mirror of https://github.com/ndarilek/tts-rs.git
Merge branch 'develop' into feature/voices
This commit is contained in:
commit
97f1de5724
|
@ -6,7 +6,6 @@ on:
|
||||||
- "v*"
|
- "v*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
build_linux:
|
build_linux:
|
||||||
name: Build Linux
|
name: Build Linux
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -15,6 +14,7 @@ jobs:
|
||||||
- run: |
|
- run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y libspeechd-dev
|
sudo apt-get install -y libspeechd-dev
|
||||||
|
rustup update
|
||||||
cargo build --release
|
cargo build --release
|
||||||
rustup target add wasm32-unknown-unknown
|
rustup target add wasm32-unknown-unknown
|
||||||
cargo build --release --target wasm32-unknown-unknown
|
cargo build --release --target wasm32-unknown-unknown
|
||||||
|
@ -26,6 +26,7 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: |
|
- run: |
|
||||||
choco install -y llvm
|
choco install -y llvm
|
||||||
|
rustup update
|
||||||
cargo build --release
|
cargo build --release
|
||||||
|
|
||||||
build_macos:
|
build_macos:
|
||||||
|
@ -34,7 +35,16 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: |
|
- run: |
|
||||||
|
rustup update
|
||||||
cargo build --release
|
cargo build --release
|
||||||
|
|
||||||
|
build_ios:
|
||||||
|
name: Build iOS
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: |
|
||||||
|
rustup update
|
||||||
rustup target add aarch64-apple-ios x86_64-apple-ios
|
rustup target add aarch64-apple-ios x86_64-apple-ios
|
||||||
cargo install cargo-lipo
|
cargo install cargo-lipo
|
||||||
cargo lipo --release
|
cargo lipo --release
|
||||||
|
@ -49,6 +59,7 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: |
|
- run: |
|
||||||
choco install -y llvm
|
choco install -y llvm
|
||||||
|
rustup update
|
||||||
cargo login $CARGO_TOKEN
|
cargo login $CARGO_TOKEN
|
||||||
cd winrt_bindings
|
cd winrt_bindings
|
||||||
cargo package
|
cargo package
|
||||||
|
@ -57,7 +68,7 @@ jobs:
|
||||||
publish:
|
publish:
|
||||||
name: Publish
|
name: Publish
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build_linux, build_windows, build_macos]
|
needs: [build_linux, build_windows, build_macos, build_ios]
|
||||||
env:
|
env:
|
||||||
CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }}
|
CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }}
|
||||||
steps:
|
steps:
|
||||||
|
@ -65,5 +76,6 @@ jobs:
|
||||||
- run: |
|
- run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y libspeechd-dev
|
sudo apt-get install -y libspeechd-dev
|
||||||
|
rustup update
|
||||||
cargo login $CARGO_TOKEN
|
cargo login $CARGO_TOKEN
|
||||||
cargo publish
|
cargo publish
|
||||||
|
|
|
@ -5,7 +5,6 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
build_linux:
|
build_linux:
|
||||||
name: Build Linux
|
name: Build Linux
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -14,6 +13,7 @@ jobs:
|
||||||
- run: |
|
- run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y libspeechd-dev
|
sudo apt-get install -y libspeechd-dev
|
||||||
|
rustup update
|
||||||
cargo build --release
|
cargo build --release
|
||||||
rustup target add wasm32-unknown-unknown
|
rustup target add wasm32-unknown-unknown
|
||||||
cargo build --release --target wasm32-unknown-unknown
|
cargo build --release --target wasm32-unknown-unknown
|
||||||
|
@ -25,6 +25,7 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: |
|
- run: |
|
||||||
choco install -y llvm
|
choco install -y llvm
|
||||||
|
rustup update
|
||||||
cargo build --release
|
cargo build --release
|
||||||
|
|
||||||
build_macos:
|
build_macos:
|
||||||
|
@ -33,7 +34,16 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: |
|
- run: |
|
||||||
|
rustup update
|
||||||
cargo build --release
|
cargo build --release
|
||||||
|
|
||||||
|
build_ios:
|
||||||
|
name: Build iOS
|
||||||
|
runs-on: macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: |
|
||||||
|
rustup update
|
||||||
rustup target add aarch64-apple-ios x86_64-apple-ios
|
rustup target add aarch64-apple-ios x86_64-apple-ios
|
||||||
cargo install cargo-lipo
|
cargo install cargo-lipo
|
||||||
cargo lipo --release
|
cargo lipo --release
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "tts"
|
name = "tts"
|
||||||
version = "0.6.2"
|
version = "0.6.3"
|
||||||
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
|
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
|
||||||
repository = "https://github.com/ndarilek/tts-rs"
|
repository = "https://github.com/ndarilek/tts-rs"
|
||||||
description = "High-level Text-To-Speech (TTS) interface"
|
description = "High-level Text-To-Speech (TTS) interface"
|
||||||
|
|
13
build.rs
13
build.rs
|
@ -1,15 +1,8 @@
|
||||||
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
if std::env::var("TARGET").unwrap().contains("-apple") {
|
if std::env::var("TARGET").unwrap().contains("-apple") {
|
||||||
println!("cargo:rustc-link-lib=framework=AppKit");
|
|
||||||
println!("cargo:rustc-link-lib=framework=AVFoundation");
|
println!("cargo:rustc-link-lib=framework=AVFoundation");
|
||||||
|
if !std::env::var("CARGO_CFG_TARGET_OS").unwrap().contains("ios") {
|
||||||
|
println!("cargo:rustc-link-lib=framework=AppKit");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,25 @@ impl Backend for Tolk {
|
||||||
|
|
||||||
fn speak(&mut self, text: &str, interrupt: bool) -> Result<(), Error> {
|
fn speak(&mut self, text: &str, interrupt: bool) -> Result<(), Error> {
|
||||||
trace!("speak({}, {})", text, interrupt);
|
trace!("speak({}, {})", text, interrupt);
|
||||||
self.0.speak(text, interrupt);
|
const BUFFER_LENGTH: usize = 300;
|
||||||
|
if text.len() <= BUFFER_LENGTH {
|
||||||
|
self.0.speak(text, interrupt);
|
||||||
|
} else {
|
||||||
|
if interrupt {
|
||||||
|
self.stop()?;
|
||||||
|
}
|
||||||
|
let tokens = text.split_whitespace();
|
||||||
|
let mut buffer = String::new();
|
||||||
|
for token in tokens {
|
||||||
|
if buffer.len() + token.len() > BUFFER_LENGTH {
|
||||||
|
self.0.speak(buffer, false);
|
||||||
|
buffer = String::new();
|
||||||
|
} else {
|
||||||
|
buffer.push_str(token);
|
||||||
|
buffer.push(' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue