0
0

Okay I just recently install fmod and when I run the code.
I just did it with mp3 to test it cause I don’t have a converter right now to convert to ogg. And The sound is bad :. It sounds like a robotic voice.
I don’t know if its cause i’m using mp3 or not.

Heres my code.

[code:3b80jh7z]

include "CFXSound.h"

CFXSound::CFXSound()
{
m_fmodSystem = NULL;
m_fmodSound = NULL;
m_fmodChannel = NULL;
}

CFXSound::~CFXSound()
{
m_fmodSound->release();
m_fmodSystem->close();
m_fmodSystem->release();
}

bool CFXSound::Initialize(std::string fileName)
{
m_fmodResult = FMOD::System_Create(&m_fmodSystem);
if(m_fmodResult != FMOD_OK)
return false;

m_fmodResult = m_fmodSystem->init(100, FMOD_INIT_NORMAL, 0);
if(m_fmodResult != FMOD_OK)
    return false;

m_fmodResult = m_fmodSystem->createSound(fileName.c_str(), FMOD_DEFAULT, 0, &m_fmodSound);
//m_fmodResult = m_fmodSystem->createStream(fileName.c_str(), FMOD_DEFAULT, 0, &m_fmodSound);
if(m_fmodResult != FMOD_OK)
    return false;
return true;

}

bool CFXSound::Play()
{
m_fmodResult = m_fmodSystem->playSound(FMOD_CHANNEL_FREE, m_fmodSound, false, &m_fmodChannel);
if(m_fmodResult != FMOD_OK)
return false;
m_fmodResult = m_fmodChannel->setVolume(1.0f);
if(m_fmodResult != FMOD_OK)
return false;
m_fmodResult = m_fmodChannel->setPaused(false);
if(m_fmodResult != FMOD_OK)
return false;
m_fmodSystem->update();
return true;
}
[/code:3b80jh7z]

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.