Adaptive music parameters question

Hey! Is there any way to play music track, after parameter changes, from the specific beat (or time)?

example:

Track no.1 playing. At the 6th beat the parameter (triggered by player hit the collider for example) changing music to track no.2.
Is it possible, when the parameter goes back to track no.1, to play from the 6th beat instead of begining of the track?

Kindest regards!

Hi,

Yes, this can be done using Channels and Channel Groups. Further explained under Core API Reference | Channels and Core API Reference | ChannelGroup respectively.

To retrieve the channel and channelgroup follow this example.

Return channel
private FMOD.RESULT ReturnEventChannel(FMODUnity.StudioEventEmitter eventEmitter, out FMOD.Channel requestedChannel, out FMOD.ChannelGroup channelsGroup)
{
	requestedChannel = new FMOD.Channel();
	channelsGroup = new FMOD.ChannelGroup();

	FMOD.RESULT result = eventEmitter.EventInstance.getChannelGroup(out FMOD.ChannelGroup newgroup);

	//Checking at every step if there is an error which will return a invalid result 
	if (result != FMOD.RESULT.OK)
	{
		Debug.Log("Failed to retrieeve parent channel group with error: " + result);
		return result;
	}

	result = newgroup.getGroup(0, out channelsGroup);

	if (result != FMOD.RESULT.OK)
	{
		Debug.Log("Attmpeting with parent group");
		result = newgroup.getChannel(0, out requestedChannel); 

		if (result != FMOD.RESULT.OK)
        {
			Debug.Log("Failed with parent group");
			return result; 
        }
		else
        {
			Debug.Log("Retrieved channel");
			return result; 
        }
		//return result;
	}

	result = channelsGroup.getChannel(0, out requestedChannel);

	if (result == FMOD.RESULT.OK)
	{
		Debug.Log("Retrieved the correct channel");
		return result;
	}
	else
	{
		Debug.Log("Failed to find the right channel with error: " + result);
		return result;
	}
}

Now when the player hits the collider, you will want to use channel.getPosition(). This will allow us to cache the playback position of the current sound. Before we transition to the next sound, we will want to call FMODUnity.RuntimeManager.StudioSystem.flushCommands() and FMODUnity.RuntimeManager.StudioSystem.flushSampleLoading(). These will block the calling thread to make sure there isn’t any lag when we to swap to the new sound.
When the parameter is updated, set the cached playback position of the new sound using channel.setPosition().

Hope this helps!