Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a function for breaking through mute of the speech synthesizer. #4195

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Zandor300
Copy link

Description

Implement SpeechSynthesizing.forceSpeak(instruction:during:locale:) for breaking through mute of the speech synthesizer.

I am using the SystemSpeechSyntesizer for providing additional spoken instructions in my app, but want some important instructions to break through the mute toggle that is in the UI. The forceSpeak(..) function will bypass the mute check and proceed to speak the instruction regardless.

Implementation

I've made the forceSpeak(..) function optional to implement in the SpeechSynthesizing protocol since I do not have a proper implementation for MapboxSpeechSynthesizer. That instead uses volume of an AVAudioPlayer to mute instructions.

So when forceSpeak(..) isn't implemented, it forwards the call to the regular speak(..) function while using UnimplementedLogging.logUnimplemented(..) to log a warning in console.

Screenshots or Gifs

See code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant