Xcode 6和EZAudio:'AudioUnitSampleType'已弃用,没有AudioPlotGL图

时间:2014-07-09 03:36:02

标签: ios swift deprecated

我正在使用EZAudio在iPhone上录制和播放应用程序,使用Xcode 6 Beta 3和Swift。

此时我已成功编译和部署应用程序,以便在模拟器和设备中进行测试(直到我安装Xcode 6 Beta 3.现在它只能在模拟器中运行。)

Xcode 6为类别中的EZAudio识别了20个警告问题:EZOutput,EZAudioFile和EZAudio,其中包含以下消息:

"'AudioUnitSampleType' is deprecated: The concept of canonical formats is deprecated"
"'kAudioFormatFlagsCanonical' is deprecated: The concept of canonical formats is deprecated"
"'AudioSessionGetProperty' is deprecated: first deprecated in iOS 7.0"
"Apple Mach-O Linker warning: relocatable dylibs (e.g. embedded frameworks) are only supported on iOS 8.0 and later (@rpath/libswift_stdlib_core.dylib)"

编译时,应用程序可以录制声音并进行播放。问题出在现场录音声音图表中。我在ViewController类中添加了一个EZAudioPilotGL变量:

@IBOutlet var audioPlot:EZAudioPlotGL

尺寸:w:320,h:62。查看模式:缩放至填充。

我还在viewDidLoad方法中包含以下行。

self.microphone = EZMicrophone(delegate: self) 
self.audioPlot.backgroundColor = UIColor.clearColor()
self.audioPlot.color = UIColor.orangeColor()
self.audioPlot.plotType = EZPlotType.Rolling
self.audioPlot.opaque = false
self.view.opaque = false
self.audioPlot.shouldFill = true
self.audioPlot.shouldMirror = true

我已将示例项目EZAudioRecordExample中实现的所有方法移植到Swift,包括麦克风方法和audioPlayerDidFinishPlaying方法:

  func microphone(microphone: EZMicrophone, hasAudioReceived buffer: CMutablePointer<Float>, withBufferSize bufferSize: UInt32, withNumberOfChannels numberOfChannels: UInt32) {
    dispatch_async(dispatch_get_main_queue(), {
      println("Updating AudioPlot Buffer")
      self.audioPlot.updateBuffer(buffer, withBufferSize: bufferSize)
      println("bufferSize \(bufferSize)")
    })
  }

  func microphone(microphone: EZMicrophone, hasBufferList bufferList:CMutablePointer<AudioBufferList>, withBufferSize bufferSize:UInt32, withNumberOfChannels numberOfChannels:UInt32){
    println(microphone)
    println(bufferList)
    if (self.isRecording) {
          self.recorder!.appendDataFromBufferList(bufferList, withBufferSize:bufferSize)
        }
  }

  func audioPlayerDidFinishPlaying(player: AVAudioPlayer, successfully flag: Bool) {
    self.isPlaying = false
    togglePlaying()
  }

在录制过程中,AudioPilot仅保持黑色,没有出现图形。

我还验证了正在调用移植的方法。

非常感谢任何解决方案的帮助。

0 个答案:

没有答案