clawft_plugin/voice/
capture.rs1#[derive(Debug, Clone)]
8pub struct CaptureConfig {
9 pub sample_rate: u32,
10 pub channels: u16,
11 pub chunk_size: u32,
12 pub device_name: Option<String>,
13}
14
15impl Default for CaptureConfig {
16 fn default() -> Self {
17 Self {
18 sample_rate: 16000,
19 channels: 1,
20 chunk_size: 512,
21 device_name: None,
22 }
23 }
24}
25
26pub struct AudioCapture {
31 config: CaptureConfig,
32 active: bool,
33}
34
35impl AudioCapture {
36 pub fn new(config: CaptureConfig) -> Self {
38 Self { config, active: false }
39 }
40
41 pub fn start(&mut self) -> Result<(), String> {
43 self.active = true;
45 tracing::info!(
46 sample_rate = self.config.sample_rate,
47 channels = self.config.channels,
48 "Audio capture started (stub)"
49 );
50 Ok(())
51 }
52
53 pub fn stop(&mut self) {
55 self.active = false;
56 tracing::info!("Audio capture stopped");
57 }
58
59 pub fn is_active(&self) -> bool {
61 self.active
62 }
63
64 pub fn config(&self) -> &CaptureConfig {
66 &self.config
67 }
68}