I am using Ogre in Ubuntu and I am using FMOD for the sound.
This is my .cpp
Code: Select all
#include "SoundEngine.h"
#include <iostream>
using namespace std;
FMOD_RESULT result;
bool SoundEngine::initSystem()
{
result = FMOD_System_Create(&system);
unsigned int version;
cout<<result<<endl;
result = FMOD_System_Init(system, 1, FMOD_INIT_NORMAL, NULL);
cout<<result<<endl;
cout<<"Sonido"<<endl;
//load sounds
result = FMOD_System_CreateSound(system, "Media/NMG.mp3", FMOD_CREATESAMPLE, 0, &sound1);
cout<<result<<endl;
result = FMOD_System_CreateChannelGroup(system,"canal",&channels);
cout<<result<<endl;
result = FMOD_System_PlaySound(system, sound1,channels, 1, NULL);
cout<<result<<endl;
//FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, )
//sound1->setMode(FMOD_LOOP_OFF); /* drumloop.wav has embedded loop points which automatically makes looping turn on, */
/* so turn it off here. We could have also just put FMOD_LOOP_OFF in the above CreateSound call. */
//system->playSound(FMOD_CHANNEL_FREE, sound1, false, 0);
cout<<"Sonido"<<endl;
return true;
}
Code: Select all
#ifndef SOUNDENGINE_H_
#define SOUNDENGINE_H_
#include "FMOD/inc/fmod.hpp" //fmod c++ header
//#include "FMODEX/inc/fmodlinux.h"
class SoundEngine{
public:
bool initSystem(void);
void update(void);
private:
//FMod Stuff
FMOD_SYSTEM *system; //handle to FMOD engine
FMOD_SOUND *sound1, *sound2; //sound that will be loaded and played
FMOD_CHANNELGROUP *channels;
};
I also try put
Code: Select all
while(true) FMOD_System_Update(system);
Any idea?