AnthonyR
AnthonyR

Reputation: 3545

iOS Audio Kit : Stop drawing a Node in a plot

I'm following the Microphone Analysis in the examples of AudioKit here :

http://audiokit.io/examples/MicrophoneAnalysis/

The plot displays the audio wave forms in loop.

I want to stop drawing inside the plot when I tap a button, but I don't know how to tell to the plot to stop drawing the microphone inputs.

This is my plot configuration :

func setupPlot() {
    plot = AKNodeOutputPlot(microphone, frame: audioInputPlot.bounds)
    plot.plotType = .rolling
    plot.shouldFill = true
    plot.shouldMirror = true
    plot.color = UIColor(red:0.24, green:1.00, blue:0.08, alpha:1.0)
    plot.alpha = 0.0
    plot.setRollingHistoryLength(200)
}

Upvotes: 1

Views: 339

Answers (2)

Michael Andorfer
Michael Andorfer

Reputation: 1800

you can stop drawing using:

plot.pause()

and resume drawing using:

plot.resume()

Upvotes: 0

Tony
Tony

Reputation: 664

try setting plot.node = nil this stops the plot from receiving any inputs from the mic.

Upvotes: 1

Related Questions