开发者

A system sound ignores volume level

开发者 https://www.devze.com 2023-02-20 10:22 出处:网络
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 sou

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 p开发者_运维百科layer 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?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消