MCG(int) -- MixerChannel Gui -- prNew 


It is possible to create a MixingBoard with empty MixerChannelGUIs, and then reuse the GUIs for various MixerChannels during a performance.


The advantage of this approach over adding and removing GUIs is that the empty GUIs can have consistent mappings to MIDI or other external controllers. The mixer's position onscreen relates to the control's position on the hardware device.


An empty MixingBoard may be prepared as follows. MIDI mappings are not prepared in this code, but may be established by creating instances of MixerMIDIControl(MIDIchannel, controlnumber, MCG(i).v).


~board = MixingBoard("chucking demo");

8.do({ |i|

MixerChannelGUI(nil, ~board) => MCG.prNew(i);

~board.add(MCG(i).v);

});

// insurance to make sure the board displays correctly

AppClock.sched(2, { ~board.refresh });


You may then chuck VC or BP objects into an MCG slot.


• If the Voicer's MixerChannel is stored in the VC under the ~target environment variable, the mixer will appear in the GUI. (Non-default variable names might be detected automatically.)


• If the BP's MixerChannel exists as ~chan inside the BP's Proto object, the mixer will appear.


• If the MixerChannel is stored under a different name, specify it as an adverb to chucking: =>.name



Default name for mixer


(make: {

~target = MixerChannel(\default, s, 2, 2);

Voicer(10, \default, target: ~target)

}, free: {

~target.free

}, type: \voicer) => Fact(\defaultSynth);


Fact(\defaultSynth) => VC(\default);


VC(\default) => MCG(0);


VC(\default).free; // GUI is cleared, but remains onscreen for the next mixer



Non-default name


(make: {

~mixer = MixerChannel(\default, s, 2, 2);

Voicer(10, \default, target: ~mixer)

}, free: {

~mixer.free

}, type: \voicer) => Fact(\defaultSynth);


Fact(\defaultSynth) => VC(\default);


VC(\default) =>.mixer MCG(0); // normal syntax, w/o .mixer, might also work here


VC(\default).free; // GUI is cleared