asie vor 1 Monat
Ursprung
Commit
41f3c3947e
4 geänderte Dateien mit 15 neuen und 15 gelöschten Zeilen
  1. 1
    1
      src/audio_stream.c
  2. 4
    4
      src/emscripten_glue.js
  3. 6
    6
      web/src/audio.js
  4. 4
    4
      web/src/emulator.js

+ 1
- 1
src/audio_stream.c Datei anzeigen

@@ -22,7 +22,7 @@
#include <string.h>
#include "audio_stream.h"

#define AUDIO_STREAM_DEBUG
// #define AUDIO_STREAM_DEBUG

typedef struct {
u8 enabled;

+ 4
- 4
src/emscripten_glue.js Datei anzeigen

@@ -35,11 +35,11 @@ mergeInto(LibraryManager.library, {
zeta_update_palette: function(data_ptr) {
return zetag_update_palette(data_ptr);
},
speaker_on: function(freq) {
speakerg_on(freq);
speaker_on: function(cycles, freq) {
speakerg_on(cycles, freq);
},
speaker_off: function() {
speakerg_off();
speaker_off: function(cycles) {
speakerg_off(cycles);
}
});


+ 6
- 6
web/src/audio.js Datei anzeigen

@@ -44,7 +44,7 @@ export class OscillatorBasedAudio {
this.noteDelay = 1;
}

on(time, freq) {
on(time, cycles, freq) {
if (audioCtx == undefined)
return;

@@ -73,7 +73,7 @@ export class OscillatorBasedAudio {
this.timeSpeakerOn = time;
}

off(time) {
off(time, cycles) {
if (this.pc_speaker == undefined)
return;

@@ -179,14 +179,14 @@ export class BufferBasedAudio {
}
}

on(time, freq) {
on(time, cycles, freq) {
if (audioCtx == undefined) return;
this._initSpeaker();
this.emu._audio_stream_append_on(time, freq);
this.emu._audio_stream_append_on(time, cycles, freq);
}

off(time) {
off(time, cycles) {
if (audioCtx == undefined) return;
this.emu._audio_stream_append_off(time);
this.emu._audio_stream_append_off(time, cycles);
}
}

+ 4
- 4
web/src/emulator.js Datei anzeigen

@@ -69,17 +69,17 @@ class Emulator {
render.setPalette(data);
}

window.speakerg_on = function(freq) {
window.speakerg_on = function(cycles, freq) {
if (!document.hasFocus()) {
speakerg_off();
return;
}

if (audio != undefined) audio.on(self.time_ms_cached, freq);
if (audio != undefined) audio.on(self.time_ms_cached, cycles, freq);
}

window.speakerg_off = function() {
if (audio != undefined) audio.off(self.time_ms_cached);
window.speakerg_off = function(cycles) {
if (audio != undefined) audio.off(self.time_ms_cached, cycles);
}

window.addEventListener("message", function(event) {

Laden…
Abbrechen
Speichern