Compare commits
14 Commits
v0.14.0+v0
...
master
Author | SHA1 | Date |
---|---|---|
Nolan Darilek | 1df00952e4 | |
Nolan Darilek | db43d95cf7 | |
Nolan Darilek | 89fcced31e | |
Nolan Darilek | 1c11f279ec | |
Nolan Darilek | f854e386a6 | |
Nolan Darilek | 1ba40e898b | |
Tait Hoyem | bcf7025f14 | |
Nolan Darilek | 2239c2539a | |
Nolan Darilek | 2ea85bc1bd | |
Nolan Darilek | 0efdccc9aa | |
Nolan Darilek | e770c73e67 | |
Samuel Thibault | 8ff6902148 | |
Samuel Thibault | 29f990e19b | |
Nolan Darilek | 6a6bc3f805 |
|
@ -0,0 +1,27 @@
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: test
|
||||||
|
image: rust
|
||||||
|
commands:
|
||||||
|
- rustup component add clippy rustfmt
|
||||||
|
- apt-get update -qq
|
||||||
|
- apt-get install -qqy llvm-dev libclang-dev clang libspeechd-dev
|
||||||
|
- cargo fmt --all --check
|
||||||
|
- cargo test --no-default-features --features 0_10
|
||||||
|
- cargo clippy --no-default-features --features 0_10
|
||||||
|
- name: release
|
||||||
|
image: rust
|
||||||
|
commands:
|
||||||
|
- apt-get update -qq
|
||||||
|
- apt-get install -qqy llvm-dev libclang-dev clang libspeechd-dev
|
||||||
|
- cargo publish --no-default-features --features 0_10 --manifest-path speech-dispatcher-sys/Cargo.toml || true
|
||||||
|
- cargo publish --no-default-features --features 0_10 --manifest-path speech-dispatcher/Cargo.toml
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/tags/v*
|
||||||
|
environment:
|
||||||
|
CARGO_REGISTRY_TOKEN:
|
||||||
|
from_secret: cargo_registry_token
|
|
@ -1,23 +0,0 @@
|
||||||
image: rust
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- test
|
|
||||||
- publish
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- apt-get update
|
|
||||||
- apt-get install -y libspeechd-dev llvm-dev libclang-dev clang
|
|
||||||
|
|
||||||
test:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- cargo test
|
|
||||||
|
|
||||||
publish:
|
|
||||||
stage: publish
|
|
||||||
script:
|
|
||||||
- cargo login $CARGO_TOKEN
|
|
||||||
- cargo publish --manifest-path speech-dispatcher-sys/Cargo.toml || true
|
|
||||||
- cargo publish --manifest-path speech-dispatcher/Cargo.toml
|
|
||||||
only:
|
|
||||||
- tags
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
# configuration file for git-cliff (0.1.0)
|
||||||
|
|
||||||
|
[changelog]
|
||||||
|
# changelog header
|
||||||
|
header = """
|
||||||
|
# Changelog\n
|
||||||
|
All notable changes to this project will be documented in this file.\n
|
||||||
|
"""
|
||||||
|
# template for the changelog body
|
||||||
|
# https://tera.netlify.app/docs/#introduction
|
||||||
|
body = """
|
||||||
|
{% if version %}\
|
||||||
|
## Version {{ version | trim_start_matches(pat="v") }} - {{ timestamp | date(format="%Y-%m-%d") }}
|
||||||
|
{% else %}\
|
||||||
|
## Unreleased
|
||||||
|
{% endif %}\
|
||||||
|
{% for group, commits in commits | group_by(attribute="group") %}
|
||||||
|
### {{ group | upper_first }}
|
||||||
|
{% for commit in commits %}
|
||||||
|
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}\n
|
||||||
|
"""
|
||||||
|
# remove the leading and trailing whitespace from the template
|
||||||
|
trim = true
|
||||||
|
# changelog footer
|
||||||
|
footer = """
|
||||||
|
<!-- generated by git-cliff -->
|
||||||
|
"""
|
||||||
|
|
||||||
|
[git]
|
||||||
|
# parse the commits based on https://www.conventionalcommits.org
|
||||||
|
conventional_commits = true
|
||||||
|
# filter out the commits that are not conventional
|
||||||
|
filter_unconventional = true
|
||||||
|
# regex for parsing and grouping commits
|
||||||
|
commit_parsers = [
|
||||||
|
{ message = "^feat", group = "Features"},
|
||||||
|
{ message = "^fix", group = "Bug Fixes"},
|
||||||
|
{ message = "^doc", group = "Documentation"},
|
||||||
|
{ message = "^perf", group = "Performance"},
|
||||||
|
{ message = "^refactor", group = "Refactor"},
|
||||||
|
{ message = "^style", group = "Styling"},
|
||||||
|
{ message = "^test", group = "Testing"},
|
||||||
|
{ message = "^chore\\(release\\): prepare for", skip = true},
|
||||||
|
{ message = "^chore", group = "Miscellaneous Tasks"},
|
||||||
|
{ body = ".*security", group = "Security"},
|
||||||
|
]
|
||||||
|
# filter out the commits that are not matched by commit parsers
|
||||||
|
filter_commits = false
|
||||||
|
# glob pattern for matching git tags
|
||||||
|
tag_pattern = "v[0-9]*"
|
||||||
|
# regex for skipping tags
|
||||||
|
skip_tags = ""
|
||||||
|
# regex for ignoring tags
|
||||||
|
ignore_tags = ""
|
||||||
|
# sort the tags chronologically
|
||||||
|
date_order = false
|
||||||
|
# sort the commits inside sections by oldest/newest order
|
||||||
|
sort_commits = "oldest"
|
|
@ -2,11 +2,16 @@
|
||||||
name = "speech-dispatcher-sys"
|
name = "speech-dispatcher-sys"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
|
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
|
||||||
repository = "https://gitlab.com/ndarilek/speech-dispatcher-rs"
|
repository = "https://dev.thewordnerd.info/nolan/speech-dispatcher-rs"
|
||||||
description = "speech-dispatcher system bindings"
|
description = "speech-dispatcher system bindings"
|
||||||
license = "LGPL-2.1 OR MIT OR Apache-2.0"
|
license = "LGPL-2.1 OR MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|
||||||
bindgen = ">= 0.54"
|
bindgen = ">= 0.54"
|
||||||
|
|
||||||
|
[package.metadata.release]
|
||||||
|
tag-prefix = ""
|
||||||
|
publish = false
|
||||||
|
push = false
|
||||||
|
pre-release-hook = ["git-cliff", "-o", "CHANGELOG.md", "--tag", "{{version}}"]
|
||||||
|
|
|
@ -1,20 +1,29 @@
|
||||||
[package]
|
[package]
|
||||||
name = "speech-dispatcher"
|
name = "speech-dispatcher"
|
||||||
version = "0.14.0"
|
version = "0.16.0"
|
||||||
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
|
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
|
||||||
repository = "https://gitlab.com/ndarilek/speech-dispatcher-rs"
|
repository = "https://dev.thewordnerd.info/nolan/speech-dispatcher-rs"
|
||||||
description = "Rusty interface to the speech-dispatcher speech synthesis library"
|
description = "Rusty interface to the speech-dispatcher speech synthesis library"
|
||||||
license = "LGPL-2.1 OR MIT OR Apache-2.0"
|
license = "LGPL-2.1 OR MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
0_10_2 = ["0_10"]
|
0_11 = ["0_10"]
|
||||||
0_10 = []
|
0_10 = []
|
||||||
default = ["0_10_2"]
|
0_9 = []
|
||||||
|
default = ["0_11"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
speech-dispatcher-sys = { version = "0.7", path = "../speech-dispatcher-sys" }
|
speech-dispatcher-sys = { version = "0.7", path = "../speech-dispatcher-sys" }
|
||||||
|
libc = "0.2.125"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
no-default-features = true
|
no-default-features = true
|
||||||
|
features = ["0_9"]
|
||||||
|
|
||||||
|
[package.metadata.release]
|
||||||
|
tag-prefix = ""
|
||||||
|
publish = false
|
||||||
|
push = false
|
||||||
|
pre-release-hook = ["git-cliff", "-o", "CHANGELOG.md", "--tag", "{{version}}"]
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#![allow(non_upper_case_globals)]
|
#![allow(non_upper_case_globals)]
|
||||||
|
|
||||||
|
use libc::size_t;
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
ffi::{CStr, CString},
|
ffi::{CStr, CString},
|
||||||
|
@ -122,12 +123,12 @@ fn c_int_to_result(r: c_int) -> Result<(), Error> {
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct Callbacks {
|
struct Callbacks {
|
||||||
begin: Option<Box<dyn FnMut(u64, u64)>>,
|
begin: Option<Box<dyn FnMut(size_t, size_t)>>,
|
||||||
end: Option<Box<dyn FnMut(u64, u64)>>,
|
end: Option<Box<dyn FnMut(size_t, size_t)>>,
|
||||||
index_mark: Option<Box<dyn FnMut(u64, u64, String)>>,
|
index_mark: Option<Box<dyn FnMut(size_t, size_t, String)>>,
|
||||||
cancel: Option<Box<dyn FnMut(u64, u64)>>,
|
cancel: Option<Box<dyn FnMut(size_t, size_t)>>,
|
||||||
pause: Option<Box<dyn FnMut(u64, u64)>>,
|
pause: Option<Box<dyn FnMut(size_t, size_t)>>,
|
||||||
resume: Option<Box<dyn FnMut(u64, u64)>>,
|
resume: Option<Box<dyn FnMut(size_t, size_t)>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl Send for Callbacks {}
|
unsafe impl Send for Callbacks {}
|
||||||
|
@ -135,13 +136,13 @@ unsafe impl Send for Callbacks {}
|
||||||
unsafe impl Sync for Callbacks {}
|
unsafe impl Sync for Callbacks {}
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref callbacks: Mutex<HashMap<u64, Callbacks>> = {
|
static ref callbacks: Mutex<HashMap<size_t, Callbacks>> = {
|
||||||
let m = HashMap::new();
|
let m = HashMap::new();
|
||||||
Mutex::new(m)
|
Mutex::new(m)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn cb(msg_id: u64, client_id: u64, state: u32) {
|
unsafe extern "C" fn cb(msg_id: size_t, client_id: size_t, state: u32) {
|
||||||
let state = match state {
|
let state = match state {
|
||||||
SPDNotificationType_SPD_EVENT_BEGIN => Notification::Begin,
|
SPDNotificationType_SPD_EVENT_BEGIN => Notification::Begin,
|
||||||
SPDNotificationType_SPD_EVENT_END => Notification::End,
|
SPDNotificationType_SPD_EVENT_END => Notification::End,
|
||||||
|
@ -165,7 +166,7 @@ unsafe extern "C" fn cb(msg_id: u64, client_id: u64, state: u32) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn cb_im(msg_id: u64, client_id: u64, state: u32, index_mark: *mut c_char) {
|
unsafe extern "C" fn cb_im(msg_id: size_t, client_id: size_t, state: u32, index_mark: *mut c_char) {
|
||||||
let index_mark = CStr::from_ptr(index_mark);
|
let index_mark = CStr::from_ptr(index_mark);
|
||||||
let index_mark = index_mark.to_string_lossy().to_string();
|
let index_mark = index_mark.to_string_lossy().to_string();
|
||||||
let state = match state {
|
let state = match state {
|
||||||
|
@ -205,7 +206,7 @@ impl fmt::Display for Error {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Connection(pub Arc<*mut SPDConnection>, u64);
|
pub struct Connection(pub Arc<*mut SPDConnection>, size_t);
|
||||||
|
|
||||||
impl Connection {
|
impl Connection {
|
||||||
pub fn open<S: Into<String>>(
|
pub fn open<S: Into<String>>(
|
||||||
|
@ -287,7 +288,7 @@ impl Connection {
|
||||||
if let Some(client_id) = client_id {
|
if let Some(client_id) = client_id {
|
||||||
let client_id: Vec<&str> = client_id.split("-").collect();
|
let client_id: Vec<&str> = client_id.split("-").collect();
|
||||||
if let Some(client_id) = client_id.get(1) {
|
if let Some(client_id) = client_id.get(1) {
|
||||||
if let Ok(client_id) = client_id.parse::<u64>() {
|
if let Ok(client_id) = client_id.parse::<size_t>() {
|
||||||
self.1 = client_id;
|
self.1 = client_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -413,26 +414,26 @@ impl Connection {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_voice_type(&self, voice_type: VoiceType) -> Result<(), Error> {
|
pub fn set_voice_type(&self, voice_type: VoiceType) -> Result<(), Error> {
|
||||||
#[cfg(all(feature = "0_10", not(feature = "0_10_2")))]
|
#[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 i32) };
|
|
||||||
#[cfg(any(feature = "0_10_2", not(feature = "0_10")))]
|
|
||||||
let v = unsafe { spd_set_voice_type(*self.0, voice_type as u32) };
|
let v = unsafe { spd_set_voice_type(*self.0, voice_type as u32) };
|
||||||
|
#[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)
|
c_int_to_result(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_voice_type_all(&self, voice_type: VoiceType) -> Result<(), Error> {
|
pub fn set_voice_type_all(&self, voice_type: VoiceType) -> Result<(), Error> {
|
||||||
#[cfg(all(feature = "0_10", not(feature = "0_10_2")))]
|
#[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 i32) };
|
|
||||||
#[cfg(any(feature = "0_10_2", not(feature = "0_10")))]
|
|
||||||
let v = unsafe { spd_set_voice_type_all(*self.0, voice_type as u32) };
|
let v = unsafe { spd_set_voice_type_all(*self.0, voice_type as u32) };
|
||||||
|
#[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)
|
c_int_to_result(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_voice_type_uid(&self, voice_type: VoiceType, target_uid: u32) -> Result<(), Error> {
|
pub fn set_voice_type_uid(&self, voice_type: VoiceType, target_uid: u32) -> Result<(), Error> {
|
||||||
#[cfg(all(feature = "0_10", not(feature = "0_10_2")))]
|
#[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 i32, target_uid) };
|
|
||||||
#[cfg(any(feature = "0_10_2", not(feature = "0_10")))]
|
|
||||||
let v = unsafe { spd_set_voice_type_uid(*self.0, voice_type as u32, target_uid) };
|
let v = unsafe { spd_set_voice_type_uid(*self.0, voice_type as u32, target_uid) };
|
||||||
|
#[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)
|
c_int_to_result(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,7 +694,7 @@ impl Connection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_begin(&self, f: Option<Box<dyn FnMut(u64, u64)>>) {
|
pub fn on_begin(&self, f: Option<Box<dyn FnMut(size_t, size_t)>>) {
|
||||||
if let Ok(mut cbs) = callbacks.lock() {
|
if let Ok(mut cbs) = callbacks.lock() {
|
||||||
let cb = cbs.get_mut(&self.1);
|
let cb = cbs.get_mut(&self.1);
|
||||||
if let Some(cb) = cb {
|
if let Some(cb) = cb {
|
||||||
|
@ -702,7 +703,7 @@ impl Connection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_end(&self, f: Option<Box<dyn FnMut(u64, u64)>>) {
|
pub fn on_end(&self, f: Option<Box<dyn FnMut(size_t, size_t)>>) {
|
||||||
if let Ok(mut cbs) = callbacks.lock() {
|
if let Ok(mut cbs) = callbacks.lock() {
|
||||||
let cb = cbs.get_mut(&self.1);
|
let cb = cbs.get_mut(&self.1);
|
||||||
if let Some(cb) = cb {
|
if let Some(cb) = cb {
|
||||||
|
@ -711,7 +712,7 @@ impl Connection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_cancel(&self, f: Option<Box<dyn FnMut(u64, u64)>>) {
|
pub fn on_cancel(&self, f: Option<Box<dyn FnMut(size_t, size_t)>>) {
|
||||||
if let Ok(mut cbs) = callbacks.lock() {
|
if let Ok(mut cbs) = callbacks.lock() {
|
||||||
let cb = cbs.get_mut(&self.1);
|
let cb = cbs.get_mut(&self.1);
|
||||||
if let Some(cb) = cb {
|
if let Some(cb) = cb {
|
||||||
|
@ -720,7 +721,7 @@ impl Connection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_pause(&self, f: Option<Box<dyn FnMut(u64, u64)>>) {
|
pub fn on_pause(&self, f: Option<Box<dyn FnMut(size_t, size_t)>>) {
|
||||||
if let Ok(mut cbs) = callbacks.lock() {
|
if let Ok(mut cbs) = callbacks.lock() {
|
||||||
let cb = cbs.get_mut(&self.1);
|
let cb = cbs.get_mut(&self.1);
|
||||||
if let Some(cb) = cb {
|
if let Some(cb) = cb {
|
||||||
|
@ -729,7 +730,7 @@ impl Connection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_resume(&self, f: Option<Box<dyn FnMut(u64, u64)>>) {
|
pub fn on_resume(&self, f: Option<Box<dyn FnMut(size_t, size_t)>>) {
|
||||||
if let Ok(mut cbs) = callbacks.lock() {
|
if let Ok(mut cbs) = callbacks.lock() {
|
||||||
let cb = cbs.get_mut(&self.1);
|
let cb = cbs.get_mut(&self.1);
|
||||||
if let Some(cb) = cb {
|
if let Some(cb) = cb {
|
||||||
|
@ -738,7 +739,7 @@ impl Connection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_index_mark(&self, f: Option<Box<dyn FnMut(u64, u64, String)>>) {
|
pub fn on_index_mark(&self, f: Option<Box<dyn FnMut(size_t, size_t, String)>>) {
|
||||||
if let Ok(mut cbs) = callbacks.lock() {
|
if let Ok(mut cbs) = callbacks.lock() {
|
||||||
let cb = cbs.get_mut(&self.1);
|
let cb = cbs.get_mut(&self.1);
|
||||||
if let Some(cb) = cb {
|
if let Some(cb) = cb {
|
||||||
|
@ -784,7 +785,7 @@ impl Connection {
|
||||||
Ok(modules)
|
Ok(modules)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn client_id(&self) -> u64 {
|
pub fn client_id(&self) -> size_t {
|
||||||
self.1
|
self.1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue