FMOD Integration — Reasons It’s An Indispensable Audio Tool

  • #10, by lance-montgomeryWednesday, 27. January, 20:03 2 months ago
    @Simon I really, really appreciate you looking into it!!

    I know that with Unity, integration involves turning off Unity's built-in audio system. I could be mistaken on what this means exactly, but I know that within Unity you can see all of FMOD's channels, and I've always assumed that those were FMOD's own channels to replace Unity's channels, not that they're routed through Unity channels.

    I'm assuming it wouldnt be necessary to turn off VS's audio system like you do with Unity. Would there be a way to "sideload" FMOD and run it in parallel?

    If it makes things simpler, all I'd need to take advantage of FMOD's power is:
    • Load a build and its "Master Bank". Forget the ability to selectively load banks. If it makes it easier to just automatically load the Master Bank and nothing else, that's totally fine!
    • See all the events in that bank. It would even be fine to not worry about displaying heirarchy, if that makes it easier.
    • Play and stop an event.
    • Set the value of an active event's parameter or a global parameter. If this is too difficult, I can even use an event to set a parameter!

    As for html5, FMOD supports it!

    Please let me know whatever else you find out about it! I'm super eager to hear about it!

    Thanks again for even just considering it, Simon!

    Newbie

    7 Posts


  • #11, by lance-montgomeryMonday, 29. March, 21:42 2 weeks ago
    I'm now trying to assess how much time an integration would take.
    @Simon I just wanted to drop by again and see if you've been able to make any progress on deciding what you would need to do to make an integration work.
    That would need custom code on your side. So at that position I could already just all the fmod stuff into a programming language in Visionaire. So I don't need to worry about events and such. But I'm not sure that would make anyone happy.
    Even if the only way to get FMOD to integrate is for me to have to use Lua to manually trigger FMOD events, I can work with that! Anything to get FMOD working in VS! I mean, ideally having an action would be the best but at this point I'd take anything.

    Newbie

    7 Posts

  • #12, by SimonSMonday, 29. March, 21:46 2 weeks ago
    I'm working on the ilios action parts, after they're done, there can be tools built to include fmod in the editor. But I already wrote the dynlib code für ilios, so if you want to try (but it's rather complex):

    struct FMOD_STUDIO_PARAMETER_DESCRIPTION
    {
     IntPtr name;
     long id;
     float minimum, maximum, defaultvalue;
     int type, flags;
    }
    class fmod
    {
     static DynLib lib = DynLib.Load("fmodstudio.dll");
     static var FMOD_Studio_System_Create = lib.GetSymbol("FMOD_Studio_System_Create") as FuncPtr;
     static var FMOD_Studio_System_Initialize = lib.GetSymbol("FMOD_Studio_System_Initialize") as FuncPtr;
     static var FMOD_Studio_System_LoadBankFile = lib.GetSymbol("FMOD_Studio_System_LoadBankFile") as FuncPtr;
     static var FMOD_Studio_System_Update = lib.GetSymbol("FMOD_Studio_System_Update") as FuncPtr;
     static var FMOD_Studio_Bank_GetEventCount = lib.GetSymbol("FMOD_Studio_Bank_GetEventCount") as FuncPtr;
     static var FMOD_Studio_Bank_GetEventList = lib.GetSymbol("FMOD_Studio_Bank_GetEventList") as FuncPtr;
     static var FMOD_Studio_EventDescription_GetPath = lib.GetSymbol("FMOD_Studio_EventDescription_GetPath") as FuncPtr;
     static var FMOD_Studio_EventDescription_CreateInstance = lib.GetSymbol("FMOD_Studio_EventDescription_CreateInstance") as FuncPtr;
     static var FMOD_Studio_EventInstance_Start = lib.GetSymbol("FMOD_Studio_EventInstance_Start") as FuncPtr;
     static var FMOD_Studio_EventInstance_Stop = lib.GetSymbol("FMOD_Studio_EventInstance_Stop") as FuncPtr;
     static var FMOD_Studio_System_GetParameterDescriptionByName = lib.GetSymbol("FMOD_Studio_System_GetParameterDescriptionByName") as FuncPtr;
     static var FMOD_Studio_EventDescription_GetParameterDescriptionByName = lib.GetSymbol("FMOD_Studio_EventDescription_GetParameterDescriptionByName") as FuncPtr;
     static var FMOD_Studio_System_SetParameterByID = lib.GetSymbol("FMOD_Studio_System_SetParameterByID") as FuncPtr;
     static var FMOD_Studio_EventInstance_SetParameterByID = lib.GetSymbol("FMOD_Studio_EventInstance_SetParameterByID") as FuncPtr;
     static var FMOD_Studio_System_GetEvent = lib.GetSymbol("FMOD_Studio_System_GetEvent") as FuncPtr;
     static IntPtr system, bank, musicbank;
     static
     {
      FMOD_Studio_System_Create(ref system, 0x00020107);
      FMOD_Studio_System_Initialize(system, 1024, 0x0, 0x0, null);
      FMOD_Studio_System_LoadBankFile(system, @"C:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\examples\media\Master.bank".IntPtr, 0, ref bank);
      FMOD_Studio_System_LoadBankFile(system, @"C:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\examples\media\Master.strings.bank".IntPtr, 0, ref bank);
      FMOD_Studio_System_LoadBankFile(system, @"C:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\examples\media\SFX.bank".IntPtr, 0, ref bank);
      FMOD_Studio_System_LoadBankFile(system, @"C:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\examples\media\Music.bank".IntPtr, 0, ref musicbank);
      int capacity;
      FMOD_Studio_Bank_GetEventCount(bank, ref capacity);
      Debug.Print("$bank $capacity events");
      IntPtr[] rawArray = new IntPtr[](capacity);
      int actualCount;
      FMOD_Studio_Bank_GetEventList(bank, rawArray.IntPtr, capacity, ref actualCount);
      for ptr in rawArray
      {
       Debug.Print("$ptr");
       string space;
       space.Resize(256);
       int read;
       FMOD_Studio_EventDescription_GetPath(ptr, space.IntPtr, 256, ref read);
       space.Resize(read);
       Debug.Print(space);
      }
      IntPtr instance;
      Debug.Print(FMOD_Studio_EventDescription_CreateInstance(rawArray[7], ref instance).ToString());
      Debug.Print(FMOD_Studio_EventInstance_Start(instance).ToString());
      IntPtr instance2;
      IntPtr music;
      FMOD_Studio_System_GetEvent(system, "event:/Music/Level 01".IntPtr, ref music);
      Debug.Print(FMOD_Studio_EventDescription_CreateInstance(music, ref instance2).ToString());
      Debug.Print(FMOD_Studio_EventInstance_Start(instance2).ToString());
      Vis.SetDelay(1000, [instance, instance2, music]{
       FMOD_Studio_EventInstance_Stop(instance, 0);
       FMOD_STUDIO_PARAMETER_DESCRIPTION descr;
       Debug.Print(FMOD_Studio_EventDescription_GetParameterDescriptionByName(music, "Progression".IntPtr, ref descr).ToString());
       Debug.Print(FMOD_Studio_EventInstance_SetParameterByID(instance2,descr.id,1.0,false).ToString());
      });
      while(true)
      {
       NextFrame();
       FMOD_Studio_System_Update(system);
      }
     }
    }

    So you need to copy fmodstudio.dll to the visionaire folder or set the right path, it loads one of the examples and plays a sound and then changes a param after a second.

    Thread Captain

    1425 Posts

  • #13, by lance-montgomeryFriday, 02. April, 13:58 2 weeks ago
    Simon, this is phenomenal!

    That code is beyond my comprehension, but what you're doing sounds very hopeful. I can't express how excited I am for this integration! Thank you again for taking the time and effort to do this!

    Newbie

    7 Posts

  • #14, by rosstaylorMonday, 12. April, 11:21 5 days ago
    ?

    Newbie

    1 Posts

Write post