当前位置: 首页>>代码示例>>Java>>正文


Java DescribeVoicesResult类代码示例

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


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

示例1: handle

import com.amazonaws.services.polly.model.DescribeVoicesResult; //导入依赖的package包/类
@Override
public void handle(Context ctx) throws Exception {
    String token = null;
    List<Voice> voices = new ArrayList<>();

    while (true) {
        DescribeVoicesResult result;
        if (token == null) {
            result = polly.describeVoices(new DescribeVoicesRequest());
        } else {
            result = polly.describeVoices(new DescribeVoicesRequest().withNextToken(token));
        }

        voices.addAll(result.getVoices());

        if (result.getNextToken() != null) {
            token = result.getNextToken();
        } else {
            ctx.render(Jackson.toJsonString(voices));
            break;
        }
    }
}
 
开发者ID:gregwhitaker,项目名称:aws-polly-example,代码行数:24,代码来源:PollyVoicesHandler.java

示例2: processVoicesRequest

import com.amazonaws.services.polly.model.DescribeVoicesResult; //导入依赖的package包/类
private void processVoicesRequest() {
  // Create describe voices request.
  DescribeVoicesRequest describeVoicesRequest = new DescribeVoicesRequest();

  // Synchronously ask Polly Polly to describe available TTS voices.
  DescribeVoicesResult describeVoicesResult = polly.describeVoices(describeVoicesRequest);
  awsVoices = describeVoicesResult.getVoices();
  log.info("found {} voices", awsVoices.size());
  for (int i = 0; i < awsVoices.size(); ++i) {
    Voice voice = awsVoices.get(i);
    voiceMap.put(voice.getName(), voice);
    langMap.put(voice.getLanguageCode(), voice);
    log.info("{} {} - {}", i, voice.getName(), voice.getLanguageCode());
  }

  // set default voice
  if (voice == null) {
    voice = awsVoices.get(0).getName();
    awsVoice = awsVoices.get(0);
    lang = awsVoice.getLanguageCode();
    log.info("setting default voice to {}", voice);
  }

}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:25,代码来源:Polly.java

示例3: doInBackground

import com.amazonaws.services.polly.model.DescribeVoicesResult; //导入依赖的package包/类
@Override
protected Void doInBackground(Void... params) {
    if (voices != null) {
        return null;
    }

    // Create describe voices request.
    DescribeVoicesRequest describeVoicesRequest = new DescribeVoicesRequest();

    DescribeVoicesResult describeVoicesResult;
    try {
        // Synchronously ask the Polly Service to describe available TTS voices.
        describeVoicesResult = client.describeVoices(describeVoicesRequest);
    } catch (RuntimeException e) {
        Log.e(TAG, "Unable to get available voices. " + e.getMessage());
        return null;
    }

    // Get list of voices from the result.
    voices = describeVoicesResult.getVoices();

    // Log a message with a list of available TTS voices.
    Log.i(TAG, "Available Polly voices: " + voices);

    return null;
}
 
开发者ID:awslabs,项目名称:aws-sdk-android-samples,代码行数:27,代码来源:MainActivity.java


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