Permalink
Browse files

Allow broadcast to everyone on the network with 0.0.0.0

  • Loading branch information...
1 parent 908759a commit b89973173d136355ecc028629b71aec80fa7115a Jonathan del Strother committed Sep 10, 2009
Showing with 18 additions and 0 deletions.
  1. +18 −0 BBOSCManager.m
View
@@ -9,6 +9,22 @@
#import "BBOSCManager.h"
#import "OSCExtensions.h"
+@interface BBOSCBroadcastPort : NSObject {
+OSCManager* oscManager;
+}
+-(id)initWithManager:(OSCManager*)manager;
+@end
+@implementation BBOSCBroadcastPort
+-(id)initWithManager:(OSCManager*)manager {
+ if (self = [super init]) {
+ oscManager = manager;
+ }
+ return self;
+}
+-(void)sendThisMessage:(OSCMessage*)message {
+ [[oscManager outPortArray] makeObjectsPerformSelector:@selector(sendThisMessage:) withObject:message];
+}
+@end
@implementation BBOSCManager
@@ -49,6 +65,8 @@ - (OSCInPort *) createNewInputForPort:(int)p withLabel:(NSString *)l {
return [oscManager createNewInputForPort:p withLabel:l];
}
- (OSCOutPort *) createNewOutputToAddress:(NSString *)a atPort:(int)p withLabel:(NSString *)l {
+ if ([a isEqualToString:@"0.0.0.0"]) // Broadcast to everyone
+ return [[[BBOSCBroadcastPort alloc] initWithManager:oscManager] autorelease];
return [oscManager createNewOutputToAddress:a atPort:p withLabel:l];
}
- (void) removeInput:(id)p {

0 comments on commit b899731

Please sign in to comment.