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

Bug in MIKMIDIDeviceManager #144

Closed
jrmaxdev opened this issue Mar 19, 2016 · 2 comments
Closed

Bug in MIKMIDIDeviceManager #144

jrmaxdev opened this issue Mar 19, 2016 · 2 comments
Labels
Milestone

Comments

@jrmaxdev
Copy link

I found a bug in MIKMIDIDeviceManager.

When virtual sources or destinations are discovered and the app is already running these endpoints are not added to the internal virtual endpoint lists.

It seems to me as if the methods that should add the endpoints have a method body copied from the respective removal methods.

The methods
- (void)addInternalVirtualSourcesObject:(MIKMIDISourceEndpoint *)source
and
- (void)addInternalVirtualDestinationsObject:(MIKMIDIDestinationEndpoint *)destination
do not add endpoints they would instead remove the endpoints if they were to be found.

This is the method body for addInternalVirtualSourcesObject:

NSUInteger index = [self.internalVirtualSources indexOfObject:source]; if (index == NSNotFound) return; [self willChange:NSKeyValueChangeRemoval valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:@"virtualSources"]; [self.internalVirtualSources removeObjectAtIndex:index]; [self didChange:NSKeyValueChangeRemoval valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:@"virtualSources"];

It should be:

NSUInteger index = [self.internalVirtualSources count]; [self willChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:@"virtualSources"]; [self.internalVirtualSources insertObject:source atIndex:index]; [self didChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:@"virtualSources"];

The method body for addInternalVirtualDestinationsObject should be:

NSUInteger index = [self.internalVirtualDestinations count]; [self willChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:@"virtualDestinations"]; [self.internalVirtualDestinations insertObject:destination atIndex:index]; [self didChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:@"virtualDestinations"];

When I change the code in this way adding virtual endpoints works as expected.

Jan

@armadsen
Copy link
Member

Hi Jan, thanks for reporting this. That is certainly a bug! I'd be happy to accept a pull request if you'd like to fix it and submit one. Otherwise, I'll get this fixed shortly.

@armadsen armadsen added the bug label Mar 19, 2016
@armadsen armadsen added this to the 1.5.1 milestone Mar 19, 2016
@armadsen
Copy link
Member

Fixed by #145.

@armadsen armadsen modified the milestones: 1.5.1, 1.6 Jun 1, 2016
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

2 participants