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

Attempt to fix interruptions by adding more sass #106

Merged
merged 2 commits into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup/randomizer.app.iss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "CodeDependencies.iss"

#define MyAppName "SMZ3 Cas' Randomizer"
#define MyAppVersion "4.2.0"
#define MyAppVersion "4.2.1"
#define MyAppPublisher "Vivelin"
#define MyAppURL "https://github.com/Vivelin/SMZ3Randomizer"
#define MyAppExeName "Randomizer.App.exe"
Expand Down
2 changes: 1 addition & 1 deletion src/Randomizer.App/Randomizer.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<ApplicationIcon>chozo20.ico</ApplicationIcon>
<Version>4.2.0</Version>
<Version>4.2.1</Version>
<Title>SMZ3 Cas' Randomizer</Title>
<AssemblyTitle>SMZ3 Cas' Randomizer</AssemblyTitle>
<Authors>Vivelin</Authors>
Expand Down
5 changes: 5 additions & 0 deletions src/Randomizer.SMZ3.Tracking/Configuration/ResponseConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,11 @@ public class ResponseConfig
/// </summary>
public SchrodingersString? Interrupted { get; init; }

/// <summary>
/// Gets the phrases to respond with when Tracker has been interrupted too many times.
/// </summary>
public SchrodingersString? InterruptedTooManyTimes { get; init; }

/// <summary>
/// Gets a dictionary that contains the phrases to respond with when no
/// voice commands have been issued after a certain period of time, as
Expand Down
20 changes: 18 additions & 2 deletions src/Randomizer.SMZ3.Tracking/Tracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1883,16 +1883,32 @@ public void StopPegWorldMode(float? confidence = null)

internal void HandleInterruption()
{
_interruptions++;
_logger.LogDebug("Tracker has been interrupted {Interruptions} time(s)", _interruptions);

if (Options.InterruptionTolerance < 0
|| (++_interruptions % Options.InterruptionTolerance) != 0)
|| (_interruptions % Options.InterruptionTolerance) != 0)
{
_logger.LogDebug("Tracker is tolerating the interruptions (Tolerance: {Tolerance})", Options.InterruptionTolerance);
return;
}

if (Responses.Interrupted != null)
if (_interruptions >= Options.InterruptionLimit
&& Responses.InterruptedTooManyTimes != null)
{
_interruptions = 0;
_tts.SpeakAsyncCancelAll();
_speechQueue.Clear();
_logger.LogDebug("Tracker has had enough and reach her interruption limit of {Limit}", Options.InterruptionLimit);

Say(x => x.InterruptedTooManyTimes);
}
else if (Responses.Interrupted != null)
{
var remainingSpeech = _speechQueue.ToList();
_tts.SpeakAsyncCancelAll();
_speechQueue.Clear();
_logger.LogDebug("Tracker doesn't like being interrupted. Still has {QueueCount} items on the TTS queue.", remainingSpeech.Count);

Say(x => x.Interrupted);

Expand Down
6 changes: 6 additions & 0 deletions src/Randomizer.SMZ3.Tracking/TrackerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,11 @@ public record TrackerOptions
/// interrupted before speaking up.
/// </summary>
public int InterruptionTolerance { get; set; } = 2;

/// <summary>
/// Gets or sets the number of times Tracker will tolerate being
/// interrupted before quitting.
/// </summary>
public int InterruptionLimit { get; set; } = 5;
}
}
15 changes: 15 additions & 0 deletions src/Randomizer.SMZ3.Tracking/tracker.json
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,12 @@
"Do you mind? <break strength='weak'/> Anyway...",
"It's not polite to talk over other people, you know. <break strength='weak'/> As I was saying..."
],
"InterruptedTooManyTimes": [
"Shut up already.",
"Fine, I'll shut up. <break time='60s'/>",
"I've had enough of this. I'm taking a break. <break time='60s'/>",
"That's it. I'm taking a break. <break time='60s'/>"
],
"TrackedItem": [
"Toggling {0} on.",
"Toggled {0} on.",
Expand Down Expand Up @@ -1973,6 +1979,15 @@
"Response": [
"<break time='2s'/> Pfft."
]
},
{
"Phrases": [ "I'm sorry", "I apologize" ],
"Response": [
"Oh, fine.",
"You better.",
"Whatever.",
"Say it like you mean it."
]
}
]
}