public interface AudioRouting
android.media.AudioRouting |
Known Indirect Subclasses |
AudioRouting定义了一个接口,用于控制AudioTrack和AudioRecord对象中的路由和路由通知。
Nested classes |
|
---|---|
interface |
AudioRouting.OnRoutingChangedListener 定义应用程序可以接收关联 |
Public methods |
|
---|---|
abstract void |
addOnRoutingChangedListener(AudioRouting.OnRoutingChangedListener listener, Handler handler) 添加一个 |
abstract AudioDeviceInfo |
getPreferredDevice() 返回由 |
abstract AudioDeviceInfo |
getRoutedDevice() 返回 |
abstract void |
removeOnRoutingChangedListener(AudioRouting.OnRoutingChangedListener listener) 删除以前添加的 |
abstract boolean |
setPreferredDevice(AudioDeviceInfo deviceInfo) 指定一个音频设备(通过 |
void addOnRoutingChangedListener (AudioRouting.OnRoutingChangedListener listener, Handler handler)
添加 AudioRouting.OnRoutingChangedListener
以接收此AudioTrack / AudioRecord上路由更改的通知。
Parameters | |
---|---|
listener |
AudioRouting.OnRoutingChangedListener : The AudioRouting.OnRoutingChangedListener interface to receive notifications of rerouting events. |
handler |
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. |
AudioDeviceInfo getPreferredDevice ()
返回由setPreferredDevice(AudioDeviceInfo)
指定的所选输出/输入。 请注意,这不能保证与用于播放/录制的实际设备相对应。
Returns | |
---|---|
AudioDeviceInfo |
AudioDeviceInfo getRoutedDevice ()
返回AudioDeviceInfo
标识此AudioTrack / AudioRecord的当前路由。 注意:只有当AudioTrack / AudioRecord当前正在播放时,该查询才有效。 如果不是, getRoutedDevice()
将返回null。
Returns | |
---|---|
AudioDeviceInfo |
void removeOnRoutingChangedListener (AudioRouting.OnRoutingChangedListener listener)
删除以前添加的 AudioRouting.OnRoutingChangedListener
以接收重新路由通知。
Parameters | |
---|---|
listener |
AudioRouting.OnRoutingChangedListener : The previously added AudioRouting.OnRoutingChangedListener interface to remove. |
boolean setPreferredDevice (AudioDeviceInfo deviceInfo)
指定一个音频设备(通过 AudioDeviceInfo
对象)将输出/输入路由到/从。
Parameters | |
---|---|
deviceInfo |
AudioDeviceInfo : The AudioDeviceInfo specifying the audio sink or source. If deviceInfo is null, default routing is restored. |
Returns | |
---|---|
boolean |
true if succesful, false if the specified AudioDeviceInfo is non-null and does not correspond to a valid audio device. |