FMOD::System *system; FMOD::Sound *sound; FMOD::Channel *channel = 0; FMOD_RESULT result; int key; unsigned int version; /* Create a System object and initialize. */ result = FMOD::System_Create(&system); ERRCHECK(result); result = system->init(1, FMOD_INIT_NORMAL, 0); ERRCHECK(result); result = system->createSound("1.mp3", FMOD_SOFTWARE | FMOD_2D , 0, &sound ERRCHECK(result);
QCoreApplication::postEvent: Receiver is not a valid QObject*** glibc detected *** corrupted double-linked list: 0x080bd128 ***Aborted
private: void ERRCHECK(FMOD_RESULT result); FMOD::System *system; FMOD::Sound *sound; FMOD::Channel *channel; FMOD_RESULT result; int key; unsigned int version;
result = FMOD::System_Create(&system); ERRCHECK(result); result = system->init(1, FMOD_INIT_NORMAL, 0); ERRCHECK(result); result = system->createSound("/1.mp3", FMOD_SOFTWARE, 0, &sound); ERRCHECK(result);
FMOD::System *system; FMOD::Sound *sound; FMOD::Channel *channel = 0; FMOD_RESULT result; int key; unsigned int version; result = system->getVersion(&version); ERRCHECK(result); result = system->init(1, FMOD_INIT_NORMAL, 0); ERRCHECK(result); result = system->createSound("1.mp3", FMOD_SOFTWARE, 0, &sound); ERRCHECK(result);
FMOD_RESULT F_API createSound (const char *name_or_data, FMOD_MODE mode, FMOD_CREATESOUNDEXINFO *exinfo, Sound **sound);
FMOD::System *system; FMOD::Sound *sound; FMOD::Channel *channel = 0; FMOD_RESULT result; int key; unsigned int version; result = system->getVersion(&version); ERRCHECK(result);
FMOD::System *system; FMOD::Sound *sound; FMOD::Channel *channel = 0; FMOD_RESULT result; int key; unsigned int version; /* Create a System object and initialize. */ result = FMOD::System_Create(&system); ERRCHECK(result); result = system->init(1, FMOD_INIT_NORMAL, 0); ERRCHECK(result); result = system->createSound("1.mp3", FMOD_SOFTWARE, 0, &sound); ERRCHECK(result);
FMOD::System *system; FMOD::Sound *sound; FMOD::Channel *channel; FMOD_RESULT result; int key; unsigned int version;
result = system->createSound("1.mp3", FMOD_SOFTWARE, 0, &sound); ERRCHECK(result);
#ifndef JPLAYER_H #define JPLAYER_H #include <QWidget> #include "fmod.hpp" #include "fmod_errors.h" class JPlayer : public QWidget { Q_OBJECT public: JPlayer ( QWidget *parent = 0 ); private: /* fmodex variables */ FMOD::System *system; FMOD::Sound *sound; FMOD::Channel *channel; FMOD_RESULT result; int key; unsigned int version; void ERRCHECK(FMOD_RESULT result); }; #endif //////// JPlayer.cpp //////////////#include "JPlayer.h" JPlayer::JPlayer(QWidget *parent) : QWidget(parent){ /* fmodex player init */ /* Create a System object and initialize. */ result = FMOD::System_Create(&system); ERRCHECK(result); result = system->init(1, FMOD_INIT_NORMAL, 0); ERRCHECK(result); result = system->createSound("1.mp3", FMOD_LOOP_NORMAL, 0, &sound); ERRCHECK(result);}
#define ERRCHECK(x) if ( x != NOERROR ) return void
void JPlayer::ERRCHECK(FMOD_RESULT result){ if (result != FMOD_OK) { printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result)); exit(-1); }}
bool JPlayer::create(){ FMOD_RESULT result = FMOD::System_Create(&system); if ( result != FMOD_OK ) { qWarning( "JPlayer::create() : Cannot create FMOD system" ); return false; } result = system->init(1, FMOD_INIT_NORMAL, 0); if ( result != FMOD_OK ) { qWarning( "JPlayer::create() : Cannot init FMOD system" ); return false; } QString file_name = "1.mp3"; result = system->createSound(file_name.ascii().constData(), FMOD_LOOP_NORMAL, 0, &sound); if ( result != FMOD_OK ) { qWarning( "JPlayer::create() : Cannot create sound: %s", file_name.ascii().constData() ); return false; } return true;}