0
0

I’ve just started working with FMOD, following the tutorial and referencing the playsound example distributed with the API. Before writing this, I spent quite a while searching through the forums to see if I’ve missed something, but to no avail.

As far as I can tell the following code should work:

[code:t4itzdlh]

include <cstdio>

include <cstdlib>

include <iostream>

include <fmod.hpp>

using namespace std;

int main()
{
cout << "FMOD C++ Tutorial" << endl;

FMOD::System    *system;
FMOD::Sound     *sound;
FMOD::Channel   *channel;

FMOD_RESULT result;

FMOD::System_Create(&amp;system);

result = system-&gt;init(32, FMOD_INIT_NORMAL, NULL);

result = system-&gt;createSound(&quot;../swish.wav&quot;, FMOD_DEFAULT, NULL, &amp;sound);
result = system-&gt;playSound(FMOD_CHANNEL_FREE, sound, false, &amp;channel);

sound-&gt;release();
system-&gt;release();

char foo;
cin &gt;&gt; foo;
return 0;

}
[/code:t4itzdlh]

This code was written after I had followed the tutorial’s code, then also followed the code provided in the Windows platform specific issues section of the docs. In short, its the condensed aftermath of my attempts. The results have been consistently the same throughout.

All of the returns to [i:t4itzdlh]result[/i:t4itzdlh] are FMOD_OK.
I have changed the sounds from various .wav files to .mp3 I have on my system, eventually using the sounds out of the examples solution provided with the API.
I have enumerated through the driver list (I’m using an azalia onboard sound device for now) to ensure I’m using the proper one.
I have set the speakermode (both manually and from the windows platform specific issues code), its defaulted to stereo.

Despite all of this, the executable seems to run without an error; it simply doesn’t play the loaded sound. No speaker pops, no sign whatsoever that output is being generated. Even in the mixer controls there is no sign on the volume indicator that a sound is being played.

The rub: I can compile the playsound example, and it plays sound perfectly well.

I am running Vista x64 with realtek azalia onboard sound, building under VS2008 as win32 (with the win32 API)… and I have no idea what I’ve missed or implemented incorrectly.

Any help would be extraordinarily appreciated!

  • You must to post comments
0
0

Hey Rudi, I must warn you I am fairly new to C++ but I will just take a shot at this … seems to me you are releasing the sound and system before it gets a chance to play my friend. You should make yourself a function to release the system and call it when you press a key or such. I hope that will put you in the right direction :)

  • You must to post comments
0
0

After playing the sound, call update every x ms, until either the sound has finished, or you press a key to exit.

At the moment, you start the sound, then release it instantly.

  • You must to post comments
0
0

Many thanks both Jess and a1psx, both the key input option and the update() call fixed the problem quite nicely.

I’m thrilled to be able to move forward, albeit feeling a bit sheepish at the moment.

Thanks again!

  • You must to post comments
0
0

No reason to feel sheepish … just glad we could help you :)

  • You must to post comments
0
0

Could that be the problem with mine code in the post I made?

What command do I use to call the update?

It’s not the system->Update (); would it?

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.