Hello sdl,
Can someone please tell what’s wrong with this small program:-----------
#include “SDL.h”
#include “SDL_mixer.h”
#include <stdio.h>
int main( int argc, char* argv[] )
{
SDL_Init (SDL_INIT_AUDIO);
if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024)==-1) {
char* err=Mix_GetError();
return 0;
}
Mix_AllocateChannels(2);
Mix_Chunk *sample;
sample=Mix_LoadWAV("Bes2.wav");
if(!sample) {
char* err=Mix_GetError();
}else{
Mix_VolumeChunk(sample, MIX_MAX_VOLUME);
if(Mix_PlayChannel(-1, sample, 1)==-1) {
char* err=Mix_GetError();
// may be critical error, or maybe just no channels were free.
// you could allocated another channel in that case...
}
Mix_FreeChunk(sample);
}
Mix_CloseAudio();
SDL_Quit();
}
It compiles well, no errors appears while executing, but Mix_PlayChannel()
simply do not play wanted wav file (but does not return an error?). What’s wrong
here?
Also, I’m not very familiar with MS VS environment - when I use printf where
that output goes? I don’t see any window/console opens.
–
Best regards,
Milan mailto:milan_g at eunet.yu