EqualizerViewController
class EqualizerViewController: GeneralUIViewController
This GeneralUIViewController controls the equalizer view. It allows the user to either stream real time audio from the microphone to the speaker after passing through a dual-channel equalizer. There are a total of 28 VerticalSlider objects that the user can control in order to change the gain at any given frequency.
-
Stack view containing the first set of 14 frequency sliders for the left audio channel. This stack view is organized into two rows via
EqualizerTableViewCell: - Row 0 (highs): 1kHz, 2kHz, 3kHz, 4kHz, 5kHz, 10kHz, 16kHz - Row 1 (lows): 8Hz, 16Hz, 32Hz, 64Hz, 128Hz, 256Hz, 512Hz - Note: Connected to storyboard via Interface Builder - SeeAlso:EqualizerTableViewCellfor individual slider configurationDeclaration
Swift
class EqualizerViewController: GeneralUIViewController -
Stack view containing the first set of 14 frequency sliders for the left audio channel. This stack view is organized into two rows via
EqualizerTableViewCell: - Row 0 (highs): 1kHz, 2kHz, 3kHz, 4kHz, 5kHz, 10kHz, 16kHz - Row 1 (lows): 8Hz, 16Hz, 32Hz, 64Hz, 128Hz, 256Hz, 512Hz - Note: Connected to storyboard via Interface Builder - SeeAlso:EqualizerTableViewCellfor individual slider configuration Stack view containing the second set of 14 frequency sliders for the right audio channel. This stack view mirrorssliderStackView1but controls the right audio channel. The frequency bands are identical to the left channel, allowing independent dual-channel equalization. - Note: Connected to storyboard via Interface Builder - Important: Both channels must be configured identically for mono audio sourcesDeclaration
Swift
class EqualizerViewController: GeneralUIViewController -
This button allows the user to toggle between
RecordandStopmode if in real time, otherwise it will allow toggling betweenPlayandPausemode.Declaration
Swift
@IBOutlet weak var mainButton: UIButton!
-
A flag used to represent if in realTime or if audio clip was recorded on the previous
GeneralUIViewConroller.Declaration
Swift
var realTime: Bool! -
If in
realTime, this flag determines if the class is in record mode or stop mode. If not in realTime, this flag determines if the class is in play mode or pause mode.Declaration
Swift
var state: Bool = true -
Indicates which audio channel is currently being controlled by the sliders. When
true, the sliders control the right channel equalizer bands. Whenfalse, the sliders control the left channel equalizer bands. This allows users to independently adjust gains for each stereo channel.Declaration
Swift
class EqualizerViewController: GeneralUIViewController
-
Set’s the
mainButtonimageView based onrealTime.Declaration
Swift
override func viewWillAppear(_ animated: Bool) -
Remove notification observers when view will disappear.
Declaration
Swift
override func viewWillDisappear(_ animated: Bool) -
Store data from the sliders.
Declaration
Swift
override func viewDidDisappear(_ animated: Bool) -
This function is called as a callback function in the case that the number of channels requested from the tapped input is less than 2.
Declaration
Swift
func failedToGetDesiredNumberOfChannels() -
This function is called every time a
VerticalSliderchanges. It updates the actual gain values within each equalizer.Declaration
Swift
func updateGains() -
This is a callback function to update UIElements after the clip finishes playing.
Declaration
Swift
func finishedPlayingClip()
-
This IBAction is called by
mainButton. Based on realTime and state, it manages setting theimageViewformainButton. As well as changingstatefor future toggles.Declaration
Swift
@IBAction func toggleAudio(_ sender: UIButton)
View on GitHub
EqualizerViewController Class Reference