Skip to content

Commit

Permalink
Support ASR's requesrType at SpeechRecognizer #2447
Browse files Browse the repository at this point in the history
  • Loading branch information
sangho.lee committed Nov 27, 2023
1 parent 0da461f commit 68f05e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import android.os.Handler
import android.os.Looper
import com.skt.nugu.sdk.agent.asr.ASRAgentInterface
import com.skt.nugu.sdk.agent.asr.EndPointDetectorParam
import com.skt.nugu.sdk.agent.asr.RequestType
import com.skt.nugu.sdk.agent.asr.WakeupInfo
import com.skt.nugu.sdk.agent.asr.audio.AudioEndPointDetector
import com.skt.nugu.sdk.agent.asr.audio.AudioFormat
Expand Down Expand Up @@ -65,6 +66,7 @@ class SpeechRecognizerAggregator(
var epdParam: EndPointDetectorParam? = null,
var service: String? = null,
var startListeningCallback: ASRAgentInterface.StartRecognitionCallback? = null,
var requestType: RequestType?,
var initiator: ASRAgentInterface.Initiator
)

Expand Down Expand Up @@ -218,6 +220,7 @@ class SpeechRecognizerAggregator(
epdParam,
null,
listeningCallback,
null,
ASRAgentInterface.Initiator.WAKE_UP_WORD
)

Expand Down Expand Up @@ -275,6 +278,7 @@ class SpeechRecognizerAggregator(
pendingStartListeningParam?.epdParam,
pendingStartListeningParam?.service,
pendingStartListeningParam?.startListeningCallback,
pendingStartListeningParam?.requestType,
pendingStartListeningParam?.initiator ?: ASRAgentInterface.Initiator.TAP
)
pendingStartListeningParam = null
Expand Down Expand Up @@ -322,6 +326,7 @@ class SpeechRecognizerAggregator(
epdParam: EndPointDetectorParam?,
service: String?,
callback: ASRAgentInterface.StartRecognitionCallback?,
requestType: RequestType?,
initiator: ASRAgentInterface.Initiator
) {
Logger.d(
Expand All @@ -342,7 +347,7 @@ class SpeechRecognizerAggregator(
}

Logger.d(TAG, "[startListening] will be started after trigger stopped.")
this.pendingStartListeningParam = StartListeningParam(wakeupInfo, epdParam, service, callback, initiator)
this.pendingStartListeningParam = StartListeningParam(wakeupInfo, epdParam, service, callback, requestType, initiator)
isTriggerStoppingByStartListening = true
keywordDetector?.stopDetect()
}
Expand All @@ -359,6 +364,7 @@ class SpeechRecognizerAggregator(
epdParam,
service,
callback,
requestType,
initiator
)
}
Expand All @@ -372,6 +378,7 @@ class SpeechRecognizerAggregator(
epdParam : EndPointDetectorParam?,
service: String?,
callback: ASRAgentInterface.StartRecognitionCallback?,
requestType: RequestType?,
initiator: ASRAgentInterface.Initiator
) {
val inputStream = audioProvider.acquireAudioInputStream(speechProcessor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package com.skt.nugu.sdk.platform.android.speechrecognizer

import com.skt.nugu.sdk.agent.asr.ASRAgentInterface
import com.skt.nugu.sdk.agent.asr.EndPointDetectorParam
import com.skt.nugu.sdk.agent.asr.RequestType
import com.skt.nugu.sdk.agent.asr.WakeupInfo
import com.skt.nugu.sdk.agent.asr.audio.AudioFormat
import com.skt.nugu.sdk.agent.sds.SharedDataStream
Expand Down Expand Up @@ -132,13 +133,15 @@ interface SpeechRecognizerAggregatorInterface {
* @param wakeupInfo the wakeup info of wakeup word for input
* @param epdParam the epd params
* @param service the service payload(json formatted string) for ASR
* @param requestType the type for ASR
* @param initiator the initiator
*/
fun startListening(
wakeupInfo: WakeupInfo? = null,
epdParam: EndPointDetectorParam? = null,
service: String? = null,
callback: ASRAgentInterface.StartRecognitionCallback? = null,
requestType: RequestType? = null,
initiator: ASRAgentInterface.Initiator
)

Expand Down

0 comments on commit 68f05e3

Please sign in to comment.