Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make the receiver patch a direct delegate of the port

No more receiving messages from different ports
  • Loading branch information...
commit 8cb4e9864c8948ec24e62a44099a39bc5379bed8 1 parent 7a4ee57
Jonathan del Strother authored
Showing with 1 addition and 25 deletions.
  1. +0 −4 BBOSCManager.h
  2. +0 −19 BBOSCManager.m
  3. +1 −2  BBOSCPluginReceiver.m
4 BBOSCManager.h
View
@@ -10,13 +10,9 @@
@class OSCManager, OSCInPort, OSCOutPort;
@interface BBOSCManager : NSObject {
- NSMutableArray* delegates;
OSCManager* oscManager;
- NSLock* delegateLock;
}
+(id)sharedManager;
--(void)addDelegate:(id)delegate;
--(void)removeDelegate:(id)delegate;
- (OSCInPort*)createNewInputForPort:(int)p withLabel:(NSString *)l;
- (OSCOutPort*)createNewOutputToAddress:(NSString *)a atPort:(int)p withLabel:(NSString *)l;
19 BBOSCManager.m
View
@@ -54,29 +54,10 @@ -(id)init {
if (self = [super init]) {
oscManager = [[OSCManager alloc] init];
oscManager.delegate = self;
- delegates = [[NSMutableArray alloc] init];
- delegateLock = [[NSLock alloc] init];
}
return self;
}
--(void)addDelegate:(id)delegate {
- [delegateLock lock];
- [delegates addObject:delegate];
- [delegateLock unlock];
-}
--(void)removeDelegate:(id)delegate {
- [delegateLock lock];
- [delegates removeObject:delegate];
- [delegateLock unlock];
-}
-
-- (void) receivedOSCMessage:(OSCMessage *)m {
- [delegateLock lock];
- [delegates makeObjectsPerformSelector:@selector(receivedOSCMessage:) withObject:m];
- [delegateLock unlock];
-}
-
- (OSCInPort *) createNewInputForPort:(int)p withLabel:(NSString *)l {
return [oscManager createNewInputForPort:p withLabel:l];
}
3  BBOSCPluginReceiver.m
View
@@ -81,7 +81,6 @@ + (QCPlugInTimeMode) timeMode
- (id) init
{
if(self = [super init]) {
- [[BBOSCManager sharedManager] addDelegate:self];
self.oscParameters = [NSArray array];
messages = [[NSMutableArray alloc] init];
messageLock = [[NSLock alloc] init];
@@ -102,7 +101,6 @@ - (void) finalize
- (void) dealloc
{
- [[BBOSCManager sharedManager] removeDelegate:self];
[oscPort release];
[messages release];
[messageLock release];
@@ -194,6 +192,7 @@ Return NO in case of failure during the execution (this will prevent rendering o
if (self.oscPort)
[[BBOSCManager sharedManager] removeInput:self.oscPort];
self.oscPort = [[BBOSCManager sharedManager] createNewInputForPort:self.inputReceivingPort withLabel:@"BB OSC"];
+ self.oscPort.delegate = self;
if (!self.oscPort)
NSLog(@"Failed to created input port");
}
Please sign in to comment.
Something went wrong with that request. Please try again.