public interface AudioRouting
Modifier and Type | Interface and Description |
---|---|
static interface |
AudioRouting.OnRoutingChangedListener
Defines the interface by which applications can receive notifications of routing
changes for the associated
AudioRouting . |
Modifier and Type | Method and Description |
---|---|
void |
addOnRoutingChangedListener(AudioRouting.OnRoutingChangedListener listener,
Handler handler)
Adds an
AudioRouting.OnRoutingChangedListener to receive notifications of routing
changes on this AudioTrack/AudioRecord. |
AudioDeviceInfo |
getPreferredDevice()
Returns the selected output/input specified by
setPreferredDevice(android.media.AudioDeviceInfo) . |
AudioDeviceInfo |
getRoutedDevice()
Returns an
AudioDeviceInfo identifying the current routing of this
AudioTrack/AudioRecord. |
void |
removeOnRoutingChangedListener(AudioRouting.OnRoutingChangedListener listener)
Removes an
AudioRouting.OnRoutingChangedListener which has been previously added
to receive rerouting notifications. |
boolean |
setPreferredDevice(AudioDeviceInfo deviceInfo)
Specifies an audio device (via an
AudioDeviceInfo object) to route
the output/input to/from. |
boolean setPreferredDevice(AudioDeviceInfo deviceInfo)
AudioDeviceInfo
object) to route
the output/input to/from.deviceInfo
- The AudioDeviceInfo
specifying the audio sink or source.
If deviceInfo is null, default routing is restored.AudioDeviceInfo
is non-null and
does not correspond to a valid audio device.AudioDeviceInfo getPreferredDevice()
setPreferredDevice(android.media.AudioDeviceInfo)
. Note that this
is not guaranteed to correspond to the actual device being used for playback/recording.AudioDeviceInfo getRoutedDevice()
AudioDeviceInfo
identifying the current routing of this
AudioTrack/AudioRecord.
Note: The query is only valid if the AudioTrack/AudioRecord is currently playing.
If it is not, getRoutedDevice()
will return null.void addOnRoutingChangedListener(AudioRouting.OnRoutingChangedListener listener, Handler handler)
AudioRouting.OnRoutingChangedListener
to receive notifications of routing
changes on this AudioTrack/AudioRecord.listener
- The AudioRouting.OnRoutingChangedListener
interface to receive
notifications of rerouting events.handler
- Specifies the Handler
object for the thread on which to execute
the callback. If null
, the Handler
associated with the main
Looper
will be used.void removeOnRoutingChangedListener(AudioRouting.OnRoutingChangedListener listener)
AudioRouting.OnRoutingChangedListener
which has been previously added
to receive rerouting notifications.listener
- The previously added AudioRouting.OnRoutingChangedListener
interface
to remove.