Replace the silence-emitting render callback from commit 1 with
real playback that drives AudioHandler::fill_buffer and downmixes
its 48 kHz stereo f32 output to the i16 mono buffer VPIO expects.
Pipeline per render callback (mirrors the cpal-output + sdl_output
contracts so the platform-neutral playback path is preserved):
1. Lock the shared Arc<Mutex<AudioHandler>>, ask fill_buffer to
populate a stereo-f32 scratch slice of length 2*num_frames.
AudioHandler runs Opus decode + per-client jitter buffer + mix
internally. Same primitive every other platform calls.
2. If output_muted is true, zero the i16 output buffer and return.
We still ran fill_buffer in step 1 so the jitter buffer drains
while muted — preventing unbounded growth — which matches the
cpal/SDL backend contract.
3. Downmix stereo -> mono with master gain:
mono_f32 = (l + r) * 0.5 * gain
i16_out = (mono_f32.clamp(-1.0, 1.0) * i16::MAX) as i16
The 0.5 average preserves total signal energy with 3 dB
headroom against sum-of-correlated-peaks clipping. Multiply by
gain after the downmix saves one mul per sample. Hard-clip on
the i16 cast is acceptable because the upstream stereo signal
is already in [-1.0, 1.0] from the f32 mix; only gain >1.0
creates clipping pressure and that path is identical to every
other backend's i16 conversion.
Closure ownership:
* scratch_stereo: Vec<f32> moved into the FnMut closure. First
callback grows it to 2*num_frames; subsequent callbacks reuse
the backing allocation. The audio thread never hits the
allocator on steady-state callbacks.
* handler_for_render / output_gain_for_render / output_muted_for_render
are Arc clones taken before the closure literal.
Public API change: AudioEngine -> IosVoiceUnit::start parameters
that were previously underscored (commit 1 placeholder) are now
all consumed by the wiring. Signature is unchanged, just the
binder names lose the leading underscore. engine.rs call-site
is unaffected.
Build verify on Mac (target aarch64-apple-ios): cargo check
clean in 0.33s, no errors, no warnings.
Build counter 63 -> 64 — About dialog shows v1.0.0-rc.8+64.
138 lines
6.0 KiB
YAML
138 lines
6.0 KiB
YAML
name: chanora_flutter
|
|
description: "Chanora — cross-platform voice client for TeamSpeak-compatible servers."
|
|
# The following line prevents the package from being accidentally published to
|
|
# pub.dev using `flutter pub publish`. This is preferred for private packages.
|
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|
|
|
# The following defines the version and build number for your application.
|
|
# A version number is three numbers separated by dots, like 1.2.43
|
|
# followed by an optional build number separated by a +.
|
|
# Both the version and the builder number may be overridden in flutter
|
|
# build by specifying --build-name and --build-number, respectively.
|
|
# In Android, build-name is used as versionName while build-number used as versionCode.
|
|
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
|
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
|
|
# Read more about iOS versioning at
|
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
|
# In Windows, build-name is used as the major, minor, and patch parts
|
|
# of the product and file versions while build-number is used as the build suffix.
|
|
version: 1.0.0-rc.8+64
|
|
|
|
environment:
|
|
sdk: ^3.11.5
|
|
|
|
# Dependencies specify other packages that your package needs in order to work.
|
|
# To automatically upgrade your package dependencies to the latest versions
|
|
# consider running `flutter pub upgrade --major-versions`. Alternatively,
|
|
# dependencies can be manually updated by changing the version numbers below to
|
|
# the latest version available on pub.dev. To see which dependencies have newer
|
|
# versions available, run `flutter pub outdated`.
|
|
dependencies:
|
|
flutter:
|
|
sdk: flutter
|
|
flutter_localizations:
|
|
sdk: flutter
|
|
intl: any
|
|
|
|
# The following adds the Cupertino Icons font to your application.
|
|
# Use with the CupertinoIcons class for iOS style icons.
|
|
cupertino_icons: ^1.0.8
|
|
flutter_rust_bridge: 2.12.0
|
|
freezed_annotation: ^3.1.0
|
|
connectivity_plus: ^6.1.0
|
|
path_provider: ^2.1.4
|
|
# audio_session 0.2.3 (MIT, Ryan Heise, 865k downloads) gives us
|
|
# programmatic access to AVAudioSession on iOS + AudioManager on
|
|
# Android. We use:
|
|
#
|
|
# * AVAudioSession.availableInputs \u2014 enumerate real input ports
|
|
# (Built-in Mic, Bluetooth HFP, wired headset, USB).
|
|
# * AVAudioSession.currentRoute \u2014 inputs + outputs of the
|
|
# active route.
|
|
# * AVAudioSession.setPreferredInput(port) \u2014 switch input
|
|
# (also drives matching output for HFP devices).
|
|
# * AVAudioSession.overrideOutputAudioPort(speaker|none) \u2014
|
|
# toggle the built-in receiver/earpiece vs speakerphone.
|
|
# * AVAudioSession.routeChangeStream \u2014 live notifications when
|
|
# the user plugs / unplugs / connects a device.
|
|
#
|
|
# This is the right primitive for a VoIP-style 'pick speaker /
|
|
# receiver / AirPods / wired' picker. Discord, WhatsApp, FaceTime
|
|
# all do exactly this. We previously tried audio_router 1.1.1
|
|
# whose iOS path is AVRoutePickerView (the AirPlay button) \u2014 the
|
|
# wrong UI: only lists AirPlay output destinations, not the
|
|
# speaker/receiver/Bluetooth choices we actually want.
|
|
audio_session: ^0.2.3
|
|
# package_info_plus 8.x (Flutter Community Plus, BSD-3, ~3M
|
|
# downloads) exposes the platform-canonical app version + build
|
|
# number at runtime so the About dialog (and any future
|
|
# diagnostic export) can display "v1.0.0-rc.8+60" sourced from
|
|
# the SAME pubspec.yaml field that drives CFBundleShortVersionString
|
|
# + CFBundleVersion on iOS and versionName + versionCode on
|
|
# Android. Single source of truth means the version on the
|
|
# iPhone screen always matches the commit that built it; no
|
|
# more "am I testing the right build?" question during the
|
|
# iOS audio test cycle.
|
|
package_info_plus: ^8.0.0
|
|
|
|
dev_dependencies:
|
|
flutter_test:
|
|
sdk: flutter
|
|
|
|
# The "flutter_lints" package below contains a set of recommended lints to
|
|
# encourage good coding practices. The lint set provided by the package is
|
|
# activated in the `analysis_options.yaml` file located at the root of your
|
|
# package. See that file for information about deactivating specific lint
|
|
# rules and activating additional ones.
|
|
flutter_lints: ^6.0.0
|
|
freezed: ^3.2.5
|
|
build_runner: ^2.15.0
|
|
|
|
# For information on the generic Dart part of this file, see the
|
|
# following page: https://dart.dev/tools/pub/pubspec
|
|
|
|
# The following section is specific to Flutter packages.
|
|
flutter:
|
|
|
|
# Generate localization bindings from lib/l10n/*.arb at build time.
|
|
# Per DEC-015 (register v0.9.5) Chanora ships English + Chinese
|
|
# Simplified at MVP with an i18n-ready architecture for additional
|
|
# languages.
|
|
generate: true
|
|
|
|
# The following line ensures that the Material Icons font is
|
|
# included with your application, so that you can use the icons in
|
|
# the material Icons class.
|
|
uses-material-design: true
|
|
|
|
# To add assets to your application, add an assets section, like this:
|
|
# assets:
|
|
# - images/a_dot_burr.jpeg
|
|
# - images/a_dot_ham.jpeg
|
|
|
|
# An image asset can refer to one or more resolution-specific "variants", see
|
|
# https://flutter.dev/to/resolution-aware-images
|
|
|
|
# For details regarding adding assets from package dependencies, see
|
|
# https://flutter.dev/to/asset-from-package
|
|
|
|
# To add custom fonts to your application, add a fonts section here,
|
|
# in this "flutter" section. Each entry in this list should have a
|
|
# "family" key with the font family name, and a "fonts" key with a
|
|
# list giving the asset and other descriptors for the font. For
|
|
# example:
|
|
# fonts:
|
|
# - family: Schyler
|
|
# fonts:
|
|
# - asset: fonts/Schyler-Regular.ttf
|
|
# - asset: fonts/Schyler-Italic.ttf
|
|
# style: italic
|
|
# - family: Trajan Pro
|
|
# fonts:
|
|
# - asset: fonts/TrajanPro.ttf
|
|
# - asset: fonts/TrajanPro_Bold.ttf
|
|
# weight: 700
|
|
#
|
|
# For details regarding fonts from package dependencies,
|
|
# see https://flutter.dev/to/font-from-package
|