changes for testing
This commit is contained in:
parent
7d76a0cd5b
commit
1ecdbeb75f
1 changed files with 7 additions and 6 deletions
|
@ -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<T>(pcm: &mut [T], channel: &mut Receiver<PcmSampleMessage>, i
|
|||
where
|
||||
T: Sample + std::fmt::Debug + FromSample<i64> + FromSample<f64>,
|
||||
{
|
||||
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::<T>(),
|
||||
//Err(_) => (std::f64::consts::PI * 2.0*(*i)/(384000.0/100.0)).sin().to_sample::<T>(), //T::EQUILIBRIUM,
|
||||
Err(_) => {
|
||||
Err(_) => (std::f64::consts::PI * 2.0*(*i)/(384000.0/100.0)).sin().to_sample::<T>(), //T::EQUILIBRIUM,
|
||||
/*Err(_) => {
|
||||
signal.next().to_sample::<T>()
|
||||
}
|
||||
}*/
|
||||
};
|
||||
*i = *i % 384000.0 + 1.0;
|
||||
//if *i > 200000.0 { break; }
|
||||
}
|
||||
println!("gave them");
|
||||
//let mut ctr = 0usize;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue