Sdl_rwops Or Some Other Way


misko

Still Fresh
Joined
Mar 10, 2007
Messages
3
Hello
I am new to gp2x developing so excuse me if you find my ideas stupid.

I need to play an wav|raw audio from another application output.
It looks like this:

Code:
Mix_OpenAudio(16000, AUDIO_S16, MIX_DEFAULT_CHANNELS, 128); // MIX_DEFAULT_FREQUENCY tried too
FILE *fp;
SDL_RWops *rw;
Mix_Chunk *wave_chunk;
fp = popen(appexecc_str(),"r");
Mix_Chunk=Mix_LoadWAV_RW(SDL_RWFromFP(fp, 0),1);
pclose(fp);
int channel;
if ((channel=Mix_PlayChannel(-1, wave_chunk, 0))==-1) {   cout << " Error: " << Mix_GetError(); };
while(Mix_Playing(channel) != 0); {   cout << " Playing "; WaitForKey(); }

This does not work. It reports: Error loading from datastream, then Tried to play NULL chunk and finally Unrecognized file type.
Should I try with Mix_QuickLoad_WAV? Can anybody help me with this?

Thanks


What I am mistaking here? Anyone have better solution how to do it?
 
Blah posted on Mar 10 2007 at 06:22 AM said:
Raw audio is not .wav
I have possibility getting both from input. Not sure if SDL supports raw..
 
Last edited by a moderator:
The SDL_mixer load function supports WAV, AIFF, RIFF, OGG and VOC.
But if you have raw data, you could try to read it into a char buffer, set the abuf member of the Mix_Chunk structure to point to the buffer and the alen member to the right length.
 
Back
Top