如何抑制通过访问“AVAudioEngine”和x27生成的警告;macOS上的“inputNode”
我有以下用于在macOS上获取实时麦克风输入的测试代码:如何抑制通过访问“AVAudioEngine”和x27生成的警告;macOS上的“inputNode”,macos,core-audio,suppress-warnings,avaudioengine,Macos,Core Audio,Suppress Warnings,Avaudioengine,我有以下用于在macOS上获取实时麦克风输入的测试代码: import AVFoundation // for AVAudioEngine class Mic { public let audioEngine = AVAudioEngine() func startRecording() throws { print("- - -") let inputNode = audioEngine.inputNode print
import AVFoundation // for AVAudioEngine
class Mic
{
public let audioEngine = AVAudioEngine()
func startRecording() throws
{
print("- - -")
let inputNode = audioEngine.inputNode
print("- - -")
if inputNode.inputFormat(forBus: 0).sampleRate == 0 {
exit(0);
}
let recordingFormat = inputNode.outputFormat(forBus: 0)
inputNode.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat) { (buffer: AVAudioPCMBuffer, when: AVAudioTime) in
print( "YES! Got some samples!")
}
audioEngine.prepare()
try audioEngine.start()
}
func stopRecording()
{
audioEngine.stop()
}
}
我得到输出:
2019-07-22 16:26:36.773244+0300实时麦克风[8111:540360][plugin]AddInstanceForFactory:没有注册id为F8BB1C28-BAE8-11D6-9C31-00039315CD46的工厂
2019-07-22 16:26:36.803372+0300实时麦克风[8111:540360]HALC_ShellDriverPlugIn::Open:无法获取指向打开例程的指针
2019-07-22 16:26:36.804020+0300实时麦克风[8111:540360]HALC_ShellDriverPlugIn::Open:无法获取指向打开例程的指针
这是否意味着我做错了什么
是否可以阻止这些警告显示在控制台上?我只在Xcode 11 Beta中看到这些警告,它隐藏在die Xcode 10 final中。希望在Xcode 11达到最终版本时,它们也会消失。仍然发生在Xcode 11.1I中,我收到了相同的警告。我甚至没有使用
AVFoundation
framework。我只是在Cocoa
中使用了NSSound
和NSSound.play()。我的应用程序运行良好,所以我想你可以忽略它,这可能是苹果的一个bug。我使用audiotoolbox测试它是否调用了那个警告。事实并非如此。我在这里写道: