Yes, I have wrapped every FMOD function with a check function that stops the program (and reports the output) unless the result is OK. And (unfortunately), all FMOD functions return with OK so the program runs fine - but never loads the samples.
static void emitStudioEventExample()
{
var system = initStudioSystem();
Console.WriteLine("Loading banks");
FMOD.Studio.Bank bank;
checkResult(system.loadBankFile("bank/Build/Desktop/Master.bank", FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out bank));
FMOD.Studio.Bank stringsBank;
checkResult(system.loadBankFile("bank/Build/Desktop/Master.strings.bank", FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out stringsBank)); // Must be loaded for Event paths to work
FMOD.Studio.LOADING_STATE lState = FMOD.Studio.LOADING_STATE.ERROR;
Console.WriteLine("Loading sample data");
checkResult(bank.loadSampleData());
do
{
checkResult(bank.getSampleLoadingState(out lState));
Console.WriteLine(lState.ToString());
System.Threading.Thread.Sleep(500);
}
while (lState != FMOD.Studio.LOADING_STATE.LOADED);
checkResult(system.flushSampleLoading());
FMOD.Studio.EventDescription[] evList;
bank.getEventList(out evList);
foreach (var evv in evList)
{
string path;
evv.getPath(out path);
Console.WriteLine(path);
Guid guid;
evv.getID(out guid);
Console.WriteLine(guid);
}
Console.WriteLine("Getting event");
FMOD.Studio.EventDescription ev;
checkResult(system.getEvent("event:/Event", out ev));
checkResult(ev.loadSampleData());
do
{
// Gets stuck here with "LOADING"
checkResult(ev.getSampleLoadingState(out lState));
Console.WriteLine(lState);
System.Threading.Thread.Sleep(500);
}
while (lState != FMOD.Studio.LOADING_STATE.LOADED);
Console.WriteLine("Creating new event instance");
FMOD.Studio.EventInstance instance;
checkResult(ev.createInstance(out instance));
checkResult(instance.start());
while (true) {
FMOD.Studio.PLAYBACK_STATE pState;
instance.getPlaybackState(out pState);
Console.WriteLine(pState);
System.Threading.Thread.Sleep(500);
};
}
It looks like you need to add system.update() to each of your while loops.
…calling Studio::System::update from your game is a fast operation which submits the queued command buffer to the asynchronous thread and performs any asynchronous callbacks due to processing on the Studio update thread.