Committed by
GitHub
Flutter demo for real-time speech recognition (#1042)
正在显示
67 个修改的文件
包含
4056 行增加
和
235 行删除
| @@ -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-macos.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-macos.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 | ||
| @@ -32,30 +15,32 @@ concurrency: | @@ -32,30 +15,32 @@ concurrency: | ||
| 32 | 15 | ||
| 33 | jobs: | 16 | jobs: |
| 34 | flutter_macos: | 17 | flutter_macos: |
| 35 | - name: macos ${{ matrix.arch }} | 18 | + name: macos ${{ matrix.arch }} ${{ matrix.index }} |
| 36 | runs-on: ${{ matrix.os }} | 19 | runs-on: ${{ matrix.os }} |
| 37 | strategy: | 20 | strategy: |
| 38 | fail-fast: false | 21 | fail-fast: false |
| 39 | matrix: | 22 | matrix: |
| 40 | os: [macos-latest] | 23 | os: [macos-latest] |
| 41 | arch: [x86_64, arm64] | 24 | arch: [x86_64, arm64] |
| 25 | + total: ["3"] | ||
| 26 | + index: ["0", "1", "2"] | ||
| 42 | 27 | ||
| 43 | steps: | 28 | steps: |
| 44 | - uses: actions/checkout@v4 | 29 | - uses: actions/checkout@v4 |
| 45 | with: | 30 | with: |
| 46 | fetch-depth: 0 | 31 | fetch-depth: 0 |
| 47 | 32 | ||
| 33 | + - name: Install Python dependencies | ||
| 34 | + shell: bash | ||
| 35 | + run: | | ||
| 36 | + python3 -m pip install --break-system-packages --upgrade pip jinja2 | ||
| 37 | + | ||
| 48 | - name: Setup Flutter SDK | 38 | - name: Setup Flutter SDK |
| 49 | uses: flutter-actions/setup-flutter@v3 | 39 | uses: flutter-actions/setup-flutter@v3 |
| 50 | with: | 40 | with: |
| 51 | channel: stable | 41 | channel: stable |
| 52 | version: latest | 42 | version: latest |
| 53 | 43 | ||
| 54 | - - name: ccache | ||
| 55 | - uses: hendrikmuhs/ccache-action@v1.2 | ||
| 56 | - with: | ||
| 57 | - key: ${{ matrix.os }}-flutter-${{ matrix.arch }} | ||
| 58 | - | ||
| 59 | - name: Display PWD | 44 | - name: Display PWD |
| 60 | shell: bash | 45 | shell: bash |
| 61 | run: | | 46 | run: | |
| @@ -67,11 +52,6 @@ jobs: | @@ -67,11 +52,6 @@ jobs: | ||
| 67 | run: | | 52 | run: | |
| 68 | uname -a | 53 | uname -a |
| 69 | 54 | ||
| 70 | - - name: Install tree | ||
| 71 | - shell: bash | ||
| 72 | - run: | | ||
| 73 | - brew install tree | ||
| 74 | - | ||
| 75 | - name: Display flutter info | 55 | - name: Display flutter info |
| 76 | shell: bash | 56 | shell: bash |
| 77 | run: | | 57 | run: | |
| @@ -82,109 +62,29 @@ jobs: | @@ -82,109 +62,29 @@ jobs: | ||
| 82 | dart --version | 62 | dart --version |
| 83 | flutter doctor | 63 | flutter doctor |
| 84 | 64 | ||
| 85 | - - name: Configure CMake | ||
| 86 | - shell: bash | ||
| 87 | - run: | | ||
| 88 | - export CMAKE_CXX_COMPILER_LAUNCHER=ccache | ||
| 89 | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" | ||
| 90 | - cmake --version | ||
| 91 | - arch=${{ matrix.arch }} | ||
| 92 | - | ||
| 93 | - mkdir build | ||
| 94 | - cd build | ||
| 95 | - | ||
| 96 | - cmake \ | ||
| 97 | - -D BUILD_SHARED_LIBS=ON \ | ||
| 98 | - -DCMAKE_OSX_ARCHITECTURES=$arch \ | ||
| 99 | - -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ | ||
| 100 | - -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ | ||
| 101 | - -DBUILD_ESPEAK_NG_EXE=OFF \ | ||
| 102 | - -DSHERPA_ONNX_ENABLE_BINARY=OFF \ | ||
| 103 | - -DCMAKE_INSTALL_PREFIX=./install \ | ||
| 104 | - .. | ||
| 105 | - | ||
| 106 | - - name: Build sherpa-onnx for macos ${{ matrix.arch }} | ||
| 107 | - shell: bash | ||
| 108 | - run: | | ||
| 109 | - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" | ||
| 110 | - | ||
| 111 | - cd build | ||
| 112 | - make -j2 | ||
| 113 | - make install | ||
| 114 | - | ||
| 115 | - rm -v ./install/lib/libonnxruntime.dylib | ||
| 116 | - | ||
| 117 | - - name: Copy libs | ||
| 118 | - shell: bash | ||
| 119 | - run: | | ||
| 120 | - cp -v build/install/lib/lib* ./sherpa-onnx/flutter/macos/ | ||
| 121 | - | ||
| 122 | - echo "--------------------" | ||
| 123 | - | ||
| 124 | - ls -lh ./sherpa-onnx/flutter/macos/ | ||
| 125 | - | ||
| 126 | - - name: Download model files | ||
| 127 | - shell: bash | ||
| 128 | - run: | | ||
| 129 | - cd sherpa-onnx/flutter | ||
| 130 | - pushd example/assets | ||
| 131 | - | ||
| 132 | - # curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/3dspeaker_speech_eres2net_base_sv_zh-cn_3dspeaker_16k.onnx | ||
| 133 | - curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx | ||
| 134 | - # git clone https://github.com/csukuangfj/sr-data | ||
| 135 | - 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 | ||
| 136 | - tar xvf sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 | ||
| 137 | - rm sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 | ||
| 138 | - cd sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 | ||
| 139 | - rm encoder-epoch-99-avg-1.onnx | ||
| 140 | - rm decoder-epoch-99-avg-1.int8.onnx | ||
| 141 | - rm joiner-epoch-99-avg-1.onnx | ||
| 142 | - rm README.md | ||
| 143 | - rm bpe.model | ||
| 144 | - rm bpe.vocab | ||
| 145 | - rm -rf test_wavs | ||
| 146 | - ls -lh | ||
| 147 | - cd .. | ||
| 148 | - | ||
| 149 | - rm -rf sr-data/.git | ||
| 150 | - popd | ||
| 151 | - | ||
| 152 | - name: Build flutter | 65 | - name: Build flutter |
| 153 | shell: bash | 66 | shell: bash |
| 154 | run: | | 67 | run: | |
| 155 | - SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | ||
| 156 | - | ||
| 157 | - d=$PWD | ||
| 158 | - | ||
| 159 | - pushd sherpa-onnx/flutter | ||
| 160 | - dart pub get | ||
| 161 | - | ||
| 162 | - cd example | ||
| 163 | - export FLUTTER_XCODE_ARCHS=${{ matrix.arch }} | ||
| 164 | - echo "FLUTTER_XCODE_ARCHS: $FLUTTER_XCODE_ARCHS" | ||
| 165 | - flutter build macos | 68 | + export arch=${{ matrix.arch }} |
| 69 | + cd scripts/flutter | ||
| 166 | 70 | ||
| 167 | - cd build/macos/Build/Products/Release/ | 71 | + total=${{ matrix.total }} |
| 72 | + index=${{ matrix.index }} | ||
| 168 | 73 | ||
| 169 | - tree ./sherpa_onnx.app | 74 | + ./generate-streaming-asr.py --total $total --index $index |
| 170 | 75 | ||
| 171 | - app=sherpa-onnx-osx-${{ matrix.arch }}-$SHERPA_ONNX_VERSION.app | ||
| 172 | - mv sherpa_onnx.app $app | ||
| 173 | - tar cjfv $app.tar.bz2 $app | ||
| 174 | - ls -lh | ||
| 175 | - mv $app.tar.bz2 $d | ||
| 176 | - | ||
| 177 | - popd | ||
| 178 | - | ||
| 179 | - ls -lh $app.tar.bz2 | 76 | + chmod +x *.sh |
| 77 | + ./build-macos-streaming-asr.sh | ||
| 78 | + cd ../../ | ||
| 79 | + ls -lh *.tar.bz2 | ||
| 180 | 80 | ||
| 181 | - uses: actions/upload-artifact@v4 | 81 | - uses: actions/upload-artifact@v4 |
| 182 | with: | 82 | with: |
| 183 | - name: sherpa-onnx-osx-${{ matrix.arch }} | 83 | + name: sherpa-onnx-osx-${{ matrix.arch }}-${{ matrix.index }} |
| 184 | path: ./*.tar.bz2 | 84 | path: ./*.tar.bz2 |
| 185 | 85 | ||
| 186 | - name: Publish to huggingface | 86 | - name: Publish to huggingface |
| 187 | - if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/') && matrix.build_type == 'Release' | 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/')) |
| 188 | env: | 88 | env: |
| 189 | HF_TOKEN: ${{ secrets.HF_TOKEN }} | 89 | HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| 190 | uses: nick-fields/retry@v3 | 90 | uses: nick-fields/retry@v3 |
| @@ -205,19 +105,11 @@ jobs: | @@ -205,19 +105,11 @@ jobs: | ||
| 205 | git fetch | 105 | git fetch |
| 206 | git pull | 106 | git pull |
| 207 | git merge -m "merge remote" --ff origin main | 107 | git merge -m "merge remote" --ff origin main |
| 208 | - mkdir -p flutter | ||
| 209 | - cp -v ../*.tar.bz2 ./flutter | 108 | + mkdir -p flutter/asr |
| 109 | + cp -v ../*.tar.bz2 ./flutter/asr | ||
| 210 | 110 | ||
| 211 | git status | 111 | git status |
| 212 | git lfs track "*.bz2" | 112 | git lfs track "*.bz2" |
| 213 | git add . | 113 | git add . |
| 214 | git commit -m "add more files" | 114 | git commit -m "add more files" |
| 215 | git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-flutter main | 115 | git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-flutter main |
| 216 | - | ||
| 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: sherpa*.tar.bz2 |
| @@ -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-windows-x64.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-windows-x64.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 | ||
| @@ -32,18 +15,25 @@ concurrency: | @@ -32,18 +15,25 @@ concurrency: | ||
| 32 | 15 | ||
| 33 | jobs: | 16 | jobs: |
| 34 | flutter_windows_x64: | 17 | flutter_windows_x64: |
| 35 | - name: flutter windows x64 | 18 | + name: windows x64 ${{ matrix.index }} |
| 36 | runs-on: ${{ matrix.os }} | 19 | runs-on: ${{ matrix.os }} |
| 37 | strategy: | 20 | strategy: |
| 38 | fail-fast: false | 21 | fail-fast: false |
| 39 | matrix: | 22 | matrix: |
| 40 | os: [windows-latest] | 23 | os: [windows-latest] |
| 24 | + total: ["3"] | ||
| 25 | + index: ["0", "1", "2"] | ||
| 41 | 26 | ||
| 42 | steps: | 27 | steps: |
| 43 | - uses: actions/checkout@v4 | 28 | - uses: actions/checkout@v4 |
| 44 | with: | 29 | with: |
| 45 | fetch-depth: 0 | 30 | fetch-depth: 0 |
| 46 | 31 | ||
| 32 | + - name: Install Python dependencies | ||
| 33 | + shell: bash | ||
| 34 | + run: | | ||
| 35 | + python3 -m pip install --upgrade pip jinja2 | ||
| 36 | + | ||
| 47 | - name: Setup Flutter SDK | 37 | - name: Setup Flutter SDK |
| 48 | uses: flutter-actions/setup-flutter@v3 | 38 | uses: flutter-actions/setup-flutter@v3 |
| 49 | with: | 39 | with: |
| @@ -71,96 +61,28 @@ jobs: | @@ -71,96 +61,28 @@ jobs: | ||
| 71 | dart --version | 61 | dart --version |
| 72 | flutter doctor | 62 | flutter doctor |
| 73 | 63 | ||
| 74 | - - name: Configure CMake | ||
| 75 | - shell: bash | ||
| 76 | - run: | | ||
| 77 | - cmake --version | ||
| 78 | - | ||
| 79 | - mkdir build | ||
| 80 | - cd build | ||
| 81 | - | ||
| 82 | - cmake \ | ||
| 83 | - -A x64 \ | ||
| 84 | - -DBUILD_SHARED_LIBS=ON \ | ||
| 85 | - -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ | ||
| 86 | - -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ | ||
| 87 | - -DBUILD_ESPEAK_NG_EXE=OFF \ | ||
| 88 | - -DSHERPA_ONNX_ENABLE_BINARY=OFF \ | ||
| 89 | - -DBUILD_ESPEAK_NG_EXE=OFF \ | ||
| 90 | - -DCMAKE_INSTALL_PREFIX=./install \ | ||
| 91 | - .. | ||
| 92 | - | ||
| 93 | - - name: Build sherpa-onnx for windows x64 | ||
| 94 | - shell: bash | ||
| 95 | - run: | | ||
| 96 | - cd build | ||
| 97 | - cmake --build . --config Release -- -m:2 | ||
| 98 | - cmake --build . --config Release --target install -- -m:2 | ||
| 99 | - | ||
| 100 | - - name: Copy libs | ||
| 101 | - shell: bash | ||
| 102 | - run: | | ||
| 103 | - cp -v build/install/lib/*dll ./sherpa-onnx/flutter/windows/ | ||
| 104 | - cp -v build/install/lib/*fst* ./sherpa-onnx/flutter/windows/ | ||
| 105 | - | ||
| 106 | - echo "--------------------" | ||
| 107 | - | ||
| 108 | - ls -lh ./sherpa-onnx/flutter/windows/ | ||
| 109 | - | ||
| 110 | - - name: Download model files | ||
| 111 | - shell: bash | ||
| 112 | - run: | | ||
| 113 | - cd sherpa-onnx/flutter | ||
| 114 | - | ||
| 115 | - cd example/assets | ||
| 116 | - | ||
| 117 | - curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/silero_vad.onnx | ||
| 118 | - 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 | ||
| 119 | - tar xvf sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 | ||
| 120 | - rm sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 | ||
| 121 | - cd sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 | ||
| 122 | - rm encoder-epoch-99-avg-1.onnx | ||
| 123 | - rm decoder-epoch-99-avg-1.int8.onnx | ||
| 124 | - rm joiner-epoch-99-avg-1.onnx | ||
| 125 | - rm README.md | ||
| 126 | - rm bpe.model | ||
| 127 | - rm bpe.vocab | ||
| 128 | - rm -rf test_wavs | ||
| 129 | - ls -lh | ||
| 130 | - cd .. | ||
| 131 | - | ||
| 132 | - name: Build flutter | 64 | - name: Build flutter |
| 133 | shell: bash | 65 | shell: bash |
| 134 | run: | | 66 | run: | |
| 135 | - d=$PWD | ||
| 136 | - SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | 67 | + cd scripts/flutter |
| 137 | 68 | ||
| 138 | - pushd sherpa-onnx/flutter | ||
| 139 | - dart pub get | 69 | + total=${{ matrix.total }} |
| 70 | + index=${{ matrix.index }} | ||
| 140 | 71 | ||
| 141 | - cd example | ||
| 142 | - flutter build windows | 72 | + ./generate-streaming-asr.py --total $total --index $index |
| 143 | 73 | ||
| 144 | - cd build/windows/x64/runner/ | ||
| 145 | - | ||
| 146 | - dst=sherpa-onnx-win-x64-$SHERPA_ONNX_VERSION | ||
| 147 | - mv Release $dst | ||
| 148 | - | ||
| 149 | - tar cjfv $dst.tar.bz2 ./$dst | ||
| 150 | - ls -lh | ||
| 151 | - mv $dst.tar.bz2 $d/ | ||
| 152 | - | ||
| 153 | - popd | ||
| 154 | - | ||
| 155 | - ls -lh $dst.tar.bz2 | 74 | + chmod +x *.sh |
| 75 | + ./build-windows-streaming-asr.sh | ||
| 76 | + cd ../../ | ||
| 77 | + ls -lh *.tar.bz2 | ||
| 156 | 78 | ||
| 157 | - uses: actions/upload-artifact@v4 | 79 | - uses: actions/upload-artifact@v4 |
| 158 | with: | 80 | with: |
| 159 | - name: sherpa-onnx-win-x64 | 81 | + name: sherpa-onnx-win-x64-${{ matrix.index }} |
| 160 | path: ./*.tar.bz2 | 82 | path: ./*.tar.bz2 |
| 161 | 83 | ||
| 162 | - name: Publish to huggingface | 84 | - name: Publish to huggingface |
| 163 | - if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/') && matrix.build_type == 'Release' | 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/')) |
| 164 | env: | 86 | env: |
| 165 | HF_TOKEN: ${{ secrets.HF_TOKEN }} | 87 | HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| 166 | uses: nick-fields/retry@v3 | 88 | uses: nick-fields/retry@v3 |
| @@ -181,19 +103,11 @@ jobs: | @@ -181,19 +103,11 @@ jobs: | ||
| 181 | git fetch | 103 | git fetch |
| 182 | git pull | 104 | git pull |
| 183 | git merge -m "merge remote" --ff origin main | 105 | git merge -m "merge remote" --ff origin main |
| 184 | - mkdir -p flutter | ||
| 185 | - cp -v ../*.tar.bz2 ./flutter | 106 | + mkdir -p flutter/asr |
| 107 | + cp -v ../*.tar.bz2 ./flutter/asr | ||
| 186 | 108 | ||
| 187 | git status | 109 | git status |
| 188 | git lfs track "*.bz2" | 110 | git lfs track "*.bz2" |
| 189 | git add . | 111 | git add . |
| 190 | git commit -m "add more files" | 112 | git commit -m "add more files" |
| 191 | git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-flutter main | 113 | git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-flutter main |
| 192 | - | ||
| 193 | - # - name: Release android libs | ||
| 194 | - # if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/') | ||
| 195 | - # uses: svenstaro/upload-release-action@v2 | ||
| 196 | - # with: | ||
| 197 | - # file_glob: true | ||
| 198 | - # overwrite: true | ||
| 199 | - # file: sherpa*.tar.bz2 |
flutter-examples/README.md
0 → 100644
flutter-examples/streaming_asr/.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/streaming_asr/.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: macos | ||
| 19 | + create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 | ||
| 20 | + base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 | ||
| 21 | + - platform: windows | ||
| 22 | + create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 | ||
| 23 | + base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1 | ||
| 24 | + | ||
| 25 | + # User provided section | ||
| 26 | + | ||
| 27 | + # List of Local paths (relative to this file) that should be | ||
| 28 | + # ignored by the migrate tool. | ||
| 29 | + # | ||
| 30 | + # Files that are not part of the templates will be ignored by default. | ||
| 31 | + unmanaged_files: | ||
| 32 | + - 'lib/main.dart' | ||
| 33 | + - 'ios/Runner.xcodeproj/project.pbxproj' |
flutter-examples/streaming_asr/README.md
0 → 100644
| 1 | +# streaming_asr | ||
| 2 | + | ||
| 3 | +A new Flutter project. | ||
| 4 | + | ||
| 5 | +## Getting Started | ||
| 6 | + | ||
| 7 | +This project is a starting point for a Flutter application. | ||
| 8 | + | ||
| 9 | +A few resources to get you started if this is your first Flutter project: | ||
| 10 | + | ||
| 11 | +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) | ||
| 12 | +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) | ||
| 13 | + | ||
| 14 | +For help getting started with Flutter development, view the | ||
| 15 | +[online documentation](https://docs.flutter.dev/), which offers tutorials, | ||
| 16 | +samples, guidance on mobile development, and a full API reference. |
| 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/streaming_asr/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/streaming_asr/lib/main.dart
0 → 100644
| 1 | +// Copyright (c) 2024 Xiaomi Corporation | ||
| 2 | +import 'package:flutter/material.dart'; | ||
| 3 | + | ||
| 4 | +import './streaming_asr.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 | + StreamingAsrScreen(), | ||
| 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 | +} |
| 1 | +import 'package:sherpa_onnx/sherpa_onnx.dart' as sherpa_onnx; | ||
| 2 | +import './utils.dart'; | ||
| 3 | + | ||
| 4 | +// Remember to change `assets` in ../pubspec.yaml | ||
| 5 | +// and download files to ../assets | ||
| 6 | +Future<sherpa_onnx.OnlineModelConfig> getOnlineModelConfig( | ||
| 7 | + {required int type}) async { | ||
| 8 | + switch (type) { | ||
| 9 | + case 0: | ||
| 10 | + final modelDir = | ||
| 11 | + 'assets/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20'; | ||
| 12 | + return sherpa_onnx.OnlineModelConfig( | ||
| 13 | + transducer: sherpa_onnx.OnlineTransducerModelConfig( | ||
| 14 | + encoder: | ||
| 15 | + await copyAssetFile('$modelDir/encoder-epoch-99-avg-1.int8.onnx'), | ||
| 16 | + decoder: await copyAssetFile('$modelDir/decoder-epoch-99-avg-1.onnx'), | ||
| 17 | + joiner: await copyAssetFile('$modelDir/joiner-epoch-99-avg-1.onnx'), | ||
| 18 | + ), | ||
| 19 | + tokens: await copyAssetFile('$modelDir/tokens.txt'), | ||
| 20 | + modelType: 'zipformer', | ||
| 21 | + ); | ||
| 22 | + case 1: | ||
| 23 | + final modelDir = 'assets/sherpa-onnx-streaming-zipformer-en-2023-06-26'; | ||
| 24 | + return sherpa_onnx.OnlineModelConfig( | ||
| 25 | + transducer: sherpa_onnx.OnlineTransducerModelConfig( | ||
| 26 | + encoder: await copyAssetFile( | ||
| 27 | + '$modelDir/encoder-epoch-99-avg-1-chunk-16-left-128.int8.onnx'), | ||
| 28 | + decoder: await copyAssetFile( | ||
| 29 | + '$modelDir/decoder-epoch-99-avg-1-chunk-16-left-128.onnx'), | ||
| 30 | + joiner: await copyAssetFile( | ||
| 31 | + '$modelDir/joiner-epoch-99-avg-1-chunk-16-left-128.onnx'), | ||
| 32 | + ), | ||
| 33 | + tokens: await copyAssetFile('$modelDir/tokens.txt'), | ||
| 34 | + modelType: 'zipformer2', | ||
| 35 | + ); | ||
| 36 | + case 2: | ||
| 37 | + final modelDir = | ||
| 38 | + 'assets/icefall-asr-zipformer-streaming-wenetspeech-20230615'; | ||
| 39 | + return sherpa_onnx.OnlineModelConfig( | ||
| 40 | + transducer: sherpa_onnx.OnlineTransducerModelConfig( | ||
| 41 | + encoder: await copyAssetFile( | ||
| 42 | + '$modelDir/exp/encoder-epoch-12-avg-4-chunk-16-left-128.int8.onnx'), | ||
| 43 | + decoder: await copyAssetFile( | ||
| 44 | + '$modelDir/exp/decoder-epoch-12-avg-4-chunk-16-left-128.onnx'), | ||
| 45 | + joiner: await copyAssetFile( | ||
| 46 | + '$modelDir/exp/joiner-epoch-12-avg-4-chunk-16-left-128.onnx'), | ||
| 47 | + ), | ||
| 48 | + tokens: await copyAssetFile('$modelDir/data/lang_char/tokens.txt'), | ||
| 49 | + modelType: 'zipformer2', | ||
| 50 | + ); | ||
| 51 | + case 3: | ||
| 52 | + final modelDir = 'assets/sherpa-onnx-streaming-zipformer-fr-2023-04-14'; | ||
| 53 | + return sherpa_onnx.OnlineModelConfig( | ||
| 54 | + transducer: sherpa_onnx.OnlineTransducerModelConfig( | ||
| 55 | + encoder: await copyAssetFile( | ||
| 56 | + '$modelDir/encoder-epoch-29-avg-9-with-averaged-model.int8.onnx'), | ||
| 57 | + decoder: await copyAssetFile( | ||
| 58 | + '$modelDir/decoder-epoch-29-avg-9-with-averaged-model.onnx'), | ||
| 59 | + joiner: await copyAssetFile( | ||
| 60 | + '$modelDir/joincoder-epoch-29-avg-9-with-averaged-model.onnx'), | ||
| 61 | + ), | ||
| 62 | + tokens: await copyAssetFile('$modelDir/tokens.txt'), | ||
| 63 | + modelType: 'zipformer', | ||
| 64 | + ); | ||
| 65 | + default: | ||
| 66 | + throw ArgumentError('Unsupported type: $type'); | ||
| 67 | + } | ||
| 68 | +} |
| 1 | +// Copyright (c) 2024 Xiaomi Corporation | ||
| 2 | +import 'dart:async'; | ||
| 3 | + | ||
| 4 | +import 'package:flutter/foundation.dart'; | ||
| 5 | +import 'package:flutter/material.dart'; | ||
| 6 | +import 'package:path/path.dart' as p; | ||
| 7 | +import 'package:path_provider/path_provider.dart'; | ||
| 8 | +import 'package:record/record.dart'; | ||
| 9 | + | ||
| 10 | +import 'package:sherpa_onnx/sherpa_onnx.dart' as sherpa_onnx; | ||
| 11 | + | ||
| 12 | +import './utils.dart'; | ||
| 13 | +import './online_model.dart'; | ||
| 14 | + | ||
| 15 | +Future<sherpa_onnx.OnlineRecognizer> createOnlineRecognizer() async { | ||
| 16 | + final type = 0; | ||
| 17 | + | ||
| 18 | + final modelConfig = await getOnlineModelConfig(type: type); | ||
| 19 | + final config = sherpa_onnx.OnlineRecognizerConfig( | ||
| 20 | + model: modelConfig, | ||
| 21 | + ruleFsts: '', | ||
| 22 | + ); | ||
| 23 | + | ||
| 24 | + return sherpa_onnx.OnlineRecognizer(config); | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +class StreamingAsrScreen extends StatefulWidget { | ||
| 28 | + const StreamingAsrScreen({super.key}); | ||
| 29 | + | ||
| 30 | + @override | ||
| 31 | + State<StreamingAsrScreen> createState() => _StreamingAsrScreenState(); | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +class _StreamingAsrScreenState extends State<StreamingAsrScreen> { | ||
| 35 | + late final TextEditingController _controller; | ||
| 36 | + late final AudioRecorder _audioRecorder; | ||
| 37 | + | ||
| 38 | + String _title = 'Real-time speech recognition'; | ||
| 39 | + String _last = ''; | ||
| 40 | + int _index = 0; | ||
| 41 | + bool _isInitialized = false; | ||
| 42 | + | ||
| 43 | + sherpa_onnx.OnlineRecognizer? _recognizer; | ||
| 44 | + sherpa_onnx.OnlineStream? _stream; | ||
| 45 | + int _sampleRate = 16000; | ||
| 46 | + | ||
| 47 | + StreamSubscription<RecordState>? _recordSub; | ||
| 48 | + RecordState _recordState = RecordState.stop; | ||
| 49 | + | ||
| 50 | + @override | ||
| 51 | + void initState() { | ||
| 52 | + _audioRecorder = AudioRecorder(); | ||
| 53 | + _controller = TextEditingController(); | ||
| 54 | + | ||
| 55 | + _recordSub = _audioRecorder.onStateChanged().listen((recordState) { | ||
| 56 | + _updateRecordState(recordState); | ||
| 57 | + }); | ||
| 58 | + | ||
| 59 | + super.initState(); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + Future<void> _start() async { | ||
| 63 | + if (!_isInitialized) { | ||
| 64 | + sherpa_onnx.initBindings(); | ||
| 65 | + _recognizer = await createOnlineRecognizer(); | ||
| 66 | + _stream = _recognizer?.createStream(); | ||
| 67 | + | ||
| 68 | + _isInitialized = true; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + try { | ||
| 72 | + if (await _audioRecorder.hasPermission()) { | ||
| 73 | + const encoder = AudioEncoder.pcm16bits; | ||
| 74 | + | ||
| 75 | + if (!await _isEncoderSupported(encoder)) { | ||
| 76 | + return; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + final devs = await _audioRecorder.listInputDevices(); | ||
| 80 | + debugPrint(devs.toString()); | ||
| 81 | + | ||
| 82 | + const config = RecordConfig( | ||
| 83 | + encoder: encoder, | ||
| 84 | + sampleRate: 16000, | ||
| 85 | + numChannels: 1, | ||
| 86 | + ); | ||
| 87 | + | ||
| 88 | + final stream = await _audioRecorder.startStream(config); | ||
| 89 | + | ||
| 90 | + stream.listen( | ||
| 91 | + (data) { | ||
| 92 | + final samplesFloat32 = | ||
| 93 | + convertBytesToFloat32(Uint8List.fromList(data)); | ||
| 94 | + | ||
| 95 | + _stream!.acceptWaveform( | ||
| 96 | + samples: samplesFloat32, sampleRate: _sampleRate); | ||
| 97 | + while (_recognizer!.isReady(_stream!)) { | ||
| 98 | + _recognizer!.decode(_stream!); | ||
| 99 | + } | ||
| 100 | + final text = _recognizer!.getResult(_stream!).text; | ||
| 101 | + String textToDisplay = _last; | ||
| 102 | + if (text != '') { | ||
| 103 | + if (_last == '') { | ||
| 104 | + textToDisplay = '$_index: $text'; | ||
| 105 | + } else { | ||
| 106 | + textToDisplay = '$_index: $text\n$_last'; | ||
| 107 | + } | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + if (_recognizer!.isEndpoint(_stream!)) { | ||
| 111 | + _recognizer!.reset(_stream!); | ||
| 112 | + if (text != '') { | ||
| 113 | + _last = textToDisplay; | ||
| 114 | + _index += 1; | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + // print('text: $textToDisplay'); | ||
| 118 | + | ||
| 119 | + _controller.value = TextEditingValue( | ||
| 120 | + text: textToDisplay, | ||
| 121 | + selection: TextSelection.collapsed(offset: textToDisplay.length), | ||
| 122 | + ); | ||
| 123 | + }, | ||
| 124 | + onDone: () { | ||
| 125 | + print('stream stopped.'); | ||
| 126 | + }, | ||
| 127 | + ); | ||
| 128 | + } | ||
| 129 | + } catch (e) { | ||
| 130 | + print(e); | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + Future<void> _stop() async { | ||
| 135 | + _stream!.free(); | ||
| 136 | + _stream = _recognizer!.createStream(); | ||
| 137 | + | ||
| 138 | + await _audioRecorder.stop(); | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + Future<void> _pause() => _audioRecorder.pause(); | ||
| 142 | + | ||
| 143 | + Future<void> _resume() => _audioRecorder.resume(); | ||
| 144 | + | ||
| 145 | + void _updateRecordState(RecordState recordState) { | ||
| 146 | + setState(() => _recordState = recordState); | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + Future<bool> _isEncoderSupported(AudioEncoder encoder) async { | ||
| 150 | + final isSupported = await _audioRecorder.isEncoderSupported( | ||
| 151 | + encoder, | ||
| 152 | + ); | ||
| 153 | + | ||
| 154 | + if (!isSupported) { | ||
| 155 | + debugPrint('${encoder.name} is not supported on this platform.'); | ||
| 156 | + debugPrint('Supported encoders are:'); | ||
| 157 | + | ||
| 158 | + for (final e in AudioEncoder.values) { | ||
| 159 | + if (await _audioRecorder.isEncoderSupported(e)) { | ||
| 160 | + debugPrint('- ${encoder.name}'); | ||
| 161 | + } | ||
| 162 | + } | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + return isSupported; | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + @override | ||
| 169 | + Widget build(BuildContext context) { | ||
| 170 | + return MaterialApp( | ||
| 171 | + home: Scaffold( | ||
| 172 | + appBar: AppBar( | ||
| 173 | + title: Text(_title), | ||
| 174 | + ), | ||
| 175 | + body: Column( | ||
| 176 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 177 | + children: [ | ||
| 178 | + const SizedBox(height: 50), | ||
| 179 | + TextField( | ||
| 180 | + maxLines: 5, | ||
| 181 | + controller: _controller, | ||
| 182 | + readOnly: true, | ||
| 183 | + ), | ||
| 184 | + const SizedBox(height: 50), | ||
| 185 | + Row( | ||
| 186 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 187 | + children: <Widget>[ | ||
| 188 | + _buildRecordStopControl(), | ||
| 189 | + const SizedBox(width: 20), | ||
| 190 | + _buildText(), | ||
| 191 | + ], | ||
| 192 | + ), | ||
| 193 | + ], | ||
| 194 | + ), | ||
| 195 | + ), | ||
| 196 | + ); | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + @override | ||
| 200 | + void dispose() { | ||
| 201 | + _recordSub?.cancel(); | ||
| 202 | + _audioRecorder.dispose(); | ||
| 203 | + _stream?.free(); | ||
| 204 | + _recognizer?.free(); | ||
| 205 | + super.dispose(); | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + Widget _buildRecordStopControl() { | ||
| 209 | + late Icon icon; | ||
| 210 | + late Color color; | ||
| 211 | + | ||
| 212 | + if (_recordState != RecordState.stop) { | ||
| 213 | + icon = const Icon(Icons.stop, color: Colors.red, size: 30); | ||
| 214 | + color = Colors.red.withOpacity(0.1); | ||
| 215 | + } else { | ||
| 216 | + final theme = Theme.of(context); | ||
| 217 | + icon = Icon(Icons.mic, color: theme.primaryColor, size: 30); | ||
| 218 | + color = theme.primaryColor.withOpacity(0.1); | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + return ClipOval( | ||
| 222 | + child: Material( | ||
| 223 | + color: color, | ||
| 224 | + child: InkWell( | ||
| 225 | + child: SizedBox(width: 56, height: 56, child: icon), | ||
| 226 | + onTap: () { | ||
| 227 | + (_recordState != RecordState.stop) ? _stop() : _start(); | ||
| 228 | + }, | ||
| 229 | + ), | ||
| 230 | + ), | ||
| 231 | + ); | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + Widget _buildText() { | ||
| 235 | + if (_recordState == RecordState.stop) { | ||
| 236 | + return const Text("Start"); | ||
| 237 | + } else { | ||
| 238 | + return const Text("Stop"); | ||
| 239 | + } | ||
| 240 | + } | ||
| 241 | +} |
| 1 | +// Copyright (c) 2024 Xiaomi Corporation | ||
| 2 | +import 'package:path/path.dart'; | ||
| 3 | +import 'package:path_provider/path_provider.dart'; | ||
| 4 | +import 'package:flutter/services.dart' show rootBundle; | ||
| 5 | +import 'dart:typed_data'; | ||
| 6 | +import "dart:io"; | ||
| 7 | + | ||
| 8 | +// Copy the asset file from src to dst | ||
| 9 | +Future<String> copyAssetFile(String src, [String? dst]) async { | ||
| 10 | + final Directory directory = await getApplicationDocumentsDirectory(); | ||
| 11 | + if (dst == null) { | ||
| 12 | + dst = basename(src); | ||
| 13 | + } | ||
| 14 | + final target = join(directory.path, dst); | ||
| 15 | + | ||
| 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); | ||
| 20 | + | ||
| 21 | + return target; | ||
| 22 | +} | ||
| 23 | + | ||
| 24 | +Float32List convertBytesToFloat32(Uint8List bytes, [endian = Endian.little]) { | ||
| 25 | + final values = Float32List(bytes.length ~/ 2); | ||
| 26 | + | ||
| 27 | + final data = ByteData.view(bytes.buffer); | ||
| 28 | + | ||
| 29 | + for (var i = 0; i < bytes.length; i += 2) { | ||
| 30 | + int short = data.getInt16(i, endian); | ||
| 31 | + values[i ~/ 2] = short / 32678.0; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + return values; | ||
| 35 | +} |
| 1 | +// | ||
| 2 | +// Generated file. Do not edit. | ||
| 3 | +// | ||
| 4 | + | ||
| 5 | +import FlutterMacOS | ||
| 6 | +import Foundation | ||
| 7 | + | ||
| 8 | +import path_provider_foundation | ||
| 9 | +import record_darwin | ||
| 10 | +import url_launcher_macos | ||
| 11 | + | ||
| 12 | +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { | ||
| 13 | + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) | ||
| 14 | + RecordPlugin.register(with: registry.registrar(forPlugin: "RecordPlugin")) | ||
| 15 | + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) | ||
| 16 | +} |
flutter-examples/streaming_asr/macos/Podfile
0 → 100644
| 1 | +platform :osx, '10.15' | ||
| 2 | + | ||
| 3 | +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. | ||
| 4 | +ENV['COCOAPODS_DISABLE_STATS'] = 'true' | ||
| 5 | + | ||
| 6 | +project 'Runner', { | ||
| 7 | + 'Debug' => :debug, | ||
| 8 | + 'Profile' => :release, | ||
| 9 | + 'Release' => :release, | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +def flutter_root | ||
| 13 | + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) | ||
| 14 | + unless File.exist?(generated_xcode_build_settings_path) | ||
| 15 | + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" | ||
| 16 | + end | ||
| 17 | + | ||
| 18 | + File.foreach(generated_xcode_build_settings_path) do |line| | ||
| 19 | + matches = line.match(/FLUTTER_ROOT\=(.*)/) | ||
| 20 | + return matches[1].strip if matches | ||
| 21 | + end | ||
| 22 | + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" | ||
| 23 | +end | ||
| 24 | + | ||
| 25 | +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) | ||
| 26 | + | ||
| 27 | +flutter_macos_podfile_setup | ||
| 28 | + | ||
| 29 | +target 'Runner' do | ||
| 30 | + use_frameworks! | ||
| 31 | + use_modular_headers! | ||
| 32 | + | ||
| 33 | + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) | ||
| 34 | + target 'RunnerTests' do | ||
| 35 | + inherit! :search_paths | ||
| 36 | + end | ||
| 37 | +end | ||
| 38 | + | ||
| 39 | +post_install do |installer| | ||
| 40 | + installer.pods_project.targets.each do |target| | ||
| 41 | + flutter_additional_macos_build_settings(target) | ||
| 42 | + end | ||
| 43 | +end |
| 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 /* streaming_asr.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "streaming_asr.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 /* streaming_asr.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 /* streaming_asr.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.example.streamingAsr.RunnerTests; | ||
| 389 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 390 | + SWIFT_VERSION = 5.0; | ||
| 391 | + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/streaming_asr.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/streaming_asr"; | ||
| 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.example.streamingAsr.RunnerTests; | ||
| 403 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 404 | + SWIFT_VERSION = 5.0; | ||
| 405 | + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/streaming_asr.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/streaming_asr"; | ||
| 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.example.streamingAsr.RunnerTests; | ||
| 417 | + PRODUCT_NAME = "$(TARGET_NAME)"; | ||
| 418 | + SWIFT_VERSION = 5.0; | ||
| 419 | + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/streaming_asr.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/streaming_asr"; | ||
| 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.15; | ||
| 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.15; | ||
| 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.15; | ||
| 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 | +} |
flutter-examples/streaming_asr/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
0 → 100644
| 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 = "streaming_asr.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 = "streaming_asr.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 = "streaming_asr.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 = "streaming_asr.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> |
flutter-examples/streaming_asr/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
0 → 100644
| 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 | +} |
flutter-examples/streaming_asr/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
0 → 100644
100.6 KB
flutter-examples/streaming_asr/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
0 → 100644
5.5 KB
flutter-examples/streaming_asr/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
0 → 100644
520 字节
flutter-examples/streaming_asr/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
0 → 100644
13.8 KB
flutter-examples/streaming_asr/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
0 → 100644
1.0 KB
flutter-examples/streaming_asr/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
0 → 100644
35.6 KB
flutter-examples/streaming_asr/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
0 → 100644
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 = streaming_asr | ||
| 9 | + | ||
| 10 | +// The application's bundle identifier | ||
| 11 | +PRODUCT_BUNDLE_IDENTIFIER = com.example.streamingAsr | ||
| 12 | + | ||
| 13 | +// The copyright displayed in application information | ||
| 14 | +PRODUCT_COPYRIGHT = Copyright © 2024 com.example. 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.device.audio-input</key> | ||
| 10 | + <true/> | ||
| 11 | + <key>com.apple.security.network.server</key> | ||
| 12 | + <true/> | ||
| 13 | +</dict> | ||
| 14 | +</plist> |
| 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>NSMicrophoneUsageDescription</key> | ||
| 6 | + <string>Need microphone access for Next-gen kaldi to work</string> | ||
| 7 | + <key>CFBundleDevelopmentRegion</key> | ||
| 8 | + <string>$(DEVELOPMENT_LANGUAGE)</string> | ||
| 9 | + <key>CFBundleExecutable</key> | ||
| 10 | + <string>$(EXECUTABLE_NAME)</string> | ||
| 11 | + <key>CFBundleIconFile</key> | ||
| 12 | + <string></string> | ||
| 13 | + <key>CFBundleIdentifier</key> | ||
| 14 | + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
| 15 | + <key>CFBundleInfoDictionaryVersion</key> | ||
| 16 | + <string>6.0</string> | ||
| 17 | + <key>CFBundleName</key> | ||
| 18 | + <string>$(PRODUCT_NAME)</string> | ||
| 19 | + <key>CFBundlePackageType</key> | ||
| 20 | + <string>APPL</string> | ||
| 21 | + <key>CFBundleShortVersionString</key> | ||
| 22 | + <string>$(FLUTTER_BUILD_NAME)</string> | ||
| 23 | + <key>CFBundleVersion</key> | ||
| 24 | + <string>$(FLUTTER_BUILD_NUMBER)</string> | ||
| 25 | + <key>LSMinimumSystemVersion</key> | ||
| 26 | + <string>$(MACOSX_DEPLOYMENT_TARGET)</string> | ||
| 27 | + <key>NSHumanReadableCopyright</key> | ||
| 28 | + <string>$(PRODUCT_COPYRIGHT)</string> | ||
| 29 | + <key>NSMainNibFile</key> | ||
| 30 | + <string>MainMenu</string> | ||
| 31 | + <key>NSPrincipalClass</key> | ||
| 32 | + <string>NSApplication</string> | ||
| 33 | +</dict> | ||
| 34 | +</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 | +<?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.device.audio-input</key> | ||
| 8 | + <true/> | ||
| 9 | +</dict> | ||
| 10 | +</plist> |
| 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/streaming_asr/pubspec.lock
0 → 100644
| 1 | +# Generated by pub | ||
| 2 | +# See https://dart.dev/tools/pub/glossary#lockfile | ||
| 3 | +packages: | ||
| 4 | + async: | ||
| 5 | + dependency: transitive | ||
| 6 | + description: | ||
| 7 | + name: async | ||
| 8 | + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" | ||
| 9 | + url: "https://pub.dev" | ||
| 10 | + source: hosted | ||
| 11 | + version: "2.11.0" | ||
| 12 | + boolean_selector: | ||
| 13 | + dependency: transitive | ||
| 14 | + description: | ||
| 15 | + name: boolean_selector | ||
| 16 | + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" | ||
| 17 | + url: "https://pub.dev" | ||
| 18 | + source: hosted | ||
| 19 | + version: "2.1.1" | ||
| 20 | + characters: | ||
| 21 | + dependency: transitive | ||
| 22 | + description: | ||
| 23 | + name: characters | ||
| 24 | + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" | ||
| 25 | + url: "https://pub.dev" | ||
| 26 | + source: hosted | ||
| 27 | + version: "1.3.0" | ||
| 28 | + clock: | ||
| 29 | + dependency: transitive | ||
| 30 | + description: | ||
| 31 | + name: clock | ||
| 32 | + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf | ||
| 33 | + url: "https://pub.dev" | ||
| 34 | + source: hosted | ||
| 35 | + version: "1.1.1" | ||
| 36 | + collection: | ||
| 37 | + dependency: transitive | ||
| 38 | + description: | ||
| 39 | + name: collection | ||
| 40 | + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a | ||
| 41 | + url: "https://pub.dev" | ||
| 42 | + source: hosted | ||
| 43 | + version: "1.18.0" | ||
| 44 | + crypto: | ||
| 45 | + dependency: transitive | ||
| 46 | + description: | ||
| 47 | + name: crypto | ||
| 48 | + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab | ||
| 49 | + url: "https://pub.dev" | ||
| 50 | + source: hosted | ||
| 51 | + version: "3.0.3" | ||
| 52 | + cupertino_icons: | ||
| 53 | + dependency: "direct main" | ||
| 54 | + description: | ||
| 55 | + name: cupertino_icons | ||
| 56 | + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 | ||
| 57 | + url: "https://pub.dev" | ||
| 58 | + source: hosted | ||
| 59 | + version: "1.0.8" | ||
| 60 | + fake_async: | ||
| 61 | + dependency: transitive | ||
| 62 | + description: | ||
| 63 | + name: fake_async | ||
| 64 | + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" | ||
| 65 | + url: "https://pub.dev" | ||
| 66 | + source: hosted | ||
| 67 | + version: "1.3.1" | ||
| 68 | + ffi: | ||
| 69 | + dependency: transitive | ||
| 70 | + description: | ||
| 71 | + name: ffi | ||
| 72 | + sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" | ||
| 73 | + url: "https://pub.dev" | ||
| 74 | + source: hosted | ||
| 75 | + version: "2.1.2" | ||
| 76 | + fixnum: | ||
| 77 | + dependency: transitive | ||
| 78 | + description: | ||
| 79 | + name: fixnum | ||
| 80 | + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" | ||
| 81 | + url: "https://pub.dev" | ||
| 82 | + source: hosted | ||
| 83 | + version: "1.1.0" | ||
| 84 | + flutter: | ||
| 85 | + dependency: "direct main" | ||
| 86 | + description: flutter | ||
| 87 | + source: sdk | ||
| 88 | + version: "0.0.0" | ||
| 89 | + flutter_lints: | ||
| 90 | + dependency: "direct dev" | ||
| 91 | + description: | ||
| 92 | + name: flutter_lints | ||
| 93 | + sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" | ||
| 94 | + url: "https://pub.dev" | ||
| 95 | + source: hosted | ||
| 96 | + version: "3.0.2" | ||
| 97 | + flutter_test: | ||
| 98 | + dependency: "direct dev" | ||
| 99 | + description: flutter | ||
| 100 | + source: sdk | ||
| 101 | + version: "0.0.0" | ||
| 102 | + flutter_web_plugins: | ||
| 103 | + dependency: transitive | ||
| 104 | + description: flutter | ||
| 105 | + source: sdk | ||
| 106 | + version: "0.0.0" | ||
| 107 | + leak_tracker: | ||
| 108 | + dependency: transitive | ||
| 109 | + description: | ||
| 110 | + name: leak_tracker | ||
| 111 | + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" | ||
| 112 | + url: "https://pub.dev" | ||
| 113 | + source: hosted | ||
| 114 | + version: "10.0.4" | ||
| 115 | + leak_tracker_flutter_testing: | ||
| 116 | + dependency: transitive | ||
| 117 | + description: | ||
| 118 | + name: leak_tracker_flutter_testing | ||
| 119 | + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" | ||
| 120 | + url: "https://pub.dev" | ||
| 121 | + source: hosted | ||
| 122 | + version: "3.0.3" | ||
| 123 | + leak_tracker_testing: | ||
| 124 | + dependency: transitive | ||
| 125 | + description: | ||
| 126 | + name: leak_tracker_testing | ||
| 127 | + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" | ||
| 128 | + url: "https://pub.dev" | ||
| 129 | + source: hosted | ||
| 130 | + version: "3.0.1" | ||
| 131 | + lints: | ||
| 132 | + dependency: transitive | ||
| 133 | + description: | ||
| 134 | + name: lints | ||
| 135 | + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 | ||
| 136 | + url: "https://pub.dev" | ||
| 137 | + source: hosted | ||
| 138 | + version: "3.0.0" | ||
| 139 | + matcher: | ||
| 140 | + dependency: transitive | ||
| 141 | + description: | ||
| 142 | + name: matcher | ||
| 143 | + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb | ||
| 144 | + url: "https://pub.dev" | ||
| 145 | + source: hosted | ||
| 146 | + version: "0.12.16+1" | ||
| 147 | + material_color_utilities: | ||
| 148 | + dependency: transitive | ||
| 149 | + description: | ||
| 150 | + name: material_color_utilities | ||
| 151 | + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" | ||
| 152 | + url: "https://pub.dev" | ||
| 153 | + source: hosted | ||
| 154 | + version: "0.8.0" | ||
| 155 | + meta: | ||
| 156 | + dependency: transitive | ||
| 157 | + description: | ||
| 158 | + name: meta | ||
| 159 | + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" | ||
| 160 | + url: "https://pub.dev" | ||
| 161 | + source: hosted | ||
| 162 | + version: "1.12.0" | ||
| 163 | + path: | ||
| 164 | + dependency: "direct main" | ||
| 165 | + description: | ||
| 166 | + name: path | ||
| 167 | + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" | ||
| 168 | + url: "https://pub.dev" | ||
| 169 | + source: hosted | ||
| 170 | + version: "1.9.0" | ||
| 171 | + path_provider: | ||
| 172 | + dependency: "direct main" | ||
| 173 | + description: | ||
| 174 | + name: path_provider | ||
| 175 | + sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161 | ||
| 176 | + url: "https://pub.dev" | ||
| 177 | + source: hosted | ||
| 178 | + version: "2.1.3" | ||
| 179 | + path_provider_android: | ||
| 180 | + dependency: transitive | ||
| 181 | + description: | ||
| 182 | + name: path_provider_android | ||
| 183 | + sha256: bca87b0165ffd7cdb9cad8edd22d18d2201e886d9a9f19b4fb3452ea7df3a72a | ||
| 184 | + url: "https://pub.dev" | ||
| 185 | + source: hosted | ||
| 186 | + version: "2.2.6" | ||
| 187 | + path_provider_foundation: | ||
| 188 | + dependency: transitive | ||
| 189 | + description: | ||
| 190 | + name: path_provider_foundation | ||
| 191 | + sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 | ||
| 192 | + url: "https://pub.dev" | ||
| 193 | + source: hosted | ||
| 194 | + version: "2.4.0" | ||
| 195 | + path_provider_linux: | ||
| 196 | + dependency: transitive | ||
| 197 | + description: | ||
| 198 | + name: path_provider_linux | ||
| 199 | + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 | ||
| 200 | + url: "https://pub.dev" | ||
| 201 | + source: hosted | ||
| 202 | + version: "2.2.1" | ||
| 203 | + path_provider_platform_interface: | ||
| 204 | + dependency: transitive | ||
| 205 | + description: | ||
| 206 | + name: path_provider_platform_interface | ||
| 207 | + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" | ||
| 208 | + url: "https://pub.dev" | ||
| 209 | + source: hosted | ||
| 210 | + version: "2.1.2" | ||
| 211 | + path_provider_windows: | ||
| 212 | + dependency: transitive | ||
| 213 | + description: | ||
| 214 | + name: path_provider_windows | ||
| 215 | + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" | ||
| 216 | + url: "https://pub.dev" | ||
| 217 | + source: hosted | ||
| 218 | + version: "2.2.1" | ||
| 219 | + platform: | ||
| 220 | + dependency: transitive | ||
| 221 | + description: | ||
| 222 | + name: platform | ||
| 223 | + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" | ||
| 224 | + url: "https://pub.dev" | ||
| 225 | + source: hosted | ||
| 226 | + version: "3.1.5" | ||
| 227 | + plugin_platform_interface: | ||
| 228 | + dependency: transitive | ||
| 229 | + description: | ||
| 230 | + name: plugin_platform_interface | ||
| 231 | + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" | ||
| 232 | + url: "https://pub.dev" | ||
| 233 | + source: hosted | ||
| 234 | + version: "2.1.8" | ||
| 235 | + record: | ||
| 236 | + dependency: "direct main" | ||
| 237 | + description: | ||
| 238 | + name: record | ||
| 239 | + sha256: "78353d3d55fa145ffe1db1f63232ad0a0cd4c773e9f7d161210ce796ba1c94f9" | ||
| 240 | + url: "https://pub.dev" | ||
| 241 | + source: hosted | ||
| 242 | + version: "5.1.1" | ||
| 243 | + record_android: | ||
| 244 | + dependency: transitive | ||
| 245 | + description: | ||
| 246 | + name: record_android | ||
| 247 | + sha256: fe83beefc8ac81b9dd02ca9365e8685755e3f12be1d442964082f1d5b618183d | ||
| 248 | + url: "https://pub.dev" | ||
| 249 | + source: hosted | ||
| 250 | + version: "1.2.2" | ||
| 251 | + record_darwin: | ||
| 252 | + dependency: transitive | ||
| 253 | + description: | ||
| 254 | + name: record_darwin | ||
| 255 | + sha256: "2210da0fde7c86b4048cccfe2cd19b25fc7adf1ada7d50ec4a5ab4af2a863739" | ||
| 256 | + url: "https://pub.dev" | ||
| 257 | + source: hosted | ||
| 258 | + version: "1.1.0" | ||
| 259 | + record_linux: | ||
| 260 | + dependency: transitive | ||
| 261 | + description: | ||
| 262 | + name: record_linux | ||
| 263 | + sha256: "7d0e70cd51635128fe9d37d89bafd6011d7cbba9af8dc323079ae60f23546aef" | ||
| 264 | + url: "https://pub.dev" | ||
| 265 | + source: hosted | ||
| 266 | + version: "0.7.1" | ||
| 267 | + record_platform_interface: | ||
| 268 | + dependency: transitive | ||
| 269 | + description: | ||
| 270 | + name: record_platform_interface | ||
| 271 | + sha256: "11f8b03ea8a0e279b0e306571dbe0db0202c0b8e866495c9fa1ad2281d5e4c15" | ||
| 272 | + url: "https://pub.dev" | ||
| 273 | + source: hosted | ||
| 274 | + version: "1.1.0" | ||
| 275 | + record_web: | ||
| 276 | + dependency: transitive | ||
| 277 | + description: | ||
| 278 | + name: record_web | ||
| 279 | + sha256: "703adb626d31e2dd86a8f6b34e306e03cd323e0c5e16e11bbc0385b07a8df97e" | ||
| 280 | + url: "https://pub.dev" | ||
| 281 | + source: hosted | ||
| 282 | + version: "1.1.1" | ||
| 283 | + record_windows: | ||
| 284 | + dependency: transitive | ||
| 285 | + description: | ||
| 286 | + name: record_windows | ||
| 287 | + sha256: e653555aa3fda168aded7c34e11bd82baf0c6ac84e7624553def3c77ffefd36f | ||
| 288 | + url: "https://pub.dev" | ||
| 289 | + source: hosted | ||
| 290 | + version: "1.0.3" | ||
| 291 | + sherpa_onnx: | ||
| 292 | + dependency: "direct main" | ||
| 293 | + description: | ||
| 294 | + path: "../../sherpa-onnx/flutter" | ||
| 295 | + relative: true | ||
| 296 | + source: path | ||
| 297 | + version: "1.9.29" | ||
| 298 | + sky_engine: | ||
| 299 | + dependency: transitive | ||
| 300 | + description: flutter | ||
| 301 | + source: sdk | ||
| 302 | + version: "0.0.99" | ||
| 303 | + source_span: | ||
| 304 | + dependency: transitive | ||
| 305 | + description: | ||
| 306 | + name: source_span | ||
| 307 | + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" | ||
| 308 | + url: "https://pub.dev" | ||
| 309 | + source: hosted | ||
| 310 | + version: "1.10.0" | ||
| 311 | + sprintf: | ||
| 312 | + dependency: transitive | ||
| 313 | + description: | ||
| 314 | + name: sprintf | ||
| 315 | + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" | ||
| 316 | + url: "https://pub.dev" | ||
| 317 | + source: hosted | ||
| 318 | + version: "7.0.0" | ||
| 319 | + stack_trace: | ||
| 320 | + dependency: transitive | ||
| 321 | + description: | ||
| 322 | + name: stack_trace | ||
| 323 | + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" | ||
| 324 | + url: "https://pub.dev" | ||
| 325 | + source: hosted | ||
| 326 | + version: "1.11.1" | ||
| 327 | + stream_channel: | ||
| 328 | + dependency: transitive | ||
| 329 | + description: | ||
| 330 | + name: stream_channel | ||
| 331 | + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 | ||
| 332 | + url: "https://pub.dev" | ||
| 333 | + source: hosted | ||
| 334 | + version: "2.1.2" | ||
| 335 | + string_scanner: | ||
| 336 | + dependency: transitive | ||
| 337 | + description: | ||
| 338 | + name: string_scanner | ||
| 339 | + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" | ||
| 340 | + url: "https://pub.dev" | ||
| 341 | + source: hosted | ||
| 342 | + version: "1.2.0" | ||
| 343 | + term_glyph: | ||
| 344 | + dependency: transitive | ||
| 345 | + description: | ||
| 346 | + name: term_glyph | ||
| 347 | + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 | ||
| 348 | + url: "https://pub.dev" | ||
| 349 | + source: hosted | ||
| 350 | + version: "1.2.1" | ||
| 351 | + test_api: | ||
| 352 | + dependency: transitive | ||
| 353 | + description: | ||
| 354 | + name: test_api | ||
| 355 | + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" | ||
| 356 | + url: "https://pub.dev" | ||
| 357 | + source: hosted | ||
| 358 | + version: "0.7.0" | ||
| 359 | + typed_data: | ||
| 360 | + dependency: transitive | ||
| 361 | + description: | ||
| 362 | + name: typed_data | ||
| 363 | + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c | ||
| 364 | + url: "https://pub.dev" | ||
| 365 | + source: hosted | ||
| 366 | + version: "1.3.2" | ||
| 367 | + url_launcher: | ||
| 368 | + dependency: "direct main" | ||
| 369 | + description: | ||
| 370 | + name: url_launcher | ||
| 371 | + sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3" | ||
| 372 | + url: "https://pub.dev" | ||
| 373 | + source: hosted | ||
| 374 | + version: "6.3.0" | ||
| 375 | + url_launcher_android: | ||
| 376 | + dependency: transitive | ||
| 377 | + description: | ||
| 378 | + name: url_launcher_android | ||
| 379 | + sha256: ceb2625f0c24ade6ef6778d1de0b2e44f2db71fded235eb52295247feba8c5cf | ||
| 380 | + url: "https://pub.dev" | ||
| 381 | + source: hosted | ||
| 382 | + version: "6.3.3" | ||
| 383 | + url_launcher_ios: | ||
| 384 | + dependency: transitive | ||
| 385 | + description: | ||
| 386 | + name: url_launcher_ios | ||
| 387 | + sha256: "7068716403343f6ba4969b4173cbf3b84fc768042124bc2c011e5d782b24fe89" | ||
| 388 | + url: "https://pub.dev" | ||
| 389 | + source: hosted | ||
| 390 | + version: "6.3.0" | ||
| 391 | + url_launcher_linux: | ||
| 392 | + dependency: transitive | ||
| 393 | + description: | ||
| 394 | + name: url_launcher_linux | ||
| 395 | + sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 | ||
| 396 | + url: "https://pub.dev" | ||
| 397 | + source: hosted | ||
| 398 | + version: "3.1.1" | ||
| 399 | + url_launcher_macos: | ||
| 400 | + dependency: transitive | ||
| 401 | + description: | ||
| 402 | + name: url_launcher_macos | ||
| 403 | + sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de" | ||
| 404 | + url: "https://pub.dev" | ||
| 405 | + source: hosted | ||
| 406 | + version: "3.2.0" | ||
| 407 | + url_launcher_platform_interface: | ||
| 408 | + dependency: transitive | ||
| 409 | + description: | ||
| 410 | + name: url_launcher_platform_interface | ||
| 411 | + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" | ||
| 412 | + url: "https://pub.dev" | ||
| 413 | + source: hosted | ||
| 414 | + version: "2.3.2" | ||
| 415 | + url_launcher_web: | ||
| 416 | + dependency: transitive | ||
| 417 | + description: | ||
| 418 | + name: url_launcher_web | ||
| 419 | + sha256: "8d9e750d8c9338601e709cd0885f95825086bd8b642547f26bda435aade95d8a" | ||
| 420 | + url: "https://pub.dev" | ||
| 421 | + source: hosted | ||
| 422 | + version: "2.3.1" | ||
| 423 | + url_launcher_windows: | ||
| 424 | + dependency: transitive | ||
| 425 | + description: | ||
| 426 | + name: url_launcher_windows | ||
| 427 | + sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 | ||
| 428 | + url: "https://pub.dev" | ||
| 429 | + source: hosted | ||
| 430 | + version: "3.1.1" | ||
| 431 | + uuid: | ||
| 432 | + dependency: transitive | ||
| 433 | + description: | ||
| 434 | + name: uuid | ||
| 435 | + sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8" | ||
| 436 | + url: "https://pub.dev" | ||
| 437 | + source: hosted | ||
| 438 | + version: "4.4.0" | ||
| 439 | + vector_math: | ||
| 440 | + dependency: transitive | ||
| 441 | + description: | ||
| 442 | + name: vector_math | ||
| 443 | + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" | ||
| 444 | + url: "https://pub.dev" | ||
| 445 | + source: hosted | ||
| 446 | + version: "2.1.4" | ||
| 447 | + vm_service: | ||
| 448 | + dependency: transitive | ||
| 449 | + description: | ||
| 450 | + name: vm_service | ||
| 451 | + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" | ||
| 452 | + url: "https://pub.dev" | ||
| 453 | + source: hosted | ||
| 454 | + version: "14.2.1" | ||
| 455 | + web: | ||
| 456 | + dependency: transitive | ||
| 457 | + description: | ||
| 458 | + name: web | ||
| 459 | + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" | ||
| 460 | + url: "https://pub.dev" | ||
| 461 | + source: hosted | ||
| 462 | + version: "0.5.1" | ||
| 463 | + win32: | ||
| 464 | + dependency: transitive | ||
| 465 | + description: | ||
| 466 | + name: win32 | ||
| 467 | + sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4 | ||
| 468 | + url: "https://pub.dev" | ||
| 469 | + source: hosted | ||
| 470 | + version: "5.5.1" | ||
| 471 | + xdg_directories: | ||
| 472 | + dependency: transitive | ||
| 473 | + description: | ||
| 474 | + name: xdg_directories | ||
| 475 | + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d | ||
| 476 | + url: "https://pub.dev" | ||
| 477 | + source: hosted | ||
| 478 | + version: "1.0.4" | ||
| 479 | +sdks: | ||
| 480 | + dart: ">=3.4.0 <4.0.0" | ||
| 481 | + flutter: ">=3.22.0" |
flutter-examples/streaming_asr/pubspec.yaml
0 → 100644
| 1 | +name: streaming_asr | ||
| 2 | + | ||
| 3 | +description: > | ||
| 4 | + This example shows how to implement real-time speech recognition using sherpa-onnx. | ||
| 5 | + | ||
| 6 | +publish_to: 'none' | ||
| 7 | + | ||
| 8 | +version: 1.10.1 | ||
| 9 | + | ||
| 10 | +topics: | ||
| 11 | + - speech-recognition | ||
| 12 | + | ||
| 13 | +issue_tracker: https://github.com/k2-fsa/sherpa-onnx/issues | ||
| 14 | + | ||
| 15 | +repository: https://github.com/k2-fsa/sherpa-onnx/tree/master/sherpa-onnx/flutter | ||
| 16 | + | ||
| 17 | +environment: | ||
| 18 | + sdk: '>=3.4.0 <4.0.0' | ||
| 19 | + | ||
| 20 | +dependencies: | ||
| 21 | + flutter: | ||
| 22 | + sdk: flutter | ||
| 23 | + | ||
| 24 | + cupertino_icons: ^1.0.6 | ||
| 25 | + | ||
| 26 | + path_provider: ^2.1.3 | ||
| 27 | + path: ^1.9.0 | ||
| 28 | + | ||
| 29 | + # Note: record does not support Linux for streaming ASR | ||
| 30 | + record: ^5.1.0 | ||
| 31 | + url_launcher: ^6.2.6 | ||
| 32 | + | ||
| 33 | + sherpa_onnx: ^1.10.0 | ||
| 34 | + | ||
| 35 | +dev_dependencies: | ||
| 36 | + flutter_test: | ||
| 37 | + sdk: flutter | ||
| 38 | + | ||
| 39 | + flutter_lints: ^3.0.0 | ||
| 40 | + | ||
| 41 | +flutter: | ||
| 42 | + uses-material-design: true | ||
| 43 | + | ||
| 44 | + assets: | ||
| 45 | + - assets/ | ||
| 46 | + # - assets/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/ |
| 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:streaming_asr/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 | +} |
| 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/ |
| 1 | +# Project-level configuration. | ||
| 2 | +cmake_minimum_required(VERSION 3.14) | ||
| 3 | +project(streaming_asr 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 "streaming_asr") | ||
| 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 | +// | ||
| 2 | +// Generated file. Do not edit. | ||
| 3 | +// | ||
| 4 | + | ||
| 5 | +// clang-format off | ||
| 6 | + | ||
| 7 | +#include "generated_plugin_registrant.h" | ||
| 8 | + | ||
| 9 | +#include <record_windows/record_windows_plugin_c_api.h> | ||
| 10 | +#include <url_launcher_windows/url_launcher_windows.h> | ||
| 11 | + | ||
| 12 | +void RegisterPlugins(flutter::PluginRegistry* registry) { | ||
| 13 | + RecordWindowsPluginCApiRegisterWithRegistrar( | ||
| 14 | + registry->GetRegistrarForPlugin("RecordWindowsPluginCApi")); | ||
| 15 | + UrlLauncherWindowsRegisterWithRegistrar( | ||
| 16 | + registry->GetRegistrarForPlugin("UrlLauncherWindows")); | ||
| 17 | +} |
| 1 | +// | ||
| 2 | +// Generated file. Do not edit. | ||
| 3 | +// | ||
| 4 | + | ||
| 5 | +// clang-format off | ||
| 6 | + | ||
| 7 | +#ifndef GENERATED_PLUGIN_REGISTRANT_ | ||
| 8 | +#define GENERATED_PLUGIN_REGISTRANT_ | ||
| 9 | + | ||
| 10 | +#include <flutter/plugin_registry.h> | ||
| 11 | + | ||
| 12 | +// Registers Flutter plugins. | ||
| 13 | +void RegisterPlugins(flutter::PluginRegistry* registry); | ||
| 14 | + | ||
| 15 | +#endif // GENERATED_PLUGIN_REGISTRANT_ |
| 1 | +# | ||
| 2 | +# Generated file, do not edit. | ||
| 3 | +# | ||
| 4 | + | ||
| 5 | +list(APPEND FLUTTER_PLUGIN_LIST | ||
| 6 | + record_windows | ||
| 7 | + url_launcher_windows | ||
| 8 | +) | ||
| 9 | + | ||
| 10 | +list(APPEND FLUTTER_FFI_PLUGIN_LIST | ||
| 11 | + sherpa_onnx | ||
| 12 | +) | ||
| 13 | + | ||
| 14 | +set(PLUGIN_BUNDLED_LIBRARIES) | ||
| 15 | + | ||
| 16 | +foreach(plugin ${FLUTTER_PLUGIN_LIST}) | ||
| 17 | + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) | ||
| 18 | + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) | ||
| 19 | + list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) | ||
| 20 | + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) | ||
| 21 | +endforeach(plugin) | ||
| 22 | + | ||
| 23 | +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) | ||
| 24 | + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) | ||
| 25 | + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) | ||
| 26 | +endforeach(ffi_plugin) |
| 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", "streaming_asr" "\0" | ||
| 94 | + VALUE "FileVersion", VERSION_AS_STRING "\0" | ||
| 95 | + VALUE "InternalName", "streaming_asr" "\0" | ||
| 96 | + VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" | ||
| 97 | + VALUE "OriginalFilename", "streaming_asr.exe" "\0" | ||
| 98 | + VALUE "ProductName", "streaming_asr" "\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_ |
| 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"streaming_asr", 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 | +} |
| 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/.gitignore
0 → 100644
| 1 | +!*.sh.in |
| 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 model in model_list %} | ||
| 25 | +pushd $SHERPA_ONNX_DIR/flutter-examples/streaming_asr/ | ||
| 26 | +model_name={{ model.model_name }} | ||
| 27 | +lang={{ model.lang }} | ||
| 28 | +type={{ model.idx }} | ||
| 29 | +short_name={{ model.short_name }} | ||
| 30 | + | ||
| 31 | +pushd assets | ||
| 32 | + | ||
| 33 | +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/${model_name}.tar.bz2 | ||
| 34 | +tar xvf ${model_name}.tar.bz2 | ||
| 35 | + | ||
| 36 | +{{ model.cmd }} | ||
| 37 | + | ||
| 38 | +rm -rf *.tar.bz2 | ||
| 39 | +ls -lh $model_name | ||
| 40 | + | ||
| 41 | +popd | ||
| 42 | + | ||
| 43 | +git checkout ./ | ||
| 44 | +sed -i.bak "s| - assets/$| - assets/\n - assets/$model_name/|g" ./pubspec.yaml | ||
| 45 | + | ||
| 46 | +sed -i.bak "s/final type = .*;$/final type = $type;/g" ./lib/streaming_asr.dart | ||
| 47 | + | ||
| 48 | +{% if model.rule_fsts %} | ||
| 49 | + rule_fsts={{ model.rule_fsts }} | ||
| 50 | + sed -i.bak "s|ruleFsts: ''|ruleFsts: await copyAssetFile(\'assets/$rule_fsts\')|g" ./lib/streaming_asr.dart | ||
| 51 | +{% endif %} | ||
| 52 | + | ||
| 53 | +git diff . | ||
| 54 | + | ||
| 55 | +flutter pub get | ||
| 56 | + | ||
| 57 | +export FLUTTER_XCODE_ARCHS=$arch | ||
| 58 | +log "FLUTTER_XCODE_ARCHS: $FLUTTER_XCODE_ARCHS" | ||
| 59 | + | ||
| 60 | +flutter build macos | ||
| 61 | + | ||
| 62 | +pushd build/macos/Build/Products/Release/ | ||
| 63 | +ls -lh | ||
| 64 | + | ||
| 65 | +app=sherpa-onnx-$SHERPA_ONNX_VERSION-osx-$arch-asr-$lang-$short_name.app | ||
| 66 | +mv streaming_asr.app $app | ||
| 67 | +tar cjfv $app.tar.bz2 $app | ||
| 68 | +ls -lh | ||
| 69 | +mv $app.tar.bz2 $SHERPA_ONNX_DIR | ||
| 70 | +popd | ||
| 71 | + | ||
| 72 | +popd | ||
| 73 | + | ||
| 74 | +{% endfor %} |
| 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 model in model_list %} | ||
| 19 | +pushd $SHERPA_ONNX_DIR/flutter-examples/streaming_asr/ | ||
| 20 | +model_name={{ model.model_name }} | ||
| 21 | +lang={{ model.lang }} | ||
| 22 | +type={{ model.idx }} | ||
| 23 | +short_name={{ model.short_name }} | ||
| 24 | + | ||
| 25 | +pushd assets | ||
| 26 | + | ||
| 27 | +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/${model_name}.tar.bz2 | ||
| 28 | +tar xvf ${model_name}.tar.bz2 | ||
| 29 | + | ||
| 30 | +{{ model.cmd }} | ||
| 31 | + | ||
| 32 | +rm -rf *.tar.bz2 | ||
| 33 | +ls -lh $model_name | ||
| 34 | + | ||
| 35 | +popd | ||
| 36 | + | ||
| 37 | +git checkout ./ | ||
| 38 | +sed -i.bak "s| - assets/$| - assets/\n - assets/$model_name/|g" ./pubspec.yaml | ||
| 39 | + | ||
| 40 | +sed -i.bak "s/final type = .*;$/final type = $type;/g" ./lib/streaming_asr.dart | ||
| 41 | + | ||
| 42 | +{% if model.rule_fsts %} | ||
| 43 | + rule_fsts={{ model.rule_fsts }} | ||
| 44 | + sed -i.bak "s|ruleFsts: ''|ruleFsts: await copyAssetFile(\'assets/$rule_fsts\')|g" ./lib/streaming_asr.dart | ||
| 45 | +{% endif %} | ||
| 46 | + | ||
| 47 | +git diff . | ||
| 48 | + | ||
| 49 | +flutter pub get | ||
| 50 | + | ||
| 51 | +flutter build windows | ||
| 52 | + | ||
| 53 | +pushd build/windows/x64/runner/ | ||
| 54 | +ls -lh | ||
| 55 | + | ||
| 56 | +dst=sherpa-onnx-$SHERPA_ONNX_VERSION-win-x64-asr-$lang-$short_name | ||
| 57 | +mv Release $dst | ||
| 58 | +tar cjfv $dst.tar.bz2 ./$dst | ||
| 59 | +mv $dst.tar.bz2 $SHERPA_ONNX_DIR | ||
| 60 | + | ||
| 61 | +popd | ||
| 62 | + | ||
| 63 | +popd | ||
| 64 | + | ||
| 65 | +{% endfor %} |
scripts/flutter/generate-streaming-asr.py
0 → 100755
| 1 | +#!/usr/bin/env python3 | ||
| 2 | + | ||
| 3 | +import argparse | ||
| 4 | +from dataclasses import dataclass | ||
| 5 | +import jinja2 | ||
| 6 | + | ||
| 7 | + | ||
| 8 | +def get_args(): | ||
| 9 | + parser = argparse.ArgumentParser() | ||
| 10 | + parser.add_argument( | ||
| 11 | + "--total", | ||
| 12 | + type=int, | ||
| 13 | + default=1, | ||
| 14 | + help="Number of runners", | ||
| 15 | + ) | ||
| 16 | + parser.add_argument( | ||
| 17 | + "--index", | ||
| 18 | + type=int, | ||
| 19 | + default=0, | ||
| 20 | + help="Index of the current runner", | ||
| 21 | + ) | ||
| 22 | + | ||
| 23 | + return parser.parse_args() | ||
| 24 | + | ||
| 25 | + | ||
| 26 | +@dataclass | ||
| 27 | +class Model: | ||
| 28 | + # We will download | ||
| 29 | + # https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/{model_name}.tar.bz2 | ||
| 30 | + model_name: str | ||
| 31 | + | ||
| 32 | + # The type of the model, e..g, 0, 1, 2. It is hardcoded in the flutter code | ||
| 33 | + # See flutter-example/streaming_asr/lib/online_model.dart | ||
| 34 | + idx: int | ||
| 35 | + | ||
| 36 | + # e.g., zh, en, zh_en | ||
| 37 | + lang: str | ||
| 38 | + | ||
| 39 | + # e.g., whisper, paraformer, zipformer | ||
| 40 | + short_name: str = "" | ||
| 41 | + | ||
| 42 | + # cmd is used to remove extra files from the model directory | ||
| 43 | + cmd: str = "" | ||
| 44 | + | ||
| 45 | + rule_fsts: str = "" | ||
| 46 | + | ||
| 47 | + | ||
| 48 | +def get_models(): | ||
| 49 | + models = [ | ||
| 50 | + Model( | ||
| 51 | + model_name="sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20", | ||
| 52 | + idx=0, | ||
| 53 | + lang="bilingual_zh_en", | ||
| 54 | + short_name="zipformer", | ||
| 55 | + rule_fsts="itn_zh_number.fst", | ||
| 56 | + cmd=""" | ||
| 57 | + if [ ! -f itn_zh_number.fst ]; then | ||
| 58 | + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn_zh_number.fst | ||
| 59 | + fi | ||
| 60 | + pushd $model_name | ||
| 61 | + rm -fv encoder-epoch-99-avg-1.onnx | ||
| 62 | + rm -fv decoder-epoch-99-avg-1.int8.onnx | ||
| 63 | + rm -fv joiner-epoch-99-avg-1.int8.onnx | ||
| 64 | + | ||
| 65 | + rm -fv *.sh | ||
| 66 | + rm -fv bpe.model | ||
| 67 | + rm -fv README.md | ||
| 68 | + rm -fv .gitattributes | ||
| 69 | + rm -fv *state* | ||
| 70 | + rm -rfv test_wavs | ||
| 71 | + | ||
| 72 | + ls -lh | ||
| 73 | + | ||
| 74 | + popd | ||
| 75 | + """, | ||
| 76 | + ), | ||
| 77 | + Model( | ||
| 78 | + model_name="sherpa-onnx-streaming-zipformer-en-2023-06-26", | ||
| 79 | + idx=1, | ||
| 80 | + lang="en", | ||
| 81 | + short_name="zipformer2", | ||
| 82 | + cmd=""" | ||
| 83 | + pushd $model_name | ||
| 84 | + rm -fv encoder-epoch-99-avg-1-chunk-16-left-128.onnx | ||
| 85 | + rm -fv decoder-epoch-99-avg-1-chunk-16-left-128.int8.onnx | ||
| 86 | + rm -fv joiner-epoch-99-avg-1-chunk-16-left-128.int8.onnx | ||
| 87 | + | ||
| 88 | + rm -fv README.md | ||
| 89 | + rm -fv bpe.model | ||
| 90 | + rm -rfv test_wavs | ||
| 91 | + | ||
| 92 | + ls -lh | ||
| 93 | + | ||
| 94 | + popd | ||
| 95 | + """, | ||
| 96 | + ), | ||
| 97 | + Model( | ||
| 98 | + model_name="icefall-asr-zipformer-streaming-wenetspeech-20230615", | ||
| 99 | + idx=2, | ||
| 100 | + lang="zh", | ||
| 101 | + short_name="zipformer2", | ||
| 102 | + rule_fsts="itn_zh_number.fst", | ||
| 103 | + cmd=""" | ||
| 104 | + if [ ! -f itn_zh_number.fst ]; then | ||
| 105 | + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn_zh_number.fst | ||
| 106 | + fi | ||
| 107 | + pushd $model_name | ||
| 108 | + rm -fv exp/encoder-epoch-12-avg-4-chunk-16-left-128.onnx | ||
| 109 | + rm -fv exp/decoder-epoch-12-avg-4-chunk-16-left-128.int8.onnx | ||
| 110 | + rm -fv exp/joiner-epoch-12-avg-4-chunk-16-left-128.int8.onnx | ||
| 111 | + | ||
| 112 | + rm -fv data/lang_char/lexicon.txt | ||
| 113 | + rm -fv data/lang_char/words.txt | ||
| 114 | + rm -rfv test_wavs | ||
| 115 | + rm -fv README.md | ||
| 116 | + | ||
| 117 | + ls -lh exp/ | ||
| 118 | + ls -lh data/lang_char | ||
| 119 | + | ||
| 120 | + popd | ||
| 121 | + """, | ||
| 122 | + ), | ||
| 123 | + Model( | ||
| 124 | + model_name="sherpa-onnx-streaming-zipformer-fr-2023-04-14", | ||
| 125 | + idx=3, | ||
| 126 | + lang="fr", | ||
| 127 | + short_name="zipformer", | ||
| 128 | + cmd=""" | ||
| 129 | + pushd $model_name | ||
| 130 | + rm -fv encoder-epoch-29-avg-9-with-averaged-model.onnx | ||
| 131 | + rm -fv decoder-epoch-29-avg-9-with-averaged-model.int8.onnx | ||
| 132 | + rm -fv joiner-epoch-29-avg-9-with-averaged-model.int8.onnx | ||
| 133 | + | ||
| 134 | + rm -fv *.sh | ||
| 135 | + rm -rfv test_wavs | ||
| 136 | + rm README.md | ||
| 137 | + | ||
| 138 | + ls -lh | ||
| 139 | + | ||
| 140 | + popd | ||
| 141 | + """, | ||
| 142 | + ), | ||
| 143 | + ] | ||
| 144 | + | ||
| 145 | + return models | ||
| 146 | + | ||
| 147 | + | ||
| 148 | +def main(): | ||
| 149 | + args = get_args() | ||
| 150 | + | ||
| 151 | + index = args.index | ||
| 152 | + total = args.total | ||
| 153 | + assert 0 <= index < total, (index, total) | ||
| 154 | + | ||
| 155 | + all_model_list = get_models() | ||
| 156 | + | ||
| 157 | + num_models = len(all_model_list) | ||
| 158 | + | ||
| 159 | + num_per_runner = num_models // total | ||
| 160 | + if num_per_runner <= 0: | ||
| 161 | + raise ValueError(f"num_models: {num_models}, num_runners: {total}") | ||
| 162 | + | ||
| 163 | + start = index * num_per_runner | ||
| 164 | + end = start + num_per_runner | ||
| 165 | + | ||
| 166 | + remaining = num_models - args.total * num_per_runner | ||
| 167 | + | ||
| 168 | + print(f"{index}/{total}: {start}-{end}/{num_models}") | ||
| 169 | + | ||
| 170 | + d = dict() | ||
| 171 | + d["model_list"] = all_model_list[start:end] | ||
| 172 | + if index < remaining: | ||
| 173 | + s = args.total * num_per_runner + index | ||
| 174 | + d["model_list"].append(all_model_list[s]) | ||
| 175 | + print(f"{s}/{num_models}") | ||
| 176 | + | ||
| 177 | + filename_list = [ | ||
| 178 | + "./build-macos-streaming-asr.sh", | ||
| 179 | + "./build-windows-streaming-asr.sh", | ||
| 180 | + ] | ||
| 181 | + for filename in filename_list: | ||
| 182 | + environment = jinja2.Environment() | ||
| 183 | + with open(f"{filename}.in") as f: | ||
| 184 | + s = f.read() | ||
| 185 | + template = environment.from_string(s) | ||
| 186 | + | ||
| 187 | + s = template.render(**d) | ||
| 188 | + with open(filename, "w") as f: | ||
| 189 | + print(s, file=f) | ||
| 190 | + | ||
| 191 | + | ||
| 192 | +if __name__ == "__main__": | ||
| 193 | + main() |
-
请 注册 或 登录 后发表评论