I actually try to play a sound with FMOD but it didn't work.
#ifndef __SOUND_HH__
#define __SOUND_HH__
#include <string>
#include <fmodex/fmod.h>
class Sound
{
FMOD_SYSTEM *sys;
FMOD_SOUND *explosion;
FMOD_RESULT resExplosion;
FMOD_CHANNEL *channel1;
public:
Sound();
~Sound();
void play(const std::string &);
};
#endif
and
#include <string>
#include <iostream>
#include "Sound.hh"
Sound::Sound()
{
FMOD_System_Create(&this->sys);
FMOD_System_Init(this->sys, 1, FMOD_INIT_NORMAL, NULL);
}
Sound::~Sound()
{
FMOD_System_Release(sys);
}
but when I do play("mysound.wav"); on my code nothing append, I verify return value and no problem. so any idea ? thanks
void Sound::play(const std::string &filename)
{
FMOD_System_CreateStream(this->sys, filename.c_str(), FMOD_HARDWARE | FMOD_LOOP_OFF | FMOD_2D, 0, &this->explosion);
FMOD_System_PlaySound(sys, FMOD_CHANNEL_FREE, explosion, 0 , &channel1);
std::cout << "playayayyayayayayya" << std::endl;
}