iOS Core MIDI support


#1

Hi Jules,

Is CoreMIDI supported by Juce on the iOS platform ?

I just checked the Juce Demo in the simulator and it does not receive any MIDI input.
Maybe I am missing though: Not working in the simulator without tricks but works on the device.

Thanks,


#2

It’s supported in iOS, but I don’t know whether the simulator can do it.


#3

Ok. Good to know.

Will check on the device then.

Thanks,


#4

Oh no, sorry, I’m talking nonsense - the midi classes are stubs in iOS, I hadn’t finished doing them yet.


#5

So far it looks like the mac code compile on ios at least for MidiInput beside EndianS32_BtoN

I need to check on the device as so far the simulator reports 0 to MIDIGetNumberOfSources.

Waiting on the dock adapter for more testing :slight_smile:


#6

Working fine on the device. Juce Demo reports two devices: a network one and the one connected.
The only issue sems that if I enable both, it won’t receive any midi events. It works fine if I only activate the one connected.

Can’t compile MidiOutput because of missing AudioGetCurrentHostTime (or don’t know where to find it). Only thing missing.

For MidiInput, I’ve replaced only EndianS32_BtoN by a nop.


#7

Thanks, that’s interesting to hear that it works!

I think the EndianS32_BtoN call could just be replaced by ByteOrder::swapIfLittleEndian ((uint32) *pid)


#8

More on the “enable both” issue

In fact when checking the two devices in the Juce Demo’s Audio Device setup, only the first one checked works.
So the physical and the network one works both but only the one that I have checked in first will work.

Does it ring a bells ?

Unfortunately this is quite hard to debug as I can’t have a physical keyboard plugged and connected to the computer for remote debugging as the same time.

Thanks,


#9

No idea about that - it shouldn’t make any difference which ones are enabled. It sounds like a driver issue to me.


#10

took my first baby steps and got the Juce demo running on an ipad - wonderful!

but now I got stuck as well on the midi stuff I’m afraid - that is, midi devices don’t seem to show up yet in Juce
sooo, any chance of coremidi support coming to our beloved library in the near future?


#11

It’s been on the to-do-list, but sorry, haven’t had time to think about it yet!


#12

I also add the IOS CoreMIDI support on my Christmas wish list :slight_smile:


#13

Christmas before Christmas ! I followed the tips described in this thread. As I just needed one MIDI input, I could make it work with a few copy/paste.
This is really great ! For those who might be interested. I tested succesfully my App with an iRig MIDI on an iPhone 4 with a latency of 512 samples. I’ll make further test with iPad.


#14

Here’s one more vote for expanding those stubs.

In the meantime I think I’ll start working from Pete Goodliffe’s bit

But as he says somewhere in his comments, to get low latency it will be necessary to go straight into CoreMIDI, so via Juce would be a great way,
once I get a little further up the learning curve.


#15

I could go down to 64 samples on iPad modifying this part of the juce_ios_audio.cpp :

int getNumBufferSizesAvailable()
{
return 6;
}

int getBufferSizeSamples (int index)
{
    switch (index)
    {
        case 0: return 64; break;
        case 1: return 128; break;
        case 2: return 256; break;
        case 3: return 512; break;
        case 4: return 1024; break;
        case 5: return 2048; break;
        default:    return getDefaultBufferSize(); 
    }
    
}

I tried intermediate values such as 192 but my app crashed when changing to another sample size.
It works with this list. I can change the latency while juce is running without problem.


#16

[quote=“skelman”]I could go down to 64 samples on iPad modifying this part of the juce_ios_audio.cpp :

int getNumBufferSizesAvailable()
{
return 6;
}

int getBufferSizeSamples (int index)
{
    switch (index)
    {
        case 0: return 64; break;
        case 1: return 128; break;
        case 2: return 256; break;
        case 3: return 512; break;
        case 4: return 1024; break;
        case 5: return 2048; break;
        default:    return getDefaultBufferSize(); 
    }
    
}

I tried intermediate values such as 192 but my app crashed when changing to another sample size.
It works with this list. I can change the latency while juce is running without problem.[/quote]

Not sure if this belongs in this thread, but thanks for the info!


#17

arg ! You’re right. I mixed it up with another thread regarding latency that’s why I got confused.


#18

Bump.

Hi Jules,

You only to use the mac version and replace EndianS32_BtoN by ByteOrder::swapIfLittleEndian ((uint32) *pid) and it works fine.

Works fine here but just want it to be in the trunk for ease of maintenance.

Thanks,


#19

Ah sorry, it was supposed to already by in there, but I’d left it #ifdef’ed out by mistake… Will sort that.


#20

I’ve read your post about modules and downloaded some new files (modules-juce_audio_devices-juce_audio_devices.cpp, modules-juce_audio_devices-juce_module_info, modules-juce_audio_devices-midi_io-juce_MidiInput.h, modules-juce_audio_devices-midi_io-juce_MidiOutput.h, modules-juce_audio_devices-native-juce_mac_CoreMidi.cpp, extras-JuceDemo-Builds-iOS-Juce Demo.xcodeproj), but have no idea so far how to implement the changes, and first of all how to create the modules folders. Also - each module folder should contain a “module_info” file, and I only have one: modules-juce_audio_devices-juce_module_info.
What should I do to make MIDI work on iOS?
Please help!!!
:frowning: