forked from jdelStrother/BBOSC
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add our own osc in-port type to handle multiple delegates
- Loading branch information
Jonathan del Strother
authored and
Jonathan del Strother
committed
Sep 16, 2009
1 parent
141de93
commit 5d750a6
Showing
7 changed files
with
101 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// BBOSCInPort.h | ||
// BBOSC | ||
// | ||
// Created by Jonathan del Strother on 16/09/2009. | ||
// Copyright 2009 Best Before Media Ltd. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
// This is a basic wrapper around OSCInPort, with the addition of handling multiple delegates | ||
|
||
@class OSCInPort, OSCManager; | ||
@interface BBOSCInPort : NSObject { | ||
OSCManager* oscManager; | ||
OSCInPort* oscPort; | ||
NSMutableSet* delegates; | ||
} | ||
-(id)initWithManager:(OSCManager*)manager withPort:(unsigned int)p label:(NSString*)l; | ||
-(void)addDelegate:(id)delegate; | ||
-(void)removeDelegate:(id)delegate; | ||
-(unsigned short)port; | ||
-(NSString*)portLabel; | ||
-(void)remove; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// BBOSCInPort.m | ||
// BBOSC | ||
// | ||
// Created by Jonathan del Strother on 16/09/2009. | ||
// Copyright 2009 Best Before Media Ltd. All rights reserved. | ||
// | ||
|
||
#import "BBOSCInPort.h" | ||
#import "OSCExtensions.h" | ||
|
||
@implementation BBOSCInPort | ||
-(id)initWithManager:(OSCManager*)manager withPort:(unsigned int)p label:(NSString*)l { | ||
if (self = [super init]) { | ||
oscManager = [manager retain]; | ||
oscPort = [[oscManager createNewInputForPort:p withLabel:l] retain]; | ||
oscPort.delegate = self; | ||
delegates = [[NSMutableSet alloc] init]; | ||
} | ||
return self; | ||
} | ||
-(void)dealloc { | ||
[oscManager release]; | ||
[oscPort release]; | ||
[delegates release]; | ||
[super dealloc]; | ||
} | ||
-(void)addDelegate:(id)delegate { | ||
[delegates addObject:delegate]; | ||
} | ||
-(void)removeDelegate:(id)delegate { | ||
[delegates removeObject:delegate]; | ||
} | ||
- (unsigned short) port { | ||
return [oscPort port]; | ||
} | ||
- (NSString *) portLabel { | ||
return [oscPort portLabel]; | ||
} | ||
-(void)remove { | ||
[oscManager removeInput:oscPort]; | ||
} | ||
|
||
- (void) receivedOSCMessage:(OSCMessage *)m { | ||
[delegates makeObjectsPerformSelector:@selector(receivedOSCMessage:) withObject:m]; | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters