2

I'm trying to add sound to an app of mine using FMOD, visual studio 2012, and c++. I got the latest version (1.02) and installed it. Everything seems to work fine but (varibles?) like FMOD_CHANNEL_FREE and FMOD_CHANNEL_REUSE are undefined. Everyone I talked to had this problem and never solved it, and everyone online doesn't seem to have this issue.Another thing I noticed is that the parameters for playSound have switched. For me:

 system->playSound(sound->second, FMOD_CHANNEL_FREE, false, 0);

Everywhere else

system->playSound( FMOD_CHANNEL_FREE, sound->second, false, 0);

I followed the installed instructions, included fmod.hpp and fmod_errors.h, uninstalled, re-installed, and google has failed me. If it helps the parameter needed in channel_free spot is a FMOD::ChannelGroup

Any ideas? If you need more code, put a comment (not answer) and I'll comply.

user2832863
  • 21
  • 1
  • 2

2 Answers2

4

With the change from FMOD Ex to FMOD Studio some of the APIs have been revised, this is one such case. The first parameter from the FMOD Ex version of System::playSound has been removed, the default behavior is always FMOD_CHANNEL_FREE now.

The new second parameter is for specifying the FMOD::ChannelGroup to play this channel in. You are not required to set this, specify NULL if you want the FMOD Ex behavior of playing the sound in the master channel group.

Correct usage for FMOD Studio would be:

FMOD::System *system = NULL; // create and init not shown
FMOD::Sound *sound = NULL; // create not shown

FMOD::Channel *channel = NULL;
FMOD_RESULT result = system->playSound(sound, NULL, false, &channel);
Mathew Block
  • 1,613
  • 1
  • 10
  • 9
0

they are not switched, did you look at the headerfile? The second parameter is a pointer to a channelgroup, and you're trying to pass an integer to it?

Regardless, the free/reuse flags are gone, just delete them. Internally channels are always 'free'.