Same problem

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 :wink: 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);

“Hr. Hristov” <hr_hristov at hotmail.com> writes:

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

  1. Load from zip and write to temporary file.
  2. Mix_LoadMUS from the temporary file
  3. Delete temporary file.

Note that this works on Unix (the deletion part) since the reference
is kept until you close the program / unload the music. On Windows
(and other platforms) this might very well not work.

So the real answer for most cases is that you can’t - music has to
come directly from disk.–
[ Below is a random fortune, which is unrelated to the above message. ]
Q: How many Harvard MBA’s does it take to screw in a light bulb?
A: Just one. He grasps it firmly and the universe revolves around him.