Skip to content

Commit

Permalink
feat: tts mute viewer names (#976)
Browse files Browse the repository at this point in the history
* feat: tts mute viewer names

* fix: titling
  • Loading branch information
SputNikPlop authored Mar 24, 2023
1 parent e0cf4be commit f9d50b1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/models/tts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class TtsModel extends ChangeNotifier {
var _isRandomVoiceEnabled = true;
var _isBotMuted = false;
var _isEmoteMuted = false;
var _isPreludeMuted = false;
var _speed = Platform.isAndroid ? 0.8 : 0.395;
var _pitch = 1.0;
var _isEnabled = false;
Expand Down Expand Up @@ -131,7 +132,7 @@ class TtsModel extends ChangeNotifier {
return "";
}
final author = model.author.displayName ?? model.author.login;
if (!includeAuthorPrelude) {
if (!includeAuthorPrelude || isPreludeMuted) {
return text;
}
return model.isAction ? "$author $text" : "$author said $text";
Expand Down Expand Up @@ -219,6 +220,15 @@ class TtsModel extends ChangeNotifier {
notifyListeners();
}

bool get isPreludeMuted {
return _isPreludeMuted;
}

set isPreludeMuted(bool value) {
_isPreludeMuted = value;
notifyListeners();
}

bool get isCloudTtsEnabled {
return _isCloudTtsEnabled;
}
Expand Down Expand Up @@ -383,6 +393,9 @@ class TtsModel extends ChangeNotifier {
if (json['isEmoteMuted'] != null) {
_isEmoteMuted = json['isEmoteMuted'];
}
if (json['isPreludeMuted'] != null) {
_isPreludeMuted = json['isPreludeMuted'];
}
if (json['isRandomVoiceEnabled'] != null) {
_isRandomVoiceEnabled = json['isRandomVoiceEnabled'];
}
Expand All @@ -403,6 +416,7 @@ class TtsModel extends ChangeNotifier {
Map<String, dynamic> toJson() => {
"isBotMuted": isBotMuted,
"isEmoteMuted": isEmoteMuted,
"isPreludeMuted": isPreludeMuted,
"isRandomVoiceEnabled": isRandomVoiceEnabled,
"language": language.languageCode,
"pitch": pitch,
Expand Down
7 changes: 7 additions & 0 deletions lib/screens/settings/tts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,13 @@ class TextToSpeechScreen extends StatelessWidget {
model.isEmoteMuted = value;
},
),
SwitchListTile.adaptive(
title: const Text("Mute viewer names in text to speech"),
value: model.isPreludeMuted,
onChanged: (value) {
model.isPreludeMuted = value;
},
)
],
);
}),
Expand Down

0 comments on commit f9d50b1

Please sign in to comment.