Delay in fmod playback and elsewhere

Hi!

I have a problem with fmod in the latest versions of the engine. I am pretty sure that this problem was not occurring with 1.2.180. I now use:

Editor / engine SHA1: 1a2776dac6a868eed1a35e41acb0c71a7e17948f

Whenever I launch an sfx I experience a clear delay in sound playback. And it’s not a problem with the build version (launched from the editor); the same problem is also there in the build release.

The game still runs at 60 fps on my mac. It seems that from the script up to fmod a lag is generated. I have to say that the input also has a bit of lag in the build version (from the editor) but it seems to me that there is no lag with the input in the RELEASE version.

Finally, the EDITOR-BUILD version takes an incredibly long time to load the proxycollections (and this is also new in the latest versions). Up to 5 sec. But this delay is not there in the release version.

Let me say that I am slightly worried about this delay with audio…

Ciao!

EDIT: in caps.

Sounds strange. What if you revert back to an older version of Defold? Is the problem gone?

Thanks @britzl

How to revert? is there a link to download the previous versions? The editor or the engine? or both? (Sorry for the silly questions…)

Yes, indeed: Installing Defold

@britzl But what to download from here Defold Downloads? the editor? one of the x86_64-darwin? (I am using a mac with macOSBigSur)

I am sorry again, but I am lost with all these files, versions, platforms…

Suppose I want to try with 1.2.180

If you download the editor and build your project it will use the engine version that was released with the editor. If you don’t want to use the editor then download bob.jar and build/bundle from the command line instead.

Thanks! I am going to try with the editor.

@britzl

The sha1 for 1.2.180 is

f34b08dc12af1101ae62c6e880b6373a03206174

but the link

https://d.defold.com/archive/f34b08dc12af1101ae62c6e880b6373a03206174/stable/editor2/Defold-x86_64-darwin.dmg

gives me:

404 not found

Try from GitHub instead: https://github.com/defold/defold/releases/download/1.2.180/editor-alpha.editor2.Defold-x86_64-darwin.zip

1 Like

Did some testing with 1.2.180.

  1. Delay fmod.

Exactly the same as in 1.2.182, but now I’m not sure if there is a delay? Our sound designer convinced me of this and probably my judgement is still skewed. I need to discuss this with him again (tomorrow).

Anyway, I found that some bouncing objects, animated via go.animate with EASING_OUTBOUNCE, are out of sync. I remember looking at the source code to see the actual math function (an array) used for the bouncing easing and I remember the sfx’s were in sync. I don’t know how to explain that it doesn’t work anymore. I need to resynchronize them.

  1. The loading of Collectionproxy in the build launched from the editor.

The 1.2.180 does NOT have this problem. Loading the collection takes a small fraction of a second while with 1.2.182 it takes about 5 seconds for the most complex collection. So something has changed here. Once again I am referring to the debug build launched via the editor. The release versions have no problems in both 1.2.180 and 1.2.182.

Is it expected that 1.2.182 will take longer to load a collectionproxy?

Thanks!

Ciao!

We need to look into this. Can you share some kind of sample project where this can be seen?

@britzl If you agree I could share the project of the game via bitbucket.

This is what I see in the console in 1.2.182:

WARNING:DLIB: Profiler Resource.Get took 2.672 seconds
WARNING:DLIB: Profiler Resource.Get took 2.981 seconds
WARNING:DLIB: Profiler GameObject.OnMessageFunction took 2.981 seconds
WARNING:DLIB: Profiler Message.Dispatch mainCollection took 2.981 seconds
WARNING:DLIB: Profiler GameObject.DispatchMessages took 3.178 seconds
WARNING:DLIB: Profiler GameObject.Update took 3.178 seconds
WARNING:DLIB: Profiler Engine.Sim took 3.178 seconds
WARNING:DLIB: Profiler Engine.Frame took 3.179 seconds

Are you loading your banks with fmod.studio.load_bank_memory(resource.load()) from custom_resources? That’s an inefficient way of loading banks, as it’s completely synchroneous. It hangs your game (and collection loading) until the bank is fully loaded in memory, then passes over that memory to FMOD (which also involves one or two memcpy()s if I recall correctly).

This is fine in development (and would yield the loading slowdown you mentioned), but for production you should be putting your banks in bundled resources and using studio.load_bank_file() (see defold-fmod’s README for an example how to do that). This allows FMOD to stream the banks from the file system.

@dapetcu21 thanks!!! I am doing what you are suggesting, and since long time. I have to say I am not 100% sure I do it correctly but I am quite sure :slight_smile:

Moreover the collection loading slowdown appeared with 1.2.182. The same project loads the collections instantly with 1.2.80. Also, I read the banks (just a couple of banks for the whole game) only at boot time, never again later.

1 Like

It would be very helpful if it isn’t an entire game but just a single collection. Working with a big project takes a lot more time while debugging an issue.

@britzl I think it is hard to show the issue without having a big collection. And it is also very time consuming to try and isolate the involved collection (the main gameplay action) from the rest of the game logic. However, I will do my best with this and send you the resulting project via DM.

Thanks!

1 Like