mirror of
https://github.com/storytold/soundcraft.git
synced 2026-11-01 14:36:50 -06:00
There was no way to change a clip's gain from the UI (#2): clip gain is stored, drawn and settable through `clip.gain`, but no menu item, key or gesture reached it. This adds the two ways Pro Tools offers. Keyboard: Pro Tools nudges the selected clips' gain with Control+Shift+Up/Down, 1 dB a step by default. Two new commands, Nudge Clip Gain Up and Down, do the same through `clip.gain`'s relative `delta_db`, so its -144..+36 dB range holds and each nudge is one undo step. Control+Up/Down extended the edit selection whether or not Shift was held, which swallowed the new keys; it now leaves the Shift variants to the command registry. Fader: in Pro Tools, Clip Gain Info puts a fader icon and the gain value in the bottom-left of each clip, and pressing the icon pops up a small fader. With View > Clip > Clip Gain Info on, or once a clip has gain, audio clips now show the icon and the value, and dragging the icon moves the clip's gain from -144 to +36 dB (Cmd for fine moves), one undo step per drag. The icon is drawn in code. The fader follows the pointer from where it was pressed rather than adding up per-frame deltas, which lose the first few pixels while egui decides between a click and a drag and leave the fader out of step with the pointer once it hits an end (it would stick, then jump). Clip Gain Info no longer depends on Clip Gain Line being shown, since the two are separate views in Pro Tools, and the value moved from the clip's bottom-right to beside the icon. Dragging the icon of a clip when nothing is selected selects that clip first, because `clip.gain` needs a selection.