Fix S*RAM, Sim.setVolume
This commit is contained in:
parent
26a0357afa
commit
8b9152dde9
|
@ -295,7 +295,7 @@ static void vsuWriteLRV(VB *sim, int index, uint8_t value) {
|
|||
|
||||
/* Write a value to S*RAM */
|
||||
static void vsuWriteRAM(VB *sim, int index, uint8_t value) {
|
||||
sim->vsu.channels[index].wave.wave = value & 15;
|
||||
sim->vsu.channels[index].wave.wave = value & 7;
|
||||
}
|
||||
|
||||
/* Write a value to S5SWP */
|
||||
|
|
|
@ -417,8 +417,9 @@ new class Core {
|
|||
for (let x = 0; x < buffer.length; x++)
|
||||
buffer[x] = Math.min(Math.max(-1, buffer[x]), +1);
|
||||
} else {
|
||||
let sim = this.automatic.sims[0];
|
||||
for (let x = 0; x < buffer.length; x++)
|
||||
buffer[x] = this.automatic.sims[0].samples[x];
|
||||
buffer[x] = sim.samples[x] * sim.volume;
|
||||
}
|
||||
this.audio.postMessage(buffer.buffer, [ buffer.buffer ]);
|
||||
|
||||
|
|
|
@ -495,8 +495,10 @@ class Sim extends HTMLElement {
|
|||
async setVolume(volume) {
|
||||
|
||||
// Error checking
|
||||
if (!Number.isFinite(volume) ||volume < 0 || volume > 1)
|
||||
throw new RangeError("Volume must be a number from 0 to 1.");
|
||||
if (!Number.isFinite(volume) ||volume < 0 || volume > 10) {
|
||||
throw new RangeError(
|
||||
"Volume must be a number from 0\u00d7 to 10\u00d7.");
|
||||
}
|
||||
|
||||
// Configure instance fields
|
||||
this.#volume = volume;
|
||||
|
|
Loading…
Reference in New Issue