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


Java ConverseConfig类代码示例

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


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

示例1: run

import com.google.assistant.embedded.v1alpha1.ConverseConfig; //导入依赖的package包/类
@Override
public void run() {
    Log.i(TAG, "starting assistant request");
    mAudioRecord.startRecording();
    mAssistantRequestObserver = mAssistantService.converse(mAssistantResponseObserver);
    ConverseConfig.Builder converseConfigBuilder = ConverseConfig.newBuilder()
            .setAudioInConfig(AudioInConfig.newBuilder()
                    .setEncoding(ENCODING_INPUT)
                    .setSampleRateHertz(SAMPLE_RATE)
                    .build())
            .setAudioOutConfig(AudioOutConfig.newBuilder()
                    .setEncoding(ENCODING_OUTPUT)
                    .setSampleRateHertz(SAMPLE_RATE)
                    .setVolumePercentage(mVolumePercentage)
                    .build());
    if (mConversationState != null) {
        converseConfigBuilder.setConverseState(ConverseState.newBuilder()
                .setConversationState(mConversationState)
                .build());
    }
    mAssistantRequestObserver.onNext(
        ConverseRequest.newBuilder()
            .setConfig(converseConfigBuilder.build())
            .build());
    mAssistantHandler.post(mStreamAssistantRequest);
}
 
开发者ID:googlecodelabs,项目名称:androidthings-googleassistant,代码行数:27,代码来源:AssistantActivity.java

示例2: run

import com.google.assistant.embedded.v1alpha1.ConverseConfig; //导入依赖的package包/类
@Override
public void run() {
    Log.i(TAG, "starting assistant request");
    mAudioRecord.startRecording();
    mAssistantRequestObserver = mAssistantService.converse(mAssistantResponseObserver);
    ConverseConfig.Builder converseConfigBuilder = ConverseConfig.newBuilder()
            .setAudioInConfig(ASSISTANT_AUDIO_REQUEST_CONFIG)
            .setAudioOutConfig(ASSISTANT_AUDIO_RESPONSE_CONFIG);
    mAssistantRequestObserver.onNext(
            ConverseRequest.newBuilder()
                    .setConfig(converseConfigBuilder.build())
                    .build());
    mAssistantHandler.post(mStreamAssistantRequest);
}
 
开发者ID:googlecodelabs,项目名称:androidthings-googleassistant,代码行数:15,代码来源:AssistantActivity.java

示例3: startConversation

import com.google.assistant.embedded.v1alpha1.ConverseConfig; //导入依赖的package包/类
/**
 * Starts a request to the Assistant.
 */
public void startConversation() {
    mAudioRecord.startRecording();
    mRequestHandler.post(new Runnable() {
                                  @Override
                                  public void run() {
                                      mRequestCallback.onRequestStart();
                                  }
                              });
    mAssistantHandler.post(new Runnable() {
        @Override
        public void run() {
            mAssistantRequestObserver = mAssistantService.converse(mAssistantResponseObserver);
            ConverseConfig.Builder converseConfigBuilder = ConverseConfig.newBuilder()
                    .setAudioInConfig(mAudioInConfig)
                    .setAudioOutConfig(mAudioOutConfig);
            if (mConversationState != null) {
                converseConfigBuilder.setConverseState(ConverseState.newBuilder()
                        .setConversationState(mConversationState)
                        .build());
            }
            mAssistantRequestObserver.onNext(
                    ConverseRequest.newBuilder()
                            .setConfig(converseConfigBuilder.build())
                            .build());
        }
    });
    mAssistantHandler.post(mStreamAssistantRequest);
}
 
开发者ID:androidthings,项目名称:sample-googleassistant,代码行数:32,代码来源:EmbeddedAssistant.java

示例4: startRecognizing

import com.google.assistant.embedded.v1alpha1.ConverseConfig; //导入依赖的package包/类
public void startRecognizing(int sampleRate) {

        if (mApi == null) {
            Log.w(TAG, "API not ready. Ignoring the request.");
            return;
        }
        //Log.d(TAG,"request sending");
        for (Listener listener : mListeners) {
            listener.onRequestStart();
           // Log.d(TAG,"request sending");
        }
        // Configure the API
        mRequestObserver = mApi.converse(mResponseObserver);
        ConverseConfig.Builder converseConfigBuilder =ConverseConfig.newBuilder()
                .setAudioInConfig(AudioInConfig.newBuilder()
                        .setEncoding(AudioInConfig.Encoding.LINEAR16)
                        .setSampleRateHertz(sampleRate)
                        .build())
                .setAudioOutConfig(AudioOutConfig.newBuilder()
                        .setEncoding(AudioOutConfig.Encoding.LINEAR16)
                        .setSampleRateHertz(sampleRate)
                        .setVolumePercentage(DEFAULT_VOLUME)
                        .build());
        if (vConversationState != null) {
            converseConfigBuilder.setConverseState(
                    ConverseState.newBuilder()
                            .setConversationState(vConversationState)
                            .build());
        }
        mRequestObserver.onNext(ConverseRequest.newBuilder()
                .setConfig(converseConfigBuilder.build())
                .build());



    }
 
开发者ID:hsavaliya,项目名称:GoogleAssistantSDK,代码行数:37,代码来源:SpeechService.java


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