.WAV file support
3 posters
.WAV file support
Unpacking vorbis codec is very slow. I'm using this code for wave files.
First rename sio2SoundBufferLoad to sio2SoundBufferLoadOGG
First rename sio2SoundBufferLoad to sio2SoundBufferLoadOGG
- Code:
void sio2SoundBufferLoadWAV(SIO2soundbuffer *_SIO2soundbuffer, SIO2stream *_SIO2stream) {
unsigned char *header;
header = ( unsigned char * )sio2StreamReadPtr( _SIO2stream, 0x2c );
_SIO2soundbuffer->size = *(unsigned int *)((int)header + 0x28);
_SIO2soundbuffer->freq = *(unsigned int *)((int)header + 0x18);
if (header[0x16] == 1 && header[0x22] == 0x10)
_SIO2soundbuffer->format = AL_FORMAT_MONO16;
else if (header[0x16] == 2 && header[0x22] == 0x10)
_SIO2soundbuffer->format = AL_FORMAT_STEREO16;
else if (header[0x16] == 1 && header[0x22] == 0x8)
_SIO2soundbuffer->format = AL_FORMAT_MONO8;
else if (header[0x16] == 2 && header[0x22] == 0x8)
_SIO2soundbuffer->format = AL_FORMAT_STEREO8;
_SIO2soundbuffer->data = (char *)malloc(_SIO2soundbuffer->size);
sio2StreamRead( _SIO2stream, _SIO2soundbuffer->data, _SIO2soundbuffer->size );
}
void sio2SoundBufferLoad(SIO2soundbuffer *_SIO2soundbuffer, SIO2stream *_SIO2stream) {
if( strstr(_SIO2stream->fname, ".ogg") ||
strstr(_SIO2stream->fname, ".OGG"))
{
sio2SoundBufferLoadOGG(_SIO2soundbuffer, _SIO2stream);
}
else if( strstr( _SIO2stream->fname, ".wav" ) ||
strstr( _SIO2stream->fname, ".WAV" ))
{
sio2SoundBufferLoadWAV(_SIO2soundbuffer, _SIO2stream);
}
}
dilshod- Posts : 7
Join date : 2008-12-28
Re: .WAV file support
Also check out this: http://forum.sio2interactive.com/about-the-sdk-f1/ogg-vs-caf-for-audio-t126.htm?sid=968ad3c3048ee8c51ca2c898d5fef4da
It is a caf file loader that supports compressed and uncompressed audio. Probably having ogg, caf and wav would cover just about every audio requirement out there.
It is a caf file loader that supports compressed and uncompressed audio. Probably having ogg, caf and wav would cover just about every audio requirement out there.
uprise78- Posts : 228
Join date : 2008-10-31
![-](https://2img.net/i/empty.gif)
» Compressed Textures from Apple's texturetool
» Blender Exporter v1.2 and up
» .PNG support
» Localization & UTF8 Support
» Where is the sio2.cc file?
» Blender Exporter v1.2 and up
» .PNG support
» Localization & UTF8 Support
» Where is the sio2.cc file?
Permissions in this forum:
You cannot reply to topics in this forum