Skip to content

Commit

Permalink
[HL] Use system sample rate for audio buffers to fix wrong playback s…
Browse files Browse the repository at this point in the history
…peeds
  • Loading branch information
MoritzBrueckner committed Dec 21, 2021
1 parent b0f7017 commit c70a8cc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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 c70a8cc

Please sign in to comment.