Add 0.10 feature.

This commit is contained in:
Nolan Darilek 2022-03-10 12:54:53 -06:00
parent c6b90a7a24
commit bbae5dc983
2 changed files with 16 additions and 1 deletions

View File

@ -7,6 +7,10 @@ description = "Rusty interface to the speech-dispatcher speech synthesis library
license = "LGPL-2.1 OR MIT OR Apache-2.0"
edition = "2021"
[features]
"0.10" = []
default = ["0.10"]
[dependencies]
lazy_static = "1"
speech-dispatcher-sys = { version = "0.7", path = "../speech-dispatcher-sys" }

View File

@ -98,8 +98,10 @@ pub enum Notification {
#[repr(u32)]
pub enum Punctuation {
All = SPDPunctuation::SPD_PUNCT_ALL,
None = SPDPunctuation::SPD_PUNCT_NONE,
#[cfg(feature = "0.10")]
Most = SPDPunctuation::SPD_PUNCT_MOST,
Some = SPDPunctuation::SPD_PUNCT_SOME,
None = SPDPunctuation::SPD_PUNCT_NONE,
}
#[derive(Clone, Copy, Debug)]
@ -411,17 +413,26 @@ impl Connection {
}
pub fn set_voice_type(&self, voice_type: VoiceType) -> Result<(), Error> {
#[cfg(feature = "0.10.0")]
let v = unsafe { spd_set_voice_type(*self.0, voice_type as i32) };
#[cfg(not(feature = "0.10.0"))]
let v = unsafe { spd_set_voice_type(*self.0, voice_type as u32) };
c_int_to_result(v)
}
pub fn set_voice_type_all(&self, voice_type: VoiceType) -> Result<(), Error> {
#[cfg(feature = "0.10")]
let v = unsafe { spd_set_voice_type_all(*self.0, voice_type as i32) };
#[cfg(not(feature = "0.10"))]
let v = unsafe { spd_set_voice_type_all(*self.0, voice_type as u32) };
c_int_to_result(v)
}
pub fn set_voice_type_uid(&self, voice_type: VoiceType, target_uid: u32) -> Result<(), Error> {
#[cfg(feature = "0.10")]
let v = unsafe { spd_set_voice_type_uid(*self.0, voice_type as i32, target_uid) };
#[cfg(not(feature = "0.10"))]
let v = unsafe { spd_set_voice_type_uid(*self.0, voice_type as u32, target_uid) };
c_int_to_result(v)
}