Compare commits

...

58 Commits

Author SHA1 Message Date
Nolan Darilek 1df00952e4 Update repositories and remove Gitlab CI configuration.
continuous-integration/drone/push Build is passing Details
2022-11-22 14:07:10 -06:00
Nolan Darilek db43d95cf7 Fix indentation.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-11-22 13:59:51 -06:00
Nolan Darilek 89fcced31e Update CI build configuration. 2022-11-22 13:55:55 -06:00
Nolan Darilek 1c11f279ec Bump version and use correct features in docs.rs builds. 2022-11-22 13:52:19 -06:00
Nolan Darilek f854e386a6 Re-add support for speech-dispatcher 0.9. 2022-11-22 13:49:54 -06:00
Nolan Darilek 1ba40e898b Merge branch 'master' into 'master'
Fix missing size_t on latest stable

See merge request ndarilek/speech-dispatcher-rs!7
2022-10-19 14:40:39 +00:00
Tait Hoyem bcf7025f14 Fix missing size_t on latest stable 2022-10-16 15:10:24 -06:00
Nolan Darilek 2239c2539a Publish with features compatible for Rust CI image. 2022-09-07 12:13:55 -05:00
Nolan Darilek 2ea85bc1bd Bump version and drop support for 0.9. 2022-09-07 11:43:22 -05:00
Nolan Darilek 0efdccc9aa Merge branch '32bit' into 'master'
Fix msg_id and client_id being size_t in C

Closes #5

See merge request ndarilek/speech-dispatcher-rs!5
2022-09-07 14:53:43 +00:00
Nolan Darilek e770c73e67 Merge branch 'voice_type' into 'master'
Fix voice_type signedness change

Closes #4

See merge request ndarilek/speech-dispatcher-rs!6
2022-09-07 14:48:56 +00:00
Samuel Thibault 8ff6902148 Fix voice_type signedness change
The signedness changed happened in speech-dispatcher 0.11, not in
speech-dispatcher 0.10.2.

Closes #4
2022-09-07 15:54:53 +02:00
Samuel Thibault 29f990e19b Fix msg_id and client_id being size_t in C
instead of u64 which is only valid on 64bit architectures.

Fixes #5
2022-09-07 15:31:10 +02:00
Nolan Darilek 6a6bc3f805 Add Drone/cargo-release/git-cliff configuration. 2022-09-04 09:15:13 -05:00
Nolan Darilek a50a6a4bdd Should now build with default features. 2022-08-29 16:36:33 -05:00
Nolan Darilek d6f9043e60 Add support for speech-dispatcher 0.10.2 and bump version. 2022-08-29 16:29:57 -05:00
Nolan Darilek 4e1b79cb84 Don't build with default features on docs.rs. 2022-06-13 10:17:18 -05:00
Nolan Darilek 8c69d78411 And of course Cargo complains about my feature name only at publication time. Fixed. 2022-03-10 13:27:50 -06:00
Nolan Darilek 0ba2937a8a Update CI since build environment doesn't run a newer speech-dispatcher. 2022-03-10 13:13:19 -06:00
Nolan Darilek be9e4592ec And another... 2022-03-10 13:00:17 -06:00
Nolan Darilek 6aacce2d73 Feature mismatch. 2022-03-10 12:58:56 -06:00
Nolan Darilek bbae5dc983 Add 0.10 feature. 2022-03-10 12:54:53 -06:00
Nolan Darilek c6b90a7a24 Cast values for compatibility with newer speech-dispatcher. 2022-03-10 12:29:27 -06:00
Nolan Darilek ee6aba7a97 Cast to u32. 2022-03-10 12:17:10 -06:00
Nolan Darilek 36f82b78f3 Bump version. 2022-03-10 11:40:18 -06:00
Nolan Darilek 729aaf5255 Soundness fixes for cloning `Connection`. 2022-03-10 11:39:42 -06:00
Nolan Darilek 2618393758 Relicense and bump version. 2022-02-05 09:15:15 -06:00
Nolan Darilek 82090cb48d Bump versions. 2022-01-27 10:29:10 -06:00
Nolan Darilek 3709573305 Use `Voice` directly to avoid messing with stringly-typed voice names. 2022-01-27 10:26:12 -06:00
Nolan Darilek 911e98d9ec Clean up example. 2022-01-27 10:21:53 -06:00
Nolan Darilek 8434bfca64 Bump edition. 2022-01-27 10:06:41 -06:00
Nolan Darilek 0dc9205b36 Merge branch 'lv' into 'master'
Add support for listing voices

See merge request ndarilek/speech-dispatcher-rs!2
2022-01-27 16:01:45 +00:00
Malloc Voidstar 143147036c
Add support for listing voices
Rebased on top of the result changes.
2022-01-10 18:26:02 -08:00
Nolan Darilek 2879284030 Bump version. 2022-01-10 10:31:14 -06:00
Nolan Darilek 5dfc99c6d7 Merge branch 'return-results' into 'master'
Change all bool-returns to Results

See merge request ndarilek/speech-dispatcher-rs!4
2022-01-10 16:26:29 +00:00
Malloc Voidstar 83b1ac5a76
Change SpeechDispatcherError to Error, format
Also lowercase Display strings to be in line with https://rust-lang.github.io/api-guidelines/interoperability.html#examples-of-error-messages
2021-12-06 10:58:29 -08:00
Malloc Voidstar 7d3edccdda
Convert all bool-returns to Results
Additionally:
* Make open2 fallible too
* Use a Result the entire time in open and open2, instead of going from Option to Result
* Specify c_int instead of i32 since apparently the size "may differ on some esoteric systems"; I suspect it won't compile on whatever those are but might as well improve the situation
* Avoid a maybe-possible panic in get_voice_type. Probably can't happen but I'm not 100% certain, so I made it fallible
* Add a missing null check to get_language
2021-12-06 10:57:04 -08:00
Nolan Darilek 91098c0f01 Merge branch 'unused' into 'master'
Remove unused gcc dependency

See merge request ndarilek/speech-dispatcher-rs!3
2021-12-06 15:04:29 +00:00
Malloc Voidstar 675b569b32
Remove unused gcc dependency 2021-12-04 13:50:25 -08:00
Nolan Darilek e0170aa011 Bump version. 2021-12-02 09:11:26 -06:00
Nolan Darilek 3b025dc0f9 Merge branch 'fix-types' into 'master'
Fix build on ARM

See merge request ndarilek/speech-dispatcher-rs!1
2021-12-02 15:09:21 +00:00
Malloc Voidstar 67a8c19410
Fix build on ARM
Differences in signedness were preventing builds.
2021-12-02 05:34:32 -08:00
Nolan Darilek ac12fb132e Bump version. 2021-11-19 08:39:16 -06:00
Nolan Darilek 4c8521ccb8 Add error handling for initialization failure. 2021-11-19 08:38:17 -06:00
Nolan Darilek 006a4835be Eliminate a Clippy warning. 2020-09-26 12:52:10 -05:00
Nolan Darilek 5349a0fc3d Refactor to FnMut and bump version. 2020-09-25 10:36:00 -05:00
Nolan Darilek 7f952f2f34 Specify minimum bindgen version constraint. 2020-09-18 12:06:32 -05:00
Nolan Darilek f71e4b0d19 Bump bindgen and version. 2020-09-18 11:21:39 -05:00
Nolan Darilek 8b28fed8e5 cargo fmt 2020-08-19 21:00:51 -05:00
Nolan Darilek bf348af84f Make client ID easier to get at.
* Pass `client_id` into all callbacks.
* Expose via `client_id()` method.
* Bump version.
2020-08-19 20:59:48 -05:00
Nolan Darilek e022973c8e Update CI. 2020-08-19 19:55:31 -05:00
Nolan Darilek ca2e0ffe5e Upgrades and refactors.
* Bump editions to 2018.
* Bump dependencies and crate versions.
* Implement callbacks.
* Return message IDs when speaking, or `None` in case of errors.
* Add callbacks to example.
2020-08-19 17:28:22 -05:00
Nolan Darilek 0de61beafe Bump dependencies. 2020-05-12 16:11:52 -05:00
Nolan Darilek 0f06715c39 Don't fail the publish step if speech-dispatcher-sys fails. 2019-12-30 09:24:12 -06:00
Nolan Darilek e99da4a1d3 Bump version. 2019-12-30 09:09:43 -06:00
Nolan Darilek 2758f79538 Add defensive handling for speaking empty strings, which appears to crash the client. 2019-12-30 09:09:19 -06:00
Nolan Darilek 369bf23fa9 Clippy, fmt, bump versions, and update repository links. 2019-12-23 08:03:24 -06:00
Nolan Darilek cb02834873 Loosen version requirement. 2019-12-22 13:56:51 -06:00
10 changed files with 831 additions and 361 deletions

27
.drone.yml Normal file
View File

@ -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

View File

@ -1,26 +0,0 @@
image: rust
stages:
- test
- publish
before_script:
- apt-get update
- apt-get install -y libclang-3.9-dev libspeechd-dev
- export CPATH=/usr/lib/llvm-3.9/lib/clang/3.9.1/include/
test:
stage: test
script:
- cargo test
publish:
stage: publish
script:
- cargo login $CARGO_TOKEN
- cargo package --manifest-path speech-dispatcher-sys/Cargo.toml
- cargo publish --manifest-path speech-dispatcher-sys/Cargo.toml
- cargo package --manifest-path speech-dispatcher/Cargo.toml
- cargo publish --manifest-path speech-dispatcher/Cargo.toml
only:
- tags

60
cliff.toml Normal file
View File

@ -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"

View File

@ -1,11 +1,17 @@
[package]
name = "speech-dispatcher-sys"
version = "0.4.1"
version = "0.7.0"
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
repository = "https://gitlab.com/ndarilek/speech-dispatcher-sys"
repository = "https://dev.thewordnerd.info/nolan/speech-dispatcher-rs"
description = "speech-dispatcher system bindings"
license = "LGPL-2.1"
license = "LGPL-2.1 OR MIT OR Apache-2.0"
edition = "2021"
[build-dependencies]
bindgen = "0.52"
gcc = "0.3"
bindgen = ">= 0.54"
[package.metadata.release]
tag-prefix = ""
publish = false
push = false
pre-release-hook = ["git-cliff", "-o", "CHANGELOG.md", "--tag", "{{version}}"]

View File

@ -18,6 +18,7 @@ fn main() {
.constified_enum_module("SPDSpelling")
.use_core()
.layout_tests(false)
.generate().unwrap()
.generate()
.unwrap()
.write_to_file(Path::new(&out_dir).join("speech_dispatcher_sys.rs"));
}

View File

@ -1,10 +1,29 @@
[package]
name = "speech-dispatcher"
version = "0.4.1"
version = "0.16.0"
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"
license = "LGPL-2.1"
license = "LGPL-2.1 OR MIT OR Apache-2.0"
edition = "2021"
[features]
0_11 = ["0_10"]
0_10 = []
0_9 = []
default = ["0_11"]
[dependencies]
speech-dispatcher-sys = { version = "0.4.0", path = "../speech-dispatcher-sys" }
lazy_static = "1"
speech-dispatcher-sys = { version = "0.7", path = "../speech-dispatcher-sys" }
libc = "0.2.125"
[package.metadata.docs.rs]
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}}"]

View File

@ -0,0 +1,42 @@
use speech_dispatcher::*;
use std::io;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let connection = speech_dispatcher::Connection::open(
"hello_world",
"hello_world",
"hello_world",
Mode::Threaded,
)?;
connection.on_begin(Some(Box::new(|msg_id, client_id| {
println!("Beginning {} from {}", msg_id, client_id)
})));
connection.on_end(Some(Box::new(|msg_id, client_id| {
println!("Ending {} from {}", msg_id, client_id)
})));
let connection_clone = connection.clone();
drop(connection);
connection_clone.say(
Priority::Important,
format!(
"Hello, world at rate {} from client {}.",
connection_clone.get_voice_rate(),
connection_clone.client_id()
),
);
connection_clone.set_voice_rate(100)?;
connection_clone.say(Priority::Important, "This is faster.");
connection_clone.set_voice_rate(0)?;
connection_clone.set_spelling(true)?;
connection_clone.say(Priority::Important, "This is spelled.");
connection_clone.set_spelling(false)?;
connection_clone.set_punctuation(Punctuation::All)?;
connection_clone.say(
Priority::Important,
"This statement, unlike others, has punctuation that is spoken!",
);
connection_clone.set_punctuation(Punctuation::None)?;
let mut _input = String::new();
io::stdin().read_line(&mut _input).unwrap();
Ok(())
}

View File

@ -1,17 +1,40 @@
extern crate speech_dispatcher;
use speech_dispatcher::*;
use std::io;
fn main() {
let connection = speech_dispatcher::Connection::open("hello_world", "hello_world", "hello_world", Mode::Single);
connection.say(Priority::Important, format!("Hello, world at rate {}.", connection.get_voice_rate()));
connection.set_voice_rate(100);
fn main() -> Result<(), Box<dyn std::error::Error>> {
let connection = speech_dispatcher::Connection::open(
"hello_world",
"hello_world",
"hello_world",
Mode::Threaded,
)?;
connection.on_begin(Some(Box::new(|msg_id, client_id| {
println!("Beginning {} from {}", msg_id, client_id)
})));
connection.on_end(Some(Box::new(|msg_id, client_id| {
println!("Ending {} from {}", msg_id, client_id)
})));
connection.say(
Priority::Important,
format!(
"Hello, world at rate {} from client {}.",
connection.get_voice_rate(),
connection.client_id()
),
);
connection.set_voice_rate(100)?;
connection.say(Priority::Important, "This is faster.");
connection.set_voice_rate(0);
connection.set_spelling(true);
connection.set_voice_rate(0)?;
connection.set_spelling(true)?;
connection.say(Priority::Important, "This is spelled.");
connection.set_spelling(false);
connection.set_punctuation(Punctuation::All);
connection.say(Priority::Important, "This statement, unlike others, has punctuation that is spoken!");
connection.set_punctuation(Punctuation::None);
connection.set_spelling(false)?;
connection.set_punctuation(Punctuation::All)?;
connection.say(
Priority::Important,
"This statement, unlike others, has punctuation that is spoken!",
);
connection.set_punctuation(Punctuation::None)?;
let mut _input = String::new();
io::stdin().read_line(&mut _input).unwrap();
Ok(())
}

View File

@ -0,0 +1,29 @@
use speech_dispatcher::*;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let connection = Connection::open("list_voices", "list_voices", "list_voices", Mode::Threaded)?;
let modules = connection.list_output_modules()?;
println!("Modules available: {:?}", modules);
for module in modules {
if connection.set_output_module(&module).is_ok() {
println!("Listing voices for module {module}");
} else {
println!("Failed to set output module to {module}");
continue;
};
let voices = connection.list_synthesis_voices()?;
for voice in voices {
if let Some(variant) = voice.variant {
println!(
" Name: {} / Language: {} / Variant: {variant}",
voice.name, voice.language
);
} else {
println!(" Name: {} / Language: {}", voice.name, voice.language);
}
}
}
// Use connection.set_synthesis_voice(voice) to set the voice to use.
Ok(())
}

File diff suppressed because it is too large Load Diff