Domanda

Sto lavorando al gioco.E ho qualche problema con i suoni.

Io uso i suoni del sistema per riconoscere un giocatore, quando preme un pulsante.Questi suoni rispettano il volume impostato da un giocatore, quando vengono riprodotti altri suoni (utilizzo AVAudioPlayers e AudioQueues).Ma quando un suono del sistema è solo per giocare, ignora un volume impostato da Player e riproduce il volume di un ringer.

Come forzare il sistema suona per rispettare un volume impostato da un giocatore anche quando non è suonati altri suoni?

È stato utile?

Soluzione

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.

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top