首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NSVoiceLocaleIdentifier on Xamarin.Mac在哪里?

NSVoiceLocaleIdentifier on Xamarin.Mac在哪里?
EN

Stack Overflow用户
提问于 2017-03-28 10:47:57
回答 1查看 67关注 0票数 0

我知道,它可能是与其他一些类似的实体分组成某种枚举。但是搜索Google,搜索程序集没有返回任何答案。那么,NSVoiceLocaleIdentifier on Xamarin.Mac在哪里?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-03-28 13:58:39

注意:编译时验证有“无”定义常量,因为NSVoiceLocaleIdentifier字符串基于操作系统安装是动态的。如果您想要一个完整的列表,您必须在应用程序运行时查找它们。

NSVoice​Locale​Identifier在为特定语音返回的NSDictionary中可用。

我的系统上没有塞尔维亚人(sv_SV),但还有64人.

  • com.apple.speech.synthesis.voice.Zarvox以美国英语为基础(en_US)
  • com.apple.speech.synthesis.voice.thomas是法语(fr-FR)

示例:

代码语言:javascript
复制
foreach (var voice in NSSpeechSynthesizer.AvailableVoices)
{
    Console.WriteLine(voice);
    var attributes = NSSpeechSynthesizer.AttributesForVoice(voice);
    foreach (var item in attributes)
    {
        if (item.Key.ToString() == "VoiceIndividuallySpokenCharacters" ||
            item.Key.ToString() == "VoiceSupportedCharacters")
            continue;
        Console.WriteLine($"\t{item.Key}:{item.Value}");
    }
    Console.WriteLine();
}

示例输出:

代码语言:javascript
复制
com.apple.speech.synthesis.voice.Zarvox
    VoiceShowInFullListOnly:1
    VoiceGender:VoiceGenderNeuter
    VoiceIdentifier:com.apple.speech.synthesis.voice.Zarvox
    VoiceVersion:3.6
    VoiceDemoText:That looks like a peaceful planet.
    VoiceLanguage:en-US
    VoiceAge:1
    VoiceName:Zarvox
    VoiceLocaleIdentifier:en_US

com.apple.speech.synthesis.voice.thomas
    VoiceName:Thomas
    VoiceGroup:VoiceGroupCompact
    VoiceLocaleIdentifier:fr_FR
    VoiceShowInFullListOnly:0
    VoiceDemoText:Bonjour, je m’appelle Thomas. Je suis une voix française.
    VoiceGender:VoiceGenderMale
    VoiceNumericID:251973347
    VoiceAge:35
    VoiceIdentifier:com.apple.speech.synthesis.voice.thomas
    VoiceVersion:5.0.7
    VoiceNameRoot:Thomas
    VoiceSynthesizerNumericID:1886745202
    VoiceRelativeDesirability:3800
    VoiceLanguage:fr-FR
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43067547

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档