Skip to content

Commit

Permalink
Merge pull request #145 from jrmaxdev/master
Browse files Browse the repository at this point in the history
fixes adding virtual sources and destinations
  • Loading branch information
armadsen committed Mar 19, 2016
2 parents 7671d1d + 6163598 commit 8ea5afe
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions Source/MIKMIDIDeviceManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,10 @@ - (NSArray *)virtualSources { return [self.internalVirtualSources copy]; }

- (void)addInternalVirtualSourcesObject:(MIKMIDISourceEndpoint *)source
{
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"];
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"];
}

- (void)removeInternalVirtualSourcesObject:(MIKMIDISourceEndpoint *)source
Expand All @@ -403,11 +402,10 @@ - (NSArray *)virtualDestinations { return [self.internalVirtualDestinations copy

- (void)addInternalVirtualDestinationsObject:(MIKMIDIDestinationEndpoint *)destination
{
NSUInteger index = [self.internalVirtualDestinations indexOfObject:destination];
if (index == NSNotFound) return;
[self willChange:NSKeyValueChangeRemoval valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:@"virtualDestinations"];
[self.internalVirtualDestinations removeObjectAtIndex:index];
[self didChange:NSKeyValueChangeRemoval valuesAtIndexes:[NSIndexSet indexSetWithIndex:index] forKey:@"virtualDestinations"];
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"];
}

- (void)removeInternalVirtualDestinationsObject:(MIKMIDIDestinationEndpoint *)destination
Expand Down

0 comments on commit 8ea5afe

Please sign in to comment.