Created
March 18, 2016 14:37
-
-
Save welbesw/0c5de7793f82d3e14859 to your computer and use it in GitHub Desktop.
Method called by NSTimer to update frequency values from FFT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func timerTick(sender:NSTimer?) { | |
if audioManager.isPlaying() { | |
//Get the frequency data from the audio manager and show on horizontal bar graph | |
var size:UInt32 = 0 | |
let frequencyData = audioManager.guitarFrequencyDataOfLength(&size) | |
let frequencyValuesArray = Array<Float32>(UnsafeBufferPointer(start: UnsafePointer(frequencyData), count: Int(size))) | |
//Sanity check for expected 256 length | |
if frequencyValuesArray.count == 256 { | |
frequencyView.frequncyValues = frequencyValuesArray | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment