Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
dheijl committed Sep 4, 2024
1 parent 57eb922 commit 067455c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/utils/rwstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl ChannelStream {
impl Read for ChannelStream {
fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
if self.flac_channel.is_none() {
// naked LPCM or WAV LPCM
// LPCM (naked LPCM or WAV/RF64)
if self.use_wave_format && !self.wav_hdr.is_empty() {
let i = self.wav_hdr.len();
buf[..i].copy_from_slice(&self.wav_hdr);
Expand All @@ -155,7 +155,10 @@ impl Read for ChannelStream {
// drain the fifo of the samples needed to fill the buffer
// this way we don't need the expensive pop_front()
let drain = self.fifo.drain(0..samples_needed);
debug_assert!(drain.len() == samples_needed);
debug_assert!(
drain.len() == samples_needed,
"PCM: drain.len <> samples_needed"
);
// return a buffer with an integral number of samples
// the drain now contains the exact number of samples needed to fill the streaming buffer
// so we can zip them
Expand Down Expand Up @@ -194,10 +197,7 @@ impl Read for ChannelStream {
},
_ => (),
}
/*debug
let i = (buf.len() / bytes_per_sample) * bytes_per_sample;
eprintln!("Returned buffer: ({i})");
*/
//eprintln!("Returned buffer: {}", (buf.len() / bytes_per_sample) * bytes_per_sample);
Ok((buf.len() / bytes_per_sample) * bytes_per_sample)
} else {
// FLAC
Expand Down

0 comments on commit 067455c

Please sign in to comment.