I’m trying to use SDL_Mixer for some back ground music. I got the music
going but the music plays really slow. I was wondering if I should
convert the music somehow. Is there a function for this?
main(){
int audio_rate = 22050;
Uint16 audio_format = AUDIO_S16;
int audio_channels = 2;
int audio_buffers = 4096;
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) != 0){
printf("Unable to initialize SDL: %s\n",
SDL_GetError());
return 1;
}
atexit(SDL_Quit);
SDL_WM_SetCaption("joethegame", "joethegame");
screen = SDL_SetVideoMode(800, 600, 16, SDL_FULLSCREEN);
if (screen == NULL){
printf("Unable to set video mode: %s\n");
return 1;
}
if(Mix_OpenAudio(audio_rate, audio_format, audio_channels,
audio_buffers)) {
printf(“Unable to open audio!\n”);
exit(1);
}
Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
}
sound(){
Mix_Music *song;
song = Mix_LoadMUS("music.ogg");
Mix_PlayMusic(song,-1);
}
Specs
Windows XP
Amd 500 mhz
GeForce 4 ti4200
Microsoft Visual Studio C++ 6.0
thanks