AudioPlayerViewController

@interface AudioPlayerViewController : UIViewController <AudioPlayerDelegate>

This class represents a UIView controller for a view showing a vlsualisation for an encapsulated AudioPlayer (an audio player object).

  • An EZAudioFile that will be used to load the audio file at the file path specified

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic) EZAudioFile *audioFile;

    Swift

    var audioFile: EZAudioFile! { get set }
  • An EZAudioPlayer that will be used for playback

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic) AudioPlayer *player;

    Swift

    var player: AudioPlayer! { get set }
  • Parent UIView to which this controller’s view is attached.

    Declaration

    Objective-C

    @property (readwrite, nonatomic) UIView *parentView;
  • A CoreGraphics-based audio plotting UIView

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic) EZAudioPlotGL *audioPlot;

    Swift

    var audioPlot: EZAudioPlotGL! { get set }
  • Audio file URL. A file in the app’s file system

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic) NSString *audioFileURL;

    Swift

    var audioFileURL: String! { get set }
  • This view controller’s delegate (to provide asset playback information callbacks)

    Declaration

    Objective-C

    @property (readwrite, nonatomic) id<AudioPlayerVCDelegate> delegate;

    Swift

    weak var delegate: AudioPlayerVCDelegate! { get set }
  • Initialise SyncAudioPlayerViewController instance with an audio asset and a parent view

    Declaration

    Objective-C

    - (instancetype)initWithAudioFilePath:(NSString *)audioFilePathURL
                               ParentView:(UIView *)parentView;

    Swift

    init!(audioFilePath audioFilePathURL: String!, parentView: Any!)

    Parameters

    audioFilePath

    file path for audio asset

    parentView

    parent UIView object to attach the view that this UIViewController object controls

    Return Value

    instance

  • Initialise SyncAudioPlayerViewController instance with an audio asset, a parent view and a delegate object for receiving callbacks (for playback progress information).

    Declaration

    Objective-C

    - (instancetype)initWithAudioFilePath:(NSString *)audioFilePathURL
                               ParentView:(UIView *)parentView
                                 Delegate:(id<AudioPlayerVCDelegate>)vcdelegate;

    Swift

    init!(audioFilePath audioFilePathURL: String!, parentView: Any!, delegate vcdelegate: AudioPlayerVCDelegate!)

    Parameters

    audioFilePath

    file path for audio asset

    parentView

    parent UIView object to attach the view that this UIViewController object

    vcdelegate

    an object that conforms to AudioPlayerVCDelegate protocol

    Return Value

    instance of AudioPlayerViewController

  • toggle play and pause modes for player.

    Declaration

    Objective-C

    - (void)play;

    Swift

    func play()
  • Stop the encapsulated audio player and remove the UIView from its superview.

    Declaration

    Objective-C

    - (void)stopPlayerAndRemoveView;

    Swift

    func stopPlayerAndRemoveView()
  • Plan an audio file and show visualisation

    Declaration

    Objective-C

    - (void)playAudioFile:(NSString *)filePathURL;

    Swift

    func playAudioFile(_ filePathURL: String!)

    Parameters

    filePathURL

    an NSURL object representing a file path URL

  • Give the visualization of the current buffer (this is almost exactly the openFrameworks audio input example)

    Declaration

    Objective-C

    - (void)drawBufferPlot;

    Swift

    func drawBufferPlot()
  • Give the classic mirrored, rolling waveform look

    Declaration

    Objective-C

    - (void)drawRollingPlot;

    Swift

    func drawRollingPlot()
  • Change visualization: 0 for buffer waveform and 1 for rolling waveform

    Declaration

    Objective-C

    - (void)changePlotType:(NSInteger)plotIndex;

    Swift

    func changePlotType(_ plotIndex: Int)

    Parameters

    plotIndex

    plot style, 0 or 1

  • Cause the internal audio player to seek to new position

    Declaration

    Objective-C

    - (void)seekToTime:(UInt64)timeInMilliSecs;

    Swift

    func seek(toTime timeInMilliSecs: UInt64)

    Parameters

    timeInMilliSecs

    new playhead position