Skip to content
Merged
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
8 changes: 7 additions & 1 deletion packages/player/src/generators/GbaDirectSound.tish
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,15 @@ fn getGbaBuffer(ctx, shape, duty) {
} else if (shape === "triangle") {
v = phase < 0.5 ? (phase * 4.0 - 1.0) : (3.0 - phase * 4.0)
} else if (shape === "square") {
// `square` names a 50% wave, so it ignores `duty` on purpose — on both sides.
v = phase < 0.5 ? 1.0 : -1.0
} else {
} else if (shape === "sine") {
v = Math.sin(phase * Math.PI * 2)
} else {
// An unrecognised name is a pulse, not a sine. `pulse` is already the default for an absent
// `waveform`, and the GBA bake's catch-all arm is a pulse too (deckpack.rs `pcm_table`), so a
// sine here meant `waveform bogus` sounded one way in the browser and another in the ROM.
v = phase < dThresh ? 1.0 : -1.0
}
data[i] = v
i = i + 1
Expand Down
Loading