RecorderViewController

class RecorderViewController: GeneralUIViewController, AVAudioRecorderDelegate

This GeneralUIViewController controls the Equalizer’s recorder view. It allows the user to prerecord an audio clip if they do not want to use the equalizer in real-time.

Provides audio recording functionality for the equalizer, allowing users to pre-record audio clips for processing.

  • The UIButton to start recording.

    Declaration

    Swift

    @IBOutlet weak var recordButton: UIButton!
  • The UIButton to stop recording.

    Declaration

    Swift

    @IBOutlet weak var stopButton: UIButton!
  • The GeneralUILabel that displays if in record mode.

    Declaration

    Swift

    @IBOutlet weak var recordingLabel: GeneralUILabel!
  • The state of the recorder -> true if recording, false if paused or stopped.

    Declaration

    Swift

    var state: Bool! // This will decide if the button should be a mic or the pause button
  • Hide stopButton and recordingLabel. This must be done since the user should not be able to stop the recording before it even starts.

    Declaration

    Swift

    override func viewWillAppear(_ animated: Bool)
  • Set the state and font of the recordingLabel. Call setupAVAudioSession to initiate the recording process.

    Declaration

    Swift

    override func viewDidLoad()
  • Set the state so that it does not keep getting modified.

    Declaration

    Swift

    override func viewWillDisappear(_ animated: Bool)
  • Ensures that when the recording ends a sucess or failure flag is sent to recordingEnded function.

    Declaration

    Swift

    func audioRecorderDidFinishRecording(_ recorder: AVAudioRecorder, successfully flag: Bool)
  • Toggle the state - this function handles the logic of switching the state as well as toggling the visibility for different views.

    Declaration

    Swift

    @IBAction func toggleRecording(_ sender: UIButton)
  • Stops recording by invoking the AVAudioRecorder's stop method on Audio.sharedInstance.recorder.

    Declaration

    Swift

    @IBAction func stopRecording(_ sender: UIButton)