x42 / libltc

Linear/Logitudinal Time Code (LTC) Library
http://x42.github.io/libltc/
GNU Lesser General Public License v3.0
198 stars 55 forks source link

Using libtlc with NDK in an Android App: unsigned char and ltcsnd_sample_t representation #33

Open niklasdahlheimer opened 6 years ago

niklasdahlheimer commented 6 years ago

hey guys,

I'm trying to use libltc in an android app (for wireless ltc-distribution). Do you have any experiences about that?

First thing I stumbled over is that the NDK seems to interpret the unsigned chars of SMPTETimecode-Object in a strange way. If I assign the time like in the libtlc-example:

my_timecode.years =18; my_timecode.months =3; my_timecode.days =18;

the debugger tells me that years = {unsigned char} '\x12' months = {unsigned char} '\x03' days = {unsigned char} '\x12'

So I changed the assignment to my_timecode.years ='18'; my_timecode.months ='3'; my_timecode.days ='18';

Second thing, and I'm not sure if this is the consequence of the issue above, is that the encoded timecode looks like that:

"������������������������+&&&&&&&&&&&&&&&&&&&&&&+������������+&&&&&&&&&&+������������������������+&&&&&&&&&&&&&&&&&&&&&&+������������+&&&&&&&&&&+������������+&&&&&&&&&&+������������������������+&&&&&&&&&&&&&&&&&&&&&&+������������+&&&&&&&&&&+������������������������+&&&&&&&&&&&&&&&&&&&&&&+������������+&&&&&&&&&&+������������������������+&&&&&&&&&&+������������+&&&&&&&&&&&&&&&&&&&&&&+������������������������+&&&&&&&&&&&&&&&&&&&&&&+������������������������+&&&&&&&&&&+������������+&&&&&&&&&&+������������+&&&&&&&&&&&&&&&&&&&&&&+������������������������+&&&&&&&&&&&&&&&&&&&&&&+������������������������+&&&&&&&&&&&&&&&&&&&&&&+������������+&&&&&&&&&&+������������������������+&&&&&&&&&&+������������+&&&&&&&&&&&&&&&&&&&&&&+������������+&&&&&&&&&&+������������������������+&&&&&&&&&&&&&&&&&&&&&&+������������������������+&&&&&&&&&&&&&&&&&&&&&&+������������+&&&&&&&&&&+������������������������+&&&&&&&&&&+������������+&&&&&&&&&&+������������+&&&&&&&&&&&&&&&&&&&&&&+������������������������+&&&&&&&&&&&&&&&&&&&&&&+������������+&&&"...

which isn't a legal timecode, right? Or is this a way of representing data of the ltcsnd_sample_t-object?

Looking forward to hear from you! Greetings from cologne/germany.

image

niklasdahlheimer commented 6 years ago

Nobody has an idea? I really need to get this forward for an university-project. A hint in which direction I can investigate this issue, would be great.

x42 commented 6 years ago

It likely is proper 8bit unsigned int audio-data (uint8_t). -- Just don't read it as a string. It's a raw audio buffer, not text.

But the pattern looks about correct. LTC is a square wave, so an alternating pattern.