Stopping play_wav()?

So for the AudioService I believe you want to be passing it a reference to the messagebus eg:
self.audio_service = AudioService(self.bus). It then knows where to send the appropriate messages.

The emitter is what sends messages to the bus. However it’s format has changed over the years as Mycroft evolved and became more stable. So instead of self.emitter.emit now we have something like:
self.bus.emit(Message("speak", {"utterance": "words to be spoken", "lang": "en-us"}))
However if you’re writing a Skill you generally shouldn’t need to send messages to the bus directly. We instead use simpler helper functions, like:
self.speak_dialog("words to be spoken")

and instead of the old self.emitter.on, we can call:
self.add_event(mycroft.audio.service.stop, some_function)
which would trigger some_function everytime the AudioService emitted a stop message.

1 Like