Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Sonus.init = (options, recognizer) => {
sonus = new stream.Writable(),
csr = CloudSpeechRecognizer.init(recognizer)
sonus.mic = {}
sonus.isPaused = false
sonus.recordProgram = opts.recordProgram
sonus.device = opts.device
sonus.started = false
Expand Down Expand Up @@ -124,6 +125,7 @@ Sonus.init = (options, recognizer) => {
})

sonus.trigger = (index, hotword) => {
if (sonus.isPaused) return
if (sonus.started) {
try {
let triggerHotword = (index == 0) ? hotword : models.lookup(index)
Expand All @@ -138,11 +140,13 @@ Sonus.init = (options, recognizer) => {
}

sonus.pause = () => {
record.pause()
// record.pause()
sonus.isPaused = true
}

sonus.resume = () => {
record.resume()
// record.resume()
sonus.isPaused = false
}

return sonus
Expand Down Expand Up @@ -197,9 +201,9 @@ ArecordHelper.restart = (sonus) => {

Sonus.trigger = (sonus, index, hotword) => sonus.trigger(index, hotword)

Sonus.pause = () => record.pause()
// Sonus.pause = () => record.pause()

Sonus.resume = () => record.resume()
// Sonus.resume = () => record.resume()

Sonus.stop = () => record.stop()

Expand Down