Merge change 6734 into donut
* changes: Adding tagging to utterances to track which app said what.
This commit is contained in:
@ -27,37 +27,37 @@ import android.content.Intent;
|
||||
* {@hide}
|
||||
*/
|
||||
interface ITts {
|
||||
int setSpeechRate(in int speechRate);
|
||||
int setSpeechRate(in String callingApp, in int speechRate);
|
||||
|
||||
int setPitch(in int pitch);
|
||||
int setPitch(in String callingApp, in int pitch);
|
||||
|
||||
int speak(in String text, in int queueMode, in String[] params);
|
||||
int speak(in String callingApp, in String text, in int queueMode, in String[] params);
|
||||
|
||||
boolean isSpeaking();
|
||||
|
||||
int stop();
|
||||
int stop(in String callingApp);
|
||||
|
||||
void addSpeech(in String text, in String packageName, in int resId);
|
||||
void addSpeech(in String callingApp, in String text, in String packageName, in int resId);
|
||||
|
||||
void addSpeechFile(in String text, in String filename);
|
||||
void addSpeechFile(in String callingApp, in String text, in String filename);
|
||||
|
||||
String[] getLanguage();
|
||||
|
||||
int isLanguageAvailable(in String language, in String country, in String variant);
|
||||
|
||||
int setLanguage(in String language, in String country, in String variant);
|
||||
int setLanguage(in String callingApp, in String language, in String country, in String variant);
|
||||
|
||||
boolean synthesizeToFile(in String text, in String[] params, in String outputDirectory);
|
||||
boolean synthesizeToFile(in String callingApp, in String text, in String[] params, in String outputDirectory);
|
||||
|
||||
int playEarcon(in String earcon, in int queueMode, in String[] params);
|
||||
int playEarcon(in String callingApp, in String earcon, in int queueMode, in String[] params);
|
||||
|
||||
void addEarcon(in String earcon, in String packageName, in int resId);
|
||||
void addEarcon(in String callingApp, in String earcon, in String packageName, in int resId);
|
||||
|
||||
void addEarconFile(in String earcon, in String filename);
|
||||
void addEarconFile(in String callingApp, in String earcon, in String filename);
|
||||
|
||||
void registerCallback(ITtsCallback cb);
|
||||
|
||||
void unregisterCallback(ITtsCallback cb);
|
||||
|
||||
int playSilence(in long duration, in int queueMode, in String[] params);
|
||||
int playSilence(in String callingApp, in long duration, in int queueMode, in String[] params);
|
||||
}
|
||||
|
@ -139,6 +139,7 @@ public class TextToSpeech {
|
||||
|
||||
private ITts mITts = null;
|
||||
private Context mContext = null;
|
||||
private String mPackageName = "";
|
||||
private OnInitListener mInitListener = null;
|
||||
private boolean mStarted = false;
|
||||
private final Object mStartLock = new Object();
|
||||
@ -159,6 +160,7 @@ public class TextToSpeech {
|
||||
*/
|
||||
public TextToSpeech(Context context, OnInitListener listener) {
|
||||
mContext = context;
|
||||
mPackageName = mContext.getPackageName();
|
||||
mInitListener = listener;
|
||||
|
||||
mCachedParams = new String[2*4]; // 4 parameters, store key and value
|
||||
@ -261,7 +263,7 @@ public class TextToSpeech {
|
||||
return TTS_ERROR;
|
||||
}
|
||||
try {
|
||||
mITts.addSpeech(text, packagename, resourceId);
|
||||
mITts.addSpeech(mPackageName, text, packagename, resourceId);
|
||||
return TTS_SUCCESS;
|
||||
} catch (RemoteException e) {
|
||||
// TTS died; restart it.
|
||||
@ -299,7 +301,7 @@ public class TextToSpeech {
|
||||
return TTS_ERROR;
|
||||
}
|
||||
try {
|
||||
mITts.addSpeechFile(text, filename);
|
||||
mITts.addSpeechFile(mPackageName, text, filename);
|
||||
return TTS_SUCCESS;
|
||||
} catch (RemoteException e) {
|
||||
// TTS died; restart it.
|
||||
@ -346,7 +348,7 @@ public class TextToSpeech {
|
||||
}
|
||||
try {
|
||||
// TODO support extra parameters, passing cache of current parameters for the moment
|
||||
result = mITts.speak(text, queueMode, mCachedParams);
|
||||
result = mITts.speak(mPackageName, text, queueMode, mCachedParams);
|
||||
} catch (RemoteException e) {
|
||||
// TTS died; restart it.
|
||||
mStarted = false;
|
||||
@ -387,7 +389,7 @@ public class TextToSpeech {
|
||||
}
|
||||
try {
|
||||
// TODO support extra parameters, passing null for the moment
|
||||
result = mITts.playEarcon(earcon, queueMode, null);
|
||||
result = mITts.playEarcon(mPackageName, earcon, queueMode, null);
|
||||
} catch (RemoteException e) {
|
||||
// TTS died; restart it.
|
||||
mStarted = false;
|
||||
@ -425,7 +427,7 @@ public class TextToSpeech {
|
||||
}
|
||||
try {
|
||||
// TODO support extra parameters, passing cache of current parameters for the moment
|
||||
result = mITts.playSilence(durationInMs, queueMode, mCachedParams);
|
||||
result = mITts.playSilence(mPackageName, durationInMs, queueMode, mCachedParams);
|
||||
} catch (RemoteException e) {
|
||||
// TTS died; restart it.
|
||||
mStarted = false;
|
||||
@ -487,7 +489,7 @@ public class TextToSpeech {
|
||||
return result;
|
||||
}
|
||||
try {
|
||||
result = mITts.stop();
|
||||
result = mITts.stop(mPackageName);
|
||||
} catch (RemoteException e) {
|
||||
// TTS died; restart it.
|
||||
mStarted = false;
|
||||
@ -532,7 +534,7 @@ public class TextToSpeech {
|
||||
if (speechRate > 0) {
|
||||
int rate = (int)(speechRate*100);
|
||||
mCachedParams[Engine.TTS_PARAM_POSITION_RATE + 1] = String.valueOf(rate);
|
||||
result = mITts.setSpeechRate(rate);
|
||||
result = mITts.setSpeechRate(mPackageName, rate);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
// TTS died; restart it.
|
||||
@ -568,7 +570,7 @@ public class TextToSpeech {
|
||||
}
|
||||
try {
|
||||
if (pitch > 0) {
|
||||
result = mITts.setPitch((int)(pitch*100));
|
||||
result = mITts.setPitch(mPackageName, (int)(pitch*100));
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
// TTS died; restart it.
|
||||
@ -603,7 +605,8 @@ public class TextToSpeech {
|
||||
mCachedParams[Engine.TTS_PARAM_POSITION_LANGUAGE + 1] = loc.getISO3Language();
|
||||
mCachedParams[Engine.TTS_PARAM_POSITION_COUNTRY + 1] = loc.getISO3Country();
|
||||
mCachedParams[Engine.TTS_PARAM_POSITION_VARIANT + 1] = loc.getVariant();
|
||||
result = mITts.setLanguage(mCachedParams[Engine.TTS_PARAM_POSITION_LANGUAGE + 1],
|
||||
result = mITts.setLanguage(mPackageName,
|
||||
mCachedParams[Engine.TTS_PARAM_POSITION_LANGUAGE + 1],
|
||||
mCachedParams[Engine.TTS_PARAM_POSITION_COUNTRY + 1],
|
||||
mCachedParams[Engine.TTS_PARAM_POSITION_VARIANT + 1] );
|
||||
} catch (RemoteException e) {
|
||||
@ -694,7 +697,7 @@ public class TextToSpeech {
|
||||
}
|
||||
try {
|
||||
// TODO support extra parameters, passing null for the moment
|
||||
if (mITts.synthesizeToFile(text, null, filename)){
|
||||
if (mITts.synthesizeToFile(mPackageName, text, null, filename)){
|
||||
result = TTS_SUCCESS;
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
|
@ -59,23 +59,27 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
public int mType = TEXT;
|
||||
public long mDuration = 0;
|
||||
public String mFilename = null;
|
||||
public String callingApp = "";
|
||||
|
||||
public SpeechItem(String text, ArrayList<String> params, int itemType) {
|
||||
public SpeechItem(String source, String text, ArrayList<String> params, int itemType) {
|
||||
mText = text;
|
||||
mParams = params;
|
||||
mType = itemType;
|
||||
callingApp = source;
|
||||
}
|
||||
|
||||
public SpeechItem(long silenceTime) {
|
||||
public SpeechItem(String source, long silenceTime) {
|
||||
mDuration = silenceTime;
|
||||
mType = SILENCE;
|
||||
callingApp = source;
|
||||
}
|
||||
|
||||
public SpeechItem(String text, ArrayList<String> params, int itemType, String filename) {
|
||||
public SpeechItem(String source, String text, ArrayList<String> params, int itemType, String filename) {
|
||||
mText = text;
|
||||
mParams = params;
|
||||
mType = itemType;
|
||||
mFilename = filename;
|
||||
callingApp = source;
|
||||
}
|
||||
|
||||
}
|
||||
@ -161,10 +165,10 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
|
||||
|
||||
private void setDefaultSettings() {
|
||||
setLanguage(this.getDefaultLanguage(), getDefaultCountry(), getDefaultLocVariant());
|
||||
setLanguage("", this.getDefaultLanguage(), getDefaultCountry(), getDefaultLocVariant());
|
||||
|
||||
// speech rate
|
||||
setSpeechRate(getDefaultRate());
|
||||
setSpeechRate("", getDefaultRate());
|
||||
}
|
||||
|
||||
|
||||
@ -219,7 +223,7 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
}
|
||||
|
||||
|
||||
private int setSpeechRate(int rate) {
|
||||
private int setSpeechRate(String callingApp, int rate) {
|
||||
if (isDefaultEnforced()) {
|
||||
return nativeSynth.setSpeechRate(getDefaultRate());
|
||||
} else {
|
||||
@ -228,7 +232,7 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
}
|
||||
|
||||
|
||||
private int setPitch(int pitch) {
|
||||
private int setPitch(String callingApp, int pitch) {
|
||||
return nativeSynth.setPitch(pitch);
|
||||
}
|
||||
|
||||
@ -244,7 +248,7 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
}
|
||||
|
||||
|
||||
private int setLanguage(String lang, String country, String variant) {
|
||||
private int setLanguage(String callingApp, String lang, String country, String variant) {
|
||||
//Log.v("TTS", "TtsService.setLanguage(" + lang + ", " + country + ", " + variant + ")");
|
||||
if (isDefaultEnforced()) {
|
||||
return nativeSynth.setLanguage(getDefaultLanguage(), getDefaultCountry(),
|
||||
@ -265,7 +269,7 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* @param resId
|
||||
* The resource ID of the sound within its package
|
||||
*/
|
||||
private void addSpeech(String text, String packageName, int resId) {
|
||||
private void addSpeech(String callingApp, String text, String packageName, int resId) {
|
||||
mUtterances.put(text, new SoundResource(packageName, resId));
|
||||
}
|
||||
|
||||
@ -278,7 +282,7 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* The filename of the sound resource. This must be a complete
|
||||
* path like: (/sdcard/mysounds/mysoundbite.mp3).
|
||||
*/
|
||||
private void addSpeech(String text, String filename) {
|
||||
private void addSpeech(String callingApp, String text, String filename) {
|
||||
mUtterances.put(text, new SoundResource(filename));
|
||||
}
|
||||
|
||||
@ -292,7 +296,7 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* @param resId
|
||||
* The resource ID of the sound within its package
|
||||
*/
|
||||
private void addEarcon(String earcon, String packageName, int resId) {
|
||||
private void addEarcon(String callingApp, String earcon, String packageName, int resId) {
|
||||
mEarcons.put(earcon, new SoundResource(packageName, resId));
|
||||
}
|
||||
|
||||
@ -305,7 +309,7 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* The filename of the sound resource. This must be a complete
|
||||
* path like: (/sdcard/mysounds/mysoundbite.mp3).
|
||||
*/
|
||||
private void addEarcon(String earcon, String filename) {
|
||||
private void addEarcon(String callingApp, String earcon, String filename) {
|
||||
mEarcons.put(earcon, new SoundResource(filename));
|
||||
}
|
||||
|
||||
@ -321,11 +325,11 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* An ArrayList of parameters. This is not implemented for all
|
||||
* engines.
|
||||
*/
|
||||
private int speak(String text, int queueMode, ArrayList<String> params) {
|
||||
private int speak(String callingApp, String text, int queueMode, ArrayList<String> params) {
|
||||
if (queueMode == 0) {
|
||||
stop();
|
||||
stop(callingApp);
|
||||
}
|
||||
mSpeechQueue.add(new SpeechItem(text, params, SpeechItem.TEXT));
|
||||
mSpeechQueue.add(new SpeechItem(callingApp, text, params, SpeechItem.TEXT));
|
||||
if (!mIsSpeaking) {
|
||||
processSpeechQueue();
|
||||
}
|
||||
@ -344,12 +348,12 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* An ArrayList of parameters. This is not implemented for all
|
||||
* engines.
|
||||
*/
|
||||
private int playEarcon(String earcon, int queueMode,
|
||||
private int playEarcon(String callingApp, String earcon, int queueMode,
|
||||
ArrayList<String> params) {
|
||||
if (queueMode == 0) {
|
||||
stop();
|
||||
stop(callingApp);
|
||||
}
|
||||
mSpeechQueue.add(new SpeechItem(earcon, params, SpeechItem.EARCON));
|
||||
mSpeechQueue.add(new SpeechItem(callingApp, earcon, params, SpeechItem.EARCON));
|
||||
if (!mIsSpeaking) {
|
||||
processSpeechQueue();
|
||||
}
|
||||
@ -359,7 +363,7 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
/**
|
||||
* Stops all speech output and removes any utterances still in the queue.
|
||||
*/
|
||||
private int stop() {
|
||||
private int stop(String callingApp) {
|
||||
int result = TextToSpeech.TTS_ERROR;
|
||||
boolean speechQueueAvailable = false;
|
||||
try{
|
||||
@ -368,7 +372,11 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
speechQueueAvailable = speechQueueLock.tryLock(1000, TimeUnit.MILLISECONDS);
|
||||
if (speechQueueAvailable) {
|
||||
Log.i("TTS", "Stopping");
|
||||
mSpeechQueue.clear();
|
||||
for (int i = mSpeechQueue.size() - 1; i > -1; i--){
|
||||
if (mSpeechQueue.get(i).callingApp.equals(callingApp)){
|
||||
mSpeechQueue.remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
result = nativeSynth.stop();
|
||||
mIsSpeaking = false;
|
||||
@ -398,12 +406,12 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
processSpeechQueue();
|
||||
}
|
||||
|
||||
private int playSilence(long duration, int queueMode,
|
||||
private int playSilence(String callingApp, long duration, int queueMode,
|
||||
ArrayList<String> params) {
|
||||
if (queueMode == 0) {
|
||||
stop();
|
||||
stop(callingApp);
|
||||
}
|
||||
mSpeechQueue.add(new SpeechItem(duration));
|
||||
mSpeechQueue.add(new SpeechItem(callingApp, duration));
|
||||
if (!mIsSpeaking) {
|
||||
processSpeechQueue();
|
||||
}
|
||||
@ -448,7 +456,7 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
for (int i = 0; i < params.size() - 1; i = i + 2){
|
||||
String param = params.get(i);
|
||||
if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_RATE)){
|
||||
setSpeechRate(Integer.parseInt(params.get(i+1)));
|
||||
setSpeechRate("", Integer.parseInt(params.get(i+1)));
|
||||
} else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_LANGUAGE)){
|
||||
language = params.get(i+1);
|
||||
} else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_COUNTRY)){
|
||||
@ -458,7 +466,7 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
}
|
||||
}
|
||||
if (language.length() > 0){
|
||||
setLanguage(language, country, variant);
|
||||
setLanguage("", language, country, variant);
|
||||
}
|
||||
}
|
||||
nativeSynth.speak(text);
|
||||
@ -503,7 +511,7 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
for (int i = 0; i < params.size() - 1; i = i + 2){
|
||||
String param = params.get(i);
|
||||
if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_RATE)){
|
||||
setSpeechRate(Integer.parseInt(params.get(i+1)));
|
||||
setSpeechRate("", Integer.parseInt(params.get(i+1)));
|
||||
} else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_LANGUAGE)){
|
||||
language = params.get(i+1);
|
||||
} else if (param.equals(TextToSpeech.Engine.TTS_KEY_PARAM_COUNTRY)){
|
||||
@ -513,7 +521,7 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
}
|
||||
}
|
||||
if (language.length() > 0){
|
||||
setLanguage(language, country, variant);
|
||||
setLanguage("", language, country, variant);
|
||||
}
|
||||
}
|
||||
nativeSynth.synthesizeToFile(text, filename);
|
||||
@ -574,6 +582,7 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
if (currentSpeechItem.mText.length() < MAX_SPEECH_ITEM_CHAR_LENGTH){
|
||||
return currentSpeechItem;
|
||||
} else {
|
||||
String callingApp = currentSpeechItem.callingApp;
|
||||
ArrayList<SpeechItem> splitItems = new ArrayList<SpeechItem>();
|
||||
int start = 0;
|
||||
int end = start + MAX_SPEECH_ITEM_CHAR_LENGTH - 1;
|
||||
@ -581,13 +590,13 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
SpeechItem splitItem;
|
||||
while (end < currentSpeechItem.mText.length()){
|
||||
splitText = currentSpeechItem.mText.substring(start, end);
|
||||
splitItem = new SpeechItem(splitText, null, SpeechItem.TEXT);
|
||||
splitItem = new SpeechItem(callingApp, splitText, null, SpeechItem.TEXT);
|
||||
splitItems.add(splitItem);
|
||||
start = end;
|
||||
end = start + MAX_SPEECH_ITEM_CHAR_LENGTH - 1;
|
||||
}
|
||||
splitText = currentSpeechItem.mText.substring(start);
|
||||
splitItem = new SpeechItem(splitText, null, SpeechItem.TEXT);
|
||||
splitItem = new SpeechItem(callingApp, splitText, null, SpeechItem.TEXT);
|
||||
splitItems.add(splitItem);
|
||||
mSpeechQueue.remove(0);
|
||||
for (int i = splitItems.size() - 1; i >= 0; i--){
|
||||
@ -701,7 +710,7 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* something like "/sdcard/myappsounds/mysound.wav".
|
||||
* @return A boolean that indicates if the synthesis succeeded
|
||||
*/
|
||||
private boolean synthesizeToFile(String text, ArrayList<String> params,
|
||||
private boolean synthesizeToFile(String callingApp, String text, ArrayList<String> params,
|
||||
String filename) {
|
||||
// Don't allow a filename that is too long
|
||||
if (filename.length() > MAX_FILENAME_LENGTH) {
|
||||
@ -712,7 +721,7 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
if (text.length() >= MAX_SPEECH_ITEM_CHAR_LENGTH){
|
||||
return false;
|
||||
}
|
||||
mSpeechQueue.add(new SpeechItem(text, params, SpeechItem.TEXT_TO_FILE, filename));
|
||||
mSpeechQueue.add(new SpeechItem(callingApp, text, params, SpeechItem.TEXT_TO_FILE, filename));
|
||||
if (!mIsSpeaking) {
|
||||
processSpeechQueue();
|
||||
}
|
||||
@ -756,12 +765,12 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* An ArrayList of parameters. The first element of this
|
||||
* array controls the type of voice to use.
|
||||
*/
|
||||
public int speak(String text, int queueMode, String[] params) {
|
||||
public int speak(String callingApp, String text, int queueMode, String[] params) {
|
||||
ArrayList<String> speakingParams = new ArrayList<String>();
|
||||
if (params != null) {
|
||||
speakingParams = new ArrayList<String>(Arrays.asList(params));
|
||||
}
|
||||
return mSelf.speak(text, queueMode, speakingParams);
|
||||
return mSelf.speak(callingApp, text, queueMode, speakingParams);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -775,12 +784,12 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* @param params
|
||||
* An ArrayList of parameters.
|
||||
*/
|
||||
public int playEarcon(String earcon, int queueMode, String[] params) {
|
||||
public int playEarcon(String callingApp, String earcon, int queueMode, String[] params) {
|
||||
ArrayList<String> speakingParams = new ArrayList<String>();
|
||||
if (params != null) {
|
||||
speakingParams = new ArrayList<String>(Arrays.asList(params));
|
||||
}
|
||||
return mSelf.playEarcon(earcon, queueMode, speakingParams);
|
||||
return mSelf.playEarcon(callingApp, earcon, queueMode, speakingParams);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -794,20 +803,20 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* @param params
|
||||
* An ArrayList of parameters.
|
||||
*/
|
||||
public int playSilence(long duration, int queueMode, String[] params) {
|
||||
public int playSilence(String callingApp, long duration, int queueMode, String[] params) {
|
||||
ArrayList<String> speakingParams = new ArrayList<String>();
|
||||
if (params != null) {
|
||||
speakingParams = new ArrayList<String>(Arrays.asList(params));
|
||||
}
|
||||
return mSelf.playSilence(duration, queueMode, speakingParams);
|
||||
return mSelf.playSilence(callingApp, duration, queueMode, speakingParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops all speech output and removes any utterances still in the
|
||||
* queue.
|
||||
*/
|
||||
public int stop() {
|
||||
return mSelf.stop();
|
||||
public int stop(String callingApp) {
|
||||
return mSelf.stop(callingApp);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -829,8 +838,8 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* @param resId
|
||||
* The resource ID of the sound within its package
|
||||
*/
|
||||
public void addSpeech(String text, String packageName, int resId) {
|
||||
mSelf.addSpeech(text, packageName, resId);
|
||||
public void addSpeech(String callingApp, String text, String packageName, int resId) {
|
||||
mSelf.addSpeech(callingApp, text, packageName, resId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -842,8 +851,8 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* The filename of the sound resource. This must be a
|
||||
* complete path like: (/sdcard/mysounds/mysoundbite.mp3).
|
||||
*/
|
||||
public void addSpeechFile(String text, String filename) {
|
||||
mSelf.addSpeech(text, filename);
|
||||
public void addSpeechFile(String callingApp, String text, String filename) {
|
||||
mSelf.addSpeech(callingApp, text, filename);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -856,8 +865,8 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* @param resId
|
||||
* The resource ID of the sound within its package
|
||||
*/
|
||||
public void addEarcon(String earcon, String packageName, int resId) {
|
||||
mSelf.addEarcon(earcon, packageName, resId);
|
||||
public void addEarcon(String callingApp, String earcon, String packageName, int resId) {
|
||||
mSelf.addEarcon(callingApp, earcon, packageName, resId);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -869,8 +878,8 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* The filename of the sound resource. This must be a
|
||||
* complete path like: (/sdcard/mysounds/mysoundbite.mp3).
|
||||
*/
|
||||
public void addEarconFile(String earcon, String filename) {
|
||||
mSelf.addEarcon(earcon, filename);
|
||||
public void addEarconFile(String callingApp, String earcon, String filename) {
|
||||
mSelf.addEarcon(callingApp, earcon, filename);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -880,8 +889,8 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* @param speechRate
|
||||
* The speech rate that should be used
|
||||
*/
|
||||
public int setSpeechRate(int speechRate) {
|
||||
return mSelf.setSpeechRate(speechRate);
|
||||
public int setSpeechRate(String callingApp, int speechRate) {
|
||||
return mSelf.setSpeechRate(callingApp, speechRate);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -891,8 +900,8 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* @param pitch
|
||||
* The pitch that should be used for the synthesized voice
|
||||
*/
|
||||
public int setPitch(int pitch) {
|
||||
return mSelf.setPitch(pitch);
|
||||
public int setPitch(String callingApp, int pitch) {
|
||||
return mSelf.setPitch(callingApp, pitch);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -926,8 +935,8 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* @param country the three letter ISO country code.
|
||||
* @param variant the variant code associated with the country and language pair.
|
||||
*/
|
||||
public int setLanguage(String lang, String country, String variant) {
|
||||
return mSelf.setLanguage(lang, country, variant);
|
||||
public int setLanguage(String callingApp, String lang, String country, String variant) {
|
||||
return mSelf.setLanguage(callingApp, lang, country, variant);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -944,13 +953,13 @@ public class TtsService extends Service implements OnCompletionListener {
|
||||
* be something like "/sdcard/myappsounds/mysound.wav".
|
||||
* @return A boolean that indicates if the synthesis succeeded
|
||||
*/
|
||||
public boolean synthesizeToFile(String text, String[] params,
|
||||
public boolean synthesizeToFile(String callingApp, String text, String[] params,
|
||||
String filename) {
|
||||
ArrayList<String> speakingParams = new ArrayList<String>();
|
||||
if (params != null) {
|
||||
speakingParams = new ArrayList<String>(Arrays.asList(params));
|
||||
}
|
||||
return mSelf.synthesizeToFile(text, speakingParams, filename);
|
||||
return mSelf.synthesizeToFile(callingApp, text, speakingParams, filename);
|
||||
}
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user