vvopensource icon indicating copy to clipboard operation
vvopensource copied to clipboard

OSCBundle:TimeTag - iOS 10 problem

Open Enigma644 opened this issue 8 years ago • 5 comments

Something weird is going on with iOS 10 with these two lines in OSCBundle (lines 218, 219):

long time_s = NSSwapHostLongToBig(floor(interval));
long time_us = NSSwapHostLongToBig((long)(floor((double)1000000.0 * ((double)(interval - (double)time_s)))));

I'm not sure what is happening, but NSSwapHostLongToBig is just not giving out the same results on iOS 10 vs iOS 9. As a result the bundle time is getting totally messed up. I think it's got to do with LONG_MAX being much higher on my x64 iOS 10 iPhone 6 test device.

Also of note, on line 218, (interval - time_s) should be (interval - floor(interval)).

Enigma644 avatar Oct 09 '16 04:10 Enigma644

howdy-

thanks for letting me know about this. i don't have an iOS 10 SDK at my disposal right now, but i made some changes- if you could please let me know if they resolve your issue i'd appreciate it!

cheers : : ray

mrRay avatar Oct 10 '16 18:10 mrRay

Awesome, thank you. iOS9 and iOS10 are now behaving the same.

I am however noticing problems with the fraction microseconds (in any iOS). In the test utils that I'm using they are showing the microseconds not changing, but looking at the packet you are creating, it looks to me like the timetag is built correctly. Can I ask what test tool you're using? I'm testing with oscP5.

Enigma644 avatar Oct 11 '16 19:10 Enigma644

FYI other libs have the second component as a fraction of 4294967296 eg: http://cim.mcgill.ca/sresvn/audioscape/audioscape_resources/PDa/extra/dumpOSC.c

Enigma644 avatar Oct 11 '16 20:10 Enigma644

After a bunch of testing, I'm 99% sure you should have: uint32_t time_us = CFSwapInt32HostToBig((uint32_t)floor((double)4294967296.0 * ((double)(interval - floor(interval)))));

Enigma644 avatar Oct 12 '16 03:10 Enigma644

you are, of course, correct- nice catch, thanks for the tip! just pushed some changes, please let me know if you have any more problems.

mrRay avatar Oct 12 '16 19:10 mrRay