FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

.WAV file support

3 posters

Go down

.WAV file support Empty .WAV file support

Post  dilshod Tue Jan 06, 2009 11:31 pm

Unpacking vorbis codec is very slow. I'm using this code for wave files.
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

Back to top Go down

.WAV file support Empty Re: .WAV file support

Post  uprise78 Wed Jan 07, 2009 1:10 pm

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.

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

.WAV file support Empty Re: .WAV file support

Post  sio2interactive Wed Jan 07, 2009 2:44 pm

totally agree...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

.WAV file support Empty Re: .WAV file support

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum