5

I am working on the game. And I have some issue with sounds.

I use system sounds to acknowledge a player, when he/she presses a button. These sounds respect the volume set by a player, when other sounds are playing (I use AVAudioPlayers and AudioQueues). But when a system sound is only to play, it ignore a volume set by player and plays at a ringer's volume.

How to force system sounds to respect a volume set by a player even when is no other sounds played?

Aleksejs Mjaliks
  • 8,647
  • 6
  • 38
  • 44
  • this is an old issue, but have you considered having a dummy AVAudioPlayer running in the background (a very short sample with a looping player). it's silly and a waste of resources, but it should do the trick. also: yes, this is annoying! – kritzikratzi Sep 13 '12 at 18:42
  • @Aleksejs: Did you ever figure this out? I'm having the same problem, and I'd like to avoid the AVAudioPlayer hack if possible. – Michael Jan 30 '13 at 05:30
  • @Michael Noup, I'm using `AVAudioPlayer` for background music constantly. I don't know other solution for this issue. – Aleksejs Mjaliks Jan 30 '13 at 10:40

2 Answers2

5

Assuming you are meaning that players are setting the volume using the side volume buttons on the device:

I had the same problem getting SystemSound to respect the volume buttons but found a setting in "Settings"/"Sounds"/"Ringer and Alerts"/"Change With Buttons" that was "OFF" by default. Switching that to "ON" made it work.

pIkEL
  • 561
  • 6
  • 14
  • I hope Apple didn't quietly disable that setting in an iOS update to show off the feature. I can see how it would be useful in rare cases, but it was a PITA for me. – Timmah Nov 24 '21 at 04:56
0

How are your players (I assume you mean the people playing the game) setting the volume -- through the device's volume control, or through your app interface? If the latter, then this won't work, since system sounds should always play at the device volume.

According to the Multimedia Programming Guide, "Sounds play at the current system audio volume, with no programmatic volume control available."

I don't know why your system sounds would change volume when an AVAudioPlayer sound is playing. If that's the case, can you loop a silent sound with AVAudioPlayer when you're not playing other sounds? Otherwise I would try playing all sounds with AVAudioPlayer so that you have direct control over the volume.

arlomedia
  • 8,534
  • 5
  • 60
  • 108