Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When you add devices and app is active it's not refreshed by MIKMIDI #120

Closed
alejandroluengo opened this issue Nov 28, 2015 · 12 comments
Closed
Assignees
Labels
Milestone

Comments

@alejandroluengo
Copy link

Hi there

I noticed the following situation when app it's running:

If I double press home button and close a virtual synth if I call [[MIKMIDIDeviceManager sharedDeviceManager] virtualDestinations] the device it's removed from MIKMIDI (great!) but if I double press home and open a new synth when I call [[MIKMIDIDeviceManager sharedDeviceManager] virtualDestinations] the new synth it's not retrieved by MIKMIDI.

The only way of getting new instruments it's by closing the app and opening again

@armadsen
Copy link
Member

Thanks for the report, @alejandroluengo. When you say "virtual synth" I presume you mean virtual endpoint (ie. MIKMIDIClientDestinationEndpoint)? I'm not sure I fully understand the issue. Is there any chance you can provide a sample project that exposes this issue? You can email it to me privately at [email protected] if need be.

@alejandroluengo
Copy link
Author

Thanks for the help, I will write you to your email now

@armadsen armadsen self-assigned this Nov 28, 2015
@armadsen armadsen added the bug label Nov 28, 2015
@armadsen armadsen added this to the 1.5.1 milestone Nov 28, 2015
@armadsen
Copy link
Member

Alejandro sent me a video that clarified this for me. The problem is that when he quits (by swiping up in the multitasking UI) an external synthesizer app, the virtual destination endpoint it presents is (correctly) removed from the array returned by MIKMIDIDeviceManager's virtualDestinations property. However, when he launches a synthesizer app while his (MIKMIDI-based) app is already running, virtualDestinations does not get updated to include the endpoint presented by the newly launched app. He has to quit and relaunch his own app for it to show up.

Presumably this is because MIKMIDIDeviceManager is either not seeing or not properly responding to a notification that the new virtual destination was created (by the other app).

@alejandroluengo
Copy link
Author

He send me a quick workaround and now it's working. He told me that he will fix it soon. Thanks for that @armadsen

@0Dmitry
Copy link
Contributor

0Dmitry commented Dec 10, 2015

Hi, I have the same problem. Can you tell me what is the workaround for this?

@armadsen
Copy link
Member

Hi @akmidd: The workaround I provided to @alejandroluengo was:

At the top of your source file create a category to trick the compiler into letting you call a private method:

@interface MIKMIDIDeviceManager (Private)
- (void)retrieveVirtualEndpoints; // Just to make the compiler let us call this "private" method
@end

Then, before you call -virtualDestinations to get the virtual destinations:

[deviceManager retrieveVirtualEndpoints]; // This should force MIKMIDIDeviceManager to update its list.

I do still intend to fix this for real, of course.

@0Dmitry
Copy link
Contributor

0Dmitry commented Dec 10, 2015

Thanks. It works now.

@armadsen
Copy link
Member

You could just do deviceManager.performSelector("retrieveVirtualEndpoints") in Swift. It's a little gross, but this should only be a temporary workaround until this bug is fixed.

@armadsen armadsen modified the milestones: 1.6, 1.5.1 Mar 8, 2016
@armadsen armadsen modified the milestones: 1.7, 1.6 Jun 1, 2016
@akoszegi
Copy link

It looks like deviceManager.performSelector("retrieveVirtualEndpoints") doesn't work in Swift 3. Do you have any suggestions?

@armadsen
Copy link
Member

@akoszegi: The following should work:

deviceManager.perform(Selector(stringLiteral: "retrieveVirtualEndpoints"))

Note that it will provoke a warning ("No method declared with Objective-C selector 'retrieveVirtualEndpoints'"), but it will work fine.

Still need to fix this in MIKMIDI...

@akoszegi
Copy link

Thanks! That worked.

@armadsen
Copy link
Member

Should be fixed by #210.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants