mirror of
https://github.com/RustAudio/rodio
synced 2024-12-12 13:12:30 +00:00
use tracing (if enabled) for stream error + sink fmt
This commit is contained in:
parent
1a7b8e5e8f
commit
95a466e03a
2 changed files with 7 additions and 2 deletions
|
@ -131,7 +131,7 @@ impl Sink {
|
|||
.periodic_access(Duration::from_millis(5), move |src| {
|
||||
if controls.stopped.load(Ordering::SeqCst) {
|
||||
src.stop();
|
||||
*controls.position.lock().unwrap() = Duration::ZERO;
|
||||
*controls.position.lock().unwrap() = Duration::ZERO;
|
||||
}
|
||||
{
|
||||
let mut to_clear = controls.to_clear.lock().unwrap();
|
||||
|
|
|
@ -195,7 +195,12 @@ impl CpalDeviceExt for cpal::Device {
|
|||
let (mixer_tx, mut mixer_rx) =
|
||||
dynamic_mixer::mixer::<f32>(format.channels(), format.sample_rate().0);
|
||||
|
||||
let error_callback = |err| eprintln!("an error occurred on output stream: {err}");
|
||||
let error_callback = |err| {
|
||||
#[cfg(feature = "tracing")]
|
||||
tracing::error!("an error occurred on output stream: {err}");
|
||||
#[cfg(not(feature = "tracing"))]
|
||||
eprintln!("an error occurred on output stream: {err}");
|
||||
};
|
||||
|
||||
match format.sample_format() {
|
||||
cpal::SampleFormat::F32 => self.build_output_stream::<f32, _, _>(
|
||||
|
|
Loading…
Reference in a new issue