Visualization: Clean up Swift code a bit
Some of this is handled in simpler ways now. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
9dcc434992
commit
fb5c23461d
1 changed files with 3 additions and 24 deletions
|
@ -87,18 +87,8 @@ class VisualizationController : NSObject {
|
||||||
@objc
|
@objc
|
||||||
func copyVisPCM(_ outPCM: UnsafeMutablePointer<Float>?, visFFT: UnsafeMutablePointer<Float>?, latencyOffset: Double) {
|
func copyVisPCM(_ outPCM: UnsafeMutablePointer<Float>?, visFFT: UnsafeMutablePointer<Float>?, latencyOffset: Double) {
|
||||||
if(self.visAudioSize == 0) {
|
if(self.visAudioSize == 0) {
|
||||||
if(outPCM != nil) {
|
outPCM?.update(repeating: 0.0, count: 4096)
|
||||||
let pcmPointer = UnsafeMutableBufferPointer<Float>(start: outPCM, count: 4096)
|
visFFT?.update(repeating: 0.0, count: 2048)
|
||||||
for i in 0...4095 {
|
|
||||||
pcmPointer[i] = 0.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(visFFT != nil) {
|
|
||||||
let fftPointer = UnsafeMutableBufferPointer<Float>(start: visFFT, count: 2048)
|
|
||||||
for i in 0...2047 {
|
|
||||||
fftPointer[i] = 0.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,20 +113,9 @@ class VisualizationController : NSObject {
|
||||||
outPCMCopy[i] = x
|
outPCMCopy[i] = x
|
||||||
j += 1; if j >= k { j = 0 }
|
j += 1; if j >= k { j = 0 }
|
||||||
}
|
}
|
||||||
if(samplesToDo < 4096) {
|
|
||||||
for i in samplesToDo...4095 {
|
|
||||||
outPCMCopy[i] = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(outPCM != nil) {
|
outPCM?.update(from: outPCMCopy, count: 4096)
|
||||||
let pcmPointer = UnsafeMutableBufferPointer<Float>(start: outPCM, count: 4096)
|
|
||||||
for i in 0...4095 {
|
|
||||||
let x = outPCMCopy[i]
|
|
||||||
pcmPointer[i] = x
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(visFFT != nil) {
|
if(visFFT != nil) {
|
||||||
serialQueue.sync {
|
serialQueue.sync {
|
||||||
|
|
Loading…
Reference in a new issue