diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f53a0d6..911d343 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9404d8a..d49d480 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/Cargo.toml b/Cargo.toml index 7afb5e7..fc20fe3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tts" -version = "0.6.2" +version = "0.6.3" authors = ["Nolan Darilek "] repository = "https://github.com/ndarilek/tts-rs" description = "High-level Text-To-Speech (TTS) interface" diff --git a/build.rs b/build.rs index eb44096..1aa98d1 100644 --- a/build.rs +++ b/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 or the MIT license -// , 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"); + } } } diff --git a/src/backends/tolk.rs b/src/backends/tolk.rs index e6d0f07..a1e8301 100644 --- a/src/backends/tolk.rs +++ b/src/backends/tolk.rs @@ -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(()) }