Closed GoogleCodeExporter closed 8 years ago
By the way, when I launch another OSC application on the same computer as my
Mac application, for example OSCTestApp, Bonjour finds it and the connection is
established.
Original comment by sebastie...@gmail.com
on 7 Aug 2010 at 11:31
After further investigation, I confirm that there seems to be a problem with
the way OSCManager uses Bonjour. I'm using Bonjour Browser on my Mac to scan
for Bonjour services. When I run TouchOSC (using OSCPack as an OSC
implementation), I can see it appear in Bonjour Browser. But when I run my own
app, it does not appear in Bonjour Browser. Here is how I instantiate the
OSCManager:
-(id)init{
if(self == [super init]){
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(oscOutputsChangedNotification:) name:VVOSCOutPortsChangedNotification object:nil];
oscManager = [[MFOSCManager alloc] init];
[oscManager setDelegate:self];
oscInPort = [oscManager createNewInputForPort:1234 withLabel:@"MIDI Fighter for iPad"];
[oscInPort setInterval:0.001];
[self oscOutputsChangedNotification:nil];
outgoingBuffer = [[MutLockArray alloc] init];
oscSendingThread = [[VVThreadLoop alloc] initWithTimeInterval:0.001 target:self selector:@selector(sendOSC)];
[oscSendingThread start];
}
return self;
}
Any idea what the problem might be? Have you tested VVOSC on the iPhone or
iPad? Can anyone else confirm if it works for them (in which case the problem
might be in my own application)?
Original comment by sebastie...@gmail.com
on 11 Aug 2010 at 7:44
hi sebastian-
i don't have an iphone/ipad dev setup; at no point have i tested any of this
ipad/iphone stuff, it's all basically been assembled blind and i certainly
wouldn't be surprised to hear about the odd bug like this; sorry if this has
caused you any problems.
i think i've figured this out- take a look at line 149 of OSCInPort.m:
#if IPHONE
name:nil
#else
name:[NSString stringWithFormat:@"%@ %@",CSCopyMachineName(),portLabel]
#endif
that #if IPHONE/name:nil bit is almost certainly why bonjour isn't being
launched correctly on iphones. i vaguely recall throwing this in there as a
temporary workaround for the fact that CSCopyMachineName() doesn't seem to be
available in the iOS SDK; the correct fix would be to replace that 'nil' with
something that returns an NSString with the machine and port names.
try replacing:
name:nil
with:
name:[NSString stringWithFormat:@"%@ %@",[[UIDevice currentDevice]
name],portLabel]
...and let me know how that works? this should compile correctly, i just don't
know if the string returned by [UIDevice currentDevice] is appropriate.
cheers
: : ray
Original comment by raycut...@gmail.com
on 11 Aug 2010 at 8:36
Yay! Bingo, that's exactly it. Now I can see my iPad with Bonjour Browser and
with OSCulator all right. That's just awesome. You rock!
Original comment by sebastie...@gmail.com
on 11 Aug 2010 at 8:54
May I suggest you to add the port number to the machine name? OSCulator does
that and it helps a lot making sure the connection is on the right port.
#if IPHONE
name:[NSString stringWithFormat:@"%@:%i %@",[[UIDevice currentDevice] name], port, portLabel]
#else
name:[NSString stringWithFormat:@"%@:%i %@",CSCopyMachineName(), port, portLabel]
#endif
Original comment by sebastie...@gmail.com
on 11 Aug 2010 at 9:03
hi sebastian-
great, glad to hear that worked; i'll commit it shortly. please let me know if
you run into any other problems.
"May I suggest you to add the port number to the machine name? OSCulator does
that and it helps a lot making sure the connection is on the right port."
that's what portLabel is for- try changing this:
oscInPort = [oscManager createNewInputForPort:1234 withLabel:@"MIDI Fighter for
iPad"];
to this:
oscInPort = [oscManager createNewInputForPort:1234 withLabel:[NSString
stringWithFormat:@"MIDI Fighter for iPad %ld",1234]];
...that said, i think putting port numbers or IP addresses in bonjour names is
a bad idea- especially if your app is expected to communicate with other
OSC-based software.
bonjour with OSC is great because it allows users to use a human-readable label
("MIDI Fighter for iPad") to refer to an IP address and port which are
ultimately dynamic. if you start changing the bonjour name every time there's
a minor network change users lose this stable point of reference, and software
which would've otherwise automatically compensated for a minor change now
requires the user to re-enter data. depending on what the user's doing/how
complex their OSC setup is, this can potentially be a *lot* of work...
cheers
: : ray
Original comment by raycut...@gmail.com
on 12 Aug 2010 at 1:12
Excellent point. So be it then.
Original comment by sebastie...@gmail.com
on 12 Aug 2010 at 4:17
Original comment by raycut...@gmail.com
on 7 Sep 2010 at 7:46
Original issue reported on code.google.com by
sebastie...@gmail.com
on 7 Aug 2010 at 11:30