1
0
mirror of https://github.com/ndarilek/tts-rs.git synced 2024-11-17 12:19:37 +00:00

Merge branch 'develop' into feature/voices

This commit is contained in:
François Caddet 2020-09-05 12:27:19 +02:00
commit 97f1de5724
5 changed files with 48 additions and 15 deletions

View File

@ -6,7 +6,6 @@ on:
- "v*"
jobs:
build_linux:
name: Build Linux
runs-on: ubuntu-latest
@ -15,6 +14,7 @@ jobs:
- run: |
sudo apt-get update
sudo apt-get install -y libspeechd-dev
rustup update
cargo build --release
rustup target add wasm32-unknown-unknown
cargo build --release --target wasm32-unknown-unknown
@ -26,6 +26,7 @@ jobs:
- uses: actions/checkout@v2
- run: |
choco install -y llvm
rustup update
cargo build --release
build_macos:
@ -34,7 +35,16 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: |
rustup update
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
cargo install cargo-lipo
cargo lipo --release
@ -49,6 +59,7 @@ jobs:
- uses: actions/checkout@v2
- run: |
choco install -y llvm
rustup update
cargo login $CARGO_TOKEN
cd winrt_bindings
cargo package
@ -57,7 +68,7 @@ jobs:
publish:
name: Publish
runs-on: ubuntu-latest
needs: [build_linux, build_windows, build_macos]
needs: [build_linux, build_windows, build_macos, build_ios]
env:
CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }}
steps:
@ -65,5 +76,6 @@ jobs:
- run: |
sudo apt-get update
sudo apt-get install -y libspeechd-dev
rustup update
cargo login $CARGO_TOKEN
cargo publish

View File

@ -5,7 +5,6 @@ on:
pull_request:
jobs:
build_linux:
name: Build Linux
runs-on: ubuntu-latest
@ -14,6 +13,7 @@ jobs:
- run: |
sudo apt-get update
sudo apt-get install -y libspeechd-dev
rustup update
cargo build --release
rustup target add wasm32-unknown-unknown
cargo build --release --target wasm32-unknown-unknown
@ -25,6 +25,7 @@ jobs:
- uses: actions/checkout@v2
- run: |
choco install -y llvm
rustup update
cargo build --release
build_macos:
@ -33,7 +34,16 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: |
rustup update
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
cargo install cargo-lipo
cargo lipo --release

View File

@ -1,6 +1,6 @@
[package]
name = "tts"
version = "0.6.2"
version = "0.6.3"
authors = ["Nolan Darilek <nolan@thewordnerd.info>"]
repository = "https://github.com/ndarilek/tts-rs"
description = "High-level Text-To-Speech (TTS) interface"

View File

@ -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() {
if std::env::var("TARGET").unwrap().contains("-apple") {
println!("cargo:rustc-link-lib=framework=AppKit");
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");
}
}
}

View File

@ -28,7 +28,25 @@ impl Backend for Tolk {
fn speak(&mut self, text: &str, interrupt: bool) -> Result<(), Error> {
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(())
}