Can't load wav file with SDL_Mixer

I am making a program that takes inputs trought the console, and reproduce a sound depending of the input, pretty straightforward; the problem is that apparently, the files can not load, i do not really understand how can it fail, the loading code is quite simple:
1
2
3
4
5
6
7
8
9
10
bool load_files()
{
Anote = Mix_LoadWAV("Anotel.wav")
Cnote = Mix_loadWAV("Cnotel.wav")

if( (Anote==NULL)||(Cnote == NULL) )
{
return false;
}
return true;


yet, that fails. I have initialized all the necesary systems (SDL_INIT_AUDIO and Mix_OpenAudio) and it shows no problems. can it be some kind of conflict between the iostream and sdl? (do not really see why, but i never really used SDL and the console at the same time).

just in case, i will leave the main code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
int main( int arc, char* args[] )
{
  int note;
  if(init() == false)
  {
    return 1;
  }

  if(load_files() == false)//<--nothing happens after this when executing
  {
    return 1;
  }
   std::cout << "put a value" << std::endl;
   std::cin >> note;
   if(note == 1)
   {
     Mix_PlayChannel(-1, Cnote, 0);
   }
   std::cing.get();
   clean_up();
   return 0;


the headers I am using are: iostream, SDL.h, SDL_main.h, SDL_mixer.h and string, and I have included the dlls and wavs where they belong.

thanks beforehand!.
Last edited on
For some reason SDL on Windows redirects output to a file called stdout.txt.

http://www.libsdl.org/cgi/docwiki.cgi/FAQ_Console
Last edited on
Are you sure you're initializing SDL_Mixer in the right way? Always check the return values also, and, did you try putting in your files' absolute folder? Like, instead of Mix_LoadWAV("Anotel.wav") using Mix_LoadWAV("C:\\Anotel.wav") and copying those file to C:, just as a test.
Topic archived. No new replies allowed.