[SDL] same problem

Hr. Hristov hr_hristov at hotmail.com
Thu May 15 13:15:01 PDT 2003


I've read this discussion and I've decided to try loading wav from a zip
and I got the same problem.
SDL_GetError reports: Error reading from datastream.
I do not have problem reading images though.
I have compiled zziplib 10.80 (I can't believe I've done it ;) and I use
the latest precompiled SDL for Windows.

I have tried both SDL_LoadWav and Mix_LoadWAV_RW and I get the same
error. Bellow is part of the code (nothing nice).

Isn't there Mix_LoadMUS_RW? How can I load MOD, MP3 or other files from
a zip to play them with SDL_mixer?

I would like to have all the data into a zip file for now.

 SDL_RWops *rw;

 // Audio mode
 int audioRate      = 44100;
 int audioChannels  = 2;
 int audioBuffer    = 4096;
 Uint16 audioFormat = AUDIO_S16;


 if ( ( rw = SDL_RWFromZZIP("data1/ir_begin.wav", "rb") ) == NULL )
 {
  printf(" ERROR: %s\n",SDL_GetError());
  exit(2);
 }
 /*SDL_AudioSpec wav_spec;

 SDL_AudioSpec *music1;
 Uint32 wav_length;
 Uint8 *wav_buffer;

 music1 =  SDL_LoadWAV_RW( rw, 0, &wav_spec, &wav_buffer, &wav_length );

    if ( music1 == NULL )
 {
  printf( "XM sound file load failed: %s\n",
       SDL_GetError()
     );
  //exit( 2 );
 }*/

 Mix_Chunk *music2;
 music2 =  Mix_LoadWAV_RW( rw, 0);
    if ( music2 == NULL )
 {
  printf( "XM sound file load failed: %s\n",
      Mix_GetError()
     );
  //exit( 2 );
 }

 SDL_FreeRW(rw);







More information about the SDL mailing list