BASS_CONFIG_IOS_SESSION config option

Audio session configuration on iOS.

BASS_SetConfig(
    BASS_CONFIG_IOS_SESSION,
    DWORD config
);

Parameters

configA combination of these flags.
BASS_IOS_SESSION_MIXAllow other apps to be heard at the same time. Enables AVAudioSessionCategoryOptionMixWithOthers.
BASS_IOS_SESSION_DUCKAllow other apps to be heard at the same time but reduce their volume level. Enables AVAudioSessionCategoryOptionDuckOthers.
BASS_IOS_SESSION_AMBIENTUse the "ambient" category.
BASS_IOS_SESSION_SPEAKERRoute the output to the speaker instead of the receiver when recording. Enables AVAudioSessionCategoryOptionDefaultToSpeaker.
BASS_IOS_SESSION_AIRPLAYAllow playback on Airplay devices when recording (Airplay is always allowed when only playing). Enables AVAudioSessionCategoryOptionAllowAirPlay.
BASS_IOS_SESSION_BTHFPAllow Bluetooth HFP (hands-free) devices when recording (Bluetooth is always allowed when only playing). Enables AVAudioSessionCategoryOptionAllowBluetooth.
BASS_IOS_SESSION_BTA2DPAllow Bluetooth A2DP devices when recording (Bluetooth is always allowed when only playing). Enables AVAudioSessionCategoryOptionAllowBluetoothA2DP.
BASS_IOS_SESSION_DEACTIVATEDeactivate the audio session when nothing is playing or recording. It is otherwise only deactivated when there are no initialized devices and during interruptions.
BASS_IOS_SESSION_DISABLEDisable BASS's audio session configuration management so that the app can handle that itself.

Remarks

By default, the audio session category is set to AVAudioSessionCategoryPlayback. If BASS_IOS_SESSION_AMBIENT is set then the category will be set to AVAudioSessionCategorySoloAmbient instead, or AVAudioSessionCategoryAmbient if BASS_IOS_SESSION_MIX or BASS_IOS_SESSION_DUCK is also set. If the "Voice" output device or a recording device are initialized then the category will be set to AVAudioSessionCategoryPlayAndRecord (regardless of BASS_IOS_SESSION_AMBIENT). Descriptions of these categories and other options can be found in Apple's AVAudioSession documentation.

If mixing with other apps is disabled (neither BASS_IOS_SESSION_MIX or BASS_IOS_SESSION_DUCK is set) then BASS will not automatically resume following an interruption if another app is still playing in the background. BASS_Start can be used in that case to force resumption (and interrupt the other app).

When BASS's audio session configuration management is disabled (BASS_IOS_SESSION_DISABLE is set), BASS will still handle activation of the session (including after interruptions) but nothing else. Except for the "No Sound" device, the BASS_CONFIG_DEV_PERIOD option is also disabled by this; the AVAudioSession setPreferredIOBufferDuration method can be used instead.

The default setting is BASS_IOS_SESSION_MIX + BASS_IOS_SESSION_BTHFP.

Platform-specific

This config option is only available on iOS.

See also

BASS_GetConfig, BASS_SetConfig, BASS_Init, BASS_RecordInit