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

InstrumentSoundShaping refactoring #7229

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

michaelgregorius
Copy link
Contributor

@michaelgregorius michaelgregorius commented Apr 27, 2024

Accessors for volume, cutoff, resonance

Add accessors for the volume, cutoff and resonance parameters (envelope and LFO). Use references instead of pointers.

This makes the code less technical and more readable as it for example removes lots of static casts. The casts are now done in a special helper method that returns the parameters for a given target.

Remove EnvelopeAndLfoParameters array

Remove the EnvelopeAndLfoParameters array and use explicit instances for volume, cutoff, resonance. This simplifies construction and initialization of the instances.

Besides the array this also removes the Target enum and the NumTargets value.

To simplify storage and retrieval of the parameters three private methods have been added which provide the node names of the volume, cutoff and resonance parameters.

Adjust InstrumentSoundShapingView to the removed NumTargets property.

Remove friend relationship

Remove the friend relationship between InstrumentSoundShaping and InstrumentSoundShapingView by providing the models via getters.

Fix memory leak

This pull request also removes a memory leak because the InstrumentSoundShaping has no explicit destructor and it therefore has never deleted the EnvelopeAndLfoParameters instances that it instantiated in its constructor.

Add private accessors for the volume, cutoff and resonance parameters (envelope and LFO).

This makes the code less technical and more readable as it for example removes lots of static casts. The casts are now done in a special helper method that returns the parameters for a given target.
Remove the `EnvelopeAndLfoParameters` array and use explicit instances for volume, cutoff, resonance. This simplifies construction and initialization of the instances.

Besides the array this also removes the `Target` enum and the `NumTargets` value.

To simplify storage and retrieval of the parameters three private methods have been added which provide the node names of the volume, cutoff and resonance parameters.

Adjust `InstrumentSoundShapingView` to the removed `NumTargets` property.
Use references to the volume, cutoff and resonance parameters instead of pointers.
Remove the friend relationship between `InstrumentSoundShaping` and its related view by providing the models via getters.
Get rid of `InstrumentSoundShaping::targetNames` by using translations and strings directly. Move the remaining stuff into `InstrumentSoundShapingView` until it is removed there as well.
Remove the array of EnvelopeAndLfoViews and use dedicated instances instead.

This also enables the final removal of the remaining `targetNames`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant