TTS的默认音频流是什么? [英] What is the default audio stream of TTS?

查看:193
本文介绍了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引擎使用哪个流:

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.

Android的TextToSpeech引擎的默认音频流是什么?

What is the default audio stream from Android's TextToSpeech engine?

是否可以查询Android的TextToSpeech引擎当前正在使用哪个流?

Is there a way to query which stream is currently being used by Android's TextToSpeech engine?

更新: 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?

推荐答案

STREAM_MUSIC 是AOSP源代码中的默认值,定义在

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;

这篇关于TTS的默认音频流是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆