[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] How would I send midi control changes using VoicerMIDISocket
- To: sc-users <sc-users@xxxxxxxxxxxxxxxx>
- Subject: Re: [sc-users] How would I send midi control changes using VoicerMIDISocket
- From: James Harkins <jamshark70@xxxxxxxxx>
- Date: Sun, 29 Dec 2013 10:16:27 +0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:user-agent:mime-version:message-id:in-reply-to :references:content-type:content-transfer-encoding; bh=tSNY4FeBTJn61HXYcWzianaDZ1C4ZIuIn37QlOKo7nY=; b=vVGPq0YzukHv/vdIb0idXdjsoX/tUqe203rKiaxbANVWjcFtbbyb6SpFdzyRlLwi6p eOdZfQjWJI11eBIBsFThXnLx1SgAGgTlNG7HArsqp33S7KZRAas69v+G8kqSCDrRHPxQ aCoUTbGDYvetD82hMi1QEHxn7exep8bjtDHht7DeZcxGngzmMEos51kALkV6WXkEE/cO /RaAe7COvS48yemgAKMCFy8DpKZdvXKZeeH5MsMikTN9Si5gnvb60r0cdgboyWFpVMut p88AshcDoN+/IIh/MOfDaZNjFSYLFvk+YaQdv4KkVTFKyM9iwrjmeyVs2gllE3hQZHvd i/4A==
- In-reply-to: <39667791.geXYtFXPfr@dougal>
- List-id: SuperCollider users mailing list <sc-users.create.ucsb.edu>
- References: <39667791.geXYtFXPfr@dougal>
- Reply-to: sc-users@xxxxxxxxxxxxxxxx
- Sender: owner-sc-users@xxxxxxxxxxxxxxxx
- User-agent: Trojita/v0.3.96-git; Qt/4.8.1; X11; Linux; Ubuntu 12.04.3 LTS
On Saturday, December 28, 2013 11:20:17 PM HKT, Simon Rees wrote:
I'm using a BCR2000 control surface with VoicerMIDISocket to control the
arguments to SynthDefs. Because the BCR2000 uses rotary
encoders with an LED
indicator of the current value of a control it would be handy
if I could send
MIDI control changes to the BCR2000 when the control initial
value is set in
sclang. This would mean there would be no need to 'pick up' the
control value
and I instantly be able to see the current control values on the control
surface.
Is there a way of doing this using VoicerMIDISocket? If this feature
isn't
available, does anyone have any suggestions as to how I might go about
implementing this.
This isn't VoicerMIDISocket's job. In object-oriented programming, a class
should have a clearly-defined purpose and not incorporate features that are
only tangentially related. VoicerMIDISocket receives noteOn and noteOff
messages, and forwards them to a Voicer object. It also, for convenience,
helps with mapping CCs onto global controls -- like VoicerMIDISocket, this
is unidirectional.
I think, actually, what you want to do is pick up any change of the
controller's value, from any source, and forward that to the BCR.
GenericGlobalControl broadcasts a "changed" notification every time its
value changes, and you can attach an Updater to it. (VoicerGlobalControl is
a subclass of GenericGlobalControl, and it does the same thing for value
changes.)
v = Voicer(.....);
v.mapGlobal(\pan, nil, 0, \bipolar);
k = VoicerMIDISocket(0, v);
k.addControl(10, \pan);
u = Updater(v.globalControls[\pan], { |obj, what|
if(what[\what] == \value) {
myBCR2000MidiOut.control(chan, ctl, what[\value].linlin(-1, 1, 0, 127))
}
});
No time to test this morning, but this ought to be pretty close. With this,
if you set the pan control in code, it should show up on the BCR.
You'd probably also have to send MIDI out at initialization time (when
creating the Voicer and MIDI mappings). Probably something like this:
k.ccs.do { |cc|
myBCR2000MidiOut.control(chan, cc.ccnum, cc.destination.value.linlin(-1,
1, 0, 127))
};
hjh
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/