1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// src/audio/commands.rs
//! Defines the commands that can be sent to the audio processing system.
use ;
use oneshot; // Used for acknowledging commands
// / Represents commands sent to control the audio stream.
// #[derive(Debug, Clone)]
// pub enum AudioCommand {
// /// Start recording using a device specified by its name.
// /// Includes a oneshot sender to signal completion or error.
// StartRecordingByName(String, oneshot::Sender<Result<(), String>>),
// /// Indicates that recording should start (used internally, maybe)
// /// Usually triggered after device initialization or selection.
// StartRecording,
// /// Send captured audio data for processing.
// ProcessChunk(Vec<f32>),
// /// Update the configuration of the audio stream (e.g., sample rate).
// UpdateConfig { sample_rate: u32, channels: u16 },
// /// Request the current status of the audio stream.
// GetStatus(oneshot::Sender<AudioStreamStatus>),
// }
// /// Represents the status of the audio stream.
// #[derive(Debug, Clone, PartialEq)]
// pub enum AudioStreamStatus {
// /// The stream is actively recording audio.
// Recording,
// /// The stream is paused.
// Paused,
// /// The stream is stopped or not yet started.
// Stopped,
// /// The stream encountered an unrecoverable error.
// Error(String),
// }
// /// Custom error type for audio operations.
// #[derive(Debug, thiserror::Error)]
// pub enum AudioError {
// #[error("Device error: {0}")]
// DeviceError(String),
// #[error("Stream error: {0}")]
// StreamError(#[from] StreamError),
// #[error("Failed to play stream: {0}")]
// PlayStreamError(#[from] PlayStreamError),
// #[error("Failed to pause stream: {0}")]
// PauseStreamError(#[from] PauseStreamError),
// #[error("Command send error: {0}")]
// CommandSendError(String),
// #[error("Configuration error: {0}")]
// ConfigError(String),
// #[error("Audio processing error: {0}")]
// ProcessingError(String),
// #[error("I/O error: {0}")]
// IoError(#[from] std::io::Error),
// #[error("No default device found")]
// NoDefaultDevice,
// #[error("Device not found: {0}")]
// DeviceNotFound(String),
// #[error("Unsupported configuration: {0}")]
// UnsupportedConfig(String),
// #[error("Audio buffer error: {0}")]
// BufferError(String),
// #[error("Feature not supported: {0}")]
// FeatureNotSupported(String),
// #[error("Initialization failed: {0}")]
// InitializationFailed(String),
// }