Syntax | mergAVAudioSessionSetCategory <pCategory>, [<pMixWithOthers>], [<pDuckOthers>], [<pAllowBluetooth>], [<pDefaultToSpeaker>]
|
Parameters | Name | Type | Description |
---|
pCategory | |
- ambient : For an app in which sound playback is nonprimary‰??that
is, your app can be used successfully with the sound turned off. This
category is also appropriate for ‰??play along‰?? style apps, such as a
virtual piano that a user plays over iPod audio. When you use this
category, audio from other apps mixes with your audio. Your audio is
silenced by screen locking and by the Silent switch (called the
Ring/Silent switch on iPhone).
- solo ambient : The default category; used unless you set a category
- playback : For playing recorded music or other sounds that are
central to the successful use of your app. When using this category,
your app audio continues with the Silent switch set to silent or when
the screen locks. (The switch is called the Ring/Silent switch on
iPhone.) This category normally prevents audio from other apps from
mixing with your app's audio.
- record : For recording audio; this category silences playback audio.
Recording continues with the screen locked.
- play and record : Allows recording (input) and playback (output) of
audio, such as for a VOIP (voice over IP) app. Your audio continues
with the Silent switch set to silent and with the screen locked. (The
switch is called the Ring/Silent switch on iPhone.)This category is
appropriate for simultaneous recording and playback, and also for apps
that record and play back but not simultaneously. If you want to ensure
that sounds such as Messages alerts do not play while your app is
recording, use the "record" category instead.This category normally
prevents audio from other apps from mixing with your app's audio unless
pMixWithOthers is true.
- audio processing : For using an audio hardware codec or signal
processor while not playing or recording audio. Use this category, for
example, when performing offline audio format conversion. This category
disables playback (audio output) and disables recording (audio input).
Audio processing does not normally continue when your app is in the
background. However, when your app moves to the background, you can
request additional time to complete processing.
- multi-route : Allows you to output distinct streams of audio data to
different output devices at the same time. For example, you would use
this category to route audio to both a USB device and a set of
headphones. Use of this category requires a more detailed knowledge of,
and interaction with, the capabilities of the available audio routes.
This category may be used for input, output, or both.
|
pMixWithOthers | | (optional with "false" default) Setting this property
to true allows audio mixing with other apps. Other aspects of these
categories, such as their Silent switch behavior, are not affected. (The
switch is called the Ring/Silent switch on iPhone.) When the audio
session category changes, such as during an interruption, the value of
this property reverts to false. To regain mixing behavior you must then
re-set this property.
- true
- false
|
pDuckOthers | | (optional with "false" default) For audio session
categories that allow audio mixing with other apps, specifies whether
other audio should be reduced in level when your app produces sound.
This property has a value of false by default. When your app is finished
playing sound, be sure to set this property back to false to remove
ducking.
- true
- false
|
pAllowBluetooth | | (optional with "false" default) Allows a paired
Bluetooth device to appear as an available audio input route. By
default, the value of this property is false. This property can be used
to modify the "record" or "play and record" categories. Attempting to
set this property to true will fail for all other categories. This
property affects the "play and record" category as follows: If the audio
input to the device is coming from a Bluetooth headset, setting this
property to true results in audio output also going to the Bluetooth
headset.
- true
- false
|
pDefaultToSpeaker | | (optional with "false" default) Specifies whether or
not to route audio to the speaker (instead of to the receiver) when no
other audio route, such as a headset, is connected. By default, the
value of this property is false. This property retains its value through
an audio route change (such as when plugging in or unplugging a
headset), and upon interruption; it reverts to its default value only
upon an audio session category change. This property can be used only
with the "play and record" category.
- true
- false
|
|