Skip to content

Commit

Permalink
Merge pull request #1383 from MoritzBrueckner/fix-hl-samplerate
Browse files Browse the repository at this point in the history
[HL] some sample rate fixes
  • Loading branch information
RobDangerous authored Dec 22, 2021
2 parents b365be3 + c70a8cc commit ac11ec4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Backends/Kinc-HL/KoreC/kore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ extern "C" void hl_init_kore(vbyte *title, int width, int height, int samplesPer
extern "C" void hl_kore_init_audio(vclosure *callCallback, vclosure *readSample, int *outSamplesPerSecond) {
audioCallCallback = *((FN_AUDIO_CALL_CALLBACK*)(&callCallback->fun));
audioReadSample = *((FN_AUDIO_READ_SAMPLE*)(&readSample->fun));
*outSamplesPerSecond = Kore::Audio2::samplesPerSecond;
Kore::Audio2::audioCallback = mix;
Kore::Audio2::init();
*outSamplesPerSecond = Kore::Audio2::samplesPerSecond;
}

extern "C" void hl_run_kore() {
Expand Down
4 changes: 2 additions & 2 deletions Backends/Kinc-HL/kha/SystemImpl.hx
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ class SystemImpl {
var g4 = new kha.korehl.graphics4.Graphics();
framebuffer = new Framebuffer(0, null, null, g4);
framebuffer.init(new kha.graphics2.Graphics1(framebuffer), new kha.korehl.graphics4.Graphics2(framebuffer), g4);
kha.audio2.Audio._init();
kha.audio1.Audio._init();
final samplesRef: hl.Ref<Int> = kha.audio2.Audio.samplesPerSecond;
kore_init_audio(kha.audio2.Audio._callCallback, kha.audio2.Audio._readSample, samplesRef);
kha.audio2.Audio.samplesPerSecond = samplesRef.get();
kha.audio1.Audio._init();
kha.audio2.Audio._init();
keyboard = new kha.input.Keyboard();
mouse = new kha.input.MouseImpl();
pen = new kha.input.Pen();
Expand Down
2 changes: 1 addition & 1 deletion Backends/Kinc-HL/kha/audio2/Audio.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Audio {

public static function _init() {
var bufferSize = 1024 * 2;
buffer = new Buffer(bufferSize * 4, 2, 44100);
buffer = new Buffer(bufferSize * 4, 2, samplesPerSecond);
}

public static function _callCallback(samples: Int): Void {
Expand Down

0 comments on commit ac11ec4

Please sign in to comment.