Getting empty events with studioSystem.loadBankFile

I have a problem with the banks being loaded being empty when trying to use them.
I have tried two banks, the first master.bank with 8 events and a smaller testbank.bank with one event. Loading the first gives 8 empty banks and the second gives 1 empty bank so something is loaded but not the contents of the banks. I am using version 2.03.02 (Early Access) both for the studio editor that exports the banks and for the engine.

I initialize like this (C#):

public override void _Ready()
{
// Create FMOD Studio system
FMOD.Studio.System.create(out studioSystem);
studioSystem.initialize(512, FMOD.Studio.INITFLAGS.NORMAL, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
GD.Print(“FMOD Studio system initialized.”);
}

Load like this:

public bool LoadBank(string bankPath)
{
// Convert the relative Godot path to an absolute path on the system
string absoluteBankPath = ProjectSettings.GlobalizePath(bankPath);
GD.Print("Loading bank from: " + absoluteBankPath);

Bank bank;
FMOD.RESULT result = studioSystem.loadBankFile(absoluteBankPath, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out bank);

if (result == FMOD.RESULT.OK)
{
    GD.Print("Bank loaded successfully: " + absoluteBankPath);
    return true;  // Indicate success
}
else
{
    GD.Print("Failed to load bank: " + result);
    return false;  // Indicate failure
}

}

And then do a check like this:

public void ListAllEventsInBank()
{
studioSystem.getBankList(out Bank banks); // Get all banks currently loaded
foreach (var bank in banks)
{
bank.getPath(out string bankPath); // Get the path of the bank
GD.Print("Listing events in bank: " + bankPath);

    // Get all events in this bank
    bank.getEventList(out EventDescription[] events);
    foreach (var eventDescription in events)
    {
        eventDescription.getPath(out string eventPath);  // Get the path of each event
        GD.Print("Event: " + eventPath);
    }
}

}

Is there some extra step needed, or should I use some other settings? Another flag? Or, should they be retrieved in another way? What is going on? Since I get no error codes initializing the system or loading the bank you would suggest things are Ok but when retrieving the banks they are there in the correct number but empty and cannot be retrieved with contents or played.

An update.

I added a few lines in the LoadBank method:

// Load sample data for the bank
loadedBank.loadSampleData();
GD.Print("Sample data loading initiated for bank: " + absoluteBankPath);

Thinking that perhaps only the meta data had been loaded but not the audio.

I test the methods/Fmood through a little interface run with keys.

Press ‘L’ to load the bank, ‘V’ to view bank contents, ‘P’ to play music, ‘S’ to stop, and ‘C’ to set a parameter.

When I press the L, this is what has been printed out:

Loading FMOD DLLs from: F:/Godot/Projects/testing-fmood/lib
FMOD Init Result: OK
FMOD Studio system initialized.
Game started and text set!
Loading bank from: F:/Godot/Projects/testing-fmood/musicbanks/Desktop/Master.bank
Bank loaded successfully: F:/Godot/Projects/testing-fmood/musicbanks/Desktop/Master.bank
Sample data loading initiated for bank: F:/Godot/Projects/testing-fmood/musicbanks/Desktop/Master.bank
Bank metadata loaded. Now loading sample data . . .

These are my interpretations of what happens. For instance, this in the beginning, an updated _Ready() method:

public override void _Ready()
{
// Create FMOD Studio system
FMOD.Studio.System.create(out studioSystem);
string logFilePath = “F:/Godot/Projects/testing-fmood/fmod_log.txt”; // Set the log file path explicitly
FMOD.DEBUG_FLAGS flags = FMOD.DEBUG_FLAGS.LOG;
FMOD.Debug.Initialize(flags, FMOD.DEBUG_MODE.FILE, null, logFilePath);

//studioSystem.initialize(512, FMOD.Studio.INITFLAGS.NORMAL, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
FMOD.RESULT initResult = studioSystem.initialize(512, FMOD.Studio.INITFLAGS.NORMAL, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
GD.Print("FMOD Init Result: " + initResult.ToString());

GD.Print("FMOD Studio system initialized.");

}

Now this looks as if things are loaded but they are not which we see if I press V:

Listing events in bank:
Event:
Event:
Event:
Event:
Event:
Event:
Event:
Event:
Event:
Event:
Event:
Event:

This bank happens to contain these many events, a previous check with a simple bank with just one event printed out one empty event. So some things are working.

I also have a check in a method [public override void _Process(double delta)] that is regulary called:

if (isLoading && bank.isValid())
{
FMOD.Studio.LOADING_STATE loadingState;
bank.getSampleLoadingState(out loadingState);

if (loadingState == FMOD.Studio.LOADING_STATE.LOADED)
{
    GD.Print("Sample data fully loaded.");
    label.Text = "Bank and sample data fully loaded. Press 'P' to play music.";
    isLoading = false;  // Stop tracking, sample data is fully loaded
}
/*else if (loadingState == FMOD.Studio.LOADING_STATE.LOADING)
{
    GD.Print("Loading sample data...");
}*/

}

It never says that Sample data fully loaded.
(The code that has been commented out will just print an endless string of Loading sample data so I found it pretty useless.)

So, why are the events not properly loaded. Any ideas?

Regarding the added lines [ string logFilePath = “F:/Godot/Projects/testing-fmood/fmod_log.txt”; // Set the log file path explicitly
FMOD.DEBUG_FLAGS flags = FMOD.DEBUG_FLAGS.LOG;
FMOD.Debug.Initialize(flags, FMOD.DEBUG_MODE.FILE, null, logFilePath);] this did unfortunately not result in a log file. So here is another problem.

Any help will be deeply appreciated!

An update II.

In an attempt to understand this better I generated a small bank with just one event, used PCM and a separation of meta data and audio.

Here is how the updated load bank method looks:

public bool LoadSeparatedBanks(string bankFolder, string bankName, out Bank loadedBank)
{
// Build the paths for the metadata bank and the assets bank
string metadataBankPath = ProjectSettings.GlobalizePath($“{bankFolder}/{bankName}.bank”);
string assetsBankPath = ProjectSettings.GlobalizePath($“{bankFolder}/{bankName}.assets.bank”);

 GD.Print("Loading metadata bank from: " + metadataBankPath);
 GD.Print("Loading assets bank from: " + assetsBankPath);

 // Initialize the out parameter for metadata bank
 loadedBank = default;
 Bank assetsBank;

 // Load the metadata bank
 FMOD.RESULT resultMeta = studioSystem.loadBankFile(metadataBankPath, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out loadedBank);
 if (resultMeta != FMOD.RESULT.OK)
 {
     GD.Print("Failed to load metadata bank: " + resultMeta.ToString());
     return false;  // Indicate failure
 }
 GD.Print("Metadata bank loaded successfully: " + metadataBankPath);

 // Load the audio assets bank
 FMOD.RESULT resultAssets = studioSystem.loadBankFile(assetsBankPath, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out assetsBank);
 if (resultAssets != FMOD.RESULT.OK)
 {
     GD.Print("Failed to load assets bank: " + resultAssets.ToString());
     return false;  // Indicate failure
 }
 GD.Print("Assets bank loaded successfully: " + assetsBankPath);

 // Load sample data for the banks
 FMOD.RESULT sampleLoadResult = loadedBank.loadSampleData();
 GD.Print("Sample data loading result for metadata bank: " + sampleLoadResult.ToString());

 sampleLoadResult = assetsBank.loadSampleData();
 GD.Print("Sample data loading result for assets bank: " + sampleLoadResult.ToString());
 return true;  // Indicate success

}

Unfortunately this did not make them load with any contents, even though we get OK result codes all the way as this output shows:

Loading FMOD DLLs from: F:/Godot/Projects/testing-fmood/lib
FMOD Init Result: OK
FMOD Studio system initialized.
Game started and text set!
Loading metadata bank from: F:/Godot/Projects/testing-fmood/musicbanks/Desktop/Small.bank
Loading assets bank from: F:/Godot/Projects/testing-fmood/musicbanks/Desktop/Small.assets.bank
Metadata bank loaded successfully: F:/Godot/Projects/testing-fmood/musicbanks/Desktop/Small.bank
Assets bank loaded successfully: F:/Godot/Projects/testing-fmood/musicbanks/Desktop/Small.assets.bank
Sample data loading result for metadata bank: OK
Sample data loading result for assets bank: OK
Bank loaded. Now loading sample data…
Listing events in bank:
Event:
Listing events in bank:
Failed to get event description: ERR_EVENT_NOTFOUND
Failed to play event: ERR_EVENT_NOTFOUND

The later parts is when I try to list the event contents. Since two banks are used - one for meta data and one for audio - it feels logical we get two outputs, the first is the same we have “Event” but not the full name [event:/SFX/Player/PlayerBullet] and the second line is presumably for the audio. Well, that is my guess.

And when I try to play an event we get the last two errors.

And we have the check in method that is regularly called:

if (isLoading && bank.isValid())
{
FMOD.Studio.LOADING_STATE loadingState;
bank.getSampleLoadingState(out loadingState);

 if (loadingState == FMOD.Studio.LOADING_STATE.LOADED)
 {
     GD.Print("Sample data fully loaded.");
     label.Text = "Bank and sample data fully loaded. Press 'P' to play music.";
     isLoading = false;  // Stop tracking, sample data is fully loaded
 }
 /*else if (loadingState == FMOD.Studio.LOADING_STATE.LOADING)
 {
     GD.Print("Loading sample data...");
 }*/

}

And that shows that we actually never get the bank loaded because the text “Sample data fully loaded.” is never shown . . . .

Any help would of course be deeply appreciated.

An Update III.

I have added som extra checks when loading and the code now looks like this:

 public override void _Process(double delta)
 {
     // Check if 'L' is pressed to load the bank
     if (Input.IsActionJustPressed("load_bank"))
     {
         if (!bankLoaded && !isLoading)
         {
             // Use the new LoadSeparatedBanks method with two out parameters for the banks
             bool bankLoadedSuccessfully = fmodWrapper.LoadSeparatedBanks("res://musicbanks/Desktop", "Master", out metaBank, out assetsBank);

             if (bankLoadedSuccessfully)
             {
                 isLoading = true;    // Now loading the sample data
                 GD.Print("Banks loaded. Now loading sample data...");
                 label.Text = "Metadata and assets banks loaded. Now loading sample data...";
             }
             else
             {
                 GD.Print("Failed to load banks.");
                 label.Text = "Failed to load banks. Try again.";
             }
         }
         else
         {
             GD.Print("Banks already loaded or still loading.");
         }
     }

     // Separate check for the metadata bank's sample data
     if (isLoading && metaBank.isValid() && !metaBankLoaded)
     {
         // Call studioSystem.update() to allow FMOD to process loading tasks
         fmodWrapper.StudioSystem.update();

         FMOD.Studio.LOADING_STATE metaLoadingState;
         metaBank.getSampleLoadingState(out metaLoadingState);

         if (metaLoadingState == FMOD.Studio.LOADING_STATE.LOADED)
         {
             GD.Print("Metadata bank sample data fully loaded.");
             label.Text = "Metadata bank sample data fully loaded.";
             metaBankLoaded = true;  // Track that metadata bank sample data is loaded
         }
         else
         {
             GD.Print("Still loading metadata bank sample data...");
         }
     }

     // Separate check for the assets bank's sample data
     if (isLoading && assetsBank.isValid() && !assetsBankLoaded)
     {
         // Call studioSystem.update() to allow FMOD to process loading tasks
         fmodWrapper.StudioSystem.update();

         FMOD.Studio.LOADING_STATE assetsLoadingState;
         assetsBank.getSampleLoadingState(out assetsLoadingState);

         if (assetsLoadingState == FMOD.Studio.LOADING_STATE.LOADED)
         {
             GD.Print("Assets bank sample data fully loaded.");
             label.Text = "Assets bank sample data fully loaded.";
             assetsBankLoaded = true;  // Track that assets bank sample data is loaded
         }
         else
         {
             GD.Print("Still loading assets bank sample data...");
         }
     }

     // If both banks are fully loaded, mark the loading process as complete
     if (metaBankLoaded && assetsBankLoaded && isLoading)
     {
         GD.Print("Both metadata and assets bank sample data fully loaded.");
         label.Text = "Both metadata and assets bank sample data fully loaded. Press 'P' to play music.";
         bankLoaded = true;
         isLoading = false;  // Stop tracking, sample data is fully loaded
     }

// Other code

I now load the meta and the assets separately to get a better understanding of what is going on and have added lines like this [ fmodWrapper.StudioSystem.update();] to make the system update. Also a lot of new printouts to see what happens.

Everything looks fine, except that the loaded events do not contain anything to list or to play. Outprints look like this:

Loading FMOD DLLs from: F:/Godot/Projects/testing-fmood/lib
FMOD Init Result: OK
FMOD Studio system initialized.
Game started and text set!
Loading metadata bank from: F:/Godot/Projects/testing-fmood/musicbanks/Desktop/Master.bank
Loading assets bank from: F:/Godot/Projects/testing-fmood/musicbanks/Desktop/Master.assets.bank
Metadata bank loaded successfully: F:/Godot/Projects/testing-fmood/musicbanks/Desktop/Master.bank
Assets bank loaded successfully: F:/Godot/Projects/testing-fmood/musicbanks/Desktop/Master.assets.bank
Sample data loading result for metadata bank: OK
Sample data loading result for assets bank: OK
Banks loaded. Now loading sample data…
Still loading metadata bank sample data…
Still loading assets bank sample data…
Still loading metadata bank sample data…
Still loading assets bank sample data…
Still loading metadata bank sample data…
Still loading assets bank sample data…
Metadata bank sample data fully loaded.
Assets bank sample data fully loaded.
Both metadata and assets bank sample data fully loaded.
Listing events in bank:
Event:
Event:
Event:
Event:
Event:
Event:
Event:
Event:
Event:
Event:
Event:
Listing events in bank:
Playing “event:/SFX/Player/PlayerBullet”
Failed to get event description: ERR_EVENT_NOTFOUND
Failed to play event: ERR_EVENT_NOTFOUND

As can be seen everything looks fine but when I try to list the events, they are empty and when I try to play something it finds nothing to play.

I have tried to generate the .banks by another earlier Fmod system just to test and apart from generating in PCM I have also tried setting output mode to stereo instead of 5.1 and changed some settings but the result is always the same.

I have also tried debugging this but for getting to the code that fails I need the fmodstudio.pdb file. I saw an entry about that in another thread and will put in a comment there in the hope of getting that file so I can debug the code that fails.

I must admit that all this is a bit frustrating and strange considering that loading something is about the most basic thing for any program that uses data from text editors to more special programs like this.
And with all the tests made in the code we do not get any usable information feedback about what is wrong. Everything is just fine it seems.

I feel as if there is something fundamental amiss here. Something that must be understood to use Fmod in code.

As always, any help will be greatly appreciated.

An update IV.

I have gone back to loading one bank - that is, not separating metadata and the assets which I presume must be the audio.

I have also added more information about the eventdescription and also changed the code some after looking at how unity does.

I have also tried generating banks in different ways to see if that could help.

The logging output first:

OS: Microsoft Windows 10.0.19045
OS Architecture: X64
Process Architecture: X64
Game started and text set!
Loading FMOD DLLs from: F:/Godot/Projects/testing-fmood/lib
FMOD base library (fmod.dll) loaded successfully.
FMOD Studio library (fmodstudio.dll) loaded successfully.
FMOD Studio system now being created.
Checking initialization of FMOD system.
FMOD Initialize Result: OK
Setting up debug flags and log file F:/Godot/Projects/testing-fmood/fmod_log.txt.
Loading bank from: F:/Godot/Projects/testing-fmood/musicbanks/Desktop/Master.bank
Bank loaded successfully: F:/Godot/Projects/testing-fmood/musicbanks/Desktop/Master.bank
Sample data loading initiated for bank: F:/Godot/Projects/testing-fmood/musicbanks/Desktop/Master.bank
Bank loaded. Now loading sample data...
Still loading bank sample data...
Still loading bank sample data...
Bank sample data fully loaded.
Listing events in bank: 
Found 11 events.
Event path "" not found or failed to retrieve. Additional info:
  GUID: FMOD.GUID
  Is 3D: True
  Is Oneshot (not looping): True
  Length (ms): 125
  Event path retrieval result: ERR_EVENT_NOTFOUND
-----------------------------------------------
Event path "" not found or failed to retrieve. Additional info:
  GUID: FMOD.GUID
  Is 3D: False
  Is Oneshot (not looping): True
  Length (ms): 437
  Event path retrieval result: ERR_EVENT_NOTFOUND
-----------------------------------------------
Event path "" not found or failed to retrieve. Additional info:
  GUID: FMOD.GUID
  Is 3D: False
  Is Oneshot (not looping): False
  Length (ms): 376488
  Event path retrieval result: ERR_EVENT_NOTFOUND
-----------------------------------------------
Event path "" not found or failed to retrieve. Additional info:
  GUID: FMOD.GUID
  Is 3D: True
  Is Oneshot (not looping): False
  Length (ms): 29538
  Event path retrieval result: ERR_EVENT_NOTFOUND
-----------------------------------------------
Event path "" not found or failed to retrieve. Additional info:
  GUID: FMOD.GUID
  Is 3D: False
  Is Oneshot (not looping): True
  Length (ms): 437
  Event path retrieval result: ERR_EVENT_NOTFOUND
-----------------------------------------------
Event path "" not found or failed to retrieve. Additional info:
  GUID: FMOD.GUID
  Is 3D: False
  Is Oneshot (not looping): False
  Length (ms): 29538
  Event path retrieval result: ERR_EVENT_NOTFOUND
-----------------------------------------------
Event path "" not found or failed to retrieve. Additional info:
  GUID: FMOD.GUID
  Is 3D: True
  Is Oneshot (not looping): True
  Length (ms): 466
  Event path retrieval result: ERR_EVENT_NOTFOUND
-----------------------------------------------
Event path "" not found or failed to retrieve. Additional info:
  GUID: FMOD.GUID
  Is 3D: False
  Is Oneshot (not looping): True
  Length (ms): 7389
  Event path retrieval result: ERR_EVENT_NOTFOUND
-----------------------------------------------
Event path "" not found or failed to retrieve. Additional info:
  GUID: FMOD.GUID
  Is 3D: True
  Is Oneshot (not looping): True
  Length (ms): 812
  Event path retrieval result: ERR_EVENT_NOTFOUND
-----------------------------------------------
Event path "" not found or failed to retrieve. Additional info:
  GUID: FMOD.GUID
  Is 3D: False
  Is Oneshot (not looping): True
  Length (ms): 218
  Event path retrieval result: ERR_EVENT_NOTFOUND
-----------------------------------------------
Event path "" not found or failed to retrieve. Additional info:
  GUID: FMOD.GUID
  Is 3D: True
  Is Oneshot (not looping): True
  Length (ms): 350
  Event path retrieval result: ERR_EVENT_NOTFOUND
-----------------------------------------------

The data for the events look as the data that should be there looking at the number of events and their length,

Everything seems to be ok - except we get no sound . . . :disappointed:

And here is the updated code for listing the events:

 public FMOD.RESULT PathToGUID(string eventPath, out FMOD.GUID eventGuid)
 {
     if (eventPath.StartsWith("{"))  // Check if the path is already a GUID
     {
         return FMOD.Studio.Util.parseID(eventPath, out eventGuid);
     }
     else
     {
         return studioSystem.lookupID(eventPath, out eventGuid);  // Convert path to FMOD.GUID
     }
 }

 public void ListAllEventsInBank()
 {
     studioSystem.getBankList(out Bank[] banks);  // Get all loaded banks
     if (banks == null || banks.Length == 0)
     {
         LogMessage("No banks found.");
         return;
     }

     foreach (var bank in banks)
     {
         bank.getPath(out string bankPath);  // Get the path of the bank
         LogMessage($"Listing events in bank: {bankPath}");

         // Get all events in this bank
         FMOD.RESULT result = bank.getEventList(out EventDescription[] events);

         if (result != FMOD.RESULT.OK || events == null)
         {
             LogMessage("Failed to retrieve events or no events found.");
             continue;
         } else

         LogMessage($"Found {events.Length} events.");

         foreach (var eventDescription in events)
         {
             // Try to get the event path
             FMOD.RESULT pathResult = eventDescription.getPath(out string eventPath);

             if (pathResult == FMOD.RESULT.OK && !string.IsNullOrEmpty(eventPath))
             {
                 LogMessage("Event: " + eventPath);
             }
             else
             {
                 // If the path is missing or there's an issue, log details
                 string pathDisplay = string.IsNullOrEmpty(eventPath) ? "(No Path)" : eventPath;
                 LogMessage($"Event path \"{pathDisplay}\" not found or failed to retrieve. Additional info:");

                 // Get the GUID of the event
                 eventDescription.getID(out FMOD.GUID eventGuid);
                 LogMessage($"  GUID: {eventGuid}");

                 // Check if the event is 3D
                 eventDescription.is3D(out bool is3D);
                 LogMessage($"  Is 3D: {is3D}");

                 // Check if the event is looping or one-shot
                 eventDescription.isOneshot(out bool isOneshot);
                 LogMessage($"  Is Oneshot (not looping): {isOneshot}");

                 // Get the length of the event (in milliseconds)
                 eventDescription.getLength(out int length);
                 LogMessage($"  Length (ms): {length}");

                 // Log the result code for the event path retrieval
                 LogMessage($"  Event path retrieval result: {pathResult}");
                 LogMessage("-----------------------------------------------");
             }
         }

     }
 }

This change was thus inspired by looking at the code in Unity where this works. I must admit of course I do not understand this well which probably is the reason why it does not work. :laughing:

So any help will be deeply appreciated.

And I have tried several variations of the settings available in Fmod (and of course checked I am using the same version of this editor as for the api.) The idea being that changing the audio format might fix the problem.

What is shown here is thus only one setting. Any ideas?

Yes, the setting up of a log file has failed, or if no such is created if no errors for it is generated. I do not know. Typically when you set up a log file you always get one and if nothing is generated it simply is empty.
Another mystery to solve. . . :disguised_face:

An Update V

Reading the documentation and also trying to understand how FMOD is implemented in Unity. It looked as if events are not loaded, they are just created and played, so I tried a rewrite of the code.

So instead of loading them I just create them and play them. The code is shown below:

 public void LoadBank(string bankPath, bool loadSampleData = false)
 {
     string absBankPath = ProjectSettings.GlobalizePath(bankPath);
     LogMessage($"Loading bank: {absBankPath}");

     if (loadedBanks.ContainsKey(absBankPath))
     {
         LogMessage($"Bank already loaded: {absBankPath}");
         return;
     }

     FMOD.RESULT result = studioSystem.loadBankFile(absBankPath, FMOD.Studio.LOAD_BANK_FLAGS.NORMAL, out Bank bank);
     if (result != FMOD.RESULT.OK)
     {
         LogMessage($"Failed to load bank: {result}");
         return;
     }

     loadedBanks.Add(absBankPath, bank);

     if (loadSampleData)
     {
         // Load sample data only for non-streaming events
         bank.loadSampleData();
         LogMessage($"Sample data loaded for non-streaming events in bank: {absBankPath}");
     }
     else
     {
         LogMessage($"Bank loaded without preloading sample data: {absBankPath}");
     }
 }

 // When you play an event, FMOD automatically handles streamed events
 public FMOD.Studio.EventInstance CreateEvent(string eventPath)
 {
     LogMessage($"Creating event instance: {eventPath}");

     FMOD.Studio.EventDescription eventDescription;
     FMOD.RESULT result = studioSystem.getEvent(eventPath, out eventDescription);
     if (result != FMOD.RESULT.OK)
     {
         LogMessage($"Failed to get event description: {result}");
         return default;
     }

     FMOD.Studio.EventInstance eventInstance;
     result = eventDescription.createInstance(out eventInstance);
     if (result != FMOD.RESULT.OK)
     {
         LogMessage($"Failed to create event instance: {result}");
         return default;
     }

     return eventInstance;
 }

 // Play an event, FMOD handles streaming automatically
 public void PlayOneShot(string eventPath)
 {
     var eventInstance = CreateEvent(eventPath);
     if (eventInstance.isValid())
     {
         eventInstance.start();
         eventInstance.release();  // Automatically release after playback
         LogMessage($"Event played: {eventPath}");
     }
     else
     {
         LogMessage($"Failed to play event: {eventPath}");
     }
 }

The log output looks like this:

OS: Microsoft Windows 10.0.19045
OS Architecture: X64
Process Architecture: X64
Game started and text set!
Loading FMOD DLLs from: F:/Godot/Projects/testing-fmood/lib
FMOD DLLs loaded successfully.
Creating FMOD Studio system...
FMOD initialized: OK
Loading bank: F:/Godot/Projects/testing-fmood/musicbanks/Desktop/Master.bank
Sample data loaded for non-streaming events in bank: F:/Godot/Projects/testing-fmood/musicbanks/Desktop/Master.bank
Bank loading...
Playing "event:/SFX/Enemies/EnemyBullet"
Creating event instance: event:/SFX/Enemies/EnemyBullet
Failed to get event description: ERR_EVENT_NOTFOUND
Failed to play event.

I have checked the generation of the .bank file in the FMOD editor quite a lot but have not been able to understand if there is som setting that is incorrect. I guess the best way to get on with testing now would be to get a .bank that is known to be correct and then of course for the system I am running (2.03.02).

Or, if there is a program that can be used to check a .bank file?

Anyone know if you can test a .bank and/or where you can get such a bank?

Any help will be greatly appreciated. And again I must confess that it is quite astounding that something as simple as loading a sound is so difficult.

Of course I am doing something wrong somewhere. But where?

I have looked at the [https://fmod.com/docs/2.00/api/studio-guide.html#playing-events] and I think I follow the steps, but probably not correctly . . .
so a helping hand would be deeply appreciated. :slightly_smiling_face:

Thank you for all the information and the code.

To play events using their paths the Master.strings.bank needs to be loaded: FMOD Engine | Glossary - Studio Strings Bank.

Full code examples of loading banks and playing events can be found in our examples here:


C:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\studio\examples\vs2019

Here is an example:

FMOD::Studio::Bank* masterBank = NULL;
ERRCHECK( system->loadBankFile(Common_MediaPath("Master.bank"), FMOD_STUDIO_LOAD_BANK_NORMAL, &masterBank) );
    
FMOD::Studio::Bank* stringsBank = NULL;
ERRCHECK( system->loadBankFile(Common_MediaPath("Master.strings.bank"), FMOD_STUDIO_LOAD_BANK_NORMAL, &stringsBank) );

Without the strings bank, you will have to load the events using its GUID, here is an example using a GUID to load a bus: FMOD Studio | Advanced Topics - Using GUIDs and Paths.

Thank you for all the work. If there’s anything we can do to improve clarity in our documentation, please don’t hesitate to let us know.

Thanks a lot, now the music plays!

" If there’s anything we can do to improve clarity in our documentation, please don’t hesitate to let us know."
I am a bit busy the next few days, but I will certainly give this some thought.
I heard from my son about a new game event and that Godot is rising rapidly in use so there will surely be a growing demand for integrating Fmod with Godot and since we can script in C# connecting with .dlls are straigtforward even though I was a bit too optimistic in my time estimate when I told my son I could fix that. 45 years of programming experience should have told me to not be so optimistic!
Anyway I would be happy if I can help others do this a little faster :slight_smile:

And thanks again.

1 Like

Good to hear that worked and sharing your implementation. Whenever you get a chance to share your suggestions we are ready!

Hi again. I am working on and have a new problem you might help me fix?

Of course, when I feel I am ready to show you something I will be very pleased to share it, if you are interested, but I am not yet there :slight_smile:

Here is the new problem.

Thank you for sharing! It looks like the issue was solved?

Nice to hear from you and thanks for asking :slight_smile:

Yes it was solved, one tricky problem after the other. And most often the solution is simple if you just figure out what is wrong. And if not, you will have to find a workaround.

I am testing the sound setup - like in the sandbox. Here are two different sounds, I attach them to nodes (the cubes) and here they are visible etc for testing purposes.

It seems to be working. At the moment I am trying to see if I can change the max and min settings for the spatializer when running the game. So I have set up a script with two input fields:

Minmax

The connected script is triggered and I can hear the sound resetting. Unfortunately the settings for max and min do not seem to change.

Here is the test code. (Print statements etc will of course be taken away when this works and replaced with exceptions where needed).

The idea is to stop the existing event, then create a new one and give it the settings and then start it. First I tried to change the settings on the running event but since that did not work I thought you might have to stop the current event, create a new one, give it the settings and then restart. Which is what I do in the code.

  public void SetSpatialMinMax(float minDistance, float maxDistance)
  {
      Stop(true); // Stop, reset and create a new event instance.
      // Set the min and max distance for the sound
      _eventInstance.setProperty(FMOD.Studio.EVENT_PROPERTY.MINIMUM_DISTANCE, minDistance);
      _eventInstance.setProperty(FMOD.Studio.EVENT_PROPERTY.MAXIMUM_DISTANCE, maxDistance);

  }

Any ideas why the settings do not take?

It would be nice to get this to work too. And if I can get this to work perhaps I could set it up for other things such as reverb too,
I have got setting local and global parameter to work so I guess it can be done like that too. So if I cannot get this to work there is that way, or we will just have to be satisfied with setting things up in the fmod editor. (I am helping my son set this up, since he is more interested in creating the music and the actual game.) So, in any case he can use the fmod editor for setting up music - which is the basic need.

Next I will see if I can set up a script that mimics how you in Unity can attach sound events to objects.

It will be a simplified version of course, the idea is to attach a script to a node in Godot and to the nodes collision shape and when it triggers fire of a sound event. Anyway that is what I think this in Unity does. :cowboy_hat_face:

And again, thanks for replying.

By the way, here is my sons youtube channel:

SeanSecret - YouTube

So music will be an important part, so it is nice we can at least play music now using Fmod in Godot. Even if it lacks a lot of the functionality you get in Unity.

1 Like

Thank you for all the information.

It is interesting that the setProperty() calls are not working as expected. Is retrieving the FMOD_RESULT’s being returned from those calls possible? (FMOD Engine | Core API Reference - FMOD_RESULT). These will be useful for debugging FMOD functions. That is the workflow I used when interacting with an instance in Unity: Audio Occlusion FMOD w/ Unity not working - #2 by Connor_FMOD.

It is possible to interact with DSP directly using ChannelControl::getDSP() (FMOD Engine | Core API Reference - ChannelControl::getDSP), however, this would require getting the event instances channel and then retrieving the correct index for the DSP you want to change.

That would be awesome!

Thank you for sharing your progress so far!

Thanks a lot for the feedback. I think I have got the min and max settings to work now. It must have been the order of calls or something because I honestly do not know exactly what I did - the code is much the same!

And I first missunderstood how min and max are supposed to work first, thought no sound was supposed to be inside min, but that is where the sound starts to diminish so if that is correct that setting is working now. (But remember I am not a game coder, I am just helping my son with some things like getting some aspects of FMOD to work in Godot.)

Anyway, at the moment in my simple framwork I add a node to the Soundnode where the name of the node represents a unique shortname for the soundevent, in this case DataStream and it has childnode to which I attached the script that does the actual settingwork.
Datastream

When the script is attached it looks like this (For now only min and max distance to try out the concept. )

The unique name of the sound and other settings are in an .xml file and the topnode has a script FMODUWrapper that acts as the central script for starting up the system, handling calls between the scripts and supplying the actual SoundEvents. I do not work directly with the FMOD music events but have encapsulated them in a class called SoundEvent. I have found it profitable to work with several levels of abstraction.

When I have gotten a bit further with the collison and trigger enter/exit parts I will get back and see if I can get other things such as Reverb to work too.

1 Like