Tuesday, August 2, 2022
HomeGame DevelopmentAn audio engine error that happens solely within the Android Launch model...

An audio engine error that happens solely within the Android Launch model – Cocos Creator


Hello guys?

I discovered a bug that I discovered whereas constructing the beta model of the sport this time, so please share. That is an error that solely happens in Signed APK, not in debug mode.

The replica methodology is straightforward, however by loading two or extra of any AudioClip, it performs indefinitely via the scheduler. Then quickly the app crashes.

like this

this.schedule(this.playEffect);

playEffect() {
const audioList = this.assetManager.audioList(-> that is preloaded audio clip array);
for (let i in audioList) {
this.audioManager.playEffect(audioList[i]);
}
}

That is an error that doesn’t happen in debug mode, so it took me a very long time to search out it. I solved it with protection logic, however I believe it is a very large downside.

I’m utilizing cocos creator model 3.5.2 now.


NewProject_10.zip (172.6 KB)
My take a look at result’s regular, no crash.

To begin with, I confirmed that there isn’t any downside with the mission you uploaded, however once we add some sound results which are being utilized in our sport to the mission, an error happens once more.

Contemplating this phenomenon, it appears that evidently an error happens when a particular sound impact is added, however I don’t know what precisely is the issue.

The construct settings have been modified to the present construct settings of our mission, and the compilation SDK model is 30.

NewProject_10 2.zip (2.9 MB)

I examined a little bit extra, however this phenomenon happens even when the compilation SDK is ready to 27, and if I play these two recordsdata(“bead_dragon+”, “bead_event+” ) consecutively among the many hooked up sound results, I get an error. Hmm… I don’t know what’s particular about these two recordsdata.

NewProject_10.zip (749.5 KB)
do that? I compressed the audio file → “bead_event+”

Ah, compression solves the issue. What compression did you utilize? And would compressing all sound results resolve this downside? I plan so as to add sound results sooner or later, however I’m anxious that one thing like this would possibly occur.

For reference, I handled this error by taking part in once more till the identical sound impact ends with the present logic.

Every platform has a restrict on the variety of sound results that may be performed on the identical time, and audio glitches could happen when a sure numerical restrict is exceeded.
As a result of the “bead_event” file is just too giant, it can’t be preloaded when taking part in a number of sound results on the identical time, to play it’s going to load the “dead_event”, which can occupy a playback monitor and trigger playback timeouts to dam as a consequence of frequent playback.
So if you wish to play many sound results on the identical time, you could take note of the file can’t be too giant, play can’t be too frequent, the file shouldn’t be an excessive amount of.

I exploit a third-party audio compression software program to do the compression.
http://formatfactory.org/CN/index.html

Oh, now I do know what the issue is. I’m studying one other one. Thanks very a lot to your variety reply!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments