I am currently working on a game on Unity3D and I have seen the tutorials on how to create interactive music system. These videos all use just one “track”.
On the game I’m working, the soundtrack has several music tracks. I have been searching around but I still haven’t found how to make a music system with multiple tracks.
How can I cycle through the entire OST?
Do I simply play the corresponding events?
What is the best way to store the list of events to play?
A more advanced way of selecting switching between different events would be to make a ‘container event’, that has event sounds referencing each of the music events. You could arrange the event sounds on a parameter that switches between different pieces of music based on the parameter value.
Thank you for your reply! On a related note is there a way to get the output level from an event? In my events there are some transitions to silence so that the music isn’t playing at all times and I would like to know if there is a way to get the output volume of an event. The only thing I could find was the Studio.EventInstance.getVolume (http://www.fmod.org/documentation/#content/generated/FMOD_Studio_EventInstance_GetVolume.html) but from what I gathered that returns the volume set in FMOD Studio and not the output level.
Using metering you can get the current volume per channel.
Basically get the tail dsp (before any panning or volume control), enable metering and get the metering info whenever you need the latest data.
Here is a short example:
[FMODUnity.EventRef] public string eventRef;
FMOD.Studio.EventInstance instance;
FMOD.ChannelGroup channelGroup;
FMOD.DSP metering;
FMOD.DSP_METERING_INFO dspInfo = new FMOD.DSP_METERING_INFO();
/* Start */
instance = FMODUnity.RuntimeManager.CreateInstance(eventRef);
instance.start();
instance.getChannelGroup(out channelGroup);
channelGroup.getDSP(FMOD.CHANNELCONTROL_DSP_INDEX.TAIL, out metering);
metering.setMeteringEnabled(false, true);
/* Call this before checking the data */
metering.getMeteringInfo(null, dspInfo);
From there you can use the dspInfo to get the volume of each channel.