monkeyswarm / MobMuPlat

MobMuPlat is an iOS & Android app to host PureData patches with custom visual interfaces and hardware access.
www.mobmuplat.com
Other
182 stars 25 forks source link

Other MIDI apps don't show up as MIDI devices #78

Open monkeyswarm opened 2 years ago

monkeyswarm commented 2 years ago

From a user email:

My intention was to use a pd patch (running inside MobMuPlat) to send midi commands to another app, able to synthesize the notes. I have installed many such apps (Super MIDI Box, FluidSynth MIDI, MIDI Keyboard, MIDI Controller). All of these apps are able to listen to the others (they show up their names as input and/or output midi ports) except for the MobMuPlat app, which seems odd to me.

Reinissance commented 2 years ago

Seems related to #23, it's the virual ports not working - I found the solution for MobMoPlatLink for virtualSources like that:

midi = [[PGMidi alloc] init];

midi.delegate = self; // move to init? --- yes, cut and pasted here

//init before setting virtualMidiEnabled: _connectedMidiSources = [NSMutableArray array]; _connectedMidiDestinations = [NSMutableArray array];

if TARGET_OS_MACCATALYST

  settingsVC = [[SettingsViewController alloc] initWithNibName:@"SettingsViewControllerCatalyst" bundle:nil];

else

// If iOS 5, then use non-auto-layout xib files.
if (SYSTEM_VERSION_LESS_THAN(@"6.0")) {
  settingsVC = [[SettingsViewController alloc] initWithNibName:@"SettingsViewControllerIOS5" bundle:nil];
} else if (SYSTEM_VERSION_LESS_THAN(@"11.0")) {
    settingsVC = [[SettingsViewController alloc] initWithNibName:nil bundle:nil];
    } else {
        settingsVC = [[SettingsViewController alloc] initWithNibName:@"SettingsViewController_new" bundle:nil];
}

endif

[midi setNetworkEnabled:YES]; [midi setVirtualEndpointName:@"MobMuPlatLink"]; [midi setVirtualSourceEnabled:YES]; [midi setVirtualDestinationEnabled:YES]; //I think this line was missing: [midi.virtualDestinationSource addDelegate:self];

And for virtual destinations the destination returned after setting virtualDestinations YES has to be added to the _connectedMidiDestinations array in the delegate method: