Skip to content

Commit

Permalink
Broadcast to specific ip addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan del Strother authored and Jonathan del Strother committed Sep 10, 2009
1 parent eafedba commit 908759a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions BBOSCPlugInSender.h
Expand Up @@ -15,6 +15,7 @@
@property (nonatomic, readonly, retain) OSCOutPort *oscPort; @property (nonatomic, readonly, retain) OSCOutPort *oscPort;
@property (nonatomic, readonly, retain) NSArray* oscParameters; @property (nonatomic, readonly, retain) NSArray* oscParameters;


@property (nonatomic, readwrite, assign) NSString* inputBroadcastAddress;
@property (nonatomic, readwrite, assign) NSUInteger inputBroadcastPort; @property (nonatomic, readwrite, assign) NSUInteger inputBroadcastPort;
@property (nonatomic, readwrite, assign) NSString* inputBroadcastPath; @property (nonatomic, readwrite, assign) NSString* inputBroadcastPath;


Expand Down
10 changes: 7 additions & 3 deletions BBOSCPlugInSender.m
Expand Up @@ -24,7 +24,7 @@ @interface BBOSCPlugInSender ()


@implementation BBOSCPlugInSender @implementation BBOSCPlugInSender
@synthesize oscPort, oscParameters; @synthesize oscPort, oscParameters;
@dynamic inputBroadcastPort, inputBroadcastPath; @dynamic inputBroadcastPort, inputBroadcastPath, inputBroadcastAddress;


+ (NSDictionary*) attributes + (NSDictionary*) attributes
{ {
Expand All @@ -36,6 +36,10 @@ + (NSDictionary*) attributes
} }


+ (NSDictionary*) attributesForPropertyPortWithKey:(NSString*)key { + (NSDictionary*) attributesForPropertyPortWithKey:(NSString*)key {
if ([key isEqualToString:@"inputBroadcastAddress"]) {
return [NSDictionary dictionaryWithObjectsAndKeys:@"Broadcast Address", QCPortAttributeNameKey,
@"0.0.0.0", QCPortAttributeDefaultValueKey, nil];
}
if ([key isEqualToString:@"inputBroadcastPort"]) { if ([key isEqualToString:@"inputBroadcastPort"]) {
return [NSDictionary dictionaryWithObjectsAndKeys:@"Broadcast Port", QCPortAttributeNameKey, return [NSDictionary dictionaryWithObjectsAndKeys:@"Broadcast Port", QCPortAttributeNameKey,
[NSNumber numberWithInt:60000], QCPortAttributeDefaultValueKey, nil]; [NSNumber numberWithInt:60000], QCPortAttributeDefaultValueKey, nil];
Expand Down Expand Up @@ -160,10 +164,10 @@ Return NO in case of failure during the execution (this will prevent rendering o


BOOL inputsChanged = NO; BOOL inputsChanged = NO;


if ([self didValueForInputKeyChange:@"inputBroadcastPort"]) { if ([self didValueForInputKeyChange:@"inputBroadcastAddress"] || [self didValueForInputKeyChange:@"inputBroadcastPort"]) {
if (self.oscPort) if (self.oscPort)
[[BBOSCManager sharedManager] removeOutput:self.oscPort]; [[BBOSCManager sharedManager] removeOutput:self.oscPort];
self.oscPort = [[BBOSCManager sharedManager] createNewOutputToAddress:@"0.0.0.0" atPort:self.inputBroadcastPort withLabel:@"BB OSC"]; self.oscPort = [[BBOSCManager sharedManager] createNewOutputToAddress:self.inputBroadcastAddress atPort:self.inputBroadcastPort withLabel:@"BB OSC"];
if (!self.oscPort) if (!self.oscPort)
NSLog(@"Failed to created output port"); NSLog(@"Failed to created output port");
inputsChanged = YES; inputsChanged = YES;
Expand Down

0 comments on commit 908759a

Please sign in to comment.