tim-janik / anklang

MIDI and Audio Synthesizer and Composer
https://anklang.testbit.eu/
Mozilla Public License 2.0
51 stars 3 forks source link

Support mute/solo/volume for tracks #19

Open swesterfeld opened 9 months ago

swesterfeld commented 9 months ago

This is my first attempt to implement mute/solo/volume support for tracks.

What is good:

What is incomplete:

Other issues:

Right now the mute/solo/volume interface between the UI and core is done by adding methods to the track. However, these values should support automation in the future. So these values really looks like AudioProcessor parameters. These have a minimum, maximum, default, non-linear mapping between UI values and actual DSP values, the ability to enter a value directly, and these are serialized automatically by the framework. However, as far as I can see Track is not an AudioProcessor, so I cannot make these parameters here.

Btw, panning isn't implemented yet because we don't have a mixer view, it should be added once we have that.

swesterfeld commented 8 months ago

Update: I've now implemented my first lit element for the track volume. The goal was not to be ultra generic here, but learning how to implement it. With this change we now have a volume slider that works. There is some duplicated code between knob.js and the new trackvolume.js for drag / pointer grab support

swesterfeld commented 7 months ago

Update: I've now migrated the PR to use Track properties instead of Track methods for mute / solo / volume. To support automation in the future, the properties that do support automation (mute and volume) are now part of the AudioProcessor and no longer part of the Track, so these can receive messages while playing. Its not sample accurate yet, but this should be fairly easy to add later on.

The solo logic is a bit tricky because to know whether a track is muted or not, the track needs its own mute state, but also the information whether another track is solo, so this has kind of global state. Since we don't need to automate solo, I can compute the solo state is the non-RT code.

Everything works as far as I can see. The trackvolume.js file has duplicated code with knob.js, this should be moved elsewhere. Other than that, let me know if you see something that you'd like to be improved for merging the PR.