Hi! I have a cassette player inside my game which is a programmer instrument that uses songs from an AudioTable.
If I switch between the different cassettes I get this warning
[FMOD] SoundI::getSubSound : Cannot switch sub-sounds on a playing stream, call Sound::stop first.
It also crashed some times…
// Inside LateUpdate
musicEventInstance.getPlaybackState(out var playbackState);
switch (playbackState)
{
case PLAYBACK_STATE.PLAYING:
{
// Getting information to set track time, example: 01:50 - 3:52
musicEventInstance.getTimelinePosition(out int timelinePosition);
CassettePlayer.instance.UpdateTrackDuration(timelinePosition);
// Get max length of current playing track
if (!gotMaxLength)
{
var result = musicSound.getOpenState(out var openState, out _, out _, out _);
if (result == RESULT.OK)
{
if (openState != OPENSTATE.ERROR)
{
musicSound.getSubSound(subSoundIndex, out var subSound); <-- THIS THROWS THE WARNING
// Wait until the length have been fetched! //
result = subSound.getLength(out var length, TIMEUNIT.MS);
if (result == RESULT.OK)
{
CassettePlayer.instance.SetMaxTrackDuration((int) length);
gotMaxLength = true;
}
}
}
}
break;
}
}
And sometimes when I stop the programmer sound from playing I get this warning as well, might be a key to the puzzle I don’t know
[FMOD] EventInstance::flushReleaseQueue : Event instance has programmer sounds pending release, update thread will be bloocked until programmer sounds are released.