Answered
1
0

Hi

A while back I made a quite basic system with three songs in a multi sound playlist, every time the game starts up one of them is selected at random and it worked just as planned ingame. But now for some reason it doesn’t work that way anymore. When i preview the event in Fmod Studio it works as it should but when I try it ingame the first song in the playlist is always selected first.

I’ve tried using different play percentages, switching the dice button on and off, changing the sound module to scattered and so on but nothing seems to change anything (except if I change the order of the sounds of course). Finally I tried putting the sounds on the timeline and using three transitions with a probability of 30% each. It worked perfect in Fmod Studio but ingame the first transition would always be selected.

I’m was using Fmod Studio 1.05.11 when I realized the problem, tried upgrading to 1.05.15 but nothing changed.

Thanks!

  • You must to post comments
Best Answer
0
0

Are you only creating/playing the event once? If so, have you tried setting FMOD_ADVANCEDSETTINGS.randomSeed in your game when you create the sound system? Setting it to the system time should ensure you get correctly randomized playback.

  • You must to post comments
0
0

The FMOD_ADVANCEDSETTINGS.randomSeed was actually not set, but unfortunately, fixing that didn’t change anything…
Here’s the code:

if (!FMODCHECK(FMOD::Studio::System::create(&m_studioSystem)))   return;    FMODCHECK(m_studioSystem->getLowLevelSystem(&m_system));

 FMODCHECK(m_system->set3DSettings(AudioDopplerScale, AudioDistanceFactor, AudioRolloffScale));

 m_advancedSettings.cbSize = sizeof(FMOD_ADVANCEDSETTINGS);  FMODCHECK(m_system->getAdvancedSettings(&m_advancedSettings));  m_advancedSettings.cbSize = sizeof(FMOD_ADVANCEDSETTINGS);  m_advancedSettings.randomSeed = static_cast<unsigned int>(time(o));  FMODCHECK(m_system->setAdvancedSettings(&m_advancedSettings));

 // Initialize FMOD.  if (!FMODCHECK(m_studioSystem->initialize(AudioChannels, FMOD_STUDIO_INIT_NORMAL, FMOD_INIT_3D_RIGHTHANDED, 0x0)))   return;
  • You must to post comments
0
0

I’ve tested with your code and it does appear to work in Studio 1.06.01. If you’re still encountering the issue, please send an email to support@fmod.org (and mention the version you’re using) so that we can do further investigation.

  • G-man
    I checked it again this morning and strangely enough it seems to be working now... I have no idea why it didn't work last time I checked since we haven't changed anything around there, but I suspect some kind of human error. Why isn't FMOD_ADVANCEDSETTINGS.randomSeed set by default by the way?
  • Patrick Wadsworth
    We don't set randomSeed as this is a common convention. For example, you need to call srand() for the standard C library if you want rand() to be non-deterministic.
  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.