Skip to content

Commit

Permalink
Add samplerate debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ringtailsoftware committed Dec 4, 2024
1 parent 63004f3 commit b5c319e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/doom/doom.zig
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var music_right: [RENDER_QUANTUM_FRAMES]f32 = undefined;
var mix_left: [RENDER_QUANTUM_FRAMES]f32 = undefined;
var mix_right: [RENDER_QUANTUM_FRAMES]f32 = undefined;
var music_leftright: [RENDER_QUANTUM_FRAMES * 2]f32 = undefined;
var sampleRate: f32 = 44100;
var sampleRate: f32 = 22050;
var synthesizer: Synthesizer = undefined;

const WIDTH = 320;
Expand Down
3 changes: 2 additions & 1 deletion src/wasmpcm.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class WasmPcm {

static async init(wasmFile, sampleRate) {
if (sampleRate) {
console.log("Configuring AudioContext sampleRate = ", sampleRate);
audioContext = new AudioContext({sampleRate:sampleRate});
} else {
audioContext = new AudioContext();
Expand All @@ -113,7 +114,6 @@ export class WasmPcm {
}).catch((err) => {
console.log(err);
});


await audioContext.audioWorklet.addModule('pcm-processor.js');

Expand All @@ -135,6 +135,7 @@ export class WasmPcm {
}

if (globalInstance.exports.setSampleRate) {
console.log("Setting synth sampleRate = ", audioContext.sampleRate);
globalInstance.exports.setSampleRate(audioContext.sampleRate);
}

Expand Down

0 comments on commit b5c319e

Please sign in to comment.