本文整理汇总了Java中android.media.AudioManager.getMode方法的典型用法代码示例。如果您正苦于以下问题:Java AudioManager.getMode方法的具体用法?Java AudioManager.getMode怎么用?Java AudioManager.getMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.AudioManager
的用法示例。
在下文中一共展示了AudioManager.getMode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import android.media.AudioManager; //导入方法依赖的package包/类
@Override
public void execute(AudioManager audioManager) {
if (voiceMediator.isBlueToothHeadSet()) {
if (!voiceMediator.isSuportA2DP()) {
if (audioManager.getMode() != AudioManager.MODE_NORMAL) {
Log.e(TAG, "playInChannel>>setMode(AudioManager.MODE_NORMAL)");
audioManager.setMode(AudioManager.MODE_NORMAL);
}
if (audioManager.isBluetoothScoOn()) {
audioManager.setBluetoothScoOn(false);
audioManager.stopBluetoothSco();
}
} else {
if (!audioManager.isBluetoothA2dpOn()) {
Log.e(TAG, "playInChannel>>setBluetoothA2dpOn(true)");
audioManager.setBluetoothA2dpOn(true);
}
}
}
}
示例2: setDefaultSynthesizerParam
import android.media.AudioManager; //导入方法依赖的package包/类
/**
* 设置默认的合成引擎
*
* @param type
*/
private void setDefaultSynthesizerParam(NetType type) {
if (isSpeaking()) {
Log.e(TAG, "播放当中切换播放引擎失败");
return;
}
synthesizer.setParameter(SpeechConstant.SPEED, Integer.toString(mVoiceConfig.getVolSpeed()));
synthesizer.setParameter(SpeechConstant.VOLUME, Integer.toString(mVoiceConfig.getVolume()));
synthesizer.setParameter(SpeechConstant.VOICE_NAME, mVoiceConfig.getVolName());
synthesizer.setParameter("rdn", "0");
synthesizer.setParameter(SpeechConstant.KEY_REQUEST_FOCUS, "0");
if (mediator.isBlueToothHeadSet()) {
synthesizer.setParameter(SpeechConstant.STREAM_TYPE, Integer.toString(AudioManager.STREAM_VOICE_CALL));
} else {
synthesizer.setParameter(SpeechConstant.STREAM_TYPE, Integer.toString(AudioManager.STREAM_MUSIC));
AudioManager am = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
if (am.getMode() != AudioManager.MODE_NORMAL) {
am.setMode(AudioManager.MODE_NORMAL);
}
}
//synthesizer.setParameter(SpeechConstant.ENGINE_TYPE, VoiceConfig.getSynEngineType());
/*if(type==NetType.NETWORK_TYPE_NONE||type==NetType.NETWORK_TYPE_2G){//网络关闭的状态下启动离线识别
Log.e(TAG, "离线。。。。。。。。。。。。。。。。。。。");
synthesizer.setParameter(SpeechConstant.SPEED, OFFLINE_ENGINE_SPPED);
synthesizer.setParameter(SpeechConstant.ENGINE_TYPE, SpeechConstant.TYPE_LOCAL);
synthesizer.setParameter(SpeechConstant.VOICE_NAME, "xiaoyan");
isLocalEngine=true;
}
else{*/
Log.e(TAG, "在线。。。。。。。。。。。。。。。。。。。");
//synthesizer.setParameter(SpeechConstant.SPEED,"70");
synthesizer.setParameter(SpeechConstant.VOICE_NAME, mVoiceConfig.getVolName());
//synthesizer.setParameter(SpeechConstant.VOICE_NAME, ChatRobot.isInit()&&ChatRobot.getInstance().getMode()==ChatConstant.CHILDREN_MODE?"vinn":"vixq");
synthesizer.setParameter(SpeechConstant.ENGINE_TYPE, SpeechConstant.TYPE_CLOUD);
//}
}
示例3: getAudioMode
import android.media.AudioManager; //导入方法依赖的package包/类
/**messagePop调用*/
public int getAudioMode(Context ctx) {
AudioManager audioManager = (AudioManager) ctx.getSystemService(Context.AUDIO_SERVICE);
return audioManager.getMode();
}