1
0

refactor: centralize common strings, paths, and default values into a new Constants class.

This commit is contained in:
2026-02-28 15:41:40 +01:00
parent 0577640da9
commit 96ccf0ea9a
13 changed files with 80 additions and 38 deletions

View File

@@ -9,7 +9,7 @@ namespace Toak.Audio;
public class AudioRecorder : IAudioRecorder
{
private readonly string WavPath = Path.Combine(Path.GetTempPath(), "toak_recording.wav");
private readonly string WavPath = Constants.Paths.RecordingWavFile;
private readonly IRecordingStateTracker _stateTracker;
private readonly INotifications _notifications;
@@ -33,7 +33,7 @@ public class AudioRecorder : IAudioRecorder
var pInfo = new ProcessStartInfo
{
FileName = "pw-record",
FileName = Constants.Commands.AudioRecord,
Arguments = $"--rate=16000 --channels=1 --format=s16 \"{WavPath}\"",
UseShellExecute = false,
CreateNoWindow = true,
@@ -63,7 +63,7 @@ public class AudioRecorder : IAudioRecorder
// Gracefully stop pw-record using SIGINT to ensure WAV headers are finalizing cleanly
Process.Start(new ProcessStartInfo
{
FileName = "kill",
FileName = Constants.Commands.ProcessKill,
Arguments = $"-INT {pid.Value}",
CreateNoWindow = true,
UseShellExecute = false