2

I tried to load a .wav file(afschieten.wav), but I cant load it. I followed the tutorial of lazyfoo: http://lazyfoo.net/SDL_tutorials/lesson11/

The code:

I got this on top of file:

#include <stdlib.h>
#include "GL/glut.h"
#include <SDL/SDL.h>
#include <SDL/SDL_mixer.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <time.h>
#include <iostream>

the function I call from main:

void load_files(){
    //Load sound effect
    fire = Mix_LoadWAV( "afschieten.wav" );

    if(fire != NULL)
        std::cout << "Sound effect afschieten.wav loaded succesfully" << std::endl; 
    else
        std::cout << "Sound effect afschieten.wav failed loading" << std::endl; 

}//load_files

What am I doing wrong? I get no errors when compiling. It says sound effect afschieten.wav failed loading.

genpfault
  • 51,148
  • 11
  • 85
  • 139
M.Tlan
  • 33
  • 7
  • You need to either provide full `afschieten.wav` path or your wav file should present parallel to the exe. – Hemant Gangwar Oct 30 '14 at 16:00
  • That, + use [Mix_GetError](http://sdl.beuc.net/sdl.wiki/Mix_GetError) to get more info about error if it persists. – keltar Oct 30 '14 at 17:07
  • Having this problem aswell. Mix_GetError() gives: "Not an Ogg Vorbis audio stream" for ogg files. But it's general for all audiotypes I've tested. wav, flac and ogg. No clue what is causing it. – LiquidityC Nov 06 '14 at 08:44

1 Answers1

0

Check the path of the wav file: for proper loading, you should put it in the same directory of the executable, or use an absolute path.

Zac
  • 4,510
  • 3
  • 36
  • 44