TTS默认的音频流是什么?
据我所知,目前 Android:
STREAM_ALARM (for alarms)
STREAM_DTMF (for DTMF Tones)
STREAM_MUSIC (for music playback)
STREAM_NOTIFICATION (for notifications)
STREAM_RING (for the phone ring)
STREAM_SYSTEM (for system sounds)
STREAM_VOICE_CALL (for phone calls)
我也知道可以明确告诉TTS引擎使用哪个流:
params.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_ALARM));
mTts.speak(text, TextToSpeech.QUEUE_ADD, params);
但是,我找不到的是当我不使用时默认使用哪个流t指定音频 溪流。
Android TextToSpeech 引擎的默认音频流是什么?
有没有办法查询 Android 的 TextToSpeech 引擎当前正在使用哪个流?
更新: TextToSpeech.Engine
有一个常量定义为 DEFAULT_STREAM 但不清楚它指的是 7 个流中的哪一个。不过,它具有与 STREAM_MUSIC 相同的十六进制值 (0x3)。是这个吗?
As far as I can tell, there are currently are 7 audio streams in Android:
STREAM_ALARM (for alarms)
STREAM_DTMF (for DTMF Tones)
STREAM_MUSIC (for music playback)
STREAM_NOTIFICATION (for notifications)
STREAM_RING (for the phone ring)
STREAM_SYSTEM (for system sounds)
STREAM_VOICE_CALL (for phone calls)
I also know that it is possible to explicitly tell the TTS engine which stream to use:
params.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_ALARM));
mTts.speak(text, TextToSpeech.QUEUE_ADD, params);
What I couldn't find, however, is what stream is used by default when I don't specify an audio stream.
What is the default audio stream from Android's TextToSpeech engine?
Is there a way to query which stream is currently being used by Android's TextToSpeech engine?
UPDATE: TextToSpeech.Engine
has a constant defined as DEFAULT_STREAM but it is unclear which of the 7 streams it is referring to. It has the same hex value (0x3) as STREAM_MUSIC, though. Is this it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
STREAM_MUSIC
是 AOSP 源中的默认值,在 TextToSpeech.java(撰写本文时第 164 行)框架/base.git:STREAM_MUSIC
is the default in the AOSP source, defined in TextToSpeech.java (line 164 as of this writing) inframeworks/base.git
: