Turn on more accessible mode
Skip to main content
Turn off more accessible mode
Creative Labs: Connect
Sign In
|
OpenAL
This Site
This List
Home
ALchemy
Beta - Audigy [CLOSED]
Beta - Linux
Beta - Windows
Developer
E-MU
MarCom
OpenAL
Open Source
PR
Creative Labs: Connect
>
OpenAL
>
OpenAL
>
Audio streaming using openal
>
New Item
OpenAL
: New Item
Attach File
Body
<div><br/><br/><hr class="ms-disc-quotedtext"/> <b>From: </b><br/> <b>Posted: </b>Friday, December 02, 2011 5:36 AM<br/> <b>Subject: </b>Audio streaming using openal<br/><br/> <div class=ExternalClass2790E4E28F0C4B9FBC35868810CF1AC6><div><br><br> <hr class=ms-disc-quotedtext> <b>From: </b><br><b>Posted: </b>Tuesday, January 06, 2009 9:54 AM<br><b>Subject: </b>Audio streaming using openal<br><br> <div class=ExternalClassE2AA8E78B301453B8B6E732E84331448> <div><br><br> <hr> <b>From: </b><br><b>Posted: </b>Tuesday, January 06, 2009 8:02 AM<br><b>Subject: </b>Audio streaming using openal<br><br> <div class=ExternalClassC4B7DE724072475287F3B49794C483D2><pre>Hi all, my name is Angelo and i am quite new to OpenAl/audio world. I need some suggestions and help for a task. I have to develop a portable software on a pc side, that mainly have to playback a PCM 16bit samples, 8Khz, LSB(Little endian Intel format) mono samples. The stream contain pure audio vocal samples, no high quality is required. Actually, i am working under windows since this is the main request for the project. The stream is generated from a little 80186 based device that i am writing the firmware for it, planning to send packets of 512/1024 bytes, constant bitrate, 1 packet about every 30 msec. So, mi questions would be: - i am using format = AL_FORMAT_MONO16, does it match the incoming stream ? I think it should. - is the streaming timing interval of 30msec and packet size 512 or 1024 correct for this purpose ? - could anyone suggest me some little sample that show how queue/unqueue the buffers and play them in the correct way ? infinite thanks, Angelo</pre></div><pre>Hi, Angelo. A packet size of 1024 bytes of 16-bit mono data would yield 512 samples. For 8khz, 512 samples is roughly 63ms. This should be adequate for a send inverval of 30ms, as long as you don't have much packet loss. A packet size of 512 bytes would be half that, giving 256 samples, for a length of 31ms, which would be cutting it close. I'm not too familiar with the networking side of things, but the queueing/unqueueing could work like this: ALint processed; ALint state; alGetSourcei(source, AL_SOURCE_STATE, &state); alGetSourcei(source, AL_BUFFERS_PROCESSED, &processed); while(alGetError() != AL_NO_ERROR && processed > 0) { ALubyte *data; ALuint buf; int length; data = get_packet_data(&length); if(!data) break; alSourceUnqueueBuffers(source, 1, &buf); if(alGetError() == AL_NO_ERROR) { alBufferData(buf, AL_FORMAT_MONO16, data, length, 8000); alSourceQueueBuffers(source, 1, &buf); } processed--; } if(state != AL_PLAYING) alSourcePlay(source); Hope that helps. :)</pre></div></div></div></div></div>
Attachments
Use this page to add attachments to an item.
Name