mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-12 22:42:03 -04:00
This commit is contained in:
parent
b9a757ea08
commit
b95b8d41ff
1 changed files with 13 additions and 2 deletions
|
@ -82,7 +82,8 @@ class Scratch3SpeechBlocks {
|
|||
this._currentUtterance = '';
|
||||
|
||||
/**
|
||||
* Similar to _currentUtterance, but set back to '' at the beginning of listening block.
|
||||
* Similar to _currentUtterance, but set back to '' at the beginning of listening block
|
||||
* and on green flag.
|
||||
* Used to get the hat blocks to edge trigger. In order to detect someone saying
|
||||
* the same thing twice in two subsequent listen and wait blocks
|
||||
* and still trigger the hat, we need this to go from
|
||||
|
@ -188,6 +189,7 @@ class Scratch3SpeechBlocks {
|
|||
|
||||
|
||||
this.runtime.on('PROJECT_STOP_ALL', this._resetListening.bind(this));
|
||||
this.runtime.on('PROJECT_START', this._resetEdgeTriggerUtterance.bind(this));
|
||||
|
||||
// Load in the start and stop listening indicator sounds.
|
||||
this._loadUISounds();
|
||||
|
@ -295,6 +297,15 @@ class Scratch3SpeechBlocks {
|
|||
this._resolveSpeechPromises();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the utterance we look for in the when I hear hat block back to
|
||||
* the empty string.
|
||||
* @private
|
||||
*/
|
||||
_resetEdgeTriggerUtterance () {
|
||||
this._utteranceForEdgeTrigger = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the connection to the socket server if it is open.
|
||||
* @private
|
||||
|
@ -738,7 +749,7 @@ class Scratch3SpeechBlocks {
|
|||
// TODO: Question - Should we only play the sound if listening isn't already in progress?
|
||||
return this._playSound(this._startSoundPlayer).then(() => {
|
||||
this._phraseList = this._scanBlocksForPhraseList();
|
||||
this._utteranceForEdgeTrigger = '';
|
||||
this._resetEdgeTriggerUtterance();
|
||||
|
||||
const endSound = (shouldPlayEndSound => {
|
||||
if (shouldPlayEndSound) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue