0

I wrote a C++ game using SDL 2.0 and SDL_Mixer. Sometimes when playing audio a sound randomly becomes louder. It seems to be when multiple sounds play at the same time, but I'm not sure why.

Here's the two functions I'm calling to play sounds in my game:

void Sounds::play(Mix_Chunk* sound)
{
    Mix_PlayChannel(-1, sound, 0);
}

void Sounds::play(Mix_Music* music)
{
    Mix_PlayMusic(music, 0);
}
Christopher Perry
  • 38,891
  • 43
  • 145
  • 187
  • Does it get louder when multiple sounds start playing or when one of them stops playing? Does everything get louder or just one of the sounds? – Daniel Jour Aug 02 '20 at 20:00
  • I'm 99% sure it happens when multiple start playing, and I'm pretty sure it's just one of the sounds that gets louder. It seems to be the one that starts playing when there is already another playing. – Christopher Perry Aug 02 '20 at 20:02
  • 2
    Can it be played twice accidentally? – bipll Aug 02 '20 at 20:13
  • Yep, that’s by design though. I made an Arkanoid clone and there’s a ball destroying tons of bricks quickly and each hit plays a sound. Most play the same sound. – Christopher Perry Aug 04 '20 at 19:39

0 Answers0