What is the default audio stream of TTS?

2020-07-03 04:16发布

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?

1条回答
地球回转人心会变
2楼-- · 2020-07-03 04:50

STREAM_MUSIC is the default in the AOSP source, defined in TextToSpeech.java (line 164 as of this writing) in frameworks/base.git:

/**
 * Default audio stream used when playing synthesized speech.
 */
public static final int DEFAULT_STREAM = AudioManager.STREAM_MUSIC;
查看更多
登录 后发表回答