CoreMIDI on Line6 Mobilizer and PC Networks

27 views
Skip to first unread message

Ben Kamen

unread,
Jan 7, 2013, 3:04:32 PM1/7/13
to open-music-app...@googlegroups.com
Hello, 
I've had MIDI implementation in my iOS app for awhile, and it's working fine.  I've had two reports, though, of MIDI not going through.  One is over the Network to Ableton (on a PC) and the other is using Line6 Mobilizer II.  I'm using PGMidi (Thanks!) and it finds the device, but somehow is not sending messages?  Someone on StackOverflow suggested maybe that there might be a config issue or that I am somehow not sending to the correct port.  

Looking at my code I'm wondering if there is something about MIDI over the network with PCs that is different - i.e. the .isNetworkSession BOOL doesn't return correctly on a PC session?  However, that would not explain the situation with the Line6.

Has anyone experienced anything similar to this?  Any ideas where to look? 
Thanks,
Ben


Ben Kamen

unread,
Jan 7, 2013, 3:11:49 PM1/7/13
to open-music-app...@googlegroups.com

Here's the basic MIDI send stuff (mostly straight from PGMidi) 

-(void)noteOn:(NSUInteger)voice note:(NSUInteger)note{

if(voice == 1){

    UInt8 status = 144 + (UInt8)chordMIDIChannel;
    const UInt8 noteOn[]  = { status, (UInt8)note, chordMIDIVelocity };

    if(chordMIDIDest)[chordMIDIDest sendBytes:noteOn size:sizeof(noteOn)];
    else [midi virtualPortSend:noteOn size:sizeof(noteOn)];

}else{
    UInt8 status = 144 + (UInt8)leadMIDIChannel;
    const UInt8 noteOn[]  = { status, (UInt8)note, leadMIDIVelocity };

    if(leadMIDIDest)[leadMIDIDest sendBytes:noteOn size:sizeof(noteOn)];
    else[midi virtualPortSend:noteOn size:sizeof(noteOn)];
}

}

and the PGMidiDestination send bytes:

- (void) sendBytes:(const UInt8*)bytes size:(UInt32)size
{
assert(size < 65536);
Byte packetBuffer[size+100];
MIDIPacketList *packetList = (MIDIPacketList*)packetBuffer;
MIDIPacket     *packet     = MIDIPacketListInit(packetList);
packet = MIDIPacketListAdd(packetList, sizeof(packetBuffer), packet, 0, size, bytes);

[self sendPacketList:packetList];
}

- (void) sendPacketList:(const MIDIPacketList *)packetList
{
// Send it
OSStatus s = MIDISend(midi.outputPort, endpoint, packetList);
NSLogError(s, @"Sending MIDI");
}
 
Reply all
Reply to author
Forward
0 new messages