Commit 539eca4
feat: banner when a Bluetooth mic pairs + fix silent BT mic level meter (#38)
Two related pieces of Bluetooth-mic UX in the streaming flow.
Banner: AudioInputProvider now diffs the Bluetooth input set on each route
change and fires onBluetoothConnected only for devices that *arrive* mid-session
(already-connected devices at launch just seed the baseline, so no false
positive). The provider is hoisted from SettingsView into ContentView so its
AVAudioSession.routeChangeNotification observer runs for the whole app lifetime,
not just while the Settings sheet is open; both screens now share one instance.
A transient glass banner slides in on the main streaming screen ("<name>
connected"), stacked under the LIVE pill, and auto-dismisses after 3s.
Fix: the Settings mic-level meter read silent for a Bluetooth mic even when the
engine was correctly routed to it (confirmed on device: route=[DJI Mic 3/
BluetoothHFP] 16kHz, yet flat). Two causes:
- A tap alone does not reliably pull a Bluetooth HFP input — the engine only
renders its input when the graph drives an output. The input node is now
routed through the main mixer (output muted) to force a full I/O cycle so the
tap receives real samples.
- There was no AVAudioEngineConfigurationChange observer, so if the HFP link
settled asynchronously after setPreferredInput the tap stayed bound to the
stale (built-in) format and went silent. Tap installation is split into a
reusable installMeterTap() that the new observer re-runs on reconfiguration;
the observer is torn down in stopLocalCapture.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 6b6e999 commit 539eca4
3 files changed
Lines changed: 183 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
41 | 53 | | |
42 | 54 | | |
43 | 55 | | |
| |||
117 | 129 | | |
118 | 130 | | |
119 | 131 | | |
120 | | - | |
| 132 | + | |
121 | 133 | | |
122 | 134 | | |
123 | 135 | | |
| |||
126 | 138 | | |
127 | 139 | | |
128 | 140 | | |
129 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
130 | 145 | | |
131 | 146 | | |
132 | 147 | | |
| |||
139 | 154 | | |
140 | 155 | | |
141 | 156 | | |
142 | | - | |
| 157 | + | |
143 | 158 | | |
144 | 159 | | |
145 | | - | |
| 160 | + | |
146 | 161 | | |
147 | 162 | | |
148 | 163 | | |
| |||
152 | 167 | | |
153 | 168 | | |
154 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
155 | 179 | | |
156 | 180 | | |
157 | 181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
4 | 12 | | |
5 | 13 | | |
6 | 14 | | |
| |||
18 | 26 | | |
19 | 27 | | |
20 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
21 | 40 | | |
22 | 41 | | |
23 | 42 | | |
| |||
59 | 78 | | |
60 | 79 | | |
61 | 80 | | |
62 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
63 | 88 | | |
64 | 89 | | |
| 90 | + | |
65 | 91 | | |
66 | 92 | | |
67 | 93 | | |
| |||
83 | 109 | | |
84 | 110 | | |
85 | 111 | | |
86 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
87 | 133 | | |
88 | 134 | | |
89 | 135 | | |
| |||
170 | 216 | | |
171 | 217 | | |
172 | 218 | | |
173 | | - | |
174 | 219 | | |
175 | 220 | | |
176 | 221 | | |
| |||
179 | 224 | | |
180 | 225 | | |
181 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
182 | 250 | | |
183 | 251 | | |
184 | 252 | | |
| |||
224 | 292 | | |
225 | 293 | | |
226 | 294 | | |
227 | | - | |
| 295 | + | |
228 | 296 | | |
229 | 297 | | |
230 | 298 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| |||
889 | 891 | | |
890 | 892 | | |
891 | 893 | | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
892 | 901 | | |
893 | 902 | | |
894 | 903 | | |
| |||
994 | 1003 | | |
995 | 1004 | | |
996 | 1005 | | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
997 | 1042 | | |
998 | 1043 | | |
999 | | - | |
| 1044 | + | |
1000 | 1045 | | |
1001 | 1046 | | |
1002 | 1047 | | |
| |||
1016 | 1061 | | |
1017 | 1062 | | |
1018 | 1063 | | |
1019 | | - | |
| 1064 | + | |
1020 | 1065 | | |
1021 | | - | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
1027 | 1074 | | |
1028 | | - | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
1029 | 1083 | | |
1030 | | - | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
1031 | 1096 | | |
1032 | 1097 | | |
1033 | | - | |
| 1098 | + | |
| 1099 | + | |
1034 | 1100 | | |
1035 | 1101 | | |
1036 | 1102 | | |
| |||
1039 | 1105 | | |
1040 | 1106 | | |
1041 | 1107 | | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
1042 | 1112 | | |
1043 | 1113 | | |
1044 | 1114 | | |
| |||
1159 | 1229 | | |
1160 | 1230 | | |
1161 | 1231 | | |
1162 | | - | |
| 1232 | + | |
1163 | 1233 | | |
1164 | 1234 | | |
0 commit comments