Hi, in my Unity Project, I’m trying to have 2 separate Studio Systems, both routed to separate windows outputs, on both of which I’d like to play events.
With the help of this forum post, I made two separate Studio Systems. I can assign a different driver/output to each and play a sound on either one of them using:
IEnumerator PlaySoundAndReleaseSystem1()
{
var soundResult_test = FMODUnity.RuntimeManager.CoreSystem.createSound( application.dataPath + "/Sounds/DemoSound.mp3", FMOD.MODE.DEFAULT, out var sound_test);
FMODUnity.RuntimeManager.CoreSystem.playSound(sound_test, cgSys1, false, out chaSys1);
bool isPlaying = true;
while (isPlaying)
{
chaSys1.isPlaying(out isPlaying);
yield return null;
}
sound_test.release();
}
Or the same, on the secondary sysrtem by replacing “CoreSystem” with “SecondaryCoreSystem”. This works well and plays the sound.
Now, I’d like to be able to play events from a bank, instead of using mp3 files. Playing an event on the (Primary/Original) StudioSystem works as it should, however, playing an event on my SecondaryStudioSystem gives issues.
I have the following:
using UnityEngine;
public class EventOnSecondarySystem : MonoBehaviour
{
private void Start()
{
FMOD.Studio.Bank masterBankStrings;
FMOD.RESULT result = FMODUnity.RuntimeManager.SecondaryStudioSystem.loadBankFile("C:\\...\\Master.bank", FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out masterBankStrings);
UnityEngine.Debug.Log("Loading Master Bank: " + result);
FMOD.Studio.Bank masterBank;
result = FMODUnity.RuntimeManager.SecondaryStudioSystem.loadBankFile("C:\\...\\Master.strings.bank", FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out masterBank);
UnityEngine.Debug.Log("Loading Master Bank Strings: " + result);
FMOD.Studio.Bank bankSecondarySystem;
string bank_path = "C:\\...\\VO.bank";
result = FMODUnity.RuntimeManager.SecondaryStudioSystem.loadBankFile(bank_path, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out bankSecondarySystem);
UnityEngine.Debug.Log("Loading Secondary Bank: " + result);
FMOD.Studio.EventDescription eventDescription;
result = FMODUnity.RuntimeManager.SecondaryStudioSystem.getEvent("event:/VO/Welcome", out eventDescription);
UnityEngine.Debug.Log("Result of getEvent: " + result);
FMOD.Studio.EventInstance eventInstance;
result = eventDescription.createInstance(out eventInstance);
UnityEngine.Debug.Log("Result of createInstance: " + result);
if (result == FMOD.RESULT.OK && eventInstance.isValid())
{
UnityEngine.Debug.Log("Event instance is valid.");
FMOD.RESULT startResult = eventInstance.start();
UnityEngine.Debug.Log("Result of starting event: " + startResult);
FMOD.Studio.PLAYBACK_STATE playbackState;
eventInstance.getPlaybackState(out playbackState);
UnityEngine.Debug.Log("Playback state: " + playbackState);
eventInstance.release();
}
else
{
UnityEngine.Debug.LogError("Event instance is not valid or creation failed.");
}
}
}
All of the result
checks give OK, and when it gets to eventInstance.Start(),
it also gives OK.
The getPlaybackState
gives
Playback state: STARTING
UnityEngine.Debug:Log (object)
EventOnSecondarySystem:Start () (at Assets/Scripts/EventOnSecondarySystem.cs:44)
However, no sound can be heard at all. Any ideas on what I’m doing wrong?
I do get this warning:
[FMOD] AsyncCommandBuffer::growBuffer : Growing command buffer to 262144 bytes. Initial command buffer size can be tuned to avoid dynamic growth using Studio::System::setAdvancedSettings()
UnityEngine.Debug:LogWarning (object)
FMODUnity.RuntimeUtils:DebugLogWarning (string) (at Assets/Plugins/FMOD/src/RuntimeUtils.cs:564)
FMODUnity.RuntimeManager:DEBUG_CALLBACK (FMOD.DEBUG_FLAGS,intptr,int,intptr,intptr) (at Assets/Plugins/FMOD/src/RuntimeManager.cs:108)
FMOD.Studio.System:getBus (string,FMOD.Studio.Bus&) (at Assets/Plugins/FMOD/src/fmod_studio.cs:444)
FMODUnity.RuntimeManager:ApplyMuteState () (at Assets/Plugins/FMOD/src/RuntimeManager.cs:1569)
FMODUnity.RuntimeManager:Update () (at Assets/Plugins/FMOD/src/RuntimeManager.cs:649)
But I’m not sure if this is related to the sound not playing, or if that is a separate issue.
Any help is greatly appreciated! (Please not that I’m not so super experienced in coding)