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

Global keytrack modulators (lowest/highest/latest note) #2352

Closed
mkruselj opened this issue Jul 14, 2020 · 4 comments
Closed

Global keytrack modulators (lowest/highest/latest note) #2352

mkruselj opened this issue Jul 14, 2020 · 4 comments
Labels
Feature Request New feature request Modulation Modulation related issues
Milestone

Comments

@mkruselj
Copy link
Collaborator

mkruselj commented Jul 14, 2020

Keyboard tracking is a per-voice thing, however it could very well be extrapolated into a global modulator by offering variations that only track lowest, highest or latest note played from the keyboard. This way, key position (at least in this rudimentary manner) can be used to modulate effects parameters.

The way it could be implemented is similar to release velocity - through a RMB context menu on the mod tab for keytrack.

keystuff

@mkruselj mkruselj added Feature Request New feature request Modulation Modulation related issues labels Jul 14, 2020
@mkruselj mkruselj added this to the 1.7.n milestone Jul 14, 2020
@mkruselj mkruselj added the Code Hints Requested Someone would like to tackle this but wants a few pointers on how to start label Aug 18, 2020
@baconpaul
Copy link
Collaborator

So there's two parts to this

Part one is adding that menu and the property. Really easy

Part two is swapping something from a voice modulator to a scene modulator. That is something we don't do anywhere else. The data structures for the modulation are separate and the place in which they are evaluated is separate. In a way you want this to be a 'different modulator' and that modulator is a scene modulator, which is some pretty substantial surgery which is why i've left this here.

but if you follow the way release velocity works, generalize it to more than 'one alternate', have that alternate set of modulators be scene not voice modulators in the Modulator info, it will all work. That's the plan of attack, basically. Don't make keytrack have 4 modes, but have 4 separate modulators ("vkeytrack, skeytrack low, skeytrackhigh, and skeytracklatest") then treat that menu as a modulator swapper and build those modulators properly.

Also you would have to do the work of updating those modulators on keypress and also handle release events. Probably best to just scan the voices when you get a noteon or off but remember to do that in a scene aware way. basically if voice->gate == true are the voices you want.

Also you would need to decide what value the modulator keeps when all notes are off.

So a bit of a tricky one but those are the hints. Lemme know if you need more to start.

@mkruselj mkruselj removed the Code Hints Requested Someone would like to tackle this but wants a few pointers on how to start label Aug 20, 2020
@baconpaul
Copy link
Collaborator

OK so the implementation of the modulators in your branch is correct but the implementation of the alternate state causes all sorts of problems. The reason it causes problems is because SurgeGUIEditor has a member 'mod source' which is used both to indicate the current modulator and also to index into the gui_modsources array so it has to be only for mod sources with buttons. If you naively set mod source to ms_keytracklow then you get a core dump looking at the GUI object; if you leave it set as keytrack you get scene/voice confusion.

So what we need to do is move the 'has an alternate' out of the CModulationSourceButton object (which is transient) and put it as a permanent feature of SurgeGUIEditor (which is long lived). Then go and fix up things. Here's what I would do

  1. Remove the alternate stuff from CModulationSource pretty much completely.
  2. Add to SurgeGUIEditor the following methods: hasAlternatesForRootModulationSource( mod source ) countAlternatesForRootModulationSource( mod source ) addAlternateForRootModulationSource( mod source, additional mod source, name ), selectAlternateForRootModulationSource( mod source, newmodsource ) and getAlternateForRootModulationSource( ms ) and have the last one return the root modulation source if there are no alternates (so if size of alternates is zero etc...). The data structure you probably want for this is std::map<int, std::vector<int>>.
  3. Then you go ahead and in the SurgeGUIEditor constructor do things like
    addAlternateForRootModulationSource( ms_velocity, ms_releasevelocity, "Release Velocity" ). Do that once there.
  4. Then everywhere you were doing cms->hasALternate use these new APIs instead.
  5. Then critically in the openOrRecreateEditor everywhere we call synth->isValidModulation( p, ms ) replace that with synth->isValidModulation( p, getAlternateForRootModulationSource( ms ) )

@mkruselj
Copy link
Collaborator Author

mkruselj commented Aug 20, 2020

Note to self:

The data structure you probably want for this is std::map<int, std::vector<int>>.

int is root modulator, std::vector<int> is list of alternate modulators.

@mkruselj
Copy link
Collaborator Author

This is now implemented without modulator alternates, by PR #2674.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New feature request Modulation Modulation related issues
Projects
None yet
Development

No branches or pull requests

2 participants