Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HL] some sample rate fixes #1383

Merged
merged 2 commits into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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