Fangjun Kuang
Committed by GitHub

Add Flutter example for speaker identification (#894)

正在显示 46 个修改的文件 包含 3317 行增加0 行删除
  1 +name: flutter
  2 +
  3 +on:
  4 + push:
  5 + branches:
  6 + - flutter
  7 + - flutter-sid-2
  8 + tags:
  9 + - '*'
  10 + paths:
  11 + - '.github/workflows/flutter.yaml'
  12 + - 'CMakeLists.txt'
  13 + - 'cmake/**'
  14 + - 'sherpa-onnx/csrc/*'
  15 + - 'sherpa-onnx/c-api/*'
  16 + - 'sherpa-onnx/flutter/**'
  17 + pull_request:
  18 + branches:
  19 + - master
  20 + paths:
  21 + - '.github/workflows/flutter.yaml'
  22 + - 'CMakeLists.txt'
  23 + - 'cmake/**'
  24 + - 'sherpa-onnx/csrc/*'
  25 + - 'sherpa-onnx/c-api/*'
  26 + - 'sherpa-onnx/flutter/**'
  27 +
  28 + workflow_dispatch:
  29 +
  30 +concurrency:
  31 + group: flutter-${{ github.ref }}
  32 + cancel-in-progress: true
  33 +
  34 +jobs:
  35 + flutter:
  36 + name: flutter
  37 + runs-on: ${{ matrix.os }}
  38 + strategy:
  39 + fail-fast: false
  40 + matrix:
  41 + os: [macos-latest]
  42 +
  43 + steps:
  44 + - uses: actions/checkout@v4
  45 + with:
  46 + fetch-depth: 0
  47 +
  48 + - name: Setup Flutter SDK
  49 + uses: flutter-actions/setup-flutter@v3
  50 + with:
  51 + channel: stable
  52 + version: latest
  53 +
  54 + - name: ccache
  55 + uses: hendrikmuhs/ccache-action@v1.2
  56 + with:
  57 + key: ${{ matrix.os }}-flutter
  58 +
  59 + - name: Display PWD
  60 + shell: bash
  61 + run: |
  62 + echo "pwd: $PWD"
  63 + ls -lh
  64 +
  65 + - name: Display machine info
  66 + shell: bash
  67 + run: |
  68 + uname -a
  69 +
  70 + - name: Display flutter info
  71 + shell: bash
  72 + run: |
  73 + which flutter
  74 + which dart
  75 +
  76 + flutter --version
  77 + dart --version
  78 + flutter doctor
  79 +
  80 + - name: Configure CMake
  81 + shell: bash
  82 + run: |
  83 + export CMAKE_CXX_COMPILER_LAUNCHER=ccache
  84 + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
  85 + cmake --version
  86 +
  87 + mkdir build
  88 + cd build
  89 +
  90 + cmake \
  91 + -D BUILD_SHARED_LIBS=ON \
  92 + -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' \
  93 + -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \
  94 + -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \
  95 + -DSHERPA_ONNX_ENABLE_BINARY=ON \
  96 + -DCMAKE_INSTALL_PREFIX=./install \
  97 + ..
  98 +
  99 + - name: Build sherpa-onnx for macos
  100 + shell: bash
  101 + run: |
  102 + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
  103 +
  104 + cd build
  105 + make -j2
  106 + make install
  107 +
  108 + rm -v ./install/lib/libcargs*
  109 +
  110 + - name: Copy libs
  111 + shell: bash
  112 + run: |
  113 + cp -v build/install/lib/lib* ./sherpa-onnx/flutter/macos/
  114 +
  115 + echo "--------------------"
  116 +
  117 + ls -lh ./sherpa-onnx/flutter/macos/
  118 +
  119 + - name: Download model files
  120 + shell: bash
  121 + run: |
  122 + cd sherpa-onnx/flutter
  123 + pushd example/assets
  124 +
  125 + 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
  126 + git clone https://github.com/csukuangfj/sr-data
  127 +
  128 + rm -rf sr-data/.git
  129 + popd
  130 +
  131 +
  132 + - name: Build flutter
  133 + shell: bash
  134 + run: |
  135 + d=$PWD
  136 +
  137 + pushd sherpa-onnx/flutter
  138 + dart pub get
  139 +
  140 + cd example
  141 + flutter build macos
  142 +
  143 + pushd build/macos/Build/Products/Release/
  144 + tar cjfv sherpa_onnx.app.tar.bz2 ./sherpa_onnx.app
  145 + ls -lh
  146 + mv sherpa_onnx.app.tar.bz2 $d
  147 + popd
  148 +
  149 + popd
  150 +
  151 + ls -lh sherpa_onnx.app.tar.bz2
  152 +
  153 + - uses: actions/upload-artifact@v4
  154 + if: matrix.os == 'macos-latest'
  155 + with:
  156 + name: flutter-sherpa-onnx-app-macos
  157 + path: ./sherpa_onnx.app.tar.bz2
1 cmake_minimum_required(VERSION 3.13 FATAL_ERROR) 1 cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
  2 +
  3 +set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14" CACHE STRING "Minimum OS X deployment version. Used only for macOS")
  4 +
2 project(sherpa-onnx) 5 project(sherpa-onnx)
3 6
4 set(SHERPA_ONNX_VERSION "1.9.25") 7 set(SHERPA_ONNX_VERSION "1.9.25")
  1 +# Do not remove or rename entries in this file, only add new ones
  2 +# See https://github.com/flutter/flutter/issues/128635 for more context.
  3 +
  4 +# Miscellaneous
  5 +*.class
  6 +*.lock
  7 +*.log
  8 +*.pyc
  9 +*.swp
  10 +.DS_Store
  11 +.atom/
  12 +.buildlog/
  13 +.history
  14 +.svn/
  15 +
  16 +# IntelliJ related
  17 +*.iml
  18 +*.ipr
  19 +*.iws
  20 +.idea/
  21 +
  22 +# Visual Studio Code related
  23 +.classpath
  24 +.project
  25 +.settings/
  26 +.vscode/*
  27 +
  28 +# Flutter repo-specific
  29 +/bin/cache/
  30 +/bin/internal/bootstrap.bat
  31 +/bin/internal/bootstrap.sh
  32 +/bin/mingit/
  33 +/dev/benchmarks/mega_gallery/
  34 +/dev/bots/.recipe_deps
  35 +/dev/bots/android_tools/
  36 +/dev/devicelab/ABresults*.json
  37 +/dev/docs/doc/
  38 +/dev/docs/api_docs.zip
  39 +/dev/docs/flutter.docs.zip
  40 +/dev/docs/lib/
  41 +/dev/docs/pubspec.yaml
  42 +/dev/integration_tests/**/xcuserdata
  43 +/dev/integration_tests/**/Pods
  44 +/packages/flutter/coverage/
  45 +version
  46 +analysis_benchmark.json
  47 +
  48 +# packages file containing multi-root paths
  49 +.packages.generated
  50 +
  51 +# Flutter/Dart/Pub related
  52 +**/doc/api/
  53 +.dart_tool/
  54 +.flutter-plugins
  55 +.flutter-plugins-dependencies
  56 +**/generated_plugin_registrant.dart
  57 +.packages
  58 +.pub-preload-cache/
  59 +.pub-cache/
  60 +.pub/
  61 +build/
  62 +flutter_*.png
  63 +linked_*.ds
  64 +unlinked.ds
  65 +unlinked_spec.ds
  66 +
  67 +# Android related
  68 +**/android/**/gradle-wrapper.jar
  69 +.gradle/
  70 +**/android/captures/
  71 +**/android/gradlew
  72 +**/android/gradlew.bat
  73 +**/android/local.properties
  74 +**/android/**/GeneratedPluginRegistrant.java
  75 +**/android/key.properties
  76 +*.jks
  77 +
  78 +# iOS/XCode related
  79 +**/ios/**/*.mode1v3
  80 +**/ios/**/*.mode2v3
  81 +**/ios/**/*.moved-aside
  82 +**/ios/**/*.pbxuser
  83 +**/ios/**/*.perspectivev3
  84 +**/ios/**/*sync/
  85 +**/ios/**/.sconsign.dblite
  86 +**/ios/**/.tags*
  87 +**/ios/**/.vagrant/
  88 +**/ios/**/DerivedData/
  89 +**/ios/**/Icon?
  90 +**/ios/**/Pods/
  91 +**/ios/**/.symlinks/
  92 +**/ios/**/profile
  93 +**/ios/**/xcuserdata
  94 +**/ios/.generated/
  95 +**/ios/Flutter/.last_build_id
  96 +**/ios/Flutter/App.framework
  97 +**/ios/Flutter/Flutter.framework
  98 +**/ios/Flutter/Flutter.podspec
  99 +**/ios/Flutter/Generated.xcconfig
  100 +**/ios/Flutter/ephemeral
  101 +**/ios/Flutter/app.flx
  102 +**/ios/Flutter/app.zip
  103 +**/ios/Flutter/flutter_assets/
  104 +**/ios/Flutter/flutter_export_environment.sh
  105 +**/ios/ServiceDefinitions.json
  106 +**/ios/Runner/GeneratedPluginRegistrant.*
  107 +
  108 +# macOS
  109 +**/Flutter/ephemeral/
  110 +**/Pods/
  111 +**/macos/Flutter/GeneratedPluginRegistrant.swift
  112 +**/macos/Flutter/ephemeral
  113 +**/xcuserdata/
  114 +
  115 +# Windows
  116 +**/windows/flutter/generated_plugin_registrant.cc
  117 +**/windows/flutter/generated_plugin_registrant.h
  118 +**/windows/flutter/generated_plugins.cmake
  119 +
  120 +# Linux
  121 +**/linux/flutter/generated_plugin_registrant.cc
  122 +**/linux/flutter/generated_plugin_registrant.h
  123 +**/linux/flutter/generated_plugins.cmake
  124 +
  125 +# Coverage
  126 +coverage/
  127 +
  128 +# Symbols
  129 +app.*.symbols
  130 +
  131 +# Exceptions to above rules.
  132 +!**/ios/**/default.mode1v3
  133 +!**/ios/**/default.mode2v3
  134 +!**/ios/**/default.pbxuser
  135 +!**/ios/**/default.perspectivev3
  136 +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
  137 +!/dev/ci/**/Gemfile.lock
  138 +!.vscode/settings.json
  139 +
  140 +## User settings
  141 +xcuserdata/
  142 +
  143 +## Xcode 8 and earlier
  144 +*.xcscmblueprint
  145 +*.xccheckout
  1 +
  2 + Apache License
  3 + Version 2.0, January 2004
  4 + http://www.apache.org/licenses/
  5 +
  6 + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
  7 +
  8 + 1. Definitions.
  9 +
  10 + "License" shall mean the terms and conditions for use, reproduction,
  11 + and distribution as defined by Sections 1 through 9 of this document.
  12 +
  13 + "Licensor" shall mean the copyright owner or entity authorized by
  14 + the copyright owner that is granting the License.
  15 +
  16 + "Legal Entity" shall mean the union of the acting entity and all
  17 + other entities that control, are controlled by, or are under common
  18 + control with that entity. For the purposes of this definition,
  19 + "control" means (i) the power, direct or indirect, to cause the
  20 + direction or management of such entity, whether by contract or
  21 + otherwise, or (ii) ownership of fifty percent (50%) or more of the
  22 + outstanding shares, or (iii) beneficial ownership of such entity.
  23 +
  24 + "You" (or "Your") shall mean an individual or Legal Entity
  25 + exercising permissions granted by this License.
  26 +
  27 + "Source" form shall mean the preferred form for making modifications,
  28 + including but not limited to software source code, documentation
  29 + source, and configuration files.
  30 +
  31 + "Object" form shall mean any form resulting from mechanical
  32 + transformation or translation of a Source form, including but
  33 + not limited to compiled object code, generated documentation,
  34 + and conversions to other media types.
  35 +
  36 + "Work" shall mean the work of authorship, whether in Source or
  37 + Object form, made available under the License, as indicated by a
  38 + copyright notice that is included in or attached to the work
  39 + (an example is provided in the Appendix below).
  40 +
  41 + "Derivative Works" shall mean any work, whether in Source or Object
  42 + form, that is based on (or derived from) the Work and for which the
  43 + editorial revisions, annotations, elaborations, or other modifications
  44 + represent, as a whole, an original work of authorship. For the purposes
  45 + of this License, Derivative Works shall not include works that remain
  46 + separable from, or merely link (or bind by name) to the interfaces of,
  47 + the Work and Derivative Works thereof.
  48 +
  49 + "Contribution" shall mean any work of authorship, including
  50 + the original version of the Work and any modifications or additions
  51 + to that Work or Derivative Works thereof, that is intentionally
  52 + submitted to Licensor for inclusion in the Work by the copyright owner
  53 + or by an individual or Legal Entity authorized to submit on behalf of
  54 + the copyright owner. For the purposes of this definition, "submitted"
  55 + means any form of electronic, verbal, or written communication sent
  56 + to the Licensor or its representatives, including but not limited to
  57 + communication on electronic mailing lists, source code control systems,
  58 + and issue tracking systems that are managed by, or on behalf of, the
  59 + Licensor for the purpose of discussing and improving the Work, but
  60 + excluding communication that is conspicuously marked or otherwise
  61 + designated in writing by the copyright owner as "Not a Contribution."
  62 +
  63 + "Contributor" shall mean Licensor and any individual or Legal Entity
  64 + on behalf of whom a Contribution has been received by Licensor and
  65 + subsequently incorporated within the Work.
  66 +
  67 + 2. Grant of Copyright License. Subject to the terms and conditions of
  68 + this License, each Contributor hereby grants to You a perpetual,
  69 + worldwide, non-exclusive, no-charge, royalty-free, irrevocable
  70 + copyright license to reproduce, prepare Derivative Works of,
  71 + publicly display, publicly perform, sublicense, and distribute the
  72 + Work and such Derivative Works in Source or Object form.
  73 +
  74 + 3. Grant of Patent License. Subject to the terms and conditions of
  75 + this License, each Contributor hereby grants to You a perpetual,
  76 + worldwide, non-exclusive, no-charge, royalty-free, irrevocable
  77 + (except as stated in this section) patent license to make, have made,
  78 + use, offer to sell, sell, import, and otherwise transfer the Work,
  79 + where such license applies only to those patent claims licensable
  80 + by such Contributor that are necessarily infringed by their
  81 + Contribution(s) alone or by combination of their Contribution(s)
  82 + with the Work to which such Contribution(s) was submitted. If You
  83 + institute patent litigation against any entity (including a
  84 + cross-claim or counterclaim in a lawsuit) alleging that the Work
  85 + or a Contribution incorporated within the Work constitutes direct
  86 + or contributory patent infringement, then any patent licenses
  87 + granted to You under this License for that Work shall terminate
  88 + as of the date such litigation is filed.
  89 +
  90 + 4. Redistribution. You may reproduce and distribute copies of the
  91 + Work or Derivative Works thereof in any medium, with or without
  92 + modifications, and in Source or Object form, provided that You
  93 + meet the following conditions:
  94 +
  95 + (a) You must give any other recipients of the Work or
  96 + Derivative Works a copy of this License; and
  97 +
  98 + (b) You must cause any modified files to carry prominent notices
  99 + stating that You changed the files; and
  100 +
  101 + (c) You must retain, in the Source form of any Derivative Works
  102 + that You distribute, all copyright, patent, trademark, and
  103 + attribution notices from the Source form of the Work,
  104 + excluding those notices that do not pertain to any part of
  105 + the Derivative Works; and
  106 +
  107 + (d) If the Work includes a "NOTICE" text file as part of its
  108 + distribution, then any Derivative Works that You distribute must
  109 + include a readable copy of the attribution notices contained
  110 + within such NOTICE file, excluding those notices that do not
  111 + pertain to any part of the Derivative Works, in at least one
  112 + of the following places: within a NOTICE text file distributed
  113 + as part of the Derivative Works; within the Source form or
  114 + documentation, if provided along with the Derivative Works; or,
  115 + within a display generated by the Derivative Works, if and
  116 + wherever such third-party notices normally appear. The contents
  117 + of the NOTICE file are for informational purposes only and
  118 + do not modify the License. You may add Your own attribution
  119 + notices within Derivative Works that You distribute, alongside
  120 + or as an addendum to the NOTICE text from the Work, provided
  121 + that such additional attribution notices cannot be construed
  122 + as modifying the License.
  123 +
  124 + You may add Your own copyright statement to Your modifications and
  125 + may provide additional or different license terms and conditions
  126 + for use, reproduction, or distribution of Your modifications, or
  127 + for any such Derivative Works as a whole, provided Your use,
  128 + reproduction, and distribution of the Work otherwise complies with
  129 + the conditions stated in this License.
  130 +
  131 + 5. Submission of Contributions. Unless You explicitly state otherwise,
  132 + any Contribution intentionally submitted for inclusion in the Work
  133 + by You to the Licensor shall be under the terms and conditions of
  134 + this License, without any additional terms or conditions.
  135 + Notwithstanding the above, nothing herein shall supersede or modify
  136 + the terms of any separate license agreement you may have executed
  137 + with Licensor regarding such Contributions.
  138 +
  139 + 6. Trademarks. This License does not grant permission to use the trade
  140 + names, trademarks, service marks, or product names of the Licensor,
  141 + except as required for reasonable and customary use in describing the
  142 + origin of the Work and reproducing the content of the NOTICE file.
  143 +
  144 + 7. Disclaimer of Warranty. Unless required by applicable law or
  145 + agreed to in writing, Licensor provides the Work (and each
  146 + Contributor provides its Contributions) on an "AS IS" BASIS,
  147 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  148 + implied, including, without limitation, any warranties or conditions
  149 + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
  150 + PARTICULAR PURPOSE. You are solely responsible for determining the
  151 + appropriateness of using or redistributing the Work and assume any
  152 + risks associated with Your exercise of permissions under this License.
  153 +
  154 + 8. Limitation of Liability. In no event and under no legal theory,
  155 + whether in tort (including negligence), contract, or otherwise,
  156 + unless required by applicable law (such as deliberate and grossly
  157 + negligent acts) or agreed to in writing, shall any Contributor be
  158 + liable to You for damages, including any direct, indirect, special,
  159 + incidental, or consequential damages of any character arising as a
  160 + result of this License or out of the use or inability to use the
  161 + Work (including but not limited to damages for loss of goodwill,
  162 + work stoppage, computer failure or malfunction, or any and all
  163 + other commercial damages or losses), even if such Contributor
  164 + has been advised of the possibility of such damages.
  165 +
  166 + 9. Accepting Warranty or Additional Liability. While redistributing
  167 + the Work or Derivative Works thereof, You may choose to offer,
  168 + and charge a fee for, acceptance of support, warranty, indemnity,
  169 + or other liability obligations and/or rights consistent with this
  170 + License. However, in accepting such obligations, You may act only
  171 + on Your own behalf and on Your sole responsibility, not on behalf
  172 + of any other Contributor, and only if You agree to indemnify,
  173 + defend, and hold each Contributor harmless for any liability
  174 + incurred by, or claims asserted against, such Contributor by reason
  175 + of your accepting any such warranty or additional liability.
  176 +
  177 + END OF TERMS AND CONDITIONS
  178 +
  179 + APPENDIX: How to apply the Apache License to your work.
  180 +
  181 + To apply the Apache License to your work, attach the following
  182 + boilerplate notice, with the fields enclosed by brackets "[]"
  183 + replaced with your own identifying information. (Don't include
  184 + the brackets!) The text should be enclosed in the appropriate
  185 + comment syntax for the file format. We also recommend that a
  186 + file or class name and description of purpose be included on the
  187 + same "printed page" as the copyright notice for easier
  188 + identification within third-party archives.
  189 +
  190 + Copyright [yyyy] [name of copyright owner]
  191 +
  192 + Licensed under the Apache License, Version 2.0 (the "License");
  193 + you may not use this file except in compliance with the License.
  194 + You may obtain a copy of the License at
  195 +
  196 + http://www.apache.org/licenses/LICENSE-2.0
  197 +
  198 + Unless required by applicable law or agreed to in writing, software
  199 + distributed under the License is distributed on an "AS IS" BASIS,
  200 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  201 + See the License for the specific language governing permissions and
  202 + limitations under the License.
  1 +include: package:flutter_lints/flutter.yaml
  2 +
  3 +# Additional information about this file can be found at
  4 +# https://dart.dev/guides/language/analysis-options
  1 +# Introduction
  2 +
  3 +## Speaker identification
  4 +
  5 +```bash
  6 +# switch to this directory and run
  7 +
  8 +wget https://github.com/k2-fsa/sherpa-onnx/releases/download/speaker-recongition-models/3dspeaker_speech_eres2net_base_sv_zh-cn_3dspeaker_16k.onnx
  9 +git clone https://github.com/csukuangfj/sr-data
  10 +
  11 +rm -rf sr-data/.git
  12 +```
  1 +// Copyright (c) 2024 Xiaomi Corporation
  2 +import 'package:sherpa_onnx/sherpa_onnx.dart' as sherpa_onnx;
  3 +import 'package:flutter/material.dart';
  4 +import "./speaker_identification_test.dart";
  5 +
  6 +void main() {
  7 + runApp(const MyApp());
  8 +}
  9 +
  10 +class MyApp extends StatelessWidget {
  11 + const MyApp({Key? key}) : super(key: key);
  12 + // This widget is the root of your application.
  13 + @override
  14 + Widget build(BuildContext context) {
  15 + return MaterialApp(
  16 + title: 'Flutter Demo',
  17 + theme: ThemeData(
  18 + // This is the theme of your application.
  19 + //
  20 + // Try running your application with "flutter run". You'll see the
  21 + // application has a blue toolbar. Then, without quitting the app, try
  22 + // changing the primarySwatch below to Colors.green and then invoke
  23 + // "hot reload" (press "r" in the console where you ran "flutter run",
  24 + // or simply save your changes to "hot reload" in a Flutter IDE).
  25 + // Notice that the counter didn't reset back to zero; the application
  26 + // is not restarted.
  27 + primarySwatch: Colors.blue,
  28 + ),
  29 + home: const MyHomePage(title: 'Flutter Demo Home Page'),
  30 + );
  31 + }
  32 +}
  33 +
  34 +class MyHomePage extends StatefulWidget {
  35 + const MyHomePage({Key? key, required this.title}) : super(key: key);
  36 + // This widget is the home page of your application. It is stateful, meaning
  37 + // that it has a State object (defined below) that contains fields that affect
  38 + // how it looks.
  39 + // This class is the configuration for the state. It holds the values (in this
  40 + // case the title) provided by the parent (in this case the App widget) and
  41 + // used by the build method of the State. Fields in a Widget subclass are
  42 + // always marked "final".
  43 + final String title;
  44 + @override
  45 + State<MyHomePage> createState() => _MyHomePageState();
  46 +}
  47 +
  48 +class _MyHomePageState extends State<MyHomePage> {
  49 + int _counter = 0;
  50 + Future<void> _incrementCounter() async {
  51 + if (_counter <= 10) {
  52 + sherpa_onnx.initBindings();
  53 + await testSpeakerID();
  54 + }
  55 +
  56 + setState(() {
  57 + // This call to setState tells the Flutter framework that something has
  58 + // changed in this State, which causes it to rerun the build method below
  59 + // so that the display can reflect the updated values. If we changed
  60 + // _counter without calling setState(), then the build method would not be
  61 + // called again, and so nothing would appear to happen.
  62 + _counter++;
  63 + });
  64 + }
  65 +
  66 + @override
  67 + Widget build(BuildContext context) {
  68 + // This method is rerun every time setState is called, for instance as done
  69 + // by the _incrementCounter method above.
  70 + //
  71 + // The Flutter framework has been optimized to make rerunning build methods
  72 + // fast, so that you can just rebuild anything that needs updating rather
  73 + // than having to individually change instances of widgets.
  74 + return Scaffold(
  75 + appBar: AppBar(
  76 + // Here we take the value from the MyHomePage object that was created by
  77 + // the App.build method, and use it to set our appbar title.
  78 + title: Text(widget.title),
  79 + ),
  80 + body: Center(
  81 + // Center is a layout widget. It takes a single child and positions it
  82 + // in the middle of the parent.
  83 + child: Column(
  84 + // Column is also a layout widget. It takes a list of children and
  85 + // arranges them vertically. By default, it sizes itself to fit its
  86 + // children horizontally, and tries to be as tall as its parent.
  87 + //
  88 + // Invoke "debug painting" (press "p" in the console, choose the
  89 + // "Toggle Debug Paint" action from the Flutter Inspector in Android
  90 + // Studio, or the "Toggle Debug Paint" command in Visual Studio Code)
  91 + // to see the wireframe for each widget.
  92 + //
  93 + // Column has various properties to control how it sizes itself and
  94 + // how it positions its children. Here we use mainAxisAlignment to
  95 + // center the children vertically; the main axis here is the vertical
  96 + // axis because Columns are vertical (the cross axis would be
  97 + // horizontal).
  98 + mainAxisAlignment: MainAxisAlignment.center,
  99 + children: <Widget>[
  100 + const Text(
  101 + 'You have pushed the button this many times:',
  102 + ),
  103 + Text(
  104 + '$_counter',
  105 + style: Theme.of(context).textTheme.headlineSmall,
  106 + ),
  107 + ],
  108 + ),
  109 + ),
  110 + floatingActionButton: FloatingActionButton(
  111 + onPressed: _incrementCounter,
  112 + tooltip: 'Increment',
  113 + child: const Icon(Icons.add),
  114 + ), // This trailing comma makes auto-formatting nicer for build methods.
  115 + );
  116 + }
  117 +}
  1 +// Copyright (c) 2024 Xiaomi Corporation
  2 +import 'package:sherpa_onnx/sherpa_onnx.dart' as sherpa_onnx;
  3 +import 'dart:typed_data';
  4 +import 'package:path/path.dart';
  5 +import './utils.dart';
  6 +
  7 +Float32List computeEmbedding(
  8 + {required sherpa_onnx.SpeakerEmbeddingExtractor extractor,
  9 + required String filename}) {
  10 + final stream = extractor.createStream();
  11 + final waveData = sherpa_onnx.readWave(filename);
  12 +
  13 + stream.acceptWaveform(
  14 + samples: waveData.samples, sampleRate: waveData.sampleRate);
  15 +
  16 + stream.inputFinished();
  17 +
  18 + final embedding = extractor.compute(stream);
  19 +
  20 + stream.free();
  21 +
  22 + return embedding;
  23 +}
  24 +
  25 +Future<void> testSpeakerID() async {
  26 + final src =
  27 + 'assets/3dspeaker_speech_eres2net_base_sv_zh-cn_3dspeaker_16k.onnx';
  28 + final modelPath = await copyAssetFile(src: src, dst: 'model.onnx');
  29 +
  30 + final config = sherpa_onnx.SpeakerEmbeddingExtractorConfig(model: modelPath);
  31 + final extractor = sherpa_onnx.SpeakerEmbeddingExtractor(config: config);
  32 +
  33 + const _spk1Files = [
  34 + 'assets/sr-data/enroll/fangjun-sr-1.wav',
  35 + 'assets/sr-data/enroll/fangjun-sr-2.wav',
  36 + 'assets/sr-data/enroll/fangjun-sr-3.wav',
  37 + ];
  38 + final spk1Files = <String>[];
  39 + for (final f in _spk1Files) {
  40 + spk1Files.add(await copyAssetFile(src: f, dst: basename(f)));
  41 + }
  42 +
  43 + final spk1Vec = <Float32List>[];
  44 + for (final f in spk1Files) {
  45 + spk1Vec.add(computeEmbedding(extractor: extractor, filename: f));
  46 + }
  47 +
  48 + const _spk2Files = [
  49 + 'assets/sr-data/enroll/leijun-sr-1.wav',
  50 + 'assets/sr-data/enroll/leijun-sr-2.wav',
  51 + ];
  52 + final spk2Files = <String>[];
  53 + for (final f in _spk2Files) {
  54 + spk2Files.add(await copyAssetFile(src: f, dst: basename(f)));
  55 + }
  56 +
  57 + final spk2Vec = <Float32List>[];
  58 + for (final f in spk2Files) {
  59 + spk2Vec.add(computeEmbedding(extractor: extractor, filename: f));
  60 + }
  61 +
  62 + final manager = sherpa_onnx.SpeakerEmbeddingManager(extractor.dim);
  63 + assert(manager.numSpeakers == 0, '${manager.numSpeakers}');
  64 +
  65 + bool ok = manager.addMulti(name: 'fangjun', embeddingList: spk1Vec);
  66 + assert(ok, "Failed to add fangjun");
  67 + assert(manager.numSpeakers == 1, '${manager.numSpeakers}');
  68 +
  69 + ok = manager.addMulti(name: 'leijun', embeddingList: spk2Vec);
  70 + assert(ok, "Failed to add leijun");
  71 + assert(manager.numSpeakers == 2, '${manager.numSpeakers}');
  72 +
  73 + bool found = manager.contains('fangjun');
  74 + assert(found, 'Failed to find fangjun');
  75 +
  76 + found = manager.contains('leijun');
  77 + assert(found, 'Failed to find leijun');
  78 +
  79 + print('---All speakers---');
  80 +
  81 + print(manager.allSpeakerNames);
  82 +
  83 + print('------------');
  84 +
  85 + const _testFiles = [
  86 + 'assets/sr-data/test/fangjun-test-sr-1.wav',
  87 + 'assets/sr-data/test/leijun-test-sr-1.wav',
  88 + 'assets/sr-data/test/liudehua-test-sr-1.wav',
  89 + ];
  90 +
  91 + final testFiles = <String>[];
  92 + for (final f in _testFiles) {
  93 + testFiles.add(await copyAssetFile(src: f, dst: basename(f)));
  94 + }
  95 +
  96 + const threshold = 0.6;
  97 +
  98 + for (final f in testFiles) {
  99 + final embedding = computeEmbedding(extractor: extractor, filename: f);
  100 +
  101 + var name = manager.search(embedding: embedding, threshold: threshold);
  102 + if (name == '') {
  103 + name = '<Unknown>';
  104 + }
  105 + print('${f}: ${name}');
  106 + }
  107 +
  108 + ok = manager.verify(
  109 + name: 'fangjun',
  110 + embedding: computeEmbedding(extractor: extractor, filename: testFiles[0]),
  111 + threshold: threshold);
  112 + assert(ok, 'Failed to verify fangjun using ${testFiles[0]}');
  113 +
  114 + ok = manager.remove('fangjun');
  115 + assert(ok, 'Failed to remove fangjun');
  116 + assert(manager.numSpeakers == 1, '${manager.numSpeakers}');
  117 +
  118 + found = manager.contains('fangjun');
  119 + assert(!found, 'Still found fangjun!');
  120 +
  121 + ok = manager.verify(
  122 + name: 'fangjun',
  123 + embedding: computeEmbedding(extractor: extractor, filename: testFiles[0]),
  124 + threshold: threshold);
  125 + assert(!ok, '${testFiles[0]}');
  126 +
  127 + manager.free();
  128 + extractor.free();
  129 +}
  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:io";
  6 +
  7 +// Copy the asset file from src to dst
  8 +Future<String> copyAssetFile({required String src, required String dst}) async {
  9 + final Directory directory = await getApplicationDocumentsDirectory();
  10 + final target = join(directory.path, dst);
  11 +
  12 + final data = await rootBundle.load(src);
  13 + final List<int> bytes =
  14 + data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
  15 + await File(target).writeAsBytes(bytes);
  16 +
  17 + return target;
  18 +}
  1 +# Flutter-related
  2 +**/Flutter/ephemeral/
  3 +**/Pods/
  4 +
  5 +# Xcode-related
  6 +**/dgph
  7 +**/xcuserdata/
  1 +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
  2 +#include "ephemeral/Flutter-Generated.xcconfig"
  1 +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
  2 +#include "ephemeral/Flutter-Generated.xcconfig"
  1 +platform :osx, '10.14'
  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 + AD18C81BD25EB64A10A74721 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EEF159F4D7912B9311CB282 /* Pods_Runner.framework */; };
  31 + F1F6B0C655533B7F45E75DA0 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BA92A3C1CA5533C24C7C7468 /* Pods_RunnerTests.framework */; };
  32 +/* End PBXBuildFile section */
  33 +
  34 +/* Begin PBXContainerItemProxy section */
  35 + 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = {
  36 + isa = PBXContainerItemProxy;
  37 + containerPortal = 33CC10E52044A3C60003C045 /* Project object */;
  38 + proxyType = 1;
  39 + remoteGlobalIDString = 33CC10EC2044A3C60003C045;
  40 + remoteInfo = Runner;
  41 + };
  42 + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = {
  43 + isa = PBXContainerItemProxy;
  44 + containerPortal = 33CC10E52044A3C60003C045 /* Project object */;
  45 + proxyType = 1;
  46 + remoteGlobalIDString = 33CC111A2044C6BA0003C045;
  47 + remoteInfo = FLX;
  48 + };
  49 +/* End PBXContainerItemProxy section */
  50 +
  51 +/* Begin PBXCopyFilesBuildPhase section */
  52 + 33CC110E2044A8840003C045 /* Bundle Framework */ = {
  53 + isa = PBXCopyFilesBuildPhase;
  54 + buildActionMask = 2147483647;
  55 + dstPath = "";
  56 + dstSubfolderSpec = 10;
  57 + files = (
  58 + );
  59 + name = "Bundle Framework";
  60 + runOnlyForDeploymentPostprocessing = 0;
  61 + };
  62 +/* End PBXCopyFilesBuildPhase section */
  63 +
  64 +/* Begin PBXFileReference section */
  65 + 09EF98B2CF4F049F4C7B5BAA /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
  66 + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
  67 + 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
  68 + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
  69 + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
  70 + 33CC10ED2044A3C60003C045 /* sherpa_onnx.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = sherpa_onnx.app; sourceTree = BUILT_PRODUCTS_DIR; };
  71 + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
  72 + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
  73 + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
  74 + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = "<group>"; };
  75 + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = "<group>"; };
  76 + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = "<group>"; };
  77 + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = "<group>"; };
  78 + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = "<group>"; };
  79 + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
  80 + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
  81 + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
  82 + 3EEF159F4D7912B9311CB282 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
  83 + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
  84 + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
  85 + A1236548122E91133BF39DA1 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
  86 + BA92A3C1CA5533C24C7C7468 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
  87 + C9A014A0AF0A3CC243C5BA0C /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
  88 + CDC9FAA17691FA4BA5F49074 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
  89 + E3A16097032C820A141E3D0C /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
  90 + F7379309434F931B509C87FA /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
  91 +/* End PBXFileReference section */
  92 +
  93 +/* Begin PBXFrameworksBuildPhase section */
  94 + 331C80D2294CF70F00263BE5 /* Frameworks */ = {
  95 + isa = PBXFrameworksBuildPhase;
  96 + buildActionMask = 2147483647;
  97 + files = (
  98 + F1F6B0C655533B7F45E75DA0 /* Pods_RunnerTests.framework in Frameworks */,
  99 + );
  100 + runOnlyForDeploymentPostprocessing = 0;
  101 + };
  102 + 33CC10EA2044A3C60003C045 /* Frameworks */ = {
  103 + isa = PBXFrameworksBuildPhase;
  104 + buildActionMask = 2147483647;
  105 + files = (
  106 + AD18C81BD25EB64A10A74721 /* Pods_Runner.framework in Frameworks */,
  107 + );
  108 + runOnlyForDeploymentPostprocessing = 0;
  109 + };
  110 +/* End PBXFrameworksBuildPhase section */
  111 +
  112 +/* Begin PBXGroup section */
  113 + 331C80D6294CF71000263BE5 /* RunnerTests */ = {
  114 + isa = PBXGroup;
  115 + children = (
  116 + 331C80D7294CF71000263BE5 /* RunnerTests.swift */,
  117 + );
  118 + path = RunnerTests;
  119 + sourceTree = "<group>";
  120 + };
  121 + 33BA886A226E78AF003329D5 /* Configs */ = {
  122 + isa = PBXGroup;
  123 + children = (
  124 + 33E5194F232828860026EE4D /* AppInfo.xcconfig */,
  125 + 9740EEB21CF90195004384FC /* Debug.xcconfig */,
  126 + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
  127 + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */,
  128 + );
  129 + path = Configs;
  130 + sourceTree = "<group>";
  131 + };
  132 + 33CC10E42044A3C60003C045 = {
  133 + isa = PBXGroup;
  134 + children = (
  135 + 33FAB671232836740065AC1E /* Runner */,
  136 + 33CEB47122A05771004F2AC0 /* Flutter */,
  137 + 331C80D6294CF71000263BE5 /* RunnerTests */,
  138 + 33CC10EE2044A3C60003C045 /* Products */,
  139 + D73912EC22F37F3D000D13A0 /* Frameworks */,
  140 + 782733D97D5852B42F7DAD3B /* Pods */,
  141 + );
  142 + sourceTree = "<group>";
  143 + };
  144 + 33CC10EE2044A3C60003C045 /* Products */ = {
  145 + isa = PBXGroup;
  146 + children = (
  147 + 33CC10ED2044A3C60003C045 /* sherpa_onnx.app */,
  148 + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */,
  149 + );
  150 + name = Products;
  151 + sourceTree = "<group>";
  152 + };
  153 + 33CC11242044D66E0003C045 /* Resources */ = {
  154 + isa = PBXGroup;
  155 + children = (
  156 + 33CC10F22044A3C60003C045 /* Assets.xcassets */,
  157 + 33CC10F42044A3C60003C045 /* MainMenu.xib */,
  158 + 33CC10F72044A3C60003C045 /* Info.plist */,
  159 + );
  160 + name = Resources;
  161 + path = ..;
  162 + sourceTree = "<group>";
  163 + };
  164 + 33CEB47122A05771004F2AC0 /* Flutter */ = {
  165 + isa = PBXGroup;
  166 + children = (
  167 + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */,
  168 + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */,
  169 + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */,
  170 + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */,
  171 + );
  172 + path = Flutter;
  173 + sourceTree = "<group>";
  174 + };
  175 + 33FAB671232836740065AC1E /* Runner */ = {
  176 + isa = PBXGroup;
  177 + children = (
  178 + 33CC10F02044A3C60003C045 /* AppDelegate.swift */,
  179 + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */,
  180 + 33E51913231747F40026EE4D /* DebugProfile.entitlements */,
  181 + 33E51914231749380026EE4D /* Release.entitlements */,
  182 + 33CC11242044D66E0003C045 /* Resources */,
  183 + 33BA886A226E78AF003329D5 /* Configs */,
  184 + );
  185 + path = Runner;
  186 + sourceTree = "<group>";
  187 + };
  188 + 782733D97D5852B42F7DAD3B /* Pods */ = {
  189 + isa = PBXGroup;
  190 + children = (
  191 + A1236548122E91133BF39DA1 /* Pods-Runner.debug.xcconfig */,
  192 + 09EF98B2CF4F049F4C7B5BAA /* Pods-Runner.release.xcconfig */,
  193 + CDC9FAA17691FA4BA5F49074 /* Pods-Runner.profile.xcconfig */,
  194 + E3A16097032C820A141E3D0C /* Pods-RunnerTests.debug.xcconfig */,
  195 + C9A014A0AF0A3CC243C5BA0C /* Pods-RunnerTests.release.xcconfig */,
  196 + F7379309434F931B509C87FA /* Pods-RunnerTests.profile.xcconfig */,
  197 + );
  198 + name = Pods;
  199 + path = Pods;
  200 + sourceTree = "<group>";
  201 + };
  202 + D73912EC22F37F3D000D13A0 /* Frameworks */ = {
  203 + isa = PBXGroup;
  204 + children = (
  205 + 3EEF159F4D7912B9311CB282 /* Pods_Runner.framework */,
  206 + BA92A3C1CA5533C24C7C7468 /* Pods_RunnerTests.framework */,
  207 + );
  208 + name = Frameworks;
  209 + sourceTree = "<group>";
  210 + };
  211 +/* End PBXGroup section */
  212 +
  213 +/* Begin PBXNativeTarget section */
  214 + 331C80D4294CF70F00263BE5 /* RunnerTests */ = {
  215 + isa = PBXNativeTarget;
  216 + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
  217 + buildPhases = (
  218 + A6B10289F00794F0134DF87E /* [CP] Check Pods Manifest.lock */,
  219 + 331C80D1294CF70F00263BE5 /* Sources */,
  220 + 331C80D2294CF70F00263BE5 /* Frameworks */,
  221 + 331C80D3294CF70F00263BE5 /* Resources */,
  222 + );
  223 + buildRules = (
  224 + );
  225 + dependencies = (
  226 + 331C80DA294CF71000263BE5 /* PBXTargetDependency */,
  227 + );
  228 + name = RunnerTests;
  229 + productName = RunnerTests;
  230 + productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */;
  231 + productType = "com.apple.product-type.bundle.unit-test";
  232 + };
  233 + 33CC10EC2044A3C60003C045 /* Runner */ = {
  234 + isa = PBXNativeTarget;
  235 + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
  236 + buildPhases = (
  237 + 1CEDB7D27400A1C1B87B926C /* [CP] Check Pods Manifest.lock */,
  238 + 33CC10E92044A3C60003C045 /* Sources */,
  239 + 33CC10EA2044A3C60003C045 /* Frameworks */,
  240 + 33CC10EB2044A3C60003C045 /* Resources */,
  241 + 33CC110E2044A8840003C045 /* Bundle Framework */,
  242 + 3399D490228B24CF009A79C7 /* ShellScript */,
  243 + C2CEDA50A000327A806944DD /* [CP] Embed Pods Frameworks */,
  244 + );
  245 + buildRules = (
  246 + );
  247 + dependencies = (
  248 + 33CC11202044C79F0003C045 /* PBXTargetDependency */,
  249 + );
  250 + name = Runner;
  251 + productName = Runner;
  252 + productReference = 33CC10ED2044A3C60003C045 /* sherpa_onnx.app */;
  253 + productType = "com.apple.product-type.application";
  254 + };
  255 +/* End PBXNativeTarget section */
  256 +
  257 +/* Begin PBXProject section */
  258 + 33CC10E52044A3C60003C045 /* Project object */ = {
  259 + isa = PBXProject;
  260 + attributes = {
  261 + BuildIndependentTargetsInParallel = YES;
  262 + LastSwiftUpdateCheck = 0920;
  263 + LastUpgradeCheck = 1510;
  264 + ORGANIZATIONNAME = "";
  265 + TargetAttributes = {
  266 + 331C80D4294CF70F00263BE5 = {
  267 + CreatedOnToolsVersion = 14.0;
  268 + TestTargetID = 33CC10EC2044A3C60003C045;
  269 + };
  270 + 33CC10EC2044A3C60003C045 = {
  271 + CreatedOnToolsVersion = 9.2;
  272 + LastSwiftMigration = 1100;
  273 + ProvisioningStyle = Automatic;
  274 + SystemCapabilities = {
  275 + com.apple.Sandbox = {
  276 + enabled = 1;
  277 + };
  278 + };
  279 + };
  280 + 33CC111A2044C6BA0003C045 = {
  281 + CreatedOnToolsVersion = 9.2;
  282 + ProvisioningStyle = Manual;
  283 + };
  284 + };
  285 + };
  286 + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */;
  287 + compatibilityVersion = "Xcode 9.3";
  288 + developmentRegion = en;
  289 + hasScannedForEncodings = 0;
  290 + knownRegions = (
  291 + en,
  292 + Base,
  293 + );
  294 + mainGroup = 33CC10E42044A3C60003C045;
  295 + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */;
  296 + projectDirPath = "";
  297 + projectRoot = "";
  298 + targets = (
  299 + 33CC10EC2044A3C60003C045 /* Runner */,
  300 + 331C80D4294CF70F00263BE5 /* RunnerTests */,
  301 + 33CC111A2044C6BA0003C045 /* Flutter Assemble */,
  302 + );
  303 + };
  304 +/* End PBXProject section */
  305 +
  306 +/* Begin PBXResourcesBuildPhase section */
  307 + 331C80D3294CF70F00263BE5 /* Resources */ = {
  308 + isa = PBXResourcesBuildPhase;
  309 + buildActionMask = 2147483647;
  310 + files = (
  311 + );
  312 + runOnlyForDeploymentPostprocessing = 0;
  313 + };
  314 + 33CC10EB2044A3C60003C045 /* Resources */ = {
  315 + isa = PBXResourcesBuildPhase;
  316 + buildActionMask = 2147483647;
  317 + files = (
  318 + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */,
  319 + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */,
  320 + );
  321 + runOnlyForDeploymentPostprocessing = 0;
  322 + };
  323 +/* End PBXResourcesBuildPhase section */
  324 +
  325 +/* Begin PBXShellScriptBuildPhase section */
  326 + 1CEDB7D27400A1C1B87B926C /* [CP] Check Pods Manifest.lock */ = {
  327 + isa = PBXShellScriptBuildPhase;
  328 + buildActionMask = 2147483647;
  329 + files = (
  330 + );
  331 + inputFileListPaths = (
  332 + );
  333 + inputPaths = (
  334 + "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
  335 + "${PODS_ROOT}/Manifest.lock",
  336 + );
  337 + name = "[CP] Check Pods Manifest.lock";
  338 + outputFileListPaths = (
  339 + );
  340 + outputPaths = (
  341 + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
  342 + );
  343 + runOnlyForDeploymentPostprocessing = 0;
  344 + shellPath = /bin/sh;
  345 + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
  346 + showEnvVarsInLog = 0;
  347 + };
  348 + 3399D490228B24CF009A79C7 /* ShellScript */ = {
  349 + isa = PBXShellScriptBuildPhase;
  350 + alwaysOutOfDate = 1;
  351 + buildActionMask = 2147483647;
  352 + files = (
  353 + );
  354 + inputFileListPaths = (
  355 + );
  356 + inputPaths = (
  357 + );
  358 + outputFileListPaths = (
  359 + );
  360 + outputPaths = (
  361 + );
  362 + runOnlyForDeploymentPostprocessing = 0;
  363 + shellPath = /bin/sh;
  364 + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
  365 + };
  366 + 33CC111E2044C6BF0003C045 /* ShellScript */ = {
  367 + isa = PBXShellScriptBuildPhase;
  368 + buildActionMask = 2147483647;
  369 + files = (
  370 + );
  371 + inputFileListPaths = (
  372 + Flutter/ephemeral/FlutterInputs.xcfilelist,
  373 + );
  374 + inputPaths = (
  375 + Flutter/ephemeral/tripwire,
  376 + );
  377 + outputFileListPaths = (
  378 + Flutter/ephemeral/FlutterOutputs.xcfilelist,
  379 + );
  380 + outputPaths = (
  381 + );
  382 + runOnlyForDeploymentPostprocessing = 0;
  383 + shellPath = /bin/sh;
  384 + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
  385 + };
  386 + A6B10289F00794F0134DF87E /* [CP] Check Pods Manifest.lock */ = {
  387 + isa = PBXShellScriptBuildPhase;
  388 + buildActionMask = 2147483647;
  389 + files = (
  390 + );
  391 + inputFileListPaths = (
  392 + );
  393 + inputPaths = (
  394 + "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
  395 + "${PODS_ROOT}/Manifest.lock",
  396 + );
  397 + name = "[CP] Check Pods Manifest.lock";
  398 + outputFileListPaths = (
  399 + );
  400 + outputPaths = (
  401 + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt",
  402 + );
  403 + runOnlyForDeploymentPostprocessing = 0;
  404 + shellPath = /bin/sh;
  405 + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
  406 + showEnvVarsInLog = 0;
  407 + };
  408 + C2CEDA50A000327A806944DD /* [CP] Embed Pods Frameworks */ = {
  409 + isa = PBXShellScriptBuildPhase;
  410 + buildActionMask = 2147483647;
  411 + files = (
  412 + );
  413 + inputFileListPaths = (
  414 + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
  415 + );
  416 + name = "[CP] Embed Pods Frameworks";
  417 + outputFileListPaths = (
  418 + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
  419 + );
  420 + runOnlyForDeploymentPostprocessing = 0;
  421 + shellPath = /bin/sh;
  422 + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
  423 + showEnvVarsInLog = 0;
  424 + };
  425 +/* End PBXShellScriptBuildPhase section */
  426 +
  427 +/* Begin PBXSourcesBuildPhase section */
  428 + 331C80D1294CF70F00263BE5 /* Sources */ = {
  429 + isa = PBXSourcesBuildPhase;
  430 + buildActionMask = 2147483647;
  431 + files = (
  432 + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */,
  433 + );
  434 + runOnlyForDeploymentPostprocessing = 0;
  435 + };
  436 + 33CC10E92044A3C60003C045 /* Sources */ = {
  437 + isa = PBXSourcesBuildPhase;
  438 + buildActionMask = 2147483647;
  439 + files = (
  440 + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */,
  441 + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */,
  442 + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */,
  443 + );
  444 + runOnlyForDeploymentPostprocessing = 0;
  445 + };
  446 +/* End PBXSourcesBuildPhase section */
  447 +
  448 +/* Begin PBXTargetDependency section */
  449 + 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = {
  450 + isa = PBXTargetDependency;
  451 + target = 33CC10EC2044A3C60003C045 /* Runner */;
  452 + targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */;
  453 + };
  454 + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = {
  455 + isa = PBXTargetDependency;
  456 + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */;
  457 + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */;
  458 + };
  459 +/* End PBXTargetDependency section */
  460 +
  461 +/* Begin PBXVariantGroup section */
  462 + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = {
  463 + isa = PBXVariantGroup;
  464 + children = (
  465 + 33CC10F52044A3C60003C045 /* Base */,
  466 + );
  467 + name = MainMenu.xib;
  468 + path = Runner;
  469 + sourceTree = "<group>";
  470 + };
  471 +/* End PBXVariantGroup section */
  472 +
  473 +/* Begin XCBuildConfiguration section */
  474 + 331C80DB294CF71000263BE5 /* Debug */ = {
  475 + isa = XCBuildConfiguration;
  476 + baseConfigurationReference = E3A16097032C820A141E3D0C /* Pods-RunnerTests.debug.xcconfig */;
  477 + buildSettings = {
  478 + BUNDLE_LOADER = "$(TEST_HOST)";
  479 + CURRENT_PROJECT_VERSION = 1;
  480 + GENERATE_INFOPLIST_FILE = YES;
  481 + MARKETING_VERSION = 1.0;
  482 + PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.RunnerTests;
  483 + PRODUCT_NAME = "$(TARGET_NAME)";
  484 + SWIFT_VERSION = 5.0;
  485 + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/sherpa_onnx.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/sherpa_onnx";
  486 + };
  487 + name = Debug;
  488 + };
  489 + 331C80DC294CF71000263BE5 /* Release */ = {
  490 + isa = XCBuildConfiguration;
  491 + baseConfigurationReference = C9A014A0AF0A3CC243C5BA0C /* Pods-RunnerTests.release.xcconfig */;
  492 + buildSettings = {
  493 + BUNDLE_LOADER = "$(TEST_HOST)";
  494 + CURRENT_PROJECT_VERSION = 1;
  495 + GENERATE_INFOPLIST_FILE = YES;
  496 + MARKETING_VERSION = 1.0;
  497 + PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.RunnerTests;
  498 + PRODUCT_NAME = "$(TARGET_NAME)";
  499 + SWIFT_VERSION = 5.0;
  500 + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/sherpa_onnx.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/sherpa_onnx";
  501 + };
  502 + name = Release;
  503 + };
  504 + 331C80DD294CF71000263BE5 /* Profile */ = {
  505 + isa = XCBuildConfiguration;
  506 + baseConfigurationReference = F7379309434F931B509C87FA /* Pods-RunnerTests.profile.xcconfig */;
  507 + buildSettings = {
  508 + BUNDLE_LOADER = "$(TEST_HOST)";
  509 + CURRENT_PROJECT_VERSION = 1;
  510 + GENERATE_INFOPLIST_FILE = YES;
  511 + MARKETING_VERSION = 1.0;
  512 + PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx.RunnerTests;
  513 + PRODUCT_NAME = "$(TARGET_NAME)";
  514 + SWIFT_VERSION = 5.0;
  515 + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/sherpa_onnx.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/sherpa_onnx";
  516 + };
  517 + name = Profile;
  518 + };
  519 + 338D0CE9231458BD00FA5F75 /* Profile */ = {
  520 + isa = XCBuildConfiguration;
  521 + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
  522 + buildSettings = {
  523 + ALWAYS_SEARCH_USER_PATHS = NO;
  524 + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
  525 + CLANG_ANALYZER_NONNULL = YES;
  526 + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
  527 + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
  528 + CLANG_CXX_LIBRARY = "libc++";
  529 + CLANG_ENABLE_MODULES = YES;
  530 + CLANG_ENABLE_OBJC_ARC = YES;
  531 + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
  532 + CLANG_WARN_BOOL_CONVERSION = YES;
  533 + CLANG_WARN_CONSTANT_CONVERSION = YES;
  534 + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
  535 + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
  536 + CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
  537 + CLANG_WARN_EMPTY_BODY = YES;
  538 + CLANG_WARN_ENUM_CONVERSION = YES;
  539 + CLANG_WARN_INFINITE_RECURSION = YES;
  540 + CLANG_WARN_INT_CONVERSION = YES;
  541 + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
  542 + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
  543 + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
  544 + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
  545 + CLANG_WARN_SUSPICIOUS_MOVE = YES;
  546 + CODE_SIGN_IDENTITY = "-";
  547 + COPY_PHASE_STRIP = NO;
  548 + DEAD_CODE_STRIPPING = YES;
  549 + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
  550 + ENABLE_NS_ASSERTIONS = NO;
  551 + ENABLE_STRICT_OBJC_MSGSEND = YES;
  552 + ENABLE_USER_SCRIPT_SANDBOXING = NO;
  553 + GCC_C_LANGUAGE_STANDARD = gnu11;
  554 + GCC_NO_COMMON_BLOCKS = YES;
  555 + GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
  556 + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
  557 + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
  558 + GCC_WARN_UNUSED_FUNCTION = YES;
  559 + GCC_WARN_UNUSED_VARIABLE = YES;
  560 + MACOSX_DEPLOYMENT_TARGET = 10.14;
  561 + MTL_ENABLE_DEBUG_INFO = NO;
  562 + SDKROOT = macosx;
  563 + SWIFT_COMPILATION_MODE = wholemodule;
  564 + SWIFT_OPTIMIZATION_LEVEL = "-O";
  565 + };
  566 + name = Profile;
  567 + };
  568 + 338D0CEA231458BD00FA5F75 /* Profile */ = {
  569 + isa = XCBuildConfiguration;
  570 + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
  571 + buildSettings = {
  572 + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
  573 + CLANG_ENABLE_MODULES = YES;
  574 + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
  575 + CODE_SIGN_STYLE = Automatic;
  576 + COMBINE_HIDPI_IMAGES = YES;
  577 + INFOPLIST_FILE = Runner/Info.plist;
  578 + LD_RUNPATH_SEARCH_PATHS = (
  579 + "$(inherited)",
  580 + "@executable_path/../Frameworks",
  581 + );
  582 + PROVISIONING_PROFILE_SPECIFIER = "";
  583 + SWIFT_VERSION = 5.0;
  584 + };
  585 + name = Profile;
  586 + };
  587 + 338D0CEB231458BD00FA5F75 /* Profile */ = {
  588 + isa = XCBuildConfiguration;
  589 + buildSettings = {
  590 + CODE_SIGN_STYLE = Manual;
  591 + PRODUCT_NAME = "$(TARGET_NAME)";
  592 + };
  593 + name = Profile;
  594 + };
  595 + 33CC10F92044A3C60003C045 /* Debug */ = {
  596 + isa = XCBuildConfiguration;
  597 + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
  598 + buildSettings = {
  599 + ALWAYS_SEARCH_USER_PATHS = NO;
  600 + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
  601 + CLANG_ANALYZER_NONNULL = YES;
  602 + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
  603 + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
  604 + CLANG_CXX_LIBRARY = "libc++";
  605 + CLANG_ENABLE_MODULES = YES;
  606 + CLANG_ENABLE_OBJC_ARC = YES;
  607 + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
  608 + CLANG_WARN_BOOL_CONVERSION = YES;
  609 + CLANG_WARN_CONSTANT_CONVERSION = YES;
  610 + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
  611 + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
  612 + CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
  613 + CLANG_WARN_EMPTY_BODY = YES;
  614 + CLANG_WARN_ENUM_CONVERSION = YES;
  615 + CLANG_WARN_INFINITE_RECURSION = YES;
  616 + CLANG_WARN_INT_CONVERSION = YES;
  617 + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
  618 + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
  619 + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
  620 + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
  621 + CLANG_WARN_SUSPICIOUS_MOVE = YES;
  622 + CODE_SIGN_IDENTITY = "-";
  623 + COPY_PHASE_STRIP = NO;
  624 + DEAD_CODE_STRIPPING = YES;
  625 + DEBUG_INFORMATION_FORMAT = dwarf;
  626 + ENABLE_STRICT_OBJC_MSGSEND = YES;
  627 + ENABLE_TESTABILITY = YES;
  628 + ENABLE_USER_SCRIPT_SANDBOXING = NO;
  629 + GCC_C_LANGUAGE_STANDARD = gnu11;
  630 + GCC_DYNAMIC_NO_PIC = NO;
  631 + GCC_NO_COMMON_BLOCKS = YES;
  632 + GCC_OPTIMIZATION_LEVEL = 0;
  633 + GCC_PREPROCESSOR_DEFINITIONS = (
  634 + "DEBUG=1",
  635 + "$(inherited)",
  636 + );
  637 + GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
  638 + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
  639 + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
  640 + GCC_WARN_UNUSED_FUNCTION = YES;
  641 + GCC_WARN_UNUSED_VARIABLE = YES;
  642 + MACOSX_DEPLOYMENT_TARGET = 10.14;
  643 + MTL_ENABLE_DEBUG_INFO = YES;
  644 + ONLY_ACTIVE_ARCH = YES;
  645 + SDKROOT = macosx;
  646 + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
  647 + SWIFT_OPTIMIZATION_LEVEL = "-Onone";
  648 + };
  649 + name = Debug;
  650 + };
  651 + 33CC10FA2044A3C60003C045 /* Release */ = {
  652 + isa = XCBuildConfiguration;
  653 + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
  654 + buildSettings = {
  655 + ALWAYS_SEARCH_USER_PATHS = NO;
  656 + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
  657 + CLANG_ANALYZER_NONNULL = YES;
  658 + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
  659 + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
  660 + CLANG_CXX_LIBRARY = "libc++";
  661 + CLANG_ENABLE_MODULES = YES;
  662 + CLANG_ENABLE_OBJC_ARC = YES;
  663 + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
  664 + CLANG_WARN_BOOL_CONVERSION = YES;
  665 + CLANG_WARN_CONSTANT_CONVERSION = YES;
  666 + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
  667 + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
  668 + CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
  669 + CLANG_WARN_EMPTY_BODY = YES;
  670 + CLANG_WARN_ENUM_CONVERSION = YES;
  671 + CLANG_WARN_INFINITE_RECURSION = YES;
  672 + CLANG_WARN_INT_CONVERSION = YES;
  673 + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
  674 + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
  675 + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
  676 + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
  677 + CLANG_WARN_SUSPICIOUS_MOVE = YES;
  678 + CODE_SIGN_IDENTITY = "-";
  679 + COPY_PHASE_STRIP = NO;
  680 + DEAD_CODE_STRIPPING = YES;
  681 + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
  682 + ENABLE_NS_ASSERTIONS = NO;
  683 + ENABLE_STRICT_OBJC_MSGSEND = YES;
  684 + ENABLE_USER_SCRIPT_SANDBOXING = NO;
  685 + GCC_C_LANGUAGE_STANDARD = gnu11;
  686 + GCC_NO_COMMON_BLOCKS = YES;
  687 + GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
  688 + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
  689 + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
  690 + GCC_WARN_UNUSED_FUNCTION = YES;
  691 + GCC_WARN_UNUSED_VARIABLE = YES;
  692 + MACOSX_DEPLOYMENT_TARGET = 10.14;
  693 + MTL_ENABLE_DEBUG_INFO = NO;
  694 + SDKROOT = macosx;
  695 + SWIFT_COMPILATION_MODE = wholemodule;
  696 + SWIFT_OPTIMIZATION_LEVEL = "-O";
  697 + };
  698 + name = Release;
  699 + };
  700 + 33CC10FC2044A3C60003C045 /* Debug */ = {
  701 + isa = XCBuildConfiguration;
  702 + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
  703 + buildSettings = {
  704 + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
  705 + CLANG_ENABLE_MODULES = YES;
  706 + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
  707 + CODE_SIGN_STYLE = Automatic;
  708 + COMBINE_HIDPI_IMAGES = YES;
  709 + INFOPLIST_FILE = Runner/Info.plist;
  710 + LD_RUNPATH_SEARCH_PATHS = (
  711 + "$(inherited)",
  712 + "@executable_path/../Frameworks",
  713 + );
  714 + PROVISIONING_PROFILE_SPECIFIER = "";
  715 + SWIFT_OPTIMIZATION_LEVEL = "-Onone";
  716 + SWIFT_VERSION = 5.0;
  717 + };
  718 + name = Debug;
  719 + };
  720 + 33CC10FD2044A3C60003C045 /* Release */ = {
  721 + isa = XCBuildConfiguration;
  722 + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
  723 + buildSettings = {
  724 + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
  725 + CLANG_ENABLE_MODULES = YES;
  726 + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
  727 + CODE_SIGN_STYLE = Automatic;
  728 + COMBINE_HIDPI_IMAGES = YES;
  729 + INFOPLIST_FILE = Runner/Info.plist;
  730 + LD_RUNPATH_SEARCH_PATHS = (
  731 + "$(inherited)",
  732 + "@executable_path/../Frameworks",
  733 + );
  734 + PROVISIONING_PROFILE_SPECIFIER = "";
  735 + SWIFT_VERSION = 5.0;
  736 + };
  737 + name = Release;
  738 + };
  739 + 33CC111C2044C6BA0003C045 /* Debug */ = {
  740 + isa = XCBuildConfiguration;
  741 + buildSettings = {
  742 + CODE_SIGN_STYLE = Manual;
  743 + PRODUCT_NAME = "$(TARGET_NAME)";
  744 + };
  745 + name = Debug;
  746 + };
  747 + 33CC111D2044C6BA0003C045 /* Release */ = {
  748 + isa = XCBuildConfiguration;
  749 + buildSettings = {
  750 + CODE_SIGN_STYLE = Automatic;
  751 + PRODUCT_NAME = "$(TARGET_NAME)";
  752 + };
  753 + name = Release;
  754 + };
  755 +/* End XCBuildConfiguration section */
  756 +
  757 +/* Begin XCConfigurationList section */
  758 + 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = {
  759 + isa = XCConfigurationList;
  760 + buildConfigurations = (
  761 + 331C80DB294CF71000263BE5 /* Debug */,
  762 + 331C80DC294CF71000263BE5 /* Release */,
  763 + 331C80DD294CF71000263BE5 /* Profile */,
  764 + );
  765 + defaultConfigurationIsVisible = 0;
  766 + defaultConfigurationName = Release;
  767 + };
  768 + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = {
  769 + isa = XCConfigurationList;
  770 + buildConfigurations = (
  771 + 33CC10F92044A3C60003C045 /* Debug */,
  772 + 33CC10FA2044A3C60003C045 /* Release */,
  773 + 338D0CE9231458BD00FA5F75 /* Profile */,
  774 + );
  775 + defaultConfigurationIsVisible = 0;
  776 + defaultConfigurationName = Release;
  777 + };
  778 + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = {
  779 + isa = XCConfigurationList;
  780 + buildConfigurations = (
  781 + 33CC10FC2044A3C60003C045 /* Debug */,
  782 + 33CC10FD2044A3C60003C045 /* Release */,
  783 + 338D0CEA231458BD00FA5F75 /* Profile */,
  784 + );
  785 + defaultConfigurationIsVisible = 0;
  786 + defaultConfigurationName = Release;
  787 + };
  788 + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = {
  789 + isa = XCConfigurationList;
  790 + buildConfigurations = (
  791 + 33CC111C2044C6BA0003C045 /* Debug */,
  792 + 33CC111D2044C6BA0003C045 /* Release */,
  793 + 338D0CEB231458BD00FA5F75 /* Profile */,
  794 + );
  795 + defaultConfigurationIsVisible = 0;
  796 + defaultConfigurationName = Release;
  797 + };
  798 +/* End XCConfigurationList section */
  799 + };
  800 + rootObject = 33CC10E52044A3C60003C045 /* Project object */;
  801 +}
  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>IDEDidComputeMac32BitWarning</key>
  6 + <true/>
  7 +</dict>
  8 +</plist>
  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 = "sherpa_onnx.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 = "sherpa_onnx.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 = "sherpa_onnx.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 = "sherpa_onnx.app"
  86 + BlueprintName = "Runner"
  87 + ReferencedContainer = "container:Runner.xcodeproj">
  88 + </BuildableReference>
  89 + </BuildableProductRunnable>
  90 + </ProfileAction>
  91 + <AnalyzeAction
  92 + buildConfiguration = "Debug">
  93 + </AnalyzeAction>
  94 + <ArchiveAction
  95 + buildConfiguration = "Release"
  96 + revealArchiveInOrganizer = "YES">
  97 + </ArchiveAction>
  98 +</Scheme>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<Workspace
  3 + version = "1.0">
  4 + <FileRef
  5 + location = "group:Runner.xcodeproj">
  6 + </FileRef>
  7 + <FileRef
  8 + location = "group:Pods/Pods.xcodeproj">
  9 + </FileRef>
  10 +</Workspace>
  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>IDEDidComputeMac32BitWarning</key>
  6 + <true/>
  7 +</dict>
  8 +</plist>
  1 +import Cocoa
  2 +import FlutterMacOS
  3 +
  4 +@NSApplicationMain
  5 +class AppDelegate: FlutterAppDelegate {
  6 + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
  7 + return true
  8 + }
  9 +}
  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 +}
  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 = sherpa_onnx
  9 +
  10 +// The application's bundle identifier
  11 +PRODUCT_BUNDLE_IDENTIFIER = com.k2fsa.sherpa.onnx
  12 +
  13 +// The copyright displayed in application information
  14 +PRODUCT_COPYRIGHT = Copyright © 2024 com.k2fsa.sherpa.onnx. All rights reserved.
  1 +#include "../../Flutter/Flutter-Debug.xcconfig"
  2 +#include "Warnings.xcconfig"
  1 +#include "../../Flutter/Flutter-Release.xcconfig"
  2 +#include "Warnings.xcconfig"
  1 +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
  2 +GCC_WARN_UNDECLARED_SELECTOR = YES
  3 +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
  4 +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
  5 +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
  6 +CLANG_WARN_PRAGMA_PACK = YES
  7 +CLANG_WARN_STRICT_PROTOTYPES = YES
  8 +CLANG_WARN_COMMA = YES
  9 +GCC_WARN_STRICT_SELECTOR_MATCH = YES
  10 +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
  11 +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
  12 +GCC_WARN_SHADOW = YES
  13 +CLANG_WARN_UNREACHABLE_CODE = YES
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>com.apple.security.app-sandbox</key>
  6 + <true/>
  7 + <key>com.apple.security.cs.allow-jit</key>
  8 + <true/>
  9 + <key>com.apple.security.network.server</key>
  10 + <true/>
  11 +</dict>
  12 +</plist>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>CFBundleDevelopmentRegion</key>
  6 + <string>$(DEVELOPMENT_LANGUAGE)</string>
  7 + <key>CFBundleExecutable</key>
  8 + <string>$(EXECUTABLE_NAME)</string>
  9 + <key>CFBundleIconFile</key>
  10 + <string></string>
  11 + <key>CFBundleIdentifier</key>
  12 + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
  13 + <key>CFBundleInfoDictionaryVersion</key>
  14 + <string>6.0</string>
  15 + <key>CFBundleName</key>
  16 + <string>$(PRODUCT_NAME)</string>
  17 + <key>CFBundlePackageType</key>
  18 + <string>APPL</string>
  19 + <key>CFBundleShortVersionString</key>
  20 + <string>$(FLUTTER_BUILD_NAME)</string>
  21 + <key>CFBundleVersion</key>
  22 + <string>$(FLUTTER_BUILD_NUMBER)</string>
  23 + <key>LSMinimumSystemVersion</key>
  24 + <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
  25 + <key>NSHumanReadableCopyright</key>
  26 + <string>$(PRODUCT_COPYRIGHT)</string>
  27 + <key>NSMainNibFile</key>
  28 + <string>MainMenu</string>
  29 + <key>NSPrincipalClass</key>
  30 + <string>NSApplication</string>
  31 +</dict>
  32 +</plist>
  1 +import Cocoa
  2 +import FlutterMacOS
  3 +
  4 +class MainFlutterWindow: NSWindow {
  5 + override func awakeFromNib() {
  6 + let flutterViewController = FlutterViewController()
  7 + let windowFrame = self.frame
  8 + self.contentViewController = flutterViewController
  9 + self.setFrame(windowFrame, display: true)
  10 +
  11 + RegisterGeneratedPlugins(registry: flutterViewController)
  12 +
  13 + super.awakeFromNib()
  14 + }
  15 +}
  1 +<?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 +</dict>
  8 +</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 +}
  1 +name: hello_sherpa_onnx
  2 +description: "Demonstrates how to use the sherpa_onnx ffi plugin."
  3 +# The following line prevents the package from being accidentally published to
  4 +# pub.dev using `flutter pub publish`. This is preferred for private packages.
  5 +publish_to: 'none' # Remove this line if you wish to publish to pub.dev
  6 +
  7 +# The following defines the version and build number for your application.
  8 +# A version number is three numbers separated by dots, like 1.2.43
  9 +# followed by an optional build number separated by a +.
  10 +# Both the version and the builder number may be overridden in flutter
  11 +# build by specifying --build-name and --build-number, respectively.
  12 +# In Android, build-name is used as versionName while build-number used as versionCode.
  13 +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
  14 +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
  15 +# Read more about iOS versioning at
  16 +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
  17 +# In Windows, build-name is used as the major, minor, and patch parts
  18 +# of the product and file versions while build-number is used as the build suffix.
  19 +version: 1.0.0+1
  20 +
  21 +environment:
  22 + sdk: '>=3.4.0 <4.0.0'
  23 +
  24 +# Dependencies specify other packages that your package needs in order to work.
  25 +# To automatically upgrade your package dependencies to the latest versions
  26 +# consider running `flutter pub upgrade --major-versions`. Alternatively,
  27 +# dependencies can be manually updated by changing the version numbers below to
  28 +# the latest version available on pub.dev. To see which dependencies have newer
  29 +# versions available, run `flutter pub outdated`.
  30 +dependencies:
  31 + flutter:
  32 + sdk: flutter
  33 +
  34 + path_provider: ^2.1.3
  35 + path:
  36 +
  37 + sherpa_onnx:
  38 + # When depending on this package from a real application you should use:
  39 + # sherpa_onnx: ^x.y.z
  40 + # See https://dart.dev/tools/pub/dependencies#version-constraints
  41 + # The example app is bundled with the plugin so we use a path dependency on
  42 + # the parent directory to use the current plugin's version.
  43 + path: ../
  44 +
  45 + # The following adds the Cupertino Icons font to your application.
  46 + # Use with the CupertinoIcons class for iOS style icons.
  47 + cupertino_icons: ^1.0.6
  48 +
  49 +dev_dependencies:
  50 + flutter_test:
  51 + sdk: flutter
  52 +
  53 + # The "flutter_lints" package below contains a set of recommended lints to
  54 + # encourage good coding practices. The lint set provided by the package is
  55 + # activated in the `analysis_options.yaml` file located at the root of your
  56 + # package. See that file for information about deactivating specific lint
  57 + # rules and activating additional ones.
  58 + flutter_lints: ^3.0.0
  59 +
  60 +# For information on the generic Dart part of this file, see the
  61 +# following page: https://dart.dev/tools/pub/pubspec
  62 +
  63 +# The following section is specific to Flutter packages.
  64 +flutter:
  65 +
  66 + # The following line ensures that the Material Icons font is
  67 + # included with your application, so that you can use the icons in
  68 + # the material Icons class.
  69 + uses-material-design: true
  70 +
  71 + # To add assets to your application, add an assets section, like this:
  72 + assets:
  73 + - assets/
  74 + - assets/sr-data/enroll/
  75 + - assets/sr-data/test/
  76 + # - images/a_dot_ham.jpeg
  77 +
  78 + # An image asset can refer to one or more resolution-specific "variants", see
  79 + # https://flutter.dev/assets-and-images/#resolution-aware
  80 +
  81 + # For details regarding adding assets from package dependencies, see
  82 + # https://flutter.dev/assets-and-images/#from-packages
  83 +
  84 + # To add custom fonts to your application, add a fonts section here,
  85 + # in this "flutter" section. Each entry in this list should have a
  86 + # "family" key with the font family name, and a "fonts" key with a
  87 + # list giving the asset and other descriptors for the font. For
  88 + # example:
  89 + # fonts:
  90 + # - family: Schyler
  91 + # fonts:
  92 + # - asset: fonts/Schyler-Regular.ttf
  93 + # - asset: fonts/Schyler-Italic.ttf
  94 + # style: italic
  95 + # - family: Trajan Pro
  96 + # fonts:
  97 + # - asset: fonts/TrajanPro.ttf
  98 + # - asset: fonts/TrajanPro_Bold.ttf
  99 + # weight: 700
  100 + #
  101 + # For details regarding fonts from package dependencies,
  102 + # see https://flutter.dev/custom-fonts/#from-packages
  1 +// Copyright (c) 2024 Xiaomi Corporation
  2 +import 'dart:io';
  3 +import 'dart:ffi';
  4 +
  5 +import 'src/sherpa_onnx_bindings.dart';
  6 +export 'src/speaker_identification.dart';
  7 +export 'src/online_stream.dart';
  8 +export 'src/wave_reader.dart';
  9 +
  10 +final DynamicLibrary _dylib = () {
  11 + if (Platform.isIOS) {
  12 + throw UnsupportedError('Unknown platform: ${Platform.operatingSystem}');
  13 + }
  14 + if (Platform.isMacOS) {
  15 + return DynamicLibrary.open('libsherpa-onnx-c-api.dylib');
  16 + }
  17 + if (Platform.isAndroid || Platform.isLinux) {
  18 + return DynamicLibrary.open('libsherpa-onnx-c-api.so');
  19 + }
  20 +
  21 + if (Platform.isWindows) {
  22 + return DynamicLibrary.open('sherpa-onnx-c-api.dll');
  23 + }
  24 +
  25 + throw UnsupportedError('Unknown platform: ${Platform.operatingSystem}');
  26 +}();
  27 +
  28 +void initBindings() {
  29 + SherpaOnnxBindings.init(_dylib);
  30 +}
  1 +// Copyright (c) 2024 Xiaomi Corporation
  2 +import 'dart:typed_data';
  3 +import 'dart:ffi';
  4 +import 'package:ffi/ffi.dart';
  5 +import "./sherpa_onnx_bindings.dart";
  6 +
  7 +class OnlineStream {
  8 + /// The user has to call OnlineStream.free() to avoid memory leak.
  9 + OnlineStream({required this.ptr});
  10 +
  11 + void free() {
  12 + SherpaOnnxBindings.destroyOnlineStream?.call(ptr);
  13 + ptr = nullptr;
  14 + }
  15 +
  16 + /// If you have List<double> data, then you can use
  17 + /// Float32List.fromList(data) to convert data to Float32List
  18 + ///
  19 + /// See
  20 + /// https://api.flutter.dev/flutter/dart-core/List-class.html
  21 + /// and
  22 + /// https://api.flutter.dev/flutter/dart-typed_data/Float32List-class.html
  23 + void acceptWaveform({required Float32List samples, required int sampleRate}) {
  24 + final n = samples.length;
  25 + final Pointer<Float> p = calloc<Float>(n);
  26 +
  27 + final pList = p.asTypedList(n);
  28 + pList.setAll(0, samples);
  29 +
  30 + SherpaOnnxBindings.onlineStreamAcceptWaveform
  31 + ?.call(this.ptr, sampleRate, p, n);
  32 +
  33 + calloc.free(p);
  34 + }
  35 +
  36 + void inputFinished() {
  37 + SherpaOnnxBindings.onlineStreamInputFinished?.call(this.ptr);
  38 + }
  39 +
  40 + Pointer<SherpaOnnxOnlineStream> ptr;
  41 +}
  1 +// Copyright (c) 2024 Xiaomi Corporation
  2 +import 'dart:ffi';
  3 +import 'package:ffi/ffi.dart';
  4 +
  5 +final class SherpaOnnxWave extends Struct {
  6 + external Pointer<Float> samples;
  7 +
  8 + @Int32()
  9 + external int sampleRate;
  10 +
  11 + @Int32()
  12 + external int numSamples;
  13 +}
  14 +
  15 +final class SherpaOnnxSpeakerEmbeddingExtractorConfig extends Struct {
  16 + external Pointer<Utf8> model;
  17 +
  18 + @Int32()
  19 + external int numThreads;
  20 +
  21 + @Int32()
  22 + external int debug;
  23 +
  24 + external Pointer<Utf8> provider;
  25 +}
  26 +
  27 +final class SherpaOnnxOnlineStream extends Opaque {}
  28 +
  29 +final class SherpaOnnxSpeakerEmbeddingExtractor extends Opaque {}
  30 +
  31 +final class SherpaOnnxSpeakerEmbeddingManager extends Opaque {}
  32 +
  33 +typedef SherpaOnnxCreateSpeakerEmbeddingManagerNative
  34 + = Pointer<SherpaOnnxSpeakerEmbeddingManager> Function(Int32 dim);
  35 +
  36 +typedef SherpaOnnxCreateSpeakerEmbeddingManager
  37 + = Pointer<SherpaOnnxSpeakerEmbeddingManager> Function(int dim);
  38 +
  39 +typedef SherpaOnnxDestroySpeakerEmbeddingManagerNative = Void Function(
  40 + Pointer<SherpaOnnxSpeakerEmbeddingManager>);
  41 +
  42 +typedef SherpaOnnxDestroySpeakerEmbeddingManager = void Function(
  43 + Pointer<SherpaOnnxSpeakerEmbeddingManager>);
  44 +
  45 +typedef SherpaOnnxSpeakerEmbeddingManagerAddNative = Int32 Function(
  46 + Pointer<SherpaOnnxSpeakerEmbeddingManager>, Pointer<Utf8>, Pointer<Float>);
  47 +
  48 +typedef SherpaOnnxSpeakerEmbeddingManagerAdd = int Function(
  49 + Pointer<SherpaOnnxSpeakerEmbeddingManager>, Pointer<Utf8>, Pointer<Float>);
  50 +
  51 +typedef SherpaOnnxSpeakerEmbeddingManagerAddListFlattenedNative
  52 + = Int32 Function(Pointer<SherpaOnnxSpeakerEmbeddingManager>, Pointer<Utf8>,
  53 + Pointer<Float>, Int32);
  54 +
  55 +typedef SherpaOnnxSpeakerEmbeddingManagerAddListFlattened = int Function(
  56 + Pointer<SherpaOnnxSpeakerEmbeddingManager>,
  57 + Pointer<Utf8>,
  58 + Pointer<Float>,
  59 + int);
  60 +
  61 +typedef SherpaOnnxSpeakerEmbeddingManagerRemoveNative = Int32 Function(
  62 + Pointer<SherpaOnnxSpeakerEmbeddingManager>, Pointer<Utf8>);
  63 +
  64 +typedef SherpaOnnxSpeakerEmbeddingManagerRemove = int Function(
  65 + Pointer<SherpaOnnxSpeakerEmbeddingManager>, Pointer<Utf8>);
  66 +
  67 +typedef SherpaOnnxSpeakerEmbeddingManagerContainsNative = Int32 Function(
  68 + Pointer<SherpaOnnxSpeakerEmbeddingManager>, Pointer<Utf8>);
  69 +
  70 +typedef SherpaOnnxSpeakerEmbeddingManagerContains = int Function(
  71 + Pointer<SherpaOnnxSpeakerEmbeddingManager>, Pointer<Utf8>);
  72 +
  73 +typedef SherpaOnnxSpeakerEmbeddingManagerSearchNative = Pointer<Utf8> Function(
  74 + Pointer<SherpaOnnxSpeakerEmbeddingManager>, Pointer<Float>, Float);
  75 +
  76 +typedef SherpaOnnxSpeakerEmbeddingManagerSearch = Pointer<Utf8> Function(
  77 + Pointer<SherpaOnnxSpeakerEmbeddingManager>, Pointer<Float>, double);
  78 +
  79 +typedef SherpaOnnxSpeakerEmbeddingManagerFreeSearchNative = Void Function(
  80 + Pointer<Utf8>);
  81 +
  82 +typedef SherpaOnnxSpeakerEmbeddingManagerFreeSearch = void Function(
  83 + Pointer<Utf8>);
  84 +
  85 +typedef SherpaOnnxSpeakerEmbeddingManagerNumSpeakersNative = Int32 Function(
  86 + Pointer<SherpaOnnxSpeakerEmbeddingManager>);
  87 +
  88 +typedef SherpaOnnxSpeakerEmbeddingManagerNumSpeakers = int Function(
  89 + Pointer<SherpaOnnxSpeakerEmbeddingManager>);
  90 +
  91 +typedef SherpaOnnxSpeakerEmbeddingManagerVerifyNative = Int32 Function(
  92 + Pointer<SherpaOnnxSpeakerEmbeddingManager>,
  93 + Pointer<Utf8>,
  94 + Pointer<Float>,
  95 + Float);
  96 +
  97 +typedef SherpaOnnxSpeakerEmbeddingManagerVerify = int Function(
  98 + Pointer<SherpaOnnxSpeakerEmbeddingManager>,
  99 + Pointer<Utf8>,
  100 + Pointer<Float>,
  101 + double);
  102 +
  103 +typedef SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakersNative
  104 + = Pointer<Pointer<Utf8>> Function(
  105 + Pointer<SherpaOnnxSpeakerEmbeddingManager>);
  106 +
  107 +typedef SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakers
  108 + = SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakersNative;
  109 +
  110 +typedef SherpaOnnxSpeakerEmbeddingManagerFreeAllSpeakersNative = Void Function(
  111 + Pointer<Pointer<Utf8>>);
  112 +
  113 +typedef SherpaOnnxSpeakerEmbeddingManagerFreeAllSpeakers = void Function(
  114 + Pointer<Pointer<Utf8>>);
  115 +
  116 +typedef SherpaOnnxCreateSpeakerEmbeddingExtractorNative
  117 + = Pointer<SherpaOnnxSpeakerEmbeddingExtractor> Function(
  118 + Pointer<SherpaOnnxSpeakerEmbeddingExtractorConfig>);
  119 +
  120 +typedef SherpaOnnxCreateSpeakerEmbeddingExtractor
  121 + = SherpaOnnxCreateSpeakerEmbeddingExtractorNative;
  122 +
  123 +typedef SherpaOnnxDestroySpeakerEmbeddingExtractorNative = Void Function(
  124 + Pointer<SherpaOnnxSpeakerEmbeddingExtractor>);
  125 +
  126 +typedef SherpaOnnxDestroySpeakerEmbeddingExtractor = void Function(
  127 + Pointer<SherpaOnnxSpeakerEmbeddingExtractor>);
  128 +
  129 +typedef SherpaOnnxSpeakerEmbeddingExtractorDimNative = Int32 Function(
  130 + Pointer<SherpaOnnxSpeakerEmbeddingExtractor>);
  131 +
  132 +typedef SherpaOnnxSpeakerEmbeddingExtractorDim = int Function(
  133 + Pointer<SherpaOnnxSpeakerEmbeddingExtractor>);
  134 +
  135 +typedef SherpaOnnxSpeakerEmbeddingExtractorCreateStreamNative
  136 + = Pointer<SherpaOnnxOnlineStream> Function(
  137 + Pointer<SherpaOnnxSpeakerEmbeddingExtractor>);
  138 +
  139 +typedef SherpaOnnxSpeakerEmbeddingExtractorCreateStream
  140 + = SherpaOnnxSpeakerEmbeddingExtractorCreateStreamNative;
  141 +
  142 +typedef DestroyOnlineStreamNative = Void Function(
  143 + Pointer<SherpaOnnxOnlineStream>);
  144 +
  145 +typedef DestroyOnlineStream = void Function(Pointer<SherpaOnnxOnlineStream>);
  146 +
  147 +typedef OnlineStreamAcceptWaveformNative = Void Function(
  148 + Pointer<SherpaOnnxOnlineStream>,
  149 + Int32 sample_rate,
  150 + Pointer<Float>,
  151 + Int32 n);
  152 +
  153 +typedef OnlineStreamAcceptWaveform = void Function(
  154 + Pointer<SherpaOnnxOnlineStream>, int sample_rate, Pointer<Float>, int n);
  155 +
  156 +typedef OnlineStreamInputFinishedNative = Void Function(
  157 + Pointer<SherpaOnnxOnlineStream>);
  158 +
  159 +typedef OnlineStreamInputFinished = void Function(
  160 + Pointer<SherpaOnnxOnlineStream>);
  161 +
  162 +typedef SherpaOnnxSpeakerEmbeddingExtractorIsReadyNative = Int32 Function(
  163 + Pointer<SherpaOnnxSpeakerEmbeddingExtractor>,
  164 + Pointer<SherpaOnnxOnlineStream>);
  165 +
  166 +typedef SherpaOnnxSpeakerEmbeddingExtractorIsReady = int Function(
  167 + Pointer<SherpaOnnxSpeakerEmbeddingExtractor>,
  168 + Pointer<SherpaOnnxOnlineStream>);
  169 +
  170 +typedef SherpaOnnxSpeakerEmbeddingExtractorComputeEmbeddingNative
  171 + = Pointer<Float> Function(Pointer<SherpaOnnxSpeakerEmbeddingExtractor>,
  172 + Pointer<SherpaOnnxOnlineStream>);
  173 +
  174 +typedef SherpaOnnxSpeakerEmbeddingExtractorComputeEmbedding
  175 + = SherpaOnnxSpeakerEmbeddingExtractorComputeEmbeddingNative;
  176 +
  177 +typedef SherpaOnnxSpeakerEmbeddingExtractorDestroyEmbeddingNative = Void
  178 + Function(Pointer<Float>);
  179 +
  180 +typedef SherpaOnnxSpeakerEmbeddingExtractorDestroyEmbedding = void Function(
  181 + Pointer<Float>);
  182 +
  183 +typedef SherpaOnnxReadWaveNative = Pointer<SherpaOnnxWave> Function(
  184 + Pointer<Utf8>);
  185 +
  186 +typedef SherpaOnnxReadWave = SherpaOnnxReadWaveNative;
  187 +
  188 +typedef SherpaOnnxFreeWaveNative = Void Function(Pointer<SherpaOnnxWave>);
  189 +
  190 +typedef SherpaOnnxFreeWave = void Function(Pointer<SherpaOnnxWave>);
  191 +
  192 +class SherpaOnnxBindings {
  193 + static SherpaOnnxCreateSpeakerEmbeddingExtractor?
  194 + createSpeakerEmbeddingExtractor;
  195 +
  196 + static SherpaOnnxDestroySpeakerEmbeddingExtractor?
  197 + destroySpeakerEmbeddingExtractor;
  198 +
  199 + static SherpaOnnxSpeakerEmbeddingExtractorDim? speakerEmbeddingExtractorDim;
  200 +
  201 + static SherpaOnnxSpeakerEmbeddingExtractorCreateStream?
  202 + speakerEmbeddingExtractorCreateStream;
  203 +
  204 + static SherpaOnnxSpeakerEmbeddingExtractorComputeEmbedding?
  205 + speakerEmbeddingExtractorComputeEmbedding;
  206 +
  207 + static SherpaOnnxSpeakerEmbeddingExtractorDestroyEmbedding?
  208 + speakerEmbeddingExtractorDestroyEmbedding;
  209 +
  210 + static DestroyOnlineStream? destroyOnlineStream;
  211 +
  212 + static OnlineStreamAcceptWaveform? onlineStreamAcceptWaveform;
  213 +
  214 + static OnlineStreamInputFinished? onlineStreamInputFinished;
  215 +
  216 + static SherpaOnnxSpeakerEmbeddingExtractorIsReady?
  217 + speakerEmbeddingExtractorIsReady;
  218 +
  219 + static SherpaOnnxCreateSpeakerEmbeddingManager? createSpeakerEmbeddingManager;
  220 +
  221 + static SherpaOnnxDestroySpeakerEmbeddingManager?
  222 + destroySpeakerEmbeddingManager;
  223 +
  224 + static SherpaOnnxSpeakerEmbeddingManagerAdd? speakerEmbeddingManagerAdd;
  225 +
  226 + static SherpaOnnxSpeakerEmbeddingManagerAddListFlattened?
  227 + speakerEmbeddingManagerAddListFlattened;
  228 +
  229 + static SherpaOnnxSpeakerEmbeddingManagerRemove? speakerEmbeddingManagerRemove;
  230 +
  231 + static SherpaOnnxSpeakerEmbeddingManagerContains?
  232 + speakerEmbeddingManagerContains;
  233 +
  234 + static SherpaOnnxSpeakerEmbeddingManagerSearch? speakerEmbeddingManagerSearch;
  235 +
  236 + static SherpaOnnxSpeakerEmbeddingManagerFreeSearch?
  237 + speakerEmbeddingManagerFreeSearch;
  238 +
  239 + static SherpaOnnxSpeakerEmbeddingManagerNumSpeakers?
  240 + speakerEmbeddingManagerNumSpeakers;
  241 +
  242 + static SherpaOnnxSpeakerEmbeddingManagerVerify? speakerEmbeddingManagerVerify;
  243 +
  244 + static SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakers?
  245 + speakerEmbeddingManagerGetAllSpeakers;
  246 +
  247 + static SherpaOnnxSpeakerEmbeddingManagerFreeAllSpeakers?
  248 + speakerEmbeddingManagerFreeAllSpeakers;
  249 +
  250 + static SherpaOnnxReadWave? readWave;
  251 +
  252 + static SherpaOnnxFreeWave? freeWave;
  253 +
  254 + static void init(DynamicLibrary dynamicLibrary) {
  255 + createSpeakerEmbeddingExtractor ??= dynamicLibrary
  256 + .lookup<NativeFunction<SherpaOnnxCreateSpeakerEmbeddingExtractor>>(
  257 + 'SherpaOnnxCreateSpeakerEmbeddingExtractor')
  258 + .asFunction();
  259 +
  260 + destroySpeakerEmbeddingExtractor ??= dynamicLibrary
  261 + .lookup<
  262 + NativeFunction<
  263 + SherpaOnnxDestroySpeakerEmbeddingExtractorNative>>(
  264 + 'SherpaOnnxDestroySpeakerEmbeddingExtractor')
  265 + .asFunction();
  266 +
  267 + speakerEmbeddingExtractorDim ??= dynamicLibrary
  268 + .lookup<NativeFunction<SherpaOnnxSpeakerEmbeddingExtractorDimNative>>(
  269 + 'SherpaOnnxSpeakerEmbeddingExtractorDim')
  270 + .asFunction();
  271 +
  272 + speakerEmbeddingExtractorCreateStream ??= dynamicLibrary
  273 + .lookup<
  274 + NativeFunction<
  275 + SherpaOnnxSpeakerEmbeddingExtractorCreateStreamNative>>(
  276 + 'SherpaOnnxSpeakerEmbeddingExtractorCreateStream')
  277 + .asFunction();
  278 +
  279 + speakerEmbeddingExtractorComputeEmbedding ??= dynamicLibrary
  280 + .lookup<
  281 + NativeFunction<
  282 + SherpaOnnxSpeakerEmbeddingExtractorComputeEmbeddingNative>>(
  283 + 'SherpaOnnxSpeakerEmbeddingExtractorComputeEmbedding')
  284 + .asFunction();
  285 +
  286 + speakerEmbeddingExtractorDestroyEmbedding ??= dynamicLibrary
  287 + .lookup<
  288 + NativeFunction<
  289 + SherpaOnnxSpeakerEmbeddingExtractorDestroyEmbeddingNative>>(
  290 + 'SherpaOnnxSpeakerEmbeddingExtractorDestroyEmbedding')
  291 + .asFunction();
  292 +
  293 + destroyOnlineStream ??= dynamicLibrary
  294 + .lookup<NativeFunction<DestroyOnlineStreamNative>>(
  295 + 'DestroyOnlineStream')
  296 + .asFunction();
  297 +
  298 + onlineStreamAcceptWaveform ??= dynamicLibrary
  299 + .lookup<NativeFunction<OnlineStreamAcceptWaveformNative>>(
  300 + 'AcceptWaveform')
  301 + .asFunction();
  302 +
  303 + onlineStreamInputFinished ??= dynamicLibrary
  304 + .lookup<NativeFunction<OnlineStreamInputFinishedNative>>(
  305 + 'InputFinished')
  306 + .asFunction();
  307 +
  308 + speakerEmbeddingExtractorIsReady ??= dynamicLibrary
  309 + .lookup<
  310 + NativeFunction<
  311 + SherpaOnnxSpeakerEmbeddingExtractorIsReadyNative>>(
  312 + 'SherpaOnnxSpeakerEmbeddingExtractorIsReady')
  313 + .asFunction();
  314 +
  315 + createSpeakerEmbeddingManager ??= dynamicLibrary
  316 + .lookup<NativeFunction<SherpaOnnxCreateSpeakerEmbeddingManagerNative>>(
  317 + 'SherpaOnnxCreateSpeakerEmbeddingManager')
  318 + .asFunction();
  319 +
  320 + destroySpeakerEmbeddingManager ??= dynamicLibrary
  321 + .lookup<NativeFunction<SherpaOnnxDestroySpeakerEmbeddingManagerNative>>(
  322 + 'SherpaOnnxDestroySpeakerEmbeddingManager')
  323 + .asFunction();
  324 +
  325 + speakerEmbeddingManagerAdd ??= dynamicLibrary
  326 + .lookup<NativeFunction<SherpaOnnxSpeakerEmbeddingManagerAddNative>>(
  327 + 'SherpaOnnxSpeakerEmbeddingManagerAdd')
  328 + .asFunction();
  329 +
  330 + speakerEmbeddingManagerAddListFlattened ??= dynamicLibrary
  331 + .lookup<
  332 + NativeFunction<
  333 + SherpaOnnxSpeakerEmbeddingManagerAddListFlattenedNative>>(
  334 + 'SherpaOnnxSpeakerEmbeddingManagerAddListFlattened')
  335 + .asFunction();
  336 +
  337 + speakerEmbeddingManagerRemove ??= dynamicLibrary
  338 + .lookup<NativeFunction<SherpaOnnxSpeakerEmbeddingManagerRemoveNative>>(
  339 + 'SherpaOnnxSpeakerEmbeddingManagerRemove')
  340 + .asFunction();
  341 +
  342 + speakerEmbeddingManagerContains ??= dynamicLibrary
  343 + .lookup<
  344 + NativeFunction<
  345 + SherpaOnnxSpeakerEmbeddingManagerContainsNative>>(
  346 + 'SherpaOnnxSpeakerEmbeddingManagerContains')
  347 + .asFunction();
  348 +
  349 + speakerEmbeddingManagerSearch ??= dynamicLibrary
  350 + .lookup<NativeFunction<SherpaOnnxSpeakerEmbeddingManagerSearchNative>>(
  351 + 'SherpaOnnxSpeakerEmbeddingManagerSearch')
  352 + .asFunction();
  353 +
  354 + speakerEmbeddingManagerFreeSearch ??= dynamicLibrary
  355 + .lookup<
  356 + NativeFunction<
  357 + SherpaOnnxSpeakerEmbeddingManagerFreeSearchNative>>(
  358 + 'SherpaOnnxSpeakerEmbeddingManagerFreeSearch')
  359 + .asFunction();
  360 +
  361 + speakerEmbeddingManagerNumSpeakers ??= dynamicLibrary
  362 + .lookup<
  363 + NativeFunction<
  364 + SherpaOnnxSpeakerEmbeddingManagerNumSpeakersNative>>(
  365 + 'SherpaOnnxSpeakerEmbeddingManagerNumSpeakers')
  366 + .asFunction();
  367 +
  368 + speakerEmbeddingManagerVerify ??= dynamicLibrary
  369 + .lookup<NativeFunction<SherpaOnnxSpeakerEmbeddingManagerVerifyNative>>(
  370 + 'SherpaOnnxSpeakerEmbeddingManagerVerify')
  371 + .asFunction();
  372 +
  373 + speakerEmbeddingManagerGetAllSpeakers ??= dynamicLibrary
  374 + .lookup<
  375 + NativeFunction<
  376 + SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakersNative>>(
  377 + 'SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakers')
  378 + .asFunction();
  379 +
  380 + speakerEmbeddingManagerFreeAllSpeakers ??= dynamicLibrary
  381 + .lookup<
  382 + NativeFunction<
  383 + SherpaOnnxSpeakerEmbeddingManagerFreeAllSpeakersNative>>(
  384 + 'SherpaOnnxSpeakerEmbeddingManagerFreeAllSpeakers')
  385 + .asFunction();
  386 +
  387 + readWave ??= dynamicLibrary
  388 + .lookup<NativeFunction<SherpaOnnxReadWaveNative>>('SherpaOnnxReadWave')
  389 + .asFunction();
  390 +
  391 + freeWave ??= dynamicLibrary
  392 + .lookup<NativeFunction<SherpaOnnxFreeWaveNative>>('SherpaOnnxFreeWave')
  393 + .asFunction();
  394 + }
  395 +}
  1 +// Copyright (c) 2024 Xiaomi Corporation
  2 +import 'dart:ffi';
  3 +import 'dart:typed_data';
  4 +import 'package:ffi/ffi.dart';
  5 +import "./sherpa_onnx_bindings.dart";
  6 +import "./online_stream.dart";
  7 +
  8 +class SpeakerEmbeddingExtractorConfig {
  9 + const SpeakerEmbeddingExtractorConfig(
  10 + {required this.model,
  11 + this.numThreads = 1,
  12 + this.debug = true,
  13 + this.provider = "cpu"});
  14 +
  15 + @override
  16 + String toString() {
  17 + return "SpeakerEmbeddingExtractorConfig(model: $model, numThreads: $numThreads, debug: $debug, provider: $provider)";
  18 + }
  19 +
  20 + final String model;
  21 + final int numThreads;
  22 + final bool debug;
  23 + final String provider;
  24 +}
  25 +
  26 +class SpeakerEmbeddingExtractor {
  27 + SpeakerEmbeddingExtractor._({required this.ptr, required this.dim});
  28 +
  29 + /// The user is responsible to call the SpeakerEmbeddingExtractor.free()
  30 + /// method of the returned instance to avoid memory leak.
  31 + factory SpeakerEmbeddingExtractor(
  32 + {required SpeakerEmbeddingExtractorConfig config}) {
  33 + final c = calloc<SherpaOnnxSpeakerEmbeddingExtractorConfig>();
  34 +
  35 + final modelPtr = config.model.toNativeUtf8();
  36 + c.ref.model = modelPtr;
  37 +
  38 + c.ref.numThreads = config.numThreads;
  39 + c.ref.debug = config.debug ? 1 : 0;
  40 +
  41 + final providerPtr = config.provider.toNativeUtf8();
  42 + c.ref.provider = providerPtr;
  43 +
  44 + final ptr =
  45 + SherpaOnnxBindings.createSpeakerEmbeddingExtractor?.call(c) ?? nullptr;
  46 +
  47 + calloc.free(providerPtr);
  48 + calloc.free(modelPtr);
  49 + calloc.free(c);
  50 +
  51 + final dim = SherpaOnnxBindings.speakerEmbeddingExtractorDim?.call(ptr) ?? 0;
  52 +
  53 + return SpeakerEmbeddingExtractor._(ptr: ptr, dim: dim);
  54 + }
  55 +
  56 + void free() {
  57 + SherpaOnnxBindings.destroySpeakerEmbeddingExtractor?.call(ptr);
  58 + ptr = nullptr;
  59 + }
  60 +
  61 + /// The user has to invoke stream.free() on the returned instance
  62 + /// to avoid memory leak
  63 + OnlineStream createStream() {
  64 + final p =
  65 + SherpaOnnxBindings.speakerEmbeddingExtractorCreateStream?.call(ptr) ??
  66 + nullptr;
  67 +
  68 + return OnlineStream(ptr: p);
  69 + }
  70 +
  71 + bool isReady(OnlineStream stream) {
  72 + final int ready = SherpaOnnxBindings.speakerEmbeddingExtractorIsReady
  73 + ?.call(this.ptr, stream.ptr) ??
  74 + 0;
  75 + return ready == 1;
  76 + }
  77 +
  78 + Float32List compute(OnlineStream stream) {
  79 + final Pointer<Float> embedding = SherpaOnnxBindings
  80 + .speakerEmbeddingExtractorComputeEmbedding
  81 + ?.call(this.ptr, stream.ptr) ??
  82 + nullptr;
  83 +
  84 + if (embedding == nullptr) {
  85 + return Float32List(0);
  86 + }
  87 +
  88 + final embeddingList = embedding.asTypedList(this.dim);
  89 + final ans = Float32List(this.dim);
  90 + ans.setAll(0, embeddingList);
  91 +
  92 + SherpaOnnxBindings.speakerEmbeddingExtractorDestroyEmbedding
  93 + ?.call(embedding);
  94 +
  95 + return ans;
  96 + }
  97 +
  98 + Pointer<SherpaOnnxSpeakerEmbeddingExtractor> ptr;
  99 + final int dim;
  100 +}
  101 +
  102 +class SpeakerEmbeddingManager {
  103 + SpeakerEmbeddingManager._({required this.ptr, required this.dim});
  104 +
  105 + // The user has to use SpeakerEmbeddingManager.free() to avoid memory leak
  106 + factory SpeakerEmbeddingManager(int dim) {
  107 + final p =
  108 + SherpaOnnxBindings.createSpeakerEmbeddingManager?.call(dim) ?? nullptr;
  109 + return SpeakerEmbeddingManager._(ptr: p, dim: dim);
  110 + }
  111 +
  112 + void free() {
  113 + SherpaOnnxBindings.destroySpeakerEmbeddingManager?.call(this.ptr);
  114 + this.ptr = nullptr;
  115 + }
  116 +
  117 + /// Return true if added successfully; return false otherwise
  118 + bool add({required String name, required Float32List embedding}) {
  119 + assert(embedding.length == this.dim, "${embedding.length} vs ${this.dim}");
  120 +
  121 + final Pointer<Utf8> namePtr = name.toNativeUtf8();
  122 + final int n = embedding.length;
  123 +
  124 + final Pointer<Float> p = calloc<Float>(n);
  125 + final pList = p.asTypedList(n);
  126 + pList.setAll(0, embedding);
  127 +
  128 + final int ok = SherpaOnnxBindings.speakerEmbeddingManagerAdd
  129 + ?.call(this.ptr, namePtr, p) ??
  130 + 0;
  131 +
  132 + calloc.free(p);
  133 + calloc.free(namePtr);
  134 +
  135 + return ok == 1;
  136 + }
  137 +
  138 + bool addMulti(
  139 + {required String name, required List<Float32List> embeddingList}) {
  140 + final Pointer<Utf8> namePtr = name.toNativeUtf8();
  141 + final int n = embeddingList.length;
  142 +
  143 + final Pointer<Float> p = calloc<Float>(n * this.dim);
  144 + final pList = p.asTypedList(n * this.dim);
  145 +
  146 + int offset = 0;
  147 + for (final e in embeddingList) {
  148 + assert(e.length == this.dim, "${e.length} vs ${this.dim}");
  149 +
  150 + pList.setAll(offset, e);
  151 + offset += this.dim;
  152 + }
  153 +
  154 + final int ok = SherpaOnnxBindings.speakerEmbeddingManagerAddListFlattened
  155 + ?.call(this.ptr, namePtr, p, n) ??
  156 + 0;
  157 +
  158 + calloc.free(p);
  159 + calloc.free(namePtr);
  160 +
  161 + return ok == 1;
  162 + }
  163 +
  164 + bool contains(String name) {
  165 + final Pointer<Utf8> namePtr = name.toNativeUtf8();
  166 +
  167 + final int found = SherpaOnnxBindings.speakerEmbeddingManagerContains
  168 + ?.call(this.ptr, namePtr) ??
  169 + 0;
  170 +
  171 + calloc.free(namePtr);
  172 +
  173 + return found == 1;
  174 + }
  175 +
  176 + bool remove(String name) {
  177 + final Pointer<Utf8> namePtr = name.toNativeUtf8();
  178 +
  179 + final int ok = SherpaOnnxBindings.speakerEmbeddingManagerRemove
  180 + ?.call(this.ptr, namePtr) ??
  181 + 0;
  182 +
  183 + calloc.free(namePtr);
  184 +
  185 + return ok == 1;
  186 + }
  187 +
  188 + /// Return an empty string if no speaker is found
  189 + String search({required Float32List embedding, required double threshold}) {
  190 + assert(embedding.length == this.dim);
  191 +
  192 + final Pointer<Float> p = calloc<Float>(this.dim);
  193 + final pList = p.asTypedList(this.dim);
  194 + pList.setAll(0, embedding);
  195 +
  196 + final Pointer<Utf8> name = SherpaOnnxBindings.speakerEmbeddingManagerSearch
  197 + ?.call(this.ptr, p, threshold) ??
  198 + nullptr;
  199 +
  200 + calloc.free(p);
  201 +
  202 + if (name == nullptr) {
  203 + return '';
  204 + }
  205 +
  206 + final String ans = name.toDartString();
  207 +
  208 + SherpaOnnxBindings.speakerEmbeddingManagerFreeSearch?.call(name);
  209 +
  210 + return ans;
  211 + }
  212 +
  213 + bool verify(
  214 + {required String name,
  215 + required Float32List embedding,
  216 + required double threshold}) {
  217 + assert(embedding.length == this.dim);
  218 +
  219 + final Pointer<Utf8> namePtr = name.toNativeUtf8();
  220 +
  221 + final Pointer<Float> p = calloc<Float>(this.dim);
  222 + final pList = p.asTypedList(this.dim);
  223 + pList.setAll(0, embedding);
  224 +
  225 + final int ok = SherpaOnnxBindings.speakerEmbeddingManagerVerify
  226 + ?.call(this.ptr, namePtr, p, threshold) ??
  227 + 0;
  228 +
  229 + calloc.free(p);
  230 + calloc.free(namePtr);
  231 +
  232 + return ok == 1;
  233 + }
  234 +
  235 + int get numSpeakers =>
  236 + SherpaOnnxBindings.speakerEmbeddingManagerNumSpeakers?.call(this.ptr) ??
  237 + 0;
  238 +
  239 + List<String> get allSpeakerNames {
  240 + int n = this.numSpeakers;
  241 + if (n == 0) {
  242 + return <String>[];
  243 + }
  244 +
  245 + final Pointer<Pointer<Utf8>> names = SherpaOnnxBindings
  246 + .speakerEmbeddingManagerGetAllSpeakers
  247 + ?.call(this.ptr) ??
  248 + nullptr;
  249 +
  250 + if (names == nullptr) {
  251 + return <String>[];
  252 + }
  253 +
  254 + final ans = <String>[];
  255 +
  256 + // see https://api.flutter.dev/flutter/dart-ffi/PointerPointer.html
  257 + for (int i = 0; i != n; ++i) {
  258 + String name = names[i].toDartString();
  259 + ans.add(name);
  260 + }
  261 +
  262 + SherpaOnnxBindings.speakerEmbeddingManagerFreeAllSpeakers?.call(names);
  263 +
  264 + return ans;
  265 + }
  266 +
  267 + Pointer<SherpaOnnxSpeakerEmbeddingManager> ptr;
  268 + final int dim;
  269 +}
  1 +// Copyright (c) 2024 Xiaomi Corporation
  2 +import 'dart:ffi';
  3 +import 'dart:typed_data';
  4 +import 'package:ffi/ffi.dart';
  5 +import "./sherpa_onnx_bindings.dart";
  6 +
  7 +class WaveData {
  8 + WaveData({required this.samples, required this.sampleRate});
  9 +
  10 + /// normalized to [-1, 1]
  11 + Float32List samples;
  12 + int sampleRate;
  13 +}
  14 +
  15 +WaveData readWave(String filename) {
  16 + final Pointer<Utf8> str = filename.toNativeUtf8();
  17 + Pointer<SherpaOnnxWave> wave =
  18 + SherpaOnnxBindings.readWave?.call(str) ?? nullptr;
  19 + calloc.free(str);
  20 +
  21 + if (wave == nullptr) {
  22 + return WaveData(samples: Float32List(0), sampleRate: 0);
  23 + }
  24 +
  25 + final samples = wave.ref.samples.asTypedList(wave.ref.numSamples);
  26 +
  27 + final newSamples = Float32List.fromList(samples);
  28 + int sampleRate = wave.ref.sampleRate;
  29 + SherpaOnnxBindings.freeWave?.call(wave);
  30 +
  31 + return WaveData(samples: newSamples, sampleRate: sampleRate);
  32 +}
  1 +#
  2 +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
  3 +# Run `pod lib lint hello.podspec` to validate before publishing.
  4 +#
  5 +Pod::Spec.new do |s|
  6 + s.name = 'sherpa_onnx'
  7 + s.version = '0.0.1'
  8 + s.summary = 'sherpa-onnx Flutter FFI plugin project.'
  9 + s.description = <<-DESC
  10 +sherpa-onnx Flutter FFI plugin project.
  11 + DESC
  12 + s.homepage = 'https://github.com/k2-fsa/sherpa-onnx'
  13 + s.license = { :file => '../LICENSE' }
  14 + s.author = { 'Your Company' => 'email@example.com' }
  15 +
  16 + # This will ensure the source files in Classes/ are included in the native
  17 + # builds of apps using this FFI plugin. Podspec does not support relative
  18 + # paths, so Classes contains a forwarder C file that relatively imports
  19 + # `../src/*` so that the C sources can be shared among all target platforms.
  20 + s.source = { :path => '.' }
  21 + s.dependency 'FlutterMacOS'
  22 + s.vendored_libraries = '*.dylib'
  23 +
  24 + s.platform = :osx, '10.11'
  25 + s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
  26 + s.swift_version = '5.0'
  27 +end
  1 +# Usage
  2 +
  3 +## macOS
  4 +
  5 +1. Build required libraries
  6 +
  7 +```bash
  8 +git clone https://github.com/k2-fsa/sherpa-onnx
  9 +cd sherpa-onnx
  10 +mkdir build
  11 +cd build
  12 +
  13 +cmake -DCMAKE_INSTALL_PREFIX=./install -DBUILD_SHARED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" ..
  14 +make install
  15 +cd ../sherpa-onnx/flutter/
  16 +cp -v ../../build/install/lib/lib* ./macos/
  17 +```
  18 +
  19 +2. Test for speaker identification
  20 +
  21 +```bash
  22 +cd sherpa-onnx/sherpa-onnx/flutter/example
  23 +mkdir assets
  24 +```
  25 +
  26 +
  27 +## Useful commands
  28 +```
  29 +flutter pub publish --dry-run
  30 +flutter run -d macos
  31 +flutter run -d linux
  32 +flutter run -d windows
  33 +
  34 +flutter build macos
  35 +
  36 +flutter run --release -d macos
  37 +
  38 +# add platform to an existing project
  39 +flutter create --platforms=windows,macos,linux .
  40 +
  41 +dart analyze
  42 +```
  1 +name: sherpa_onnx
  2 +description: >
  3 + Dart bindings for sherpa-onnx.
  4 +repository: https://github.com/k2-fsa/sherpa-onnx/tree/main/sherpa-onnx/flutter
  5 +topics:
  6 + - speech-to-text
  7 + - text-to-speech
  8 + - speaker-identification
  9 + - spoken-language-identification
  10 + - audio-tagging
  11 + - voice-activity-detection
  12 +
  13 +# remember to change the version in macos/sherpa_onnx.podspec
  14 +version: 0.0.1
  15 +homepage: https://github.com/k2-fsa/sherpa-onnx
  16 +
  17 +environment:
  18 + sdk: '>=3.4.0 <4.0.0'
  19 + flutter: '>=3.3.0'
  20 +
  21 +dependencies:
  22 + ffi: ^2.1.0
  23 + flutter:
  24 + sdk: flutter
  25 + plugin_platform_interface: ^2.0.2
  26 +
  27 +dev_dependencies:
  28 + flutter_test:
  29 + sdk: flutter
  30 + flutter_lints: ^3.0.0
  31 +
  32 +# For information on the generic Dart part of this file, see the
  33 +# following page: https://dart.dev/tools/pub/pubspec
  34 +
  35 +# The following section is specific to Flutter packages.
  36 +flutter:
  37 + # This section identifies this Flutter project as a plugin project.
  38 + # The 'pluginClass' specifies the class (in Java, Kotlin, Swift, Objective-C, etc.)
  39 + # which should be registered in the plugin registry. This is required for
  40 + # using method channels.
  41 + # The Android 'package' specifies package in which the registered class is.
  42 + # This is required for using method channels on Android.
  43 + # The 'ffiPlugin' specifies that native code should be built and bundled.
  44 + # This is required for using `dart:ffi`.
  45 + # All these are used by the tooling to maintain consistency when
  46 + # adding or updating assets for this project.
  47 + #
  48 + # Please refer to README.md for a detailed explanation.
  49 + plugin:
  50 + platforms:
  51 + macos:
  52 + ffiPlugin: true
  53 +
  54 + # To add assets to your plugin package, add an assets section, like this:
  55 + # assets:
  56 + # - images/a_dot_burr.jpeg
  57 + # - images/a_dot_ham.jpeg
  58 + #
  59 + # For details regarding assets in packages, see
  60 + # https://flutter.dev/assets-and-images/#from-packages
  61 + #
  62 + # An image asset can refer to one or more resolution-specific "variants", see
  63 + # https://flutter.dev/assets-and-images/#resolution-aware
  64 +
  65 + # To add custom fonts to your plugin package, add a fonts section here,
  66 + # in this "flutter" section. Each entry in this list should have a
  67 + # "family" key with the font family name, and a "fonts" key with a
  68 + # list giving the asset and other descriptors for the font. For
  69 + # example:
  70 + # fonts:
  71 + # - family: Schyler
  72 + # fonts:
  73 + # - asset: fonts/Schyler-Regular.ttf
  74 + # - asset: fonts/Schyler-Italic.ttf
  75 + # style: italic
  76 + # - family: Trajan Pro
  77 + # fonts:
  78 + # - asset: fonts/TrajanPro.ttf
  79 + # - asset: fonts/TrajanPro_Bold.ttf
  80 + # weight: 700
  81 + #
  82 + # For details regarding fonts in packages, see
  83 + # https://flutter.dev/custom-fonts/#from-packages