From c00dbb4579b98e248e99d546268782fa0f72bff0 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 7 Jan 2023 17:11:36 +0100 Subject: Handle set_sample_rate --- src/fl2k.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/fl2k.rs b/src/fl2k.rs index 74357b3..a17a04d 100644 --- a/src/fl2k.rs +++ b/src/fl2k.rs @@ -95,7 +95,13 @@ impl FL2K { } pub fn set_sample_rate(&mut self, sample_rate: u32) -> Result<(), FL2KError> { - handle_return_value( unsafe { fl2k_set_sample_rate(self.device, sample_rate) }) + let r = unsafe { fl2k_set_sample_rate(self.device, sample_rate) }; + if r < 0 { + handle_return_value(r) + } + else { + Ok(()) + } } pub fn get_sample_rate(&mut self) -> Result { -- cgit v1.2.3