New id with each shound?

Hello,
bellow I’ve attach the output of what happens everytime I shoot a bullet

ezgif.com-gif-maker

as you see a new sound id is created each time. Is this normal? This doesn’t feel right.
All I am doing is setting the path to the sound in a constant file called gaomeConstants.h as
static const std::string PLAYER_LASERSHOT_FX = “/pathToMySounds/PLAYER_LASERSHOT_FX.mp3”;
and then call AudioEngine::play2d(PLAYER_LASERSHOT_FX, false, 0.4f); when a shoot happens.

Is there anyting wrong with this that is cause the outputs above?

thanks,
R

Yes, it’s correct. The ID has nothing to do with which sound is being played.

That ID that is returned is your reference to that audio instance, and the ID is used for other operations (such as stopping that specific audio instance).

i see.
So it is normal that if you shoot 5000 times, you’ll have 5000 ids printed out.
Doesn’t that affect the performance?

Yes

Most likely yes, but those messages should not be appearing in the release version of the application, and if they still are, then there should be a way to turn them off. Just search for ALOGVV and ALOGV in the engine code to figure out what defines you need to set at build time.

1 Like

Perfect, thanks @R101