I'm having some trouble playing music and chunks at the same time.
I wrote a frequency change function that changes the frequency for either music or chunks before either mix_playmusic or mix_playchannel.
but if I do this in the frequency change function: Mix_CloseAudio(); mix_openaudio , the voice sounds like chipmunks.
I call this function before mix_playmusic or mix_playchannel .
if I remove closeaudio , the voice sounds normal , but teh music stops as soon as voice has played (and it should continue in the background)
Why do you want to change the frequency? Most programs use the same frequency throughout the whole run of a program, unless they want to provide the user with an option to change it.
The docs says you need to call Mix_CloseAudio before calling Mix_OpenAudio again otherwise the new settings will not be used.
If you use Mix_CloseAudio and Mix_OpenAudio to change the frequency you will have to reload every Mix_Chunk and Mix_Music from file again otherwise they might sound like chipmunks (happens when you increase the frequency). You will also have to call Mix_PlayMusic etc. to start playing everything again.
Thank for the reply.
I have to change the frequency between my music files and chunks or either will sound bad. Either the music is to slow or the voices sound like chipmunks. And i did incude mix_closeaudio ,but that didnt work?
The frequency is the sample rate. When you call Mix_LoadWAV or Mix_LoadMUS it will automatically convert to the sample rate that was set when Mix_OpenAudio was called.