Jean-Marc wrote:>I think what happened is that you did not write the "message" length. >With user-callbacks, you also need to say how large the message. The >size is in bytes and encoded in 4 bits.I wonder what is correct. Inside speex the documentation was written that the size in byte is encoded within 5 bit. I changed the code in both ways, but it doesn't work anytime. It's the same problem. See below.>Besides, you're probably the first one to use user-callbacks.Oh, I feel honoured. :-) Why does it contain this feature if nobody uses it? I think it's a good and very flexible feature (if it works :-)).>BTW, why >didn't you want to use Ogg. It's much simpler to use and overhead canbe>made minimal anyway.At first there is no need for ogg, the programm is only for encoding voice in a test environment. And if the user in-band callback mechanism works it is more then enough. <p><p>void CSpeexEncoderThread::Decode(char * pcData, DWORD dwLength){ ... speex_encode(st, s, &bits); // encode if (syncmsg == TRUE && synccount < 256){ // is there a sync message? syncstruct[synccount].sync_value = syncvalue; //fill the sync structure ... //custom in-band messages speex_bits_pack(&bits, 13, 5); // write the length of the message speex_bits_pack(&bits, 1, 4); // write the array index of the sync structure into the stream (max. 256 sync points) speex_bits_pack(&bits, synccount, 8); synccount++ } nbBytes = speex_bits_write(&bits, cbits, MAX_FRAME_BYTES); ... // write the encoded data into the end buffer ... speex_bits_reset(&bits); ... } int CSpeexDecoderThread::SpeexUserCallback(SpeexBits *bits, void *state, void *data){ int length = speex_bits_unpack_unsigned(bits, 4); int inedx = speex_bits_unpack_unsigned(bits, length * 8); <p> SendNotifyMessage(l_sdthread->m_hWnd, USER_PLAYBACK_MESSAGE, SYNC_DATA, LPARAM(index)); return 0; } <p><p><p><p><p><p><p><p>--- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'speex-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Le ven 07/11/2003 à 13:37, Norman Biehl a écrit :> Jean-Marc wrote: > > >I think what happened is that you did not write the "message" length. > >With user-callbacks, you also need to say how large the message. The > >size is in bytes and encoded in 4 bits. > > I wonder what is correct. Inside speex the documentation was written > that the size in byte is encoded within 5 bit. > > I changed the code in both ways, but it doesn't work anytime. It's the > same problem. See below.I guess you'll need to somehow trace what's happening.> >Besides, you're probably the first one to use user-callbacks. > > Oh, I feel honoured. :-) > > Why does it contain this feature if nobody uses it? I think it's a good > and very flexible feature (if it works :-)).I thought it could be useful in some cases, but you're the first to find a use for it.> >BTW, why > >didn't you want to use Ogg. It's much simpler to use and overhead can > be > >made minimal anyway. > > At first there is no need for ogg, the programm is only for encoding > voice in a test environment. > And if the user in-band callback mechanism works it is more then enough.The reason I suggest Ogg is that it takes care of everything. It makes the file readable everywhere and I don't see any reason not to use it. Jean-Marc -- Jean-Marc Valin, M.Sc.A., ing. jr. LABORIUS (http://www.gel.usherb.ca/laborius) Université de Sherbrooke, Québec, Canada -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 190 bytes Desc: Ceci est une partie de message numériquement signée Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20031107/40166edd/signature-0001.pgp
>I guess you'll need to somehow trace what's happening. > >> >Besides, you're probably the first one to use user-callbacks. >> >> Oh, I feel honoured. :-) >> >> Why does it contain this feature if nobody uses it? I think it's agood>> and very flexible feature (if it works :-)). > >I thought it could be useful in some cases, but you're the first tofind>a use for it. >Oh, I guess, there are a lot cases to use this feature.>> >BTW, why >> >didn't you want to use Ogg. It's much simpler to use and overheadcan>> be >> >made minimal anyway. >> >> At first there is no need for ogg, the programm is only for encoding >> voice in a test environment. >> And if the user in-band callback mechanism works it is more thenenough.> >The reason I suggest Ogg is that it takes care of everything. It makes >the file readable everywhere and I don't see any reason not to use it.Ok, I will try Ogg, maybe Ogg can prevent these error. But I promise, that's my last try ....... today. :-| Norman <p>--- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'speex-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.