正在显示
133 个修改的文件
包含
6682 行增加
和
139 行删除
.github/workflows/flutter-android.yaml
0 → 100644
| 1 | +name: flutter-android | ||
| 2 | + | ||
| 3 | +on: | ||
| 4 | + push: | ||
| 5 | + branches: | ||
| 6 | + - flutter | ||
| 7 | + tags: | ||
| 8 | + - 'v[0-9]+.[0-9]+.[0-9]+*' | ||
| 9 | + | ||
| 10 | + workflow_dispatch: | ||
| 11 | + | ||
| 12 | +concurrency: | ||
| 13 | + group: flutter-android-${{ github.ref }} | ||
| 14 | + cancel-in-progress: true | ||
| 15 | + | ||
| 16 | +jobs: | ||
| 17 | + tts: | ||
| 18 | + name: tts ${{ matrix.index }}/${{ matrix.total }} | ||
| 19 | + runs-on: ${{ matrix.os }} | ||
| 20 | + strategy: | ||
| 21 | + fail-fast: false | ||
| 22 | + matrix: | ||
| 23 | + os: [ubuntu-latest] | ||
| 24 | + total: ["15"] | ||
| 25 | + index: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"] | ||
| 26 | + | ||
| 27 | + steps: | ||
| 28 | + - uses: actions/checkout@v4 | ||
| 29 | + with: | ||
| 30 | + fetch-depth: 0 | ||
| 31 | + | ||
| 32 | + - name: Display NDK HOME | ||
| 33 | + shell: bash | ||
| 34 | + run: | | ||
| 35 | + echo "ANDROID_NDK_LATEST_HOME: ${ANDROID_NDK_LATEST_HOME}" | ||
| 36 | + ls -lh ${ANDROID_NDK_LATEST_HOME} | ||
| 37 | + | ||
| 38 | + - name: Setup build tool version variable | ||
| 39 | + shell: bash | ||
| 40 | + run: | | ||
| 41 | + echo "---" | ||
| 42 | + ls -lh /usr/local/lib/android/ | ||
| 43 | + echo "---" | ||
| 44 | + | ||
| 45 | + ls -lh /usr/local/lib/android/sdk | ||
| 46 | + echo "---" | ||
| 47 | + | ||
| 48 | + ls -lh /usr/local/lib/android/sdk/build-tools | ||
| 49 | + echo "---" | ||
| 50 | + | ||
| 51 | + BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1) | ||
| 52 | + echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV | ||
| 53 | + echo "Last build tool version is: $BUILD_TOOL_VERSION" | ||
| 54 | + | ||
| 55 | + - name: Install Python dependencies | ||
| 56 | + shell: bash | ||
| 57 | + run: | | ||
| 58 | + python3 -m pip install --upgrade pip jinja2 iso639-lang | ||
| 59 | + | ||
| 60 | + - name: Install deps | ||
| 61 | + shell: bash | ||
| 62 | + run: | | ||
| 63 | + sudo apt-get update -y | ||
| 64 | + sudo apt-get install -y build-essential jq git cmake | ||
| 65 | + sudo apt-get install -y curl | ||
| 66 | + | ||
| 67 | + - name: Setup Flutter SDK | ||
| 68 | + uses: flutter-actions/setup-flutter@v3 | ||
| 69 | + with: | ||
| 70 | + channel: stable | ||
| 71 | + version: latest | ||
| 72 | + | ||
| 73 | + - name: Install ninja | ||
| 74 | + shell: bash | ||
| 75 | + run: | | ||
| 76 | + sudo apt-get install -y ninja-build | ||
| 77 | + | ||
| 78 | + - name: Display ninja version | ||
| 79 | + shell: bash | ||
| 80 | + run: | | ||
| 81 | + ninja --version | ||
| 82 | + ninja --help || true | ||
| 83 | + which ninja | ||
| 84 | + | ||
| 85 | + - name: Display PWD | ||
| 86 | + shell: bash | ||
| 87 | + run: | | ||
| 88 | + echo "pwd: $PWD" | ||
| 89 | + ls -lh | ||
| 90 | + | ||
| 91 | + - name: Display machine info | ||
| 92 | + shell: bash | ||
| 93 | + run: | | ||
| 94 | + uname -a | ||
| 95 | + | ||
| 96 | + - name: Display flutter info | ||
| 97 | + shell: bash | ||
| 98 | + run: | | ||
| 99 | + which flutter | ||
| 100 | + which dart | ||
| 101 | + | ||
| 102 | + flutter --version | ||
| 103 | + | ||
| 104 | + git config --global --add safe.directory /__t/flutter-Linux-*/flutter || true | ||
| 105 | + | ||
| 106 | + flutter --version | ||
| 107 | + | ||
| 108 | + dart --version | ||
| 109 | + flutter doctor | ||
| 110 | + | ||
| 111 | + - name: Install libgtk-3-dev | ||
| 112 | + shell: bash | ||
| 113 | + run: | | ||
| 114 | + sudo apt install -y libgtk-3-dev tree clang pkg-config | ||
| 115 | + | ||
| 116 | + - name: Display flutter info (2) | ||
| 117 | + shell: bash | ||
| 118 | + run: | | ||
| 119 | + which flutter | ||
| 120 | + which dart | ||
| 121 | + | ||
| 122 | + flutter --version | ||
| 123 | + dart --version | ||
| 124 | + flutter doctor | ||
| 125 | + | ||
| 126 | + cd .. | ||
| 127 | + | ||
| 128 | + - name: Build flutter | ||
| 129 | + shell: bash | ||
| 130 | + run: | | ||
| 131 | + cd scripts/flutter | ||
| 132 | + | ||
| 133 | + total=${{ matrix.total }} | ||
| 134 | + index=${{ matrix.index }} | ||
| 135 | + | ||
| 136 | + ./generate-tts.py --total $total --index $index | ||
| 137 | + | ||
| 138 | + chmod +x *.sh | ||
| 139 | + ./build-android-tts.sh | ||
| 140 | + | ||
| 141 | + cd ../../ | ||
| 142 | + | ||
| 143 | + ls -lh *.apk | ||
| 144 | + | ||
| 145 | + - name: Display generated files | ||
| 146 | + shell: bash | ||
| 147 | + run: | | ||
| 148 | + ls -lh *.apk | ||
| 149 | + | ||
| 150 | + mkdir apks | ||
| 151 | + | ||
| 152 | + mv -v *.apk ./apks | ||
| 153 | + | ||
| 154 | + # https://github.com/marketplace/actions/sign-android-release | ||
| 155 | + - uses: r0adkll/sign-android-release@v1 | ||
| 156 | + name: Sign app APK | ||
| 157 | + with: | ||
| 158 | + releaseDirectory: ./apks | ||
| 159 | + signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }} | ||
| 160 | + alias: ${{ secrets.ANDROID_SIGNING_KEY_ALIAS }} | ||
| 161 | + keyStorePassword: ${{ secrets.ANDROID_SIGNING_KEY_STORE_PASSWORD }} | ||
| 162 | + env: | ||
| 163 | + BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }} | ||
| 164 | + | ||
| 165 | + - name: Display APK after signing | ||
| 166 | + shell: bash | ||
| 167 | + run: | | ||
| 168 | + ls -lh ./apks/ | ||
| 169 | + du -h -d1 . | ||
| 170 | + | ||
| 171 | + - name: Rename APK after signing | ||
| 172 | + shell: bash | ||
| 173 | + run: | | ||
| 174 | + cd apks | ||
| 175 | + rm -fv signingKey.jks | ||
| 176 | + rm -fv *.apk.idsig | ||
| 177 | + rm -fv *-aligned.apk | ||
| 178 | + | ||
| 179 | + all_apks=$(ls -1 *-signed.apk) | ||
| 180 | + echo "----" | ||
| 181 | + echo $all_apks | ||
| 182 | + echo "----" | ||
| 183 | + for apk in ${all_apks[@]}; do | ||
| 184 | + n=$(echo $apk | sed -e s/-signed//) | ||
| 185 | + mv -v $apk $n | ||
| 186 | + done | ||
| 187 | + | ||
| 188 | + cd .. | ||
| 189 | + | ||
| 190 | + ls -lh ./apks/ | ||
| 191 | + du -h -d1 . | ||
| 192 | + | ||
| 193 | + - name: Display APK after rename | ||
| 194 | + shell: bash | ||
| 195 | + run: | | ||
| 196 | + ls -lh ./apks/ | ||
| 197 | + du -h -d1 . | ||
| 198 | + | ||
| 199 | + - name: Publish to huggingface | ||
| 200 | + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' || github.repository_owner == 'csu-fangjun') && ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') || contains(github.ref, 'refs/tags/')) | ||
| 201 | + env: | ||
| 202 | + HF_TOKEN: ${{ secrets.HF_TOKEN }} | ||
| 203 | + uses: nick-fields/retry@v3 | ||
| 204 | + with: | ||
| 205 | + max_attempts: 20 | ||
| 206 | + timeout_seconds: 200 | ||
| 207 | + shell: bash | ||
| 208 | + command: | | ||
| 209 | + git config --global user.email "csukuangfj@gmail.com" | ||
| 210 | + git config --global user.name "Fangjun Kuang" | ||
| 211 | + | ||
| 212 | + rm -rf huggingface | ||
| 213 | + export GIT_LFS_SKIP_SMUDGE=1 | ||
| 214 | + export GIT_CLONE_PROTECTION_ACTIVE=false | ||
| 215 | + | ||
| 216 | + SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | ||
| 217 | + echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION" | ||
| 218 | + | ||
| 219 | + git clone https://huggingface.co/csukuangfj/sherpa-onnx-flutter huggingface | ||
| 220 | + cd huggingface | ||
| 221 | + git fetch | ||
| 222 | + git pull | ||
| 223 | + git merge -m "merge remote" --ff origin main | ||
| 224 | + | ||
| 225 | + dst=flutter/tts/android/$SHERPA_ONNX_VERSION | ||
| 226 | + mkdir -p $dst | ||
| 227 | + | ||
| 228 | + cp -v ../apks/*.apk $dst | ||
| 229 | + | ||
| 230 | + git status | ||
| 231 | + git lfs track "*.apk" | ||
| 232 | + git add . | ||
| 233 | + git commit -m "add more files" | ||
| 234 | + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-flutter main |
| @@ -6,23 +6,6 @@ on: | @@ -6,23 +6,6 @@ on: | ||
| 6 | - flutter | 6 | - flutter |
| 7 | tags: | 7 | tags: |
| 8 | - 'v[0-9]+.[0-9]+.[0-9]+*' | 8 | - 'v[0-9]+.[0-9]+.[0-9]+*' |
| 9 | - paths: | ||
| 10 | - - '.github/workflows/flutter-linux.yaml' | ||
| 11 | - - 'CMakeLists.txt' | ||
| 12 | - - 'cmake/**' | ||
| 13 | - - 'sherpa-onnx/csrc/*' | ||
| 14 | - - 'sherpa-onnx/c-api/*' | ||
| 15 | - - 'sherpa-onnx/flutter/**' | ||
| 16 | - pull_request: | ||
| 17 | - branches: | ||
| 18 | - - master | ||
| 19 | - paths: | ||
| 20 | - - '.github/workflows/flutter-linux.yaml' | ||
| 21 | - - 'CMakeLists.txt' | ||
| 22 | - - 'cmake/**' | ||
| 23 | - - 'sherpa-onnx/csrc/*' | ||
| 24 | - - 'sherpa-onnx/c-api/*' | ||
| 25 | - - 'sherpa-onnx/flutter/**' | ||
| 26 | 9 | ||
| 27 | workflow_dispatch: | 10 | workflow_dispatch: |
| 28 | 11 | ||
| @@ -30,19 +13,26 @@ concurrency: | @@ -30,19 +13,26 @@ concurrency: | ||
| 30 | group: flutter-linux-${{ github.ref }} | 13 | group: flutter-linux-${{ github.ref }} |
| 31 | cancel-in-progress: true | 14 | cancel-in-progress: true |
| 32 | 15 | ||
| 16 | +# See https://github.com/actions/checkout/issues/1590#issuecomment-2207052044 | ||
| 17 | +# and | ||
| 18 | +# https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/ | ||
| 19 | +env: | ||
| 20 | + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | ||
| 21 | + | ||
| 33 | jobs: | 22 | jobs: |
| 34 | - flutter_linux: | ||
| 35 | - if: false | ||
| 36 | - name: linux | 23 | + tts: |
| 24 | + name: tts ${{ matrix.index }}/${{ matrix.total }} | ||
| 37 | runs-on: ${{ matrix.os }} | 25 | runs-on: ${{ matrix.os }} |
| 38 | container: ubuntu:18.04 | 26 | container: ubuntu:18.04 |
| 39 | strategy: | 27 | strategy: |
| 40 | fail-fast: false | 28 | fail-fast: false |
| 41 | matrix: | 29 | matrix: |
| 42 | os: [ubuntu-latest] | 30 | os: [ubuntu-latest] |
| 31 | + total: ["20"] | ||
| 32 | + index: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] | ||
| 43 | 33 | ||
| 44 | steps: | 34 | steps: |
| 45 | - - uses: actions/checkout@v2 | 35 | + - uses: actions/checkout@v3 |
| 46 | with: | 36 | with: |
| 47 | fetch-depth: 0 | 37 | fetch-depth: 0 |
| 48 | 38 | ||
| @@ -50,8 +40,98 @@ jobs: | @@ -50,8 +40,98 @@ jobs: | ||
| 50 | shell: bash | 40 | shell: bash |
| 51 | run: | | 41 | run: | |
| 52 | apt-get update -y | 42 | apt-get update -y |
| 53 | - apt-get install -y build-essential jq git cmake | 43 | + apt-get install -y bc curl git |
| 44 | + | ||
| 45 | + - name: Show files | ||
| 46 | + shell: bash | ||
| 47 | + run: | | ||
| 48 | + git config --global --add safe.directory /__w/sherpa-onnx/sherpa-onnx | ||
| 49 | + | ||
| 50 | + ls -lha | ||
| 51 | + | ||
| 52 | + git init | ||
| 53 | + git add . | ||
| 54 | + git config user.name "foo" | ||
| 55 | + git config user.email "bar@g.com" | ||
| 56 | + git commit -m "test" | ||
| 57 | + | ||
| 58 | + - name: Generate tts script | ||
| 59 | + uses: addnab/docker-run-action@v3 | ||
| 60 | + with: | ||
| 61 | + image: quay.io/pypa/manylinux2014_x86_64 | ||
| 62 | + options: | | ||
| 63 | + --volume ${{ github.workspace }}/:/home/runner/work/sherpa-onnx/sherpa-onnx | ||
| 64 | + shell: bash | ||
| 65 | + run: | | ||
| 66 | + uname -a | ||
| 67 | + gcc --version | ||
| 68 | + cmake --version | ||
| 69 | + cat /etc/*release | ||
| 70 | + id | ||
| 71 | + pwd | ||
| 72 | + | ||
| 73 | + find /opt -name "python*" | ||
| 74 | + export PATH=/opt/_internal/cpython-3.8.19/bin:$PATH | ||
| 75 | + python3 --version | ||
| 76 | + python3 -m pip install --upgrade pip jinja2 iso639-lang | ||
| 77 | + | ||
| 78 | + total=${{ matrix.total }} | ||
| 79 | + index=${{ matrix.index }} | ||
| 80 | + | ||
| 81 | + cd /home/runner/work/sherpa-onnx/sherpa-onnx | ||
| 82 | + cd scripts/flutter | ||
| 83 | + ls -lh | ||
| 84 | + echo "---" | ||
| 85 | + python3 ./generate-tts.py --total $total --index $index | ||
| 86 | + chmod +x *.sh | ||
| 87 | + ls -lh | ||
| 88 | + | ||
| 89 | + # Ubuntu 18.04 uses cmake 3.10 by default, but we need cmake >= 3.11 | ||
| 90 | + - name: Install cmake | ||
| 91 | + shell: bash | ||
| 92 | + run: | | ||
| 93 | + # see https://askubuntu.com/questions/355565/how-do-i-install-the-latest-version-of-cmake-from-the-command-line | ||
| 94 | + version=3.28 | ||
| 95 | + build=1 | ||
| 96 | + ## don't modify from here | ||
| 97 | + limit=3.20 | ||
| 98 | + result=$(echo "$version >= $limit" | bc -l) | ||
| 99 | + os=$([ "$result" == 1 ] && echo "linux" || echo "Linux") | ||
| 100 | + mkdir ~/temp | ||
| 101 | + cd ~/temp | ||
| 102 | + curl -SL -O https://cmake.org/files/v$version/cmake-$version.$build-$os-x86_64.sh | ||
| 103 | + mkdir /opt/cmake | ||
| 104 | + sh cmake-$version.$build-$os-x86_64.sh --skip-license --prefix=/opt/cmake | ||
| 105 | + ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake | ||
| 106 | + | ||
| 107 | + echo "/opt/cmake/bin" >> $GITHUB_PATH | ||
| 108 | + | ||
| 109 | + - name: Display cmake version | ||
| 110 | + shell: bash | ||
| 111 | + run: | | ||
| 112 | + cmake --version | ||
| 113 | + which cmake | ||
| 114 | + | ||
| 115 | + - name: Install deps | ||
| 116 | + shell: bash | ||
| 117 | + run: | | ||
| 118 | + apt-get update -y | ||
| 119 | + apt-get install -y build-essential jq git python3-pip | ||
| 54 | apt-get install -y curl | 120 | apt-get install -y curl |
| 121 | + apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libunwind-dev | ||
| 122 | + | ||
| 123 | + - name: Show files | ||
| 124 | + shell: bash | ||
| 125 | + run: | | ||
| 126 | + echo "pwd: $PWD" | ||
| 127 | + ls -lh | ||
| 128 | + echo "---" | ||
| 129 | + ls -lh scripts/flutter | ||
| 130 | + | ||
| 131 | + - name: Install Python dependencies | ||
| 132 | + shell: bash | ||
| 133 | + run: | | ||
| 134 | + python3 -m pip install --upgrade pip jinja2 iso639-lang dataclasses | ||
| 55 | 135 | ||
| 56 | - name: Setup Flutter SDK | 136 | - name: Setup Flutter SDK |
| 57 | uses: flutter-actions/setup-flutter@v3 | 137 | uses: flutter-actions/setup-flutter@v3 |
| @@ -112,112 +192,88 @@ jobs: | @@ -112,112 +192,88 @@ jobs: | ||
| 112 | dart --version | 192 | dart --version |
| 113 | flutter doctor | 193 | flutter doctor |
| 114 | 194 | ||
| 115 | - - name: Build sherpa-onnx | ||
| 116 | - uses: addnab/docker-run-action@v3 | ||
| 117 | - with: | ||
| 118 | - image: quay.io/pypa/manylinux2014_x86_64 | ||
| 119 | - options: | | ||
| 120 | - --volume ${{ github.workspace }}/:/home/runner/work/sherpa-onnx/sherpa-onnx | ||
| 121 | - shell: bash | ||
| 122 | - run: | | ||
| 123 | - uname -a | ||
| 124 | - gcc --version | ||
| 125 | - cmake --version | ||
| 126 | - cat /etc/*release | ||
| 127 | - id | ||
| 128 | - pwd | ||
| 129 | - | ||
| 130 | - cd /home/runner/work/sherpa-onnx/sherpa-onnx | ||
| 131 | - | ||
| 132 | - mkdir build | ||
| 133 | - cd build | ||
| 134 | - | ||
| 135 | - cmake \ | ||
| 136 | - -D BUILD_SHARED_LIBS=ON \ | ||
| 137 | - -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ | ||
| 138 | - -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ | ||
| 139 | - -DBUILD_ESPEAK_NG_EXE=OFF \ | ||
| 140 | - -DSHERPA_ONNX_ENABLE_BINARY=OFF \ | ||
| 141 | - -DCMAKE_INSTALL_PREFIX=./install \ | ||
| 142 | - .. | ||
| 143 | - | ||
| 144 | - make -j2 | ||
| 145 | - make install | ||
| 146 | - | ||
| 147 | - - name: Copy libs | ||
| 148 | - shell: bash | ||
| 149 | - run: | | ||
| 150 | - cp -v build/install/lib/lib* ./sherpa-onnx/flutter/linux/ | ||
| 151 | - | ||
| 152 | - echo "--------------------" | ||
| 153 | - | ||
| 154 | - ls -lh ./sherpa-onnx/flutter/linux/ | ||
| 155 | - | ||
| 156 | - - name: Download model files | ||
| 157 | - shell: bash | ||
| 158 | - run: | | ||
| 159 | - cd sherpa-onnx/flutter | ||
| 160 | - cd example/assets | ||
| 161 | - | ||
| 162 | - curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx | ||
| 163 | - curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 | ||
| 164 | - tar xvf sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 | ||
| 165 | - rm sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 | ||
| 166 | - cd sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 | ||
| 167 | - rm encoder-epoch-99-avg-1.onnx | ||
| 168 | - rm decoder-epoch-99-avg-1.int8.onnx | ||
| 169 | - rm joiner-epoch-99-avg-1.onnx | ||
| 170 | - rm README.md | ||
| 171 | - rm bpe.model | ||
| 172 | - rm bpe.vocab | ||
| 173 | - rm -rf test_wavs | ||
| 174 | - ls -lh | ||
| 175 | cd .. | 195 | cd .. |
| 176 | 196 | ||
| 177 | - name: Build flutter | 197 | - name: Build flutter |
| 178 | shell: bash | 198 | shell: bash |
| 179 | run: | | 199 | run: | |
| 200 | + cd scripts/flutter | ||
| 180 | 201 | ||
| 181 | - d=$PWD | ||
| 182 | - | ||
| 183 | - pushd sherpa-onnx/flutter | ||
| 184 | - dart pub get | ||
| 185 | - | ||
| 186 | - cd example | ||
| 187 | - flutter build linux | ||
| 188 | - | ||
| 189 | - ls -lh build/linux/x64/release/bundle/sherpa_onnx | ||
| 190 | - file build/linux/x64/release/bundle/sherpa_onnx | ||
| 191 | - | ||
| 192 | - tree build/linux/x64/release/bundle/ | ||
| 193 | - cd build/linux/x64/release/ | 202 | + total=${{ matrix.total }} |
| 203 | + index=${{ matrix.index }} | ||
| 194 | 204 | ||
| 195 | - dst=flutter_sherpa_onnx_linux_x64 | ||
| 196 | - mv bundle $dst | 205 | + ./generate-tts.py --total $total --index $index |
| 197 | 206 | ||
| 198 | - pushd $dst/lib | 207 | + chmod +x *.sh |
| 208 | + ./build-linux-tts.sh | ||
| 209 | + cd ../../ | ||
| 210 | + ls -lh *.tar.bz2 | ||
| 199 | 211 | ||
| 200 | - ls -lh | ||
| 201 | - mv -v libonnxruntime.so libonnxruntime.so.1.17.1 | ||
| 202 | - mv -v libpiper_phonemize.so libpiper_phonemize.so.1 | ||
| 203 | - popd | 212 | + - name: Display generated files |
| 213 | + shell: bash | ||
| 214 | + run: | | ||
| 215 | + ls -lh *.tar.bz2 | ||
| 204 | 216 | ||
| 205 | - tar cjfv $dst.tar.bz2 $dst | ||
| 206 | - ls -lh | ||
| 207 | - mv $dst.tar.bz2 $d | ||
| 208 | - popd | 217 | + - uses: actions/upload-artifact@v3 |
| 218 | + with: | ||
| 219 | + name: ${{ matrix.os }}-${{ matrix.total }}-${{ matrix.index }} | ||
| 220 | + path: ./*.tar.bz2 | ||
| 209 | 221 | ||
| 210 | - ls -lh $dst.tar.bz2 | 222 | + tts_upload: |
| 223 | + needs: [tts] | ||
| 224 | + name: tts upload ${{ matrix.index }}/${{ matrix.total }} | ||
| 225 | + runs-on: ${{ matrix.os }} | ||
| 226 | + strategy: | ||
| 227 | + fail-fast: false | ||
| 228 | + matrix: | ||
| 229 | + os: [ubuntu-latest] | ||
| 230 | + total: ["20"] | ||
| 231 | + index: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] | ||
| 232 | + # total: ["1"] | ||
| 233 | + # index: ["0"] | ||
| 211 | 234 | ||
| 212 | - - uses: actions/upload-artifact@v2 | 235 | + steps: |
| 236 | + - uses: actions/checkout@v4 | ||
| 213 | with: | 237 | with: |
| 214 | - name: flutter-sherpa-onnx-linux-x64 | ||
| 215 | - path: ./*.tar.bz2 | 238 | + fetch-depth: 0 |
| 216 | 239 | ||
| 217 | - # - name: Release android libs | ||
| 218 | - # if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/') | ||
| 219 | - # uses: svenstaro/upload-release-action@v2 | ||
| 220 | - # with: | ||
| 221 | - # file_glob: true | ||
| 222 | - # overwrite: true | ||
| 223 | - # file: flutter*.tar.bz2 | 240 | + - name: Retrieve artifact from ubuntu-latest |
| 241 | + uses: actions/download-artifact@v3 | ||
| 242 | + with: | ||
| 243 | + name: ${{ matrix.os }}-${{ matrix.total }}-${{ matrix.index }} | ||
| 244 | + path: /tmp/files/ | ||
| 245 | + | ||
| 246 | + - name: Publish to huggingface | ||
| 247 | + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' || github.repository_owner == 'csu-fangjun') && ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') || contains(github.ref, 'refs/tags/')) | ||
| 248 | + env: | ||
| 249 | + HF_TOKEN: ${{ secrets.HF_TOKEN }} | ||
| 250 | + uses: nick-fields/retry@v3 | ||
| 251 | + with: | ||
| 252 | + max_attempts: 20 | ||
| 253 | + timeout_seconds: 200 | ||
| 254 | + shell: bash | ||
| 255 | + command: | | ||
| 256 | + git config --global user.email "csukuangfj@gmail.com" | ||
| 257 | + git config --global user.name "Fangjun Kuang" | ||
| 258 | + | ||
| 259 | + rm -rf huggingface | ||
| 260 | + export GIT_LFS_SKIP_SMUDGE=1 | ||
| 261 | + export GIT_CLONE_PROTECTION_ACTIVE=false | ||
| 262 | + | ||
| 263 | + SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | ||
| 264 | + echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION" | ||
| 265 | + | ||
| 266 | + git clone https://huggingface.co/csukuangfj/sherpa-onnx-flutter huggingface | ||
| 267 | + cd huggingface | ||
| 268 | + git fetch | ||
| 269 | + git pull | ||
| 270 | + git merge -m "merge remote" --ff origin main | ||
| 271 | + dst=flutter/tts/linux/$SHERPA_ONNX_VERSION | ||
| 272 | + mkdir -p $dst | ||
| 273 | + cp -v /tmp/files/*.tar.bz2 $dst | ||
| 274 | + | ||
| 275 | + git status | ||
| 276 | + git lfs track "*.bz2" | ||
| 277 | + git add . | ||
| 278 | + git commit -m "add more files" | ||
| 279 | + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-flutter main |
| @@ -14,8 +14,8 @@ concurrency: | @@ -14,8 +14,8 @@ concurrency: | ||
| 14 | cancel-in-progress: true | 14 | cancel-in-progress: true |
| 15 | 15 | ||
| 16 | jobs: | 16 | jobs: |
| 17 | - flutter_macos: | ||
| 18 | - name: macos ${{ matrix.arch }} ${{ matrix.index }} | 17 | + asr: |
| 18 | + name: asr ${{ matrix.arch }}/${{ matrix.total }} | ||
| 19 | runs-on: ${{ matrix.os }} | 19 | runs-on: ${{ matrix.os }} |
| 20 | strategy: | 20 | strategy: |
| 21 | fail-fast: false | 21 | fail-fast: false |
| @@ -78,13 +78,119 @@ jobs: | @@ -78,13 +78,119 @@ jobs: | ||
| 78 | cd ../../ | 78 | cd ../../ |
| 79 | ls -lh *.tar.bz2 | 79 | ls -lh *.tar.bz2 |
| 80 | 80 | ||
| 81 | - - uses: actions/upload-artifact@v4 | 81 | + - name: Display generated files |
| 82 | + shell: bash | ||
| 83 | + run: | | ||
| 84 | + ls -lh *.tar.bz2 | ||
| 85 | + | ||
| 86 | + - name: Publish to huggingface | ||
| 87 | + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' || github.repository_owner == 'csu-fangjun') && ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') || contains(github.ref, 'refs/tags/')) | ||
| 88 | + env: | ||
| 89 | + HF_TOKEN: ${{ secrets.HF_TOKEN }} | ||
| 90 | + uses: nick-fields/retry@v3 | ||
| 91 | + with: | ||
| 92 | + max_attempts: 20 | ||
| 93 | + timeout_seconds: 200 | ||
| 94 | + shell: bash | ||
| 95 | + command: | | ||
| 96 | + git config --global user.email "csukuangfj@gmail.com" | ||
| 97 | + git config --global user.name "Fangjun Kuang" | ||
| 98 | + | ||
| 99 | + rm -rf huggingface | ||
| 100 | + export GIT_LFS_SKIP_SMUDGE=1 | ||
| 101 | + export GIT_CLONE_PROTECTION_ACTIVE=false | ||
| 102 | + | ||
| 103 | + SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | ||
| 104 | + echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION" | ||
| 105 | + | ||
| 106 | + git clone https://huggingface.co/csukuangfj/sherpa-onnx-flutter huggingface | ||
| 107 | + cd huggingface | ||
| 108 | + git fetch | ||
| 109 | + git pull | ||
| 110 | + git merge -m "merge remote" --ff origin main | ||
| 111 | + | ||
| 112 | + dst=flutter/asr/macos/$SHERPA_ONNX_VERSION | ||
| 113 | + mkdir -p $dst | ||
| 114 | + | ||
| 115 | + cp -v ../*.tar.bz2 $dst | ||
| 116 | + | ||
| 117 | + git status | ||
| 118 | + git lfs track "*.bz2" | ||
| 119 | + git add . | ||
| 120 | + git commit -m "add more files" | ||
| 121 | + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-flutter main | ||
| 122 | + | ||
| 123 | + tts: | ||
| 124 | + name: tts ${{ matrix.arch }} ${{ matrix.index }}/${{ matrix.total }} | ||
| 125 | + runs-on: ${{ matrix.os }} | ||
| 126 | + strategy: | ||
| 127 | + fail-fast: false | ||
| 128 | + matrix: | ||
| 129 | + os: [macos-latest] | ||
| 130 | + arch: [x86_64, arm64] | ||
| 131 | + total: ["10"] | ||
| 132 | + index: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] | ||
| 133 | + | ||
| 134 | + steps: | ||
| 135 | + - uses: actions/checkout@v4 | ||
| 82 | with: | 136 | with: |
| 83 | - name: sherpa-onnx-osx-${{ matrix.arch }}-${{ matrix.index }} | ||
| 84 | - path: ./*.tar.bz2 | 137 | + fetch-depth: 0 |
| 138 | + | ||
| 139 | + - name: Install Python dependencies | ||
| 140 | + shell: bash | ||
| 141 | + run: | | ||
| 142 | + python3 -m pip install --break-system-packages --upgrade pip jinja2 iso639-lang | ||
| 143 | + | ||
| 144 | + - name: Setup Flutter SDK | ||
| 145 | + uses: flutter-actions/setup-flutter@v3 | ||
| 146 | + with: | ||
| 147 | + channel: stable | ||
| 148 | + version: latest | ||
| 149 | + | ||
| 150 | + - name: Display PWD | ||
| 151 | + shell: bash | ||
| 152 | + run: | | ||
| 153 | + echo "pwd: $PWD" | ||
| 154 | + ls -lh | ||
| 155 | + | ||
| 156 | + - name: Display machine info | ||
| 157 | + shell: bash | ||
| 158 | + run: | | ||
| 159 | + uname -a | ||
| 160 | + | ||
| 161 | + - name: Display flutter info | ||
| 162 | + shell: bash | ||
| 163 | + run: | | ||
| 164 | + which flutter | ||
| 165 | + which dart | ||
| 166 | + | ||
| 167 | + flutter --version | ||
| 168 | + dart --version | ||
| 169 | + flutter doctor | ||
| 170 | + | ||
| 171 | + - name: Build flutter | ||
| 172 | + shell: bash | ||
| 173 | + run: | | ||
| 174 | + export arch=${{ matrix.arch }} | ||
| 175 | + cd scripts/flutter | ||
| 176 | + | ||
| 177 | + total=${{ matrix.total }} | ||
| 178 | + index=${{ matrix.index }} | ||
| 179 | + | ||
| 180 | + ./generate-tts.py --total $total --index $index | ||
| 181 | + | ||
| 182 | + chmod +x *.sh | ||
| 183 | + ./build-macos-tts.sh | ||
| 184 | + cd ../../ | ||
| 185 | + ls -lh *.tar.bz2 | ||
| 186 | + | ||
| 187 | + - name: Display generated files | ||
| 188 | + shell: bash | ||
| 189 | + run: | | ||
| 190 | + ls -lh *.tar.bz2 | ||
| 85 | 191 | ||
| 86 | - name: Publish to huggingface | 192 | - name: Publish to huggingface |
| 87 | - if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') || contains(github.ref, 'refs/tags/')) | 193 | + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' || github.repository_owner == 'csu-fangjun') && ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') || contains(github.ref, 'refs/tags/')) |
| 88 | env: | 194 | env: |
| 89 | HF_TOKEN: ${{ secrets.HF_TOKEN }} | 195 | HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| 90 | uses: nick-fields/retry@v3 | 196 | uses: nick-fields/retry@v3 |
| @@ -100,13 +206,17 @@ jobs: | @@ -100,13 +206,17 @@ jobs: | ||
| 100 | export GIT_LFS_SKIP_SMUDGE=1 | 206 | export GIT_LFS_SKIP_SMUDGE=1 |
| 101 | export GIT_CLONE_PROTECTION_ACTIVE=false | 207 | export GIT_CLONE_PROTECTION_ACTIVE=false |
| 102 | 208 | ||
| 209 | + SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | ||
| 210 | + echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION" | ||
| 211 | + | ||
| 103 | git clone https://huggingface.co/csukuangfj/sherpa-onnx-flutter huggingface | 212 | git clone https://huggingface.co/csukuangfj/sherpa-onnx-flutter huggingface |
| 104 | cd huggingface | 213 | cd huggingface |
| 105 | git fetch | 214 | git fetch |
| 106 | git pull | 215 | git pull |
| 107 | git merge -m "merge remote" --ff origin main | 216 | git merge -m "merge remote" --ff origin main |
| 108 | - mkdir -p flutter/asr | ||
| 109 | - cp -v ../*.tar.bz2 ./flutter/asr | 217 | + dst=flutter/tts/macos/$SHERPA_ONNX_VERSION |
| 218 | + mkdir -p $dst | ||
| 219 | + cp -v ../*.tar.bz2 $dst | ||
| 110 | 220 | ||
| 111 | git status | 221 | git status |
| 112 | git lfs track "*.bz2" | 222 | git lfs track "*.bz2" |
| @@ -14,8 +14,8 @@ concurrency: | @@ -14,8 +14,8 @@ concurrency: | ||
| 14 | cancel-in-progress: true | 14 | cancel-in-progress: true |
| 15 | 15 | ||
| 16 | jobs: | 16 | jobs: |
| 17 | - flutter_windows_x64: | ||
| 18 | - name: windows x64 ${{ matrix.index }} | 17 | + asr: |
| 18 | + name: asr ${{ matrix.index }}/${{ matrix.total }} | ||
| 19 | runs-on: ${{ matrix.os }} | 19 | runs-on: ${{ matrix.os }} |
| 20 | strategy: | 20 | strategy: |
| 21 | fail-fast: false | 21 | fail-fast: false |
| @@ -76,13 +76,106 @@ jobs: | @@ -76,13 +76,106 @@ jobs: | ||
| 76 | cd ../../ | 76 | cd ../../ |
| 77 | ls -lh *.tar.bz2 | 77 | ls -lh *.tar.bz2 |
| 78 | 78 | ||
| 79 | - - uses: actions/upload-artifact@v4 | 79 | + - name: Publish to huggingface |
| 80 | + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' || github.repository_owner == 'csu-fangjun') && ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') || contains(github.ref, 'refs/tags/')) | ||
| 81 | + env: | ||
| 82 | + HF_TOKEN: ${{ secrets.HF_TOKEN }} | ||
| 83 | + uses: nick-fields/retry@v3 | ||
| 80 | with: | 84 | with: |
| 81 | - name: sherpa-onnx-win-x64-${{ matrix.index }} | ||
| 82 | - path: ./*.tar.bz2 | 85 | + max_attempts: 20 |
| 86 | + timeout_seconds: 200 | ||
| 87 | + shell: bash | ||
| 88 | + command: | | ||
| 89 | + git config --global user.email "csukuangfj@gmail.com" | ||
| 90 | + git config --global user.name "Fangjun Kuang" | ||
| 91 | + | ||
| 92 | + rm -rf huggingface | ||
| 93 | + export GIT_LFS_SKIP_SMUDGE=1 | ||
| 94 | + export GIT_CLONE_PROTECTION_ACTIVE=false | ||
| 95 | + | ||
| 96 | + SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | ||
| 97 | + echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION" | ||
| 98 | + | ||
| 99 | + git clone https://huggingface.co/csukuangfj/sherpa-onnx-flutter huggingface | ||
| 100 | + cd huggingface | ||
| 101 | + git fetch | ||
| 102 | + git pull | ||
| 103 | + git merge -m "merge remote" --ff origin main | ||
| 104 | + | ||
| 105 | + dst=flutter/asr/windows/$SHERPA_ONNX_VERSION | ||
| 106 | + mkdir -p $dst | ||
| 107 | + cp -v ../*.tar.bz2 $dst | ||
| 108 | + | ||
| 109 | + git status | ||
| 110 | + git lfs track "*.bz2" | ||
| 111 | + git add . | ||
| 112 | + git commit -m "add more files" | ||
| 113 | + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-flutter main | ||
| 114 | + | ||
| 115 | + tts: | ||
| 116 | + name: tts ${{ matrix.index }}/${{ matrix.total }} | ||
| 117 | + runs-on: ${{ matrix.os }} | ||
| 118 | + strategy: | ||
| 119 | + fail-fast: false | ||
| 120 | + matrix: | ||
| 121 | + os: [windows-latest] | ||
| 122 | + total: ["20"] | ||
| 123 | + index: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "11", "12", "13", "14", "15", "16", "17", "18", "19"] | ||
| 124 | + | ||
| 125 | + steps: | ||
| 126 | + - uses: actions/checkout@v4 | ||
| 127 | + with: | ||
| 128 | + fetch-depth: 0 | ||
| 129 | + | ||
| 130 | + - name: Install Python dependencies | ||
| 131 | + shell: bash | ||
| 132 | + run: | | ||
| 133 | + python3 -m pip install --upgrade pip jinja2 iso639-lang | ||
| 134 | + | ||
| 135 | + - name: Setup Flutter SDK | ||
| 136 | + uses: flutter-actions/setup-flutter@v3 | ||
| 137 | + with: | ||
| 138 | + channel: stable | ||
| 139 | + version: latest | ||
| 140 | + | ||
| 141 | + - name: Display PWD | ||
| 142 | + shell: bash | ||
| 143 | + run: | | ||
| 144 | + echo "pwd: $PWD" | ||
| 145 | + ls -lh | ||
| 146 | + | ||
| 147 | + - name: Display machine info | ||
| 148 | + shell: bash | ||
| 149 | + run: | | ||
| 150 | + uname -a | ||
| 151 | + | ||
| 152 | + - name: Display flutter info | ||
| 153 | + shell: bash | ||
| 154 | + run: | | ||
| 155 | + which flutter | ||
| 156 | + which dart | ||
| 157 | + | ||
| 158 | + flutter --version | ||
| 159 | + dart --version | ||
| 160 | + flutter doctor | ||
| 161 | + | ||
| 162 | + - name: Build flutter | ||
| 163 | + shell: bash | ||
| 164 | + run: | | ||
| 165 | + cd scripts/flutter | ||
| 166 | + | ||
| 167 | + total=${{ matrix.total }} | ||
| 168 | + index=${{ matrix.index }} | ||
| 169 | + | ||
| 170 | + ./generate-tts.py --total $total --index $index | ||
| 171 | + | ||
| 172 | + chmod +x *.sh | ||
| 173 | + ./build-windows-tts.sh | ||
| 174 | + cd ../../ | ||
| 175 | + ls -lh *.tar.bz2 | ||
| 83 | 176 | ||
| 84 | - name: Publish to huggingface | 177 | - name: Publish to huggingface |
| 85 | - if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') || contains(github.ref, 'refs/tags/')) | 178 | + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' || github.repository_owner == 'csu-fangjun') && ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') || contains(github.ref, 'refs/tags/')) |
| 86 | env: | 179 | env: |
| 87 | HF_TOKEN: ${{ secrets.HF_TOKEN }} | 180 | HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| 88 | uses: nick-fields/retry@v3 | 181 | uses: nick-fields/retry@v3 |
| @@ -98,13 +191,18 @@ jobs: | @@ -98,13 +191,18 @@ jobs: | ||
| 98 | export GIT_LFS_SKIP_SMUDGE=1 | 191 | export GIT_LFS_SKIP_SMUDGE=1 |
| 99 | export GIT_CLONE_PROTECTION_ACTIVE=false | 192 | export GIT_CLONE_PROTECTION_ACTIVE=false |
| 100 | 193 | ||
| 194 | + SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | ||
| 195 | + echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION" | ||
| 196 | + | ||
| 101 | git clone https://huggingface.co/csukuangfj/sherpa-onnx-flutter huggingface | 197 | git clone https://huggingface.co/csukuangfj/sherpa-onnx-flutter huggingface |
| 102 | cd huggingface | 198 | cd huggingface |
| 103 | git fetch | 199 | git fetch |
| 104 | git pull | 200 | git pull |
| 105 | git merge -m "merge remote" --ff origin main | 201 | git merge -m "merge remote" --ff origin main |
| 106 | - mkdir -p flutter/asr | ||
| 107 | - cp -v ../*.tar.bz2 ./flutter/asr | 202 | + |
| 203 | + dst=flutter/tts/windows/$SHERPA_ONNX_VERSION | ||
| 204 | + mkdir -p $dst | ||
| 205 | + cp -v ../*.tar.bz2 $dst | ||
| 108 | 206 | ||
| 109 | git status | 207 | git status |
| 110 | git lfs track "*.bz2" | 208 | git lfs track "*.bz2" |
flutter-examples/andriod-notes.md
0 → 100644
| 1 | +# Note about android | ||
| 2 | + | ||
| 3 | +Useful commands | ||
| 4 | + | ||
| 5 | +```bash | ||
| 6 | +flutter build apk --split-per-abi --release | ||
| 7 | +``` | ||
| 8 | + | ||
| 9 | +The above commands print the following: | ||
| 10 | + | ||
| 11 | +``` | ||
| 12 | +✓ Built build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk (94.8MB) | ||
| 13 | +✓ Built build/app/outputs/flutter-apk/app-arm64-v8a-release.apk (96.1MB) | ||
| 14 | +✓ Built build/app/outputs/flutter-apk/app-x86_64-release.apk (96.9MB) | ||
| 15 | +``` | ||
| 16 | + | ||
| 17 | +Note that it does not generate APK for `x86`. | ||
| 18 | + | ||
| 19 | +``` | ||
| 20 | +adb install build/app/outputs/flutter-apk/app-arm64-v8a-release.apk | ||
| 21 | +``` |
flutter-examples/how-tts-is-created.md
0 → 100644
| 1 | +# Introduction | ||
| 2 | + | ||
| 3 | +This document describes how the [tts](./tts) folder is created. | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +```bash | ||
| 7 | +flutter create --platforms windows,macos,linux,android,ios tts | ||
| 8 | +``` | ||
| 9 | + | ||
| 10 | +It prints the following: | ||
| 11 | + | ||
| 12 | +``` | ||
| 13 | +Developer identity "Apple Development: xxx@zzz.com (xxxxxxx)" selected for iOS code signing | ||
| 14 | +Creating project tts... | ||
| 15 | +Resolving dependencies in `tts`... (1.3s) | ||
| 16 | +Downloading packages... | ||
| 17 | +Got dependencies in `tts`. | ||
| 18 | +Wrote 122 files. | ||
| 19 | + | ||
| 20 | +All done! | ||
| 21 | +You can find general documentation for Flutter at: https://docs.flutter.dev/ | ||
| 22 | +Detailed API documentation is available at: https://api.flutter.dev/ | ||
| 23 | +If you prefer video documentation, consider: https://www.youtube.com/c/flutterdev | ||
| 24 | + | ||
| 25 | +In order to run your application, type: | ||
| 26 | + | ||
| 27 | + $ cd tts | ||
| 28 | + $ flutter run | ||
| 29 | + | ||
| 30 | +Your application code is in tts/lib/main.dart. | ||
| 31 | +``` | ||
| 32 | + | ||
| 33 | +``` | ||
| 34 | +cd tts | ||
| 35 | +flutter pub get | ||
| 36 | +flutter build macos | ||
| 37 | +flutter run -d macos | ||
| 38 | +``` |
| @@ -12,11 +12,14 @@ Future<String> copyAssetFile(String src, [String? dst]) async { | @@ -12,11 +12,14 @@ Future<String> copyAssetFile(String src, [String? dst]) async { | ||
| 12 | dst = basename(src); | 12 | dst = basename(src); |
| 13 | } | 13 | } |
| 14 | final target = join(directory.path, dst); | 14 | final target = join(directory.path, dst); |
| 15 | + bool exists = await new File(target).exists(); | ||
| 15 | 16 | ||
| 16 | - final data = await rootBundle.load(src); | ||
| 17 | - final List<int> bytes = | ||
| 18 | - data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); | ||
| 19 | - await File(target).writeAsBytes(bytes); | 17 | + if (!exists) { |
| 18 | + final data = await rootBundle.load(src); | ||
| 19 | + final List<int> bytes = | ||
| 20 | + data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); | ||
| 21 | + await File(target).writeAsBytes(bytes); | ||
| 22 | + } | ||
| 20 | 23 | ||
| 21 | return target; | 24 | return target; |
| 22 | } | 25 | } |
flutter-examples/tts/.gitignore
0 → 100644
| 1 | +# Miscellaneous | ||
| 2 | +*.class | ||
| 3 | +*.log | ||
| 4 | +*.pyc | ||
| 5 | +*.swp | ||
| 6 | +.DS_Store | ||
| 7 | +.atom/ | ||
| 8 | +.buildlog/ | ||
| 9 | +.history | ||
| 10 | +.svn/ | ||
| 11 | +migrate_working_dir/ | ||
| 12 | + | ||
| 13 | +# IntelliJ related | ||
| 14 | +*.iml | ||
| 15 | +*.ipr | ||
| 16 | +*.iws | ||
| 17 | +.idea/ | ||
| 18 | + | ||
| 19 | +# The .vscode folder contains launch configuration and tasks you configure in | ||
| 20 | +# VS Code which you may wish to be included in version control, so this line | ||
| 21 | +# is commented out by default. | ||
| 22 | +#.vscode/ | ||
| 23 | + | ||
| 24 | +# Flutter/Dart/Pub related | ||
| 25 | +**/doc/api/ | ||
| 26 | +**/ios/Flutter/.last_build_id | ||
| 27 | +.dart_tool/ | ||
| 28 | +.flutter-plugins | ||
| 29 | +.flutter-plugins-dependencies | ||
| 30 | +.pub-cache/ | ||
| 31 | +.pub/ | ||
| 32 | +/build/ | ||
| 33 | + | ||
| 34 | +# Symbolication related | ||
| 35 | +app.*.symbols | ||
| 36 | + | ||
| 37 | +# Obfuscation related | ||
| 38 | +app.*.map.json | ||
| 39 | + | ||
| 40 | +# Android Studio will place build artifacts here | ||
| 41 | +/android/app/debug | ||
| 42 | +/android/app/profile | ||
| 43 | +/android/app/release |
flutter-examples/tts/.metadata
0 → 100644
| 1 | +# This file tracks properties of this Flutter project. | ||
| 2 | +# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
| 3 | +# | ||
| 4 | +# This file should be version controlled and should not be manually edited. | ||
| 5 | + | ||
| 6 | +version: | ||
| 7 | + revision: "5dcb86f68f239346676ceb1ed1ea385bd215fba1" | ||
| 8 | + channel: "stable" | ||
| 9 | + | ||
| 10 | +project_type: app | ||
| 11 | + | ||
| 12 | +# Tracks metadata for the flutter migrate command | ||
| 13 | +migration: | ||
| 14 | + platforms: | ||
| 15 | + - platform: root | ||
| 16 | + create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 | ||
| 17 | + base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 | ||
| 18 | + - platform: android | ||
| 19 | + create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 | ||
| 20 | + base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 | ||
| 21 | + - platform: ios | ||
| 22 | + create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 | ||
| 23 | + base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 | ||
| 24 | + - platform: linux | ||
| 25 | + create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 | ||
| 26 | + base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 | ||
| 27 | + - platform: macos | ||
| 28 | + create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 | ||
| 29 | + base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 | ||
| 30 | + - platform: windows | ||
| 31 | + create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 | ||
| 32 | + base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 | ||
| 33 | + | ||
| 34 | + # User provided section | ||
| 35 | + | ||
| 36 | + # List of Local paths (relative to this file) that should be | ||
| 37 | + # ignored by the migrate tool. | ||
| 38 | + # | ||
| 39 | + # Files that are not part of the templates will be ignored by default. | ||
| 40 | + unmanaged_files: | ||
| 41 | + - 'lib/main.dart' | ||
| 42 | + - 'ios/Runner.xcodeproj/project.pbxproj' |
flutter-examples/tts/README.md
0 → 100644
| 1 | +# tts | ||
| 2 | + | ||
| 3 | +This example demonstrates how to use text to speech (TTS) in Flutter with sherpa-onnx. | ||
| 4 | + | ||
| 5 | +It works on the following platforms: | ||
| 6 | + | ||
| 7 | + - Android | ||
| 8 | + - iOS | ||
| 9 | + - Linux | ||
| 10 | + - macOS (both arm64 and x86_64 are supported) | ||
| 11 | + - Windows | ||
| 12 | + | ||
| 13 | +## How to build | ||
| 14 | + | ||
| 15 | +Before you run `flutter build`, you have to select a TTS model and change | ||
| 16 | +the code to use your selected model. | ||
| 17 | + | ||
| 18 | +### 1. Select a TTS model | ||
| 19 | + | ||
| 20 | +We have a list of TTS models at | ||
| 21 | + | ||
| 22 | +<https://github.com/k2-fsa/sherpa-onnx/releases/tag/tts-models> | ||
| 23 | + | ||
| 24 | +You can select any of them. If you feel that there are so many that you don't know | ||
| 25 | +which one is the best, please visit <http://huggingface.co/spaces/k2-fsa/text-to-speech> | ||
| 26 | +and try each one by yourself and select the one you consider the best. | ||
| 27 | + | ||
| 28 | +Suppose you select | ||
| 29 | + | ||
| 30 | + <https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-libritts_r-medium.tar.bz2> | ||
| 31 | + | ||
| 32 | +Then please do the following: | ||
| 33 | + | ||
| 34 | + - 1. Download and unzip the model | ||
| 35 | + | ||
| 36 | +```bash | ||
| 37 | +cd flutter-examples/tts/assets | ||
| 38 | +wget https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-libritts_r-medium.tar.bz2 | ||
| 39 | +tar xf vits-piper-en_US-libritts_r-medium.tar.bz2 | ||
| 40 | +rm vits-piper-en_US-libritts_r-medium.tar.bz2 | ||
| 41 | +cd .. | ||
| 42 | + | ||
| 43 | +./generate-asset-list.py | ||
| 44 | +``` | ||
| 45 | + | ||
| 46 | + Note that you have to run [./generate-asset-list.py](./generate-asset-list.py) so that Flutter knows where | ||
| 47 | + to find the model. | ||
| 48 | + | ||
| 49 | + - 2. Change the code to use the downloaded model. | ||
| 50 | + | ||
| 51 | + We have given several examples for different models in [./lib/model.dart](./lib/model.dart). | ||
| 52 | + For our selected model, we need to change [./lib/model.dart](./lib/model.dart) so that it looks like below: | ||
| 53 | + | ||
| 54 | +``` | ||
| 55 | +// Example 6 | ||
| 56 | +// https://github.com/k2-fsa/sherpa-onnx/releases/tag/tts-models | ||
| 57 | +// https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-libritts_r-medium.tar.bz2 | ||
| 58 | +modelDir = 'vits-piper-en_US-libritts_r-medium'; | ||
| 59 | +modelName = 'en_US-libritts_r-medium.onnx'; | ||
| 60 | +dataDir = 'vits-piper-en_US-libritts_r-medium/espeak-ng-data'; | ||
| 61 | +``` | ||
| 62 | + | ||
| 63 | + - 3. That's it. | ||
| 64 | + | ||
| 65 | +### Build the APP | ||
| 66 | + | ||
| 67 | + - 1. For Linux | ||
| 68 | + | ||
| 69 | +```bash | ||
| 70 | +flutter build linux | ||
| 71 | + | ||
| 72 | +# See below if you get any errors | ||
| 73 | +``` | ||
| 74 | + | ||
| 75 | + - 2. For macOS | ||
| 76 | + | ||
| 77 | +To build a universal2 APP, use | ||
| 78 | + | ||
| 79 | +```bash | ||
| 80 | +flutter build macos | ||
| 81 | +``` | ||
| 82 | + | ||
| 83 | +To build for `x86_64`, use | ||
| 84 | + | ||
| 85 | +```bash | ||
| 86 | +export FLUTTER_XCODE_ARCHS=x86_64 | ||
| 87 | +flutter build macos | ||
| 88 | +``` | ||
| 89 | + | ||
| 90 | +To build for `arm64`, use | ||
| 91 | + | ||
| 92 | +```bash | ||
| 93 | +export FLUTTER_XCODE_ARCHS=arm64 | ||
| 94 | +flutter build macos | ||
| 95 | +``` | ||
| 96 | + | ||
| 97 | + - 3. For Windows | ||
| 98 | + | ||
| 99 | +```bash | ||
| 100 | +flutter build windows | ||
| 101 | +``` | ||
| 102 | + | ||
| 103 | + - 4. For Android | ||
| 104 | + | ||
| 105 | +```bash | ||
| 106 | +flutter build apk --split-per-abi | ||
| 107 | +``` | ||
| 108 | + | ||
| 109 | + - 5. For iOS | ||
| 110 | + | ||
| 111 | +``` | ||
| 112 | +flutter build ios | ||
| 113 | +``` | ||
| 114 | + | ||
| 115 | +## Fix for Linux | ||
| 116 | + | ||
| 117 | +If you get the following errors on Linux, | ||
| 118 | + | ||
| 119 | +``` | ||
| 120 | +Building Linux application... | ||
| 121 | +CMake Error at /usr/local/share/cmake-3.29/Modules/FindPkgConfig.cmake:634 (message): | ||
| 122 | + The following required packages were not found: | ||
| 123 | + | ||
| 124 | + - gstreamer-1.0 | ||
| 125 | + | ||
| 126 | +Call Stack (most recent call first): | ||
| 127 | + /usr/local/share/cmake-3.29/Modules/FindPkgConfig.cmake:862 (_pkg_check_modules_internal) | ||
| 128 | + flutter/ephemeral/.plugin_symlinks/audioplayers_linux/linux/CMakeLists.txt:24 (pkg_check_modules) | ||
| 129 | +``` | ||
| 130 | + | ||
| 131 | +please run: | ||
| 132 | + | ||
| 133 | +```bash | ||
| 134 | +sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libunwind-dev | ||
| 135 | +``` | ||
| 136 | + | ||
| 137 | +See also <https://github.com/bluefireteam/audioplayers/tree/main/packages/audioplayers_linux#setup-for-linux> | ||
| 138 | +for the above error. |
flutter-examples/tts/analysis_options.yaml
0 → 100644
| 1 | +# This file configures the analyzer, which statically analyzes Dart code to | ||
| 2 | +# check for errors, warnings, and lints. | ||
| 3 | +# | ||
| 4 | +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled | ||
| 5 | +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be | ||
| 6 | +# invoked from the command line by running `flutter analyze`. | ||
| 7 | + | ||
| 8 | +# The following line activates a set of recommended lints for Flutter apps, | ||
| 9 | +# packages, and plugins designed to encourage good coding practices. | ||
| 10 | +include: package:flutter_lints/flutter.yaml | ||
| 11 | + | ||
| 12 | +linter: | ||
| 13 | + # The lint rules applied to this project can be customized in the | ||
| 14 | + # section below to disable rules from the `package:flutter_lints/flutter.yaml` | ||
| 15 | + # included above or to enable additional rules. A list of all available lints | ||
| 16 | + # and their documentation is published at https://dart.dev/lints. | ||
| 17 | + # | ||
| 18 | + # Instead of disabling a lint rule for the entire project in the | ||
| 19 | + # section below, it can also be suppressed for a single line of code | ||
| 20 | + # or a specific dart file by using the `// ignore: name_of_lint` and | ||
| 21 | + # `// ignore_for_file: name_of_lint` syntax on the line or in the file | ||
| 22 | + # producing the lint. | ||
| 23 | + rules: | ||
| 24 | + # avoid_print: false # Uncomment to disable the `avoid_print` rule | ||
| 25 | + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule | ||
| 26 | + | ||
| 27 | +# Additional information about this file can be found at | ||
| 28 | +# https://dart.dev/guides/language/analysis-options |
flutter-examples/tts/android/.gitignore
0 → 100644
| 1 | +gradle-wrapper.jar | ||
| 2 | +/.gradle | ||
| 3 | +/captures/ | ||
| 4 | +/gradlew | ||
| 5 | +/gradlew.bat | ||
| 6 | +/local.properties | ||
| 7 | +GeneratedPluginRegistrant.java | ||
| 8 | + | ||
| 9 | +# Remember to never publicly share your keystore. | ||
| 10 | +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app | ||
| 11 | +key.properties | ||
| 12 | +**/*.keystore | ||
| 13 | +**/*.jks |
| 1 | +plugins { | ||
| 2 | + id "com.android.application" | ||
| 3 | + id "kotlin-android" | ||
| 4 | + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. | ||
| 5 | + id "dev.flutter.flutter-gradle-plugin" | ||
| 6 | +} | ||
| 7 | + | ||
| 8 | +def localProperties = new Properties() | ||
| 9 | +def localPropertiesFile = rootProject.file("local.properties") | ||
| 10 | +if (localPropertiesFile.exists()) { | ||
| 11 | + localPropertiesFile.withReader("UTF-8") { reader -> | ||
| 12 | + localProperties.load(reader) | ||
| 13 | + } | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +def flutterVersionCode = localProperties.getProperty("flutter.versionCode") | ||
| 17 | +if (flutterVersionCode == null) { | ||
| 18 | + flutterVersionCode = "1" | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +def flutterVersionName = localProperties.getProperty("flutter.versionName") | ||
| 22 | +if (flutterVersionName == null) { | ||
| 23 | + flutterVersionName = "1.0" | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +android { | ||
| 27 | + namespace = "com.k2fsa.sherpa.onnx.tts" | ||
| 28 | + compileSdk = flutter.compileSdkVersion | ||
| 29 | + ndkVersion = flutter.ndkVersion | ||
| 30 | + | ||
| 31 | + compileOptions { | ||
| 32 | + sourceCompatibility = JavaVersion.VERSION_1_8 | ||
| 33 | + targetCompatibility = JavaVersion.VERSION_1_8 | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + defaultConfig { | ||
| 37 | + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | ||
| 38 | + applicationId = "com.k2fsa.sherpa.onnx.tts" | ||
| 39 | + // You can update the following values to match your application needs. | ||
| 40 | + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. | ||
| 41 | + minSdk = flutter.minSdkVersion | ||
| 42 | + targetSdk = flutter.targetSdkVersion | ||
| 43 | + versionCode = flutterVersionCode.toInteger() | ||
| 44 | + versionName = flutterVersionName | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + buildTypes { | ||
| 48 | + release { | ||
| 49 | + // TODO: Add your own signing config for the release build. | ||
| 50 | + // Signing with the debug keys for now, so `flutter run --release` works. | ||
| 51 | + signingConfig = signingConfigs.debug | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +flutter { | ||
| 57 | + source = "../.." | ||
| 58 | +} |
| 1 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 2 | + <!-- The INTERNET permission is required for development. Specifically, | ||
| 3 | + the Flutter tool needs it to communicate with the running application | ||
| 4 | + to allow setting breakpoints, to provide hot reload, etc. | ||
| 5 | + --> | ||
| 6 | + <uses-permission android:name="android.permission.INTERNET"/> | ||
| 7 | +</manifest> |
| 1 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 2 | + <application | ||
| 3 | + android:label="tts" | ||
| 4 | + android:name="${applicationName}" | ||
| 5 | + android:icon="@mipmap/ic_launcher"> | ||
| 6 | + <activity | ||
| 7 | + android:name=".MainActivity" | ||
| 8 | + android:exported="true" | ||
| 9 | + android:launchMode="singleTop" | ||
| 10 | + android:taskAffinity="" | ||
| 11 | + android:theme="@style/LaunchTheme" | ||
| 12 | + android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" | ||
| 13 | + android:hardwareAccelerated="true" | ||
| 14 | + android:windowSoftInputMode="adjustResize"> | ||
| 15 | + <!-- Specifies an Android theme to apply to this Activity as soon as | ||
| 16 | + the Android process has started. This theme is visible to the user | ||
| 17 | + while the Flutter UI initializes. After that, this theme continues | ||
| 18 | + to determine the Window background behind the Flutter UI. --> | ||
| 19 | + <meta-data | ||
| 20 | + android:name="io.flutter.embedding.android.NormalTheme" | ||
| 21 | + android:resource="@style/NormalTheme" | ||
| 22 | + /> | ||
| 23 | + <intent-filter> | ||
| 24 | + <action android:name="android.intent.action.MAIN"/> | ||
| 25 | + <category android:name="android.intent.category.LAUNCHER"/> | ||
| 26 | + </intent-filter> | ||
| 27 | + </activity> | ||
| 28 | + <!-- Don't delete the meta-data below. | ||
| 29 | + This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> | ||
| 30 | + <meta-data | ||
| 31 | + android:name="flutterEmbedding" | ||
| 32 | + android:value="2" /> | ||
| 33 | + </application> | ||
| 34 | + <!-- Required to query activities that can process text, see: | ||
| 35 | + https://developer.android.com/training/package-visibility and | ||
| 36 | + https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT. | ||
| 37 | + | ||
| 38 | + In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. --> | ||
| 39 | + <queries> | ||
| 40 | + <intent> | ||
| 41 | + <action android:name="android.intent.action.PROCESS_TEXT"/> | ||
| 42 | + <data android:mimeType="text/plain"/> | ||
| 43 | + </intent> | ||
| 44 | + </queries> | ||
| 45 | +</manifest> |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<!-- Modify this file to customize your launch splash screen --> | ||
| 3 | +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 4 | + <item android:drawable="?android:colorBackground" /> | ||
| 5 | + | ||
| 6 | + <!-- You can insert your own image assets here --> | ||
| 7 | + <!-- <item> | ||
| 8 | + <bitmap | ||
| 9 | + android:gravity="center" | ||
| 10 | + android:src="@mipmap/launch_image" /> | ||
| 11 | + </item> --> | ||
| 12 | +</layer-list> |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<!-- Modify this file to customize your launch splash screen --> | ||
| 3 | +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 4 | + <item android:drawable="@android:color/white" /> | ||
| 5 | + | ||
| 6 | + <!-- You can insert your own image assets here --> | ||
| 7 | + <!-- <item> | ||
| 8 | + <bitmap | ||
| 9 | + android:gravity="center" | ||
| 10 | + android:src="@mipmap/launch_image" /> | ||
| 11 | + </item> --> | ||
| 12 | +</layer-list> |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<resources> | ||
| 3 | + <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on --> | ||
| 4 | + <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar"> | ||
| 5 | + <!-- Show a splash screen on the activity. Automatically removed when | ||
| 6 | + the Flutter engine draws its first frame --> | ||
| 7 | + <item name="android:windowBackground">@drawable/launch_background</item> | ||
| 8 | + </style> | ||
| 9 | + <!-- Theme applied to the Android Window as soon as the process has started. | ||
| 10 | + This theme determines the color of the Android Window while your | ||
| 11 | + Flutter UI initializes, as well as behind your Flutter UI while its | ||
| 12 | + running. | ||
| 13 | + | ||
| 14 | + This Theme is only used starting with V2 of Flutter's Android embedding. --> | ||
| 15 | + <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar"> | ||
| 16 | + <item name="android:windowBackground">?android:colorBackground</item> | ||
| 17 | + </style> | ||
| 18 | +</resources> |
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<resources> | ||
| 3 | + <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off --> | ||
| 4 | + <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar"> | ||
| 5 | + <!-- Show a splash screen on the activity. Automatically removed when | ||
| 6 | + the Flutter engine draws its first frame --> | ||
| 7 | + <item name="android:windowBackground">@drawable/launch_background</item> | ||
| 8 | + </style> | ||
| 9 | + <!-- Theme applied to the Android Window as soon as the process has started. | ||
| 10 | + This theme determines the color of the Android Window while your | ||
| 11 | + Flutter UI initializes, as well as behind your Flutter UI while its | ||
| 12 | + running. | ||
| 13 | + | ||
| 14 | + This Theme is only used starting with V2 of Flutter's Android embedding. --> | ||
| 15 | + <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar"> | ||
| 16 | + <item name="android:windowBackground">?android:colorBackground</item> | ||
| 17 | + </style> | ||
| 18 | +</resources> |
| 1 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 2 | + <!-- The INTERNET permission is required for development. Specifically, | ||
| 3 | + the Flutter tool needs it to communicate with the running application | ||
| 4 | + to allow setting breakpoints, to provide hot reload, etc. | ||
| 5 | + --> | ||
| 6 | + <uses-permission android:name="android.permission.INTERNET"/> | ||
| 7 | +</manifest> |
flutter-examples/tts/android/build.gradle
0 → 100644
| 1 | +allprojects { | ||
| 2 | + repositories { | ||
| 3 | + google() | ||
| 4 | + mavenCentral() | ||
| 5 | + } | ||
| 6 | +} | ||
| 7 | + | ||
| 8 | +rootProject.buildDir = "../build" | ||
| 9 | +subprojects { | ||
| 10 | + project.buildDir = "${rootProject.buildDir}/${project.name}" | ||
| 11 | +} | ||
| 12 | +subprojects { | ||
| 13 | + project.evaluationDependsOn(":app") | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +tasks.register("clean", Delete) { | ||
| 17 | + delete rootProject.buildDir | ||
| 18 | +} |
flutter-examples/tts/android/settings.gradle
0 → 100644
| 1 | +pluginManagement { | ||
| 2 | + def flutterSdkPath = { | ||
| 3 | + def properties = new Properties() | ||
| 4 | + file("local.properties").withInputStream { properties.load(it) } | ||
| 5 | + def flutterSdkPath = properties.getProperty("flutter.sdk") | ||
| 6 | + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" | ||
| 7 | + return flutterSdkPath | ||
| 8 | + }() | ||
| 9 | + | ||
| 10 | + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") | ||
| 11 | + | ||
| 12 | + repositories { | ||
| 13 | + google() | ||
| 14 | + mavenCentral() | ||
| 15 | + gradlePluginPortal() | ||
| 16 | + } | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +plugins { | ||
| 20 | + id "dev.flutter.flutter-plugin-loader" version "1.0.0" | ||
| 21 | + id "com.android.application" version "7.3.0" apply false | ||
| 22 | + id "org.jetbrains.kotlin.android" version "1.7.10" apply false | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +include ":app" |
flutter-examples/tts/assets/.gitkeep
0 → 100644
flutter-examples/tts/generate-asset-list.py
0 → 100755
| 1 | +#!/usr/bin/env python3 | ||
| 2 | + | ||
| 3 | +""" | ||
| 4 | +This file assumes that | ||
| 5 | + assets: | ||
| 6 | +is the last line in ./pubspec.yaml | ||
| 7 | + | ||
| 8 | +It reads the file names of all files from the ./assets folder | ||
| 9 | +and turns them as assets and writes them into ./pubspec.yaml | ||
| 10 | +""" | ||
| 11 | + | ||
| 12 | +import os | ||
| 13 | + | ||
| 14 | + | ||
| 15 | +def main(): | ||
| 16 | + target = "./assets" | ||
| 17 | + excluded_ext = [ | ||
| 18 | + ".gitkeep", | ||
| 19 | + ".onnx.json", | ||
| 20 | + ".py", | ||
| 21 | + ".sh", | ||
| 22 | + "*.md", | ||
| 23 | + "MODEL_CARD", | ||
| 24 | + ] | ||
| 25 | + sep = " " | ||
| 26 | + ss = [] | ||
| 27 | + for root, d, files in os.walk(target): | ||
| 28 | + for f in files: | ||
| 29 | + skip = False | ||
| 30 | + for p in excluded_ext: | ||
| 31 | + if f.endswith(p): | ||
| 32 | + skip = True | ||
| 33 | + break | ||
| 34 | + | ||
| 35 | + if skip: | ||
| 36 | + continue | ||
| 37 | + | ||
| 38 | + t = os.path.join(root, f).replace("\\", "/") | ||
| 39 | + ss.append("{sep}- {t}".format(sep=sep, t=t)) | ||
| 40 | + | ||
| 41 | + # read pub.spec.yaml | ||
| 42 | + with open("./pubspec.yaml", encoding="utf-8") as f: | ||
| 43 | + lines = f.readlines() | ||
| 44 | + | ||
| 45 | + found_assets = False | ||
| 46 | + with open("./pubspec.yaml", "w", encoding="utf-8") as f: | ||
| 47 | + for line in lines: | ||
| 48 | + if line == " assets:\n": | ||
| 49 | + assert found_assets is False | ||
| 50 | + found_assets = True | ||
| 51 | + if len(ss) > 0: | ||
| 52 | + f.write(line) | ||
| 53 | + | ||
| 54 | + if not found_assets: | ||
| 55 | + f.write(line) | ||
| 56 | + continue | ||
| 57 | + | ||
| 58 | + for s in ss: | ||
| 59 | + f.write("{s}\n".format(s=s)) | ||
| 60 | + break | ||
| 61 | + | ||
| 62 | + if not found_assets and ss: | ||
| 63 | + f.write(" assets:\n") | ||
| 64 | + for s in ss: | ||
| 65 | + f.write("{s}\n".format(s=s)) | ||
| 66 | + | ||
| 67 | + | ||
| 68 | +if __name__ == "__main__": | ||
| 69 | + main() |
flutter-examples/tts/ios/.gitignore
0 → 100644
| 1 | +**/dgph | ||
| 2 | +*.mode1v3 | ||
| 3 | +*.mode2v3 | ||
| 4 | +*.moved-aside | ||
| 5 | +*.pbxuser | ||
| 6 | +*.perspectivev3 | ||
| 7 | +**/*sync/ | ||
| 8 | +.sconsign.dblite | ||
| 9 | +.tags* | ||
| 10 | +**/.vagrant/ | ||
| 11 | +**/DerivedData/ | ||
| 12 | +Icon? | ||
| 13 | +**/Pods/ | ||
| 14 | +**/.symlinks/ | ||
| 15 | +profile | ||
| 16 | +xcuserdata | ||
| 17 | +**/.generated/ | ||
| 18 | +Flutter/App.framework | ||
| 19 | +Flutter/Flutter.framework | ||
| 20 | +Flutter/Flutter.podspec | ||
| 21 | +Flutter/Generated.xcconfig | ||
| 22 | +Flutter/ephemeral/ | ||
| 23 | +Flutter/app.flx | ||
| 24 | +Flutter/app.zip | ||
| 25 | +Flutter/flutter_assets/ | ||
| 26 | +Flutter/flutter_export_environment.sh | ||
| 27 | +ServiceDefinitions.json | ||
| 28 | +Runner/GeneratedPluginRegistrant.* | ||
| 29 | + | ||
| 30 | +# Exceptions to above rules. | ||
| 31 | +!default.mode1v3 | ||
| 32 | +!default.mode2v3 | ||
| 33 | +!default.pbxuser | ||
| 34 | +!default.perspectivev3 |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| 3 | +<plist version="1.0"> | ||
| 4 | +<dict> | ||
| 5 | + <key>CFBundleDevelopmentRegion</key> | ||
| 6 | + <string>en</string> | ||
| 7 | + <key>CFBundleExecutable</key> | ||
| 8 | + <string>App</string> | ||
| 9 | + <key>CFBundleIdentifier</key> | ||
| 10 | + <string>io.flutter.flutter.app</string> | ||
| 11 | + <key>CFBundleInfoDictionaryVersion</key> | ||
| 12 | + <string>6.0</string> | ||
| 13 | + <key>CFBundleName</key> | ||
| 14 | + <string>App</string> | ||
| 15 | + <key>CFBundlePackageType</key> | ||
| 16 | + <string>FMWK</string> | ||
| 17 | + <key>CFBundleShortVersionString</key> | ||
| 18 | + <string>1.0</string> | ||
| 19 | + <key>CFBundleSignature</key> | ||
| 20 | + <string>????</string> | ||
| 21 | + <key>CFBundleVersion</key> | ||
| 22 | + <string>1.0</string> | ||
| 23 | + <key>MinimumOSVersion</key> | ||
| 24 | + <string>12.0</string> | ||
| 25 | +</dict> | ||
| 26 | +</plist> |
| 1 | +#include "Generated.xcconfig" |
| 1 | +#include "Generated.xcconfig" |
| 1 | +// !$*UTF8*$! | ||
| 2 | +{ | ||
| 3 | + archiveVersion = 1; | ||
| 4 | + classes = { | ||
| 5 | + }; | ||
| 6 | + objectVersion = 54; | ||
| 7 | + objects = { | ||
| 8 | + | ||
| 9 | +/* Begin PBXBuildFile section */ | ||
| 10 | + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; | ||
| 11 | + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; | ||
| 12 | + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; | ||
| 13 | + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; | ||
| 14 | + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; | ||
| 15 | + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; | ||
| 16 | + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; | ||
| 17 | +/* End PBXBuildFile section */ | ||
| 18 | + | ||
| 19 | +/* Begin PBXContainerItemProxy section */ | ||
| 20 | + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { | ||
| 21 | + isa = PBXContainerItemProxy; | ||
| 22 | + containerPortal = 97C146E61CF9000F007C117D /* Project object */; | ||
| 23 | + proxyType = 1; | ||
| 24 | + remoteGlobalIDString = 97C146ED1CF9000F007C117D; | ||
| 25 | + remoteInfo = Runner; | ||
| 26 | + }; | ||
| 27 | +/* End PBXContainerItemProxy section */ | ||
| 28 | + | ||
| 29 | +/* Begin PBXCopyFilesBuildPhase section */ | ||
| 30 | + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { | ||
| 31 | + isa = PBXCopyFilesBuildPhase; | ||
| 32 | + buildActionMask = 2147483647; | ||
| 33 | + dstPath = ""; | ||
| 34 | + dstSubfolderSpec = 10; | ||
| 35 | + files = ( | ||
| 36 | + ); | ||
| 37 | + name = "Embed Frameworks"; | ||
| 38 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 39 | + }; | ||
| 40 | +/* End PBXCopyFilesBuildPhase section */ | ||
| 41 | + | ||
| 42 | +/* Begin PBXFileReference section */ | ||
| 43 | + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; }; | ||
| 44 | + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; }; | ||
| 45 | + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; }; | ||
| 46 | + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
| 47 | + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; | ||
| 48 | + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; }; | ||
| 49 | + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; | ||
| 50 | + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; | ||
| 51 | + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; }; | ||
| 52 | + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; }; | ||
| 53 | + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
| 54 | + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; | ||
| 55 | + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; | ||
| 56 | + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; | ||
| 57 | + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; | ||
| 58 | +/* End PBXFileReference section */ | ||
| 59 | + | ||
| 60 | +/* Begin PBXFrameworksBuildPhase section */ | ||
| 61 | + 97C146EB1CF9000F007C117D /* Frameworks */ = { | ||
| 62 | + isa = PBXFrameworksBuildPhase; | ||
| 63 | + buildActionMask = 2147483647; | ||
| 64 | + files = ( | ||
| 65 | + ); | ||
| 66 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 67 | + }; | ||
| 68 | +/* End PBXFrameworksBuildPhase section */ | ||
| 69 | + | ||
| 70 | +/* Begin PBXGroup section */ | ||
| 71 | + 331C8082294A63A400263BE5 /* RunnerTests */ = { | ||
| 72 | + isa = PBXGroup; | ||
| 73 | + children = ( | ||
| 74 | + 331C807B294A618700263BE5 /* RunnerTests.swift */, | ||
| 75 | + ); | ||
| 76 | + path = RunnerTests; | ||
| 77 | + sourceTree = "<group>"; | ||
| 78 | + }; | ||
| 79 | + 9740EEB11CF90186004384FC /* Flutter */ = { | ||
| 80 | + isa = PBXGroup; | ||
| 81 | + children = ( | ||
| 82 | + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, | ||
| 83 | + 9740EEB21CF90195004384FC /* Debug.xcconfig */, | ||
| 84 | + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, | ||
| 85 | + 9740EEB31CF90195004384FC /* Generated.xcconfig */, | ||
| 86 | + ); | ||
| 87 | + name = Flutter; | ||
| 88 | + sourceTree = "<group>"; | ||
| 89 | + }; | ||
| 90 | + 97C146E51CF9000F007C117D = { | ||
| 91 | + isa = PBXGroup; | ||
| 92 | + children = ( | ||
| 93 | + 9740EEB11CF90186004384FC /* Flutter */, | ||
| 94 | + 97C146F01CF9000F007C117D /* Runner */, | ||
| 95 | + 97C146EF1CF9000F007C117D /* Products */, | ||
| 96 | + 331C8082294A63A400263BE5 /* RunnerTests */, | ||
| 97 | + ); | ||
| 98 | + sourceTree = "<group>"; | ||
| 99 | + }; | ||
| 100 | + 97C146EF1CF9000F007C117D /* Products */ = { | ||
| 101 | + isa = PBXGroup; | ||
| 102 | + children = ( | ||
| 103 | + 97C146EE1CF9000F007C117D /* Runner.app */, | ||
| 104 | + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, | ||
| 105 | + ); | ||
| 106 | + name = Products; | ||
| 107 | + sourceTree = "<group>"; | ||
| 108 | + }; | ||
| 109 | + 97C146F01CF9000F007C117D /* Runner */ = { | ||
| 110 | + isa = PBXGroup; | ||
| 111 | + children = ( | ||
| 112 | + 97C146FA1CF9000F007C117D /* Main.storyboard */, | ||
| 113 | + 97C146FD1CF9000F007C117D /* Assets.xcassets */, | ||
| 114 | + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, | ||
| 115 | + 97C147021CF9000F007C117D /* Info.plist */, | ||
| 116 | + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, | ||
| 117 | + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, | ||
| 118 | + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, | ||
| 119 | + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, | ||
| 120 | + ); | ||
| 121 | + path = Runner; | ||
| 122 | + sourceTree = "<group>"; | ||
| 123 | + }; | ||
| 124 | +/* End PBXGroup section */ | ||
| 125 | + | ||
| 126 | +/* Begin PBXNativeTarget section */ | ||
| 127 | + 331C8080294A63A400263BE5 /* RunnerTests */ = { | ||
| 128 | + isa = PBXNativeTarget; | ||
| 129 | + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; | ||
| 130 | + buildPhases = ( | ||
| 131 | + 331C807D294A63A400263BE5 /* Sources */, | ||
| 132 | + 331C807F294A63A400263BE5 /* Resources */, | ||
| 133 | + ); | ||
| 134 | + buildRules = ( | ||
| 135 | + ); | ||
| 136 | + dependencies = ( | ||
| 137 | + 331C8086294A63A400263BE5 /* PBXTargetDependency */, | ||
| 138 | + ); | ||
| 139 | + name = RunnerTests; | ||
| 140 | + productName = RunnerTests; | ||
| 141 | + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; | ||
| 142 | + productType = "com.apple.product-type.bundle.unit-test"; | ||
| 143 | + }; | ||
| 144 | + 97C146ED1CF9000F007C117D /* Runner */ = { | ||
| 145 | + isa = PBXNativeTarget; | ||
| 146 | + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; | ||
| 147 | + buildPhases = ( | ||
| 148 | + 9740EEB61CF901F6004384FC /* Run Script */, | ||
| 149 | + 97C146EA1CF9000F007C117D /* Sources */, | ||
| 150 | + 97C146EB1CF9000F007C117D /* Frameworks */, | ||
| 151 | + 97C146EC1CF9000F007C117D /* Resources */, | ||
| 152 | + 9705A1C41CF9048500538489 /* Embed Frameworks */, | ||
| 153 | + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, | ||
| 154 | + ); | ||
| 155 | + buildRules = ( | ||
| 156 | + ); | ||
| 157 | + dependencies = ( | ||
| 158 | + ); | ||
| 159 | + name = Runner; | ||
| 160 | + productName = Runner; | ||
| 161 | + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; | ||
| 162 | + productType = "com.apple.product-type.application"; | ||
| 163 | + }; | ||
| 164 | +/* End PBXNativeTarget section */ | ||
| 165 | + | ||
| 166 | +/* Begin PBXProject section */ | ||
| 167 | + 97C146E61CF9000F007C117D /* Project object */ = { | ||
| 168 | + isa = PBXProject; | ||
| 169 | + attributes = { | ||
| 170 | + BuildIndependentTargetsInParallel = YES; | ||
| 171 | + LastUpgradeCheck = 1510; | ||
| 172 | + ORGANIZATIONNAME = ""; | ||
| 173 | + TargetAttributes = { | ||
| 174 | + 331C8080294A63A400263BE5 = { | ||
| 175 | + CreatedOnToolsVersion = 14.0; | ||
| 176 | + TestTargetID = 97C146ED1CF9000F007C117D; | ||
| 177 | + }; | ||
| 178 | + 97C146ED1CF9000F007C117D = { | ||
| 179 | + CreatedOnToolsVersion = 7.3.1; | ||
| 180 | + LastSwiftMigration = 1100; | ||
| 181 | + }; | ||
| 182 | + }; | ||
| 183 | + }; | ||
| 184 | + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; | ||
| 185 | + compatibilityVersion = "Xcode 9.3"; | ||
| 186 | + developmentRegion = en; | ||
| 187 | + hasScannedForEncodings = 0; | ||
| 188 | + knownRegions = ( | ||
| 189 | + en, | ||
| 190 | + Base, | ||
| 191 | + ); | ||
| 192 | + mainGroup = 97C146E51CF9000F007C117D; | ||
| 193 | + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; | ||
| 194 | + projectDirPath = ""; | ||
| 195 | + projectRoot = ""; | ||
| 196 | + targets = ( | ||
| 197 | + 97C146ED1CF9000F007C117D /* Runner */, | ||
| 198 | + 331C8080294A63A400263BE5 /* RunnerTests */, | ||
| 199 | + ); | ||
| 200 | + }; | ||
| 201 | +/* End PBXProject section */ | ||
| 202 | + | ||
| 203 | +/* Begin PBXResourcesBuildPhase section */ | ||
| 204 | + 331C807F294A63A400263BE5 /* Resources */ = { | ||
| 205 | + isa = PBXResourcesBuildPhase; | ||
| 206 | + buildActionMask = 2147483647; | ||
| 207 | + files = ( | ||
| 208 | + ); | ||
| 209 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 210 | + }; | ||
| 211 | + 97C146EC1CF9000F007C117D /* Resources */ = { | ||
| 212 | + isa = PBXResourcesBuildPhase; | ||
| 213 | + buildActionMask = 2147483647; | ||
| 214 | + files = ( | ||
| 215 | + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, | ||
| 216 | + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, | ||
| 217 | + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, | ||
| 218 | + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, | ||
| 219 | + ); | ||
| 220 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 221 | + }; | ||
| 222 | +/* End PBXResourcesBuildPhase section */ | ||
| 223 | + | ||
| 224 | +/* Begin PBXShellScriptBuildPhase section */ | ||
| 225 | + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { | ||
| 226 | + isa = PBXShellScriptBuildPhase; | ||
| 227 | + alwaysOutOfDate = 1; | ||
| 228 | + buildActionMask = 2147483647; | ||
| 229 | + files = ( | ||
| 230 | + ); | ||
| 231 | + inputPaths = ( | ||
| 232 | + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", | ||
| 233 | + ); | ||
| 234 | + name = "Thin Binary"; | ||
| 235 | + outputPaths = ( | ||
| 236 | + ); | ||
| 237 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 238 | + shellPath = /bin/sh; | ||
| 239 | + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; | ||
| 240 | + }; | ||
| 241 | + 9740EEB61CF901F6004384FC /* Run Script */ = { | ||
| 242 | + isa = PBXShellScriptBuildPhase; | ||
| 243 | + alwaysOutOfDate = 1; | ||
| 244 | + buildActionMask = 2147483647; | ||
| 245 | + files = ( | ||
| 246 | + ); | ||
| 247 | + inputPaths = ( | ||
| 248 | + ); | ||
| 249 | + name = "Run Script"; | ||
| 250 | + outputPaths = ( | ||
| 251 | + ); | ||
| 252 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 253 | + shellPath = /bin/sh; | ||
| 254 | + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; | ||
| 255 | + }; | ||
| 256 | +/* End PBXShellScriptBuildPhase section */ | ||
| 257 | + | ||
| 258 | +/* Begin PBXSourcesBuildPhase section */ | ||
| 259 | + 331C807D294A63A400263BE5 /* Sources */ = { | ||
| 260 | + isa = PBXSourcesBuildPhase; | ||
| 261 | + buildActionMask = 2147483647; | ||
| 262 | + files = ( | ||
| 263 | + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, | ||
| 264 | + ); | ||
| 265 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 266 | + }; | ||
| 267 | + 97C146EA1CF9000F007C117D /* Sources */ = { | ||
| 268 | + isa = PBXSourcesBuildPhase; | ||
| 269 | + buildActionMask = 2147483647; | ||
| 270 | + files = ( | ||
| 271 | + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, | ||
| 272 | + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, | ||
| 273 | + ); | ||
| 274 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 275 | + }; | ||
| 276 | +/* End PBXSourcesBuildPhase section */ | ||
| 277 | + | ||
| 278 | +/* Begin PBXTargetDependency section */ | ||
| 279 | + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { | ||
| 280 | + isa = PBXTargetDependency; | ||
| 281 | + target = 97C146ED1CF9000F007C117D /* Runner */; | ||
| 282 | + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; | ||
| 283 | + }; | ||
| 284 | +/* End PBXTargetDependency section */ | ||
| 285 | + | ||
| 286 | +/* Begin PBXVariantGroup section */ | ||
| 287 | + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { | ||
| 288 | + isa = PBXVariantGroup; | ||
| 289 | + children = ( | ||
| 290 | + 97C146FB1CF9000F007C117D /* Base */, | ||
| 291 | + ); | ||
| 292 | + name = Main.storyboard; | ||
| 293 | + sourceTree = "<group>"; | ||
| 294 | + }; | ||
| 295 | + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { | ||
| 296 | + isa = PBXVariantGroup; | ||
| 297 | + children = ( | ||
| 298 | + 97C147001CF9000F007C117D /* Base */, | ||
| 299 | + ); | ||
| 300 | + name = LaunchScreen.storyboard; | ||
| 301 | + sourceTree = "<group>"; | ||
| 302 | + }; | ||
| 303 | +/* End PBXVariantGroup section */ | ||
| 304 | + | ||
| 305 | +/* Begin XCBuildConfiguration section */ | ||
| 306 | + 249021D3217E4FDB00AE95B9 /* Profile */ = { | ||
| 307 | + isa = XCBuildConfiguration; | ||
| 308 | + buildSettings = { | ||
| 309 | + ALWAYS_SEARCH_USER_PATHS = NO; | ||
| 310 | + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; | ||
| 311 | + CLANG_ANALYZER_NONNULL = YES; | ||
| 312 | + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | ||
| 313 | + CLANG_CXX_LIBRARY = "libc++"; | ||
| 314 | + CLANG_ENABLE_MODULES = YES; | ||
| 315 | + CLANG_ENABLE_OBJC_ARC = YES; | ||
| 316 | + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | ||
| 317 | + CLANG_WARN_BOOL_CONVERSION = YES; | ||
| 318 | + CLANG_WARN_COMMA = YES; | ||
| 319 | + CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
| 320 | + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | ||
| 321 | + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
| 322 | + CLANG_WARN_EMPTY_BODY = YES; | ||
| 323 | + CLANG_WARN_ENUM_CONVERSION = YES; | ||
| 324 | + CLANG_WARN_INFINITE_RECURSION = YES; | ||
| 325 | + CLANG_WARN_INT_CONVERSION = YES; | ||
| 326 | + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | ||
| 327 | + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | ||
| 328 | + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | ||
| 329 | + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
| 330 | + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | ||
| 331 | + CLANG_WARN_STRICT_PROTOTYPES = YES; | ||
| 332 | + CLANG_WARN_SUSPICIOUS_MOVE = YES; | ||
| 333 | + CLANG_WARN_UNREACHABLE_CODE = YES; | ||
| 334 | + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
| 335 | + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||
| 336 | + COPY_PHASE_STRIP = NO; | ||
| 337 | + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | ||
| 338 | + ENABLE_NS_ASSERTIONS = NO; | ||
| 339 | + ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
| 340 | + ENABLE_USER_SCRIPT_SANDBOXING = NO; | ||
| 341 | + GCC_C_LANGUAGE_STANDARD = gnu99; | ||
| 342 | + GCC_NO_COMMON_BLOCKS = YES; | ||
| 343 | + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
| 344 | + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
| 345 | + GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
| 346 | + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
| 347 | + GCC_WARN_UNUSED_FUNCTION = YES; | ||
| 348 | + GCC_WARN_UNUSED_VARIABLE = YES; | ||
| 349 | + IPHONEOS_DEPLOYMENT_TARGET = 12.0; | ||
| 350 | + MTL_ENABLE_DEBUG_INFO = NO; | ||
| 351 | + SDKROOT = iphoneos; | ||
| 352 | + SUPPORTED_PLATFORMS = iphoneos; | ||
| 353 | + TARGETED_DEVICE_FAMILY = "1,2"; | ||
| 354 | + VALIDATE_PRODUCT = YES; | ||
| 355 | + }; | ||
| 356 | + name = Profile; | ||
| 357 | + }; | ||
| 358 | + 249021D4217E4FDB00AE95B9 /* Profile */ = { | ||
| 359 | + isa = XCBuildConfiguration; | ||
| 360 | + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; | ||
| 361 | + buildSettings = { | ||
| 362 | + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
| 363 | + CLANG_ENABLE_MODULES = YES; | ||
| 364 | + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; | ||
| 365 | + DEVELOPMENT_TEAM = N5ZH3Z63A6; | ||
| 366 | + ENABLE_BITCODE = NO; | ||
| 367 | + INFOPLIST_FILE = Runner/Info.plist; | ||
| 368 | + LD_RUNPATH_SEARCH_PATHS = ( | ||
| 369 | + "$(inherited)", | ||
| 370 | + "@executable_path/Frameworks", | ||
| 371 | + ); | ||
| 372 | + PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.tts; | ||
| 373 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 374 | + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | ||
| 375 | + SWIFT_VERSION = 5.0; | ||
| 376 | + VERSIONING_SYSTEM = "apple-generic"; | ||
| 377 | + }; | ||
| 378 | + name = Profile; | ||
| 379 | + }; | ||
| 380 | + 331C8088294A63A400263BE5 /* Debug */ = { | ||
| 381 | + isa = XCBuildConfiguration; | ||
| 382 | + buildSettings = { | ||
| 383 | + BUNDLE_LOADER = "$(TEST_HOST)"; | ||
| 384 | + CODE_SIGN_STYLE = Automatic; | ||
| 385 | + CURRENT_PROJECT_VERSION = 1; | ||
| 386 | + GENERATE_INFOPLIST_FILE = YES; | ||
| 387 | + MARKETING_VERSION = 1.0; | ||
| 388 | + PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.tts.RunnerTests; | ||
| 389 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 390 | + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; | ||
| 391 | + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | ||
| 392 | + SWIFT_VERSION = 5.0; | ||
| 393 | + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; | ||
| 394 | + }; | ||
| 395 | + name = Debug; | ||
| 396 | + }; | ||
| 397 | + 331C8089294A63A400263BE5 /* Release */ = { | ||
| 398 | + isa = XCBuildConfiguration; | ||
| 399 | + buildSettings = { | ||
| 400 | + BUNDLE_LOADER = "$(TEST_HOST)"; | ||
| 401 | + CODE_SIGN_STYLE = Automatic; | ||
| 402 | + CURRENT_PROJECT_VERSION = 1; | ||
| 403 | + GENERATE_INFOPLIST_FILE = YES; | ||
| 404 | + MARKETING_VERSION = 1.0; | ||
| 405 | + PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.tts.RunnerTests; | ||
| 406 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 407 | + SWIFT_VERSION = 5.0; | ||
| 408 | + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; | ||
| 409 | + }; | ||
| 410 | + name = Release; | ||
| 411 | + }; | ||
| 412 | + 331C808A294A63A400263BE5 /* Profile */ = { | ||
| 413 | + isa = XCBuildConfiguration; | ||
| 414 | + buildSettings = { | ||
| 415 | + BUNDLE_LOADER = "$(TEST_HOST)"; | ||
| 416 | + CODE_SIGN_STYLE = Automatic; | ||
| 417 | + CURRENT_PROJECT_VERSION = 1; | ||
| 418 | + GENERATE_INFOPLIST_FILE = YES; | ||
| 419 | + MARKETING_VERSION = 1.0; | ||
| 420 | + PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.tts.RunnerTests; | ||
| 421 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 422 | + SWIFT_VERSION = 5.0; | ||
| 423 | + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; | ||
| 424 | + }; | ||
| 425 | + name = Profile; | ||
| 426 | + }; | ||
| 427 | + 97C147031CF9000F007C117D /* Debug */ = { | ||
| 428 | + isa = XCBuildConfiguration; | ||
| 429 | + buildSettings = { | ||
| 430 | + ALWAYS_SEARCH_USER_PATHS = NO; | ||
| 431 | + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; | ||
| 432 | + CLANG_ANALYZER_NONNULL = YES; | ||
| 433 | + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | ||
| 434 | + CLANG_CXX_LIBRARY = "libc++"; | ||
| 435 | + CLANG_ENABLE_MODULES = YES; | ||
| 436 | + CLANG_ENABLE_OBJC_ARC = YES; | ||
| 437 | + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | ||
| 438 | + CLANG_WARN_BOOL_CONVERSION = YES; | ||
| 439 | + CLANG_WARN_COMMA = YES; | ||
| 440 | + CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
| 441 | + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | ||
| 442 | + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
| 443 | + CLANG_WARN_EMPTY_BODY = YES; | ||
| 444 | + CLANG_WARN_ENUM_CONVERSION = YES; | ||
| 445 | + CLANG_WARN_INFINITE_RECURSION = YES; | ||
| 446 | + CLANG_WARN_INT_CONVERSION = YES; | ||
| 447 | + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | ||
| 448 | + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | ||
| 449 | + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | ||
| 450 | + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
| 451 | + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | ||
| 452 | + CLANG_WARN_STRICT_PROTOTYPES = YES; | ||
| 453 | + CLANG_WARN_SUSPICIOUS_MOVE = YES; | ||
| 454 | + CLANG_WARN_UNREACHABLE_CODE = YES; | ||
| 455 | + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
| 456 | + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||
| 457 | + COPY_PHASE_STRIP = NO; | ||
| 458 | + DEBUG_INFORMATION_FORMAT = dwarf; | ||
| 459 | + ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
| 460 | + ENABLE_TESTABILITY = YES; | ||
| 461 | + ENABLE_USER_SCRIPT_SANDBOXING = NO; | ||
| 462 | + GCC_C_LANGUAGE_STANDARD = gnu99; | ||
| 463 | + GCC_DYNAMIC_NO_PIC = NO; | ||
| 464 | + GCC_NO_COMMON_BLOCKS = YES; | ||
| 465 | + GCC_OPTIMIZATION_LEVEL = 0; | ||
| 466 | + GCC_PREPROCESSOR_DEFINITIONS = ( | ||
| 467 | + "DEBUG=1", | ||
| 468 | + "$(inherited)", | ||
| 469 | + ); | ||
| 470 | + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
| 471 | + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
| 472 | + GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
| 473 | + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
| 474 | + GCC_WARN_UNUSED_FUNCTION = YES; | ||
| 475 | + GCC_WARN_UNUSED_VARIABLE = YES; | ||
| 476 | + IPHONEOS_DEPLOYMENT_TARGET = 12.0; | ||
| 477 | + MTL_ENABLE_DEBUG_INFO = YES; | ||
| 478 | + ONLY_ACTIVE_ARCH = YES; | ||
| 479 | + SDKROOT = iphoneos; | ||
| 480 | + TARGETED_DEVICE_FAMILY = "1,2"; | ||
| 481 | + }; | ||
| 482 | + name = Debug; | ||
| 483 | + }; | ||
| 484 | + 97C147041CF9000F007C117D /* Release */ = { | ||
| 485 | + isa = XCBuildConfiguration; | ||
| 486 | + buildSettings = { | ||
| 487 | + ALWAYS_SEARCH_USER_PATHS = NO; | ||
| 488 | + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; | ||
| 489 | + CLANG_ANALYZER_NONNULL = YES; | ||
| 490 | + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; | ||
| 491 | + CLANG_CXX_LIBRARY = "libc++"; | ||
| 492 | + CLANG_ENABLE_MODULES = YES; | ||
| 493 | + CLANG_ENABLE_OBJC_ARC = YES; | ||
| 494 | + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | ||
| 495 | + CLANG_WARN_BOOL_CONVERSION = YES; | ||
| 496 | + CLANG_WARN_COMMA = YES; | ||
| 497 | + CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
| 498 | + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | ||
| 499 | + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
| 500 | + CLANG_WARN_EMPTY_BODY = YES; | ||
| 501 | + CLANG_WARN_ENUM_CONVERSION = YES; | ||
| 502 | + CLANG_WARN_INFINITE_RECURSION = YES; | ||
| 503 | + CLANG_WARN_INT_CONVERSION = YES; | ||
| 504 | + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | ||
| 505 | + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | ||
| 506 | + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | ||
| 507 | + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
| 508 | + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | ||
| 509 | + CLANG_WARN_STRICT_PROTOTYPES = YES; | ||
| 510 | + CLANG_WARN_SUSPICIOUS_MOVE = YES; | ||
| 511 | + CLANG_WARN_UNREACHABLE_CODE = YES; | ||
| 512 | + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
| 513 | + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; | ||
| 514 | + COPY_PHASE_STRIP = NO; | ||
| 515 | + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | ||
| 516 | + ENABLE_NS_ASSERTIONS = NO; | ||
| 517 | + ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
| 518 | + ENABLE_USER_SCRIPT_SANDBOXING = NO; | ||
| 519 | + GCC_C_LANGUAGE_STANDARD = gnu99; | ||
| 520 | + GCC_NO_COMMON_BLOCKS = YES; | ||
| 521 | + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
| 522 | + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
| 523 | + GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
| 524 | + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
| 525 | + GCC_WARN_UNUSED_FUNCTION = YES; | ||
| 526 | + GCC_WARN_UNUSED_VARIABLE = YES; | ||
| 527 | + IPHONEOS_DEPLOYMENT_TARGET = 12.0; | ||
| 528 | + MTL_ENABLE_DEBUG_INFO = NO; | ||
| 529 | + SDKROOT = iphoneos; | ||
| 530 | + SUPPORTED_PLATFORMS = iphoneos; | ||
| 531 | + SWIFT_COMPILATION_MODE = wholemodule; | ||
| 532 | + SWIFT_OPTIMIZATION_LEVEL = "-O"; | ||
| 533 | + TARGETED_DEVICE_FAMILY = "1,2"; | ||
| 534 | + VALIDATE_PRODUCT = YES; | ||
| 535 | + }; | ||
| 536 | + name = Release; | ||
| 537 | + }; | ||
| 538 | + 97C147061CF9000F007C117D /* Debug */ = { | ||
| 539 | + isa = XCBuildConfiguration; | ||
| 540 | + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; | ||
| 541 | + buildSettings = { | ||
| 542 | + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
| 543 | + CLANG_ENABLE_MODULES = YES; | ||
| 544 | + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; | ||
| 545 | + DEVELOPMENT_TEAM = N5ZH3Z63A6; | ||
| 546 | + ENABLE_BITCODE = NO; | ||
| 547 | + INFOPLIST_FILE = Runner/Info.plist; | ||
| 548 | + LD_RUNPATH_SEARCH_PATHS = ( | ||
| 549 | + "$(inherited)", | ||
| 550 | + "@executable_path/Frameworks", | ||
| 551 | + ); | ||
| 552 | + PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.tts; | ||
| 553 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 554 | + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | ||
| 555 | + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | ||
| 556 | + SWIFT_VERSION = 5.0; | ||
| 557 | + VERSIONING_SYSTEM = "apple-generic"; | ||
| 558 | + }; | ||
| 559 | + name = Debug; | ||
| 560 | + }; | ||
| 561 | + 97C147071CF9000F007C117D /* Release */ = { | ||
| 562 | + isa = XCBuildConfiguration; | ||
| 563 | + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; | ||
| 564 | + buildSettings = { | ||
| 565 | + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
| 566 | + CLANG_ENABLE_MODULES = YES; | ||
| 567 | + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; | ||
| 568 | + DEVELOPMENT_TEAM = N5ZH3Z63A6; | ||
| 569 | + ENABLE_BITCODE = NO; | ||
| 570 | + INFOPLIST_FILE = Runner/Info.plist; | ||
| 571 | + LD_RUNPATH_SEARCH_PATHS = ( | ||
| 572 | + "$(inherited)", | ||
| 573 | + "@executable_path/Frameworks", | ||
| 574 | + ); | ||
| 575 | + PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.tts; | ||
| 576 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 577 | + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | ||
| 578 | + SWIFT_VERSION = 5.0; | ||
| 579 | + VERSIONING_SYSTEM = "apple-generic"; | ||
| 580 | + }; | ||
| 581 | + name = Release; | ||
| 582 | + }; | ||
| 583 | +/* End XCBuildConfiguration section */ | ||
| 584 | + | ||
| 585 | +/* Begin XCConfigurationList section */ | ||
| 586 | + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { | ||
| 587 | + isa = XCConfigurationList; | ||
| 588 | + buildConfigurations = ( | ||
| 589 | + 331C8088294A63A400263BE5 /* Debug */, | ||
| 590 | + 331C8089294A63A400263BE5 /* Release */, | ||
| 591 | + 331C808A294A63A400263BE5 /* Profile */, | ||
| 592 | + ); | ||
| 593 | + defaultConfigurationIsVisible = 0; | ||
| 594 | + defaultConfigurationName = Release; | ||
| 595 | + }; | ||
| 596 | + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { | ||
| 597 | + isa = XCConfigurationList; | ||
| 598 | + buildConfigurations = ( | ||
| 599 | + 97C147031CF9000F007C117D /* Debug */, | ||
| 600 | + 97C147041CF9000F007C117D /* Release */, | ||
| 601 | + 249021D3217E4FDB00AE95B9 /* Profile */, | ||
| 602 | + ); | ||
| 603 | + defaultConfigurationIsVisible = 0; | ||
| 604 | + defaultConfigurationName = Release; | ||
| 605 | + }; | ||
| 606 | + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { | ||
| 607 | + isa = XCConfigurationList; | ||
| 608 | + buildConfigurations = ( | ||
| 609 | + 97C147061CF9000F007C117D /* Debug */, | ||
| 610 | + 97C147071CF9000F007C117D /* Release */, | ||
| 611 | + 249021D4217E4FDB00AE95B9 /* Profile */, | ||
| 612 | + ); | ||
| 613 | + defaultConfigurationIsVisible = 0; | ||
| 614 | + defaultConfigurationName = Release; | ||
| 615 | + }; | ||
| 616 | +/* End XCConfigurationList section */ | ||
| 617 | + }; | ||
| 618 | + rootObject = 97C146E61CF9000F007C117D /* Project object */; | ||
| 619 | +} |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<Scheme | ||
| 3 | + LastUpgradeVersion = "1510" | ||
| 4 | + version = "1.3"> | ||
| 5 | + <BuildAction | ||
| 6 | + parallelizeBuildables = "YES" | ||
| 7 | + buildImplicitDependencies = "YES"> | ||
| 8 | + <BuildActionEntries> | ||
| 9 | + <BuildActionEntry | ||
| 10 | + buildForTesting = "YES" | ||
| 11 | + buildForRunning = "YES" | ||
| 12 | + buildForProfiling = "YES" | ||
| 13 | + buildForArchiving = "YES" | ||
| 14 | + buildForAnalyzing = "YES"> | ||
| 15 | + <BuildableReference | ||
| 16 | + BuildableIdentifier = "primary" | ||
| 17 | + BlueprintIdentifier = "97C146ED1CF9000F007C117D" | ||
| 18 | + BuildableName = "Runner.app" | ||
| 19 | + BlueprintName = "Runner" | ||
| 20 | + ReferencedContainer = "container:Runner.xcodeproj"> | ||
| 21 | + </BuildableReference> | ||
| 22 | + </BuildActionEntry> | ||
| 23 | + </BuildActionEntries> | ||
| 24 | + </BuildAction> | ||
| 25 | + <TestAction | ||
| 26 | + buildConfiguration = "Debug" | ||
| 27 | + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| 28 | + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| 29 | + shouldUseLaunchSchemeArgsEnv = "YES"> | ||
| 30 | + <MacroExpansion> | ||
| 31 | + <BuildableReference | ||
| 32 | + BuildableIdentifier = "primary" | ||
| 33 | + BlueprintIdentifier = "97C146ED1CF9000F007C117D" | ||
| 34 | + BuildableName = "Runner.app" | ||
| 35 | + BlueprintName = "Runner" | ||
| 36 | + ReferencedContainer = "container:Runner.xcodeproj"> | ||
| 37 | + </BuildableReference> | ||
| 38 | + </MacroExpansion> | ||
| 39 | + <Testables> | ||
| 40 | + <TestableReference | ||
| 41 | + skipped = "NO" | ||
| 42 | + parallelizable = "YES"> | ||
| 43 | + <BuildableReference | ||
| 44 | + BuildableIdentifier = "primary" | ||
| 45 | + BlueprintIdentifier = "331C8080294A63A400263BE5" | ||
| 46 | + BuildableName = "RunnerTests.xctest" | ||
| 47 | + BlueprintName = "RunnerTests" | ||
| 48 | + ReferencedContainer = "container:Runner.xcodeproj"> | ||
| 49 | + </BuildableReference> | ||
| 50 | + </TestableReference> | ||
| 51 | + </Testables> | ||
| 52 | + </TestAction> | ||
| 53 | + <LaunchAction | ||
| 54 | + buildConfiguration = "Debug" | ||
| 55 | + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| 56 | + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| 57 | + launchStyle = "0" | ||
| 58 | + useCustomWorkingDirectory = "NO" | ||
| 59 | + ignoresPersistentStateOnLaunch = "NO" | ||
| 60 | + debugDocumentVersioning = "YES" | ||
| 61 | + debugServiceExtension = "internal" | ||
| 62 | + allowLocationSimulation = "YES"> | ||
| 63 | + <BuildableProductRunnable | ||
| 64 | + runnableDebuggingMode = "0"> | ||
| 65 | + <BuildableReference | ||
| 66 | + BuildableIdentifier = "primary" | ||
| 67 | + BlueprintIdentifier = "97C146ED1CF9000F007C117D" | ||
| 68 | + BuildableName = "Runner.app" | ||
| 69 | + BlueprintName = "Runner" | ||
| 70 | + ReferencedContainer = "container:Runner.xcodeproj"> | ||
| 71 | + </BuildableReference> | ||
| 72 | + </BuildableProductRunnable> | ||
| 73 | + </LaunchAction> | ||
| 74 | + <ProfileAction | ||
| 75 | + buildConfiguration = "Profile" | ||
| 76 | + shouldUseLaunchSchemeArgsEnv = "YES" | ||
| 77 | + savedToolIdentifier = "" | ||
| 78 | + useCustomWorkingDirectory = "NO" | ||
| 79 | + debugDocumentVersioning = "YES"> | ||
| 80 | + <BuildableProductRunnable | ||
| 81 | + runnableDebuggingMode = "0"> | ||
| 82 | + <BuildableReference | ||
| 83 | + BuildableIdentifier = "primary" | ||
| 84 | + BlueprintIdentifier = "97C146ED1CF9000F007C117D" | ||
| 85 | + BuildableName = "Runner.app" | ||
| 86 | + BlueprintName = "Runner" | ||
| 87 | + ReferencedContainer = "container:Runner.xcodeproj"> | ||
| 88 | + </BuildableReference> | ||
| 89 | + </BuildableProductRunnable> | ||
| 90 | + </ProfileAction> | ||
| 91 | + <AnalyzeAction | ||
| 92 | + buildConfiguration = "Debug"> | ||
| 93 | + </AnalyzeAction> | ||
| 94 | + <ArchiveAction | ||
| 95 | + buildConfiguration = "Release" | ||
| 96 | + revealArchiveInOrganizer = "YES"> | ||
| 97 | + </ArchiveAction> | ||
| 98 | +</Scheme> |
| 1 | +import Flutter | ||
| 2 | +import UIKit | ||
| 3 | + | ||
| 4 | +@UIApplicationMain | ||
| 5 | +@objc class AppDelegate: FlutterAppDelegate { | ||
| 6 | + override func application( | ||
| 7 | + _ application: UIApplication, | ||
| 8 | + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? | ||
| 9 | + ) -> Bool { | ||
| 10 | + GeneratedPluginRegistrant.register(with: self) | ||
| 11 | + return super.application(application, didFinishLaunchingWithOptions: launchOptions) | ||
| 12 | + } | ||
| 13 | +} |
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "size" : "20x20", | ||
| 5 | + "idiom" : "iphone", | ||
| 6 | + "filename" : "Icon-App-20x20@2x.png", | ||
| 7 | + "scale" : "2x" | ||
| 8 | + }, | ||
| 9 | + { | ||
| 10 | + "size" : "20x20", | ||
| 11 | + "idiom" : "iphone", | ||
| 12 | + "filename" : "Icon-App-20x20@3x.png", | ||
| 13 | + "scale" : "3x" | ||
| 14 | + }, | ||
| 15 | + { | ||
| 16 | + "size" : "29x29", | ||
| 17 | + "idiom" : "iphone", | ||
| 18 | + "filename" : "Icon-App-29x29@1x.png", | ||
| 19 | + "scale" : "1x" | ||
| 20 | + }, | ||
| 21 | + { | ||
| 22 | + "size" : "29x29", | ||
| 23 | + "idiom" : "iphone", | ||
| 24 | + "filename" : "Icon-App-29x29@2x.png", | ||
| 25 | + "scale" : "2x" | ||
| 26 | + }, | ||
| 27 | + { | ||
| 28 | + "size" : "29x29", | ||
| 29 | + "idiom" : "iphone", | ||
| 30 | + "filename" : "Icon-App-29x29@3x.png", | ||
| 31 | + "scale" : "3x" | ||
| 32 | + }, | ||
| 33 | + { | ||
| 34 | + "size" : "40x40", | ||
| 35 | + "idiom" : "iphone", | ||
| 36 | + "filename" : "Icon-App-40x40@2x.png", | ||
| 37 | + "scale" : "2x" | ||
| 38 | + }, | ||
| 39 | + { | ||
| 40 | + "size" : "40x40", | ||
| 41 | + "idiom" : "iphone", | ||
| 42 | + "filename" : "Icon-App-40x40@3x.png", | ||
| 43 | + "scale" : "3x" | ||
| 44 | + }, | ||
| 45 | + { | ||
| 46 | + "size" : "60x60", | ||
| 47 | + "idiom" : "iphone", | ||
| 48 | + "filename" : "Icon-App-60x60@2x.png", | ||
| 49 | + "scale" : "2x" | ||
| 50 | + }, | ||
| 51 | + { | ||
| 52 | + "size" : "60x60", | ||
| 53 | + "idiom" : "iphone", | ||
| 54 | + "filename" : "Icon-App-60x60@3x.png", | ||
| 55 | + "scale" : "3x" | ||
| 56 | + }, | ||
| 57 | + { | ||
| 58 | + "size" : "20x20", | ||
| 59 | + "idiom" : "ipad", | ||
| 60 | + "filename" : "Icon-App-20x20@1x.png", | ||
| 61 | + "scale" : "1x" | ||
| 62 | + }, | ||
| 63 | + { | ||
| 64 | + "size" : "20x20", | ||
| 65 | + "idiom" : "ipad", | ||
| 66 | + "filename" : "Icon-App-20x20@2x.png", | ||
| 67 | + "scale" : "2x" | ||
| 68 | + }, | ||
| 69 | + { | ||
| 70 | + "size" : "29x29", | ||
| 71 | + "idiom" : "ipad", | ||
| 72 | + "filename" : "Icon-App-29x29@1x.png", | ||
| 73 | + "scale" : "1x" | ||
| 74 | + }, | ||
| 75 | + { | ||
| 76 | + "size" : "29x29", | ||
| 77 | + "idiom" : "ipad", | ||
| 78 | + "filename" : "Icon-App-29x29@2x.png", | ||
| 79 | + "scale" : "2x" | ||
| 80 | + }, | ||
| 81 | + { | ||
| 82 | + "size" : "40x40", | ||
| 83 | + "idiom" : "ipad", | ||
| 84 | + "filename" : "Icon-App-40x40@1x.png", | ||
| 85 | + "scale" : "1x" | ||
| 86 | + }, | ||
| 87 | + { | ||
| 88 | + "size" : "40x40", | ||
| 89 | + "idiom" : "ipad", | ||
| 90 | + "filename" : "Icon-App-40x40@2x.png", | ||
| 91 | + "scale" : "2x" | ||
| 92 | + }, | ||
| 93 | + { | ||
| 94 | + "size" : "76x76", | ||
| 95 | + "idiom" : "ipad", | ||
| 96 | + "filename" : "Icon-App-76x76@1x.png", | ||
| 97 | + "scale" : "1x" | ||
| 98 | + }, | ||
| 99 | + { | ||
| 100 | + "size" : "76x76", | ||
| 101 | + "idiom" : "ipad", | ||
| 102 | + "filename" : "Icon-App-76x76@2x.png", | ||
| 103 | + "scale" : "2x" | ||
| 104 | + }, | ||
| 105 | + { | ||
| 106 | + "size" : "83.5x83.5", | ||
| 107 | + "idiom" : "ipad", | ||
| 108 | + "filename" : "Icon-App-83.5x83.5@2x.png", | ||
| 109 | + "scale" : "2x" | ||
| 110 | + }, | ||
| 111 | + { | ||
| 112 | + "size" : "1024x1024", | ||
| 113 | + "idiom" : "ios-marketing", | ||
| 114 | + "filename" : "Icon-App-1024x1024@1x.png", | ||
| 115 | + "scale" : "1x" | ||
| 116 | + } | ||
| 117 | + ], | ||
| 118 | + "info" : { | ||
| 119 | + "version" : 1, | ||
| 120 | + "author" : "xcode" | ||
| 121 | + } | ||
| 122 | +} |
flutter-examples/tts/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
0 → 100644
10.7 KB
295 字节
406 字节
450 字节
282 字节
462 字节
704 字节
406 字节
586 字节
862 字节
862 字节
1.6 KB
762 字节
1.2 KB
flutter-examples/tts/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
0 → 100644
1.4 KB
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "filename" : "LaunchImage.png", | ||
| 6 | + "scale" : "1x" | ||
| 7 | + }, | ||
| 8 | + { | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "filename" : "LaunchImage@2x.png", | ||
| 11 | + "scale" : "2x" | ||
| 12 | + }, | ||
| 13 | + { | ||
| 14 | + "idiom" : "universal", | ||
| 15 | + "filename" : "LaunchImage@3x.png", | ||
| 16 | + "scale" : "3x" | ||
| 17 | + } | ||
| 18 | + ], | ||
| 19 | + "info" : { | ||
| 20 | + "version" : 1, | ||
| 21 | + "author" : "xcode" | ||
| 22 | + } | ||
| 23 | +} |
68 字节
68 字节
68 字节
| 1 | +# Launch Screen Assets | ||
| 2 | + | ||
| 3 | +You can customize the launch screen with your own desired assets by replacing the image files in this directory. | ||
| 4 | + | ||
| 5 | +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. |
| 1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
| 2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> | ||
| 3 | + <dependencies> | ||
| 4 | + <deployment identifier="iOS"/> | ||
| 5 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/> | ||
| 6 | + </dependencies> | ||
| 7 | + <scenes> | ||
| 8 | + <!--View Controller--> | ||
| 9 | + <scene sceneID="EHf-IW-A2E"> | ||
| 10 | + <objects> | ||
| 11 | + <viewController id="01J-lp-oVM" sceneMemberID="viewController"> | ||
| 12 | + <layoutGuides> | ||
| 13 | + <viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/> | ||
| 14 | + <viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/> | ||
| 15 | + </layoutGuides> | ||
| 16 | + <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> | ||
| 17 | + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
| 18 | + <subviews> | ||
| 19 | + <imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4"> | ||
| 20 | + </imageView> | ||
| 21 | + </subviews> | ||
| 22 | + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | ||
| 23 | + <constraints> | ||
| 24 | + <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/> | ||
| 25 | + <constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/> | ||
| 26 | + </constraints> | ||
| 27 | + </view> | ||
| 28 | + </viewController> | ||
| 29 | + <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
| 30 | + </objects> | ||
| 31 | + <point key="canvasLocation" x="53" y="375"/> | ||
| 32 | + </scene> | ||
| 33 | + </scenes> | ||
| 34 | + <resources> | ||
| 35 | + <image name="LaunchImage" width="168" height="185"/> | ||
| 36 | + </resources> | ||
| 37 | +</document> |
| 1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
| 2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r"> | ||
| 3 | + <dependencies> | ||
| 4 | + <deployment identifier="iOS"/> | ||
| 5 | + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/> | ||
| 6 | + </dependencies> | ||
| 7 | + <scenes> | ||
| 8 | + <!--Flutter View Controller--> | ||
| 9 | + <scene sceneID="tne-QT-ifu"> | ||
| 10 | + <objects> | ||
| 11 | + <viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController"> | ||
| 12 | + <layoutGuides> | ||
| 13 | + <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/> | ||
| 14 | + <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/> | ||
| 15 | + </layoutGuides> | ||
| 16 | + <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> | ||
| 17 | + <rect key="frame" x="0.0" y="0.0" width="600" height="600"/> | ||
| 18 | + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
| 19 | + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> | ||
| 20 | + </view> | ||
| 21 | + </viewController> | ||
| 22 | + <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> | ||
| 23 | + </objects> | ||
| 24 | + </scene> | ||
| 25 | + </scenes> | ||
| 26 | +</document> |
flutter-examples/tts/ios/Runner/Info.plist
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| 3 | +<plist version="1.0"> | ||
| 4 | +<dict> | ||
| 5 | + <key>CFBundleDevelopmentRegion</key> | ||
| 6 | + <string>$(DEVELOPMENT_LANGUAGE)</string> | ||
| 7 | + <key>CFBundleDisplayName</key> | ||
| 8 | + <string>Tts</string> | ||
| 9 | + <key>CFBundleExecutable</key> | ||
| 10 | + <string>$(EXECUTABLE_NAME)</string> | ||
| 11 | + <key>CFBundleIdentifier</key> | ||
| 12 | + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
| 13 | + <key>CFBundleInfoDictionaryVersion</key> | ||
| 14 | + <string>6.0</string> | ||
| 15 | + <key>CFBundleName</key> | ||
| 16 | + <string>tts</string> | ||
| 17 | + <key>CFBundlePackageType</key> | ||
| 18 | + <string>APPL</string> | ||
| 19 | + <key>CFBundleShortVersionString</key> | ||
| 20 | + <string>$(FLUTTER_BUILD_NAME)</string> | ||
| 21 | + <key>CFBundleSignature</key> | ||
| 22 | + <string>????</string> | ||
| 23 | + <key>CFBundleVersion</key> | ||
| 24 | + <string>$(FLUTTER_BUILD_NUMBER)</string> | ||
| 25 | + <key>LSRequiresIPhoneOS</key> | ||
| 26 | + <true/> | ||
| 27 | + <key>UILaunchStoryboardName</key> | ||
| 28 | + <string>LaunchScreen</string> | ||
| 29 | + <key>UIMainStoryboardFile</key> | ||
| 30 | + <string>Main</string> | ||
| 31 | + <key>UISupportedInterfaceOrientations</key> | ||
| 32 | + <array> | ||
| 33 | + <string>UIInterfaceOrientationPortrait</string> | ||
| 34 | + <string>UIInterfaceOrientationLandscapeLeft</string> | ||
| 35 | + <string>UIInterfaceOrientationLandscapeRight</string> | ||
| 36 | + </array> | ||
| 37 | + <key>UISupportedInterfaceOrientations~ipad</key> | ||
| 38 | + <array> | ||
| 39 | + <string>UIInterfaceOrientationPortrait</string> | ||
| 40 | + <string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
| 41 | + <string>UIInterfaceOrientationLandscapeLeft</string> | ||
| 42 | + <string>UIInterfaceOrientationLandscapeRight</string> | ||
| 43 | + </array> | ||
| 44 | + <key>CADisableMinimumFrameDurationOnPhone</key> | ||
| 45 | + <true/> | ||
| 46 | + <key>UIApplicationSupportsIndirectInputEvents</key> | ||
| 47 | + <true/> | ||
| 48 | +</dict> | ||
| 49 | +</plist> |
| 1 | +#import "GeneratedPluginRegistrant.h" |
| 1 | +import Flutter | ||
| 2 | +import UIKit | ||
| 3 | +import XCTest | ||
| 4 | + | ||
| 5 | +class RunnerTests: XCTestCase { | ||
| 6 | + | ||
| 7 | + func testExample() { | ||
| 8 | + // If you add code to the Runner application, consider adding tests here. | ||
| 9 | + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. | ||
| 10 | + } | ||
| 11 | + | ||
| 12 | +} |
flutter-examples/tts/lib/info.dart
0 → 100644
| 1 | +// Copyright (c) 2024 Xiaomi Corporation | ||
| 2 | +import 'package:flutter/material.dart'; | ||
| 3 | +import 'package:url_launcher/url_launcher.dart'; | ||
| 4 | + | ||
| 5 | +class InfoScreen extends StatelessWidget { | ||
| 6 | + @override | ||
| 7 | + Widget build(BuildContext context) { | ||
| 8 | + const double height = 20; | ||
| 9 | + return Container( | ||
| 10 | + child: Padding( | ||
| 11 | + padding: const EdgeInsets.all(8.0), | ||
| 12 | + child: Column( | ||
| 13 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 14 | + children: <Widget>[ | ||
| 15 | + Text('Everything is open-sourced.'), | ||
| 16 | + SizedBox(height: height), | ||
| 17 | + InkWell( | ||
| 18 | + child: Text('Code: https://github.com/k2-fsa/sherpa-onnx'), | ||
| 19 | + onTap: () => launch('https://k2-fsa.github.io/sherpa/onnx/'), | ||
| 20 | + ), | ||
| 21 | + SizedBox(height: height), | ||
| 22 | + InkWell( | ||
| 23 | + child: Text('Doc: https://k2-fsa.github.io/sherpa/onnx/'), | ||
| 24 | + onTap: () => launch('https://k2-fsa.github.io/sherpa/onnx/'), | ||
| 25 | + ), | ||
| 26 | + SizedBox(height: height), | ||
| 27 | + Text('QQ 群: 744602236'), | ||
| 28 | + SizedBox(height: height), | ||
| 29 | + InkWell( | ||
| 30 | + child: Text( | ||
| 31 | + '微信群: https://k2-fsa.github.io/sherpa/social-groups.html'), | ||
| 32 | + onTap: () => | ||
| 33 | + launch('https://k2-fsa.github.io/sherpa/social-groups.html'), | ||
| 34 | + ), | ||
| 35 | + ], | ||
| 36 | + ), | ||
| 37 | + ), | ||
| 38 | + ); | ||
| 39 | + } | ||
| 40 | +} |
flutter-examples/tts/lib/main.dart
0 → 100644
| 1 | +// Copyright (c) 2024 Xiaomi Corporation | ||
| 2 | +import 'package:flutter/material.dart'; | ||
| 3 | + | ||
| 4 | +import './tts.dart'; | ||
| 5 | +import './info.dart'; | ||
| 6 | + | ||
| 7 | +void main() { | ||
| 8 | + runApp(const MyApp()); | ||
| 9 | +} | ||
| 10 | + | ||
| 11 | +class MyApp extends StatelessWidget { | ||
| 12 | + const MyApp({super.key}); | ||
| 13 | + | ||
| 14 | + @override | ||
| 15 | + Widget build(BuildContext context) { | ||
| 16 | + return MaterialApp( | ||
| 17 | + title: 'Next-gen Kaldi flutter demo', | ||
| 18 | + theme: ThemeData( | ||
| 19 | + colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), | ||
| 20 | + useMaterial3: true, | ||
| 21 | + ), | ||
| 22 | + home: const MyHomePage(title: 'Next-gen Kaldi with Flutter'), | ||
| 23 | + ); | ||
| 24 | + } | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +class MyHomePage extends StatefulWidget { | ||
| 28 | + const MyHomePage({super.key, required this.title}); | ||
| 29 | + | ||
| 30 | + final String title; | ||
| 31 | + | ||
| 32 | + @override | ||
| 33 | + State<MyHomePage> createState() => _MyHomePageState(); | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | +class _MyHomePageState extends State<MyHomePage> { | ||
| 37 | + int _currentIndex = 0; | ||
| 38 | + final List<Widget> _tabs = [ | ||
| 39 | + TtsScreen(), | ||
| 40 | + InfoScreen(), | ||
| 41 | + ]; | ||
| 42 | + @override | ||
| 43 | + Widget build(BuildContext context) { | ||
| 44 | + return Scaffold( | ||
| 45 | + appBar: AppBar( | ||
| 46 | + title: Text(widget.title), | ||
| 47 | + ), | ||
| 48 | + body: _tabs[_currentIndex], | ||
| 49 | + bottomNavigationBar: BottomNavigationBar( | ||
| 50 | + currentIndex: _currentIndex, | ||
| 51 | + onTap: (int index) { | ||
| 52 | + setState(() { | ||
| 53 | + _currentIndex = index; | ||
| 54 | + }); | ||
| 55 | + }, | ||
| 56 | + items: [ | ||
| 57 | + BottomNavigationBarItem( | ||
| 58 | + icon: Icon(Icons.home), | ||
| 59 | + label: 'Home', | ||
| 60 | + ), | ||
| 61 | + BottomNavigationBarItem( | ||
| 62 | + icon: Icon(Icons.info), | ||
| 63 | + label: 'Info', | ||
| 64 | + ), | ||
| 65 | + ], | ||
| 66 | + ), | ||
| 67 | + ); | ||
| 68 | + } | ||
| 69 | +} |
flutter-examples/tts/lib/model.dart
0 → 100644
| 1 | +// Copyright (c) 2024 Xiaomi Corporation | ||
| 2 | + | ||
| 3 | +import "dart:io"; | ||
| 4 | + | ||
| 5 | +import 'package:flutter/services.dart'; | ||
| 6 | +import 'package:path_provider/path_provider.dart'; | ||
| 7 | +import 'package:path/path.dart' as p; | ||
| 8 | +import 'package:sherpa_onnx/sherpa_onnx.dart' as sherpa_onnx; | ||
| 9 | + | ||
| 10 | +import './utils.dart'; | ||
| 11 | + | ||
| 12 | +Future<sherpa_onnx.OfflineTts> createOfflineTts() async { | ||
| 13 | + // sherpa_onnx requires that model files are in the local disk, so we | ||
| 14 | + // need to copy all asset files to disk. | ||
| 15 | + await copyAllAssetFiles(); | ||
| 16 | + | ||
| 17 | + sherpa_onnx.initBindings(); | ||
| 18 | + | ||
| 19 | + // Such a design is to make it easier to build flutter APPs with | ||
| 20 | + // github actions for a variety of tts models | ||
| 21 | + // | ||
| 22 | + // See https://github.com/k2-fsa/sherpa-onnx/blob/master/scripts/flutter/generate-tts.py | ||
| 23 | + // for details | ||
| 24 | + | ||
| 25 | + String modelDir = ''; | ||
| 26 | + String modelName = ''; | ||
| 27 | + String ruleFsts = ''; | ||
| 28 | + String ruleFars = ''; | ||
| 29 | + String lexicon = ''; | ||
| 30 | + String dataDir = ''; | ||
| 31 | + String dictDir = ''; | ||
| 32 | + | ||
| 33 | + // You can select an example below and change it according to match your | ||
| 34 | + // selected tts model | ||
| 35 | + | ||
| 36 | + // ============================================================ | ||
| 37 | + // Your change starts here | ||
| 38 | + // ============================================================ | ||
| 39 | + | ||
| 40 | + // Example 1: | ||
| 41 | + // modelDir = 'vits-vctk'; | ||
| 42 | + // modelName = 'vits-vctk.onnx'; | ||
| 43 | + // lexicon = 'lexicon.txt'; | ||
| 44 | + | ||
| 45 | + // Example 2: | ||
| 46 | + // https://github.com/k2-fsa/sherpa-onnx/releases/tag/tts-models | ||
| 47 | + // https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-amy-low.tar.bz2 | ||
| 48 | + // modelDir = 'vits-piper-en_US-amy-low'; | ||
| 49 | + // modelName = 'en_US-amy-low.onnx'; | ||
| 50 | + // dataDir = 'vits-piper-en_US-amy-low/espeak-ng-data'; | ||
| 51 | + | ||
| 52 | + // Example 3: | ||
| 53 | + // https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-icefall-zh-aishell3.tar.bz2 | ||
| 54 | + // modelDir = 'vits-icefall-zh-aishell3'; | ||
| 55 | + // modelName = 'model.onnx'; | ||
| 56 | + // ruleFsts = 'vits-icefall-zh-aishell3/phone.fst,vits-icefall-zh-aishell3/date.fst,vits-icefall-zh-aishell3/number.fst,vits-icefall-zh-aishell3/new_heteronym.fst'; | ||
| 57 | + // ruleFars = 'vits-icefall-zh-aishell3/rule.far'; | ||
| 58 | + // lexicon = 'lexicon.txt'; | ||
| 59 | + | ||
| 60 | + // Example 4: | ||
| 61 | + // https://k2-fsa.github.io/sherpa/onnx/tts/pretrained_models/vits.html#csukuangfj-vits-zh-hf-fanchen-c-chinese-187-speakers | ||
| 62 | + // modelDir = 'vits-zh-hf-fanchen-C'; | ||
| 63 | + // modelName = 'vits-zh-hf-fanchen-C.onnx'; | ||
| 64 | + // lexicon = 'lexicon.txt'; | ||
| 65 | + // dictDir = 'vits-zh-hf-fanchen-C/dict'; | ||
| 66 | + | ||
| 67 | + // Example 5: | ||
| 68 | + // https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-coqui-de-css10.tar.bz2 | ||
| 69 | + // modelDir = 'vits-coqui-de-css10'; | ||
| 70 | + // modelName = 'model.onnx'; | ||
| 71 | + | ||
| 72 | + // Example 6 | ||
| 73 | + // https://github.com/k2-fsa/sherpa-onnx/releases/tag/tts-models | ||
| 74 | + // https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-libritts_r-medium.tar.bz2 | ||
| 75 | + // modelDir = 'vits-piper-en_US-libritts_r-medium'; | ||
| 76 | + // modelName = 'en_US-libritts_r-medium.onnx'; | ||
| 77 | + // dataDir = 'vits-piper-en_US-libritts_r-medium/espeak-ng-data'; | ||
| 78 | + | ||
| 79 | + // ============================================================ | ||
| 80 | + // Please don't change the remaining part of this function | ||
| 81 | + // ============================================================ | ||
| 82 | + if (modelName == '') { | ||
| 83 | + throw Exception( | ||
| 84 | + 'You are supposed to select a model by changing the code before you run the app'); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + final Directory directory = await getApplicationDocumentsDirectory(); | ||
| 88 | + modelName = p.join(directory.path, modelDir, modelName); | ||
| 89 | + | ||
| 90 | + if (ruleFsts != '') { | ||
| 91 | + final all = ruleFsts.split(','); | ||
| 92 | + var tmp = <String>[]; | ||
| 93 | + for (final f in all) { | ||
| 94 | + tmp.add(p.join(directory.path, modelDir, f)); | ||
| 95 | + } | ||
| 96 | + ruleFsts = tmp.join(','); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + if (ruleFars != '') { | ||
| 100 | + final all = ruleFars.split(','); | ||
| 101 | + var tmp = <String>[]; | ||
| 102 | + for (final f in all) { | ||
| 103 | + tmp.add(p.join(directory.path, f)); | ||
| 104 | + } | ||
| 105 | + ruleFars = tmp.join(','); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + if (lexicon != '') { | ||
| 109 | + lexicon = p.join(directory.path, lexicon); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + if (dataDir != '') { | ||
| 113 | + dataDir = p.join(directory.path, dataDir); | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + if (dictDir != '') { | ||
| 117 | + dictDir = p.join(directory.path, dictDir); | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + final tokens = p.join(directory.path, modelDir, 'tokens.txt'); | ||
| 121 | + | ||
| 122 | + final vits = sherpa_onnx.OfflineTtsVitsModelConfig( | ||
| 123 | + model: modelName, | ||
| 124 | + lexicon: lexicon, | ||
| 125 | + tokens: tokens, | ||
| 126 | + dataDir: dataDir, | ||
| 127 | + dictDir: dictDir, | ||
| 128 | + ); | ||
| 129 | + | ||
| 130 | + final modelConfig = sherpa_onnx.OfflineTtsModelConfig( | ||
| 131 | + vits: vits, | ||
| 132 | + numThreads: 2, | ||
| 133 | + debug: true, | ||
| 134 | + provider: 'cpu', | ||
| 135 | + ); | ||
| 136 | + | ||
| 137 | + final config = sherpa_onnx.OfflineTtsConfig( | ||
| 138 | + model: modelConfig, | ||
| 139 | + ruleFsts: ruleFsts, | ||
| 140 | + ruleFars: ruleFars, | ||
| 141 | + maxNumSenetences: 1, | ||
| 142 | + ); | ||
| 143 | + // print(config); | ||
| 144 | + | ||
| 145 | + final tts = sherpa_onnx.OfflineTts(config); | ||
| 146 | + print('tts created successfully'); | ||
| 147 | + | ||
| 148 | + return tts; | ||
| 149 | +} |
flutter-examples/tts/lib/tts.dart
0 → 100644
| 1 | +// Copyright (c) 2024 Xiaomi Corporation | ||
| 2 | +import 'dart:async'; | ||
| 3 | + | ||
| 4 | +import 'package:flutter/foundation.dart'; | ||
| 5 | +import 'package:flutter/services.dart'; | ||
| 6 | + | ||
| 7 | +import 'package:flutter/material.dart'; | ||
| 8 | + | ||
| 9 | +import 'package:audioplayers/audioplayers.dart'; | ||
| 10 | +import 'package:sherpa_onnx/sherpa_onnx.dart' as sherpa_onnx; | ||
| 11 | + | ||
| 12 | +import './model.dart'; | ||
| 13 | +import './utils.dart'; | ||
| 14 | + | ||
| 15 | +class TtsScreen extends StatefulWidget { | ||
| 16 | + const TtsScreen({super.key}); | ||
| 17 | + | ||
| 18 | + @override | ||
| 19 | + State<TtsScreen> createState() => _TtsScreenState(); | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +class _TtsScreenState extends State<TtsScreen> { | ||
| 23 | + late final TextEditingController _controller_text_input; | ||
| 24 | + late final TextEditingController _controller_sid; | ||
| 25 | + late final TextEditingController _controller_hint; | ||
| 26 | + late final AudioPlayer _player; | ||
| 27 | + String _title = 'Text to speech'; | ||
| 28 | + String _lastFilename = ''; | ||
| 29 | + bool _isInitialized = false; | ||
| 30 | + int _maxSpeakerID = 0; | ||
| 31 | + double _speed = 1.0; | ||
| 32 | + | ||
| 33 | + sherpa_onnx.OfflineTts? _tts; | ||
| 34 | + | ||
| 35 | + @override | ||
| 36 | + void initState() { | ||
| 37 | + _controller_text_input = TextEditingController(); | ||
| 38 | + _controller_hint = TextEditingController(); | ||
| 39 | + _controller_sid = TextEditingController(text: '0'); | ||
| 40 | + super.initState(); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + Future<void> _init() async { | ||
| 44 | + if (!_isInitialized) { | ||
| 45 | + sherpa_onnx.initBindings(); | ||
| 46 | + | ||
| 47 | + _tts?.free(); | ||
| 48 | + _tts = await createOfflineTts(); | ||
| 49 | + | ||
| 50 | + _player = AudioPlayer(); | ||
| 51 | + | ||
| 52 | + _isInitialized = true; | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @override | ||
| 57 | + Widget build(BuildContext context) { | ||
| 58 | + return MaterialApp( | ||
| 59 | + home: Scaffold( | ||
| 60 | + appBar: AppBar( | ||
| 61 | + title: Text(_title), | ||
| 62 | + ), | ||
| 63 | + body: Padding( | ||
| 64 | + padding: EdgeInsets.all(10), | ||
| 65 | + child: Column( | ||
| 66 | + // mainAxisAlignment: MainAxisAlignment.center, | ||
| 67 | + children: <Widget>[ | ||
| 68 | + TextField( | ||
| 69 | + decoration: InputDecoration( | ||
| 70 | + labelText: "Speaker ID (0-$_maxSpeakerID)", | ||
| 71 | + hintText: 'Please input your speaker ID', | ||
| 72 | + ), | ||
| 73 | + keyboardType: TextInputType.number, | ||
| 74 | + maxLines: 1, | ||
| 75 | + controller: _controller_sid, | ||
| 76 | + inputFormatters: <TextInputFormatter>[ | ||
| 77 | + FilteringTextInputFormatter.digitsOnly | ||
| 78 | + ]), | ||
| 79 | + Slider( | ||
| 80 | + // decoration: InputDecoration( | ||
| 81 | + // labelText: "speech speed", | ||
| 82 | + // ), | ||
| 83 | + label: "Speech speed ${_speed.toStringAsPrecision(2)}", | ||
| 84 | + min: 0.5, | ||
| 85 | + max: 3.0, | ||
| 86 | + divisions: 25, | ||
| 87 | + value: _speed, | ||
| 88 | + onChanged: (value) { | ||
| 89 | + setState(() { | ||
| 90 | + _speed = value; | ||
| 91 | + }); | ||
| 92 | + }, | ||
| 93 | + ), | ||
| 94 | + const SizedBox(height: 5), | ||
| 95 | + TextField( | ||
| 96 | + decoration: InputDecoration( | ||
| 97 | + border: OutlineInputBorder(), | ||
| 98 | + hintText: 'Please enter your text here', | ||
| 99 | + ), | ||
| 100 | + maxLines: 5, | ||
| 101 | + controller: _controller_text_input, | ||
| 102 | + ), | ||
| 103 | + const SizedBox(height: 5), | ||
| 104 | + Row( | ||
| 105 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 106 | + children: <Widget>[ | ||
| 107 | + OutlinedButton( | ||
| 108 | + child: Text("Generate"), | ||
| 109 | + onPressed: () async { | ||
| 110 | + await _init(); | ||
| 111 | + await _player?.stop(); | ||
| 112 | + | ||
| 113 | + setState(() { | ||
| 114 | + _maxSpeakerID = _tts?.numSpeakers ?? 0; | ||
| 115 | + if (_maxSpeakerID > 0) { | ||
| 116 | + _maxSpeakerID -= 1; | ||
| 117 | + } | ||
| 118 | + }); | ||
| 119 | + | ||
| 120 | + if (_tts == null) { | ||
| 121 | + _controller_hint.value = TextEditingValue( | ||
| 122 | + text: 'Failed to initialize tts', | ||
| 123 | + ); | ||
| 124 | + return; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + _controller_hint.value = TextEditingValue( | ||
| 128 | + text: '', | ||
| 129 | + ); | ||
| 130 | + | ||
| 131 | + final text = _controller_text_input.text.trim(); | ||
| 132 | + if (text == '') { | ||
| 133 | + _controller_hint.value = TextEditingValue( | ||
| 134 | + text: 'Please first input your text to generate', | ||
| 135 | + ); | ||
| 136 | + return; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + final sid = | ||
| 140 | + int.tryParse(_controller_sid.text.trim()) ?? 0; | ||
| 141 | + | ||
| 142 | + final stopwatch = Stopwatch(); | ||
| 143 | + stopwatch.start(); | ||
| 144 | + final audio = | ||
| 145 | + _tts!.generate(text: text, sid: sid, speed: _speed); | ||
| 146 | + final suffix = | ||
| 147 | + '-sid-$sid-speed-${_speed.toStringAsPrecision(2)}'; | ||
| 148 | + final filename = await generateWaveFilename(suffix); | ||
| 149 | + | ||
| 150 | + final ok = sherpa_onnx.writeWave( | ||
| 151 | + filename: filename, | ||
| 152 | + samples: audio.samples, | ||
| 153 | + sampleRate: audio.sampleRate, | ||
| 154 | + ); | ||
| 155 | + | ||
| 156 | + if (ok) { | ||
| 157 | + stopwatch.stop(); | ||
| 158 | + double elapsed = | ||
| 159 | + stopwatch.elapsed.inMilliseconds.toDouble(); | ||
| 160 | + | ||
| 161 | + double waveDuration = | ||
| 162 | + audio.samples.length.toDouble() / | ||
| 163 | + audio.sampleRate.toDouble(); | ||
| 164 | + | ||
| 165 | + _controller_hint.value = TextEditingValue( | ||
| 166 | + text: 'Saved to\n$filename\n' | ||
| 167 | + 'Elapsed: ${(elapsed / 1000).toStringAsPrecision(4)} s\n' | ||
| 168 | + 'Wave duration: ${waveDuration.toStringAsPrecision(4)} s\n' | ||
| 169 | + 'RTF: ${(elapsed / 1000).toStringAsPrecision(4)}/${waveDuration.toStringAsPrecision(4)} ' | ||
| 170 | + '= ${(elapsed / 1000 / waveDuration).toStringAsPrecision(3)} ', | ||
| 171 | + ); | ||
| 172 | + _lastFilename = filename; | ||
| 173 | + | ||
| 174 | + await _player?.play(DeviceFileSource(_lastFilename)); | ||
| 175 | + } else { | ||
| 176 | + _controller_hint.value = TextEditingValue( | ||
| 177 | + text: 'Failed to save generated audio', | ||
| 178 | + ); | ||
| 179 | + } | ||
| 180 | + }, | ||
| 181 | + ), | ||
| 182 | + const SizedBox(width: 5), | ||
| 183 | + OutlinedButton( | ||
| 184 | + child: Text("Clear"), | ||
| 185 | + onPressed: () { | ||
| 186 | + _controller_text_input.value = TextEditingValue( | ||
| 187 | + text: '', | ||
| 188 | + ); | ||
| 189 | + | ||
| 190 | + _controller_hint.value = TextEditingValue( | ||
| 191 | + text: '', | ||
| 192 | + ); | ||
| 193 | + }, | ||
| 194 | + ), | ||
| 195 | + const SizedBox(width: 5), | ||
| 196 | + OutlinedButton( | ||
| 197 | + child: Text("Play"), | ||
| 198 | + onPressed: () async { | ||
| 199 | + if (_lastFilename == '') { | ||
| 200 | + _controller_hint.value = TextEditingValue( | ||
| 201 | + text: 'No generated wave file found', | ||
| 202 | + ); | ||
| 203 | + return; | ||
| 204 | + } | ||
| 205 | + await _player?.stop(); | ||
| 206 | + await _player?.play(DeviceFileSource(_lastFilename)); | ||
| 207 | + _controller_hint.value = TextEditingValue( | ||
| 208 | + text: 'Playing\n$_lastFilename', | ||
| 209 | + ); | ||
| 210 | + }, | ||
| 211 | + ), | ||
| 212 | + const SizedBox(width: 5), | ||
| 213 | + OutlinedButton( | ||
| 214 | + child: Text("Stop"), | ||
| 215 | + onPressed: () async { | ||
| 216 | + await _player?.stop(); | ||
| 217 | + _controller_hint.value = TextEditingValue( | ||
| 218 | + text: '', | ||
| 219 | + ); | ||
| 220 | + }, | ||
| 221 | + ), | ||
| 222 | + ]), | ||
| 223 | + const SizedBox(height: 5), | ||
| 224 | + TextField( | ||
| 225 | + decoration: InputDecoration( | ||
| 226 | + border: OutlineInputBorder(), | ||
| 227 | + hintText: 'Logs will be shown here.\n' | ||
| 228 | + 'The first run is slower due to model initialization.', | ||
| 229 | + ), | ||
| 230 | + maxLines: 6, | ||
| 231 | + controller: _controller_hint, | ||
| 232 | + readOnly: true, | ||
| 233 | + ), | ||
| 234 | + ], | ||
| 235 | + ), | ||
| 236 | + ), | ||
| 237 | + ), | ||
| 238 | + ); | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + @override | ||
| 242 | + void dispose() { | ||
| 243 | + _tts?.free(); | ||
| 244 | + super.dispose(); | ||
| 245 | + } | ||
| 246 | +} |
flutter-examples/tts/lib/utils.dart
0 → 100644
| 1 | +// Copyright (c) 2024 Xiaomi Corporation | ||
| 2 | +import 'dart:io'; | ||
| 3 | +import 'dart:typed_data'; | ||
| 4 | + | ||
| 5 | +import 'package:flutter/services.dart'; | ||
| 6 | +import 'package:path/path.dart' as p; | ||
| 7 | +import 'package:path_provider/path_provider.dart'; | ||
| 8 | + | ||
| 9 | +Future<String> generateWaveFilename([String suffix = '']) async { | ||
| 10 | + final Directory directory = await getApplicationDocumentsDirectory(); | ||
| 11 | + DateTime now = DateTime.now(); | ||
| 12 | + final filename = | ||
| 13 | + '${now.year.toString()}-${now.month.toString().padLeft(2, '0')}-${now.day.toString().padLeft(2, '0')}-${now.hour.toString().padLeft(2, '0')}-${now.minute.toString().padLeft(2, '0')}-${now.second.toString().padLeft(2, '0')}$suffix.wav'; | ||
| 14 | + | ||
| 15 | + return p.join(directory.path, filename); | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +// https://stackoverflow.com/questions/68862225/flutter-how-to-get-all-files-from-assets-folder-in-one-list | ||
| 19 | +Future<List<String>> getAllAssetFiles() async { | ||
| 20 | + final AssetManifest assetManifest = | ||
| 21 | + await AssetManifest.loadFromAssetBundle(rootBundle); | ||
| 22 | + final List<String> assets = assetManifest.listAssets(); | ||
| 23 | + return assets; | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +String stripLeadingDirectory(String src, {int n = 1}) { | ||
| 27 | + return p.joinAll(p.split(src).sublist(n)); | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +Future<void> copyAllAssetFiles() async { | ||
| 31 | + final allFiles = await getAllAssetFiles(); | ||
| 32 | + for (final src in allFiles) { | ||
| 33 | + final dst = stripLeadingDirectory(src); | ||
| 34 | + await copyAssetFile(src, dst); | ||
| 35 | + } | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | +// Copy the asset file from src to dst. | ||
| 39 | +// If dst already exists, then just skip the copy | ||
| 40 | +Future<String> copyAssetFile(String src, [String? dst]) async { | ||
| 41 | + final Directory directory = await getApplicationDocumentsDirectory(); | ||
| 42 | + if (dst == null) { | ||
| 43 | + dst = p.basename(src); | ||
| 44 | + } | ||
| 45 | + final target = p.join(directory.path, dst); | ||
| 46 | + bool exists = await new File(target).exists(); | ||
| 47 | + | ||
| 48 | + if (!exists) { | ||
| 49 | + final data = await rootBundle.load(src); | ||
| 50 | + final List<int> bytes = | ||
| 51 | + data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); | ||
| 52 | + await (await File(target).create(recursive: true)).writeAsBytes(bytes); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + return target; | ||
| 56 | +} |
flutter-examples/tts/linux/.gitignore
0 → 100644
| 1 | +flutter/ephemeral |
flutter-examples/tts/linux/CMakeLists.txt
0 → 100644
| 1 | +# Project-level configuration. | ||
| 2 | +cmake_minimum_required(VERSION 3.10) | ||
| 3 | +project(runner LANGUAGES CXX) | ||
| 4 | + | ||
| 5 | +# The name of the executable created for the application. Change this to change | ||
| 6 | +# the on-disk name of your application. | ||
| 7 | +set(BINARY_NAME "tts") | ||
| 8 | +# The unique GTK application identifier for this application. See: | ||
| 9 | +# https://wiki.gnome.org/HowDoI/ChooseApplicationID | ||
| 10 | +set(APPLICATION_ID "com.k2fsa.sherpa.onnx.tts") | ||
| 11 | + | ||
| 12 | +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent | ||
| 13 | +# versions of CMake. | ||
| 14 | +cmake_policy(SET CMP0063 NEW) | ||
| 15 | + | ||
| 16 | +# Load bundled libraries from the lib/ directory relative to the binary. | ||
| 17 | +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") | ||
| 18 | + | ||
| 19 | +# Root filesystem for cross-building. | ||
| 20 | +if(FLUTTER_TARGET_PLATFORM_SYSROOT) | ||
| 21 | + set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) | ||
| 22 | + set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) | ||
| 23 | + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
| 24 | + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) | ||
| 25 | + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
| 26 | + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
| 27 | +endif() | ||
| 28 | + | ||
| 29 | +# Define build configuration options. | ||
| 30 | +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
| 31 | + set(CMAKE_BUILD_TYPE "Debug" CACHE | ||
| 32 | + STRING "Flutter build mode" FORCE) | ||
| 33 | + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS | ||
| 34 | + "Debug" "Profile" "Release") | ||
| 35 | +endif() | ||
| 36 | + | ||
| 37 | +# Compilation settings that should be applied to most targets. | ||
| 38 | +# | ||
| 39 | +# Be cautious about adding new options here, as plugins use this function by | ||
| 40 | +# default. In most cases, you should add new options to specific targets instead | ||
| 41 | +# of modifying this function. | ||
| 42 | +function(APPLY_STANDARD_SETTINGS TARGET) | ||
| 43 | + target_compile_features(${TARGET} PUBLIC cxx_std_14) | ||
| 44 | + target_compile_options(${TARGET} PRIVATE -Wall -Werror) | ||
| 45 | + target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>") | ||
| 46 | + target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>") | ||
| 47 | +endfunction() | ||
| 48 | + | ||
| 49 | +# Flutter library and tool build rules. | ||
| 50 | +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") | ||
| 51 | +add_subdirectory(${FLUTTER_MANAGED_DIR}) | ||
| 52 | + | ||
| 53 | +# System-level dependencies. | ||
| 54 | +find_package(PkgConfig REQUIRED) | ||
| 55 | +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) | ||
| 56 | + | ||
| 57 | +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") | ||
| 58 | + | ||
| 59 | +# Define the application target. To change its name, change BINARY_NAME above, | ||
| 60 | +# not the value here, or `flutter run` will no longer work. | ||
| 61 | +# | ||
| 62 | +# Any new source files that you add to the application should be added here. | ||
| 63 | +add_executable(${BINARY_NAME} | ||
| 64 | + "main.cc" | ||
| 65 | + "my_application.cc" | ||
| 66 | + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" | ||
| 67 | +) | ||
| 68 | + | ||
| 69 | +# Apply the standard set of build settings. This can be removed for applications | ||
| 70 | +# that need different build settings. | ||
| 71 | +apply_standard_settings(${BINARY_NAME}) | ||
| 72 | + | ||
| 73 | +# Add dependency libraries. Add any application-specific dependencies here. | ||
| 74 | +target_link_libraries(${BINARY_NAME} PRIVATE flutter) | ||
| 75 | +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) | ||
| 76 | + | ||
| 77 | +# Run the Flutter tool portions of the build. This must not be removed. | ||
| 78 | +add_dependencies(${BINARY_NAME} flutter_assemble) | ||
| 79 | + | ||
| 80 | +# Only the install-generated bundle's copy of the executable will launch | ||
| 81 | +# correctly, since the resources must in the right relative locations. To avoid | ||
| 82 | +# people trying to run the unbundled copy, put it in a subdirectory instead of | ||
| 83 | +# the default top-level location. | ||
| 84 | +set_target_properties(${BINARY_NAME} | ||
| 85 | + PROPERTIES | ||
| 86 | + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" | ||
| 87 | +) | ||
| 88 | + | ||
| 89 | + | ||
| 90 | +# Generated plugin build rules, which manage building the plugins and adding | ||
| 91 | +# them to the application. | ||
| 92 | +include(flutter/generated_plugins.cmake) | ||
| 93 | + | ||
| 94 | + | ||
| 95 | +# === Installation === | ||
| 96 | +# By default, "installing" just makes a relocatable bundle in the build | ||
| 97 | +# directory. | ||
| 98 | +set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") | ||
| 99 | +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) | ||
| 100 | + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) | ||
| 101 | +endif() | ||
| 102 | + | ||
| 103 | +# Start with a clean build bundle directory every time. | ||
| 104 | +install(CODE " | ||
| 105 | + file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") | ||
| 106 | + " COMPONENT Runtime) | ||
| 107 | + | ||
| 108 | +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") | ||
| 109 | +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") | ||
| 110 | + | ||
| 111 | +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" | ||
| 112 | + COMPONENT Runtime) | ||
| 113 | + | ||
| 114 | +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" | ||
| 115 | + COMPONENT Runtime) | ||
| 116 | + | ||
| 117 | +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" | ||
| 118 | + COMPONENT Runtime) | ||
| 119 | + | ||
| 120 | +foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) | ||
| 121 | + install(FILES "${bundled_library}" | ||
| 122 | + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" | ||
| 123 | + COMPONENT Runtime) | ||
| 124 | +endforeach(bundled_library) | ||
| 125 | + | ||
| 126 | +# Copy the native assets provided by the build.dart from all packages. | ||
| 127 | +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") | ||
| 128 | +install(DIRECTORY "${NATIVE_ASSETS_DIR}" | ||
| 129 | + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" | ||
| 130 | + COMPONENT Runtime) | ||
| 131 | + | ||
| 132 | +# Fully re-copy the assets directory on each build to avoid having stale files | ||
| 133 | +# from a previous install. | ||
| 134 | +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") | ||
| 135 | +install(CODE " | ||
| 136 | + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") | ||
| 137 | + " COMPONENT Runtime) | ||
| 138 | +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" | ||
| 139 | + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) | ||
| 140 | + | ||
| 141 | +# Install the AOT library on non-Debug builds only. | ||
| 142 | +if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") | ||
| 143 | + install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" | ||
| 144 | + COMPONENT Runtime) | ||
| 145 | +endif() |
| 1 | +# This file controls Flutter-level build steps. It should not be edited. | ||
| 2 | +cmake_minimum_required(VERSION 3.10) | ||
| 3 | + | ||
| 4 | +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") | ||
| 5 | + | ||
| 6 | +# Configuration provided via flutter tool. | ||
| 7 | +include(${EPHEMERAL_DIR}/generated_config.cmake) | ||
| 8 | + | ||
| 9 | +# TODO: Move the rest of this into files in ephemeral. See | ||
| 10 | +# https://github.com/flutter/flutter/issues/57146. | ||
| 11 | + | ||
| 12 | +# Serves the same purpose as list(TRANSFORM ... PREPEND ...), | ||
| 13 | +# which isn't available in 3.10. | ||
| 14 | +function(list_prepend LIST_NAME PREFIX) | ||
| 15 | + set(NEW_LIST "") | ||
| 16 | + foreach(element ${${LIST_NAME}}) | ||
| 17 | + list(APPEND NEW_LIST "${PREFIX}${element}") | ||
| 18 | + endforeach(element) | ||
| 19 | + set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) | ||
| 20 | +endfunction() | ||
| 21 | + | ||
| 22 | +# === Flutter Library === | ||
| 23 | +# System-level dependencies. | ||
| 24 | +find_package(PkgConfig REQUIRED) | ||
| 25 | +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) | ||
| 26 | +pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) | ||
| 27 | +pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) | ||
| 28 | + | ||
| 29 | +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") | ||
| 30 | + | ||
| 31 | +# Published to parent scope for install step. | ||
| 32 | +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) | ||
| 33 | +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) | ||
| 34 | +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) | ||
| 35 | +set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) | ||
| 36 | + | ||
| 37 | +list(APPEND FLUTTER_LIBRARY_HEADERS | ||
| 38 | + "fl_basic_message_channel.h" | ||
| 39 | + "fl_binary_codec.h" | ||
| 40 | + "fl_binary_messenger.h" | ||
| 41 | + "fl_dart_project.h" | ||
| 42 | + "fl_engine.h" | ||
| 43 | + "fl_json_message_codec.h" | ||
| 44 | + "fl_json_method_codec.h" | ||
| 45 | + "fl_message_codec.h" | ||
| 46 | + "fl_method_call.h" | ||
| 47 | + "fl_method_channel.h" | ||
| 48 | + "fl_method_codec.h" | ||
| 49 | + "fl_method_response.h" | ||
| 50 | + "fl_plugin_registrar.h" | ||
| 51 | + "fl_plugin_registry.h" | ||
| 52 | + "fl_standard_message_codec.h" | ||
| 53 | + "fl_standard_method_codec.h" | ||
| 54 | + "fl_string_codec.h" | ||
| 55 | + "fl_value.h" | ||
| 56 | + "fl_view.h" | ||
| 57 | + "flutter_linux.h" | ||
| 58 | +) | ||
| 59 | +list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") | ||
| 60 | +add_library(flutter INTERFACE) | ||
| 61 | +target_include_directories(flutter INTERFACE | ||
| 62 | + "${EPHEMERAL_DIR}" | ||
| 63 | +) | ||
| 64 | +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") | ||
| 65 | +target_link_libraries(flutter INTERFACE | ||
| 66 | + PkgConfig::GTK | ||
| 67 | + PkgConfig::GLIB | ||
| 68 | + PkgConfig::GIO | ||
| 69 | +) | ||
| 70 | +add_dependencies(flutter flutter_assemble) | ||
| 71 | + | ||
| 72 | +# === Flutter tool backend === | ||
| 73 | +# _phony_ is a non-existent file to force this command to run every time, | ||
| 74 | +# since currently there's no way to get a full input/output list from the | ||
| 75 | +# flutter tool. | ||
| 76 | +add_custom_command( | ||
| 77 | + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} | ||
| 78 | + ${CMAKE_CURRENT_BINARY_DIR}/_phony_ | ||
| 79 | + COMMAND ${CMAKE_COMMAND} -E env | ||
| 80 | + ${FLUTTER_TOOL_ENVIRONMENT} | ||
| 81 | + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" | ||
| 82 | + ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} | ||
| 83 | + VERBATIM | ||
| 84 | +) | ||
| 85 | +add_custom_target(flutter_assemble DEPENDS | ||
| 86 | + "${FLUTTER_LIBRARY}" | ||
| 87 | + ${FLUTTER_LIBRARY_HEADERS} | ||
| 88 | +) |
flutter-examples/tts/linux/main.cc
0 → 100644
flutter-examples/tts/linux/my_application.cc
0 → 100644
| 1 | +#include "my_application.h" | ||
| 2 | + | ||
| 3 | +#include <flutter_linux/flutter_linux.h> | ||
| 4 | +#ifdef GDK_WINDOWING_X11 | ||
| 5 | +#include <gdk/gdkx.h> | ||
| 6 | +#endif | ||
| 7 | + | ||
| 8 | +#include "flutter/generated_plugin_registrant.h" | ||
| 9 | + | ||
| 10 | +struct _MyApplication { | ||
| 11 | + GtkApplication parent_instance; | ||
| 12 | + char** dart_entrypoint_arguments; | ||
| 13 | +}; | ||
| 14 | + | ||
| 15 | +G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) | ||
| 16 | + | ||
| 17 | +// Implements GApplication::activate. | ||
| 18 | +static void my_application_activate(GApplication* application) { | ||
| 19 | + MyApplication* self = MY_APPLICATION(application); | ||
| 20 | + GtkWindow* window = | ||
| 21 | + GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); | ||
| 22 | + | ||
| 23 | + // Use a header bar when running in GNOME as this is the common style used | ||
| 24 | + // by applications and is the setup most users will be using (e.g. Ubuntu | ||
| 25 | + // desktop). | ||
| 26 | + // If running on X and not using GNOME then just use a traditional title bar | ||
| 27 | + // in case the window manager does more exotic layout, e.g. tiling. | ||
| 28 | + // If running on Wayland assume the header bar will work (may need changing | ||
| 29 | + // if future cases occur). | ||
| 30 | + gboolean use_header_bar = TRUE; | ||
| 31 | +#ifdef GDK_WINDOWING_X11 | ||
| 32 | + GdkScreen* screen = gtk_window_get_screen(window); | ||
| 33 | + if (GDK_IS_X11_SCREEN(screen)) { | ||
| 34 | + const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); | ||
| 35 | + if (g_strcmp0(wm_name, "GNOME Shell") != 0) { | ||
| 36 | + use_header_bar = FALSE; | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | +#endif | ||
| 40 | + if (use_header_bar) { | ||
| 41 | + GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); | ||
| 42 | + gtk_widget_show(GTK_WIDGET(header_bar)); | ||
| 43 | + gtk_header_bar_set_title(header_bar, "tts"); | ||
| 44 | + gtk_header_bar_set_show_close_button(header_bar, TRUE); | ||
| 45 | + gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); | ||
| 46 | + } else { | ||
| 47 | + gtk_window_set_title(window, "tts"); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + gtk_window_set_default_size(window, 1280, 720); | ||
| 51 | + gtk_widget_show(GTK_WIDGET(window)); | ||
| 52 | + | ||
| 53 | + g_autoptr(FlDartProject) project = fl_dart_project_new(); | ||
| 54 | + fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); | ||
| 55 | + | ||
| 56 | + FlView* view = fl_view_new(project); | ||
| 57 | + gtk_widget_show(GTK_WIDGET(view)); | ||
| 58 | + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); | ||
| 59 | + | ||
| 60 | + fl_register_plugins(FL_PLUGIN_REGISTRY(view)); | ||
| 61 | + | ||
| 62 | + gtk_widget_grab_focus(GTK_WIDGET(view)); | ||
| 63 | +} | ||
| 64 | + | ||
| 65 | +// Implements GApplication::local_command_line. | ||
| 66 | +static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { | ||
| 67 | + MyApplication* self = MY_APPLICATION(application); | ||
| 68 | + // Strip out the first argument as it is the binary name. | ||
| 69 | + self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); | ||
| 70 | + | ||
| 71 | + g_autoptr(GError) error = nullptr; | ||
| 72 | + if (!g_application_register(application, nullptr, &error)) { | ||
| 73 | + g_warning("Failed to register: %s", error->message); | ||
| 74 | + *exit_status = 1; | ||
| 75 | + return TRUE; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + g_application_activate(application); | ||
| 79 | + *exit_status = 0; | ||
| 80 | + | ||
| 81 | + return TRUE; | ||
| 82 | +} | ||
| 83 | + | ||
| 84 | +// Implements GApplication::startup. | ||
| 85 | +static void my_application_startup(GApplication* application) { | ||
| 86 | + //MyApplication* self = MY_APPLICATION(object); | ||
| 87 | + | ||
| 88 | + // Perform any actions required at application startup. | ||
| 89 | + | ||
| 90 | + G_APPLICATION_CLASS(my_application_parent_class)->startup(application); | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | +// Implements GApplication::shutdown. | ||
| 94 | +static void my_application_shutdown(GApplication* application) { | ||
| 95 | + //MyApplication* self = MY_APPLICATION(object); | ||
| 96 | + | ||
| 97 | + // Perform any actions required at application shutdown. | ||
| 98 | + | ||
| 99 | + G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); | ||
| 100 | +} | ||
| 101 | + | ||
| 102 | +// Implements GObject::dispose. | ||
| 103 | +static void my_application_dispose(GObject* object) { | ||
| 104 | + MyApplication* self = MY_APPLICATION(object); | ||
| 105 | + g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); | ||
| 106 | + G_OBJECT_CLASS(my_application_parent_class)->dispose(object); | ||
| 107 | +} | ||
| 108 | + | ||
| 109 | +static void my_application_class_init(MyApplicationClass* klass) { | ||
| 110 | + G_APPLICATION_CLASS(klass)->activate = my_application_activate; | ||
| 111 | + G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; | ||
| 112 | + G_APPLICATION_CLASS(klass)->startup = my_application_startup; | ||
| 113 | + G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; | ||
| 114 | + G_OBJECT_CLASS(klass)->dispose = my_application_dispose; | ||
| 115 | +} | ||
| 116 | + | ||
| 117 | +static void my_application_init(MyApplication* self) {} | ||
| 118 | + | ||
| 119 | +MyApplication* my_application_new() { | ||
| 120 | + return MY_APPLICATION(g_object_new(my_application_get_type(), | ||
| 121 | + "application-id", APPLICATION_ID, | ||
| 122 | + "flags", G_APPLICATION_NON_UNIQUE, | ||
| 123 | + nullptr)); | ||
| 124 | +} |
flutter-examples/tts/linux/my_application.h
0 → 100644
| 1 | +#ifndef FLUTTER_MY_APPLICATION_H_ | ||
| 2 | +#define FLUTTER_MY_APPLICATION_H_ | ||
| 3 | + | ||
| 4 | +#include <gtk/gtk.h> | ||
| 5 | + | ||
| 6 | +G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, | ||
| 7 | + GtkApplication) | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * my_application_new: | ||
| 11 | + * | ||
| 12 | + * Creates a new Flutter-based application. | ||
| 13 | + * | ||
| 14 | + * Returns: a new #MyApplication. | ||
| 15 | + */ | ||
| 16 | +MyApplication* my_application_new(); | ||
| 17 | + | ||
| 18 | +#endif // FLUTTER_MY_APPLICATION_H_ |
flutter-examples/tts/macos/.gitignore
0 → 100644
| 1 | +#include "ephemeral/Flutter-Generated.xcconfig" |
| 1 | +#include "ephemeral/Flutter-Generated.xcconfig" |
| 1 | +// !$*UTF8*$! | ||
| 2 | +{ | ||
| 3 | + archiveVersion = 1; | ||
| 4 | + classes = { | ||
| 5 | + }; | ||
| 6 | + objectVersion = 54; | ||
| 7 | + objects = { | ||
| 8 | + | ||
| 9 | +/* Begin PBXAggregateTarget section */ | ||
| 10 | + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { | ||
| 11 | + isa = PBXAggregateTarget; | ||
| 12 | + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; | ||
| 13 | + buildPhases = ( | ||
| 14 | + 33CC111E2044C6BF0003C045 /* ShellScript */, | ||
| 15 | + ); | ||
| 16 | + dependencies = ( | ||
| 17 | + ); | ||
| 18 | + name = "Flutter Assemble"; | ||
| 19 | + productName = FLX; | ||
| 20 | + }; | ||
| 21 | +/* End PBXAggregateTarget section */ | ||
| 22 | + | ||
| 23 | +/* Begin PBXBuildFile section */ | ||
| 24 | + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; | ||
| 25 | + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; | ||
| 26 | + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; | ||
| 27 | + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; | ||
| 28 | + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; | ||
| 29 | + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; | ||
| 30 | +/* End PBXBuildFile section */ | ||
| 31 | + | ||
| 32 | +/* Begin PBXContainerItemProxy section */ | ||
| 33 | + 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { | ||
| 34 | + isa = PBXContainerItemProxy; | ||
| 35 | + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; | ||
| 36 | + proxyType = 1; | ||
| 37 | + remoteGlobalIDString = 33CC10EC2044A3C60003C045; | ||
| 38 | + remoteInfo = Runner; | ||
| 39 | + }; | ||
| 40 | + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { | ||
| 41 | + isa = PBXContainerItemProxy; | ||
| 42 | + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; | ||
| 43 | + proxyType = 1; | ||
| 44 | + remoteGlobalIDString = 33CC111A2044C6BA0003C045; | ||
| 45 | + remoteInfo = FLX; | ||
| 46 | + }; | ||
| 47 | +/* End PBXContainerItemProxy section */ | ||
| 48 | + | ||
| 49 | +/* Begin PBXCopyFilesBuildPhase section */ | ||
| 50 | + 33CC110E2044A8840003C045 /* Bundle Framework */ = { | ||
| 51 | + isa = PBXCopyFilesBuildPhase; | ||
| 52 | + buildActionMask = 2147483647; | ||
| 53 | + dstPath = ""; | ||
| 54 | + dstSubfolderSpec = 10; | ||
| 55 | + files = ( | ||
| 56 | + ); | ||
| 57 | + name = "Bundle Framework"; | ||
| 58 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 59 | + }; | ||
| 60 | +/* End PBXCopyFilesBuildPhase section */ | ||
| 61 | + | ||
| 62 | +/* Begin PBXFileReference section */ | ||
| 63 | + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
| 64 | + 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; }; | ||
| 65 | + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; }; | ||
| 66 | + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; }; | ||
| 67 | + 33CC10ED2044A3C60003C045 /* tts.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "tts.app"; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
| 68 | + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; | ||
| 69 | + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; }; | ||
| 70 | + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; }; | ||
| 71 | + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = "<group>"; }; | ||
| 72 | + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = "<group>"; }; | ||
| 73 | + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = "<group>"; }; | ||
| 74 | + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = "<group>"; }; | ||
| 75 | + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = "<group>"; }; | ||
| 76 | + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; }; | ||
| 77 | + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; }; | ||
| 78 | + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; }; | ||
| 79 | + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; }; | ||
| 80 | + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; }; | ||
| 81 | +/* End PBXFileReference section */ | ||
| 82 | + | ||
| 83 | +/* Begin PBXFrameworksBuildPhase section */ | ||
| 84 | + 331C80D2294CF70F00263BE5 /* Frameworks */ = { | ||
| 85 | + isa = PBXFrameworksBuildPhase; | ||
| 86 | + buildActionMask = 2147483647; | ||
| 87 | + files = ( | ||
| 88 | + ); | ||
| 89 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 90 | + }; | ||
| 91 | + 33CC10EA2044A3C60003C045 /* Frameworks */ = { | ||
| 92 | + isa = PBXFrameworksBuildPhase; | ||
| 93 | + buildActionMask = 2147483647; | ||
| 94 | + files = ( | ||
| 95 | + ); | ||
| 96 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 97 | + }; | ||
| 98 | +/* End PBXFrameworksBuildPhase section */ | ||
| 99 | + | ||
| 100 | +/* Begin PBXGroup section */ | ||
| 101 | + 331C80D6294CF71000263BE5 /* RunnerTests */ = { | ||
| 102 | + isa = PBXGroup; | ||
| 103 | + children = ( | ||
| 104 | + 331C80D7294CF71000263BE5 /* RunnerTests.swift */, | ||
| 105 | + ); | ||
| 106 | + path = RunnerTests; | ||
| 107 | + sourceTree = "<group>"; | ||
| 108 | + }; | ||
| 109 | + 33BA886A226E78AF003329D5 /* Configs */ = { | ||
| 110 | + isa = PBXGroup; | ||
| 111 | + children = ( | ||
| 112 | + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, | ||
| 113 | + 9740EEB21CF90195004384FC /* Debug.xcconfig */, | ||
| 114 | + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, | ||
| 115 | + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, | ||
| 116 | + ); | ||
| 117 | + path = Configs; | ||
| 118 | + sourceTree = "<group>"; | ||
| 119 | + }; | ||
| 120 | + 33CC10E42044A3C60003C045 = { | ||
| 121 | + isa = PBXGroup; | ||
| 122 | + children = ( | ||
| 123 | + 33FAB671232836740065AC1E /* Runner */, | ||
| 124 | + 33CEB47122A05771004F2AC0 /* Flutter */, | ||
| 125 | + 331C80D6294CF71000263BE5 /* RunnerTests */, | ||
| 126 | + 33CC10EE2044A3C60003C045 /* Products */, | ||
| 127 | + D73912EC22F37F3D000D13A0 /* Frameworks */, | ||
| 128 | + ); | ||
| 129 | + sourceTree = "<group>"; | ||
| 130 | + }; | ||
| 131 | + 33CC10EE2044A3C60003C045 /* Products */ = { | ||
| 132 | + isa = PBXGroup; | ||
| 133 | + children = ( | ||
| 134 | + 33CC10ED2044A3C60003C045 /* tts.app */, | ||
| 135 | + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, | ||
| 136 | + ); | ||
| 137 | + name = Products; | ||
| 138 | + sourceTree = "<group>"; | ||
| 139 | + }; | ||
| 140 | + 33CC11242044D66E0003C045 /* Resources */ = { | ||
| 141 | + isa = PBXGroup; | ||
| 142 | + children = ( | ||
| 143 | + 33CC10F22044A3C60003C045 /* Assets.xcassets */, | ||
| 144 | + 33CC10F42044A3C60003C045 /* MainMenu.xib */, | ||
| 145 | + 33CC10F72044A3C60003C045 /* Info.plist */, | ||
| 146 | + ); | ||
| 147 | + name = Resources; | ||
| 148 | + path = ..; | ||
| 149 | + sourceTree = "<group>"; | ||
| 150 | + }; | ||
| 151 | + 33CEB47122A05771004F2AC0 /* Flutter */ = { | ||
| 152 | + isa = PBXGroup; | ||
| 153 | + children = ( | ||
| 154 | + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, | ||
| 155 | + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, | ||
| 156 | + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, | ||
| 157 | + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, | ||
| 158 | + ); | ||
| 159 | + path = Flutter; | ||
| 160 | + sourceTree = "<group>"; | ||
| 161 | + }; | ||
| 162 | + 33FAB671232836740065AC1E /* Runner */ = { | ||
| 163 | + isa = PBXGroup; | ||
| 164 | + children = ( | ||
| 165 | + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, | ||
| 166 | + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, | ||
| 167 | + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, | ||
| 168 | + 33E51914231749380026EE4D /* Release.entitlements */, | ||
| 169 | + 33CC11242044D66E0003C045 /* Resources */, | ||
| 170 | + 33BA886A226E78AF003329D5 /* Configs */, | ||
| 171 | + ); | ||
| 172 | + path = Runner; | ||
| 173 | + sourceTree = "<group>"; | ||
| 174 | + }; | ||
| 175 | + D73912EC22F37F3D000D13A0 /* Frameworks */ = { | ||
| 176 | + isa = PBXGroup; | ||
| 177 | + children = ( | ||
| 178 | + ); | ||
| 179 | + name = Frameworks; | ||
| 180 | + sourceTree = "<group>"; | ||
| 181 | + }; | ||
| 182 | +/* End PBXGroup section */ | ||
| 183 | + | ||
| 184 | +/* Begin PBXNativeTarget section */ | ||
| 185 | + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { | ||
| 186 | + isa = PBXNativeTarget; | ||
| 187 | + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; | ||
| 188 | + buildPhases = ( | ||
| 189 | + 331C80D1294CF70F00263BE5 /* Sources */, | ||
| 190 | + 331C80D2294CF70F00263BE5 /* Frameworks */, | ||
| 191 | + 331C80D3294CF70F00263BE5 /* Resources */, | ||
| 192 | + ); | ||
| 193 | + buildRules = ( | ||
| 194 | + ); | ||
| 195 | + dependencies = ( | ||
| 196 | + 331C80DA294CF71000263BE5 /* PBXTargetDependency */, | ||
| 197 | + ); | ||
| 198 | + name = RunnerTests; | ||
| 199 | + productName = RunnerTests; | ||
| 200 | + productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; | ||
| 201 | + productType = "com.apple.product-type.bundle.unit-test"; | ||
| 202 | + }; | ||
| 203 | + 33CC10EC2044A3C60003C045 /* Runner */ = { | ||
| 204 | + isa = PBXNativeTarget; | ||
| 205 | + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; | ||
| 206 | + buildPhases = ( | ||
| 207 | + 33CC10E92044A3C60003C045 /* Sources */, | ||
| 208 | + 33CC10EA2044A3C60003C045 /* Frameworks */, | ||
| 209 | + 33CC10EB2044A3C60003C045 /* Resources */, | ||
| 210 | + 33CC110E2044A8840003C045 /* Bundle Framework */, | ||
| 211 | + 3399D490228B24CF009A79C7 /* ShellScript */, | ||
| 212 | + ); | ||
| 213 | + buildRules = ( | ||
| 214 | + ); | ||
| 215 | + dependencies = ( | ||
| 216 | + 33CC11202044C79F0003C045 /* PBXTargetDependency */, | ||
| 217 | + ); | ||
| 218 | + name = Runner; | ||
| 219 | + productName = Runner; | ||
| 220 | + productReference = 33CC10ED2044A3C60003C045 /* tts.app */; | ||
| 221 | + productType = "com.apple.product-type.application"; | ||
| 222 | + }; | ||
| 223 | +/* End PBXNativeTarget section */ | ||
| 224 | + | ||
| 225 | +/* Begin PBXProject section */ | ||
| 226 | + 33CC10E52044A3C60003C045 /* Project object */ = { | ||
| 227 | + isa = PBXProject; | ||
| 228 | + attributes = { | ||
| 229 | + BuildIndependentTargetsInParallel = YES; | ||
| 230 | + LastSwiftUpdateCheck = 0920; | ||
| 231 | + LastUpgradeCheck = 1510; | ||
| 232 | + ORGANIZATIONNAME = ""; | ||
| 233 | + TargetAttributes = { | ||
| 234 | + 331C80D4294CF70F00263BE5 = { | ||
| 235 | + CreatedOnToolsVersion = 14.0; | ||
| 236 | + TestTargetID = 33CC10EC2044A3C60003C045; | ||
| 237 | + }; | ||
| 238 | + 33CC10EC2044A3C60003C045 = { | ||
| 239 | + CreatedOnToolsVersion = 9.2; | ||
| 240 | + LastSwiftMigration = 1100; | ||
| 241 | + ProvisioningStyle = Automatic; | ||
| 242 | + SystemCapabilities = { | ||
| 243 | + com.apple.Sandbox = { | ||
| 244 | + enabled = 1; | ||
| 245 | + }; | ||
| 246 | + }; | ||
| 247 | + }; | ||
| 248 | + 33CC111A2044C6BA0003C045 = { | ||
| 249 | + CreatedOnToolsVersion = 9.2; | ||
| 250 | + ProvisioningStyle = Manual; | ||
| 251 | + }; | ||
| 252 | + }; | ||
| 253 | + }; | ||
| 254 | + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; | ||
| 255 | + compatibilityVersion = "Xcode 9.3"; | ||
| 256 | + developmentRegion = en; | ||
| 257 | + hasScannedForEncodings = 0; | ||
| 258 | + knownRegions = ( | ||
| 259 | + en, | ||
| 260 | + Base, | ||
| 261 | + ); | ||
| 262 | + mainGroup = 33CC10E42044A3C60003C045; | ||
| 263 | + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; | ||
| 264 | + projectDirPath = ""; | ||
| 265 | + projectRoot = ""; | ||
| 266 | + targets = ( | ||
| 267 | + 33CC10EC2044A3C60003C045 /* Runner */, | ||
| 268 | + 331C80D4294CF70F00263BE5 /* RunnerTests */, | ||
| 269 | + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, | ||
| 270 | + ); | ||
| 271 | + }; | ||
| 272 | +/* End PBXProject section */ | ||
| 273 | + | ||
| 274 | +/* Begin PBXResourcesBuildPhase section */ | ||
| 275 | + 331C80D3294CF70F00263BE5 /* Resources */ = { | ||
| 276 | + isa = PBXResourcesBuildPhase; | ||
| 277 | + buildActionMask = 2147483647; | ||
| 278 | + files = ( | ||
| 279 | + ); | ||
| 280 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 281 | + }; | ||
| 282 | + 33CC10EB2044A3C60003C045 /* Resources */ = { | ||
| 283 | + isa = PBXResourcesBuildPhase; | ||
| 284 | + buildActionMask = 2147483647; | ||
| 285 | + files = ( | ||
| 286 | + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, | ||
| 287 | + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, | ||
| 288 | + ); | ||
| 289 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 290 | + }; | ||
| 291 | +/* End PBXResourcesBuildPhase section */ | ||
| 292 | + | ||
| 293 | +/* Begin PBXShellScriptBuildPhase section */ | ||
| 294 | + 3399D490228B24CF009A79C7 /* ShellScript */ = { | ||
| 295 | + isa = PBXShellScriptBuildPhase; | ||
| 296 | + alwaysOutOfDate = 1; | ||
| 297 | + buildActionMask = 2147483647; | ||
| 298 | + files = ( | ||
| 299 | + ); | ||
| 300 | + inputFileListPaths = ( | ||
| 301 | + ); | ||
| 302 | + inputPaths = ( | ||
| 303 | + ); | ||
| 304 | + outputFileListPaths = ( | ||
| 305 | + ); | ||
| 306 | + outputPaths = ( | ||
| 307 | + ); | ||
| 308 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 309 | + shellPath = /bin/sh; | ||
| 310 | + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; | ||
| 311 | + }; | ||
| 312 | + 33CC111E2044C6BF0003C045 /* ShellScript */ = { | ||
| 313 | + isa = PBXShellScriptBuildPhase; | ||
| 314 | + buildActionMask = 2147483647; | ||
| 315 | + files = ( | ||
| 316 | + ); | ||
| 317 | + inputFileListPaths = ( | ||
| 318 | + Flutter/ephemeral/FlutterInputs.xcfilelist, | ||
| 319 | + ); | ||
| 320 | + inputPaths = ( | ||
| 321 | + Flutter/ephemeral/tripwire, | ||
| 322 | + ); | ||
| 323 | + outputFileListPaths = ( | ||
| 324 | + Flutter/ephemeral/FlutterOutputs.xcfilelist, | ||
| 325 | + ); | ||
| 326 | + outputPaths = ( | ||
| 327 | + ); | ||
| 328 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 329 | + shellPath = /bin/sh; | ||
| 330 | + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; | ||
| 331 | + }; | ||
| 332 | +/* End PBXShellScriptBuildPhase section */ | ||
| 333 | + | ||
| 334 | +/* Begin PBXSourcesBuildPhase section */ | ||
| 335 | + 331C80D1294CF70F00263BE5 /* Sources */ = { | ||
| 336 | + isa = PBXSourcesBuildPhase; | ||
| 337 | + buildActionMask = 2147483647; | ||
| 338 | + files = ( | ||
| 339 | + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, | ||
| 340 | + ); | ||
| 341 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 342 | + }; | ||
| 343 | + 33CC10E92044A3C60003C045 /* Sources */ = { | ||
| 344 | + isa = PBXSourcesBuildPhase; | ||
| 345 | + buildActionMask = 2147483647; | ||
| 346 | + files = ( | ||
| 347 | + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, | ||
| 348 | + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, | ||
| 349 | + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, | ||
| 350 | + ); | ||
| 351 | + runOnlyForDeploymentPostprocessing = 0; | ||
| 352 | + }; | ||
| 353 | +/* End PBXSourcesBuildPhase section */ | ||
| 354 | + | ||
| 355 | +/* Begin PBXTargetDependency section */ | ||
| 356 | + 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { | ||
| 357 | + isa = PBXTargetDependency; | ||
| 358 | + target = 33CC10EC2044A3C60003C045 /* Runner */; | ||
| 359 | + targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; | ||
| 360 | + }; | ||
| 361 | + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { | ||
| 362 | + isa = PBXTargetDependency; | ||
| 363 | + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; | ||
| 364 | + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; | ||
| 365 | + }; | ||
| 366 | +/* End PBXTargetDependency section */ | ||
| 367 | + | ||
| 368 | +/* Begin PBXVariantGroup section */ | ||
| 369 | + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { | ||
| 370 | + isa = PBXVariantGroup; | ||
| 371 | + children = ( | ||
| 372 | + 33CC10F52044A3C60003C045 /* Base */, | ||
| 373 | + ); | ||
| 374 | + name = MainMenu.xib; | ||
| 375 | + path = Runner; | ||
| 376 | + sourceTree = "<group>"; | ||
| 377 | + }; | ||
| 378 | +/* End PBXVariantGroup section */ | ||
| 379 | + | ||
| 380 | +/* Begin XCBuildConfiguration section */ | ||
| 381 | + 331C80DB294CF71000263BE5 /* Debug */ = { | ||
| 382 | + isa = XCBuildConfiguration; | ||
| 383 | + buildSettings = { | ||
| 384 | + BUNDLE_LOADER = "$(TEST_HOST)"; | ||
| 385 | + CURRENT_PROJECT_VERSION = 1; | ||
| 386 | + GENERATE_INFOPLIST_FILE = YES; | ||
| 387 | + MARKETING_VERSION = 1.0; | ||
| 388 | + PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.tts.RunnerTests; | ||
| 389 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 390 | + SWIFT_VERSION = 5.0; | ||
| 391 | + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/tts.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/tts"; | ||
| 392 | + }; | ||
| 393 | + name = Debug; | ||
| 394 | + }; | ||
| 395 | + 331C80DC294CF71000263BE5 /* Release */ = { | ||
| 396 | + isa = XCBuildConfiguration; | ||
| 397 | + buildSettings = { | ||
| 398 | + BUNDLE_LOADER = "$(TEST_HOST)"; | ||
| 399 | + CURRENT_PROJECT_VERSION = 1; | ||
| 400 | + GENERATE_INFOPLIST_FILE = YES; | ||
| 401 | + MARKETING_VERSION = 1.0; | ||
| 402 | + PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.tts.RunnerTests; | ||
| 403 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 404 | + SWIFT_VERSION = 5.0; | ||
| 405 | + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/tts.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/tts"; | ||
| 406 | + }; | ||
| 407 | + name = Release; | ||
| 408 | + }; | ||
| 409 | + 331C80DD294CF71000263BE5 /* Profile */ = { | ||
| 410 | + isa = XCBuildConfiguration; | ||
| 411 | + buildSettings = { | ||
| 412 | + BUNDLE_LOADER = "$(TEST_HOST)"; | ||
| 413 | + CURRENT_PROJECT_VERSION = 1; | ||
| 414 | + GENERATE_INFOPLIST_FILE = YES; | ||
| 415 | + MARKETING_VERSION = 1.0; | ||
| 416 | + PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.tts.RunnerTests; | ||
| 417 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 418 | + SWIFT_VERSION = 5.0; | ||
| 419 | + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/tts.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/tts"; | ||
| 420 | + }; | ||
| 421 | + name = Profile; | ||
| 422 | + }; | ||
| 423 | + 338D0CE9231458BD00FA5F75 /* Profile */ = { | ||
| 424 | + isa = XCBuildConfiguration; | ||
| 425 | + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; | ||
| 426 | + buildSettings = { | ||
| 427 | + ALWAYS_SEARCH_USER_PATHS = NO; | ||
| 428 | + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; | ||
| 429 | + CLANG_ANALYZER_NONNULL = YES; | ||
| 430 | + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; | ||
| 431 | + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; | ||
| 432 | + CLANG_CXX_LIBRARY = "libc++"; | ||
| 433 | + CLANG_ENABLE_MODULES = YES; | ||
| 434 | + CLANG_ENABLE_OBJC_ARC = YES; | ||
| 435 | + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | ||
| 436 | + CLANG_WARN_BOOL_CONVERSION = YES; | ||
| 437 | + CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
| 438 | + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | ||
| 439 | + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
| 440 | + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; | ||
| 441 | + CLANG_WARN_EMPTY_BODY = YES; | ||
| 442 | + CLANG_WARN_ENUM_CONVERSION = YES; | ||
| 443 | + CLANG_WARN_INFINITE_RECURSION = YES; | ||
| 444 | + CLANG_WARN_INT_CONVERSION = YES; | ||
| 445 | + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | ||
| 446 | + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | ||
| 447 | + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
| 448 | + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | ||
| 449 | + CLANG_WARN_SUSPICIOUS_MOVE = YES; | ||
| 450 | + CODE_SIGN_IDENTITY = "-"; | ||
| 451 | + COPY_PHASE_STRIP = NO; | ||
| 452 | + DEAD_CODE_STRIPPING = YES; | ||
| 453 | + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | ||
| 454 | + ENABLE_NS_ASSERTIONS = NO; | ||
| 455 | + ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
| 456 | + ENABLE_USER_SCRIPT_SANDBOXING = NO; | ||
| 457 | + GCC_C_LANGUAGE_STANDARD = gnu11; | ||
| 458 | + GCC_NO_COMMON_BLOCKS = YES; | ||
| 459 | + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
| 460 | + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
| 461 | + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
| 462 | + GCC_WARN_UNUSED_FUNCTION = YES; | ||
| 463 | + GCC_WARN_UNUSED_VARIABLE = YES; | ||
| 464 | + MACOSX_DEPLOYMENT_TARGET = 10.14; | ||
| 465 | + MTL_ENABLE_DEBUG_INFO = NO; | ||
| 466 | + SDKROOT = macosx; | ||
| 467 | + SWIFT_COMPILATION_MODE = wholemodule; | ||
| 468 | + SWIFT_OPTIMIZATION_LEVEL = "-O"; | ||
| 469 | + }; | ||
| 470 | + name = Profile; | ||
| 471 | + }; | ||
| 472 | + 338D0CEA231458BD00FA5F75 /* Profile */ = { | ||
| 473 | + isa = XCBuildConfiguration; | ||
| 474 | + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; | ||
| 475 | + buildSettings = { | ||
| 476 | + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
| 477 | + CLANG_ENABLE_MODULES = YES; | ||
| 478 | + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; | ||
| 479 | + CODE_SIGN_STYLE = Automatic; | ||
| 480 | + COMBINE_HIDPI_IMAGES = YES; | ||
| 481 | + INFOPLIST_FILE = Runner/Info.plist; | ||
| 482 | + LD_RUNPATH_SEARCH_PATHS = ( | ||
| 483 | + "$(inherited)", | ||
| 484 | + "@executable_path/../Frameworks", | ||
| 485 | + ); | ||
| 486 | + PROVISIONING_PROFILE_SPECIFIER = ""; | ||
| 487 | + SWIFT_VERSION = 5.0; | ||
| 488 | + }; | ||
| 489 | + name = Profile; | ||
| 490 | + }; | ||
| 491 | + 338D0CEB231458BD00FA5F75 /* Profile */ = { | ||
| 492 | + isa = XCBuildConfiguration; | ||
| 493 | + buildSettings = { | ||
| 494 | + CODE_SIGN_STYLE = Manual; | ||
| 495 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 496 | + }; | ||
| 497 | + name = Profile; | ||
| 498 | + }; | ||
| 499 | + 33CC10F92044A3C60003C045 /* Debug */ = { | ||
| 500 | + isa = XCBuildConfiguration; | ||
| 501 | + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; | ||
| 502 | + buildSettings = { | ||
| 503 | + ALWAYS_SEARCH_USER_PATHS = NO; | ||
| 504 | + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; | ||
| 505 | + CLANG_ANALYZER_NONNULL = YES; | ||
| 506 | + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; | ||
| 507 | + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; | ||
| 508 | + CLANG_CXX_LIBRARY = "libc++"; | ||
| 509 | + CLANG_ENABLE_MODULES = YES; | ||
| 510 | + CLANG_ENABLE_OBJC_ARC = YES; | ||
| 511 | + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | ||
| 512 | + CLANG_WARN_BOOL_CONVERSION = YES; | ||
| 513 | + CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
| 514 | + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | ||
| 515 | + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
| 516 | + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; | ||
| 517 | + CLANG_WARN_EMPTY_BODY = YES; | ||
| 518 | + CLANG_WARN_ENUM_CONVERSION = YES; | ||
| 519 | + CLANG_WARN_INFINITE_RECURSION = YES; | ||
| 520 | + CLANG_WARN_INT_CONVERSION = YES; | ||
| 521 | + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | ||
| 522 | + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | ||
| 523 | + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
| 524 | + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | ||
| 525 | + CLANG_WARN_SUSPICIOUS_MOVE = YES; | ||
| 526 | + CODE_SIGN_IDENTITY = "-"; | ||
| 527 | + COPY_PHASE_STRIP = NO; | ||
| 528 | + DEAD_CODE_STRIPPING = YES; | ||
| 529 | + DEBUG_INFORMATION_FORMAT = dwarf; | ||
| 530 | + ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
| 531 | + ENABLE_TESTABILITY = YES; | ||
| 532 | + ENABLE_USER_SCRIPT_SANDBOXING = NO; | ||
| 533 | + GCC_C_LANGUAGE_STANDARD = gnu11; | ||
| 534 | + GCC_DYNAMIC_NO_PIC = NO; | ||
| 535 | + GCC_NO_COMMON_BLOCKS = YES; | ||
| 536 | + GCC_OPTIMIZATION_LEVEL = 0; | ||
| 537 | + GCC_PREPROCESSOR_DEFINITIONS = ( | ||
| 538 | + "DEBUG=1", | ||
| 539 | + "$(inherited)", | ||
| 540 | + ); | ||
| 541 | + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
| 542 | + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
| 543 | + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
| 544 | + GCC_WARN_UNUSED_FUNCTION = YES; | ||
| 545 | + GCC_WARN_UNUSED_VARIABLE = YES; | ||
| 546 | + MACOSX_DEPLOYMENT_TARGET = 10.14; | ||
| 547 | + MTL_ENABLE_DEBUG_INFO = YES; | ||
| 548 | + ONLY_ACTIVE_ARCH = YES; | ||
| 549 | + SDKROOT = macosx; | ||
| 550 | + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; | ||
| 551 | + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | ||
| 552 | + }; | ||
| 553 | + name = Debug; | ||
| 554 | + }; | ||
| 555 | + 33CC10FA2044A3C60003C045 /* Release */ = { | ||
| 556 | + isa = XCBuildConfiguration; | ||
| 557 | + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; | ||
| 558 | + buildSettings = { | ||
| 559 | + ALWAYS_SEARCH_USER_PATHS = NO; | ||
| 560 | + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; | ||
| 561 | + CLANG_ANALYZER_NONNULL = YES; | ||
| 562 | + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; | ||
| 563 | + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; | ||
| 564 | + CLANG_CXX_LIBRARY = "libc++"; | ||
| 565 | + CLANG_ENABLE_MODULES = YES; | ||
| 566 | + CLANG_ENABLE_OBJC_ARC = YES; | ||
| 567 | + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | ||
| 568 | + CLANG_WARN_BOOL_CONVERSION = YES; | ||
| 569 | + CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
| 570 | + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | ||
| 571 | + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
| 572 | + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; | ||
| 573 | + CLANG_WARN_EMPTY_BODY = YES; | ||
| 574 | + CLANG_WARN_ENUM_CONVERSION = YES; | ||
| 575 | + CLANG_WARN_INFINITE_RECURSION = YES; | ||
| 576 | + CLANG_WARN_INT_CONVERSION = YES; | ||
| 577 | + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | ||
| 578 | + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | ||
| 579 | + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
| 580 | + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | ||
| 581 | + CLANG_WARN_SUSPICIOUS_MOVE = YES; | ||
| 582 | + CODE_SIGN_IDENTITY = "-"; | ||
| 583 | + COPY_PHASE_STRIP = NO; | ||
| 584 | + DEAD_CODE_STRIPPING = YES; | ||
| 585 | + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | ||
| 586 | + ENABLE_NS_ASSERTIONS = NO; | ||
| 587 | + ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
| 588 | + ENABLE_USER_SCRIPT_SANDBOXING = NO; | ||
| 589 | + GCC_C_LANGUAGE_STANDARD = gnu11; | ||
| 590 | + GCC_NO_COMMON_BLOCKS = YES; | ||
| 591 | + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
| 592 | + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
| 593 | + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
| 594 | + GCC_WARN_UNUSED_FUNCTION = YES; | ||
| 595 | + GCC_WARN_UNUSED_VARIABLE = YES; | ||
| 596 | + MACOSX_DEPLOYMENT_TARGET = 10.14; | ||
| 597 | + MTL_ENABLE_DEBUG_INFO = NO; | ||
| 598 | + SDKROOT = macosx; | ||
| 599 | + SWIFT_COMPILATION_MODE = wholemodule; | ||
| 600 | + SWIFT_OPTIMIZATION_LEVEL = "-O"; | ||
| 601 | + }; | ||
| 602 | + name = Release; | ||
| 603 | + }; | ||
| 604 | + 33CC10FC2044A3C60003C045 /* Debug */ = { | ||
| 605 | + isa = XCBuildConfiguration; | ||
| 606 | + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; | ||
| 607 | + buildSettings = { | ||
| 608 | + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
| 609 | + CLANG_ENABLE_MODULES = YES; | ||
| 610 | + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; | ||
| 611 | + CODE_SIGN_STYLE = Automatic; | ||
| 612 | + COMBINE_HIDPI_IMAGES = YES; | ||
| 613 | + INFOPLIST_FILE = Runner/Info.plist; | ||
| 614 | + LD_RUNPATH_SEARCH_PATHS = ( | ||
| 615 | + "$(inherited)", | ||
| 616 | + "@executable_path/../Frameworks", | ||
| 617 | + ); | ||
| 618 | + PROVISIONING_PROFILE_SPECIFIER = ""; | ||
| 619 | + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | ||
| 620 | + SWIFT_VERSION = 5.0; | ||
| 621 | + }; | ||
| 622 | + name = Debug; | ||
| 623 | + }; | ||
| 624 | + 33CC10FD2044A3C60003C045 /* Release */ = { | ||
| 625 | + isa = XCBuildConfiguration; | ||
| 626 | + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; | ||
| 627 | + buildSettings = { | ||
| 628 | + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||
| 629 | + CLANG_ENABLE_MODULES = YES; | ||
| 630 | + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; | ||
| 631 | + CODE_SIGN_STYLE = Automatic; | ||
| 632 | + COMBINE_HIDPI_IMAGES = YES; | ||
| 633 | + INFOPLIST_FILE = Runner/Info.plist; | ||
| 634 | + LD_RUNPATH_SEARCH_PATHS = ( | ||
| 635 | + "$(inherited)", | ||
| 636 | + "@executable_path/../Frameworks", | ||
| 637 | + ); | ||
| 638 | + PROVISIONING_PROFILE_SPECIFIER = ""; | ||
| 639 | + SWIFT_VERSION = 5.0; | ||
| 640 | + }; | ||
| 641 | + name = Release; | ||
| 642 | + }; | ||
| 643 | + 33CC111C2044C6BA0003C045 /* Debug */ = { | ||
| 644 | + isa = XCBuildConfiguration; | ||
| 645 | + buildSettings = { | ||
| 646 | + CODE_SIGN_STYLE = Manual; | ||
| 647 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 648 | + }; | ||
| 649 | + name = Debug; | ||
| 650 | + }; | ||
| 651 | + 33CC111D2044C6BA0003C045 /* Release */ = { | ||
| 652 | + isa = XCBuildConfiguration; | ||
| 653 | + buildSettings = { | ||
| 654 | + CODE_SIGN_STYLE = Automatic; | ||
| 655 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 656 | + }; | ||
| 657 | + name = Release; | ||
| 658 | + }; | ||
| 659 | +/* End XCBuildConfiguration section */ | ||
| 660 | + | ||
| 661 | +/* Begin XCConfigurationList section */ | ||
| 662 | + 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { | ||
| 663 | + isa = XCConfigurationList; | ||
| 664 | + buildConfigurations = ( | ||
| 665 | + 331C80DB294CF71000263BE5 /* Debug */, | ||
| 666 | + 331C80DC294CF71000263BE5 /* Release */, | ||
| 667 | + 331C80DD294CF71000263BE5 /* Profile */, | ||
| 668 | + ); | ||
| 669 | + defaultConfigurationIsVisible = 0; | ||
| 670 | + defaultConfigurationName = Release; | ||
| 671 | + }; | ||
| 672 | + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { | ||
| 673 | + isa = XCConfigurationList; | ||
| 674 | + buildConfigurations = ( | ||
| 675 | + 33CC10F92044A3C60003C045 /* Debug */, | ||
| 676 | + 33CC10FA2044A3C60003C045 /* Release */, | ||
| 677 | + 338D0CE9231458BD00FA5F75 /* Profile */, | ||
| 678 | + ); | ||
| 679 | + defaultConfigurationIsVisible = 0; | ||
| 680 | + defaultConfigurationName = Release; | ||
| 681 | + }; | ||
| 682 | + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { | ||
| 683 | + isa = XCConfigurationList; | ||
| 684 | + buildConfigurations = ( | ||
| 685 | + 33CC10FC2044A3C60003C045 /* Debug */, | ||
| 686 | + 33CC10FD2044A3C60003C045 /* Release */, | ||
| 687 | + 338D0CEA231458BD00FA5F75 /* Profile */, | ||
| 688 | + ); | ||
| 689 | + defaultConfigurationIsVisible = 0; | ||
| 690 | + defaultConfigurationName = Release; | ||
| 691 | + }; | ||
| 692 | + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { | ||
| 693 | + isa = XCConfigurationList; | ||
| 694 | + buildConfigurations = ( | ||
| 695 | + 33CC111C2044C6BA0003C045 /* Debug */, | ||
| 696 | + 33CC111D2044C6BA0003C045 /* Release */, | ||
| 697 | + 338D0CEB231458BD00FA5F75 /* Profile */, | ||
| 698 | + ); | ||
| 699 | + defaultConfigurationIsVisible = 0; | ||
| 700 | + defaultConfigurationName = Release; | ||
| 701 | + }; | ||
| 702 | +/* End XCConfigurationList section */ | ||
| 703 | + }; | ||
| 704 | + rootObject = 33CC10E52044A3C60003C045 /* Project object */; | ||
| 705 | +} |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<Scheme | ||
| 3 | + LastUpgradeVersion = "1510" | ||
| 4 | + version = "1.3"> | ||
| 5 | + <BuildAction | ||
| 6 | + parallelizeBuildables = "YES" | ||
| 7 | + buildImplicitDependencies = "YES"> | ||
| 8 | + <BuildActionEntries> | ||
| 9 | + <BuildActionEntry | ||
| 10 | + buildForTesting = "YES" | ||
| 11 | + buildForRunning = "YES" | ||
| 12 | + buildForProfiling = "YES" | ||
| 13 | + buildForArchiving = "YES" | ||
| 14 | + buildForAnalyzing = "YES"> | ||
| 15 | + <BuildableReference | ||
| 16 | + BuildableIdentifier = "primary" | ||
| 17 | + BlueprintIdentifier = "33CC10EC2044A3C60003C045" | ||
| 18 | + BuildableName = "tts.app" | ||
| 19 | + BlueprintName = "Runner" | ||
| 20 | + ReferencedContainer = "container:Runner.xcodeproj"> | ||
| 21 | + </BuildableReference> | ||
| 22 | + </BuildActionEntry> | ||
| 23 | + </BuildActionEntries> | ||
| 24 | + </BuildAction> | ||
| 25 | + <TestAction | ||
| 26 | + buildConfiguration = "Debug" | ||
| 27 | + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| 28 | + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| 29 | + shouldUseLaunchSchemeArgsEnv = "YES"> | ||
| 30 | + <MacroExpansion> | ||
| 31 | + <BuildableReference | ||
| 32 | + BuildableIdentifier = "primary" | ||
| 33 | + BlueprintIdentifier = "33CC10EC2044A3C60003C045" | ||
| 34 | + BuildableName = "tts.app" | ||
| 35 | + BlueprintName = "Runner" | ||
| 36 | + ReferencedContainer = "container:Runner.xcodeproj"> | ||
| 37 | + </BuildableReference> | ||
| 38 | + </MacroExpansion> | ||
| 39 | + <Testables> | ||
| 40 | + <TestableReference | ||
| 41 | + skipped = "NO" | ||
| 42 | + parallelizable = "YES"> | ||
| 43 | + <BuildableReference | ||
| 44 | + BuildableIdentifier = "primary" | ||
| 45 | + BlueprintIdentifier = "331C80D4294CF70F00263BE5" | ||
| 46 | + BuildableName = "RunnerTests.xctest" | ||
| 47 | + BlueprintName = "RunnerTests" | ||
| 48 | + ReferencedContainer = "container:Runner.xcodeproj"> | ||
| 49 | + </BuildableReference> | ||
| 50 | + </TestableReference> | ||
| 51 | + </Testables> | ||
| 52 | + </TestAction> | ||
| 53 | + <LaunchAction | ||
| 54 | + buildConfiguration = "Debug" | ||
| 55 | + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
| 56 | + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
| 57 | + launchStyle = "0" | ||
| 58 | + useCustomWorkingDirectory = "NO" | ||
| 59 | + ignoresPersistentStateOnLaunch = "NO" | ||
| 60 | + debugDocumentVersioning = "YES" | ||
| 61 | + debugServiceExtension = "internal" | ||
| 62 | + allowLocationSimulation = "YES"> | ||
| 63 | + <BuildableProductRunnable | ||
| 64 | + runnableDebuggingMode = "0"> | ||
| 65 | + <BuildableReference | ||
| 66 | + BuildableIdentifier = "primary" | ||
| 67 | + BlueprintIdentifier = "33CC10EC2044A3C60003C045" | ||
| 68 | + BuildableName = "tts.app" | ||
| 69 | + BlueprintName = "Runner" | ||
| 70 | + ReferencedContainer = "container:Runner.xcodeproj"> | ||
| 71 | + </BuildableReference> | ||
| 72 | + </BuildableProductRunnable> | ||
| 73 | + </LaunchAction> | ||
| 74 | + <ProfileAction | ||
| 75 | + buildConfiguration = "Profile" | ||
| 76 | + shouldUseLaunchSchemeArgsEnv = "YES" | ||
| 77 | + savedToolIdentifier = "" | ||
| 78 | + useCustomWorkingDirectory = "NO" | ||
| 79 | + debugDocumentVersioning = "YES"> | ||
| 80 | + <BuildableProductRunnable | ||
| 81 | + runnableDebuggingMode = "0"> | ||
| 82 | + <BuildableReference | ||
| 83 | + BuildableIdentifier = "primary" | ||
| 84 | + BlueprintIdentifier = "33CC10EC2044A3C60003C045" | ||
| 85 | + BuildableName = "tts.app" | ||
| 86 | + BlueprintName = "Runner" | ||
| 87 | + ReferencedContainer = "container:Runner.xcodeproj"> | ||
| 88 | + </BuildableReference> | ||
| 89 | + </BuildableProductRunnable> | ||
| 90 | + </ProfileAction> | ||
| 91 | + <AnalyzeAction | ||
| 92 | + buildConfiguration = "Debug"> | ||
| 93 | + </AnalyzeAction> | ||
| 94 | + <ArchiveAction | ||
| 95 | + buildConfiguration = "Release" | ||
| 96 | + revealArchiveInOrganizer = "YES"> | ||
| 97 | + </ArchiveAction> | ||
| 98 | +</Scheme> |
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "size" : "16x16", | ||
| 5 | + "idiom" : "mac", | ||
| 6 | + "filename" : "app_icon_16.png", | ||
| 7 | + "scale" : "1x" | ||
| 8 | + }, | ||
| 9 | + { | ||
| 10 | + "size" : "16x16", | ||
| 11 | + "idiom" : "mac", | ||
| 12 | + "filename" : "app_icon_32.png", | ||
| 13 | + "scale" : "2x" | ||
| 14 | + }, | ||
| 15 | + { | ||
| 16 | + "size" : "32x32", | ||
| 17 | + "idiom" : "mac", | ||
| 18 | + "filename" : "app_icon_32.png", | ||
| 19 | + "scale" : "1x" | ||
| 20 | + }, | ||
| 21 | + { | ||
| 22 | + "size" : "32x32", | ||
| 23 | + "idiom" : "mac", | ||
| 24 | + "filename" : "app_icon_64.png", | ||
| 25 | + "scale" : "2x" | ||
| 26 | + }, | ||
| 27 | + { | ||
| 28 | + "size" : "128x128", | ||
| 29 | + "idiom" : "mac", | ||
| 30 | + "filename" : "app_icon_128.png", | ||
| 31 | + "scale" : "1x" | ||
| 32 | + }, | ||
| 33 | + { | ||
| 34 | + "size" : "128x128", | ||
| 35 | + "idiom" : "mac", | ||
| 36 | + "filename" : "app_icon_256.png", | ||
| 37 | + "scale" : "2x" | ||
| 38 | + }, | ||
| 39 | + { | ||
| 40 | + "size" : "256x256", | ||
| 41 | + "idiom" : "mac", | ||
| 42 | + "filename" : "app_icon_256.png", | ||
| 43 | + "scale" : "1x" | ||
| 44 | + }, | ||
| 45 | + { | ||
| 46 | + "size" : "256x256", | ||
| 47 | + "idiom" : "mac", | ||
| 48 | + "filename" : "app_icon_512.png", | ||
| 49 | + "scale" : "2x" | ||
| 50 | + }, | ||
| 51 | + { | ||
| 52 | + "size" : "512x512", | ||
| 53 | + "idiom" : "mac", | ||
| 54 | + "filename" : "app_icon_512.png", | ||
| 55 | + "scale" : "1x" | ||
| 56 | + }, | ||
| 57 | + { | ||
| 58 | + "size" : "512x512", | ||
| 59 | + "idiom" : "mac", | ||
| 60 | + "filename" : "app_icon_1024.png", | ||
| 61 | + "scale" : "2x" | ||
| 62 | + } | ||
| 63 | + ], | ||
| 64 | + "info" : { | ||
| 65 | + "version" : 1, | ||
| 66 | + "author" : "xcode" | ||
| 67 | + } | ||
| 68 | +} |
100.6 KB
5.5 KB
520 字节
13.8 KB
1.0 KB
35.6 KB
2.2 KB
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct"> | ||
| 3 | + <dependencies> | ||
| 4 | + <deployment identifier="macosx"/> | ||
| 5 | + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/> | ||
| 6 | + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
| 7 | + </dependencies> | ||
| 8 | + <objects> | ||
| 9 | + <customObject id="-2" userLabel="File's Owner" customClass="NSApplication"> | ||
| 10 | + <connections> | ||
| 11 | + <outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/> | ||
| 12 | + </connections> | ||
| 13 | + </customObject> | ||
| 14 | + <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> | ||
| 15 | + <customObject id="-3" userLabel="Application" customClass="NSObject"/> | ||
| 16 | + <customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="Runner" customModuleProvider="target"> | ||
| 17 | + <connections> | ||
| 18 | + <outlet property="applicationMenu" destination="uQy-DD-JDr" id="XBo-yE-nKs"/> | ||
| 19 | + <outlet property="mainFlutterWindow" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/> | ||
| 20 | + </connections> | ||
| 21 | + </customObject> | ||
| 22 | + <customObject id="YLy-65-1bz" customClass="NSFontManager"/> | ||
| 23 | + <menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6"> | ||
| 24 | + <items> | ||
| 25 | + <menuItem title="APP_NAME" id="1Xt-HY-uBw"> | ||
| 26 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 27 | + <menu key="submenu" title="APP_NAME" systemMenu="apple" id="uQy-DD-JDr"> | ||
| 28 | + <items> | ||
| 29 | + <menuItem title="About APP_NAME" id="5kV-Vb-QxS"> | ||
| 30 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 31 | + <connections> | ||
| 32 | + <action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/> | ||
| 33 | + </connections> | ||
| 34 | + </menuItem> | ||
| 35 | + <menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/> | ||
| 36 | + <menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/> | ||
| 37 | + <menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/> | ||
| 38 | + <menuItem title="Services" id="NMo-om-nkz"> | ||
| 39 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 40 | + <menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/> | ||
| 41 | + </menuItem> | ||
| 42 | + <menuItem isSeparatorItem="YES" id="4je-JR-u6R"/> | ||
| 43 | + <menuItem title="Hide APP_NAME" keyEquivalent="h" id="Olw-nP-bQN"> | ||
| 44 | + <connections> | ||
| 45 | + <action selector="hide:" target="-1" id="PnN-Uc-m68"/> | ||
| 46 | + </connections> | ||
| 47 | + </menuItem> | ||
| 48 | + <menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO"> | ||
| 49 | + <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/> | ||
| 50 | + <connections> | ||
| 51 | + <action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/> | ||
| 52 | + </connections> | ||
| 53 | + </menuItem> | ||
| 54 | + <menuItem title="Show All" id="Kd2-mp-pUS"> | ||
| 55 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 56 | + <connections> | ||
| 57 | + <action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/> | ||
| 58 | + </connections> | ||
| 59 | + </menuItem> | ||
| 60 | + <menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/> | ||
| 61 | + <menuItem title="Quit APP_NAME" keyEquivalent="q" id="4sb-4s-VLi"> | ||
| 62 | + <connections> | ||
| 63 | + <action selector="terminate:" target="-1" id="Te7-pn-YzF"/> | ||
| 64 | + </connections> | ||
| 65 | + </menuItem> | ||
| 66 | + </items> | ||
| 67 | + </menu> | ||
| 68 | + </menuItem> | ||
| 69 | + <menuItem title="Edit" id="5QF-Oa-p0T"> | ||
| 70 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 71 | + <menu key="submenu" title="Edit" id="W48-6f-4Dl"> | ||
| 72 | + <items> | ||
| 73 | + <menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg"> | ||
| 74 | + <connections> | ||
| 75 | + <action selector="undo:" target="-1" id="M6e-cu-g7V"/> | ||
| 76 | + </connections> | ||
| 77 | + </menuItem> | ||
| 78 | + <menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam"> | ||
| 79 | + <connections> | ||
| 80 | + <action selector="redo:" target="-1" id="oIA-Rs-6OD"/> | ||
| 81 | + </connections> | ||
| 82 | + </menuItem> | ||
| 83 | + <menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/> | ||
| 84 | + <menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG"> | ||
| 85 | + <connections> | ||
| 86 | + <action selector="cut:" target="-1" id="YJe-68-I9s"/> | ||
| 87 | + </connections> | ||
| 88 | + </menuItem> | ||
| 89 | + <menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU"> | ||
| 90 | + <connections> | ||
| 91 | + <action selector="copy:" target="-1" id="G1f-GL-Joy"/> | ||
| 92 | + </connections> | ||
| 93 | + </menuItem> | ||
| 94 | + <menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL"> | ||
| 95 | + <connections> | ||
| 96 | + <action selector="paste:" target="-1" id="UvS-8e-Qdg"/> | ||
| 97 | + </connections> | ||
| 98 | + </menuItem> | ||
| 99 | + <menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk"> | ||
| 100 | + <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/> | ||
| 101 | + <connections> | ||
| 102 | + <action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/> | ||
| 103 | + </connections> | ||
| 104 | + </menuItem> | ||
| 105 | + <menuItem title="Delete" id="pa3-QI-u2k"> | ||
| 106 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 107 | + <connections> | ||
| 108 | + <action selector="delete:" target="-1" id="0Mk-Ml-PaM"/> | ||
| 109 | + </connections> | ||
| 110 | + </menuItem> | ||
| 111 | + <menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m"> | ||
| 112 | + <connections> | ||
| 113 | + <action selector="selectAll:" target="-1" id="VNm-Mi-diN"/> | ||
| 114 | + </connections> | ||
| 115 | + </menuItem> | ||
| 116 | + <menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/> | ||
| 117 | + <menuItem title="Find" id="4EN-yA-p0u"> | ||
| 118 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 119 | + <menu key="submenu" title="Find" id="1b7-l0-nxx"> | ||
| 120 | + <items> | ||
| 121 | + <menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W"> | ||
| 122 | + <connections> | ||
| 123 | + <action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/> | ||
| 124 | + </connections> | ||
| 125 | + </menuItem> | ||
| 126 | + <menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz"> | ||
| 127 | + <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/> | ||
| 128 | + <connections> | ||
| 129 | + <action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/> | ||
| 130 | + </connections> | ||
| 131 | + </menuItem> | ||
| 132 | + <menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye"> | ||
| 133 | + <connections> | ||
| 134 | + <action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/> | ||
| 135 | + </connections> | ||
| 136 | + </menuItem> | ||
| 137 | + <menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV"> | ||
| 138 | + <connections> | ||
| 139 | + <action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/> | ||
| 140 | + </connections> | ||
| 141 | + </menuItem> | ||
| 142 | + <menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt"> | ||
| 143 | + <connections> | ||
| 144 | + <action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/> | ||
| 145 | + </connections> | ||
| 146 | + </menuItem> | ||
| 147 | + <menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd"> | ||
| 148 | + <connections> | ||
| 149 | + <action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/> | ||
| 150 | + </connections> | ||
| 151 | + </menuItem> | ||
| 152 | + </items> | ||
| 153 | + </menu> | ||
| 154 | + </menuItem> | ||
| 155 | + <menuItem title="Spelling and Grammar" id="Dv1-io-Yv7"> | ||
| 156 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 157 | + <menu key="submenu" title="Spelling" id="3IN-sU-3Bg"> | ||
| 158 | + <items> | ||
| 159 | + <menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI"> | ||
| 160 | + <connections> | ||
| 161 | + <action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/> | ||
| 162 | + </connections> | ||
| 163 | + </menuItem> | ||
| 164 | + <menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7"> | ||
| 165 | + <connections> | ||
| 166 | + <action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/> | ||
| 167 | + </connections> | ||
| 168 | + </menuItem> | ||
| 169 | + <menuItem isSeparatorItem="YES" id="bNw-od-mp5"/> | ||
| 170 | + <menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN"> | ||
| 171 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 172 | + <connections> | ||
| 173 | + <action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/> | ||
| 174 | + </connections> | ||
| 175 | + </menuItem> | ||
| 176 | + <menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG"> | ||
| 177 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 178 | + <connections> | ||
| 179 | + <action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/> | ||
| 180 | + </connections> | ||
| 181 | + </menuItem> | ||
| 182 | + <menuItem title="Correct Spelling Automatically" id="78Y-hA-62v"> | ||
| 183 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 184 | + <connections> | ||
| 185 | + <action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/> | ||
| 186 | + </connections> | ||
| 187 | + </menuItem> | ||
| 188 | + </items> | ||
| 189 | + </menu> | ||
| 190 | + </menuItem> | ||
| 191 | + <menuItem title="Substitutions" id="9ic-FL-obx"> | ||
| 192 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 193 | + <menu key="submenu" title="Substitutions" id="FeM-D8-WVr"> | ||
| 194 | + <items> | ||
| 195 | + <menuItem title="Show Substitutions" id="z6F-FW-3nz"> | ||
| 196 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 197 | + <connections> | ||
| 198 | + <action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/> | ||
| 199 | + </connections> | ||
| 200 | + </menuItem> | ||
| 201 | + <menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/> | ||
| 202 | + <menuItem title="Smart Copy/Paste" id="9yt-4B-nSM"> | ||
| 203 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 204 | + <connections> | ||
| 205 | + <action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/> | ||
| 206 | + </connections> | ||
| 207 | + </menuItem> | ||
| 208 | + <menuItem title="Smart Quotes" id="hQb-2v-fYv"> | ||
| 209 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 210 | + <connections> | ||
| 211 | + <action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/> | ||
| 212 | + </connections> | ||
| 213 | + </menuItem> | ||
| 214 | + <menuItem title="Smart Dashes" id="rgM-f4-ycn"> | ||
| 215 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 216 | + <connections> | ||
| 217 | + <action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/> | ||
| 218 | + </connections> | ||
| 219 | + </menuItem> | ||
| 220 | + <menuItem title="Smart Links" id="cwL-P1-jid"> | ||
| 221 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 222 | + <connections> | ||
| 223 | + <action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/> | ||
| 224 | + </connections> | ||
| 225 | + </menuItem> | ||
| 226 | + <menuItem title="Data Detectors" id="tRr-pd-1PS"> | ||
| 227 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 228 | + <connections> | ||
| 229 | + <action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/> | ||
| 230 | + </connections> | ||
| 231 | + </menuItem> | ||
| 232 | + <menuItem title="Text Replacement" id="HFQ-gK-NFA"> | ||
| 233 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 234 | + <connections> | ||
| 235 | + <action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/> | ||
| 236 | + </connections> | ||
| 237 | + </menuItem> | ||
| 238 | + </items> | ||
| 239 | + </menu> | ||
| 240 | + </menuItem> | ||
| 241 | + <menuItem title="Transformations" id="2oI-Rn-ZJC"> | ||
| 242 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 243 | + <menu key="submenu" title="Transformations" id="c8a-y6-VQd"> | ||
| 244 | + <items> | ||
| 245 | + <menuItem title="Make Upper Case" id="vmV-6d-7jI"> | ||
| 246 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 247 | + <connections> | ||
| 248 | + <action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/> | ||
| 249 | + </connections> | ||
| 250 | + </menuItem> | ||
| 251 | + <menuItem title="Make Lower Case" id="d9M-CD-aMd"> | ||
| 252 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 253 | + <connections> | ||
| 254 | + <action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/> | ||
| 255 | + </connections> | ||
| 256 | + </menuItem> | ||
| 257 | + <menuItem title="Capitalize" id="UEZ-Bs-lqG"> | ||
| 258 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 259 | + <connections> | ||
| 260 | + <action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/> | ||
| 261 | + </connections> | ||
| 262 | + </menuItem> | ||
| 263 | + </items> | ||
| 264 | + </menu> | ||
| 265 | + </menuItem> | ||
| 266 | + <menuItem title="Speech" id="xrE-MZ-jX0"> | ||
| 267 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 268 | + <menu key="submenu" title="Speech" id="3rS-ZA-NoH"> | ||
| 269 | + <items> | ||
| 270 | + <menuItem title="Start Speaking" id="Ynk-f8-cLZ"> | ||
| 271 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 272 | + <connections> | ||
| 273 | + <action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/> | ||
| 274 | + </connections> | ||
| 275 | + </menuItem> | ||
| 276 | + <menuItem title="Stop Speaking" id="Oyz-dy-DGm"> | ||
| 277 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 278 | + <connections> | ||
| 279 | + <action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/> | ||
| 280 | + </connections> | ||
| 281 | + </menuItem> | ||
| 282 | + </items> | ||
| 283 | + </menu> | ||
| 284 | + </menuItem> | ||
| 285 | + </items> | ||
| 286 | + </menu> | ||
| 287 | + </menuItem> | ||
| 288 | + <menuItem title="View" id="H8h-7b-M4v"> | ||
| 289 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 290 | + <menu key="submenu" title="View" id="HyV-fh-RgO"> | ||
| 291 | + <items> | ||
| 292 | + <menuItem title="Enter Full Screen" keyEquivalent="f" id="4J7-dP-txa"> | ||
| 293 | + <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/> | ||
| 294 | + <connections> | ||
| 295 | + <action selector="toggleFullScreen:" target="-1" id="dU3-MA-1Rq"/> | ||
| 296 | + </connections> | ||
| 297 | + </menuItem> | ||
| 298 | + </items> | ||
| 299 | + </menu> | ||
| 300 | + </menuItem> | ||
| 301 | + <menuItem title="Window" id="aUF-d1-5bR"> | ||
| 302 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 303 | + <menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo"> | ||
| 304 | + <items> | ||
| 305 | + <menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV"> | ||
| 306 | + <connections> | ||
| 307 | + <action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/> | ||
| 308 | + </connections> | ||
| 309 | + </menuItem> | ||
| 310 | + <menuItem title="Zoom" id="R4o-n2-Eq4"> | ||
| 311 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 312 | + <connections> | ||
| 313 | + <action selector="performZoom:" target="-1" id="DIl-cC-cCs"/> | ||
| 314 | + </connections> | ||
| 315 | + </menuItem> | ||
| 316 | + <menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/> | ||
| 317 | + <menuItem title="Bring All to Front" id="LE2-aR-0XJ"> | ||
| 318 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 319 | + <connections> | ||
| 320 | + <action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/> | ||
| 321 | + </connections> | ||
| 322 | + </menuItem> | ||
| 323 | + </items> | ||
| 324 | + </menu> | ||
| 325 | + </menuItem> | ||
| 326 | + <menuItem title="Help" id="EPT-qC-fAb"> | ||
| 327 | + <modifierMask key="keyEquivalentModifierMask"/> | ||
| 328 | + <menu key="submenu" title="Help" systemMenu="help" id="rJ0-wn-3NY"/> | ||
| 329 | + </menuItem> | ||
| 330 | + </items> | ||
| 331 | + <point key="canvasLocation" x="142" y="-258"/> | ||
| 332 | + </menu> | ||
| 333 | + <window title="APP_NAME" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="MainFlutterWindow" customModule="Runner" customModuleProvider="target"> | ||
| 334 | + <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/> | ||
| 335 | + <rect key="contentRect" x="335" y="390" width="800" height="600"/> | ||
| 336 | + <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1577"/> | ||
| 337 | + <view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ"> | ||
| 338 | + <rect key="frame" x="0.0" y="0.0" width="800" height="600"/> | ||
| 339 | + <autoresizingMask key="autoresizingMask"/> | ||
| 340 | + </view> | ||
| 341 | + </window> | ||
| 342 | + </objects> | ||
| 343 | +</document> |
| 1 | +// Application-level settings for the Runner target. | ||
| 2 | +// | ||
| 3 | +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the | ||
| 4 | +// future. If not, the values below would default to using the project name when this becomes a | ||
| 5 | +// 'flutter create' template. | ||
| 6 | + | ||
| 7 | +// The application's name. By default this is also the title of the Flutter window. | ||
| 8 | +PRODUCT_NAME = tts | ||
| 9 | + | ||
| 10 | +// The application's bundle identifier | ||
| 11 | +PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.tts | ||
| 12 | + | ||
| 13 | +// The copyright displayed in application information | ||
| 14 | +PRODUCT_COPYRIGHT = Copyright © 2024 Next-gen Kaldi. All rights reserved. |
| 1 | +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings | ||
| 2 | +GCC_WARN_UNDECLARED_SELECTOR = YES | ||
| 3 | +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES | ||
| 4 | +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE | ||
| 5 | +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES | ||
| 6 | +CLANG_WARN_PRAGMA_PACK = YES | ||
| 7 | +CLANG_WARN_STRICT_PROTOTYPES = YES | ||
| 8 | +CLANG_WARN_COMMA = YES | ||
| 9 | +GCC_WARN_STRICT_SELECTOR_MATCH = YES | ||
| 10 | +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES | ||
| 11 | +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES | ||
| 12 | +GCC_WARN_SHADOW = YES | ||
| 13 | +CLANG_WARN_UNREACHABLE_CODE = YES |
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| 3 | +<plist version="1.0"> | ||
| 4 | +<dict> | ||
| 5 | + <key>com.apple.security.app-sandbox</key> | ||
| 6 | + <true/> | ||
| 7 | + <key>com.apple.security.cs.allow-jit</key> | ||
| 8 | + <true/> | ||
| 9 | + <key>com.apple.security.network.server</key> | ||
| 10 | + <true/> | ||
| 11 | +</dict> | ||
| 12 | +</plist> |
flutter-examples/tts/macos/Runner/Info.plist
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| 3 | +<plist version="1.0"> | ||
| 4 | +<dict> | ||
| 5 | + <key>CFBundleDevelopmentRegion</key> | ||
| 6 | + <string>$(DEVELOPMENT_LANGUAGE)</string> | ||
| 7 | + <key>CFBundleExecutable</key> | ||
| 8 | + <string>$(EXECUTABLE_NAME)</string> | ||
| 9 | + <key>CFBundleIconFile</key> | ||
| 10 | + <string></string> | ||
| 11 | + <key>CFBundleIdentifier</key> | ||
| 12 | + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
| 13 | + <key>CFBundleInfoDictionaryVersion</key> | ||
| 14 | + <string>6.0</string> | ||
| 15 | + <key>CFBundleName</key> | ||
| 16 | + <string>$(PRODUCT_NAME)</string> | ||
| 17 | + <key>CFBundlePackageType</key> | ||
| 18 | + <string>APPL</string> | ||
| 19 | + <key>CFBundleShortVersionString</key> | ||
| 20 | + <string>$(FLUTTER_BUILD_NAME)</string> | ||
| 21 | + <key>CFBundleVersion</key> | ||
| 22 | + <string>$(FLUTTER_BUILD_NUMBER)</string> | ||
| 23 | + <key>LSMinimumSystemVersion</key> | ||
| 24 | + <string>$(MACOSX_DEPLOYMENT_TARGET)</string> | ||
| 25 | + <key>NSHumanReadableCopyright</key> | ||
| 26 | + <string>$(PRODUCT_COPYRIGHT)</string> | ||
| 27 | + <key>NSMainNibFile</key> | ||
| 28 | + <string>MainMenu</string> | ||
| 29 | + <key>NSPrincipalClass</key> | ||
| 30 | + <string>NSApplication</string> | ||
| 31 | +</dict> | ||
| 32 | +</plist> |
| 1 | +import Cocoa | ||
| 2 | +import FlutterMacOS | ||
| 3 | + | ||
| 4 | +class MainFlutterWindow: NSWindow { | ||
| 5 | + override func awakeFromNib() { | ||
| 6 | + let flutterViewController = FlutterViewController() | ||
| 7 | + let windowFrame = self.frame | ||
| 8 | + self.contentViewController = flutterViewController | ||
| 9 | + self.setFrame(windowFrame, display: true) | ||
| 10 | + | ||
| 11 | + RegisterGeneratedPlugins(registry: flutterViewController) | ||
| 12 | + | ||
| 13 | + super.awakeFromNib() | ||
| 14 | + } | ||
| 15 | +} |
| 1 | +import Cocoa | ||
| 2 | +import FlutterMacOS | ||
| 3 | +import XCTest | ||
| 4 | + | ||
| 5 | +class RunnerTests: XCTestCase { | ||
| 6 | + | ||
| 7 | + func testExample() { | ||
| 8 | + // If you add code to the Runner application, consider adding tests here. | ||
| 9 | + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. | ||
| 10 | + } | ||
| 11 | + | ||
| 12 | +} |
flutter-examples/tts/pubspec.yaml
0 → 100644
| 1 | +name: tts | ||
| 2 | +description: > | ||
| 3 | + This example shows how to implement text to speech, i.e., speech synthesis, | ||
| 4 | + using sherpa-onnx. | ||
| 5 | + | ||
| 6 | +publish_to: 'none' # Remove this line if you wish to publish to pub.dev | ||
| 7 | + | ||
| 8 | +version: 1.0.0 | ||
| 9 | + | ||
| 10 | +environment: | ||
| 11 | + sdk: '>=3.4.0 <4.0.0' | ||
| 12 | + | ||
| 13 | +dependencies: | ||
| 14 | + flutter: | ||
| 15 | + sdk: flutter | ||
| 16 | + | ||
| 17 | + cupertino_icons: ^1.0.6 | ||
| 18 | + path_provider: ^2.1.3 | ||
| 19 | + path: ^1.9.0 | ||
| 20 | + sherpa_onnx: ^1.10.11 | ||
| 21 | + url_launcher: ^6.2.6 | ||
| 22 | + audioplayers: ^5.0.0 | ||
| 23 | + | ||
| 24 | +flutter: | ||
| 25 | + uses-material-design: true |
flutter-examples/tts/test/widget_test.dart
0 → 100644
| 1 | +// This is a basic Flutter widget test. | ||
| 2 | +// | ||
| 3 | +// To perform an interaction with a widget in your test, use the WidgetTester | ||
| 4 | +// utility in the flutter_test package. For example, you can send tap and scroll | ||
| 5 | +// gestures. You can also use WidgetTester to find child widgets in the widget | ||
| 6 | +// tree, read text, and verify that the values of widget properties are correct. | ||
| 7 | + | ||
| 8 | +import 'package:flutter/material.dart'; | ||
| 9 | +import 'package:flutter_test/flutter_test.dart'; | ||
| 10 | + | ||
| 11 | +import 'package:tts/main.dart'; | ||
| 12 | + | ||
| 13 | +void main() { | ||
| 14 | + testWidgets('Counter increments smoke test', (WidgetTester tester) async { | ||
| 15 | + // Build our app and trigger a frame. | ||
| 16 | + await tester.pumpWidget(const MyApp()); | ||
| 17 | + | ||
| 18 | + // Verify that our counter starts at 0. | ||
| 19 | + expect(find.text('0'), findsOneWidget); | ||
| 20 | + expect(find.text('1'), findsNothing); | ||
| 21 | + | ||
| 22 | + // Tap the '+' icon and trigger a frame. | ||
| 23 | + await tester.tap(find.byIcon(Icons.add)); | ||
| 24 | + await tester.pump(); | ||
| 25 | + | ||
| 26 | + // Verify that our counter has incremented. | ||
| 27 | + expect(find.text('0'), findsNothing); | ||
| 28 | + expect(find.text('1'), findsOneWidget); | ||
| 29 | + }); | ||
| 30 | +} |
flutter-examples/tts/windows/.gitignore
0 → 100644
| 1 | +flutter/ephemeral/ | ||
| 2 | + | ||
| 3 | +# Visual Studio user-specific files. | ||
| 4 | +*.suo | ||
| 5 | +*.user | ||
| 6 | +*.userosscache | ||
| 7 | +*.sln.docstates | ||
| 8 | + | ||
| 9 | +# Visual Studio build-related files. | ||
| 10 | +x64/ | ||
| 11 | +x86/ | ||
| 12 | + | ||
| 13 | +# Visual Studio cache files | ||
| 14 | +# files ending in .cache can be ignored | ||
| 15 | +*.[Cc]ache | ||
| 16 | +# but keep track of directories ending in .cache | ||
| 17 | +!*.[Cc]ache/ |
flutter-examples/tts/windows/CMakeLists.txt
0 → 100644
| 1 | +# Project-level configuration. | ||
| 2 | +cmake_minimum_required(VERSION 3.14) | ||
| 3 | +project(tts LANGUAGES CXX) | ||
| 4 | + | ||
| 5 | +# The name of the executable created for the application. Change this to change | ||
| 6 | +# the on-disk name of your application. | ||
| 7 | +set(BINARY_NAME "tts") | ||
| 8 | + | ||
| 9 | +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent | ||
| 10 | +# versions of CMake. | ||
| 11 | +cmake_policy(VERSION 3.14...3.25) | ||
| 12 | + | ||
| 13 | +# Define build configuration option. | ||
| 14 | +get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) | ||
| 15 | +if(IS_MULTICONFIG) | ||
| 16 | + set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" | ||
| 17 | + CACHE STRING "" FORCE) | ||
| 18 | +else() | ||
| 19 | + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
| 20 | + set(CMAKE_BUILD_TYPE "Debug" CACHE | ||
| 21 | + STRING "Flutter build mode" FORCE) | ||
| 22 | + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS | ||
| 23 | + "Debug" "Profile" "Release") | ||
| 24 | + endif() | ||
| 25 | +endif() | ||
| 26 | +# Define settings for the Profile build mode. | ||
| 27 | +set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") | ||
| 28 | +set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") | ||
| 29 | +set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") | ||
| 30 | +set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") | ||
| 31 | + | ||
| 32 | +# Use Unicode for all projects. | ||
| 33 | +add_definitions(-DUNICODE -D_UNICODE) | ||
| 34 | + | ||
| 35 | +# Compilation settings that should be applied to most targets. | ||
| 36 | +# | ||
| 37 | +# Be cautious about adding new options here, as plugins use this function by | ||
| 38 | +# default. In most cases, you should add new options to specific targets instead | ||
| 39 | +# of modifying this function. | ||
| 40 | +function(APPLY_STANDARD_SETTINGS TARGET) | ||
| 41 | + target_compile_features(${TARGET} PUBLIC cxx_std_17) | ||
| 42 | + target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") | ||
| 43 | + target_compile_options(${TARGET} PRIVATE /EHsc) | ||
| 44 | + target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") | ||
| 45 | + target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>") | ||
| 46 | +endfunction() | ||
| 47 | + | ||
| 48 | +# Flutter library and tool build rules. | ||
| 49 | +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") | ||
| 50 | +add_subdirectory(${FLUTTER_MANAGED_DIR}) | ||
| 51 | + | ||
| 52 | +# Application build; see runner/CMakeLists.txt. | ||
| 53 | +add_subdirectory("runner") | ||
| 54 | + | ||
| 55 | + | ||
| 56 | +# Generated plugin build rules, which manage building the plugins and adding | ||
| 57 | +# them to the application. | ||
| 58 | +include(flutter/generated_plugins.cmake) | ||
| 59 | + | ||
| 60 | + | ||
| 61 | +# === Installation === | ||
| 62 | +# Support files are copied into place next to the executable, so that it can | ||
| 63 | +# run in place. This is done instead of making a separate bundle (as on Linux) | ||
| 64 | +# so that building and running from within Visual Studio will work. | ||
| 65 | +set(BUILD_BUNDLE_DIR "$<TARGET_FILE_DIR:${BINARY_NAME}>") | ||
| 66 | +# Make the "install" step default, as it's required to run. | ||
| 67 | +set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) | ||
| 68 | +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) | ||
| 69 | + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) | ||
| 70 | +endif() | ||
| 71 | + | ||
| 72 | +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") | ||
| 73 | +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") | ||
| 74 | + | ||
| 75 | +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" | ||
| 76 | + COMPONENT Runtime) | ||
| 77 | + | ||
| 78 | +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" | ||
| 79 | + COMPONENT Runtime) | ||
| 80 | + | ||
| 81 | +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" | ||
| 82 | + COMPONENT Runtime) | ||
| 83 | + | ||
| 84 | +if(PLUGIN_BUNDLED_LIBRARIES) | ||
| 85 | + install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" | ||
| 86 | + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" | ||
| 87 | + COMPONENT Runtime) | ||
| 88 | +endif() | ||
| 89 | + | ||
| 90 | +# Copy the native assets provided by the build.dart from all packages. | ||
| 91 | +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") | ||
| 92 | +install(DIRECTORY "${NATIVE_ASSETS_DIR}" | ||
| 93 | + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" | ||
| 94 | + COMPONENT Runtime) | ||
| 95 | + | ||
| 96 | +# Fully re-copy the assets directory on each build to avoid having stale files | ||
| 97 | +# from a previous install. | ||
| 98 | +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") | ||
| 99 | +install(CODE " | ||
| 100 | + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") | ||
| 101 | + " COMPONENT Runtime) | ||
| 102 | +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" | ||
| 103 | + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) | ||
| 104 | + | ||
| 105 | +# Install the AOT library on non-Debug builds only. | ||
| 106 | +install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" | ||
| 107 | + CONFIGURATIONS Profile;Release | ||
| 108 | + COMPONENT Runtime) |
| 1 | +# This file controls Flutter-level build steps. It should not be edited. | ||
| 2 | +cmake_minimum_required(VERSION 3.14) | ||
| 3 | + | ||
| 4 | +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") | ||
| 5 | + | ||
| 6 | +# Configuration provided via flutter tool. | ||
| 7 | +include(${EPHEMERAL_DIR}/generated_config.cmake) | ||
| 8 | + | ||
| 9 | +# TODO: Move the rest of this into files in ephemeral. See | ||
| 10 | +# https://github.com/flutter/flutter/issues/57146. | ||
| 11 | +set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") | ||
| 12 | + | ||
| 13 | +# Set fallback configurations for older versions of the flutter tool. | ||
| 14 | +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) | ||
| 15 | + set(FLUTTER_TARGET_PLATFORM "windows-x64") | ||
| 16 | +endif() | ||
| 17 | + | ||
| 18 | +# === Flutter Library === | ||
| 19 | +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") | ||
| 20 | + | ||
| 21 | +# Published to parent scope for install step. | ||
| 22 | +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) | ||
| 23 | +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) | ||
| 24 | +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) | ||
| 25 | +set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) | ||
| 26 | + | ||
| 27 | +list(APPEND FLUTTER_LIBRARY_HEADERS | ||
| 28 | + "flutter_export.h" | ||
| 29 | + "flutter_windows.h" | ||
| 30 | + "flutter_messenger.h" | ||
| 31 | + "flutter_plugin_registrar.h" | ||
| 32 | + "flutter_texture_registrar.h" | ||
| 33 | +) | ||
| 34 | +list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") | ||
| 35 | +add_library(flutter INTERFACE) | ||
| 36 | +target_include_directories(flutter INTERFACE | ||
| 37 | + "${EPHEMERAL_DIR}" | ||
| 38 | +) | ||
| 39 | +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") | ||
| 40 | +add_dependencies(flutter flutter_assemble) | ||
| 41 | + | ||
| 42 | +# === Wrapper === | ||
| 43 | +list(APPEND CPP_WRAPPER_SOURCES_CORE | ||
| 44 | + "core_implementations.cc" | ||
| 45 | + "standard_codec.cc" | ||
| 46 | +) | ||
| 47 | +list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") | ||
| 48 | +list(APPEND CPP_WRAPPER_SOURCES_PLUGIN | ||
| 49 | + "plugin_registrar.cc" | ||
| 50 | +) | ||
| 51 | +list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") | ||
| 52 | +list(APPEND CPP_WRAPPER_SOURCES_APP | ||
| 53 | + "flutter_engine.cc" | ||
| 54 | + "flutter_view_controller.cc" | ||
| 55 | +) | ||
| 56 | +list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") | ||
| 57 | + | ||
| 58 | +# Wrapper sources needed for a plugin. | ||
| 59 | +add_library(flutter_wrapper_plugin STATIC | ||
| 60 | + ${CPP_WRAPPER_SOURCES_CORE} | ||
| 61 | + ${CPP_WRAPPER_SOURCES_PLUGIN} | ||
| 62 | +) | ||
| 63 | +apply_standard_settings(flutter_wrapper_plugin) | ||
| 64 | +set_target_properties(flutter_wrapper_plugin PROPERTIES | ||
| 65 | + POSITION_INDEPENDENT_CODE ON) | ||
| 66 | +set_target_properties(flutter_wrapper_plugin PROPERTIES | ||
| 67 | + CXX_VISIBILITY_PRESET hidden) | ||
| 68 | +target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) | ||
| 69 | +target_include_directories(flutter_wrapper_plugin PUBLIC | ||
| 70 | + "${WRAPPER_ROOT}/include" | ||
| 71 | +) | ||
| 72 | +add_dependencies(flutter_wrapper_plugin flutter_assemble) | ||
| 73 | + | ||
| 74 | +# Wrapper sources needed for the runner. | ||
| 75 | +add_library(flutter_wrapper_app STATIC | ||
| 76 | + ${CPP_WRAPPER_SOURCES_CORE} | ||
| 77 | + ${CPP_WRAPPER_SOURCES_APP} | ||
| 78 | +) | ||
| 79 | +apply_standard_settings(flutter_wrapper_app) | ||
| 80 | +target_link_libraries(flutter_wrapper_app PUBLIC flutter) | ||
| 81 | +target_include_directories(flutter_wrapper_app PUBLIC | ||
| 82 | + "${WRAPPER_ROOT}/include" | ||
| 83 | +) | ||
| 84 | +add_dependencies(flutter_wrapper_app flutter_assemble) | ||
| 85 | + | ||
| 86 | +# === Flutter tool backend === | ||
| 87 | +# _phony_ is a non-existent file to force this command to run every time, | ||
| 88 | +# since currently there's no way to get a full input/output list from the | ||
| 89 | +# flutter tool. | ||
| 90 | +set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") | ||
| 91 | +set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) | ||
| 92 | +add_custom_command( | ||
| 93 | + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} | ||
| 94 | + ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} | ||
| 95 | + ${CPP_WRAPPER_SOURCES_APP} | ||
| 96 | + ${PHONY_OUTPUT} | ||
| 97 | + COMMAND ${CMAKE_COMMAND} -E env | ||
| 98 | + ${FLUTTER_TOOL_ENVIRONMENT} | ||
| 99 | + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" | ||
| 100 | + ${FLUTTER_TARGET_PLATFORM} $<CONFIG> | ||
| 101 | + VERBATIM | ||
| 102 | +) | ||
| 103 | +add_custom_target(flutter_assemble DEPENDS | ||
| 104 | + "${FLUTTER_LIBRARY}" | ||
| 105 | + ${FLUTTER_LIBRARY_HEADERS} | ||
| 106 | + ${CPP_WRAPPER_SOURCES_CORE} | ||
| 107 | + ${CPP_WRAPPER_SOURCES_PLUGIN} | ||
| 108 | + ${CPP_WRAPPER_SOURCES_APP} | ||
| 109 | +) |
| 1 | +cmake_minimum_required(VERSION 3.14) | ||
| 2 | +project(runner LANGUAGES CXX) | ||
| 3 | + | ||
| 4 | +# Define the application target. To change its name, change BINARY_NAME in the | ||
| 5 | +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer | ||
| 6 | +# work. | ||
| 7 | +# | ||
| 8 | +# Any new source files that you add to the application should be added here. | ||
| 9 | +add_executable(${BINARY_NAME} WIN32 | ||
| 10 | + "flutter_window.cpp" | ||
| 11 | + "main.cpp" | ||
| 12 | + "utils.cpp" | ||
| 13 | + "win32_window.cpp" | ||
| 14 | + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" | ||
| 15 | + "Runner.rc" | ||
| 16 | + "runner.exe.manifest" | ||
| 17 | +) | ||
| 18 | + | ||
| 19 | +# Apply the standard set of build settings. This can be removed for applications | ||
| 20 | +# that need different build settings. | ||
| 21 | +apply_standard_settings(${BINARY_NAME}) | ||
| 22 | + | ||
| 23 | +# Add preprocessor definitions for the build version. | ||
| 24 | +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") | ||
| 25 | +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") | ||
| 26 | +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") | ||
| 27 | +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") | ||
| 28 | +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") | ||
| 29 | + | ||
| 30 | +# Disable Windows macros that collide with C++ standard library functions. | ||
| 31 | +target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") | ||
| 32 | + | ||
| 33 | +# Add dependency libraries and include directories. Add any application-specific | ||
| 34 | +# dependencies here. | ||
| 35 | +target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) | ||
| 36 | +target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") | ||
| 37 | +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") | ||
| 38 | + | ||
| 39 | +# Run the Flutter tool portions of the build. This must not be removed. | ||
| 40 | +add_dependencies(${BINARY_NAME} flutter_assemble) |
| 1 | +// Microsoft Visual C++ generated resource script. | ||
| 2 | +// | ||
| 3 | +#pragma code_page(65001) | ||
| 4 | +#include "resource.h" | ||
| 5 | + | ||
| 6 | +#define APSTUDIO_READONLY_SYMBOLS | ||
| 7 | +///////////////////////////////////////////////////////////////////////////// | ||
| 8 | +// | ||
| 9 | +// Generated from the TEXTINCLUDE 2 resource. | ||
| 10 | +// | ||
| 11 | +#include "winres.h" | ||
| 12 | + | ||
| 13 | +///////////////////////////////////////////////////////////////////////////// | ||
| 14 | +#undef APSTUDIO_READONLY_SYMBOLS | ||
| 15 | + | ||
| 16 | +///////////////////////////////////////////////////////////////////////////// | ||
| 17 | +// English (United States) resources | ||
| 18 | + | ||
| 19 | +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) | ||
| 20 | +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US | ||
| 21 | + | ||
| 22 | +#ifdef APSTUDIO_INVOKED | ||
| 23 | +///////////////////////////////////////////////////////////////////////////// | ||
| 24 | +// | ||
| 25 | +// TEXTINCLUDE | ||
| 26 | +// | ||
| 27 | + | ||
| 28 | +1 TEXTINCLUDE | ||
| 29 | +BEGIN | ||
| 30 | + "resource.h\0" | ||
| 31 | +END | ||
| 32 | + | ||
| 33 | +2 TEXTINCLUDE | ||
| 34 | +BEGIN | ||
| 35 | + "#include ""winres.h""\r\n" | ||
| 36 | + "\0" | ||
| 37 | +END | ||
| 38 | + | ||
| 39 | +3 TEXTINCLUDE | ||
| 40 | +BEGIN | ||
| 41 | + "\r\n" | ||
| 42 | + "\0" | ||
| 43 | +END | ||
| 44 | + | ||
| 45 | +#endif // APSTUDIO_INVOKED | ||
| 46 | + | ||
| 47 | + | ||
| 48 | +///////////////////////////////////////////////////////////////////////////// | ||
| 49 | +// | ||
| 50 | +// Icon | ||
| 51 | +// | ||
| 52 | + | ||
| 53 | +// Icon with lowest ID value placed first to ensure application icon | ||
| 54 | +// remains consistent on all systems. | ||
| 55 | +IDI_APP_ICON ICON "resources\\app_icon.ico" | ||
| 56 | + | ||
| 57 | + | ||
| 58 | +///////////////////////////////////////////////////////////////////////////// | ||
| 59 | +// | ||
| 60 | +// Version | ||
| 61 | +// | ||
| 62 | + | ||
| 63 | +#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) | ||
| 64 | +#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD | ||
| 65 | +#else | ||
| 66 | +#define VERSION_AS_NUMBER 1,0,0,0 | ||
| 67 | +#endif | ||
| 68 | + | ||
| 69 | +#if defined(FLUTTER_VERSION) | ||
| 70 | +#define VERSION_AS_STRING FLUTTER_VERSION | ||
| 71 | +#else | ||
| 72 | +#define VERSION_AS_STRING "1.0.0" | ||
| 73 | +#endif | ||
| 74 | + | ||
| 75 | +VS_VERSION_INFO VERSIONINFO | ||
| 76 | + FILEVERSION VERSION_AS_NUMBER | ||
| 77 | + PRODUCTVERSION VERSION_AS_NUMBER | ||
| 78 | + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK | ||
| 79 | +#ifdef _DEBUG | ||
| 80 | + FILEFLAGS VS_FF_DEBUG | ||
| 81 | +#else | ||
| 82 | + FILEFLAGS 0x0L | ||
| 83 | +#endif | ||
| 84 | + FILEOS VOS__WINDOWS32 | ||
| 85 | + FILETYPE VFT_APP | ||
| 86 | + FILESUBTYPE 0x0L | ||
| 87 | +BEGIN | ||
| 88 | + BLOCK "StringFileInfo" | ||
| 89 | + BEGIN | ||
| 90 | + BLOCK "040904e4" | ||
| 91 | + BEGIN | ||
| 92 | + VALUE "CompanyName", "com.example" "\0" | ||
| 93 | + VALUE "FileDescription", "tts" "\0" | ||
| 94 | + VALUE "FileVersion", VERSION_AS_STRING "\0" | ||
| 95 | + VALUE "InternalName", "tts" "\0" | ||
| 96 | + VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" | ||
| 97 | + VALUE "OriginalFilename", "tts.exe" "\0" | ||
| 98 | + VALUE "ProductName", "tts" "\0" | ||
| 99 | + VALUE "ProductVersion", VERSION_AS_STRING "\0" | ||
| 100 | + END | ||
| 101 | + END | ||
| 102 | + BLOCK "VarFileInfo" | ||
| 103 | + BEGIN | ||
| 104 | + VALUE "Translation", 0x409, 1252 | ||
| 105 | + END | ||
| 106 | +END | ||
| 107 | + | ||
| 108 | +#endif // English (United States) resources | ||
| 109 | +///////////////////////////////////////////////////////////////////////////// | ||
| 110 | + | ||
| 111 | + | ||
| 112 | + | ||
| 113 | +#ifndef APSTUDIO_INVOKED | ||
| 114 | +///////////////////////////////////////////////////////////////////////////// | ||
| 115 | +// | ||
| 116 | +// Generated from the TEXTINCLUDE 3 resource. | ||
| 117 | +// | ||
| 118 | + | ||
| 119 | + | ||
| 120 | +///////////////////////////////////////////////////////////////////////////// | ||
| 121 | +#endif // not APSTUDIO_INVOKED |
| 1 | +#include "flutter_window.h" | ||
| 2 | + | ||
| 3 | +#include <optional> | ||
| 4 | + | ||
| 5 | +#include "flutter/generated_plugin_registrant.h" | ||
| 6 | + | ||
| 7 | +FlutterWindow::FlutterWindow(const flutter::DartProject& project) | ||
| 8 | + : project_(project) {} | ||
| 9 | + | ||
| 10 | +FlutterWindow::~FlutterWindow() {} | ||
| 11 | + | ||
| 12 | +bool FlutterWindow::OnCreate() { | ||
| 13 | + if (!Win32Window::OnCreate()) { | ||
| 14 | + return false; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + RECT frame = GetClientArea(); | ||
| 18 | + | ||
| 19 | + // The size here must match the window dimensions to avoid unnecessary surface | ||
| 20 | + // creation / destruction in the startup path. | ||
| 21 | + flutter_controller_ = std::make_unique<flutter::FlutterViewController>( | ||
| 22 | + frame.right - frame.left, frame.bottom - frame.top, project_); | ||
| 23 | + // Ensure that basic setup of the controller was successful. | ||
| 24 | + if (!flutter_controller_->engine() || !flutter_controller_->view()) { | ||
| 25 | + return false; | ||
| 26 | + } | ||
| 27 | + RegisterPlugins(flutter_controller_->engine()); | ||
| 28 | + SetChildContent(flutter_controller_->view()->GetNativeWindow()); | ||
| 29 | + | ||
| 30 | + flutter_controller_->engine()->SetNextFrameCallback([&]() { | ||
| 31 | + this->Show(); | ||
| 32 | + }); | ||
| 33 | + | ||
| 34 | + // Flutter can complete the first frame before the "show window" callback is | ||
| 35 | + // registered. The following call ensures a frame is pending to ensure the | ||
| 36 | + // window is shown. It is a no-op if the first frame hasn't completed yet. | ||
| 37 | + flutter_controller_->ForceRedraw(); | ||
| 38 | + | ||
| 39 | + return true; | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +void FlutterWindow::OnDestroy() { | ||
| 43 | + if (flutter_controller_) { | ||
| 44 | + flutter_controller_ = nullptr; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + Win32Window::OnDestroy(); | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | +LRESULT | ||
| 51 | +FlutterWindow::MessageHandler(HWND hwnd, UINT const message, | ||
| 52 | + WPARAM const wparam, | ||
| 53 | + LPARAM const lparam) noexcept { | ||
| 54 | + // Give Flutter, including plugins, an opportunity to handle window messages. | ||
| 55 | + if (flutter_controller_) { | ||
| 56 | + std::optional<LRESULT> result = | ||
| 57 | + flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, | ||
| 58 | + lparam); | ||
| 59 | + if (result) { | ||
| 60 | + return *result; | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + switch (message) { | ||
| 65 | + case WM_FONTCHANGE: | ||
| 66 | + flutter_controller_->engine()->ReloadSystemFonts(); | ||
| 67 | + break; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + return Win32Window::MessageHandler(hwnd, message, wparam, lparam); | ||
| 71 | +} |
| 1 | +#ifndef RUNNER_FLUTTER_WINDOW_H_ | ||
| 2 | +#define RUNNER_FLUTTER_WINDOW_H_ | ||
| 3 | + | ||
| 4 | +#include <flutter/dart_project.h> | ||
| 5 | +#include <flutter/flutter_view_controller.h> | ||
| 6 | + | ||
| 7 | +#include <memory> | ||
| 8 | + | ||
| 9 | +#include "win32_window.h" | ||
| 10 | + | ||
| 11 | +// A window that does nothing but host a Flutter view. | ||
| 12 | +class FlutterWindow : public Win32Window { | ||
| 13 | + public: | ||
| 14 | + // Creates a new FlutterWindow hosting a Flutter view running |project|. | ||
| 15 | + explicit FlutterWindow(const flutter::DartProject& project); | ||
| 16 | + virtual ~FlutterWindow(); | ||
| 17 | + | ||
| 18 | + protected: | ||
| 19 | + // Win32Window: | ||
| 20 | + bool OnCreate() override; | ||
| 21 | + void OnDestroy() override; | ||
| 22 | + LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, | ||
| 23 | + LPARAM const lparam) noexcept override; | ||
| 24 | + | ||
| 25 | + private: | ||
| 26 | + // The project to run. | ||
| 27 | + flutter::DartProject project_; | ||
| 28 | + | ||
| 29 | + // The Flutter instance hosted by this window. | ||
| 30 | + std::unique_ptr<flutter::FlutterViewController> flutter_controller_; | ||
| 31 | +}; | ||
| 32 | + | ||
| 33 | +#endif // RUNNER_FLUTTER_WINDOW_H_ |
flutter-examples/tts/windows/runner/main.cpp
0 → 100644
| 1 | +#include <flutter/dart_project.h> | ||
| 2 | +#include <flutter/flutter_view_controller.h> | ||
| 3 | +#include <windows.h> | ||
| 4 | + | ||
| 5 | +#include "flutter_window.h" | ||
| 6 | +#include "utils.h" | ||
| 7 | + | ||
| 8 | +int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, | ||
| 9 | + _In_ wchar_t *command_line, _In_ int show_command) { | ||
| 10 | + // Attach to console when present (e.g., 'flutter run') or create a | ||
| 11 | + // new console when running with a debugger. | ||
| 12 | + if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { | ||
| 13 | + CreateAndAttachConsole(); | ||
| 14 | + } | ||
| 15 | + | ||
| 16 | + // Initialize COM, so that it is available for use in the library and/or | ||
| 17 | + // plugins. | ||
| 18 | + ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); | ||
| 19 | + | ||
| 20 | + flutter::DartProject project(L"data"); | ||
| 21 | + | ||
| 22 | + std::vector<std::string> command_line_arguments = | ||
| 23 | + GetCommandLineArguments(); | ||
| 24 | + | ||
| 25 | + project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); | ||
| 26 | + | ||
| 27 | + FlutterWindow window(project); | ||
| 28 | + Win32Window::Point origin(10, 10); | ||
| 29 | + Win32Window::Size size(1280, 720); | ||
| 30 | + if (!window.Create(L"tts", origin, size)) { | ||
| 31 | + return EXIT_FAILURE; | ||
| 32 | + } | ||
| 33 | + window.SetQuitOnClose(true); | ||
| 34 | + | ||
| 35 | + ::MSG msg; | ||
| 36 | + while (::GetMessage(&msg, nullptr, 0, 0)) { | ||
| 37 | + ::TranslateMessage(&msg); | ||
| 38 | + ::DispatchMessage(&msg); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + ::CoUninitialize(); | ||
| 42 | + return EXIT_SUCCESS; | ||
| 43 | +} |
| 1 | +//{{NO_DEPENDENCIES}} | ||
| 2 | +// Microsoft Visual C++ generated include file. | ||
| 3 | +// Used by Runner.rc | ||
| 4 | +// | ||
| 5 | +#define IDI_APP_ICON 101 | ||
| 6 | + | ||
| 7 | +// Next default values for new objects | ||
| 8 | +// | ||
| 9 | +#ifdef APSTUDIO_INVOKED | ||
| 10 | +#ifndef APSTUDIO_READONLY_SYMBOLS | ||
| 11 | +#define _APS_NEXT_RESOURCE_VALUE 102 | ||
| 12 | +#define _APS_NEXT_COMMAND_VALUE 40001 | ||
| 13 | +#define _APS_NEXT_CONTROL_VALUE 1001 | ||
| 14 | +#define _APS_NEXT_SYMED_VALUE 101 | ||
| 15 | +#endif | ||
| 16 | +#endif |
不能预览此文件类型
| 1 | +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
| 2 | +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> | ||
| 3 | + <application xmlns="urn:schemas-microsoft-com:asm.v3"> | ||
| 4 | + <windowsSettings> | ||
| 5 | + <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness> | ||
| 6 | + </windowsSettings> | ||
| 7 | + </application> | ||
| 8 | + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> | ||
| 9 | + <application> | ||
| 10 | + <!-- Windows 10 and Windows 11 --> | ||
| 11 | + <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> | ||
| 12 | + <!-- Windows 8.1 --> | ||
| 13 | + <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> | ||
| 14 | + <!-- Windows 8 --> | ||
| 15 | + <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> | ||
| 16 | + <!-- Windows 7 --> | ||
| 17 | + <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> | ||
| 18 | + </application> | ||
| 19 | + </compatibility> | ||
| 20 | +</assembly> |
| 1 | +#include "utils.h" | ||
| 2 | + | ||
| 3 | +#include <flutter_windows.h> | ||
| 4 | +#include <io.h> | ||
| 5 | +#include <stdio.h> | ||
| 6 | +#include <windows.h> | ||
| 7 | + | ||
| 8 | +#include <iostream> | ||
| 9 | + | ||
| 10 | +void CreateAndAttachConsole() { | ||
| 11 | + if (::AllocConsole()) { | ||
| 12 | + FILE *unused; | ||
| 13 | + if (freopen_s(&unused, "CONOUT$", "w", stdout)) { | ||
| 14 | + _dup2(_fileno(stdout), 1); | ||
| 15 | + } | ||
| 16 | + if (freopen_s(&unused, "CONOUT$", "w", stderr)) { | ||
| 17 | + _dup2(_fileno(stdout), 2); | ||
| 18 | + } | ||
| 19 | + std::ios::sync_with_stdio(); | ||
| 20 | + FlutterDesktopResyncOutputStreams(); | ||
| 21 | + } | ||
| 22 | +} | ||
| 23 | + | ||
| 24 | +std::vector<std::string> GetCommandLineArguments() { | ||
| 25 | + // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. | ||
| 26 | + int argc; | ||
| 27 | + wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); | ||
| 28 | + if (argv == nullptr) { | ||
| 29 | + return std::vector<std::string>(); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + std::vector<std::string> command_line_arguments; | ||
| 33 | + | ||
| 34 | + // Skip the first argument as it's the binary name. | ||
| 35 | + for (int i = 1; i < argc; i++) { | ||
| 36 | + command_line_arguments.push_back(Utf8FromUtf16(argv[i])); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + ::LocalFree(argv); | ||
| 40 | + | ||
| 41 | + return command_line_arguments; | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +std::string Utf8FromUtf16(const wchar_t* utf16_string) { | ||
| 45 | + if (utf16_string == nullptr) { | ||
| 46 | + return std::string(); | ||
| 47 | + } | ||
| 48 | + unsigned int target_length = ::WideCharToMultiByte( | ||
| 49 | + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, | ||
| 50 | + -1, nullptr, 0, nullptr, nullptr) | ||
| 51 | + -1; // remove the trailing null character | ||
| 52 | + int input_length = (int)wcslen(utf16_string); | ||
| 53 | + std::string utf8_string; | ||
| 54 | + if (target_length == 0 || target_length > utf8_string.max_size()) { | ||
| 55 | + return utf8_string; | ||
| 56 | + } | ||
| 57 | + utf8_string.resize(target_length); | ||
| 58 | + int converted_length = ::WideCharToMultiByte( | ||
| 59 | + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, | ||
| 60 | + input_length, utf8_string.data(), target_length, nullptr, nullptr); | ||
| 61 | + if (converted_length == 0) { | ||
| 62 | + return std::string(); | ||
| 63 | + } | ||
| 64 | + return utf8_string; | ||
| 65 | +} |
flutter-examples/tts/windows/runner/utils.h
0 → 100644
| 1 | +#ifndef RUNNER_UTILS_H_ | ||
| 2 | +#define RUNNER_UTILS_H_ | ||
| 3 | + | ||
| 4 | +#include <string> | ||
| 5 | +#include <vector> | ||
| 6 | + | ||
| 7 | +// Creates a console for the process, and redirects stdout and stderr to | ||
| 8 | +// it for both the runner and the Flutter library. | ||
| 9 | +void CreateAndAttachConsole(); | ||
| 10 | + | ||
| 11 | +// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string | ||
| 12 | +// encoded in UTF-8. Returns an empty std::string on failure. | ||
| 13 | +std::string Utf8FromUtf16(const wchar_t* utf16_string); | ||
| 14 | + | ||
| 15 | +// Gets the command line arguments passed in as a std::vector<std::string>, | ||
| 16 | +// encoded in UTF-8. Returns an empty std::vector<std::string> on failure. | ||
| 17 | +std::vector<std::string> GetCommandLineArguments(); | ||
| 18 | + | ||
| 19 | +#endif // RUNNER_UTILS_H_ |
| 1 | +#include "win32_window.h" | ||
| 2 | + | ||
| 3 | +#include <dwmapi.h> | ||
| 4 | +#include <flutter_windows.h> | ||
| 5 | + | ||
| 6 | +#include "resource.h" | ||
| 7 | + | ||
| 8 | +namespace { | ||
| 9 | + | ||
| 10 | +/// Window attribute that enables dark mode window decorations. | ||
| 11 | +/// | ||
| 12 | +/// Redefined in case the developer's machine has a Windows SDK older than | ||
| 13 | +/// version 10.0.22000.0. | ||
| 14 | +/// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute | ||
| 15 | +#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE | ||
| 16 | +#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 | ||
| 17 | +#endif | ||
| 18 | + | ||
| 19 | +constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; | ||
| 20 | + | ||
| 21 | +/// Registry key for app theme preference. | ||
| 22 | +/// | ||
| 23 | +/// A value of 0 indicates apps should use dark mode. A non-zero or missing | ||
| 24 | +/// value indicates apps should use light mode. | ||
| 25 | +constexpr const wchar_t kGetPreferredBrightnessRegKey[] = | ||
| 26 | + L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; | ||
| 27 | +constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; | ||
| 28 | + | ||
| 29 | +// The number of Win32Window objects that currently exist. | ||
| 30 | +static int g_active_window_count = 0; | ||
| 31 | + | ||
| 32 | +using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); | ||
| 33 | + | ||
| 34 | +// Scale helper to convert logical scaler values to physical using passed in | ||
| 35 | +// scale factor | ||
| 36 | +int Scale(int source, double scale_factor) { | ||
| 37 | + return static_cast<int>(source * scale_factor); | ||
| 38 | +} | ||
| 39 | + | ||
| 40 | +// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. | ||
| 41 | +// This API is only needed for PerMonitor V1 awareness mode. | ||
| 42 | +void EnableFullDpiSupportIfAvailable(HWND hwnd) { | ||
| 43 | + HMODULE user32_module = LoadLibraryA("User32.dll"); | ||
| 44 | + if (!user32_module) { | ||
| 45 | + return; | ||
| 46 | + } | ||
| 47 | + auto enable_non_client_dpi_scaling = | ||
| 48 | + reinterpret_cast<EnableNonClientDpiScaling*>( | ||
| 49 | + GetProcAddress(user32_module, "EnableNonClientDpiScaling")); | ||
| 50 | + if (enable_non_client_dpi_scaling != nullptr) { | ||
| 51 | + enable_non_client_dpi_scaling(hwnd); | ||
| 52 | + } | ||
| 53 | + FreeLibrary(user32_module); | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +} // namespace | ||
| 57 | + | ||
| 58 | +// Manages the Win32Window's window class registration. | ||
| 59 | +class WindowClassRegistrar { | ||
| 60 | + public: | ||
| 61 | + ~WindowClassRegistrar() = default; | ||
| 62 | + | ||
| 63 | + // Returns the singleton registrar instance. | ||
| 64 | + static WindowClassRegistrar* GetInstance() { | ||
| 65 | + if (!instance_) { | ||
| 66 | + instance_ = new WindowClassRegistrar(); | ||
| 67 | + } | ||
| 68 | + return instance_; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + // Returns the name of the window class, registering the class if it hasn't | ||
| 72 | + // previously been registered. | ||
| 73 | + const wchar_t* GetWindowClass(); | ||
| 74 | + | ||
| 75 | + // Unregisters the window class. Should only be called if there are no | ||
| 76 | + // instances of the window. | ||
| 77 | + void UnregisterWindowClass(); | ||
| 78 | + | ||
| 79 | + private: | ||
| 80 | + WindowClassRegistrar() = default; | ||
| 81 | + | ||
| 82 | + static WindowClassRegistrar* instance_; | ||
| 83 | + | ||
| 84 | + bool class_registered_ = false; | ||
| 85 | +}; | ||
| 86 | + | ||
| 87 | +WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; | ||
| 88 | + | ||
| 89 | +const wchar_t* WindowClassRegistrar::GetWindowClass() { | ||
| 90 | + if (!class_registered_) { | ||
| 91 | + WNDCLASS window_class{}; | ||
| 92 | + window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); | ||
| 93 | + window_class.lpszClassName = kWindowClassName; | ||
| 94 | + window_class.style = CS_HREDRAW | CS_VREDRAW; | ||
| 95 | + window_class.cbClsExtra = 0; | ||
| 96 | + window_class.cbWndExtra = 0; | ||
| 97 | + window_class.hInstance = GetModuleHandle(nullptr); | ||
| 98 | + window_class.hIcon = | ||
| 99 | + LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); | ||
| 100 | + window_class.hbrBackground = 0; | ||
| 101 | + window_class.lpszMenuName = nullptr; | ||
| 102 | + window_class.lpfnWndProc = Win32Window::WndProc; | ||
| 103 | + RegisterClass(&window_class); | ||
| 104 | + class_registered_ = true; | ||
| 105 | + } | ||
| 106 | + return kWindowClassName; | ||
| 107 | +} | ||
| 108 | + | ||
| 109 | +void WindowClassRegistrar::UnregisterWindowClass() { | ||
| 110 | + UnregisterClass(kWindowClassName, nullptr); | ||
| 111 | + class_registered_ = false; | ||
| 112 | +} | ||
| 113 | + | ||
| 114 | +Win32Window::Win32Window() { | ||
| 115 | + ++g_active_window_count; | ||
| 116 | +} | ||
| 117 | + | ||
| 118 | +Win32Window::~Win32Window() { | ||
| 119 | + --g_active_window_count; | ||
| 120 | + Destroy(); | ||
| 121 | +} | ||
| 122 | + | ||
| 123 | +bool Win32Window::Create(const std::wstring& title, | ||
| 124 | + const Point& origin, | ||
| 125 | + const Size& size) { | ||
| 126 | + Destroy(); | ||
| 127 | + | ||
| 128 | + const wchar_t* window_class = | ||
| 129 | + WindowClassRegistrar::GetInstance()->GetWindowClass(); | ||
| 130 | + | ||
| 131 | + const POINT target_point = {static_cast<LONG>(origin.x), | ||
| 132 | + static_cast<LONG>(origin.y)}; | ||
| 133 | + HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); | ||
| 134 | + UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); | ||
| 135 | + double scale_factor = dpi / 96.0; | ||
| 136 | + | ||
| 137 | + HWND window = CreateWindow( | ||
| 138 | + window_class, title.c_str(), WS_OVERLAPPEDWINDOW, | ||
| 139 | + Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), | ||
| 140 | + Scale(size.width, scale_factor), Scale(size.height, scale_factor), | ||
| 141 | + nullptr, nullptr, GetModuleHandle(nullptr), this); | ||
| 142 | + | ||
| 143 | + if (!window) { | ||
| 144 | + return false; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + UpdateTheme(window); | ||
| 148 | + | ||
| 149 | + return OnCreate(); | ||
| 150 | +} | ||
| 151 | + | ||
| 152 | +bool Win32Window::Show() { | ||
| 153 | + return ShowWindow(window_handle_, SW_SHOWNORMAL); | ||
| 154 | +} | ||
| 155 | + | ||
| 156 | +// static | ||
| 157 | +LRESULT CALLBACK Win32Window::WndProc(HWND const window, | ||
| 158 | + UINT const message, | ||
| 159 | + WPARAM const wparam, | ||
| 160 | + LPARAM const lparam) noexcept { | ||
| 161 | + if (message == WM_NCCREATE) { | ||
| 162 | + auto window_struct = reinterpret_cast<CREATESTRUCT*>(lparam); | ||
| 163 | + SetWindowLongPtr(window, GWLP_USERDATA, | ||
| 164 | + reinterpret_cast<LONG_PTR>(window_struct->lpCreateParams)); | ||
| 165 | + | ||
| 166 | + auto that = static_cast<Win32Window*>(window_struct->lpCreateParams); | ||
| 167 | + EnableFullDpiSupportIfAvailable(window); | ||
| 168 | + that->window_handle_ = window; | ||
| 169 | + } else if (Win32Window* that = GetThisFromHandle(window)) { | ||
| 170 | + return that->MessageHandler(window, message, wparam, lparam); | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + return DefWindowProc(window, message, wparam, lparam); | ||
| 174 | +} | ||
| 175 | + | ||
| 176 | +LRESULT | ||
| 177 | +Win32Window::MessageHandler(HWND hwnd, | ||
| 178 | + UINT const message, | ||
| 179 | + WPARAM const wparam, | ||
| 180 | + LPARAM const lparam) noexcept { | ||
| 181 | + switch (message) { | ||
| 182 | + case WM_DESTROY: | ||
| 183 | + window_handle_ = nullptr; | ||
| 184 | + Destroy(); | ||
| 185 | + if (quit_on_close_) { | ||
| 186 | + PostQuitMessage(0); | ||
| 187 | + } | ||
| 188 | + return 0; | ||
| 189 | + | ||
| 190 | + case WM_DPICHANGED: { | ||
| 191 | + auto newRectSize = reinterpret_cast<RECT*>(lparam); | ||
| 192 | + LONG newWidth = newRectSize->right - newRectSize->left; | ||
| 193 | + LONG newHeight = newRectSize->bottom - newRectSize->top; | ||
| 194 | + | ||
| 195 | + SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, | ||
| 196 | + newHeight, SWP_NOZORDER | SWP_NOACTIVATE); | ||
| 197 | + | ||
| 198 | + return 0; | ||
| 199 | + } | ||
| 200 | + case WM_SIZE: { | ||
| 201 | + RECT rect = GetClientArea(); | ||
| 202 | + if (child_content_ != nullptr) { | ||
| 203 | + // Size and position the child window. | ||
| 204 | + MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, | ||
| 205 | + rect.bottom - rect.top, TRUE); | ||
| 206 | + } | ||
| 207 | + return 0; | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + case WM_ACTIVATE: | ||
| 211 | + if (child_content_ != nullptr) { | ||
| 212 | + SetFocus(child_content_); | ||
| 213 | + } | ||
| 214 | + return 0; | ||
| 215 | + | ||
| 216 | + case WM_DWMCOLORIZATIONCOLORCHANGED: | ||
| 217 | + UpdateTheme(hwnd); | ||
| 218 | + return 0; | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + return DefWindowProc(window_handle_, message, wparam, lparam); | ||
| 222 | +} | ||
| 223 | + | ||
| 224 | +void Win32Window::Destroy() { | ||
| 225 | + OnDestroy(); | ||
| 226 | + | ||
| 227 | + if (window_handle_) { | ||
| 228 | + DestroyWindow(window_handle_); | ||
| 229 | + window_handle_ = nullptr; | ||
| 230 | + } | ||
| 231 | + if (g_active_window_count == 0) { | ||
| 232 | + WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); | ||
| 233 | + } | ||
| 234 | +} | ||
| 235 | + | ||
| 236 | +Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { | ||
| 237 | + return reinterpret_cast<Win32Window*>( | ||
| 238 | + GetWindowLongPtr(window, GWLP_USERDATA)); | ||
| 239 | +} | ||
| 240 | + | ||
| 241 | +void Win32Window::SetChildContent(HWND content) { | ||
| 242 | + child_content_ = content; | ||
| 243 | + SetParent(content, window_handle_); | ||
| 244 | + RECT frame = GetClientArea(); | ||
| 245 | + | ||
| 246 | + MoveWindow(content, frame.left, frame.top, frame.right - frame.left, | ||
| 247 | + frame.bottom - frame.top, true); | ||
| 248 | + | ||
| 249 | + SetFocus(child_content_); | ||
| 250 | +} | ||
| 251 | + | ||
| 252 | +RECT Win32Window::GetClientArea() { | ||
| 253 | + RECT frame; | ||
| 254 | + GetClientRect(window_handle_, &frame); | ||
| 255 | + return frame; | ||
| 256 | +} | ||
| 257 | + | ||
| 258 | +HWND Win32Window::GetHandle() { | ||
| 259 | + return window_handle_; | ||
| 260 | +} | ||
| 261 | + | ||
| 262 | +void Win32Window::SetQuitOnClose(bool quit_on_close) { | ||
| 263 | + quit_on_close_ = quit_on_close; | ||
| 264 | +} | ||
| 265 | + | ||
| 266 | +bool Win32Window::OnCreate() { | ||
| 267 | + // No-op; provided for subclasses. | ||
| 268 | + return true; | ||
| 269 | +} | ||
| 270 | + | ||
| 271 | +void Win32Window::OnDestroy() { | ||
| 272 | + // No-op; provided for subclasses. | ||
| 273 | +} | ||
| 274 | + | ||
| 275 | +void Win32Window::UpdateTheme(HWND const window) { | ||
| 276 | + DWORD light_mode; | ||
| 277 | + DWORD light_mode_size = sizeof(light_mode); | ||
| 278 | + LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, | ||
| 279 | + kGetPreferredBrightnessRegValue, | ||
| 280 | + RRF_RT_REG_DWORD, nullptr, &light_mode, | ||
| 281 | + &light_mode_size); | ||
| 282 | + | ||
| 283 | + if (result == ERROR_SUCCESS) { | ||
| 284 | + BOOL enable_dark_mode = light_mode == 0; | ||
| 285 | + DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, | ||
| 286 | + &enable_dark_mode, sizeof(enable_dark_mode)); | ||
| 287 | + } | ||
| 288 | +} |
| 1 | +#ifndef RUNNER_WIN32_WINDOW_H_ | ||
| 2 | +#define RUNNER_WIN32_WINDOW_H_ | ||
| 3 | + | ||
| 4 | +#include <windows.h> | ||
| 5 | + | ||
| 6 | +#include <functional> | ||
| 7 | +#include <memory> | ||
| 8 | +#include <string> | ||
| 9 | + | ||
| 10 | +// A class abstraction for a high DPI-aware Win32 Window. Intended to be | ||
| 11 | +// inherited from by classes that wish to specialize with custom | ||
| 12 | +// rendering and input handling | ||
| 13 | +class Win32Window { | ||
| 14 | + public: | ||
| 15 | + struct Point { | ||
| 16 | + unsigned int x; | ||
| 17 | + unsigned int y; | ||
| 18 | + Point(unsigned int x, unsigned int y) : x(x), y(y) {} | ||
| 19 | + }; | ||
| 20 | + | ||
| 21 | + struct Size { | ||
| 22 | + unsigned int width; | ||
| 23 | + unsigned int height; | ||
| 24 | + Size(unsigned int width, unsigned int height) | ||
| 25 | + : width(width), height(height) {} | ||
| 26 | + }; | ||
| 27 | + | ||
| 28 | + Win32Window(); | ||
| 29 | + virtual ~Win32Window(); | ||
| 30 | + | ||
| 31 | + // Creates a win32 window with |title| that is positioned and sized using | ||
| 32 | + // |origin| and |size|. New windows are created on the default monitor. Window | ||
| 33 | + // sizes are specified to the OS in physical pixels, hence to ensure a | ||
| 34 | + // consistent size this function will scale the inputted width and height as | ||
| 35 | + // as appropriate for the default monitor. The window is invisible until | ||
| 36 | + // |Show| is called. Returns true if the window was created successfully. | ||
| 37 | + bool Create(const std::wstring& title, const Point& origin, const Size& size); | ||
| 38 | + | ||
| 39 | + // Show the current window. Returns true if the window was successfully shown. | ||
| 40 | + bool Show(); | ||
| 41 | + | ||
| 42 | + // Release OS resources associated with window. | ||
| 43 | + void Destroy(); | ||
| 44 | + | ||
| 45 | + // Inserts |content| into the window tree. | ||
| 46 | + void SetChildContent(HWND content); | ||
| 47 | + | ||
| 48 | + // Returns the backing Window handle to enable clients to set icon and other | ||
| 49 | + // window properties. Returns nullptr if the window has been destroyed. | ||
| 50 | + HWND GetHandle(); | ||
| 51 | + | ||
| 52 | + // If true, closing this window will quit the application. | ||
| 53 | + void SetQuitOnClose(bool quit_on_close); | ||
| 54 | + | ||
| 55 | + // Return a RECT representing the bounds of the current client area. | ||
| 56 | + RECT GetClientArea(); | ||
| 57 | + | ||
| 58 | + protected: | ||
| 59 | + // Processes and route salient window messages for mouse handling, | ||
| 60 | + // size change and DPI. Delegates handling of these to member overloads that | ||
| 61 | + // inheriting classes can handle. | ||
| 62 | + virtual LRESULT MessageHandler(HWND window, | ||
| 63 | + UINT const message, | ||
| 64 | + WPARAM const wparam, | ||
| 65 | + LPARAM const lparam) noexcept; | ||
| 66 | + | ||
| 67 | + // Called when CreateAndShow is called, allowing subclass window-related | ||
| 68 | + // setup. Subclasses should return false if setup fails. | ||
| 69 | + virtual bool OnCreate(); | ||
| 70 | + | ||
| 71 | + // Called when Destroy is called. | ||
| 72 | + virtual void OnDestroy(); | ||
| 73 | + | ||
| 74 | + private: | ||
| 75 | + friend class WindowClassRegistrar; | ||
| 76 | + | ||
| 77 | + // OS callback called by message pump. Handles the WM_NCCREATE message which | ||
| 78 | + // is passed when the non-client area is being created and enables automatic | ||
| 79 | + // non-client DPI scaling so that the non-client area automatically | ||
| 80 | + // responds to changes in DPI. All other messages are handled by | ||
| 81 | + // MessageHandler. | ||
| 82 | + static LRESULT CALLBACK WndProc(HWND const window, | ||
| 83 | + UINT const message, | ||
| 84 | + WPARAM const wparam, | ||
| 85 | + LPARAM const lparam) noexcept; | ||
| 86 | + | ||
| 87 | + // Retrieves a class instance pointer for |window| | ||
| 88 | + static Win32Window* GetThisFromHandle(HWND const window) noexcept; | ||
| 89 | + | ||
| 90 | + // Update the window frame's theme to match the system theme. | ||
| 91 | + static void UpdateTheme(HWND const window); | ||
| 92 | + | ||
| 93 | + bool quit_on_close_ = false; | ||
| 94 | + | ||
| 95 | + // window handle for top level window. | ||
| 96 | + HWND window_handle_ = nullptr; | ||
| 97 | + | ||
| 98 | + // window handle for hosted content. | ||
| 99 | + HWND child_content_ = nullptr; | ||
| 100 | +}; | ||
| 101 | + | ||
| 102 | +#endif // RUNNER_WIN32_WINDOW_H_ |
scripts/flutter/build-android-tts.sh.in
0 → 100755
| 1 | +#!/usr/bin/env bash | ||
| 2 | +set -ex | ||
| 3 | + | ||
| 4 | +log() { | ||
| 5 | + # This function is from espnet | ||
| 6 | + local fname=${BASH_SOURCE[1]##*/} | ||
| 7 | + echo -e "$(date '+%Y-%m-%d %H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*" | ||
| 8 | +} | ||
| 9 | + | ||
| 10 | +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
| 11 | +SHERPA_ONNX_DIR=$(cd $SCRIPT_DIR/../.. && pwd) | ||
| 12 | +log "SCRIPT_DIR: $SCRIPT_DIR" | ||
| 13 | +log "SHERPA_ONNX_DIR: $SHERPA_ONNX_DIR" | ||
| 14 | + | ||
| 15 | +SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" $SHERPA_ONNX_DIR/CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | ||
| 16 | +log "SHERPA_ONNX_VERSION: $SHERPA_ONNX_VERSION" | ||
| 17 | + | ||
| 18 | +{% for tts_model in tts_model_list %} | ||
| 19 | +pushd $SHERPA_ONNX_DIR/flutter-examples/tts/ | ||
| 20 | + | ||
| 21 | +git checkout . | ||
| 22 | + | ||
| 23 | +rm -rf assets | ||
| 24 | +mkdir assets | ||
| 25 | +pushd assets | ||
| 26 | + | ||
| 27 | +model_dir={{ tts_model.model_dir }} | ||
| 28 | +model_name={{ tts_model.model_name }} | ||
| 29 | +lang={{ tts_model.lang }} | ||
| 30 | + | ||
| 31 | +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/$model_dir.tar.bz2 | ||
| 32 | +tar xf $model_dir.tar.bz2 | ||
| 33 | +rm $model_dir.tar.bz2 | ||
| 34 | + | ||
| 35 | +ls -lh | ||
| 36 | +ls -lh * | ||
| 37 | + | ||
| 38 | +popd # assets | ||
| 39 | +# Now we are at the project root directory | ||
| 40 | + | ||
| 41 | +./generate-asset-list.py | ||
| 42 | + | ||
| 43 | +pushd lib | ||
| 44 | + | ||
| 45 | +sed -i.bak "s|modelDir = ''|modelDir = \"$model_dir\"|" ./model.dart | ||
| 46 | +sed -i.bak s/"modelName = ''"/"modelName = \"$model_name\""/ ./model.dart | ||
| 47 | + | ||
| 48 | +{% if tts_model.rule_fsts %} | ||
| 49 | + rule_fsts={{ tts_model.rule_fsts }} | ||
| 50 | + sed -i.bak "s|ruleFsts = ''|ruleFsts = \"$rule_fsts\"|" ./model.dart | ||
| 51 | +{% endif %} | ||
| 52 | + | ||
| 53 | +{% if tts_model.rule_fars %} | ||
| 54 | + rule_fars={{ tts_model.rule_fars }} | ||
| 55 | + sed -i.bak "s|ruleFars = ''|ruleFars = \"$rule_fars\"|" ./model.dart | ||
| 56 | +{% endif %} | ||
| 57 | + | ||
| 58 | +{% if tts_model.dict_dir %} | ||
| 59 | + dict_dir={{ tts_model.dict_dir }} | ||
| 60 | + sed -i.bak "s|dictDir = ''|dictDir = \"$dict_dir\"|" ./model.dart | ||
| 61 | +{% endif %} | ||
| 62 | + | ||
| 63 | +{% if tts_model.data_dir %} | ||
| 64 | + data_dir={{ tts_model.data_dir }} | ||
| 65 | + sed -i.bak "s|dataDir = ''|dataDir = \"$data_dir\"|" ./model.dart | ||
| 66 | +{% elif not tts_model.is_char %} | ||
| 67 | + sed -i.bak "s|lexicon = ''|lexicon = \"lexicon.txt\"|" ./model.dart | ||
| 68 | +{% endif %} | ||
| 69 | + | ||
| 70 | +git status | ||
| 71 | + | ||
| 72 | +git diff . | ||
| 73 | + | ||
| 74 | +popd #lib | ||
| 75 | + | ||
| 76 | +flutter pub get | ||
| 77 | + | ||
| 78 | +flutter build apk --split-per-abi --release | ||
| 79 | + | ||
| 80 | +pushd build/app/outputs/flutter-apk | ||
| 81 | +ls -lh | ||
| 82 | + | ||
| 83 | +for arch in armeabi-v7a arm64-v8a x86_64; do | ||
| 84 | + src=app-$arch-release.apk | ||
| 85 | + dst=$SHERPA_ONNX_DIR/sherpa-onnx-$SHERPA_ONNX_VERSION-$arch-$lang-tts-$model_dir.apk | ||
| 86 | + mv $src $dst | ||
| 87 | +done | ||
| 88 | + | ||
| 89 | +pushd $SHERPA_ONNX_DIR | ||
| 90 | +ls -lh *.apk | ||
| 91 | +popd | ||
| 92 | + | ||
| 93 | +popd | ||
| 94 | + | ||
| 95 | +popd | ||
| 96 | + | ||
| 97 | +{% endfor %} |
scripts/flutter/build-linux-tts.sh.in
0 → 100755
| 1 | +#!/usr/bin/env bash | ||
| 2 | +set -ex | ||
| 3 | + | ||
| 4 | +log() { | ||
| 5 | + # This function is from espnet | ||
| 6 | + local fname=${BASH_SOURCE[1]##*/} | ||
| 7 | + echo -e "$(date '+%Y-%m-%d %H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*" | ||
| 8 | +} | ||
| 9 | + | ||
| 10 | +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
| 11 | +SHERPA_ONNX_DIR=$(cd $SCRIPT_DIR/../.. && pwd) | ||
| 12 | +log "SCRIPT_DIR: $SCRIPT_DIR" | ||
| 13 | +log "SHERPA_ONNX_DIR: $SHERPA_ONNX_DIR" | ||
| 14 | + | ||
| 15 | +SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" $SHERPA_ONNX_DIR/CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | ||
| 16 | +log "SHERPA_ONNX_VERSION: $SHERPA_ONNX_VERSION" | ||
| 17 | + | ||
| 18 | +if [ -z $arch ]; then | ||
| 19 | + arch=x86_64 | ||
| 20 | +fi | ||
| 21 | + | ||
| 22 | +log "arch: $arch" | ||
| 23 | + | ||
| 24 | +{% for tts_model in tts_model_list %} | ||
| 25 | +pushd $SHERPA_ONNX_DIR/flutter-examples/tts/ | ||
| 26 | + | ||
| 27 | +git checkout . | ||
| 28 | + | ||
| 29 | +rm -rf assets | ||
| 30 | +mkdir assets | ||
| 31 | + | ||
| 32 | +pushd assets | ||
| 33 | + | ||
| 34 | +model_dir={{ tts_model.model_dir }} | ||
| 35 | +model_name={{ tts_model.model_name }} | ||
| 36 | +lang={{ tts_model.lang }} | ||
| 37 | + | ||
| 38 | +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/$model_dir.tar.bz2 | ||
| 39 | +tar xf $model_dir.tar.bz2 | ||
| 40 | +rm $model_dir.tar.bz2 | ||
| 41 | + | ||
| 42 | +ls -lh | ||
| 43 | +ls -lh * | ||
| 44 | + | ||
| 45 | +popd # assets | ||
| 46 | +# Now we are at the project root directory | ||
| 47 | + | ||
| 48 | +./generate-asset-list.py | ||
| 49 | + | ||
| 50 | +pushd lib | ||
| 51 | + | ||
| 52 | +sed -i.bak "s|modelDir = ''|modelDir = \"$model_dir\"|" ./model.dart | ||
| 53 | +sed -i.bak s/"modelName = ''"/"modelName = \"$model_name\""/ ./model.dart | ||
| 54 | + | ||
| 55 | +{% if tts_model.rule_fsts %} | ||
| 56 | + rule_fsts={{ tts_model.rule_fsts }} | ||
| 57 | + sed -i.bak "s|ruleFsts = ''|ruleFsts = \"$rule_fsts\"|" ./model.dart | ||
| 58 | +{% endif %} | ||
| 59 | + | ||
| 60 | +{% if tts_model.rule_fars %} | ||
| 61 | + rule_fars={{ tts_model.rule_fars }} | ||
| 62 | + sed -i.bak "s|ruleFars = ''|ruleFars = \"$rule_fars\"|" ./model.dart | ||
| 63 | +{% endif %} | ||
| 64 | + | ||
| 65 | +{% if tts_model.dict_dir %} | ||
| 66 | + dict_dir={{ tts_model.dict_dir }} | ||
| 67 | + sed -i.bak "s|dictDir = ''|dictDir = \"$dict_dir\"|" ./model.dart | ||
| 68 | +{% endif %} | ||
| 69 | + | ||
| 70 | +{% if tts_model.data_dir %} | ||
| 71 | + data_dir={{ tts_model.data_dir }} | ||
| 72 | + sed -i.bak "s|dataDir = ''|dataDir = \"$data_dir\"|" ./model.dart | ||
| 73 | +{% elif not tts_model.is_char %} | ||
| 74 | + sed -i.bak "s|lexicon = ''|lexicon = \"lexicon.txt\"|" ./model.dart | ||
| 75 | +{% endif %} | ||
| 76 | + | ||
| 77 | +git status | ||
| 78 | + | ||
| 79 | +git diff . | ||
| 80 | + | ||
| 81 | +popd #lib | ||
| 82 | + | ||
| 83 | +flutter pub get | ||
| 84 | + | ||
| 85 | +flutter build linux | ||
| 86 | + | ||
| 87 | +pushd build/linux/x64/release/ | ||
| 88 | + | ||
| 89 | +ls -lh | ||
| 90 | +echo "----" | ||
| 91 | +ls -lh bundle | ||
| 92 | + | ||
| 93 | +echo "----" | ||
| 94 | +ls -lh bundle/lib | ||
| 95 | + | ||
| 96 | +echo "----" | ||
| 97 | +ls -lh bundle/data | ||
| 98 | +echo "======" | ||
| 99 | +ls -lh bundle/data/flutter_assets | ||
| 100 | + | ||
| 101 | + | ||
| 102 | +echo "----" | ||
| 103 | +file bundle/tts | ||
| 104 | + | ||
| 105 | +echo "----" | ||
| 106 | +readelf -d bundle/tts | ||
| 107 | + | ||
| 108 | +echo "----" | ||
| 109 | +ldd bundle/tts | ||
| 110 | + | ||
| 111 | +app=sherpa-onnx-$SHERPA_ONNX_VERSION-linux-$arch-$lang-tts-$model_dir | ||
| 112 | + | ||
| 113 | +mv bundle $app | ||
| 114 | +tar cjf $app.tar.bz2 $app | ||
| 115 | +rm -rf $app | ||
| 116 | +mv $app.tar.bz2 $SHERPA_ONNX_DIR | ||
| 117 | + | ||
| 118 | +pushd $SHERPA_ONNX_DIR | ||
| 119 | +ls -lh *.tar.bz2 | ||
| 120 | +popd | ||
| 121 | + | ||
| 122 | +popd | ||
| 123 | + | ||
| 124 | +popd | ||
| 125 | +{% endfor %} |
| @@ -23,11 +23,15 @@ log "arch: $arch" | @@ -23,11 +23,15 @@ log "arch: $arch" | ||
| 23 | 23 | ||
| 24 | {% for model in model_list %} | 24 | {% for model in model_list %} |
| 25 | pushd $SHERPA_ONNX_DIR/flutter-examples/streaming_asr/ | 25 | pushd $SHERPA_ONNX_DIR/flutter-examples/streaming_asr/ |
| 26 | + | ||
| 26 | model_name={{ model.model_name }} | 27 | model_name={{ model.model_name }} |
| 27 | lang={{ model.lang }} | 28 | lang={{ model.lang }} |
| 28 | type={{ model.idx }} | 29 | type={{ model.idx }} |
| 29 | short_name={{ model.short_name }} | 30 | short_name={{ model.short_name }} |
| 30 | 31 | ||
| 32 | +rm -rf assets | ||
| 33 | +mkdir assets | ||
| 34 | + | ||
| 31 | pushd assets | 35 | pushd assets |
| 32 | 36 | ||
| 33 | curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/${model_name}.tar.bz2 | 37 | curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/${model_name}.tar.bz2 |
| @@ -38,6 +42,9 @@ tar xvf ${model_name}.tar.bz2 | @@ -38,6 +42,9 @@ tar xvf ${model_name}.tar.bz2 | ||
| 38 | rm -rf *.tar.bz2 | 42 | rm -rf *.tar.bz2 |
| 39 | ls -lh $model_name | 43 | ls -lh $model_name |
| 40 | 44 | ||
| 45 | +ls -lh | ||
| 46 | +ls -lh * | ||
| 47 | + | ||
| 41 | popd | 48 | popd |
| 42 | 49 | ||
| 43 | git checkout ./ | 50 | git checkout ./ |
| @@ -64,9 +71,15 @@ ls -lh | @@ -64,9 +71,15 @@ ls -lh | ||
| 64 | 71 | ||
| 65 | app=sherpa-onnx-$SHERPA_ONNX_VERSION-osx-$arch-asr-$lang-$short_name.app | 72 | app=sherpa-onnx-$SHERPA_ONNX_VERSION-osx-$arch-asr-$lang-$short_name.app |
| 66 | mv streaming_asr.app $app | 73 | mv streaming_asr.app $app |
| 67 | -tar cjfv $app.tar.bz2 $app | 74 | +tar cjf $app.tar.bz2 $app |
| 75 | +rm -rf $app | ||
| 68 | ls -lh | 76 | ls -lh |
| 69 | mv $app.tar.bz2 $SHERPA_ONNX_DIR | 77 | mv $app.tar.bz2 $SHERPA_ONNX_DIR |
| 78 | + | ||
| 79 | +pushd $SHERPA_ONNX_DIR | ||
| 80 | +ls -lh *.tar.bz2 | ||
| 81 | +popd | ||
| 82 | + | ||
| 70 | popd | 83 | popd |
| 71 | 84 | ||
| 72 | popd | 85 | popd |
scripts/flutter/build-macos-tts.sh.in
0 → 100755
| 1 | +#!/usr/bin/env bash | ||
| 2 | +set -ex | ||
| 3 | + | ||
| 4 | +log() { | ||
| 5 | + # This function is from espnet | ||
| 6 | + local fname=${BASH_SOURCE[1]##*/} | ||
| 7 | + echo -e "$(date '+%Y-%m-%d %H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*" | ||
| 8 | +} | ||
| 9 | + | ||
| 10 | +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
| 11 | +SHERPA_ONNX_DIR=$(cd $SCRIPT_DIR/../.. && pwd) | ||
| 12 | +log "SCRIPT_DIR: $SCRIPT_DIR" | ||
| 13 | +log "SHERPA_ONNX_DIR: $SHERPA_ONNX_DIR" | ||
| 14 | + | ||
| 15 | +SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" $SHERPA_ONNX_DIR/CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | ||
| 16 | +log "SHERPA_ONNX_VERSION: $SHERPA_ONNX_VERSION" | ||
| 17 | + | ||
| 18 | +if [ -z $arch ]; then | ||
| 19 | + arch=x86_64 | ||
| 20 | +fi | ||
| 21 | + | ||
| 22 | +log "arch: $arch" | ||
| 23 | + | ||
| 24 | +{% for tts_model in tts_model_list %} | ||
| 25 | +pushd $SHERPA_ONNX_DIR/flutter-examples/tts/ | ||
| 26 | + | ||
| 27 | +git checkout . | ||
| 28 | + | ||
| 29 | +rm -rf assets | ||
| 30 | +mkdir assets | ||
| 31 | + | ||
| 32 | +pushd assets | ||
| 33 | + | ||
| 34 | +model_dir={{ tts_model.model_dir }} | ||
| 35 | +model_name={{ tts_model.model_name }} | ||
| 36 | +lang={{ tts_model.lang }} | ||
| 37 | + | ||
| 38 | +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/$model_dir.tar.bz2 | ||
| 39 | +tar xf $model_dir.tar.bz2 | ||
| 40 | +rm $model_dir.tar.bz2 | ||
| 41 | + | ||
| 42 | +ls -lh | ||
| 43 | +ls -lh * | ||
| 44 | + | ||
| 45 | +popd # assets | ||
| 46 | +# Now we are at the project root directory | ||
| 47 | + | ||
| 48 | +./generate-asset-list.py | ||
| 49 | + | ||
| 50 | +pushd lib | ||
| 51 | + | ||
| 52 | +sed -i.bak "s|modelDir = ''|modelDir = \"$model_dir\"|" ./model.dart | ||
| 53 | +sed -i.bak s/"modelName = ''"/"modelName = \"$model_name\""/ ./model.dart | ||
| 54 | + | ||
| 55 | +{% if tts_model.rule_fsts %} | ||
| 56 | + rule_fsts={{ tts_model.rule_fsts }} | ||
| 57 | + sed -i.bak "s|ruleFsts = ''|ruleFsts = \"$rule_fsts\"|" ./model.dart | ||
| 58 | +{% endif %} | ||
| 59 | + | ||
| 60 | +{% if tts_model.rule_fars %} | ||
| 61 | + rule_fars={{ tts_model.rule_fars }} | ||
| 62 | + sed -i.bak "s|ruleFars = ''|ruleFars = \"$rule_fars\"|" ./model.dart | ||
| 63 | +{% endif %} | ||
| 64 | + | ||
| 65 | +{% if tts_model.dict_dir %} | ||
| 66 | + dict_dir={{ tts_model.dict_dir }} | ||
| 67 | + sed -i.bak "s|dictDir = ''|dictDir = \"$dict_dir\"|" ./model.dart | ||
| 68 | +{% endif %} | ||
| 69 | + | ||
| 70 | +{% if tts_model.data_dir %} | ||
| 71 | + data_dir={{ tts_model.data_dir }} | ||
| 72 | + sed -i.bak "s|dataDir = ''|dataDir = \"$data_dir\"|" ./model.dart | ||
| 73 | +{% elif not tts_model.is_char %} | ||
| 74 | + sed -i.bak "s|lexicon = ''|lexicon = \"lexicon.txt\"|" ./model.dart | ||
| 75 | +{% endif %} | ||
| 76 | + | ||
| 77 | +git status | ||
| 78 | + | ||
| 79 | +git diff . | ||
| 80 | + | ||
| 81 | +popd #lib | ||
| 82 | + | ||
| 83 | +flutter pub get | ||
| 84 | + | ||
| 85 | +export FLUTTER_XCODE_ARCHS=$arch | ||
| 86 | +log "FLUTTER_XCODE_ARCHS: $FLUTTER_XCODE_ARCHS" | ||
| 87 | + | ||
| 88 | +flutter build macos | ||
| 89 | + | ||
| 90 | +pushd build/macos/Build/Products/Release/ | ||
| 91 | +ls -lh | ||
| 92 | + | ||
| 93 | +app=sherpa-onnx-$SHERPA_ONNX_VERSION-osx-$arch-$lang-tts-$model_dir.app | ||
| 94 | + | ||
| 95 | +mv tts.app $app | ||
| 96 | +tar cjf $app.tar.bz2 $app | ||
| 97 | +ls -lh | ||
| 98 | +mv $app.tar.bz2 $SHERPA_ONNX_DIR | ||
| 99 | +rm -rf $app | ||
| 100 | + | ||
| 101 | +pushd $SHERPA_ONNX_DIR | ||
| 102 | +ls -lh *.tar.bz2 | ||
| 103 | +popd | ||
| 104 | + | ||
| 105 | +popd | ||
| 106 | + | ||
| 107 | +popd | ||
| 108 | + | ||
| 109 | +{% endfor %} |
| @@ -17,11 +17,16 @@ log "SHERPA_ONNX_VERSION: $SHERPA_ONNX_VERSION" | @@ -17,11 +17,16 @@ log "SHERPA_ONNX_VERSION: $SHERPA_ONNX_VERSION" | ||
| 17 | 17 | ||
| 18 | {% for model in model_list %} | 18 | {% for model in model_list %} |
| 19 | pushd $SHERPA_ONNX_DIR/flutter-examples/streaming_asr/ | 19 | pushd $SHERPA_ONNX_DIR/flutter-examples/streaming_asr/ |
| 20 | + | ||
| 20 | model_name={{ model.model_name }} | 21 | model_name={{ model.model_name }} |
| 21 | lang={{ model.lang }} | 22 | lang={{ model.lang }} |
| 22 | type={{ model.idx }} | 23 | type={{ model.idx }} |
| 23 | short_name={{ model.short_name }} | 24 | short_name={{ model.short_name }} |
| 24 | 25 | ||
| 26 | +rm -rf build | ||
| 27 | +rm -rf assets | ||
| 28 | +mkdir assets | ||
| 29 | + | ||
| 25 | pushd assets | 30 | pushd assets |
| 26 | 31 | ||
| 27 | curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/${model_name}.tar.bz2 | 32 | curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/${model_name}.tar.bz2 |
| @@ -32,6 +37,9 @@ tar xvf ${model_name}.tar.bz2 | @@ -32,6 +37,9 @@ tar xvf ${model_name}.tar.bz2 | ||
| 32 | rm -rf *.tar.bz2 | 37 | rm -rf *.tar.bz2 |
| 33 | ls -lh $model_name | 38 | ls -lh $model_name |
| 34 | 39 | ||
| 40 | +ls -lh | ||
| 41 | +ls -lh * | ||
| 42 | + | ||
| 35 | popd | 43 | popd |
| 36 | 44 | ||
| 37 | git checkout ./ | 45 | git checkout ./ |
| @@ -55,9 +63,14 @@ ls -lh | @@ -55,9 +63,14 @@ ls -lh | ||
| 55 | 63 | ||
| 56 | dst=sherpa-onnx-$SHERPA_ONNX_VERSION-win-x64-asr-$lang-$short_name | 64 | dst=sherpa-onnx-$SHERPA_ONNX_VERSION-win-x64-asr-$lang-$short_name |
| 57 | mv Release $dst | 65 | mv Release $dst |
| 58 | -tar cjfv $dst.tar.bz2 ./$dst | 66 | +tar cjf $dst.tar.bz2 ./$dst |
| 67 | +rm -rf $dst | ||
| 59 | mv $dst.tar.bz2 $SHERPA_ONNX_DIR | 68 | mv $dst.tar.bz2 $SHERPA_ONNX_DIR |
| 60 | 69 | ||
| 70 | +pushd $SHERPA_ONNX_DIR | ||
| 71 | +ls -lh *.tar.bz2 | ||
| 72 | +popd | ||
| 73 | + | ||
| 61 | popd | 74 | popd |
| 62 | 75 | ||
| 63 | popd | 76 | popd |
scripts/flutter/build-windows-tts.sh.in
0 → 100755
| 1 | +#!/usr/bin/env bash | ||
| 2 | +set -ex | ||
| 3 | + | ||
| 4 | +log() { | ||
| 5 | + # This function is from espnet | ||
| 6 | + local fname=${BASH_SOURCE[1]##*/} | ||
| 7 | + echo -e "$(date '+%Y-%m-%d %H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*" | ||
| 8 | +} | ||
| 9 | + | ||
| 10 | +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
| 11 | +SHERPA_ONNX_DIR=$(cd $SCRIPT_DIR/../.. && pwd) | ||
| 12 | +log "SCRIPT_DIR: $SCRIPT_DIR" | ||
| 13 | +log "SHERPA_ONNX_DIR: $SHERPA_ONNX_DIR" | ||
| 14 | + | ||
| 15 | +SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" $SHERPA_ONNX_DIR/CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | ||
| 16 | +log "SHERPA_ONNX_VERSION: $SHERPA_ONNX_VERSION" | ||
| 17 | + | ||
| 18 | +if [ -z $arch ]; then | ||
| 19 | + arch=x64 | ||
| 20 | +fi | ||
| 21 | + | ||
| 22 | +log "arch: $arch" | ||
| 23 | + | ||
| 24 | +{% for tts_model in tts_model_list %} | ||
| 25 | +pushd $SHERPA_ONNX_DIR/flutter-examples/tts/ | ||
| 26 | + | ||
| 27 | +git checkout . | ||
| 28 | + | ||
| 29 | +rm -rf assets | ||
| 30 | + | ||
| 31 | +mkdir -p assets | ||
| 32 | + | ||
| 33 | +pushd assets | ||
| 34 | + | ||
| 35 | +model_dir={{ tts_model.model_dir }} | ||
| 36 | +model_name={{ tts_model.model_name }} | ||
| 37 | +lang={{ tts_model.lang }} | ||
| 38 | + | ||
| 39 | +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/$model_dir.tar.bz2 | ||
| 40 | +tar xf $model_dir.tar.bz2 | ||
| 41 | +rm $model_dir.tar.bz2 | ||
| 42 | + | ||
| 43 | +ls -lh | ||
| 44 | + | ||
| 45 | +ls -lh * | ||
| 46 | + | ||
| 47 | +popd # assets | ||
| 48 | +# Now we are at the project root directory | ||
| 49 | + | ||
| 50 | +./generate-asset-list.py | ||
| 51 | + | ||
| 52 | +pushd lib | ||
| 53 | + | ||
| 54 | +sed -i.bak "s|modelDir = ''|modelDir = \"$model_dir\"|" ./model.dart | ||
| 55 | +sed -i.bak s/"modelName = ''"/"modelName = \"$model_name\""/ ./model.dart | ||
| 56 | + | ||
| 57 | +{% if tts_model.rule_fsts %} | ||
| 58 | + rule_fsts={{ tts_model.rule_fsts }} | ||
| 59 | + sed -i.bak "s|ruleFsts = ''|ruleFsts = \"$rule_fsts\"|" ./model.dart | ||
| 60 | +{% endif %} | ||
| 61 | + | ||
| 62 | +{% if tts_model.rule_fars %} | ||
| 63 | + rule_fars={{ tts_model.rule_fars }} | ||
| 64 | + sed -i.bak "s|ruleFars = ''|ruleFars = \"$rule_fars\"|" ./model.dart | ||
| 65 | +{% endif %} | ||
| 66 | + | ||
| 67 | +{% if tts_model.dict_dir %} | ||
| 68 | + dict_dir={{ tts_model.dict_dir }} | ||
| 69 | + sed -i.bak "s|dictDir = ''|dictDir = \"$dict_dir\"|" ./model.dart | ||
| 70 | +{% endif %} | ||
| 71 | + | ||
| 72 | +{% if tts_model.data_dir %} | ||
| 73 | + data_dir={{ tts_model.data_dir }} | ||
| 74 | + sed -i.bak "s|dataDir = ''|dataDir = \"$data_dir\"|" ./model.dart | ||
| 75 | +{% elif not tts_model.is_char %} | ||
| 76 | + sed -i.bak "s|lexicon = ''|lexicon = \"lexicon.txt\"|" ./model.dart | ||
| 77 | +{% endif %} | ||
| 78 | + | ||
| 79 | +git status | ||
| 80 | + | ||
| 81 | +git diff . | ||
| 82 | + | ||
| 83 | +popd #lib | ||
| 84 | + | ||
| 85 | +flutter pub get | ||
| 86 | + | ||
| 87 | +flutter build windows | ||
| 88 | + | ||
| 89 | +pushd build/windows/x64/runner/ | ||
| 90 | +ls -lh | ||
| 91 | +echo "---" | ||
| 92 | + | ||
| 93 | +ls -lh ./Release/ | ||
| 94 | + | ||
| 95 | +dst=sherpa-onnx-$SHERPA_ONNX_VERSION-win-$arch-$lang-tts-$model_dir | ||
| 96 | +mv Release $dst | ||
| 97 | +tar cjf $dst.tar.bz2 ./$dst | ||
| 98 | +rm -rf $dst | ||
| 99 | +mv $dst.tar.bz2 $SHERPA_ONNX_DIR | ||
| 100 | + | ||
| 101 | +pushd $SHERPA_ONNX_DIR | ||
| 102 | +ls -lh *.tar.bz2 | ||
| 103 | +popd | ||
| 104 | + | ||
| 105 | +popd | ||
| 106 | + | ||
| 107 | +popd | ||
| 108 | + | ||
| 109 | +{% endfor %} |
scripts/flutter/generate-tts.py
0 → 100755
| 1 | +#!/usr/bin/env python3 | ||
| 2 | + | ||
| 3 | +import argparse | ||
| 4 | +from dataclasses import dataclass | ||
| 5 | +from typing import List, Optional | ||
| 6 | + | ||
| 7 | +import jinja2 | ||
| 8 | + | ||
| 9 | +# pip install iso639-lang | ||
| 10 | +from iso639 import Lang | ||
| 11 | + | ||
| 12 | + | ||
| 13 | +def get_args(): | ||
| 14 | + parser = argparse.ArgumentParser() | ||
| 15 | + parser.add_argument( | ||
| 16 | + "--total", | ||
| 17 | + type=int, | ||
| 18 | + default=1, | ||
| 19 | + help="Number of runners", | ||
| 20 | + ) | ||
| 21 | + parser.add_argument( | ||
| 22 | + "--index", | ||
| 23 | + type=int, | ||
| 24 | + default=0, | ||
| 25 | + help="Index of the current runner", | ||
| 26 | + ) | ||
| 27 | + return parser.parse_args() | ||
| 28 | + | ||
| 29 | + | ||
| 30 | +@dataclass | ||
| 31 | +class TtsModel: | ||
| 32 | + model_dir: str | ||
| 33 | + model_name: str = "" | ||
| 34 | + lang: str = "" # en, zh, fr, de, etc. | ||
| 35 | + rule_fsts: Optional[List[str]] = None | ||
| 36 | + rule_fars: Optional[List[str]] = None | ||
| 37 | + data_dir: Optional[str] = None | ||
| 38 | + dict_dir: Optional[str] = None | ||
| 39 | + is_char: bool = False | ||
| 40 | + lang_iso_639_3: str = "" | ||
| 41 | + | ||
| 42 | + | ||
| 43 | +def convert_lang_to_iso_639_3(models: List[TtsModel]): | ||
| 44 | + for m in models: | ||
| 45 | + if m.lang_iso_639_3 == "": | ||
| 46 | + m.lang_iso_639_3 = Lang(m.lang).pt3 | ||
| 47 | + | ||
| 48 | + | ||
| 49 | +def get_coqui_models() -> List[TtsModel]: | ||
| 50 | + # English (coqui-ai/TTS) | ||
| 51 | + models = [ | ||
| 52 | + TtsModel(model_dir="vits-coqui-en-ljspeech"), | ||
| 53 | + TtsModel(model_dir="vits-coqui-en-ljspeech-neon"), | ||
| 54 | + TtsModel(model_dir="vits-coqui-en-vctk"), | ||
| 55 | + # TtsModel(model_dir="vits-coqui-en-jenny"), | ||
| 56 | + ] | ||
| 57 | + | ||
| 58 | + for m in models: | ||
| 59 | + m.data_dir = m.model_dir + "/" + "espeak-ng-data" | ||
| 60 | + m.model_name = "model.onnx" | ||
| 61 | + m.lang = "en" | ||
| 62 | + | ||
| 63 | + character_models = [ | ||
| 64 | + TtsModel(model_dir="vits-coqui-bg-cv", lang="bg"), | ||
| 65 | + TtsModel(model_dir="vits-coqui-bn-custom_female", lang="bn"), | ||
| 66 | + TtsModel(model_dir="vits-coqui-cs-cv", lang="cs"), | ||
| 67 | + TtsModel(model_dir="vits-coqui-da-cv", lang="da"), | ||
| 68 | + TtsModel(model_dir="vits-coqui-de-css10", lang="de"), | ||
| 69 | + TtsModel(model_dir="vits-coqui-es-css10", lang="es"), | ||
| 70 | + TtsModel(model_dir="vits-coqui-et-cv", lang="et"), | ||
| 71 | + TtsModel(model_dir="vits-coqui-fi-css10", lang="fi"), | ||
| 72 | + TtsModel(model_dir="vits-coqui-fr-css10", lang="fr"), | ||
| 73 | + TtsModel(model_dir="vits-coqui-ga-cv", lang="ga"), | ||
| 74 | + TtsModel(model_dir="vits-coqui-hr-cv", lang="hr"), | ||
| 75 | + TtsModel(model_dir="vits-coqui-lt-cv", lang="lt"), | ||
| 76 | + TtsModel(model_dir="vits-coqui-lv-cv", lang="lv"), | ||
| 77 | + TtsModel(model_dir="vits-coqui-mt-cv", lang="mt"), | ||
| 78 | + TtsModel(model_dir="vits-coqui-nl-css10", lang="nl"), | ||
| 79 | + TtsModel(model_dir="vits-coqui-pl-mai_female", lang="pl"), | ||
| 80 | + TtsModel(model_dir="vits-coqui-pt-cv", lang="pt"), | ||
| 81 | + TtsModel(model_dir="vits-coqui-ro-cv", lang="ro"), | ||
| 82 | + TtsModel(model_dir="vits-coqui-sk-cv", lang="sk"), | ||
| 83 | + TtsModel(model_dir="vits-coqui-sl-cv", lang="sl"), | ||
| 84 | + TtsModel(model_dir="vits-coqui-sv-cv", lang="sv"), | ||
| 85 | + TtsModel(model_dir="vits-coqui-uk-mai", lang="uk"), | ||
| 86 | + ] | ||
| 87 | + for m in character_models: | ||
| 88 | + m.is_char = True | ||
| 89 | + m.model_name = "model.onnx" | ||
| 90 | + | ||
| 91 | + return models + character_models | ||
| 92 | + | ||
| 93 | + | ||
| 94 | +def get_piper_models() -> List[TtsModel]: | ||
| 95 | + models = [ | ||
| 96 | + # TtsModel(model_dir="vits-piper-es_ES-mls_10246-low"), | ||
| 97 | + # TtsModel(model_dir="vits-piper-es_ES-mls_9972-low"), | ||
| 98 | + # TtsModel(model_dir="vits-piper-pl_PL-mls_6892-low"), | ||
| 99 | + TtsModel(model_dir="vits-piper-ar_JO-kareem-low"), | ||
| 100 | + TtsModel(model_dir="vits-piper-ar_JO-kareem-medium"), | ||
| 101 | + TtsModel(model_dir="vits-piper-ca_ES-upc_ona-medium"), | ||
| 102 | + TtsModel(model_dir="vits-piper-ca_ES-upc_ona-x_low"), | ||
| 103 | + TtsModel(model_dir="vits-piper-ca_ES-upc_pau-x_low"), | ||
| 104 | + TtsModel(model_dir="vits-piper-ca_ES-upc_pau-x_low"), | ||
| 105 | + TtsModel(model_dir="vits-piper-cs_CZ-jirka-medium"), | ||
| 106 | + TtsModel(model_dir="vits-piper-cy_GB-gwryw_gogleddol-medium"), | ||
| 107 | + TtsModel(model_dir="vits-piper-da_DK-talesyntese-medium"), | ||
| 108 | + TtsModel(model_dir="vits-piper-de_DE-eva_k-x_low"), | ||
| 109 | + TtsModel(model_dir="vits-piper-de_DE-karlsson-low"), | ||
| 110 | + TtsModel(model_dir="vits-piper-de_DE-kerstin-low"), | ||
| 111 | + # TtsModel(model_dir="vits-piper-de_DE-mls-medium"), | ||
| 112 | + TtsModel(model_dir="vits-piper-de_DE-pavoque-low"), | ||
| 113 | + TtsModel(model_dir="vits-piper-de_DE-ramona-low"), | ||
| 114 | + TtsModel(model_dir="vits-piper-de_DE-thorsten-high"), | ||
| 115 | + TtsModel(model_dir="vits-piper-de_DE-thorsten-low"), | ||
| 116 | + TtsModel(model_dir="vits-piper-de_DE-thorsten-medium"), | ||
| 117 | + TtsModel(model_dir="vits-piper-de_DE-thorsten_emotional-medium"), | ||
| 118 | + TtsModel(model_dir="vits-piper-el_GR-rapunzelina-low"), | ||
| 119 | + TtsModel(model_dir="vits-piper-en_GB-alan-low"), | ||
| 120 | + TtsModel(model_dir="vits-piper-en_GB-alan-medium"), | ||
| 121 | + TtsModel(model_dir="vits-piper-en_GB-alba-medium"), | ||
| 122 | + TtsModel(model_dir="vits-piper-en_GB-aru-medium"), | ||
| 123 | + TtsModel(model_dir="vits-piper-en_GB-cori-high"), | ||
| 124 | + TtsModel(model_dir="vits-piper-en_GB-cori-medium"), | ||
| 125 | + TtsModel(model_dir="vits-piper-en_GB-jenny_dioco-medium"), | ||
| 126 | + TtsModel(model_dir="vits-piper-en_GB-northern_english_male-medium"), | ||
| 127 | + TtsModel(model_dir="vits-piper-en_GB-semaine-medium"), | ||
| 128 | + TtsModel(model_dir="vits-piper-en_GB-southern_english_female-low"), | ||
| 129 | + TtsModel(model_dir="vits-piper-en_GB-southern_english_female-medium"), | ||
| 130 | + TtsModel(model_dir="vits-piper-en_GB-southern_english_male-medium"), | ||
| 131 | + TtsModel(model_dir="vits-piper-en_GB-sweetbbak-amy"), | ||
| 132 | + TtsModel(model_dir="vits-piper-en_GB-vctk-medium"), | ||
| 133 | + TtsModel(model_dir="vits-piper-en_US-amy-low"), | ||
| 134 | + TtsModel(model_dir="vits-piper-en_US-amy-medium"), | ||
| 135 | + TtsModel(model_dir="vits-piper-en_US-arctic-medium"), | ||
| 136 | + TtsModel(model_dir="vits-piper-en_US-bryce-medium"), | ||
| 137 | + TtsModel(model_dir="vits-piper-en_US-danny-low"), | ||
| 138 | + TtsModel(model_dir="vits-piper-en_US-glados"), | ||
| 139 | + TtsModel(model_dir="vits-piper-en_US-hfc_female-medium"), | ||
| 140 | + TtsModel(model_dir="vits-piper-en_US-hfc_male-medium"), | ||
| 141 | + TtsModel(model_dir="vits-piper-en_US-joe-medium"), | ||
| 142 | + TtsModel(model_dir="vits-piper-en_US-john-medium"), | ||
| 143 | + TtsModel(model_dir="vits-piper-en_US-kathleen-low"), | ||
| 144 | + TtsModel(model_dir="vits-piper-en_US-kristin-medium"), | ||
| 145 | + TtsModel(model_dir="vits-piper-en_US-kusal-medium"), | ||
| 146 | + TtsModel(model_dir="vits-piper-en_US-l2arctic-medium"), | ||
| 147 | + TtsModel(model_dir="vits-piper-en_US-lessac-high"), | ||
| 148 | + TtsModel(model_dir="vits-piper-en_US-lessac-low"), | ||
| 149 | + TtsModel(model_dir="vits-piper-en_US-lessac-medium"), | ||
| 150 | + TtsModel(model_dir="vits-piper-en_US-libritts-high"), | ||
| 151 | + TtsModel(model_dir="vits-piper-en_US-libritts_r-medium"), | ||
| 152 | + TtsModel(model_dir="vits-piper-en_US-ljspeech-high"), | ||
| 153 | + TtsModel(model_dir="vits-piper-en_US-ljspeech-medium"), | ||
| 154 | + TtsModel(model_dir="vits-piper-en_US-norman-medium"), | ||
| 155 | + TtsModel(model_dir="vits-piper-en_US-ryan-high"), | ||
| 156 | + TtsModel(model_dir="vits-piper-en_US-ryan-low"), | ||
| 157 | + TtsModel(model_dir="vits-piper-en_US-ryan-medium"), | ||
| 158 | + TtsModel(model_dir="vits-piper-es-glados-medium"), | ||
| 159 | + TtsModel(model_dir="vits-piper-es_ES-carlfm-x_low"), | ||
| 160 | + TtsModel(model_dir="vits-piper-es_ES-davefx-medium"), | ||
| 161 | + TtsModel(model_dir="vits-piper-es_ES-sharvard-medium"), | ||
| 162 | + TtsModel(model_dir="vits-piper-es_MX-ald-medium"), | ||
| 163 | + TtsModel(model_dir="vits-piper-es_MX-claude-high"), | ||
| 164 | + TtsModel(model_dir="vits-piper-fa_IR-amir-medium"), | ||
| 165 | + TtsModel(model_dir="vits-piper-fa_IR-gyro-medium"), | ||
| 166 | + TtsModel(model_dir="vits-piper-fi_FI-harri-low"), | ||
| 167 | + TtsModel(model_dir="vits-piper-fi_FI-harri-medium"), | ||
| 168 | + # TtsModel(model_dir="vits-piper-fr_FR-mls-medium"), | ||
| 169 | + TtsModel(model_dir="vits-piper-fr_FR-siwis-low"), | ||
| 170 | + TtsModel(model_dir="vits-piper-fr_FR-siwis-medium"), | ||
| 171 | + TtsModel(model_dir="vits-piper-fr_FR-tom-medium"), | ||
| 172 | + TtsModel(model_dir="vits-piper-fr_FR-upmc-medium"), | ||
| 173 | + TtsModel(model_dir="vits-piper-hu_HU-anna-medium"), | ||
| 174 | + TtsModel(model_dir="vits-piper-hu_HU-berta-medium"), | ||
| 175 | + TtsModel(model_dir="vits-piper-hu_HU-imre-medium"), | ||
| 176 | + TtsModel(model_dir="vits-piper-is_IS-bui-medium"), | ||
| 177 | + TtsModel(model_dir="vits-piper-is_IS-salka-medium"), | ||
| 178 | + TtsModel(model_dir="vits-piper-is_IS-steinn-medium"), | ||
| 179 | + TtsModel(model_dir="vits-piper-is_IS-ugla-medium"), | ||
| 180 | + TtsModel(model_dir="vits-piper-it_IT-paola-medium"), | ||
| 181 | + TtsModel(model_dir="vits-piper-it_IT-riccardo-x_low"), | ||
| 182 | + TtsModel(model_dir="vits-piper-ka_GE-natia-medium"), | ||
| 183 | + TtsModel(model_dir="vits-piper-kk_KZ-iseke-x_low"), | ||
| 184 | + TtsModel(model_dir="vits-piper-kk_KZ-issai-high"), | ||
| 185 | + TtsModel(model_dir="vits-piper-kk_KZ-raya-x_low"), | ||
| 186 | + TtsModel(model_dir="vits-piper-lb_LU-marylux-medium"), | ||
| 187 | + TtsModel(model_dir="vits-piper-ne_NP-google-medium"), | ||
| 188 | + TtsModel(model_dir="vits-piper-ne_NP-google-x_low"), | ||
| 189 | + TtsModel(model_dir="vits-piper-nl_BE-nathalie-medium"), | ||
| 190 | + TtsModel(model_dir="vits-piper-nl_BE-nathalie-x_low"), | ||
| 191 | + TtsModel(model_dir="vits-piper-nl_BE-rdh-medium"), | ||
| 192 | + TtsModel(model_dir="vits-piper-nl_BE-rdh-x_low"), | ||
| 193 | + TtsModel(model_dir="vits-piper-nl_NL-mls-medium"), | ||
| 194 | + TtsModel(model_dir="vits-piper-nl_NL-mls_5809-low"), | ||
| 195 | + TtsModel(model_dir="vits-piper-nl_NL-mls_7432-low"), | ||
| 196 | + TtsModel(model_dir="vits-piper-no_NO-talesyntese-medium"), | ||
| 197 | + TtsModel(model_dir="vits-piper-pl_PL-darkman-medium"), | ||
| 198 | + TtsModel(model_dir="vits-piper-pl_PL-gosia-medium"), | ||
| 199 | + TtsModel(model_dir="vits-piper-pl_PL-mc_speech-medium"), | ||
| 200 | + TtsModel(model_dir="vits-piper-pt_BR-edresson-low"), | ||
| 201 | + TtsModel(model_dir="vits-piper-pt_BR-faber-medium"), | ||
| 202 | + TtsModel(model_dir="vits-piper-pt_PT-tugao-medium"), | ||
| 203 | + TtsModel(model_dir="vits-piper-ro_RO-mihai-medium"), | ||
| 204 | + TtsModel(model_dir="vits-piper-ru_RU-denis-medium"), | ||
| 205 | + TtsModel(model_dir="vits-piper-ru_RU-dmitri-medium"), | ||
| 206 | + TtsModel(model_dir="vits-piper-ru_RU-irina-medium"), | ||
| 207 | + TtsModel(model_dir="vits-piper-ru_RU-ruslan-medium"), | ||
| 208 | + TtsModel(model_dir="vits-piper-sk_SK-lili-medium"), | ||
| 209 | + TtsModel(model_dir="vits-piper-sl_SI-artur-medium"), | ||
| 210 | + TtsModel(model_dir="vits-piper-sr_RS-serbski_institut-medium"), | ||
| 211 | + TtsModel(model_dir="vits-piper-sv_SE-nst-medium"), | ||
| 212 | + TtsModel(model_dir="vits-piper-sw_CD-lanfrica-medium"), | ||
| 213 | + TtsModel(model_dir="vits-piper-tr_TR-dfki-medium"), | ||
| 214 | + TtsModel(model_dir="vits-piper-tr_TR-fahrettin-medium"), | ||
| 215 | + TtsModel(model_dir="vits-piper-tr_TR-fettah-medium"), | ||
| 216 | + TtsModel(model_dir="vits-piper-uk_UA-lada-x_low"), | ||
| 217 | + TtsModel(model_dir="vits-piper-uk_UA-ukrainian_tts-medium"), | ||
| 218 | + TtsModel(model_dir="vits-piper-vi_VN-25hours_single-low"), | ||
| 219 | + TtsModel(model_dir="vits-piper-vi_VN-vais1000-medium"), | ||
| 220 | + TtsModel(model_dir="vits-piper-vi_VN-vivos-x_low"), | ||
| 221 | + TtsModel(model_dir="vits-piper-zh_CN-huayan-medium"), | ||
| 222 | + ] | ||
| 223 | + | ||
| 224 | + for m in models: | ||
| 225 | + m.data_dir = m.model_dir + "/" + "espeak-ng-data" | ||
| 226 | + m.model_name = m.model_dir[len("vits-piper-") :] + ".onnx" | ||
| 227 | + m.lang = m.model_dir.split("-")[2][:2] | ||
| 228 | + | ||
| 229 | + return models | ||
| 230 | + | ||
| 231 | + | ||
| 232 | +def get_mimic3_models() -> List[TtsModel]: | ||
| 233 | + models = [ | ||
| 234 | + TtsModel(model_dir="vits-mimic3-af_ZA-google-nwu_low"), | ||
| 235 | + TtsModel(model_dir="vits-mimic3-bn-multi_low"), | ||
| 236 | + TtsModel(model_dir="vits-mimic3-es_ES-m-ailabs_low"), | ||
| 237 | + TtsModel(model_dir="vits-mimic3-fa-haaniye_low"), | ||
| 238 | + TtsModel(model_dir="vits-mimic3-fi_FI-harri-tapani-ylilammi_low"), | ||
| 239 | + TtsModel(model_dir="vits-mimic3-gu_IN-cmu-indic_low"), | ||
| 240 | + TtsModel(model_dir="vits-mimic3-hu_HU-diana-majlinger_low"), | ||
| 241 | + TtsModel(model_dir="vits-mimic3-ko_KO-kss_low"), | ||
| 242 | + TtsModel(model_dir="vits-mimic3-ne_NP-ne-google_low"), | ||
| 243 | + TtsModel(model_dir="vits-mimic3-pl_PL-m-ailabs_low"), | ||
| 244 | + TtsModel(model_dir="vits-mimic3-tn_ZA-google-nwu_low"), | ||
| 245 | + TtsModel(model_dir="vits-mimic3-vi_VN-vais1000_low"), | ||
| 246 | + ] | ||
| 247 | + for m in models: | ||
| 248 | + m.data_dir = m.model_dir + "/" + "espeak-ng-data" | ||
| 249 | + m.model_name = m.model_dir[len("vits-mimic3-") :] + ".onnx" | ||
| 250 | + m.lang = m.model_dir.split("-")[2][:2] | ||
| 251 | + | ||
| 252 | + return models | ||
| 253 | + | ||
| 254 | + | ||
| 255 | +def get_vits_models() -> List[TtsModel]: | ||
| 256 | + chinese_models = [ | ||
| 257 | + # Chinese | ||
| 258 | + TtsModel( | ||
| 259 | + model_dir="vits-icefall-zh-aishell3", | ||
| 260 | + model_name="model.onnx", | ||
| 261 | + lang="zh", | ||
| 262 | + rule_fsts="vits-icefall-zh-aishell3/phone.fst,vits-icefall-zh-aishell3/date.fst,vits-icefall-zh-aishell3/number.fst,vits-icefall-zh-aishell3/new_heteronym.fst", | ||
| 263 | + rule_fars="vits-icefall-zh-aishell3/rule.far", | ||
| 264 | + ), | ||
| 265 | + TtsModel( | ||
| 266 | + model_dir="vits-zh-aishell3", | ||
| 267 | + model_name="vits-aishell3.onnx", | ||
| 268 | + lang="zh", | ||
| 269 | + ), | ||
| 270 | + TtsModel( | ||
| 271 | + model_dir="vits-zh-hf-doom", | ||
| 272 | + model_name="doom.onnx", | ||
| 273 | + lang="zh", | ||
| 274 | + ), | ||
| 275 | + TtsModel( | ||
| 276 | + model_dir="vits-zh-hf-echo", | ||
| 277 | + model_name="echo.onnx", | ||
| 278 | + lang="zh", | ||
| 279 | + ), | ||
| 280 | + TtsModel( | ||
| 281 | + model_dir="vits-zh-hf-zenyatta", | ||
| 282 | + model_name="zenyatta.onnx", | ||
| 283 | + lang="zh", | ||
| 284 | + ), | ||
| 285 | + TtsModel( | ||
| 286 | + model_dir="vits-zh-hf-abyssinvoker", | ||
| 287 | + model_name="abyssinvoker.onnx", | ||
| 288 | + lang="zh", | ||
| 289 | + ), | ||
| 290 | + TtsModel( | ||
| 291 | + model_dir="vits-zh-hf-keqing", | ||
| 292 | + model_name="keqing.onnx", | ||
| 293 | + lang="zh", | ||
| 294 | + ), | ||
| 295 | + TtsModel( | ||
| 296 | + model_dir="vits-zh-hf-eula", | ||
| 297 | + model_name="eula.onnx", | ||
| 298 | + lang="zh", | ||
| 299 | + ), | ||
| 300 | + TtsModel( | ||
| 301 | + model_dir="vits-zh-hf-bronya", | ||
| 302 | + model_name="bronya.onnx", | ||
| 303 | + lang="zh", | ||
| 304 | + ), | ||
| 305 | + TtsModel( | ||
| 306 | + model_dir="vits-zh-hf-theresa", | ||
| 307 | + model_name="theresa.onnx", | ||
| 308 | + lang="zh", | ||
| 309 | + ), | ||
| 310 | + TtsModel( | ||
| 311 | + model_dir="vits-zh-hf-fanchen-wnj", | ||
| 312 | + model_name="vits-zh-hf-fanchen-wnj.onnx", | ||
| 313 | + lang="zh", | ||
| 314 | + ), | ||
| 315 | + TtsModel( | ||
| 316 | + model_dir="vits-zh-hf-fanchen-C", | ||
| 317 | + model_name="vits-zh-hf-fanchen-C.onnx", | ||
| 318 | + lang="zh", | ||
| 319 | + ), | ||
| 320 | + TtsModel( | ||
| 321 | + model_dir="vits-zh-hf-fanchen-ZhiHuiLaoZhe", | ||
| 322 | + model_name="vits-zh-hf-fanchen-ZhiHuiLaoZhe.onnx", | ||
| 323 | + lang="zh", | ||
| 324 | + ), | ||
| 325 | + TtsModel( | ||
| 326 | + model_dir="vits-zh-hf-fanchen-ZhiHuiLaoZhe_new", | ||
| 327 | + model_name="vits-zh-hf-fanchen-ZhiHuiLaoZhe_new.onnx", | ||
| 328 | + lang="zh", | ||
| 329 | + ), | ||
| 330 | + TtsModel( | ||
| 331 | + model_dir="vits-zh-hf-fanchen-unity", | ||
| 332 | + model_name="vits-zh-hf-fanchen-unity.onnx", | ||
| 333 | + lang="zh", | ||
| 334 | + ), | ||
| 335 | + ] | ||
| 336 | + | ||
| 337 | + rule_fsts = ["phone.fst", "date.fst", "number.fst", "new_heteronym.fst"] | ||
| 338 | + for m in chinese_models: | ||
| 339 | + s = [f"{m.model_dir}/{r}" for r in rule_fsts] | ||
| 340 | + if "vits-zh-hf" in m.model_dir: | ||
| 341 | + s = s[:-1] | ||
| 342 | + m.dict_dir = m.model_dir + "/dict" | ||
| 343 | + | ||
| 344 | + m.rule_fsts = ",".join(s) | ||
| 345 | + | ||
| 346 | + if "vits-zh-hf" not in m.model_dir: | ||
| 347 | + m.rule_fars = f"{m.model_dir}/rule.far" | ||
| 348 | + | ||
| 349 | + all_models = chinese_models + [ | ||
| 350 | + TtsModel( | ||
| 351 | + model_dir="vits-cantonese-hf-xiaomaiiwn", | ||
| 352 | + model_name="vits-cantonese-hf-xiaomaiiwn.onnx", | ||
| 353 | + lang="cantonese", | ||
| 354 | + lang_iso_639_3="yue", | ||
| 355 | + rule_fsts="vits-cantonese-hf-xiaomaiiwn/rule.fst", | ||
| 356 | + ), | ||
| 357 | + # English (US) | ||
| 358 | + TtsModel(model_dir="vits-vctk", model_name="vits-vctk.onnx", lang="en"), | ||
| 359 | + # TtsModel(model_dir="vits-ljs", model_name="vits-ljs.onnx", lang="en"), | ||
| 360 | + # fmt: on | ||
| 361 | + ] | ||
| 362 | + | ||
| 363 | + return all_models | ||
| 364 | + | ||
| 365 | + | ||
| 366 | +def main(): | ||
| 367 | + args = get_args() | ||
| 368 | + index = args.index | ||
| 369 | + total = args.total | ||
| 370 | + assert 0 <= index < total, (index, total) | ||
| 371 | + d = dict() | ||
| 372 | + | ||
| 373 | + all_model_list = get_vits_models() | ||
| 374 | + all_model_list += get_piper_models() | ||
| 375 | + all_model_list += get_mimic3_models() | ||
| 376 | + all_model_list += get_coqui_models() | ||
| 377 | + convert_lang_to_iso_639_3(all_model_list) | ||
| 378 | + | ||
| 379 | + num_models = len(all_model_list) | ||
| 380 | + | ||
| 381 | + num_per_runner = num_models // total | ||
| 382 | + if num_per_runner <= 0: | ||
| 383 | + raise ValueError(f"num_models: {num_models}, num_runners: {total}") | ||
| 384 | + | ||
| 385 | + start = index * num_per_runner | ||
| 386 | + end = start + num_per_runner | ||
| 387 | + | ||
| 388 | + remaining = num_models - args.total * num_per_runner | ||
| 389 | + | ||
| 390 | + print( | ||
| 391 | + "{index}/{total}: {start}-{end}/{num_models}".format( | ||
| 392 | + index=index, | ||
| 393 | + total=total, | ||
| 394 | + start=start, | ||
| 395 | + end=end, | ||
| 396 | + num_models=num_models, | ||
| 397 | + ) | ||
| 398 | + ) | ||
| 399 | + | ||
| 400 | + d["tts_model_list"] = all_model_list[start:end] | ||
| 401 | + if index < remaining: | ||
| 402 | + s = args.total * num_per_runner + index | ||
| 403 | + d["tts_model_list"].append(all_model_list[s]) | ||
| 404 | + print("{s}/{num_models}".format(s=s, num_models=num_models)) | ||
| 405 | + | ||
| 406 | + filename_list = [ | ||
| 407 | + "./build-macos-tts.sh", | ||
| 408 | + "./build-linux-tts.sh", | ||
| 409 | + "./build-android-tts.sh", | ||
| 410 | + "./build-windows-tts.sh", | ||
| 411 | + ] | ||
| 412 | + for filename in filename_list: | ||
| 413 | + environment = jinja2.Environment() | ||
| 414 | + with open("{filename}.in".format(filename=filename)) as f: | ||
| 415 | + s = f.read() | ||
| 416 | + template = environment.from_string(s) | ||
| 417 | + | ||
| 418 | + s = template.render(**d) | ||
| 419 | + with open(filename, "w") as f: | ||
| 420 | + print(s, file=f) | ||
| 421 | + | ||
| 422 | + | ||
| 423 | +if __name__ == "__main__": | ||
| 424 | + main() |
-
请 注册 或 登录 后发表评论