Author Topic: How do I respect the iPad mute switch?  (Read 4939 times)

HyperNovaSoftware

  • Posts: 54
How do I respect the iPad mute switch?
« on: 17 Jun '11 - 02:29 »
I need to know how to detect when the mute switch on my iPad is enabled/disabled in order to set the volume of an Internet audio stream appropriately.

I'm using BASS_ChannelPlay((DWORD)channel.stream, NO) to begin playback and BASS_ChannelSetAttribute((DWORD)channel.stream, BASS_ATTRIB_VOL, volumeLevel) to set the volume.

If I can receive a notification that the mute switch has been enabled/disabled, I can use BASS_ChannelSetAttribute to save the current volume setting, set the volume to 0 whenever the mute switch is enabled and restore the volume level when the mute switch is disabled.

Ian @ un4seen

  • Administrator
  • Posts: 20426
Re: How do I respect the iPad mute switch?
« Reply #1 on: 17 Jun '11 - 14:56 »
Apparently, you can detect that by checking the kAudioSessionProperty_AudioRoute property (via AudioSessionGetProperty). If it returns an empty string, then mute is enabled.

HyperNovaSoftware

  • Posts: 54
Re: How do I respect the iPad mute switch?
« Reply #2 on: 18 Jun '11 - 16:41 »
Apparently, you can detect that by checking the kAudioSessionProperty_AudioRoute property (via AudioSessionGetProperty). If it returns an empty string, then mute is enabled.

BASS uses an AVAudioSession for playing streaming Internet audio, correct?
How do I reference that session in order to check it's properties?

Thanks!

Ian @ un4seen

  • Administrator
  • Posts: 20426
Re: How do I respect the iPad mute switch?
« Reply #3 on: 20 Jun '11 - 15:27 »
No, BASS doesn't use AVAudioSession. That appears to be a wrapper class for the Audio Session stuff. You can use that stuff directly in your app, eg. to check the kAudioSessionProperty_AudioRoute property mentioned above. There are also a couple of related BASS_SetConfig options; please see the iOS thread for details on that...

   www.un4seen.com/forum/?topic=10910