midi.config.add_synth now subsumes add_synth_object. #453
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.
Originally we had
midi.config.add_synth()
which took a patch number and voices count.Then we created the
Synth()
object which handled the patch number. Butadd_synth
called it.Then we added
add_synth_object
so you could construct your ownSynth
object and add it to MIDI.But users were confused about how synths were created since
midi.config.add_synth()
was doing it for them.This change alters
midi.config.add_synth()
to accept aSynth
object, and to prefer that pattern. This makes it obvious to the user thatSynth
objects are the core concept.The problem here, I realize, is that in order to manage the limited
voices
resources, it's best torelease
any existing synth before creating the newSynth
object. However, if theSynth
is passed as an instantiated object it will already have grabbed its voices. Maybe we can fix with some kind of deferred initialization in theSynth
object.