PDA

View Full Version : Help with OSCulator Meta events



lovethedj
02-05-2011, 11:39 AM
I am in the process of creating a template for touchOSC<->OSCulator<->Traktor... Seems popular these days, huh...

Anyway, I have everything working except for the annoying way Traktor deals with MASTER deck association. Here is how it works in Traktor:

- There are 4 decks in Traktor - known as A, B, C, D
- Only one of the 4 decks can be designated as the MASTER deck at a time
- When one of the 4 decks become the MASTER deck, Traktor sends out a one-shot message to that deck only

So what I need to be able to do is to listen for this one-shot message (MIDI CC value of 127) to any of the MIDI_CC channels associated with the 4 decks, and then send the appropriate MIDI_CC messages to each deck's MASTER LED depending on which one was selected as the master.

sudo code looks like this:


#DeckA_midi_cc_num = 100
#DeckB_midi_cc_num = 101
#DeckC_midi_cc_num = 102
#DeckD_midi_cc_num = 103

wait for midi_cc message for each deck // i.e., check for a midi_CC_val of 127 on midi_cc_channel 100, 101, 102, & 103
{
// note - traktor sends a one-shot midi cc message for MASTER deck outputs -
// i.e., a 127 followed quickly by a 0 on the channel associted with the deck which was selected as master
if (MIDI_CC_val == 127)
{
// i.e. which deck triggered the midi_cc_val of 127
int midi_cc_num = midi_cc_num of deck which triggered a value of 127;

// send a midi_cc_val of 127 to Deck A if deck A triggered the value of 127, otherwise send a value of 0
midi_cc_val.deckA = (midi_cc_num == DeckA_midi_cc_num) ? 127 : 0;
// send a midi_cc_val of 127 to Deck B if deck B triggered the value of 127, otherwise send a value of 0
midi_cc_val.deckB = (midi_cc_num == DeckB_midi_cc_num) ? 127 : 0;
// send a midi_cc_val of 127 to Deck C if deck C triggered the value of 127, otherwise send a value of 0
midi_cc_val.deckC = (midi_cc_num == DeckC_midi_cc_num) ? 127 : 0;
// send a midi_cc_val of 127 to Deck D if deck D triggered the value of 127, otherwise send a value of 0
midi_cc_val.deckD = (midi_cc_num == DeckD_midi_cc_num) ? 127 : 0;
}
}

camille
02-05-2011, 06:01 PM
Hi lovethedj,

I understand that you would like to listen for 4 different MIDI CC numbers, and depending on the value, switch 1 led on and the 3 other leds off.

I am not really sure it would work, but what you could do is create 4 OSC routings for each LEDs.
Then for each received MIDI CC (/midi/cc100/1, /midi/cc101/1, /midi/cc102/1, /midi/cc103/1) message registered in OSCulator, duplicate 4 times the message and assign the 4 OSC Routings to route the value to the LEDs. Now because you want to switch on only one 1 and the other 3 off, go to the scalings page, and change the output min and max value to out min = 1.0 and out max = 1.0 for one duplicate, and set the other 3 to 0.0 / 0.0. Repeat for the other 3 MIDI CC, but choose another LED to switch on.

The only thing is that there would be no test for a value of 127, but I wonder if that is really needed.

Please let me know if that works for you.


Best,
Cam

lovethedj
02-06-2011, 11:05 AM
Thanks for the tip... I will try it out...

lovethedj
02-06-2011, 12:52 PM
So I meant to imply that the CC values go from 0 to 1.0 (not 0 to 127) - but nonetheless, I got it working... here's how:

for DeckA_midi_cc I added 2 routes:
route 1: set to trigger when value goes from 0 to positive and send a 1.0 as the argument (and delete the original arg)
route 2: set to trigger when value goes from 0 to positive and send a 0.0 as the argument (and delete the original arg)

for DeckB_midi_cc I did the opposite

Works great! Thanks!