Here is SDL_Mixer, but I get no sound.
int GenRaw(){ Uint8* lraw; Uint32 len = 88000; lraw = new Uint8[len]; for (int i = 0; i < len; ++i){ lraw = RandInt(0, 255); } mGenRaw = Mix_QuickLoad_RAW(lraw, len ); if( mGenRaw==NULL ){ std::cout << "GenRaw() ERROR: Mix_GetError():" << Mix_GetError() << std::endl; delete[] lraw; return -1; } else { delete[] lraw; return 0; } }void PlayLoop(){ int channel; channel = Mix_PlayChannel( -1, mGenRaw, -1 ); if( channel != 0 ){ std::cout << "PlayLoop() ERROR: Unable to play Mix_GetError(): " << Mix_GetError() << std::endl; }}
My load wave file function works and plays fine though mSound
int LoadWave(const std::string& awavfile){ mSound = NULL; mSound = Mix_LoadWAV( awavfile.c_str() ); if( mSound==NULL ){ std::cout << "Unable to load WAV file: " << awavfile << std::endl << std::endl; return -1; } else{ return 0; }}
The sound specification is
static const int mAudioRate = 22050;static const Uint16 mAudioFormat = AUDIO_S16SYS;static const int mAudioChannels = 2;static const int mAudioBuffers = 4096;Mix_Chunk* mSound;Mix_Chunk* mGenRaw;
No errors are detected by the above code. I have checked the address of mGenRaw and it is NULL before the load, and has a normal looking 0034B68 type address. Dunno :o
[Edited by - PrestoChung on December 24, 2010 4:37:34 AM]