Made the record button save and restore level

bugfix-looptober-cleanup
Mike Lynch 2023-09-23 15:06:05 +10:00
parent 3ac1c3cd47
commit 3d08975c3f
1 changed files with 11 additions and 1 deletions

View File

@ -51,14 +51,24 @@ OSCdef.freeAll;
// setrecord: toggles record on (1) or off (0) for a track, and also sets the // setrecord: toggles record on (1) or off (0) for a track, and also sets the
// track's input mix to 0 so that it doesn't start fadeing out. If the track // track's input mix to 0 so that it doesn't start fadeing out. If the track
// is the currently selected track, set its touchosc control to 0. // is the currently selected track, set its touchosc control to 0.
// keeps the level for each track in an array and resets it
~mixlevel = Array.new(4);
(0..3).do({~mixlevel.add(0.25)});
~setrecord = { | track, v | ~setrecord = { | track, v |
~granulators[track].record_(v); ~granulators[track].record_(v);
[ v, track, ~tracknum ].postln; [ v, track, ~tracknum ].postln;
if(v == 0, { if(v == 0, {
~mixlevel[track] = ~granulators[track].mix;
~granulators[track].mix_(0); ~granulators[track].mix_(0);
if( track == ~tracknum, { ~to.v_('/track/mix', 0); }); },
{
~granulators[track].mix_(~mixlevel[track]);
}); });
if( track == ~tracknum, { ~to.v_('/track/mix', ~granulators[track].mix); })
}; };