Audio issue? :(

Hi, we have inserted audio in our game anche we have these many many messages in android console; a massage every time a audio is played. Is it normal?

Thanks

Stefano

2020-03-03 20:18:06.707 4207-4477/com.ghost.google V/AudioMixerController: Play over …

2020-03-03 20:18:06.710 4207-4278/com.ghost.google V/AudioEngineImpl: Removing player id=3330, state:5

2020-03-03 20:18:06.710 4207-4278/com.ghost.google V/PcmAudioPlayer: In the destructor of PcmAudioPlayer (0x8262f5e0)

2020-03-03 20:18:06.710 4207-4278/com.ghost.google V/Track: ~Track(): 0x92403680

2020-03-03 20:18:06.728 4207-4477/com.ghost.google V/AudioMixerController: Play over …

2020-03-03 20:18:06.743 4207-4278/com.ghost.google V/AudioEngineImpl: Removing player id=3332, state:5

2020-03-03 20:18:06.743 4207-4278/com.ghost.google V/PcmAudioPlayer: In the destructor of PcmAudioPlayer (0x8262f700)

2020-03-03 20:18:06.743 4207-4278/com.ghost.google V/Track: ~Track(): 0x92403980

2020-03-03 20:18:06.751 4207-4278/com.ghost.google V/AudioEngineImpl: play2d, _audioPlayers.size=3

2020-03-03 20:18:06.751 4207-4278/com.ghost.google V/PcmAudioPlayer: PcmAudioPlayer constructor: 0x8262f820

2020-03-03 20:18:06.751 4207-4278/com.ghost.google V/PcmAudioPlayer: PcmAudioPlayer (0x8262f820) play, url: @assets/res/raw-assets/25/2539d0f3-2e6f-4869-b1f2-abc8da2ddc44.fac68.mp3

2020-03-03 20:18:06.830 4207-4278/com.ghost.google V/AudioEngineImpl: play2d, _audioPlayers.size=4

2020-03-03 20:18:06.830 4207-4278/com.ghost.google V/PcmAudioPlayer: PcmAudioPlayer constructor: 0x8262f880

2020-03-03 20:18:06.830 4207-4278/com.ghost.google V/PcmAudioPlayer: PcmAudioPlayer (0x8262f880) play, url: @assets/res/raw-assets/79/7986c718-8df2-4008-ad1a-191d9700057f.2c3f3.mp3

2020-03-03 20:18:06.857 4207-4207/com.ghost.google I/ViewRootImpl: ViewRoot’s Touch Event : ACTION_UP

2020-03-03 20:18:06.888 4207-4477/com.ghost.google V/AudioMixerController: Play over …

2020-03-03 20:18:06.892 4207-4278/com.ghost.google V/AudioEngineImpl: Removing player id=3334, state:5

2020-03-03 20:18:06.892 4207-4278/com.ghost.google V/PcmAudioPlayer: In the destructor of PcmAudioPlayer (0x8262f280)

2020-03-03 20:18:06.892 4207-4278/com.ghost.google V/Track: ~Track(): 0x890ffa00

2020-03-03 20:18:06.963 4207-4477/com.ghost.google V/AudioMixerController: Play over …

2020-03-03 20:18:06.975 4207-4278/com.ghost.google V/AudioEngineImpl: Removing player id=3333, state:5

2020-03-03 20:18:06.975 4207-4278/com.ghost.google V/PcmAudioPlayer: In the destructor of PcmAudioPlayer (0x8262f640)

2020-03-03 20:18:06.975 4207-4278/com.ghost.google V/Track: ~Track(): 0x92917d80

2020-03-03 20:18:06.995 4207-4477/com.ghost.google V/AudioMixerController: Play over …

2020-03-03 20:18:07.008 4207-4278/com.ghost.google V/AudioEngineImpl: Removing player id=3335, state:5

2020-03-03 20:18:07.008 4207-4278/com.ghost.google V/PcmAudioPlayer: In the destructor of PcmAudioPlayer (0x8262f820)

2020-03-03 20:18:07.008 4207-4278/com.ghost.google V/Track: ~Track(): 0x92403980

2020-03-03 20:18:07.230 4207-4477/com.ghost.google V/AudioMixerController: Play over …

2020-03-03 20:18:07.230 4207-4477/com.ghost.google V/AudioMixerController: Doesn’t have enough tracks: 1, 1

2020-03-03 20:18:07.244 4207-4278/com.ghost.google V/AudioEngineImpl: Removing player id=3336, state:5

2020-03-03 20:18:07.244 4207-4278/com.ghost.google V/PcmAudioPlayer: In the destructor of PcmAudioPlayer (0x8262f880)

2020-03-03 20:18:07.244 4207-4278/com.ghost.google V/Track: ~Track(): 0x92403680

2020-03-03 20:18:08.054 4207-4207/com.ghost.google I/ViewRootImpl: ViewRoot’s Touch Event : ACTION_DOWN

2020-03-03 20:18:08.202 4207-4207/com.ghost.google I/ViewRootImpl: ViewRoot’s Touch Event : ACTION_UP

2020-03-03 20:18:09.953 4207-4207/com.ghost.google D/Cocos2dxActivity: onPause()

2020-03-03 20:18:10.260 4207-4207/com.ghost.google D/Cocos2dxActivity: onWindowFocusChanged() hasFocus=false

We can ask @jare to have a team member help.

1 Like

Hi @jare,
do you have any idea for the messages? we need to send a demo to our customer :frowning:

Thanks for help!

Stefano

Hi,
ok, we have seen the c++ source, and these are the messages to trace the behavior about audio… but question, why when we create a audiosource, the clip is everytime create and destroy when we play it? :confused: there is a way to play and preserve a sound in memory for use the same clip?

Do you have any news about this task? Thanks for help!
(we have see every time the log is create the game have a little lag…) :confused:
we use CC2.2.2.

An audioSource instance map an audio instance, so alway need create, You can keep audioSource instance in memory and reuse.

How is possible keep the audiosource in memory and reuse?

Thanks for help!

Stefano

you can keep the audioSource node, add it to the scene when use, remove when scene destroy, but never destroy node.
see the document.
https://docs.cocos.com/creator/manual/en/scripting/create-destroy.html#destroy-and-removefromparent

mmm… we have done this… we have created a prefabs with inside the sfx to load in level… but every time we play a audiosource CC writes these log

Dynamically created nodes are valid, nodes who inside the prefab on editor will be destroyed when prefab destroyed.

so, we have done correct? and why CC release the sfx and recreate it? :confused:
we use cc.audioEngine.playEffect.

cc.audioEngine.playEffect alway create a new audio instance, it is no friendly for audio cache.

So, how use? :slight_smile: (thanks for help)

create node with audioSource component, and keep in memory, dynamically add to scene when use to play, and remove the node before scene destroy.

and to re-play it without recreate it? because now we create a prefabs with every audiosource as like children and to play a audiosource, we found item from the prefabs children and we do cc.audioEngine.playEffect(children[i]) (for or less)… but we have wrote that is wrong use playEffect because it is no friendly for audio cache… :sweat_smile: :blush:
in fact we have the log every time we use playEffect… :confused: and is a trouble because for sample for our character we have a playEffect every time he done a step…

correct way to play a sfx withouh recreate it? cc.audioengine.playEffect no… another? :sweat_smile:
Thanks a lot for help!

Stefano

we have tried to use cc.audoEngine.play to play our sfx but the result are same…

V/PcmAudioPlayer: PcmAudioPlayer constructor: 0xa6bd9e20
PcmAudioPlayer (0xa6bd9e20) play, url: @assets/res/raw-assets/1b/1b472d61-6a89-4e49-964e-e3fbecf644d3.1211b.mp3
V/PcmAudioPlayer: In the destructor of PcmAudioPlayer (0xa420e0c0)
V/Track: ~Track(): 0x8c8e0e80
V/PcmAudioPlayer: PcmAudioPlayer (0xa6bd9e20) stop, url: @assets/res/raw-assets/1b/1b472d61-6a89-4e49-964e-e3fbecf644d3.1211b.mp3
V/AudioEngineImpl: Removing player id=80, state:4
play2d, _audioPlayers.size=1
V/PcmAudioPlayer: PcmAudioPlayer constructor: 0xa420e0c0
PcmAudioPlayer (0xa420e0c0) play, url: @assets/res/raw-assets/1b/1b472d61-6a89-4e49-964e-e3fbecf644d3.1211b.mp3
V/PcmAudioPlayer: In the destructor of PcmAudioPlayer (0xa6bd9e20)
V/Track: ~Track(): 0x8c089380
V/AudioEngineImpl: play2d, _audioPlayers.size=2
V/AudioPlayerProvider: (@assets/res/raw-assets/93/93b9b296-ac4a-4feb-8fc7-5ca86d1fccac.b2c0f.mp3) file size: 40367
FileInfo (0x8fcfe2f8), Waiting preload (@assets/res/raw-assets/93/93b9b296-ac4a-4feb-8fc7-5ca86d1fccac.b2c0f.mp3) to finish …
V/AudioPlayerProvider: AudioPlayerProvider::preloadEffect: (@assets/res/raw-assets/93/93b9b296-ac4a-4feb-8fc7-5ca86d1fccac.b2c0f.mp3)
V/AudioDecoderProvider: url:@assets/res/raw-assets/93/93b9b296-ac4a-4feb-8fc7-5ca86d1fccac.b2c0f.mp3, extension:.mp3

the sfx are always load and release… we wrong something? All audioclip have ‘preload’… and are children of a node…

Thanks!

Stefano

audio preload can load an audio instance before you play,but every time to new an audio component instance, it will load audio instance again, so keep the audio component instance will fine.

I am very sorry :frowning: but I don’t understand… now the audioclips are nodes linked to a node parent and we play these audioclip… but every time after play, they are destroy… maybe we wrong something to create the audioclip? because, the audioclips are in a prefabs and the prefabs is loaded when the level is loaded (to have different sfx for level)… so this prefabs is unload only when we destroy the level.

can you provide a project to reproduce this issue?I can help you check it.