本文整理汇总了Java中android.media.AudioManager.MODE_NORMAL属性的典型用法代码示例。如果您正苦于以下问题:Java AudioManager.MODE_NORMAL属性的具体用法?Java AudioManager.MODE_NORMAL怎么用?Java AudioManager.MODE_NORMAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.media.AudioManager
的用法示例。
在下文中一共展示了AudioManager.MODE_NORMAL属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
@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: getAudioTargetMode
private int getAudioTargetMode() {
int targetMode = modeSipInCall;
if(service.getPrefs().useModeApi()) {
Log.d(THIS_FILE, "User want speaker now..." + userWantSpeaker);
if(!service.getPrefs().generateForSetCall()) {
return userWantSpeaker ? AudioManager.MODE_NORMAL : AudioManager.MODE_IN_CALL;
}else {
return userWantSpeaker ? AudioManager.MODE_IN_CALL: AudioManager.MODE_NORMAL ;
}
}
if(userWantBluetooth) {
targetMode = AudioManager.MODE_NORMAL;
}
Log.d(THIS_FILE, "Target mode... : " + targetMode);
return targetMode;
}
示例3: setDefaultSynthesizerParam
/**
* 设置默认的合成引擎
*
* @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);
//}
}
示例4: getInCallMode
/**
* Get the audio codec quality setting
*
* @return the audio quality
*/
public int getInCallMode() {
String mode = getPreferenceStringValue(SipConfigManager.SIP_AUDIO_MODE);
try {
return Integer.parseInt(mode);
} catch (NumberFormatException e) {
Log.e(THIS_FILE, "In call mode " + mode + " not well formated");
}
return AudioManager.MODE_NORMAL;
}
示例5: setAudioMode
public void setAudioMode(int mode,Context ctx) {
if (mode != AudioManager.MODE_NORMAL && mode != AudioManager.MODE_IN_CALL) {
return;
}
AudioManager audioManager = (AudioManager) ctx.getSystemService(Context.AUDIO_SERVICE);
audioManager.setMode(mode);
}
示例6: onSpeakerClick
@Override
public void onSpeakerClick() {
AudioPlayerHandler audioPlayerHandler = AudioPlayerHandler.getInstance();
if (audioPlayerHandler.getAudioMode(ctx) == AudioManager.MODE_NORMAL) {
audioPlayerHandler.setAudioMode(AudioManager.MODE_IN_CALL, ctx);
SpeekerToast.show(ctx, ctx.getText(R.string.audio_in_call), Toast.LENGTH_SHORT);
} else {
audioPlayerHandler.setAudioMode(AudioManager.MODE_NORMAL, ctx);
SpeekerToast.show(ctx, ctx.getText(R.string.audio_in_speeker), Toast.LENGTH_SHORT);
}
}