Fix #2920: Python sfx() ignores note/octave/speed from SFX editor#2963
Open
joshgoebel wants to merge 1 commit into
Open
Fix #2920: Python sfx() ignores note/octave/speed from SFX editor#2963joshgoebel wants to merge 1 commit into
joshgoebel wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2920
What
The Python
sfx()binding never read the stored note, octave, or speed from the SFX sample data. When called assfx(0)(no note specified), it computednote = -1 % 12 = -1andoctave = -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, andeffect->speedfromtic->ram->sfx.samples.dataas defaults before applying any user-provided overrides.Also changes
speed's default sentinel from0to-1(matchingnote/duration) so the effect's stored speed is used when not explicitly specified.