• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Voice类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中android.speech.tts.Voice的典型用法代码示例。如果您正苦于以下问题:Java Voice类的具体用法?Java Voice怎么用?Java Voice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Voice类属于android.speech.tts包,在下文中一共展示了Voice类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getCurrentVoice

import android.speech.tts.Voice; //导入依赖的package包/类
@ReactMethod 
public void getCurrentVoice(Promise promise) {
	if(notReady(promise)) return;

	try {
		if(Build.VERSION.SDK_INT >= 21) {
			Voice currentVoice = tts.getVoice();
			WritableMap map = returnMapForVoice(currentVoice);

			promise.resolve(map);
		} else {
			promise.reject("error", "Method not availaible for SDK version " + Build.VERSION.SDK_INT + ". Requires(SDK version >= 21)");
		}
	} catch(Exception e) {
		promise.reject("error", "Unable to retrieve voice for getCurrentVoice()", e);
	}
}
 
开发者ID:echo8795,项目名称:react-native-android-text-to-speech,代码行数:18,代码来源:RNAndroidTextToSpeechModule.java


示例2: getAvailableVoices

import android.speech.tts.Voice; //导入依赖的package包/类
@ReactMethod
public void getAvailableVoices(Promise promise) {
	if(notReady(promise)) return;

	try {
		WritableArray voicesList = Arguments.createArray();
		Voice[] array = tts.getVoices().toArray(new Voice[tts.getVoices().size()]);
		for(Voice voice: array) {
			WritableMap newVoice = returnMapForVoice(voice);
			voicesList.pushMap(newVoice);
		}

		promise.resolve(voicesList);
	} catch(Exception e) {
		promise.reject("not_found", "Unable to retrieve voices for getAvailableVoices()", e);
	}
}
 
开发者ID:echo8795,项目名称:react-native-android-text-to-speech,代码行数:18,代码来源:RNAndroidTextToSpeechModule.java


示例3: getEngineDefaultSaiyVoice

import android.speech.tts.Voice; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private SaiyVoice getEngineDefaultSaiyVoice() {

    final Voice voice = getDefaultVoice();

    if (voice != null) {
        final SaiyVoice saiyVoice = new SaiyVoice(voice);
        saiyVoice.setEngine(getInitialisedEngine());
        saiyVoice.setGender(saiyVoice.getName());

        if (DEBUG) {
            MyLog.i(CLS_NAME, "getEngineDefaultSaiyVoice: setting Gender: " + saiyVoice.getGender().name());
        }

        return saiyVoice;
    } else {
        if (DEBUG) {
            MyLog.i(CLS_NAME, "getEngineDefaultSaiyVoice: voice null");
        }
        return null;
    }
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:23,代码来源:SaiyTextToSpeech.java


示例4: getVoices

import android.speech.tts.Voice; //导入依赖的package包/类
@Override
public Set<Voice> getVoices() {
    final long then = System.nanoTime();

    if (defaultVoiceSet == null || defaultVoiceSet.isEmpty()) {
        defaultVoiceSet = super.getVoices();
    } else {
        if (DEBUG) {
            MyLog.i(CLS_NAME, "getVoices: already prepared");
        }
    }

    if (DEBUG) {
        MyLog.getElapsed("getVoices", then);
    }

    return defaultVoiceSet;
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:19,代码来源:SaiyTextToSpeech.java


示例5: getSaiyVoices

import android.speech.tts.Voice; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private Set<SaiyVoice> getSaiyVoices() {
    final long then = System.nanoTime();
    final Set<Voice> voiceSet = getVoices();

    if (saiyVoiceSet == null || saiyVoiceSet.size() != voiceSet.size()) {
        saiyVoiceSet = SaiyVoice.getSaiyVoices(voiceSet, getInitialisedEngine());
    } else {
        if (DEBUG) {
            MyLog.i(CLS_NAME, "getSaiyVoices: already prepared");
        }
    }

    if (DEBUG) {
        MyLog.getElapsed("getSaiyVoices", then);
    }
    return saiyVoiceSet;
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:19,代码来源:SaiyTextToSpeech.java


示例6: returnMapForVoice

import android.speech.tts.Voice; //导入依赖的package包/类
private WritableMap returnMapForVoice(Voice voice) {
	WritableMap voiceData = Arguments.createMap();
	voiceData.putString("voiceName", voice.getName());
	voiceData.putString("languageName", voice.getLocale().getDisplayLanguage());
	voiceData.putString("languageCode", voice.getLocale().getISO3Language());
	voiceData.putString("languageString", voice.getLocale().toString());
	voiceData.putString("countryName", voice.getLocale().getDisplayCountry());
	voiceData.putString("countryCode", voice.getLocale().getISO3Country());

	return voiceData;
}
 
开发者ID:echo8795,项目名称:react-native-android-text-to-speech,代码行数:12,代码来源:RNAndroidTextToSpeechModule.java


示例7: pronounceWord

import android.speech.tts.Voice; //导入依赖的package包/类
public static void pronounceWord(CharSequence word, float pitch, float speechRate, Voice accent) {
    //manual pronunciation of a word, never used.
    american_speaker_google.setPitch(pitch);
    american_speaker_google.setSpeechRate(speechRate);
    american_speaker_google.setVoice(accent);
    american_speaker_google.speak(word, QUEUE_FLUSH, null, null);
}
 
开发者ID:Cesarsk,项目名称:Say_it,代码行数:8,代码来源:UtilityTTS.java


示例8: searchVoice

import android.speech.tts.Voice; //导入依赖的package包/类
public static Voice searchVoice(String voiceName, TextToSpeech tts) {
    if (MainActivity.isLoggingEnabled)
        Log.i("VOICES:", tts.getVoices().toString()); //stampa tutte le voci disponibili
    for (Voice tmpVoice : tts.getVoices()) {
        if (tmpVoice.getName().equals(voiceName)) {
            return tmpVoice;
        }
    }
    return null;
}
 
开发者ID:Cesarsk,项目名称:Say_it,代码行数:11,代码来源:UtilityTTS.java


示例9: getBoundSaiyVoice

import android.speech.tts.Voice; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public SaiyVoice getBoundSaiyVoice() {

    final Voice voice = getVoice();

    if (voice != null) {
        final SaiyVoice saiyVoice = new SaiyVoice(voice);
        saiyVoice.setEngine(getInitialisedEngine());
        saiyVoice.setGender(saiyVoice.getName());
        return saiyVoice;
    } else {
        return null;
    }
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:15,代码来源:SaiyTextToSpeech.java


示例10: TTS

import android.speech.tts.Voice; //导入依赖的package包/类
public TTS(Context c){
    tts = new TextToSpeech(c, new TextToSpeech.OnInitListener() {
        @Override
        public void onInit(int i) {
            if (i==TextToSpeech.SUCCESS) {
                tts.setLanguage(Locale.ITALY);
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
                    tts.setVoice(new Voice("My Voice", Locale.ITALY, QUALITY_VERY_HIGH, LATENCY_NORMAL, true, tts.getFeatures(Locale.ITALY)));
            }
        }
    });
}
 
开发者ID:Marplex,项目名称:Schoolbook,代码行数:13,代码来源:TTS.java


示例11: onGetVoices

import android.speech.tts.Voice; //导入依赖的package包/类
@Override
@TargetApi(21)
public List<Voice> onGetVoices() {
    // Work-around for https://github.com/De7vID/klingon-assistant/issues/132.
    List<Voice> list = new ArrayList<Voice>();
    list.add(new Voice("Klingon (Canada)", new Locale("tlh", "CAN"), 100, 100, false,
          new HashSet<String>()));
    return list;
}
 
开发者ID:De7vID,项目名称:klingon-assistant,代码行数:10,代码来源:KlingonSpeakTtsService.java


示例12: getVoice

import android.speech.tts.Voice; //导入依赖的package包/类
public Voice getVoice() {
    return voice;
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:4,代码来源:SpeechCachePrepare.java


示例13: setVoice

import android.speech.tts.Voice; //导入依赖的package包/类
public void setVoice(@NonNull final Voice voice) {
    this.voice = voice;
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:4,代码来源:SpeechCachePrepare.java


示例14: SaiyVoice

import android.speech.tts.Voice; //导入依赖的package包/类
public SaiyVoice(@NonNull final Voice voice) {
    super(voice.getName(), voice.getLocale(), voice.getQuality(), voice.getLatency(), voice.isNetworkConnectionRequired(),
            voice.getFeatures());
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:5,代码来源:SaiyVoice.java


示例15: compare

import android.speech.tts.Voice; //导入依赖的package包/类
@Override
public int compare(final Voice v1, final Voice v2) {
    return v1.getLocale().toString().compareTo(v2.getLocale().toString());
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:5,代码来源:SaiyVoice.java


示例16: getDefaultVoice

import android.speech.tts.Voice; //导入依赖的package包/类
@Override
public Voice getDefaultVoice() {
    return super.getDefaultVoice();
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:5,代码来源:SaiyTextToSpeech.java


示例17: getVoice

import android.speech.tts.Voice; //导入依赖的package包/类
@Override
public Voice getVoice() {
    return super.getVoice();
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:5,代码来源:SaiyTextToSpeech.java


示例18: setVoice

import android.speech.tts.Voice; //导入依赖的package包/类
@Override
public int setVoice(final Voice voice) {
    return super.setVoice(voice);
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:5,代码来源:SaiyTextToSpeech.java



注:本文中的android.speech.tts.Voice类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BeanHandler类代码示例发布时间:2022-05-21
下一篇:
Java OpenHandler类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap