Defold 1.10.2 sound crash

When playing my game in windows for testing, and I set group gain to zero like so
sound.set_group_gain("master", 0) the game plays when I transition to a new screen / collection.

But doing the same thing on Android, whether in released to google play or debugging on Defold, the game crashes and exits to OS without displaying an error message in defold console.
My game has used this code (sound.set_group_gain("master", data.music_status)) since the initial release on google play.

I am not sure what is causing the error. But for the time being, I have to disable the “Sound off” button feature. :frowning:

Anyone else experience this issue?

I tried with a fresh-ish project. I could not get my android build to crash with sound.set_group_gain("master", 0).

I wonder if, for the time being, you could make the “Sound off” button to set the gain to 0.01 or such instead of disabling the feature.

2 Likes

Hi @Jay_Cee !

Is it a project you could share?
Or perhaps create such a repro project?

What does your adb logs say?
What type of phone is it? What OS version?

Its a fully released to android project. I could add you to github. Britzl might still have access. Adb reports no errors or messages. The game simply returns to home screen. No consle output either.

This only happens is master gain is set to 0 and a new sound (song) is started.

1 Like

That gives me an idea. I use a variable data.music_status that might be testing nil somewhere. But the same code has been active since initial release.

Please share the project with me (JCash at GitHub) and I can take a look.

1 Like

Invitation should have been sent.

1 Like

Thanks for the invite.
I can’t reproduce it though.
Testing on an android.

Do you have steps to reproduce?

Please share the adb logs for the session, where we can see the engine info and crash callstack etc.

I am not sure why it’s not doing it. I am using the version available on GOOGLE PLAY.

What I do is start the app and on the home screen, I toggle “sound off”. Then I click on anything that produces a sound and it returns to the OS.

Funny thing I notice this morning is that I use DefSave and when I click the sound off toggle and exit the app, it should save with DefSave. The only toggle that persists is the “show intro” toggle. Quite strange that it saves but the sound no longer saves. I do stop the sound before exiting thus could be why it does not save as it crashes.

This was the fix. I set it to 0.001 and it works. Doing sound.set_group_gain("master", 0) crashes for me.

2 Likes

Hmm. I recently updated the game in Google Play just on version 1.10.2 and when I was testing I didn’t see such a bug. I don’t see any crashes in Google Console reports either. :thinking:

1 Like

Thanks for the info!
Are you also using a gain value close to or equal to zero?

Are you sure it was 1.10.2 and not 1.10.1 (which had such a bug) ?

This is partly why I wanted to see your adb logs, to confirm the version, but also to see the callstack.

yes

	if game.sounds then
		sound.set_group_gain("master", 0)
		sound.set_group_gain("fx", 0)
	else
		sound.set_group_gain("master", 1)
		sound.set_group_gain("fx", 1)
	end
2 Likes

For me, I just updated my App and it works now. I suppose me using a variable might be the issue.

In any case there should not be a crash, if you pass nil (undefined variable) instead of a value, there should be an error, but not a runtime crash. (need to check it).

3 Likes