You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using duplex mode, I'm getting serious gaps in the audio output. This is in release mode, and even if I increase the frames per buffer to buffers sizes corresponding to multiple seconds, there are gaps between the buffers. The gaps are approximate 1 sec long. A minimal example to reproduce looks like this:
use std::io;use portaudio as pa;constCHANNELS:i32 = 2;constSAMPLE_RATE:f64 = 44_100.0;constFRAMES_PER_BUFFER:u32 = 1024;fnmain(){run().unwrap()}fnrun() -> Result<(), pa::Error>{let pa = pa::PortAudio::new()?;letmut settings = pa.default_duplex_stream_settings(CHANNELS,CHANNELS,SAMPLE_RATE,FRAMES_PER_BUFFER,)?;
settings.flags = pa::stream_flags::CLIP_OFF;let callback = move |pa::DuplexStreamCallbackArgs{ in_buffer, out_buffer, frames, time, .. }: pa::DuplexStreamCallbackArgs<f32,f32>| {for i in0 .. out_buffer.len(){
out_buffer[i] = ((i *2 % 1000) - 500)asf32 / 1000.0;}
pa::Continue};// Start streamletmut stream = pa.open_non_blocking_stream(settings, callback)?;
stream.start()?;// Wait for user input to quitprintln!("Press enter/return to quit...");letmut user_input = String::new();
io::stdin().read_line(&mut user_input).ok();
stream.stop()?;
stream.close()?;Ok(())}
I can run the same example in other languages just fine, which indicates it is a problem in the Rust binding themselves.
The non-duplex variant using default_output_stream_settings also runs fine.
The text was updated successfully, but these errors were encountered:
When using duplex mode, I'm getting serious gaps in the audio output. This is in release mode, and even if I increase the frames per buffer to buffers sizes corresponding to multiple seconds, there are gaps between the buffers. The gaps are approximate 1 sec long. A minimal example to reproduce looks like this:
I can run the same example in other languages just fine, which indicates it is a problem in the Rust binding themselves.
The non-duplex variant using
default_output_stream_settings
also runs fine.The text was updated successfully, but these errors were encountered: