我正在尝试在我的音频引擎上设置一个inputNode用于语音识别的水龙头。以下代码在模拟器中运行良好,但在我iPhone X正在运行的 iOS 13.1.2上运行时则不行。
这是相关的代码:
if (audioEngine == nil || (!audioEngine!.isRunning)) {
print("Setting up audioEngine")
if audioEngine == nil {
audioEngine = AVAudioEngine.init()
}
if(audioEngine!.inputNode.inputFormat(forBus: 0).channelCount == 0){
print("Not enough available inputs!")
}
let recognitionFormat = audioEngine!.inputNode.inputFormat(forBus: 0)
audioEngine!.inputNode.installTap(onBus: 0, bufferSize: 1024, format: recognitionFormat) {
(buffer: AVAudioPCMBuffer, when: AVAudioTime) in
self.recognitionRequest?.append(buffer)
}
audioEngine?.prepare()
try audioEngine?.start()
}
Run Code Online (Sandbox Code Playgroud)
我在模拟器中没有运行错误并且语音识别工作正常。但是,在我的代码上运行时,我得到了以下信息:
Setting up audioEngine
[aurioc] AURemoteIO.cpp:1086:Initialize: failed: -10851 (enable 1, outf< 2 ch, 0 Hz, Float32, non-inter> inf< 2 ch, …Run Code Online (Sandbox Code Playgroud) 我有这个角度材料表,其中包含来自角度材料网站的选择stackblitz。
这个带有选择的表格允许您通过单击复选框和复选框之外但在行内的任何其他空间来选择表格行。
我应该进行哪些更改才能仅通过复选框选择表格行?
有一个类似的问题How to pass selected row value of table to button click event - Material design - Angular 6,但是我没有找到对我的案例有帮助的解决方案。
我正在使用 Angular Material 表来显示我的数据,我在每行数据旁边都选中了复选框。
我想要实现的是用户应该能够选择所需的行,并且在按钮提交时,所有选定的行都将传递到后端进行处理。现在我的方法是当单击复选框时,它将调用(click)="onSelectCheckbox(row)"my 中的一个函数component.ts并将该行附加到一个数组中,当用户取消选择该行时,它将触发相同的函数并将行对象删除.filter()。
如果我以相对正常的速度单击复选框,这工作正常,但是当我以更快的速度反复单击不同的复选框时,逻辑开始出错。在按钮提交时,我的控制台显示被取消选择的行仍在数组中,而被勾选的行不在数组中。
我有这个复选框mat-table:
<ng-container matColumnDef="select">
<th mat-header-cell *matHeaderCellDef>
<mat-checkbox (change)="$event ? masterToggle() : null" [checked]="selection.hasValue() && isAllSelected()"
[indeterminate]="selection.hasValue() && !isAllSelected()" [aria-label]="checkboxLabel()">
</mat-checkbox>
</th>
<td mat-cell *matCellDef="let row">
<mat-checkbox (click)="onSelectCheckbox(row)" (change)="$event ? selection.toggle(row) : null"
[checked]="selection.isSelected(row)" [aria-label]="checkboxLabel(row)">
</mat-checkbox>
</td>
</ng-container>
.
.
.
<button class="btn btn-primary" (click)="openSubmitConfirmation()">Submit</button>
Run Code Online (Sandbox Code Playgroud)
以及 …