Skip to content

Commit 9ca1e66

Browse files
committed
Handle shutdown correctly
1 parent 269ac33 commit 9ca1e66

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ fn main() {
8181
while running.load(Ordering::SeqCst) {
8282
thread::sleep(Duration::from_secs(1));
8383
}
84+
85+
_active_client
86+
.deactivate()
87+
.expect("Failed to deactivate JACK client");
88+
8489
if let Some(rec) = recorder {
8590
rec.stop(); // join disk thread
8691
}

src/recorder.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl Recorder {
3434

3535
pub fn stop(self) {
3636
drop(self.tx);
37-
let _ = self.handle.join();
37+
self.handle.join().expect("Unable to join thread");
3838
}
3939
}
4040

@@ -52,4 +52,6 @@ fn run_writer_thread(sample_rate: u32, filename: String, rx: Receiver<AudioBlock
5252
writer.write_sample(*sample).unwrap();
5353
}
5454
}
55+
56+
writer.finalize().expect("Failed to finalise WAV file");
5557
}

0 commit comments

Comments
 (0)