EZAudioUtilities

@interface EZAudioUtilities : NSObject

The EZAudioUtilities class provides a set of class-level utility methods used throughout EZAudio to handle common operations such as allocating audio buffers and structures, creating various types of AudioStreamBasicDescription structures, string helpers for formatting and debugging, various math utilities, a very handy check result function (used everywhere!), and helpers for dealing with circular buffers. These were previously on the EZAudio class, but as of the 0.1.0 release have been moved here so the whole EZAudio is not needed when using only certain modules.

  • Globally sets whether or not the program should exit if a checkResult:operation: operation fails. Currently the behavior on EZAudio is to quit if a checkResult:operation: fails, but this is not desirable in any production environment. Internally there are a lot of checkResult:operation: operations used on all the core classes. This should only ever be set to NO in production environments since a checkResult:operation: failing means something breaking has likely happened. - parameter: shouldExitOnCheckResultFail A BOOL indicating whether or not the running program should exist due to a checkResult:operation: fail.

    Declaration

    Objective-C

    + (void)setShouldExitOnCheckResultFail:(BOOL)shouldExitOnCheckResultFail;

    Swift

    class func setShouldExitOnCheckResultFail(_ shouldExitOnCheckResultFail: Bool)

    Parameters

    shouldExitOnCheckResultFail

    A BOOL indicating whether or not the running program should exist due to a checkResult:operation: fail.

  • Provides a flag indicating whether or not the program will exit if a checkResult:operation: fails. - returns: A BOOL indicating whether or not the program will exit if a checkResult:operation: fails.

    Declaration

    Objective-C

    + (BOOL)shouldExitOnCheckResultFail;

    Swift

    class func shouldExitOnCheckResultFail() -> Bool

    Return Value

    A BOOL indicating whether or not the program will exit if a checkResult:operation: fails.

  • Allocates an AudioBufferList structure. Make sure to call freeBufferList when done using AudioBufferList or it will leak. - parameter: frames The number of frames that will be stored within each audio buffer - parameter: channels The number of channels (e.g. 2 for stereo, 1 for mono, etc.) - parameter: interleaved Whether the samples will be interleaved (if not it will be assumed to be non-interleaved and each channel will have an AudioBuffer allocated) - returns: An AudioBufferList struct that has been allocated in memory

    Declaration

    Objective-C

    + (AudioBufferList *)audioBufferListWithNumberOfFrames:(UInt32)frames
                                          numberOfChannels:(UInt32)channels
                                               interleaved:(BOOL)interleaved;

    Swift

    class func audioBufferList(withNumberOfFrames frames: UInt32, numberOfChannels channels: UInt32, interleaved: Bool) -> UnsafeMutablePointer

    Parameters

    frames

    The number of frames that will be stored within each audio buffer

    channels

    The number of channels (e.g. 2 for stereo, 1 for mono, etc.)

    interleaved

    Whether the samples will be interleaved (if not it will be assumed to be non-interleaved and each channel will have an AudioBuffer allocated)

    Return Value

    An AudioBufferList struct that has been allocated in memory

  • Allocates an array of float arrays given the number of frames needed to store in each float array. - parameter: frames A UInt32 representing the number of frames to store in each float buffer - parameter: channels A UInt32 representing the number of channels (i.e. the number of float arrays to allocate) - returns: An array of float arrays, each the length of the number of frames specified

    Declaration

    Objective-C

    + (float **)floatBuffersWithNumberOfFrames:(UInt32)frames
                              numberOfChannels:(UInt32)channels;

    Swift

    class func floatBuffers(withNumberOfFrames frames: UInt32, numberOfChannels channels: UInt32) -> UnsafeMutablePointer

    Parameters

    frames

    A UInt32 representing the number of frames to store in each float buffer

    channels

    A UInt32 representing the number of channels (i.e. the number of float arrays to allocate)

    Return Value

    An array of float arrays, each the length of the number of frames specified

  • Deallocates an AudioBufferList structure from memory. - parameter: bufferList A pointer to the buffer list you would like to free

    Declaration

    Objective-C

    + (void)freeBufferList:(AudioBufferList *)bufferList;

    Swift

    class func freeBufferList(_ bufferList: UnsafeMutablePointer

    Parameters

    bufferList

    A pointer to the buffer list you would like to free

  • Deallocates an array of float buffers - parameter: buffers An array of float arrays - parameter: channels A UInt32 representing the number of channels (i.e. the number of float arrays to deallocate)

    Declaration

    Objective-C

    + (void)freeFloatBuffers:(float **)buffers numberOfChannels:(UInt32)channels;

    Swift

    class func freeFloatBuffers(_ buffers: UnsafeMutablePointer

    Parameters

    buffers

    An array of float arrays

    channels

    A UInt32 representing the number of channels (i.e. the number of float arrays to deallocate)

  • Creates a signed-integer, interleaved AudioStreamBasicDescription for the number of channels specified for an AIFF format. - parameter: channels The desired number of channels - parameter: sampleRate A float representing the sample rate. - returns: A new AudioStreamBasicDescription with the specified format.

    Declaration

    Objective-C

    + (AudioStreamBasicDescription)AIFFFormatWithNumberOfChannels:(UInt32)channels
                                                       sampleRate:(float)sampleRate;

    Swift

    class func aiffFormat(withNumberOfChannels channels: UInt32, sampleRate: Float) -> AudioStreamBasicDescription

    Parameters

    channels

    The desired number of channels

    sampleRate

    A float representing the sample rate.

    Return Value

    A new AudioStreamBasicDescription with the specified format.

  • Creates an AudioStreamBasicDescription for the iLBC narrow band speech codec. - parameter: sampleRate A float representing the sample rate. - returns: A new AudioStreamBasicDescription with the specified format.

    Declaration

    Objective-C

    + (AudioStreamBasicDescription)iLBCFormatWithSampleRate:(float)sampleRate;

    Swift

    class func iLBCFormat(withSampleRate sampleRate: Float) -> AudioStreamBasicDescription

    Parameters

    sampleRate

    A float representing the sample rate.

    Return Value

    A new AudioStreamBasicDescription with the specified format.

  • Creates a float-based, non-interleaved AudioStreamBasicDescription for the number of channels specified. - parameter: channels A UInt32 representing the number of channels. - parameter: sampleRate A float representing the sample rate. - returns: A float-based AudioStreamBasicDescription with the number of channels specified.

    Declaration

    Objective-C

    + (AudioStreamBasicDescription)floatFormatWithNumberOfChannels:(UInt32)channels
                                                        sampleRate:
                                                            (float)sampleRate;

    Swift

    class func floatFormat(withNumberOfChannels channels: UInt32, sampleRate: Float) -> AudioStreamBasicDescription

    Parameters

    channels

    A UInt32 representing the number of channels.

    sampleRate

    A float representing the sample rate.

    Return Value

    A float-based AudioStreamBasicDescription with the number of channels specified.

  • Creates an AudioStreamBasicDescription for an M4A AAC format. - parameter: channels The desired number of channels - parameter: sampleRate A float representing the sample rate. - returns: A new AudioStreamBasicDescription with the specified format.

    Declaration

    Objective-C

    + (AudioStreamBasicDescription)M4AFormatWithNumberOfChannels:(UInt32)channels
                                                      sampleRate:(float)sampleRate;

    Swift

    class func m4AFormat(withNumberOfChannels channels: UInt32, sampleRate: Float) -> AudioStreamBasicDescription

    Parameters

    channels

    The desired number of channels

    sampleRate

    A float representing the sample rate.

    Return Value

    A new AudioStreamBasicDescription with the specified format.

  • Creates a single-channel, float-based AudioStreamBasicDescription. - parameter: sampleRate A float representing the sample rate. - returns: A new AudioStreamBasicDescription with the specified format.

    Declaration

    Objective-C

    + (AudioStreamBasicDescription)monoFloatFormatWithSampleRate:(float)sampleRate;

    Swift

    class func monoFloatFormat(withSampleRate sampleRate: Float) -> AudioStreamBasicDescription

    Parameters

    sampleRate

    A float representing the sample rate.

    Return Value

    A new AudioStreamBasicDescription with the specified format.

  • Creates a single-channel, float-based AudioStreamBasicDescription (as of 0.0.6 this is the same as monoFloatFormatWithSampleRate:). - parameter: sampleRate A float representing the sample rate. - returns: A new AudioStreamBasicDescription with the specified format.

    Declaration

    Objective-C

    + (AudioStreamBasicDescription)monoCanonicalFormatWithSampleRate:
        (float)sampleRate;

    Swift

    class func monoCanonicalFormat(withSampleRate sampleRate: Float) -> AudioStreamBasicDescription

    Parameters

    sampleRate

    A float representing the sample rate.

    Return Value

    A new AudioStreamBasicDescription with the specified format.

  • Creates a two-channel, non-interleaved, float-based AudioStreamBasicDescription (as of 0.0.6 this is the same as stereoFloatNonInterleavedFormatWithSampleRate:). - parameter: sampleRate A float representing the sample rate. - returns: A new AudioStreamBasicDescription with the specified format.

    Declaration

    Objective-C

    + (AudioStreamBasicDescription)
    stereoCanonicalNonInterleavedFormatWithSampleRate:(float)sampleRate;

    Swift

    class func stereoCanonicalNonInterleavedFormat(withSampleRate sampleRate: Float) -> AudioStreamBasicDescription

    Parameters

    sampleRate

    A float representing the sample rate.

    Return Value

    A new AudioStreamBasicDescription with the specified format.

  • Creates a two-channel, interleaved, float-based AudioStreamBasicDescription. - parameter: sampleRate A float representing the sample rate. - returns: A new AudioStreamBasicDescription with the specified format.

    Declaration

    Objective-C

    + (AudioStreamBasicDescription)stereoFloatInterleavedFormatWithSampleRate:
        (float)sampleRate;

    Swift

    class func stereoFloatInterleavedFormat(withSampleRate sampleRate: Float) -> AudioStreamBasicDescription

    Parameters

    sampleRate

    A float representing the sample rate.

    Return Value

    A new AudioStreamBasicDescription with the specified format.

  • Creates a two-channel, non-interleaved, float-based AudioStreamBasicDescription. - parameter: sampleRate A float representing the sample rate. - returns: A new AudioStreamBasicDescription with the specified format.

    Declaration

    Objective-C

    + (AudioStreamBasicDescription)stereoFloatNonInterleavedFormatWithSampleRate:
        (float)sampleRate;

    Swift

    class func stereoFloatNonInterleavedFormat(withSampleRate sampleRate: Float) -> AudioStreamBasicDescription

    Parameters

    sampleRate

    A float representing the sample rate.

    Return Value

    A new AudioStreamBasicDescription with the specified format.

  • Checks an AudioStreamBasicDescription to see if it is a float-based format (as opposed to a signed integer based format). - parameter: asbd A valid AudioStreamBasicDescription - returns: A BOOL indicating whether or not the AudioStreamBasicDescription is a float format.

    Declaration

    Objective-C

    + (BOOL)isFloatFormat:(AudioStreamBasicDescription)asbd;

    Swift

    class func isFloatFormat(_ asbd: AudioStreamBasicDescription) -> Bool

    Parameters

    asbd

    A valid AudioStreamBasicDescription

    Return Value

    A BOOL indicating whether or not the AudioStreamBasicDescription is a float format.

  • Checks an AudioStreamBasicDescription to check for an interleaved flag (samples are stored in one buffer one after another instead of two (or n channels) parallel buffers - parameter: asbd A valid AudioStreamBasicDescription - returns: A BOOL indicating whether or not the AudioStreamBasicDescription is interleaved

    Declaration

    Objective-C

    + (BOOL)isInterleaved:(AudioStreamBasicDescription)asbd;

    Swift

    class func isInterleaved(_ asbd: AudioStreamBasicDescription) -> Bool

    Parameters

    asbd

    A valid AudioStreamBasicDescription

    Return Value

    A BOOL indicating whether or not the AudioStreamBasicDescription is interleaved

  • Checks an AudioStreamBasicDescription to see if it is a linear PCM format (uncompressed, 1 frame per packet) - parameter: asbd A valid AudioStreamBasicDescription - returns: A BOOL indicating whether or not the AudioStreamBasicDescription is linear PCM.

    Declaration

    Objective-C

    + (BOOL)isLinearPCM:(AudioStreamBasicDescription)asbd;

    Swift

    class func isLinearPCM(_ asbd: AudioStreamBasicDescription) -> Bool

    Parameters

    asbd

    A valid AudioStreamBasicDescription

    Return Value

    A BOOL indicating whether or not the AudioStreamBasicDescription is linear PCM.

  • Nicely logs out the contents of an AudioStreamBasicDescription struct - parameter: asbd The AudioStreamBasicDescription struct with content to print out

    Declaration

    Objective-C

    + (void)printASBD:(AudioStreamBasicDescription)asbd;

    Swift

    class func printASBD(_ asbd: AudioStreamBasicDescription)

    Parameters

    asbd

    The AudioStreamBasicDescription struct with content to print out

  • Converts seconds into a string formatted as MM:SS - parameter: seconds An NSTimeInterval representing the number of seconds - returns: An NSString instance formatted as MM:SS from the seconds provided.

    Declaration

    Objective-C

    + (NSString *)displayTimeStringFromSeconds:(NSTimeInterval)seconds;

    Swift

    class func displayTimeString(fromSeconds seconds: TimeInterval) -> String!

    Parameters

    seconds

    An NSTimeInterval representing the number of seconds

    Return Value

    An NSString instance formatted as MM:SS from the seconds provided.

  • Creates a string to use when logging out the contents of an AudioStreamBasicDescription - parameter: asbd A valid AudioStreamBasicDescription struct. - returns: An NSString representing the contents of the AudioStreamBasicDescription.

    Declaration

    Objective-C

    + (NSString *)stringForAudioStreamBasicDescription:
        (AudioStreamBasicDescription)asbd;

    Swift

    class func string(for asbd: AudioStreamBasicDescription) -> String!

    Parameters

    asbd

    A valid AudioStreamBasicDescription struct.

    Return Value

    An NSString representing the contents of the AudioStreamBasicDescription.

  • Just a wrapper around the setCanonical function provided in the Core Audio Utility C++ class. - parameter: asbd The AudioStreamBasicDescription structure to modify - parameter: nChannels The number of expected channels on the description - parameter: interleaved A flag indicating whether the stereo samples should be interleaved in the buffer

    Declaration

    Objective-C

    + (void)setCanonicalAudioStreamBasicDescription:
                (AudioStreamBasicDescription *)asbd
                                   numberOfChannels:(UInt32)nChannels
                                        interleaved:(BOOL)interleaved;

    Swift

    class func setCanonicalAudioStreamBasicDescription(_ asbd: UnsafeMutablePointer

    Parameters

    asbd

    The AudioStreamBasicDescription structure to modify

    nChannels

    The number of expected channels on the description

    interleaved

    A flag indicating whether the stereo samples should be interleaved in the buffer

  • Appends an array of values to a history buffer and performs an internal shift to add the values to the tail and removes the same number of values from the head. - parameter: buffer A float array of values to append to the tail of the history buffer - parameter: bufferLength The length of the float array being appended to the history buffer - parameter: scrollHistory The target history buffer in which to append the values - parameter: scrollHistoryLength The length of the target history buffer

    Declaration

    Objective-C

    + (void)appendBufferAndShift:(float *)buffer
                  withBufferSize:(int)bufferLength
                 toScrollHistory:(float *)scrollHistory
           withScrollHistorySize:(int)scrollHistoryLength;

    Swift

    class func appendBufferAndShift(_ buffer: UnsafeMutablePointer

    Parameters

    buffer

    A float array of values to append to the tail of the history buffer

    bufferLength

    The length of the float array being appended to the history buffer

    scrollHistory

    The target history buffer in which to append the values

    scrollHistoryLength

    The length of the target history buffer

  • Appends a value to a history buffer and performs an internal shift to add the value to the tail and remove the 0th value. - parameter: value The float value to append to the history array - parameter: scrollHistory The target history buffer in which to append the values - parameter: scrollHistoryLength The length of the target history buffer

    Declaration

    Objective-C

    + (void)appendValue:(float)value
              toScrollHistory:(float *)scrollHistory
        withScrollHistorySize:(int)scrollHistoryLength;

    Swift

    class func appendValue(_ value: Float, toScrollHistory scrollHistory: UnsafeMutablePointer

    Parameters

    value

    The float value to append to the history array

    scrollHistory

    The target history buffer in which to append the values

    scrollHistoryLength

    The length of the target history buffer

  • Maps a value from one coordinate system into another one. Takes in the current value to map, the minimum and maximum values of the first coordinate system, and the minimum and maximum values of the second coordinate system and calculates the mapped value in the second coordinate system’s constraints. - parameter: value The value expressed in the first coordinate system - parameter: leftMin The minimum of the first coordinate system - parameter: leftMax The maximum of the first coordinate system - parameter: rightMin The minimum of the second coordindate system - parameter: rightMax The maximum of the second coordinate system @return The mapped value in terms of the second coordinate system

    Declaration

    Objective-C

    + (float)MAP:(float)value
         leftMin:(float)leftMin
         leftMax:(float)leftMax
        rightMin:(float)rightMin
        rightMax:(float)rightMax;

    Swift

    class func map(_ value: Float, leftMin: Float, leftMax: Float, rightMin: Float, rightMax: Float) -> Float

    Parameters

    value

    The value expressed in the first coordinate system

    leftMin

    The minimum of the first coordinate system

    leftMax

    The maximum of the first coordinate system

    rightMin

    The minimum of the second coordindate system

    rightMax

    The maximum of the second coordinate system

    Return Value

    The mapped value in terms of the second coordinate system

  • Calculates the root mean squared for a buffer. - parameter: buffer A float buffer array of values whose root mean squared to calculate - parameter: bufferSize The size of the float buffer @return The root mean squared of the buffer

    Declaration

    Objective-C

    + (float)RMS:(float *)buffer length:(int)bufferSize;

    Swift

    class func rms(_ buffer: UnsafeMutablePointer

    Parameters

    buffer

    A float buffer array of values whose root mean squared to calculate

    bufferSize

    The size of the float buffer

    Return Value

    The root mean squared of the buffer

  • Calculate the sign function sgn(x) = { -1 , x < 0, { 0 , x = 0, { 1 , x > 0 - parameter: value The float value for which to use as x - returns: The float sign value

    Declaration

    Objective-C

    + (float)SGN:(float)value;

    Swift

    class func sgn(_ value: Float) -> Float

    Parameters

    value

    The float value for which to use as x

    Return Value

    The float sign value

  • Basic check result function useful for checking each step of the audio setup process - parameter: result The OSStatus representing the result of an operation - parameter: operation A string (const char, not NSString) describing the operation taking place (will print if fails)

    Declaration

    Objective-C

    + (void)checkResult:(OSStatus)result operation:(const char *)operation;

    Swift

    class func checkResult(_ result: OSStatus, operation: UnsafePointer

    Parameters

    result

    The OSStatus representing the result of an operation

    operation

    A string (const char, not NSString) describing the operation taking place (will print if fails)

  • Provides a string representation of the often cryptic Core Audio error codes - parameter: code A UInt32 representing an error code - returns: An NSString with a human readable version of the error code.

    Declaration

    Objective-C

    + (NSString *)stringFromUInt32Code:(UInt32)code;

    Swift

    class func string(fromUInt32Code code: UInt32) -> String!

    Parameters

    code

    A UInt32 representing an error code

    Return Value

    An NSString with a human readable version of the error code.

  • Helper function to get the color components from a CGColorRef in the RGBA colorspace. - parameter: color A CGColorRef that represents a color. - parameter: red A pointer to a CGFloat to hold the value of the red component. This value will be between 0 and 1. - parameter: green A pointer to a CGFloat to hold the value of the green component. This value will be between 0 and 1. - parameter: blue A pointer to a CGFloat to hold the value of the blue component. This value will be between 0 and 1. - parameter: alpha A pointer to a CGFloat to hold the value of the alpha component. This value will be between 0 and 1.

    Declaration

    Objective-C

    + (void)getColorComponentsFromCGColor:(CGColorRef)color
                                      red:(CGFloat *)red
                                    green:(CGFloat *)green
                                     blue:(CGFloat *)blue
                                    alpha:(CGFloat *)alpha;

    Swift

    class func getColorComponents(from color: CGColor!, red: UnsafeMutablePointer

    Parameters

    color

    A CGColorRef that represents a color.

    red

    A pointer to a CGFloat to hold the value of the red component. This value will be between 0 and 1.

    green

    A pointer to a CGFloat to hold the value of the green component. This value will be between 0 and 1.

    blue

    A pointer to a CGFloat to hold the value of the blue component. This value will be between 0 and 1.

    alpha

    A pointer to a CGFloat to hold the value of the alpha component. This value will be between 0 and 1.

  • Given a buffer representing a window of float history data this append the RMS of a buffer of incoming float data…This will likely be deprecated in a future version of EZAudio for a circular buffer based approach. - parameter: scrollHistory An array of float arrays being used to hold the history values for each channel. - parameter: scrollHistoryLength An int representing the length of the history window. - parameter: index An int pointer to the index of the current read index of the history buffer. - parameter: buffer A float array representing the incoming audio data. - parameter: bufferSize An int representing the length of the incoming audio data. - parameter: isChanging A BOOL pointer representing whether the resolution (length of the history window) is currently changing.

    Declaration

    Objective-C

    + (void)updateScrollHistory:(float **)scrollHistory
                     withLength:(int)scrollHistoryLength
                        atIndex:(int *)index
                     withBuffer:(float *)buffer
                 withBufferSize:(int)bufferSize
           isResolutionChanging:(BOOL *)isChanging;

    Swift

    class func updateScrollHistory(_ scrollHistory: UnsafeMutablePointer

    Parameters

    scrollHistory

    An array of float arrays being used to hold the history values for each channel.

    scrollHistoryLength

    An int representing the length of the history window.

    index

    An int pointer to the index of the current read index of the history buffer.

    buffer

    A float array representing the incoming audio data.

    bufferSize

    An int representing the length of the incoming audio data.

    isChanging

    A BOOL pointer representing whether the resolution (length of the history window) is currently changing.

  • Appends the data from the audio buffer list to the circular buffer - parameter: circularBuffer Pointer to the instance of the TPCircularBuffer to add the audio data to - parameter: audioBufferList Pointer to the instance of the AudioBufferList with the audio data

    Declaration

    Objective-C

    + (void)appendDataToCircularBuffer:(TPCircularBuffer *)circularBuffer
                   fromAudioBufferList:(AudioBufferList *)audioBufferList;

    Swift

    class func appendData(to circularBuffer: UnsafeMutablePointer

    Parameters

    circularBuffer

    Pointer to the instance of the TPCircularBuffer to add the audio data to

    audioBufferList

    Pointer to the instance of the AudioBufferList with the audio data

  • Initializes the circular buffer (just a wrapper around the C method) - parameter: circularBuffer Pointer to an instance of the TPCircularBuffer - parameter: size The length of the TPCircularBuffer (usually 1024)

    Declaration

    Objective-C

    + (void)circularBuffer:(TPCircularBuffer *)circularBuffer withSize:(int)size;

    Swift

    class func circularBuffer(_ circularBuffer: UnsafeMutablePointer

    Parameters

    circularBuffer

    Pointer to an instance of the TPCircularBuffer

    size

    The length of the TPCircularBuffer (usually 1024)

  • Frees a circular buffer - parameter: circularBuffer Pointer to the circular buffer to clear

    Declaration

    Objective-C

    + (void)freeCircularBuffer:(TPCircularBuffer *)circularBuffer;

    Swift

    class func freeCircularBuffer(_ circularBuffer: UnsafeMutablePointer

    Parameters

    circularBuffer

    Pointer to the circular buffer to clear

  • Calculates the RMS of a float array containing audio data and appends it to the tail of a EZPlotHistoryInfo data structure. Thread-safe. - parameter: buffer A float array containing the incoming audio buffer to append to the history buffer - parameter: bufferSize A UInt32 representing the length of the incoming audio buffer - parameter: historyInfo A pointer to a EZPlotHistoryInfo structure to use for managing the history buffers

    Declaration

    Objective-C

    + (void)appendBufferRMS:(float *)buffer
             withBufferSize:(UInt32)bufferSize
              toHistoryInfo:(EZPlotHistoryInfo *)historyInfo;

    Swift

    class func appendBufferRMS(_ buffer: UnsafeMutablePointer

    Parameters

    buffer

    A float array containing the incoming audio buffer to append to the history buffer

    bufferSize

    A UInt32 representing the length of the incoming audio buffer

    historyInfo

    A pointer to a EZPlotHistoryInfo structure to use for managing the history buffers

  • Appends a buffer of audio data to the tail of a EZPlotHistoryInfo data structure. Thread-safe. - parameter: buffer A float array containing the incoming audio buffer to append to the history buffer - parameter: bufferSize A UInt32 representing the length of the incoming audio buffer - parameter: historyInfo A pointer to a EZPlotHistoryInfo structure to use for managing the history buffers

    Declaration

    Objective-C

    + (void)appendBuffer:(float *)buffer
          withBufferSize:(UInt32)bufferSize
           toHistoryInfo:(EZPlotHistoryInfo *)historyInfo;

    Swift

    class func appendBuffer(_ buffer: UnsafeMutablePointer

    Parameters

    buffer

    A float array containing the incoming audio buffer to append to the history buffer

    bufferSize

    A UInt32 representing the length of the incoming audio buffer

    historyInfo

    A pointer to a EZPlotHistoryInfo structure to use for managing the history buffers

  • Zeroes out a EZPlotHistoryInfo data structure without freeing the resources. - parameter: historyInfo A pointer to a EZPlotHistoryInfo data structure

    Declaration

    Objective-C

    + (void)clearHistoryInfo:(EZPlotHistoryInfo *)historyInfo;

    Swift

    class func clear(_ historyInfo: UnsafeMutablePointer

    Parameters

    historyInfo

    A pointer to a EZPlotHistoryInfo data structure

  • Frees a EZPlotHistoryInfo data structure - parameter: historyInfo A pointer to a EZPlotHistoryInfo data structure

    Declaration

    Objective-C

    + (void)freeHistoryInfo:(EZPlotHistoryInfo *)historyInfo;

    Swift

    class func freeHistoryInfo(_ historyInfo: UnsafeMutablePointer

    Parameters

    historyInfo

    A pointer to a EZPlotHistoryInfo data structure

  • Creates an EZPlotHistoryInfo data structure with a default length for the window buffer and a maximum length capacity for the internal circular buffer that holds all the audio data. - parameter: defaultLength An int representing the default length (i.e. the number of points that will be displayed on screen) of the history window. - parameter: maximumLength An int representing the default maximum length that is the absolute maximum amount of values that can be held in the history’s circular buffer. - returns: A pointer to the EZPlotHistoryInfo created. The caller is responsible for freeing this structure using the freeHistoryInfo method above.

    Declaration

    Objective-C

    + (EZPlotHistoryInfo *)historyInfoWithDefaultLength:(int)defaultLength
                                          maximumLength:(int)maximumLength;

    Swift

    class func historyInfo(withDefaultLength defaultLength: Int32, maximumLength: Int32) -> UnsafeMutablePointer

    Parameters

    defaultLength

    An int representing the default length (i.e. the number of points that will be displayed on screen) of the history window.

    maximumLength

    An int representing the default maximum length that is the absolute maximum amount of values that can be held in the history’s circular buffer.

    Return Value

    A pointer to the EZPlotHistoryInfo created. The caller is responsible for freeing this structure using the freeHistoryInfo method above.