From f854e386a6e80cfb7f260e063cd8586882cebe2b Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Tue, 22 Nov 2022 13:49:54 -0600 Subject: [PATCH] Re-add support for speech-dispatcher 0.9. --- speech-dispatcher/Cargo.toml | 1 + speech-dispatcher/src/lib.rs | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/speech-dispatcher/Cargo.toml b/speech-dispatcher/Cargo.toml index f33d6a1..fcec158 100644 --- a/speech-dispatcher/Cargo.toml +++ b/speech-dispatcher/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [features] 0_11 = ["0_10"] 0_10 = [] +0_9 = [] default = ["0_11"] [dependencies] diff --git a/speech-dispatcher/src/lib.rs b/speech-dispatcher/src/lib.rs index 9381911..6bed3fe 100644 --- a/speech-dispatcher/src/lib.rs +++ b/speech-dispatcher/src/lib.rs @@ -99,6 +99,7 @@ pub enum Notification { #[repr(u32)] pub enum Punctuation { All = SPDPunctuation::SPD_PUNCT_ALL, + #[cfg(feature = "0_10")] Most = SPDPunctuation::SPD_PUNCT_MOST, Some = SPDPunctuation::SPD_PUNCT_SOME, None = SPDPunctuation::SPD_PUNCT_NONE, @@ -413,25 +414,25 @@ impl Connection { } pub fn set_voice_type(&self, voice_type: VoiceType) -> Result<(), Error> { - #[cfg(all(feature = "0_10", not(feature = "0_11")))] + #[cfg(all(any(feature = "0_9", feature = "0_10"), not(feature = "0_11")))] let v = unsafe { spd_set_voice_type(*self.0, voice_type as u32) }; - #[cfg(any(feature = "0_11", not(feature = "0_10")))] + #[cfg(all(not(feature = "0_9"), any(feature = "0_11", not(feature = "0_10"))))] let v = unsafe { spd_set_voice_type(*self.0, voice_type as i32) }; c_int_to_result(v) } pub fn set_voice_type_all(&self, voice_type: VoiceType) -> Result<(), Error> { - #[cfg(all(feature = "0_10", not(feature = "0_11")))] + #[cfg(all(any(feature = "0_9", feature = "0_10"), not(feature = "0_11")))] let v = unsafe { spd_set_voice_type_all(*self.0, voice_type as u32) }; - #[cfg(any(feature = "0_11", not(feature = "0_10")))] + #[cfg(all(not(feature = "0_9"), any(feature = "0_11", not(feature = "0_10"))))] let v = unsafe { spd_set_voice_type_all(*self.0, voice_type as i32) }; c_int_to_result(v) } pub fn set_voice_type_uid(&self, voice_type: VoiceType, target_uid: u32) -> Result<(), Error> { - #[cfg(all(feature = "0_10", not(feature = "0_11")))] + #[cfg(all(any(feature = "0_9", feature = "0_10"), not(feature = "0_11")))] let v = unsafe { spd_set_voice_type_uid(*self.0, voice_type as u32, target_uid) }; - #[cfg(any(feature = "0_11", not(feature = "0_10")))] + #[cfg(all(not(feature = "0_9"), any(feature = "0_11", not(feature = "0_10"))))] let v = unsafe { spd_set_voice_type_uid(*self.0, voice_type as i32, target_uid) }; c_int_to_result(v) }