设置方式就是在语音播报前,将音量设置最大,再进行播报

方式如下

//设置最大音量
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
int sb2value =am.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
am.setStreamVolume(AudioManager.STREAM_MUSIC, sb2value, 0);

//再进行播报
Bundle bundle = new Bundle();
bundle.putFloat(KEY_PARAM_VOLUME,1.0f);
tts.speak("播放内容", TextToSpeech.QUEUE_ADD, bundle, null);

 

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐