aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs
index 38a34d4..0814506 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 by Matthias P. Braendli <matthias.braendli@mpb.li>
+ * Copyright (C) 2023 by Matthias P. Braendli <matthias.braendli@mpb.li>
*
* Based on previous work by
* Copyright (C) 2022 by Felix Erckenbrecht <eligs@eligs.de>
@@ -245,14 +245,20 @@ fn main() {
)
};
- if let Err(e) = source_file.read_exact(&mut buf_u8) {
- if e.kind() != std::io::ErrorKind::UnexpectedEof {
- eprintln!("Input file read stopped {:?}", e);
- }
- else {
- eprintln!("Input file EOF reached");
+ match source_file.read(&mut buf_u8) {
+ Ok(len) => {
+ if len == 0 {
+ if let Err(e_seek) = source_file.rewind() {
+ eprintln!("Failed to rewind source file: {}", e_seek);
+ break;
+ }
+ }
+ buf.resize(len, 0);
+ },
+ Err(e) => {
+ eprintln!("Failed to read source file: {}", e);
+ break;
}
- break;
}
let buf: Vec<f32> = buf
@@ -271,6 +277,8 @@ fn main() {
break;
}
}
+
+ eprintln!("Leaving input thread");
});
// Read samples, calculate PD and PDSLOPE
@@ -326,6 +334,7 @@ fn main() {
break;
}
}
+ eprintln!("Leaving pd thread");
});
// Read PD and PDSLOPE, interpolate to higher rate
@@ -374,6 +383,7 @@ fn main() {
}
}
}
+ eprintln!("Leaving dds thread");
});
// Main thread, output to file/device