mrRay / vvopensource

OSC and MIDI frameworks for OS X and iOS, a framework for managing and rendering to GL textures in OS X, and a functional ISF (interactive shader format) implementation for OS X.
231 stars 33 forks source link

SysEx examples #22

Closed PusherLabs closed 8 years ago

PusherLabs commented 8 years ago

Can you point me toward any SysEx (sending) examples or sample code?

mrRay commented 8 years ago

howdy-

just pushed a small addition to VVMIDIMessage that will hopefully make it easier to work with sysex data:

uint8_t         sysexVals[] = {0x00, 0x01, 0x02, 0x03};
NSData          *sysexData = [NSData dataWithBytes:sysexVals length:4];
VVMIDIMessage   *sysexMsg = [VVMIDIMessage createWithSysexData:sysexData];
[outputNode sendMsg:sysexMsg];
PusherLabs commented 8 years ago

I came up with some working code just prior to your response:

VVMIDIMessage   *sysexMsg = nil;
NSMutableArray  *sysexArray = [[NSMutableArray alloc] initWithCapacity: 0];;
char sysexDump[] = {0xF0, 0x00, ... etc.};

for (int i = 1; i < x; i++) {
     [sysexArray addObject:[NSNumber numberWithChar:sysexDump[i]]];
}
sysexMsg = [VVMIDIMessage createWithSysexArray:sysexArray];
[midiManager sendMsg:sysexMsg];

Before you ask, sysexDump[] contains a whole series of dumps, that I can cherry-pick and send individually, so I'm picking out sections between the 0xF0 and 0xF7 delimiters.

But now I have a question. Is there any advantage to sending data to a valid Node versus just using VVMIDIManager as I have above?

mrRay commented 8 years ago

But now I have a question. Is there any advantage to sending data to a valid Node versus just using VVMIDIManager as I have above?

nah- sending it to the manager just sends it to more places (all destination nodes + the manager's built-in virtual node)

PusherLabs commented 8 years ago

Thanks man!