Permalink
Browse files

Allow user to specify a label

  • Loading branch information...
1 parent 881fc11 commit e53eb59b98f614265e0269d9a93f20a61cf93a3f Jonathan del Strother committed Sep 15, 2009
Showing with 14 additions and 5 deletions.
  1. +1 −1 BBOSCPlugInSender.m
  2. +1 −0 BBOSCPluginReceiver.h
  3. +12 −4 BBOSCPluginReceiver.m
View
@@ -167,7 +167,7 @@ Return NO in case of failure during the execution (this will prevent rendering o
if ([self didValueForInputKeyChange:@"inputBroadcastAddress"] || [self didValueForInputKeyChange:@"inputBroadcastPort"]) {
if (self.oscPort)
[[BBOSCManager sharedManager] removeOutput:self.oscPort];
- self.oscPort = [[BBOSCManager sharedManager] createNewOutputToAddress:self.inputBroadcastAddress atPort:self.inputBroadcastPort withLabel:@"BB OSC"];
+ self.oscPort = [[BBOSCManager sharedManager] createNewOutputToAddress:self.inputBroadcastAddress atPort:self.inputBroadcastPort withLabel:@"BB OSC Output"];
if (!self.oscPort)
NSLog(@"Failed to create output port");
inputsChanged = YES;
View
@@ -21,6 +21,7 @@
@property (nonatomic, readwrite, assign) BOOL inputDiscardExcessMessages;
@property (nonatomic, readwrite, assign) NSUInteger inputReceivingPort;
+@property (nonatomic, readwrite, assign) NSString* inputLabel;
@property (nonatomic, readwrite, assign) NSString* inputReceivingPath;
@property (nonatomic, readwrite, assign) BOOL outputError;
@property (nonatomic, readwrite, assign) BOOL outputMessageReceived;
View
@@ -24,7 +24,7 @@ @interface BBOSCPluginReceiver ()
@end
@implementation BBOSCPluginReceiver
-@dynamic inputDiscardExcessMessages, inputReceivingPort, inputReceivingPath, outputError, outputMessageReceived, outputMessagePath;
+@dynamic inputDiscardExcessMessages, inputReceivingPort, inputReceivingPath, inputLabel, outputError, outputMessageReceived, outputMessagePath;
@synthesize oscPort, oscParameters, listeningPath;
+ (NSDictionary*) attributes
@@ -53,6 +53,10 @@ Specify the optional attributes for property based ports (QCPortAttributeNameKey
return [NSDictionary dictionaryWithObjectsAndKeys:@"Receiving Path", QCPortAttributeNameKey,
@"", QCPortAttributeDefaultValueKey, nil];
}
+ if ([key isEqualToString:@"inputLabel"]) {
+ return [NSDictionary dictionaryWithObjectsAndKeys:@"OSC Label", QCPortAttributeNameKey,
+ @"", QCPortAttributeDefaultValueKey, nil];
+ }
if ([key isEqualToString:@"outputMessageReceived"]) {
return [NSDictionary dictionaryWithObjectsAndKeys:@"Message Received", QCPortAttributeNameKey, nil];
}
@@ -191,10 +195,14 @@ Return NO in case of failure during the execution (this will prevent rendering o
[messageLock unlock];
}
- if ([self didValueForInputKeyChange:@"inputReceivingPort"]) {
+ if ([self didValueForInputKeyChange:@"inputReceivingPort"]||[self didValueForInputKeyChange:@"inputLabel"]) {
if (self.oscPort)
[[BBOSCManager sharedManager] removeInput:self.oscPort];
- self.oscPort = [[BBOSCManager sharedManager] createNewInputForPort:self.inputReceivingPort withLabel:@"BB OSC"];
+
+ NSString* label = self.inputLabel;
+ if (![label length])
+ label = [NSString stringWithFormat:@"BBOSC-%u", self.inputReceivingPort];
+ self.oscPort = [[BBOSCManager sharedManager] createNewInputForPort:self.inputReceivingPort withLabel:label];
self.oscPort.delegate = self;
if (!self.oscPort)
NSLog(@"Failed to create input port");
@@ -239,7 +247,7 @@ Return NO in case of failure during the execution (this will prevent rendering o
- (void) disableExecution:(id<QCPlugInContext>)context
{
if (self.oscPort) {
- [[BBOSCManager sharedManager] removeOutput:self.oscPort];
+ [[BBOSCManager sharedManager] removeInput:self.oscPort];
self.oscPort = nil;
}
}

0 comments on commit e53eb59

Please sign in to comment.