On Jul 23, 2009, at 10:15 AM, Dan Stowell wrote:
The behavior you're seeing is because the pitch bend control routing over to scsynth is part of the Voicer, not the proxy or the MIDI socket. When you call addControl on the MIDI socket, it creates a Voicer MIDI Control object to pick up the MIDI messages and also creates a global control for pitch bend in the Voicer object. Then, when you replace the proxy's referent with a brand-new Voicer, the new Voicer doesn't have the global control. The MIDI socket will still pick up the pitch bend messages, but the voicer doesn't know how to translate that over to the server. .gui-ing the proxy illustrates this more clearly. A better workflow would be to create the two voicers in advance and manually add the pitch bend global control to each (Voicer:mapGlobal). Then you can alternate between the two in the proxy. (By the way, generally it's a good idea to free a voicer before discarding it, in case it allocated control buses or other resources.) This seems to work: s.boot; v = VoicerProxy.new; v.gui; // Establishes VoicerMIDISocket: ~vmidisock = VoicerMIDISocket(14, v); ( ~defName = { |synthdefname = 'harpsi'| if(v.voicer.notNil){ v.voicer.releaseAll; }; Voicer.new(12, synthdefname, bus:Bus.new); } ) // Creates voicer: ~v1 = ~defName.(); ~v2 = ~defName.('xylo_v'); [~v1, ~v2].do { |vc| vc.mapGlobal(\pb, nil, 1, [3.midiratio.reciprocal, 3.midiratio, \exp]); }; v.voicer = ~v1; // note, this does not create or overwrite the \pb controls created just above // if the global control already exists, it just points to the existing one ~vmidisock.addControl(\pb, \pb, 1, 3);// 3-semitone bend // the VoicerMIDIControl actually points to a VoicerGCProxy; // this also swaps ~v2's global control into the gcproxy, // automatically remapping the MIDI control v.voicer = ~v2; hjh : H. James Harkins .::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..: "Come said the Muse, Sing me a song no poet has yet chanted, Sing me the universal." -- Whitman |