EZAudioFileDelegate
@protocol EZAudioFileDelegate <NSObject>
The EZAudioFileDelegate provides event callbacks for the EZAudioFile object. These type of events are triggered by reads and seeks on the file and gives feedback such as the audio data read as a float array for visualizations and the new seek position for UI updating.
-
Triggered from the EZAudioFile function
readFrames:audioBufferList:bufferSize:eof:
to notify the delegate of the read audio data as a float array instead of a buffer list. Common use case of this would be to visualize the float data using an audio plot or audio data dependent OpenGL sketch. - parameter: audioFile The instance of the EZAudioFile that triggered the event. - parameter: buffer A float array of float arrays holding the audio data. buffer[0] would be the left channel’s float array while buffer[1] would be the right channel’s float array in a stereo file. - parameter: bufferSize The length of the buffers float arrays - parameter: numberOfChannels The number of channels. 2 for stereo, 1 for mono.Declaration
Objective-C
- (void)audioFile:(EZAudioFile *)audioFile readAudio:(float **)buffer withBufferSize:(UInt32)bufferSize withNumberOfChannels:(UInt32)numberOfChannels;
Swift
optional func audioFile(_ audioFile: EZAudioFile!, readAudio buffer: UnsafeMutablePointer
Parameters
audioFile
The instance of the EZAudioFile that triggered the event.
buffer
A float array of float arrays holding the audio data. buffer[0] would be the left channel’s float array while buffer[1] would be the right channel’s float array in a stereo file.
bufferSize
The length of the buffers float arrays
numberOfChannels
The number of channels. 2 for stereo, 1 for mono.
-
Occurs when the audio file’s internal seek position has been updated by the EZAudioFile functions
readFrames:audioBufferList:bufferSize:eof:
oraudioFile:updatedPosition:
. As of 0.8.0 this is the preferred method of listening for position updates on the audio file since a user may want the pull the currentTime, formattedCurrentTime, or the frame index from the EZAudioFile instance provided. - parameter: audioFile The instance of the EZAudio in which the change occured.Declaration
Objective-C
- (void)audioFileUpdatedPosition:(EZAudioFile *)audioFile;
Swift
optional func audioFileUpdatedPosition(_ audioFile: EZAudioFile!)
Parameters
audioFile
The instance of the EZAudio in which the change occured.
-
Occurs when the audio file’s internal seek position has been updated by the EZAudioFile functions
readFrames:audioBufferList:bufferSize:eof:
oraudioFile:updatedPosition:
. - parameter: audioFile The instance of the EZAudio in which the change occured - parameter: framePosition The new frame index as a 64-bit signed integer @deprecated This property is deprecated starting in version 0.8.0. - note: Please useaudioFileUpdatedPosition:
property instead.Declaration
Objective-C
- (void)audioFile:(EZAudioFile *)audioFile updatedPosition:(SInt64)framePosition;
Swift
optional func audioFile(_ audioFile: EZAudioFile!, updatedPosition framePosition: Int64)
Parameters
audioFile
The instance of the EZAudio in which the change occured
framePosition
The new frame index as a 64-bit signed integer