Skip to content

Fix #2920: Python sfx() ignores note/octave/speed from SFX editor#2963

Open
joshgoebel wants to merge 1 commit into
nesbox:mainfrom
joshgoebel:fix-2920-python-sfx-note-default
Open

Fix #2920: Python sfx() ignores note/octave/speed from SFX editor#2963
joshgoebel wants to merge 1 commit into
nesbox:mainfrom
joshgoebel:fix-2920-python-sfx-note-default

Conversation

@joshgoebel

Copy link
Copy Markdown
Collaborator

Closes #2920

What

The Python sfx() binding never read the stored note, octave, or speed from the SFX sample data. When called as sfx(0) (no note specified), it computed note = -1 % 12 = -1 and octave = -1 / 12 = 0, causing playback at C-1 regardless of what's set in the SFX tab. All other language bindings (Lua, JS, Wren, etc.) work correctly because they read from the sample data first.

Fix

Mirrors the Lua binding: read effect->note, effect->octave, and effect->speed from tic->ram->sfx.samples.data as defaults before applying any user-provided overrides.

Also changes speed's default sentinel from 0 to -1 (matching note/duration) so the effect's stored speed is used when not explicitly specified.

The Python sfx() binding never read the stored note, octave, or speed
from the SFX sample data. When called without a note (sfx(0)), it
computed note = -1 % 12 = -1 and octave = -1 / 12 = 0, which caused
playback at C-1 instead of the note configured in the SFX editor.

Fix by mirroring the Lua binding: read effect->note, effect->octave,
and effect->speed from tic->ram->sfx.samples.data as defaults before
applying any user-provided overrides. Also change speed's default
sentinel from 0 to -1 (matching note/duration) so the effect's stored
speed is used when not explicitly specified.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants