Multi Sound Playlist Shuffle is Not Randomizing?

The playlist in a multi sound object appears to play in a shuffled order when shuffle is enabled but it seems to always play the SAME shuffled order every time I restart my application.

This is obviously not desired behaviour - why does the shuffle function not have a random seed set each time the bank is loaded?

Is there any way to actually randomize the play list of a multi sound object properly?

EDIT: Just want to note that this behaviour is not evident INSIDE Studio as it plays randomly all the time, it only happens when I’m using the events from within my app.

EDIT 2: Using the following code - still no change in behaviour. Tried setAdvancedSettings both before and after system->initialize, with no change. Not seeing any errors. cbSize is 108, and random seed (as expected) is always different and greater than 2. Any idea what I’m doing wrong?

    system = NULL;
	ERRCHECK(FMOD::Studio::System::create(&system));
	
	lowLevelSystem = NULL;
	ERRCHECK(system->getLowLevelSystem(&lowLevelSystem));
	ERRCHECK(lowLevelSystem->setSoftwareFormat(0, FMOD_SPEAKERMODE_STEREO, 0));

	FMOD_ADVANCEDSETTINGS settings;
	settings.randomSeed = util.randInt(2, 10000);
	settings.cbSize = sizeof(FMOD_ADVANCEDSETTINGS);
	std::cout << " settings.cbSize= " << settings.cbSize << "  settings.randomSeed =" << settings.randomSeed << "\n";
	ERRCHECK(lowLevelSystem->setAdvancedSettings(&settings));


	ERRCHECK(system->initialize(1024, FMOD_STUDIO_INIT_NORMAL, FMOD_INIT_NORMAL, extraDriverData));

Hi Nicholas,

Randomisation in Multi Sounds is based on the random seed provided by your FMOD initialization settings. By default, the random seed will default to 0, meaning that you will get the same shuffled order deterministically, each time you start up your game.

You can read more about Random Seeds here:

Our Unreal Engine 4 and Unity integrations both set the random seed to the system time, so you should get a quasi-random behaviour in game.

If you are using a custom integration, you can set the random seed on the advance settings struct by using the System::setAdvancedSettings function and setting FMOD_ADVANCEDSETTINGS.randomSeed. Please see our API documentation for more details:
http://www.fmod.org/documentation/#content/generated/FMOD_System_SetAdvancedSettings.html
http://www.fmod.org/documentation/#content/generated/FMOD_ADVANCEDSETTINGS.html

1 Like

Thanks for the info - having trouble implementing it. See edit above for code.

Hi Nicholas,

You need to make sure that you are setting these settings before FMOD Studio is initialised. Could you let me know how you are building your game (Unity, UE4, custom?)?

1 Like

Using Visual Studio Community 2015 with C++. Code above shows that I’m doing it before initialize - what else can I try?

Hi Nicholas,

Your code looks correct and should work, which leads me to believe there might be an issue elsewhere in your game code. Unfortunately without seeing the source code we can’t really offer further advice.

Are you able to reproduce this in a separate project (eg. press a button to play the multi sound)?

Hello, also having this issue. Multisound instruments are not randomized correctly.

Have you tried editing the random seed before initializing the FMOD system?