0
0

I’ve used the code below in a DLL for an application, all functions don’t return errors. As you can see, I merely copied the code from the examples. The examples work fine but mine doesn’t.

The host EXE is an application that uses DirectSound.

[code:3jgq2b70]void sound_init(){
//ULONG thread_id;
//CreateThread(0, 0, (LPTHREAD_START_ROUTINE)(do_init), 0, 0, &thread_id);
FMOD::System *system;
FMOD::Sound *sound;
FMOD::Channel *channel = 0;
FMOD_RESULT result;
int key;
unsigned int version;

/*
    Create a System object and initialize.
*/
cout << FMOD_ErrorString(FMOD::System_Create(&system)) << endl;

cout << FMOD_ErrorString(system->getVersion(&version)) << endl;

cout << FMOD_ErrorString(system->init(1, FMOD_INIT_NORMAL, 0)) << endl;

cout << FMOD_ErrorString(system->createStream("C:/wave.mp3", FMOD_HARDWARE | FMOD_LOOP_NORMAL | FMOD_2D, 0, &sound)) << endl;

system->playSound(FMOD_CHANNEL_FREE, sound, false, &channel);
}[/code:3jgq2b70]

Please enlighten me.

[b:3jgq2b70]UPDATE:[/b:3jgq2b70]
Solved. The sound system fails after the thread exited. Putting an infinite while loop solved the problem.

  • You must to post comments
0
0

nothing failed, you just bailed out of your app before even hearing the sound.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.