From 1ecdbeb75f191b06e49541eb27aa7d8a9f218d9f Mon Sep 17 00:00:00 2001 From: TerraMaster85 Date: Mon, 16 Dec 2024 11:44:14 -0500 Subject: [PATCH] changes for testing --- src/audio_transmitter/mod.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/audio_transmitter/mod.rs b/src/audio_transmitter/mod.rs index 21eaa62..8169418 100644 --- a/src/audio_transmitter/mod.rs +++ b/src/audio_transmitter/mod.rs @@ -19,6 +19,7 @@ pub fn audio_transmitter_main( let cpal_output_config = cpal_output.supported_output_configs() .context("could not find a suitable audio output configuration. are you root, trying to use a normal user's audio stack? try setting the capability CAP_NET_ADMIN=ep on this binary, and running as the user who is running the audio stack.")? .max_by_key(|cfg| { + println!("AVAIL RATE: {:?}, {:?}, {:?}", cfg.sample_format(), cfg.min_sample_rate(), cfg.max_sample_rate()); match cfg.sample_format() { SampleFormat::U8 => 10, SampleFormat::I8 => 11, @@ -33,7 +34,7 @@ pub fn audio_transmitter_main( x => { warn!("Backend offered unknown sample format {x}",); -999 } } }).expect("output device has no supported configurations available") - .with_max_sample_rate(); + .with_sample_rate(cpal::SampleRate(384000));//max_sample_rate(); info!( "output samples are {} @ {}hz", @@ -131,18 +132,18 @@ fn give_output_pcm(pcm: &mut [T], channel: &mut Receiver, i where T: Sample + std::fmt::Debug + FromSample + FromSample, { - println!("wanted {} samples", pcm.len()); - let mut signal = dasp_signal::rate(384000.0).const_hz(100.0).sine(); + print!("ALSA wanted {} samples... ", pcm.len()); for outgoing in pcm.iter_mut() { *outgoing = match channel.try_recv() { Ok(sample) => sample.to_sample::(), - //Err(_) => (std::f64::consts::PI * 2.0*(*i)/(384000.0/100.0)).sin().to_sample::(), //T::EQUILIBRIUM, - Err(_) => { + Err(_) => (std::f64::consts::PI * 2.0*(*i)/(384000.0/100.0)).sin().to_sample::(), //T::EQUILIBRIUM, + /*Err(_) => { signal.next().to_sample::() - } + }*/ }; *i = *i % 384000.0 + 1.0; //if *i > 200000.0 { break; } } + println!("gave them"); //let mut ctr = 0usize; }