1
0

feat: Introduce ITranscriptionOrchestrator and related interfaces, refactoring DaemonService and other components to use dependency injection.

This commit is contained in:
2026-02-28 15:36:03 +01:00
parent ac0ac2397b
commit 0577640da9
18 changed files with 356 additions and 175 deletions

View File

@@ -3,15 +3,25 @@ using System.Diagnostics;
using Toak.Core;
using Toak.IO;
using Toak.Core.Interfaces;
namespace Toak.Audio;
public static class AudioRecorder
public class AudioRecorder : IAudioRecorder
{
private static readonly string WavPath = Path.Combine(Path.GetTempPath(), "toak_recording.wav");
private readonly string WavPath = Path.Combine(Path.GetTempPath(), "toak_recording.wav");
private readonly IRecordingStateTracker _stateTracker;
private readonly INotifications _notifications;
public static string GetWavPath() => WavPath;
public AudioRecorder(IRecordingStateTracker stateTracker, INotifications notifications)
{
_stateTracker = stateTracker;
_notifications = notifications;
}
public static void StartRecording()
public string GetWavPath() => WavPath;
public void StartRecording()
{
if (File.Exists(WavPath))
{
@@ -34,14 +44,14 @@ public static class AudioRecorder
var process = Process.Start(pInfo);
if (process != null)
{
StateTracker.SetRecording(process.Id);
Notifications.Notify("Recording Started");
_stateTracker.SetRecording(process.Id);
_notifications.Notify("Recording Started");
}
}
public static void StopRecording()
public void StopRecording()
{
var pid = StateTracker.GetRecordingPid();
var pid = _stateTracker.GetRecordingPid();
if (pid.HasValue)
{
Logger.LogDebug($"Found active recording process with PID {pid.Value}. Attempting to stop...");
@@ -69,7 +79,7 @@ public static class AudioRecorder
}
finally
{
StateTracker.ClearRecording();
_stateTracker.ClearRecording();
}
}
}