Answered
0
0

I am using FMOD on Ubuntu and i think that now the sound must be heared, but I dont hear sound.

SoundEngine.h

#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;
};

And SoundEngine.cpp

#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;

    cout<<"Sonido"<<endl;
    return true;
}

I think that its correct and must play sound, but I dont hear nothing( and I have the computer volume turn on and works). Its there any other method that I need to use?

I also use FMOD_System_Update() in every frame.

And tried to put

while(true) FMOD_System_Update();

Inside the initSystem methor but it doesnt work.

PS: I dont know if this is the correct forum to put this (FMOD 4) but tell me if I am wrong.

  • You must to post comments
Best Answer
0
0

You’re passing 1 in fourth argument of FMOD_System_PlaySound, which is means the channel is created in the paused state.

Either you need to pass 0 for that parameter, or get the channel handle back from FMOD_System_PlaySound and call FMOD_Channel_SetPaused(channel, 0).

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.