Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latching scene B plays a voice on Scene A #6963

Closed
Andreya-Autumn opened this issue Apr 20, 2023 · 11 comments · Fixed by #7126
Closed

Latching scene B plays a voice on Scene A #6963

Andreya-Autumn opened this issue Apr 20, 2023 · 11 comments · Fixed by #7126
Labels
Bug Report Item submitted using the Bug Report template DSP Issues and feature requests related to sound generation in the synth
Milestone

Comments

@Andreya-Autumn
Copy link
Collaborator

Scene A has a sine osc and is monophonic
Scene B has an audio in osc from Scene A
Latching scene B should be silent, but here, it latches both scenes for some reason.

@Andreya-Autumn Andreya-Autumn added the Bug Report Item submitted using the Bug Report template label Apr 20, 2023
@mkruselj mkruselj added this to the Surge XT 1.x milestone Jun 20, 2023
@Andreya-Autumn
Copy link
Collaborator Author

Simpler repro:
Load a fresh Surge.
Set it to Dual scene mode.
In one of the scenes, turn latch on and off again.

If I latch scene A, the voice counter reads 2. Turning latch off again it does down to 1, and indeed it still makes sound. Each time I turn latch on/off, another extra voice lingers. Switching off dual doesn't end them, but switching to scene B and turning latch on/off there does.

If I latch scene B, the behavior is the same, except it doesn't stack extra voices. Each time you latch on it goes to 2, then back to 1. Switching off dual does stop them from sounding.

@mkruselj mkruselj added the DSP Issues and feature requests related to sound generation in the synth label Jul 19, 2023
@baconpaul baconpaul modified the milestones: Surge XT 1.x, Surge XT 1.3 Jul 19, 2023
@baconpaul
Copy link
Collaborator

tagging into 1.3

i bet the latch-end-voice-reaper isn't properly scene aware

@Andreya-Autumn
Copy link
Collaborator Author

An afternoon of casually building Surge from different commits I think I've found it. It appears at #6606, and only happens with the added MIDI channel-to-Scene option not engaged. I guess something about the scene channel mask code is a bit borky...

@baconpaul
Copy link
Collaborator

My guess is this state

if (release_if_latched[0])
is getting set improperly in that case (that is play a or b is wrong) and I would start with a print there

@Andreya-Autumn
Copy link
Collaborator Author

I tried looking at it, but I'm in a bit over my head as you might expect. 😅 I messed around with XCode breakpoints a little, and I think you're right PlayB stays true in some cases where it shouldn't, but discerning why is where I'm lost. Wish I could be of more help. 🙃

@baconpaul
Copy link
Collaborator

We have confirmed the diff that breaks it and the line that’s wrong. That’s 90% of the fix. I’m sure this one will now be easy to do the last 10%. Awesome bug hunting!

@baconpaul
Copy link
Collaborator

Oh also do you know about git bisect?

@Andreya-Autumn
Copy link
Collaborator Author

No! Lemme guess, it helps find a breaking commit? I should read up on that probably. :)

@baconpaul
Copy link
Collaborator

Right. The problem is entirely with the ch23 turn off thing. That basically breaks latch.

It breaks latch for an annoying reason though.

if (playA && (storage.getPatch().scene[0].polymode.val.i == pm_latch) && voices[0].empty())

there's the code which plays in latch mode. As you can see it uses 'channel 1' to mean scene A and 'channel 2' to mean scene b.

So it turns out this is also broken in 1.2.3 in MPE mode, where latch does the exact same thing.

The answer here is to add an argument to playNote for 'ignore scene' which ands onto the channel mask then pass it form that latch initiation point.

@baconpaul
Copy link
Collaborator

Ahh great and i can grab it in a regtest now. Will have this soon.

baconpaul added a commit to baconpaul/surge that referenced this issue Jul 29, 2023
In MPE or ignore-23-to-scene mode, turning one scene
on to latch would mistakenly trigger voices in the non
latched scene. Fix that but adding an intended scene optional
argument to playNote and calling it from the right place. Also
add a regtest.

Closes surge-synthesizer#6963
@baconpaul
Copy link
Collaborator

yup got it.

baconpaul added a commit that referenced this issue Jul 29, 2023
In MPE or ignore-23-to-scene mode, turning one scene
on to latch would mistakenly trigger voices in the non
latched scene. Fix that but adding an intended scene optional
argument to playNote and calling it from the right place. Also
add a regtest.

Closes #6963
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report Item submitted using the Bug Report template DSP Issues and feature requests related to sound generation in the synth
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants