Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
reset activation timeout on manual deactivation
Browse files Browse the repository at this point in the history
Previously, the wakeword trigger would only reset its activation
counter whenever it automatically deactivated the pipeline, due to
either a timeout or a vad deactivation. However, if the client manually
deactivated the pipeline, the counter's state would be retained for the
subsequent activation. This would shorten that activation's effective
timeout. These changes reset the activation counter whenever the
pipeline is inactive.
  • Loading branch information
brentspell committed Jul 26, 2019
1 parent 0637235 commit 613fffb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ public void process(SpeechContext context, ByteBuffer buffer)
if (!context.isActive()) {
// run the current frame through the detector pipeline
// activate if a keyword phrase was detected
this.activeLength = 0;
sample(context, buffer);
} else {
// continue this wakeword (or external) activation
Expand Down Expand Up @@ -477,7 +478,6 @@ private void detect(SpeechContext context) {

private void activate(SpeechContext context) {
trace(context);
this.activeLength = 1;
context.setActive(true);
context.dispatch(SpeechContext.Event.ACTIVATE);
}
Expand All @@ -486,7 +486,6 @@ private void deactivate(SpeechContext context) {
reset(context);
context.setActive(false);
context.dispatch(SpeechContext.Event.DEACTIVATE);
this.activeLength = 0;
}

private void reset(SpeechContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public void testDetActiveVadDeactivate() throws Exception {

env.detect.setOutputs(1);
env.process();
env.process();

env.process();
env.process();
Expand Down Expand Up @@ -189,6 +190,7 @@ public void testDetActiveTimeout() throws Exception {
env.detect.setOutputs(1);
env.process();
env.process();
env.process();

env.context.setSpeech(false);
env.process();
Expand Down

0 comments on commit 613fffb

Please sign in to comment.