Compare commits

..

89 Commits

Author SHA1 Message Date
Syed Haris Ali 7ff5996f09 yet another test... 2015-07-02 16:39:09 -07:00
Syed Haris Ali fea20e3b9f think I got relative paths working for OSX 2015-07-02 16:27:48 -07:00
Syed Haris Ali 39f79a2f2d removed absolute references to framework path 2015-07-02 15:08:48 -07:00
Syed Haris Ali 666630b5fa changed to local header 2015-07-02 15:02:16 -07:00
Syed Haris Ali bb033d2e9a removed EZAudio.h reference in EZAudioFile 2015-07-02 15:01:33 -07:00
Syed Haris Ali 3df159fded cleaned up project structure 2015-07-02 14:57:42 -07:00
Syed Haris Ali 3ce1777067 removing tests from iOS examples 2015-07-02 13:28:33 -07:00
Syed Haris Ali dda6f5a045 removing tests from OSX examples 2015-07-02 13:26:00 -07:00
Syed Haris Ali cd47fe7cc7 got frameworks for iOS and OSX and updated all examples 2015-07-02 13:14:35 -07:00
Syed Haris Ali 1ded12d18e got OSX framework building and included in OSX examples 2015-07-02 12:38:42 -07:00
Syed Haris Ali 556ac8390a updated README for 0.7.1 and deprecation note 2015-07-02 12:24:06 -07:00
Syed Haris Ali 700bd4bbce bumped podspec to 0.7.1 2015-07-02 11:52:03 -07:00
Syed Haris Ali 7df85ed2b8 fixing subspec stuff 2015-07-02 11:49:18 -07:00
Syed Haris Ali 68ad54d824 removing unused code, adding TPCircularBuffer cocoapods macro, and adding subspec to podspec 2015-07-02 11:39:50 -07:00
Syed Haris Ali c6ed4c48b6 bumped version to 0.6.0 2015-07-01 19:34:19 -07:00
Syed Haris Ali d65c918f00 Merge pull request #177 from syedhali/opengl_plot_rewrite
Rewrote EZAudioPlotGL and removed EZAudioPlotGLKViewController
2015-07-01 19:33:12 -07:00
Syed Haris Ali e771fe257a added support to allow start/stopping display link 2015-07-01 19:31:59 -07:00
Syed Haris Ali 7fc587d3af removed readwrite in property declaration 2015-07-01 19:27:11 -07:00
Syed Haris Ali 7bcf2517cb added more documentation 2015-07-01 19:24:54 -07:00
Syed Haris Ali 47de71d817 updated examples 2015-07-01 19:21:01 -07:00
Syed Haris Ali cdee3dadd5 Added lots and lots of documentation 2015-07-01 18:47:40 -07:00
Syed Haris Ali 4b76949836 added method to allow easier subclassing the EZAudioPlotGL 2015-07-01 18:16:24 -07:00
Syed Haris Ali 55172b2356 added clear method 2015-07-01 17:53:54 -07:00
Syed Haris Ali 302a047f6a performance tweaking, adding documentation, updating examples, and adding missing setters to EZAudioPlotGL 2015-07-01 17:25:20 -07:00
Syed Haris Ali 2705a7b559 added proper yscale 2015-07-01 15:51:35 -07:00
Syed Haris Ali e620db225a cleaning up 2015-07-01 15:37:31 -07:00
Syed Haris Ali 6f51b2b387 unified common GL drawing calls 2015-07-01 15:26:50 -07:00
Syed Haris Ali a8202b44ad got layer backed OSX GL view working 2015-07-01 15:16:49 -07:00
Syed Haris Ali ddfe22106f got mac opengl view setup and resizing properly 2015-07-01 12:18:45 -07:00
Syed Haris Ali 64a9e963ee added model view matrix transforms instead of manually mapping x-axis 2015-07-01 03:42:04 -07:00
Syed Haris Ali 2309329709 made sure open gl view only redraws when application is active and added target conditionals for drawing on iOS only 2015-07-01 00:40:52 -07:00
Syed Haris Ali bb19920533 added mirroring 2015-07-01 00:23:17 -07:00
Syed Haris Ali 44429ec91a got iOS gl plot working again 2015-06-30 23:41:58 -07:00
Syed Haris Ali 3936165aeb cleaned up EZAudioPlotGL and removed GLKViewController 2015-06-30 22:38:27 -07:00
Syed Haris Ali 996744ffc4 updated for 0.5.0 release 2015-06-30 14:17:54 -07:00
Syed Haris Ali 3ae090c761 Merge pull request #175 from syedhali/audioplayer_w_output_rewrite
Rewrote EZAudioPlayer using EZOutput
2015-06-30 14:17:05 -07:00
Syed Haris Ali 33bdcee78a accidentally deleted totalFrames property, added back 2015-06-30 14:13:37 -07:00
Syed Haris Ali 081c7047f5 cleaned up AVAudioSession stuff 2015-06-30 14:10:43 -07:00
Syed Haris Ali 4d952e2fa5 added more documentation and proper AVAudioSession for play file iOS example 2015-06-30 14:09:12 -07:00
Syed Haris Ali f2084dab2a added clean up to remove observers when done 2015-06-30 13:44:40 -07:00
Syed Haris Ali 115dc2b8a0 updated play file example for notifications and added loop checkbox for OSX, fixed audio session not being set on iOS FFT example 2015-06-30 13:03:34 -07:00
Syed Haris Ali a832f27a5a added nice description method to EZAudioFile and updated play file examples to use notifications 2015-06-30 12:36:24 -07:00
Syed Haris Ali 199f63d7e2 more code cleanup 2015-06-30 02:28:15 -07:00
Syed Haris Ali f5f40304d0 code clean up 2015-06-30 02:13:31 -07:00
Syed Haris Ali 6ea04c0f7b rewrote EZAudioPlayer to use new EZOutput, added notifications, added NSCopying protocol to EZAudioFile, updated play file examples for iOS and Mac 2015-06-30 02:11:07 -07:00
Syed Haris Ali ab9fb5b9bd bumped podspec and README to 0.4.0 and removed getting started reference (moving all to github) 2015-06-29 19:43:46 -07:00
Syed Haris Ali f98d520efd Merge pull request #171 from syedhali/output_rewrite
Rewrote EZOutput using AUGraph
2015-06-29 19:41:54 -07:00
Syed Haris Ali 6a44909a2f Used EZOutputDelegate for audio received callback and fixed minor bgs 2015-06-29 19:33:24 -07:00
Syed Haris Ali c85d1d9d2f so much documentation 2015-06-29 19:13:01 -07:00
Syed Haris Ali d03a5f76e6 added lots of documentation 2015-06-29 19:09:52 -07:00
Syed Haris Ali 6d7625027f added more documentation and pan property 2015-06-29 18:42:47 -07:00
Syed Haris Ali cce5ee0af1 minor tweak 2015-06-29 18:26:31 -07:00
Syed Haris Ali cc868e79dd little style tweak 2015-06-29 18:15:27 -07:00
Syed Haris Ali d2ad3d2034 added clean up for float converter 2015-06-29 18:14:10 -07:00
Syed Haris Ali 3fdb33209d added float converter 2015-06-29 18:11:56 -07:00
Syed Haris Ali e16c775be8 fixed broken IB connection 2015-06-29 17:52:45 -07:00
Syed Haris Ali 59a3a22c6a added plot clear 2015-06-29 17:51:53 -07:00
Syed Haris Ali 4c7719f168 added output selector to OSX play file example 2015-06-29 17:47:10 -07:00
Syed Haris Ali 5789954cb9 updated examples that explicitly use EZOuput and added volume controls 2015-06-29 17:32:03 -07:00
Syed Haris Ali c34c7c9f89 added documentation for Core Audio properties 2015-06-29 16:28:20 -07:00
Syed Haris Ali 6745265dd5 rewrote EZOuput and added output device support for iOS and OSX 2015-06-29 16:17:08 -07:00
Syed Haris Ali c7727f8586 Changed totalDuration references to just duration 2015-06-28 17:05:18 -07:00
Syed Haris Ali c8ee8a4f7d updated podspec dependencies to explicitly depend on TPCircularBuffer and ignore files in EZAudio folder 2015-06-28 17:01:13 -07:00
Syed Haris Ali 2e90d0e6f1 updated podspec 2015-06-28 16:55:25 -07:00
Syed Haris Ali abe23bed12 Merge pull request #169 from syedhali/ha-audiofile_rewrite
Updated EZAudioFile for thread-safety and added more properties
2015-06-28 16:54:43 -07:00
Syed Haris Ali 95d9a1e7ba finished documentation 2015-06-28 16:51:19 -07:00
Syed Haris Ali c55423759b adding additional documentation and updated play file example for iOS 2015-06-28 16:44:30 -07:00
Syed Haris Ali f2b61d340e minor tweak 2015-06-28 15:41:43 -07:00
Syed Haris Ali cc663ec82d removed AEFloatConverter and updated iOS examples 2015-06-28 15:39:25 -07:00
Syed Haris Ali c96a65831d fixed block name 2015-06-28 15:28:11 -07:00
Syed Haris Ali 0073f555bc added documentation 2015-06-28 15:27:21 -07:00
Syed Haris Ali 62055f1782 Updated EZAudioFile 2015-06-28 15:17:04 -07:00
Syed Haris Ali b29ff9b53f updated homepage 2015-06-26 01:34:39 -07:00
Syed Haris Ali 4618c9f139 added homepage to podspec 2015-06-26 01:33:38 -07:00
Syed Haris Ali a84eeedfc8 bumped podspec to 0.2.0 2015-06-26 01:05:46 -07:00
Syed Haris Ali b3dd0817f1 Merge pull request #167 from syedhali/better_cg_waveform
Added more performant Core Graphics waveforms and updated examples
2015-06-26 01:02:25 -07:00
Syed Haris Ali 5505cc2883 more documentation 2015-06-26 01:00:37 -07:00
Syed Haris Ali 494828e31b added documentation 2015-06-26 00:59:04 -07:00
Syed Haris Ali d4fa778d7e comment clean up 2015-06-26 00:48:50 -07:00
Syed Haris Ali e05c602626 moved history buffer handling to utilities class 2015-06-26 00:47:42 -07:00
Syed Haris Ali d031217ae0 added shadow to waveform in examples to show how to manipulate waveform layer 2015-06-26 00:07:38 -07:00
Syed Haris Ali 6678f43165 moved history initialization to utiltiies 2015-06-25 23:59:05 -07:00
Syed Haris Ali 188ff567b3 fixed bug with example where changedInputChannel was no longer needed 2015-06-25 23:44:47 -07:00
Syed Haris Ali a3e79aafd0 updated play file example 2015-06-25 23:37:12 -07:00
Syed Haris Ali b21681464c updated license file and documented display link 2015-06-25 23:23:27 -07:00
Syed Haris Ali 2cdb4abdf8 more improvements, made it easier to subclass audio plot 2015-06-25 22:56:19 -07:00
Syed Haris Ali 9b26a0ac62 Added fixes to plot and tested performance in all examples 2015-06-25 16:43:21 -07:00
Syed Haris Ali f6facedf8c Updating examples for new waveform 2015-06-25 12:35:44 -07:00
Syed Haris Ali a58e8d6461 cleaning up readme 2015-06-24 01:53:55 -07:00
187 changed files with 11151 additions and 9459 deletions
@@ -33,6 +33,14 @@
*/
+ (NSArray *)inputDevices;
//------------------------------------------------------------------------------
/**
Enumerates all the available output devices and returns the result in an NSArray of EZAudioDevice instances.
@return An NSArray of output EZAudioDevice instances.
*/
+ (NSArray *)outputDevices;
#if TARGET_OS_IPHONE
/**
@@ -42,6 +50,13 @@
*/
+ (EZAudioDevice *)currentInputDevice;
/**
Provides the current EZAudioDevice that is being used to output audio.
- iOS only
@return An EZAudioDevice instance representing the currently selected ouotput device.
*/
+ (EZAudioDevice *)currentOutputDevice;
//------------------------------------------------------------------------------
/**
@@ -52,6 +67,16 @@
+ (void)enumerateInputDevicesUsingBlock:(void(^)(EZAudioDevice *device,
BOOL *stop))block;
//------------------------------------------------------------------------------
/**
Enumerates all the available output devices.
- iOS only
@param block When enumerating this block executes repeatedly for each EZAudioDevice found. It contains two arguments - first, the EZAudioDevice found, then a pointer to a stop BOOL to allow breaking out of the enumeration)
*/
+ (void)enumerateOutputDevicesUsingBlock:(void (^)(EZAudioDevice *device,
BOOL *stop))block;
#elif TARGET_OS_MAC
/**
@@ -63,15 +88,6 @@
//------------------------------------------------------------------------------
/**
Enumerates all the available output devices and returns the result in an NSArray of EZAudioDevice instances.
- OSX only
@return An NSArray of output EZAudioDevice instances.
*/
+ (NSArray *)outputDevices;
//------------------------------------------------------------------------------
/**
Enumerates all the available devices.
- OSX only
@@ -49,6 +49,19 @@
//------------------------------------------------------------------------------
+ (EZAudioDevice *)currentOutputDevice
{
AVAudioSession *session = [AVAudioSession sharedInstance];
AVAudioSessionPortDescription *port = [[[session currentRoute] outputs] firstObject];
AVAudioSessionDataSourceDescription *dataSource = [session outputDataSource];
EZAudioDevice *device = [[EZAudioDevice alloc] init];
device.port = port;
device.dataSource = dataSource;
return device;
}
//------------------------------------------------------------------------------
+ (NSArray *)inputDevices
{
__block NSMutableArray *devices = [NSMutableArray array];
@@ -61,6 +74,18 @@
//------------------------------------------------------------------------------
+ (NSArray *)outputDevices
{
__block NSMutableArray *devices = [NSMutableArray array];
[self enumerateOutputDevicesUsingBlock:^(EZAudioDevice *device, BOOL *stop)
{
[devices addObject:device];
}];
return devices;
}
//------------------------------------------------------------------------------
+ (void)enumerateInputDevicesUsingBlock:(void (^)(EZAudioDevice *, BOOL *))block
{
if (!block)
@@ -101,6 +126,42 @@
//------------------------------------------------------------------------------
+ (void)enumerateOutputDevicesUsingBlock:(void (^)(EZAudioDevice *, BOOL *))block
{
if (!block)
{
return;
}
AVAudioSessionRouteDescription *currentRoute = [[AVAudioSession sharedInstance] currentRoute];
NSArray *portDescriptions = [currentRoute outputs];
BOOL stop;
for (AVAudioSessionPortDescription *outputDevicePortDescription in portDescriptions)
{
// add any additional sub-devices
NSArray *dataSources = [outputDevicePortDescription dataSources];
if (dataSources.count)
{
for (AVAudioSessionDataSourceDescription *outputDeviceDataSourceDescription in dataSources)
{
EZAudioDevice *device = [[EZAudioDevice alloc] init];
device.port = outputDevicePortDescription;
device.dataSource = outputDeviceDataSourceDescription;
block(device, &stop);
}
}
else
{
EZAudioDevice *device = [[EZAudioDevice alloc] init];
device.port = outputDevicePortDescription;
block(device, &stop);
}
}
}
//------------------------------------------------------------------------------
- (NSString *)name
{
NSMutableString *name = [NSMutableString string];
+368
View File
@@ -0,0 +1,368 @@
//
// EZAudioFile.h
// EZAudio
//
// Created by Syed Haris Ali on 12/1/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
#import "EZAudioFloatData.h"
//------------------------------------------------------------------------------
@class EZAudio;
@class EZAudioFile;
//------------------------------------------------------------------------------
#pragma mark - Blocks
//------------------------------------------------------------------------------
/**
A block used when returning back the waveform data. The waveform data itself will be an array of float arrays, one for each channel, and the length indicates the total length of each float array.
@param waveformData An array of float arrays, each representing a channel of audio data from the file
@param length An int representing the length of each channel of float audio data
*/
typedef void (^EZAudioWaveformDataCompletionBlock)(float **waveformData, int length);
//------------------------------------------------------------------------------
#pragma mark - EZAudioFileDelegate
//------------------------------------------------------------------------------
/**
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.
*/
@protocol EZAudioFileDelegate <NSObject>
@optional
/**
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.
@param audioFile The instance of the EZAudioFile that triggered the event.
@param 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.
@param bufferSize The length of the buffers float arrays
@param numberOfChannels The number of channels. 2 for stereo, 1 for mono.
*/
- (void) audioFile:(EZAudioFile *)audioFile
readAudio:(float **)buffer
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels;
//------------------------------------------------------------------------------
/**
Occurs when the audio file's internal seek position has been updated by the EZAudioFile functions `readFrames:audioBufferList:bufferSize:eof:` or `audioFile:updatedPosition:`.
@param audioFile The instance of the EZAudio in which the change occured
@param framePosition The new frame index as a 64-bit signed integer
*/
- (void)audioFile:(EZAudioFile *)audioFile updatedPosition:(SInt64)framePosition;
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioFile
//------------------------------------------------------------------------------
/**
The EZAudioFile provides a lightweight and intuitive way to asynchronously interact with audio files. These interactions included reading audio data, seeking within an audio file, getting information about the file, and pulling the waveform data for visualizing the contents of the audio file. The EZAudioFileDelegate provides event callbacks for when reads, seeks, and various updates happen within the audio file to allow the caller to interact with the action in meaningful ways. Common use cases here could be to read the audio file's data as AudioBufferList structures for output (see EZOutput) and visualizing the audio file's data as a float array using an audio plot (see EZAudioPlot).
*/
@interface EZAudioFile : NSObject <NSCopying>
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
/**
A EZAudioFileDelegate for the audio file that is used to return events such as new seek positions within the file and the read audio data as a float array.
*/
@property (nonatomic, weak) id<EZAudioFileDelegate> delegate;
//------------------------------------------------------------------------------
#pragma mark - Initialization
//------------------------------------------------------------------------------
/**
@name Initialization
*/
/**
Creates a new instance of the EZAudioFile using a file path URL.
@param url The file path reference of the audio file as an NSURL.
@return The newly created EZAudioFile instance. nil if the file path does not exist.
*/
- (instancetype)initWithURL:(NSURL *)url;
/**
Creates a new instance of the EZAudioFile using a file path URL with a delegate conforming to the EZAudioFileDelegate protocol.
@param delegate The audio file delegate that receives events specified by the EZAudioFileDelegate protocol
@param url The file path reference of the audio file as an NSURL.
@return The newly created EZAudioFile instance.
*/
- (instancetype)initWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Creates a new instance of the EZAudioFile using a file path URL with a delegate conforming to the EZAudioFileDelegate protocol and a client format.
@param url The file path reference of the audio file as an NSURL.
@param delegate The audio file delegate that receives events specified by the EZAudioFileDelegate protocol
@param clientFormat An AudioStreamBasicDescription that will be used as the client format on the audio file. For instance, the audio file might be in a 22.5 kHz sample rate format in its file format, but your app wants to read the samples at a sample rate of 44.1 kHz so it can iterate with other components (like a audio processing graph) without any weird playback effects. If this initializer is not used then a non-interleaved float format will be assumed.
@return The newly created EZAudioFile instance.
*/
- (instancetype)initWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate
clientFormat:(AudioStreamBasicDescription)clientFormat;
//------------------------------------------------------------------------------
#pragma mark - Class Initializers
//------------------------------------------------------------------------------
/**
@name Class Initializers
*/
/**
Class method that creates a new instance of the EZAudioFile using a file path URL.
@param url The file path reference of the audio file as an NSURL.
@return The newly created EZAudioFile instance.
*/
+ (instancetype)audioFileWithURL:(NSURL *)url;
//------------------------------------------------------------------------------
/**
Class method that creates a new instance of the EZAudioFile using a file path URL with a delegate conforming to the EZAudioFileDelegate protocol.
@param url The file path reference of the audio file as an NSURL.
@param delegate The audio file delegate that receives events specified by the EZAudioFileDelegate protocol
@return The newly created EZAudioFile instance.
*/
+ (instancetype)audioFileWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Class method that creates a new instance of the EZAudioFile using a file path URL with a delegate conforming to the EZAudioFileDelegate protocol and a client format.
@param url The file path reference of the audio file as an NSURL.
@param delegate The audio file delegate that receives events specified by the EZAudioFileDelegate protocol
@param clientFormat An AudioStreamBasicDescription that will be used as the client format on the audio file. For instance, the audio file might be in a 22.5 kHz sample rate, interleaved MP3 file format, but your app wants to read linear PCM samples at a sample rate of 44.1 kHz so it can be read in the context of other components sharing a common stream format (like a audio processing graph). If this initializer is not used then the `defaultClientFormat` will be used as teh default value for the client format.
@return The newly created EZAudioFile instance.
*/
+ (instancetype)audioFileWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate
clientFormat:(AudioStreamBasicDescription)clientFormat;
//------------------------------------------------------------------------------
#pragma mark - Class Methods
//------------------------------------------------------------------------------
/**
@name Class Methods
*/
/**
A class method that subclasses can override to specify the default client format that will be used to read audio data from this file. A client format is different from the file format in that it is the format of the other components interacting with this file. For instance, the file on disk could be a 22.5 kHz, float format, but we might have an audio processing graph that has a 44.1 kHz, signed integer format that we'd like to interact with. The client format lets us set that 44.1 kHz format on the audio file to properly read samples from it with any interpolation or format conversion that must take place done automatically within the EZAudioFile `readFrames:audioBufferList:bufferSize:eof:` method. Default is stereo, non-interleaved, 44.1 kHz.
@return An AudioStreamBasicDescription that serves as the audio file's client format.
*/
+ (AudioStreamBasicDescription)defaultClientFormat;
//------------------------------------------------------------------------------
/**
A class method that subclasses can override to specify the default sample rate that will be used in the `defaultClientFormat` method. Default is 44100.0 (44.1 kHz).
@return A Float64 representing the sample rate that should be used in the default client format.
*/
+ (Float64)defaultClientFormatSampleRate;
//------------------------------------------------------------------------------
/**
Provides an array of the supported audio files types. Each audio file type is provided as a string, i.e. @"caf". Useful for filtering lists of files in an open panel to only the types allowed.
@return An array of NSString objects representing the represented file types.
*/
+ (NSArray *)supportedAudioFileTypes;
//------------------------------------------------------------------------------
#pragma mark - Events
//------------------------------------------------------------------------------
/**
@name Reading From The Audio File
*/
/**
Reads a specified number of frames from the audio file. In addition, this will notify the EZAudioFileDelegate (if specified) of the read data as a float array with the audioFile:readAudio:withBufferSize:withNumberOfChannels: event and the new seek position within the file with the audioFile:updatedPosition: event.
@param frames The number of frames to read from the file.
@param audioBufferList An allocated AudioBufferList structure in which to store the read audio data
@param bufferSize A pointer to a UInt32 in which to store the read buffersize
@param eof A pointer to a BOOL in which to store whether the read operation reached the end of the audio file.
*/
- (void)readFrames:(UInt32)frames
audioBufferList:(AudioBufferList *)audioBufferList
bufferSize:(UInt32 *)bufferSize
eof:(BOOL *)eof;
//------------------------------------------------------------------------------
/**
@name Seeking Through The Audio File
*/
/**
Seeks through an audio file to a specified frame. This will notify the EZAudioFileDelegate (if specified) with the audioFile:updatedPosition: function.
@param frame The new frame position to seek to as a SInt64.
*/
- (void)seekToFrame:(SInt64)frame;
//------------------------------------------------------------------------------
#pragma mark - Getters
//------------------------------------------------------------------------------
/**
@name Getting Information About The Audio File
*/
/**
Provides the AudioStreamBasicDescription structure used within the app. The file's format will be converted to this format and then sent back as either a float array or a `AudioBufferList` pointer. For instance, the file on disk could be a 22.5 kHz, float format, but we might have an audio processing graph that has a 44.1 kHz, signed integer format that we'd like to interact with. The client format lets us set that 44.1 kHz format on the audio file to properly read samples from it with any interpolation or format conversion that must take place done automatically within the EZAudioFile `readFrames:audioBufferList:bufferSize:eof:` method. Default is stereo, non-interleaved, 44.1 kHz.
@warning This must be a linear PCM format!
@return An AudioStreamBasicDescription structure describing the format of the audio file.
*/
@property (readwrite) AudioStreamBasicDescription clientFormat;
//------------------------------------------------------------------------------
/**
Provides the current offset in the audio file as an NSTimeInterval (i.e. in seconds). When setting this it will determine the correct frame offset and perform a `seekToFrame` to the new time offset.
@warning Make sure the new current time offset is less than the `duration` or you will receive an invalid seek assertion.
*/
@property (nonatomic, readwrite) NSTimeInterval currentTime;
//------------------------------------------------------------------------------
/**
Provides the duration of the audio file in seconds.
*/
@property (readonly) NSTimeInterval duration;
//------------------------------------------------------------------------------
/**
Provides the AudioStreamBasicDescription structure containing the format of the file.
@return An AudioStreamBasicDescription structure describing the format of the audio file.
*/
@property (readonly) AudioStreamBasicDescription fileFormat;
//------------------------------------------------------------------------------
/**
Provides the current time as an NSString with the time format MM:SS.
*/
@property (readonly) NSString *formattedCurrentTime;
//------------------------------------------------------------------------------
/**
Provides the duration as an NSString with the time format MM:SS.
*/
@property (readonly) NSString *formattedDuration;
//------------------------------------------------------------------------------
/**
Provides the frame index (a.k.a the seek positon) within the audio file as SInt64. This can be helpful when seeking through the audio file.
@return The current frame index within the audio file as a SInt64.
*/
@property (readonly) SInt64 frameIndex;
//------------------------------------------------------------------------------
/**
Provides a dictionary containing the metadata (ID3) tags that are included in the header for the audio file. Typically this contains stuff like artist, title, release year, etc.
@return An NSDictionary containing the metadata for the audio file.
*/
@property (readonly) NSDictionary *metadata;
//------------------------------------------------------------------------------
/**
Provides the total duration of the audio file in seconds.
@deprecated This property is deprecated starting in version 0.3.0.
@note Please use `duration` property instead.
@return The total duration of the audio file as a Float32.
*/
@property (readonly) NSTimeInterval totalDuration __attribute__((deprecated));;
//------------------------------------------------------------------------------
/**
Provides the total frame count of the audio file in the client format.
@return The total number of frames in the audio file in the AudioStreamBasicDescription representing the client format as a SInt64.
*/
@property (readonly) SInt64 totalClientFrames;
//------------------------------------------------------------------------------
/**
Provides the total frame count of the audio file in the file format.
@return The total number of frames in the audio file in the AudioStreamBasicDescription representing the file format as a SInt64.
*/
@property (readonly) SInt64 totalFrames;
//------------------------------------------------------------------------------
/**
Provides the NSURL for the audio file.
@return An NSURL representing the path of the EZAudioFile instance.
*/
@property (nonatomic, copy, readonly) NSURL *url;
//------------------------------------------------------------------------------
#pragma mark - Helpers
//------------------------------------------------------------------------------
/**
Synchronously pulls the waveform amplitude data into a float array for the receiver. This returns a waveform with a default resolution of 1024, meaning there are 1024 data points to plot the waveform.
@param numberOfPoints A UInt32 representing the number of data points you need. The higher the number of points the more detailed the waveform will be.
@return A EZAudioFloatData instance containing the audio data for all channels of the audio.
*/
- (EZAudioFloatData *)getWaveformData;
//------------------------------------------------------------------------------
/**
Synchronously pulls the waveform amplitude data into a float array for the receiver.
@param numberOfPoints A UInt32 representing the number of data points you need. The higher the number of points the more detailed the waveform will be.
@return A EZAudioFloatData instance containing the audio data for all channels of the audio.
*/
- (EZAudioFloatData *)getWaveformDataWithNumberOfPoints:(UInt32)numberOfPoints;
//------------------------------------------------------------------------------
/**
Asynchronously pulls the waveform amplitude data into a float array for the receiver. This returns a waveform with a default resolution of 1024, meaning there are 1024 data points to plot the waveform.
@param completion A EZAudioWaveformDataCompletionBlock that executes when the waveform data has been extracted. Provides a `EZAudioFloatData` instance containing the waveform data for all audio channels.
*/
- (void)getWaveformDataWithCompletionBlock:(EZAudioWaveformDataCompletionBlock)completion;
//------------------------------------------------------------------------------
/**
Asynchronously pulls the waveform amplitude data into a float array for the receiver.
@param numberOfPoints A UInt32 representing the number of data points you need. The higher the number of points the more detailed the waveform will be.
@param completion A EZAudioWaveformDataCompletionBlock that executes when the waveform data has been extracted. Provides a `EZAudioFloatData` instance containing the waveform data for all audio channels.
*/
- (void)getWaveformDataWithNumberOfPoints:(UInt32)numberOfPoints
completion:(EZAudioWaveformDataCompletionBlock)completion;
//------------------------------------------------------------------------------
@end
+701
View File
@@ -0,0 +1,701 @@
//
// EZAudioFile.m
// EZAudio
//
// Created by Syed Haris Ali on 12/1/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "EZAudioFile.h"
#import "EZAudioUtilities.h"
#import "EZAudioFloatConverter.h"
#import "EZAudioFloatData.h"
#include <pthread.h>
// constants
static UInt32 EZAudioFileWaveformDefaultResolution = 1024;
static NSString *EZAudioFileWaveformDataQueueIdentifier = @"com.ezaudio.waveformQueue";
//------------------------------------------------------------------------------
typedef struct
{
AudioFileID audioFileID;
AudioStreamBasicDescription clientFormat;
NSTimeInterval duration;
ExtAudioFileRef extAudioFileRef;
AudioStreamBasicDescription fileFormat;
SInt64 frames;
CFURLRef sourceURL;
} EZAudioFileInfo;
//------------------------------------------------------------------------------
#pragma mark - EZAudioFile
//------------------------------------------------------------------------------
@interface EZAudioFile ()
@property (nonatomic, strong) EZAudioFloatConverter *floatConverter;
@property (nonatomic) float **floatData;
@property (nonatomic) EZAudioFileInfo *info;
@property (nonatomic) pthread_mutex_t lock;
@property (nonatomic) dispatch_queue_t waveformQueue;
@end
//------------------------------------------------------------------------------
@implementation EZAudioFile
//------------------------------------------------------------------------------
#pragma mark - Dealloc
//------------------------------------------------------------------------------
- (void)dealloc
{
self.floatConverter = nil;
pthread_mutex_destroy(&_lock);
[EZAudioUtilities freeFloatBuffers:self.floatData numberOfChannels:self.clientFormat.mChannelsPerFrame];
[EZAudioUtilities checkResult:ExtAudioFileDispose(self.info->extAudioFileRef) operation:"Failed to dispose of ext audio file"];
free(self.info);
}
//------------------------------------------------------------------------------
#pragma mark - Initialization
//------------------------------------------------------------------------------
- (instancetype)init
{
self = [super init];
if (self)
{
self.info = (EZAudioFileInfo *)malloc(sizeof(EZAudioFileInfo));
_floatData = NULL;
pthread_mutex_init(&_lock, NULL);
_waveformQueue = dispatch_queue_create(EZAudioFileWaveformDataQueueIdentifier.UTF8String, DISPATCH_QUEUE_PRIORITY_DEFAULT);
}
return self;
}
//------------------------------------------------------------------------------
- (instancetype)initWithURL:(NSURL *)url
{
return [self initWithURL:url delegate:nil];
}
//------------------------------------------------------------------------------
- (instancetype)initWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate
{
return [self initWithURL:url
delegate:delegate
clientFormat:[self.class defaultClientFormat]];
}
//------------------------------------------------------------------------------
- (instancetype)initWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate
clientFormat:(AudioStreamBasicDescription)clientFormat
{
self = [self init];
if (self)
{
self.info->sourceURL = (__bridge CFURLRef)(url);
self.info->clientFormat = clientFormat;
self.delegate = delegate;
if (![self setup])
{
return nil;
}
}
return self;
}
//------------------------------------------------------------------------------
#pragma mark - Class Initializers
//------------------------------------------------------------------------------
+ (instancetype)audioFileWithURL:(NSURL *)url
{
return [[self alloc] initWithURL:url];
}
//------------------------------------------------------------------------------
+ (instancetype)audioFileWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate
{
return [[self alloc] initWithURL:url delegate:delegate];
}
//------------------------------------------------------------------------------
+ (instancetype)audioFileWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate
clientFormat:(AudioStreamBasicDescription)clientFormat
{
return [[self alloc] initWithURL:url
delegate:delegate
clientFormat:clientFormat];
}
//------------------------------------------------------------------------------
#pragma mark - NSCopying
//------------------------------------------------------------------------------
- (id)copyWithZone:(NSZone *)zone
{
return [EZAudioFile audioFileWithURL:self.url];
}
//------------------------------------------------------------------------------
#pragma mark - Class Methods
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)defaultClientFormat
{
return [EZAudioUtilities stereoFloatNonInterleavedFormatWithSampleRate:[self defaultClientFormatSampleRate]];
}
//------------------------------------------------------------------------------
+ (Float64)defaultClientFormatSampleRate
{
return 44100.0f;
}
//------------------------------------------------------------------------------
+ (NSArray *)supportedAudioFileTypes
{
return @
[
@"aac",
@"caf",
@"aif",
@"aiff",
@"aifc",
@"mp3",
@"mp4",
@"m4a",
@"snd",
@"au",
@"sd2",
@"wav"
];
}
//------------------------------------------------------------------------------
#pragma mark - Setup
//------------------------------------------------------------------------------
- (BOOL)setup
{
//
// Try to open the file, bail if the file could not be opened
//
BOOL success = [self openAudioFile];
if (!success)
{
return success;
}
//
// Set the client format
//
self.clientFormat = self.info->clientFormat;
return YES;
}
//------------------------------------------------------------------------------
#pragma mark - Creating/Opening Audio File
//------------------------------------------------------------------------------
- (BOOL)openAudioFile
{
//
// Need a source url
//
NSAssert(self.info->sourceURL, @"EZAudioFile cannot be created without a source url!");
//
// Determine if the file actually exists
//
CFURLRef url = self.info->sourceURL;
NSURL *fileURL = (__bridge NSURL *)(url);
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:fileURL.path];
//
// Create an ExtAudioFileRef for the file handle
//
if (fileExists)
{
[EZAudioUtilities checkResult:ExtAudioFileOpenURL(url, &self.info->extAudioFileRef)
operation:"Failed to create ExtAudioFileRef"];
}
else
{
return NO;
}
//
// Get the underlying AudioFileID
//
UInt32 propSize = sizeof(self.info->audioFileID);
[EZAudioUtilities checkResult:ExtAudioFileGetProperty(self.info->extAudioFileRef,
kExtAudioFileProperty_AudioFile,
&propSize,
&self.info->audioFileID)
operation:"Failed to get underlying AudioFileID"];
//
// Store the file format
//
propSize = sizeof(self.info->fileFormat);
[EZAudioUtilities checkResult:ExtAudioFileGetProperty(self.info->extAudioFileRef,
kExtAudioFileProperty_FileDataFormat,
&propSize,
&self.info->fileFormat)
operation:"Failed to get file audio format on existing audio file"];
//
// Get the total frames and duration
//
propSize = sizeof(SInt64);
[EZAudioUtilities checkResult:ExtAudioFileGetProperty(self.info->extAudioFileRef,
kExtAudioFileProperty_FileLengthFrames,
&propSize,
&self.info->frames)
operation:"Failed to get total frames"];
self.info->duration = (NSTimeInterval) self.info->frames / self.info->fileFormat.mSampleRate;
return YES;
}
//------------------------------------------------------------------------------
#pragma mark - Events
//------------------------------------------------------------------------------
- (void)readFrames:(UInt32)frames
audioBufferList:(AudioBufferList *)audioBufferList
bufferSize:(UInt32 *)bufferSize
eof:(BOOL *)eof
{
if (pthread_mutex_trylock(&_lock) == 0)
{
// perform read
[EZAudioUtilities checkResult:ExtAudioFileRead(self.info->extAudioFileRef,
&frames,
audioBufferList)
operation:"Failed to read audio data from file"];
*bufferSize = frames;
*eof = frames == 0;
// notify delegate
if ([self.delegate respondsToSelector:@selector(audioFile:updatedPosition:)])
{
[self.delegate audioFile:self updatedPosition:self.frameIndex];
}
if ([self.delegate respondsToSelector:@selector(audioFile:readAudio:withBufferSize:withNumberOfChannels:)])
{
// convert into float data
[self.floatConverter convertDataFromAudioBufferList:audioBufferList
withNumberOfFrames:*bufferSize
toFloatBuffers:self.floatData];
// notify delegate
UInt32 channels = self.clientFormat.mChannelsPerFrame;
[self.delegate audioFile:self
readAudio:self.floatData
withBufferSize:*bufferSize
withNumberOfChannels:channels];
}
pthread_mutex_unlock(&_lock);
}
}
//------------------------------------------------------------------------------
- (void)seekToFrame:(SInt64)frame
{
if (pthread_mutex_trylock(&_lock) == 0)
{
[EZAudioUtilities checkResult:ExtAudioFileSeek(self.info->extAudioFileRef,
frame)
operation:"Failed to seek frame position within audio file"];
pthread_mutex_unlock(&_lock);
// notify delegate
if ([self.delegate respondsToSelector:@selector(audioFile:updatedPosition:)])
{
[self.delegate audioFile:self
updatedPosition:self.frameIndex];
}
}
}
//------------------------------------------------------------------------------
#pragma mark - Getters
//------------------------------------------------------------------------------
- (AudioStreamBasicDescription)floatFormat
{
return [EZAudioUtilities stereoFloatNonInterleavedFormatWithSampleRate:44100.0f];
}
//------------------------------------------------------------------------------
- (EZAudioFloatData *)getWaveformData
{
return [self getWaveformDataWithNumberOfPoints:EZAudioFileWaveformDefaultResolution];
}
//------------------------------------------------------------------------------
- (EZAudioFloatData *)getWaveformDataWithNumberOfPoints:(UInt32)numberOfPoints
{
EZAudioFloatData *waveformData;
if (pthread_mutex_trylock(&_lock) == 0)
{
// store current frame
SInt64 currentFrame = self.frameIndex;
BOOL interleaved = [EZAudioUtilities isInterleaved:self.clientFormat];
UInt32 channels = self.clientFormat.mChannelsPerFrame;
float **data = (float **)malloc( sizeof(float*) * channels );
for (int i = 0; i < channels; i++)
{
data[i] = (float *)malloc( sizeof(float) * numberOfPoints );
}
// seek to 0
[EZAudioUtilities checkResult:ExtAudioFileSeek(self.info->extAudioFileRef,
0)
operation:"Failed to seek frame position within audio file"];
// calculate the required number of frames per buffer
SInt64 framesPerBuffer = ((SInt64) self.totalClientFrames / numberOfPoints);
SInt64 framesPerChannel = framesPerBuffer / channels;
// allocate an audio buffer list
AudioBufferList *audioBufferList = [EZAudioUtilities audioBufferListWithNumberOfFrames:(UInt32)framesPerBuffer
numberOfChannels:self.info->clientFormat.mChannelsPerFrame
interleaved:interleaved];
// read through file and calculate rms at each point
for (SInt64 i = 0; i < numberOfPoints; i++)
{
UInt32 bufferSize = (UInt32) framesPerBuffer;
[EZAudioUtilities checkResult:ExtAudioFileRead(self.info->extAudioFileRef,
&bufferSize,
audioBufferList)
operation:"Failed to read audio data from file waveform"];
if (interleaved)
{
float *buffer = (float *)audioBufferList->mBuffers[0].mData;
for (int channel = 0; channel < channels; channel++)
{
float channelData[framesPerChannel];
for (int frame = 0; frame < framesPerChannel; frame++)
{
channelData[frame] = buffer[frame * channels + channel];
}
float rms = [EZAudioUtilities RMS:channelData length:(UInt32)framesPerChannel];
data[channel][i] = rms;
}
}
else
{
for (int channel = 0; channel < channels; channel++)
{
float *channelData = audioBufferList->mBuffers[channel].mData;
float rms = [EZAudioUtilities RMS:channelData length:bufferSize];
data[channel][i] = rms;
}
}
}
// clean up
[EZAudioUtilities freeBufferList:audioBufferList];
// seek back to previous position
[EZAudioUtilities checkResult:ExtAudioFileSeek(self.info->extAudioFileRef,
currentFrame)
operation:"Failed to seek frame position within audio file"];
pthread_mutex_unlock(&_lock);
waveformData = [EZAudioFloatData dataWithNumberOfChannels:channels
buffers:(float **)data
bufferSize:numberOfPoints];
// cleanup
for (int i = 0; i < channels; i++)
{
free(data[i]);
}
free(data);
}
return waveformData;
}
//------------------------------------------------------------------------------
- (void)getWaveformDataWithCompletionBlock:(EZAudioWaveformDataCompletionBlock)waveformDataCompletionBlock
{
[self getWaveformDataWithNumberOfPoints:EZAudioFileWaveformDefaultResolution
completion:waveformDataCompletionBlock];
}
//------------------------------------------------------------------------------
- (void)getWaveformDataWithNumberOfPoints:(UInt32)numberOfPoints
completion:(EZAudioWaveformDataCompletionBlock)completion
{
if (!completion)
{
return;
}
// async get waveform data
__weak EZAudioFile *weakSelf = self;
dispatch_async(self.waveformQueue, ^{
EZAudioFloatData *waveformData = [weakSelf getWaveformDataWithNumberOfPoints:numberOfPoints];
dispatch_async(dispatch_get_main_queue(), ^{
completion(waveformData.buffers, waveformData.bufferSize);
});
});
}
//------------------------------------------------------------------------------
- (AudioStreamBasicDescription)clientFormat
{
return self.info->clientFormat;
}
//------------------------------------------------------------------------------
- (NSTimeInterval)currentTime
{
return [EZAudioUtilities MAP:(float)[self frameIndex]
leftMin:0.0f
leftMax:(float)[self totalFrames]
rightMin:0.0f
rightMax:[self duration]];
}
//------------------------------------------------------------------------------
- (NSTimeInterval)duration
{
return self.info->duration;
}
//------------------------------------------------------------------------------
- (AudioStreamBasicDescription)fileFormat
{
return self.info->fileFormat;
}
//------------------------------------------------------------------------------
- (NSString *)formattedCurrentTime
{
return [EZAudioUtilities displayTimeStringFromSeconds:[self currentTime]];
}
//------------------------------------------------------------------------------
- (NSString *)formattedDuration
{
return [EZAudioUtilities displayTimeStringFromSeconds:[self duration]];
}
//------------------------------------------------------------------------------
- (SInt64)frameIndex
{
SInt64 frameIndex;
[EZAudioUtilities checkResult:ExtAudioFileTell(self.info->extAudioFileRef, &frameIndex)
operation:"Failed to get frame index"];
return frameIndex;
}
//------------------------------------------------------------------------------
- (NSDictionary *)metadata
{
// get size of metadata property (dictionary)
UInt32 propSize = sizeof(self.info->audioFileID);
CFDictionaryRef metadata;
UInt32 writable;
[EZAudioUtilities checkResult:AudioFileGetPropertyInfo(self.info->audioFileID,
kAudioFilePropertyInfoDictionary,
&propSize,
&writable)
operation:"Failed to get the size of the metadata dictionary"];
// pull metadata
[EZAudioUtilities checkResult:AudioFileGetProperty(self.info->audioFileID,
kAudioFilePropertyInfoDictionary,
&propSize,
&metadata)
operation:"Failed to get metadata dictionary"];
// cast to NSDictionary
return (__bridge NSDictionary*)metadata;
}
//------------------------------------------------------------------------------
- (NSTimeInterval)totalDuration
{
return self.info->duration;
}
//------------------------------------------------------------------------------
- (SInt64)totalClientFrames
{
SInt64 totalFrames = [self totalFrames];
AudioStreamBasicDescription clientFormat = self.info->clientFormat;
AudioStreamBasicDescription fileFormat = self.info->fileFormat;
BOOL sameSampleRate = clientFormat.mSampleRate == fileFormat.mSampleRate;
if (!sameSampleRate)
{
totalFrames = self.info->duration * clientFormat.mSampleRate;
}
return totalFrames;
}
//------------------------------------------------------------------------------
- (SInt64)totalFrames
{
return self.info->frames;
}
//------------------------------------------------------------------------------
- (NSURL *)url
{
return (__bridge NSURL*)self.info->sourceURL;
}
//------------------------------------------------------------------------------
#pragma mark - Setters
//------------------------------------------------------------------------------
- (void)setClientFormat:(AudioStreamBasicDescription)clientFormat
{
//
// Clear any float data currently cached
//
if (self.floatData)
{
self.floatData = nil;
}
//
// Client format can only be linear PCM!
//
NSAssert([EZAudioUtilities isLinearPCM:clientFormat], @"Client format must be linear PCM");
//
// Store the client format
//
self.info->clientFormat = clientFormat;
//
// Set the client format on the ExtAudioFileRef
//
[EZAudioUtilities checkResult:ExtAudioFileSetProperty(self.info->extAudioFileRef,
kExtAudioFileProperty_ClientDataFormat,
sizeof(clientFormat),
&clientFormat)
operation:"Couldn't set client data format on file"];
//
// Create a new float converter using the client format as the input format
//
self.floatConverter = [EZAudioFloatConverter converterWithInputFormat:clientFormat];
//
// Determine how big our float buffers need to be to hold a buffer of float
// data for the audio received callback.
//
UInt32 maxPacketSize;
UInt32 propSize = sizeof(maxPacketSize);
[EZAudioUtilities checkResult:ExtAudioFileGetProperty(self.info->extAudioFileRef,
kExtAudioFileProperty_ClientMaxPacketSize,
&propSize,
&maxPacketSize)
operation:"Failed to get max packet size"];
self.floatData = [EZAudioUtilities floatBuffersWithNumberOfFrames:1024
numberOfChannels:self.clientFormat.mChannelsPerFrame];
}
//------------------------------------------------------------------------------
- (void)setCurrentTime:(NSTimeInterval)currentTime
{
NSAssert(currentTime < [self duration], @"Invalid seek operation, expected current time to be less than duration");
SInt64 frame = [EZAudioUtilities MAP:currentTime
leftMin:0.0f
leftMax:[self duration]
rightMin:0.0f
rightMax:[self totalFrames]];
[self seekToFrame:frame];
}
//------------------------------------------------------------------------------
#pragma mark - Description
//------------------------------------------------------------------------------
- (NSString *)description
{
return [NSString stringWithFormat:@"%@ {\n"
" url: %@,\n"
" duration: %f,\n"
" totalFrames: %lld,\n"
" metadata: %@,\n"
" fileFormat: { %@ },\n"
" clientFormat: { %@ } \n"
"}",
[super description],
[self url],
[self duration],
[self totalFrames],
[self metadata],
[EZAudioUtilities stringForAudioStreamBasicDescription:[self fileFormat]],
[EZAudioUtilities stringForAudioStreamBasicDescription:[self clientFormat]]];
}
//------------------------------------------------------------------------------
@end
+414
View File
@@ -0,0 +1,414 @@
//
// EZAudioPlayer.h
// EZAudio
//
// Created by Syed Haris Ali on 1/16/14.
// Copyright (c) 2014 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import "TargetConditionals.h"
#import "EZAudioFile.h"
#import "EZOutput.h"
@class EZAudioPlayer;
//------------------------------------------------------------------------------
#pragma mark - Notifications
//------------------------------------------------------------------------------
/**
Notification that occurs whenever the EZAudioPlayer changes its `audioFile` property. Check the new value using the EZAudioPlayer's `audioFile` property.
*/
FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangeAudioFileNotification;
/**
Notification that occurs whenever the EZAudioPlayer changes its `device` property. Check the new value using the EZAudioPlayer's `device` property.
*/
FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangeOutputDeviceNotification;
/**
Notification that occurs whenever the EZAudioPlayer changes its `output` component's `pan` property. Check the new value using the EZAudioPlayer's `pan` property.
*/
FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangePanNotification;
/**
Notification that occurs whenever the EZAudioPlayer changes its `output` component's play state. Check the new value using the EZAudioPlayer's `isPlaying` property.
*/
FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangePlayStateNotification;
/**
Notification that occurs whenever the EZAudioPlayer changes its `output` component's `volume` property. Check the new value using the EZAudioPlayer's `volume` property.
*/
FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangeVolumeNotification;
/**
Notification that occurs whenever the EZAudioPlayer has reached the end of a file and its `shouldLoop` property has been set to NO.
*/
FOUNDATION_EXPORT NSString * const EZAudioPlayerDidReachEndOfFileNotification;
/**
Notification that occurs whenever the EZAudioPlayer performs a seek via the `seekToFrame` method or `setCurrentTime:` property setter. Check the new `currentTime` or `frameIndex` value using the EZAudioPlayer's `currentTime` or `frameIndex` property, respectively.
*/
FOUNDATION_EXPORT NSString * const EZAudioPlayerDidSeekNotification;
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlayerDelegate
//------------------------------------------------------------------------------
/**
The EZAudioPlayerDelegate provides event callbacks for the EZAudioPlayer. Since 0.5.0 the EZAudioPlayerDelegate provides a smaller set of delegate methods in favor of notifications to allow multiple receivers of the EZAudioPlayer event callbacks since only one player is typically used in an application. Specifically, these methods are provided for high frequency callbacks that wrap the EZAudioPlayer's internal EZAudioFile and EZOutput instances.
@warning These callbacks don't necessarily occur on the main thread so make sure you wrap any UI code in a GCD block like: dispatch_async(dispatch_get_main_queue(), ^{ // Update UI });
*/
@protocol EZAudioPlayerDelegate <NSObject>
@optional
//------------------------------------------------------------------------------
/**
Triggered by the EZAudioPlayer's internal EZAudioFile's EZAudioFileDelegate callback and notifies 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.
@param audioPlayer The instance of the EZAudioPlayer that triggered the event
@param 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.
@param bufferSize The length of the buffers float arrays
@param numberOfChannels The number of channels. 2 for stereo, 1 for mono.
@param audioFile The instance of the EZAudioFile that the event was triggered from
*/
- (void) audioPlayer:(EZAudioPlayer *)audioPlayer
playedAudio:(float **)buffer
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels
inAudioFile:(EZAudioFile *)audioFile;;
//------------------------------------------------------------------------------
/**
Triggered by EZAudioPlayer's internal EZAudioFile's EZAudioFileDelegate callback and notifies the delegate of the current playback position. The framePosition provides the current frame position and can be calculated against the EZAudioPlayer's total frames using the `totalFrames` function from the EZAudioPlayer.
@param audioPlayer The instance of the EZAudioPlayer that triggered the event
@param framePosition The new frame index as a 64-bit signed integer
@param audioFile The instance of the EZAudioFile that the event was triggered from
*/
- (void)audioPlayer:(EZAudioPlayer *)audioPlayer
updatedPosition:(SInt64)framePosition
inAudioFile:(EZAudioFile *)audioFile;
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlayer
//------------------------------------------------------------------------------
/**
The EZAudioPlayer provides an interface that combines the EZAudioFile and EZOutput to play local audio files. This class acts as the master delegate (the EZAudioFileDelegate) over whatever EZAudioFile instance, the `audioFile` property, it is using for playback as well as the EZOutputDelegate and EZOutputDataSource over whatever EZOutput instance is set as the `output`. Classes that want to get the EZAudioFileDelegate callbacks should implement the EZAudioPlayer's EZAudioPlayerDelegate on the EZAudioPlayer instance. Since 0.5.0 the EZAudioPlayer offers notifications over the usual delegate methods to allow multiple receivers to get the EZAudioPlayer's state changes since one player will typically be used in one application. The EZAudioPlayerDelegate, the `delegate`, provides callbacks for high frequency methods that simply wrap the EZAudioFileDelegate and EZOutputDelegate callbacks for providing the audio buffer played as well as the position updating (you will typically have one scrub bar in an application).
*/
@interface EZAudioPlayer : NSObject <EZAudioFileDelegate,
EZOutputDataSource,
EZOutputDelegate>
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Properties
///-----------------------------------------------------------
/**
The EZAudioPlayerDelegate that will handle the audio player callbacks
*/
@property (nonatomic, weak) id<EZAudioPlayerDelegate> delegate;
//------------------------------------------------------------------------------
/**
A BOOL indicating whether the player should loop the file
*/
@property (nonatomic, assign) BOOL shouldLoop;
//------------------------------------------------------------------------------
#pragma mark - Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Initializers
///-----------------------------------------------------------
/**
Initializes the EZAudioPlayer with an EZAudioFile instance. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
@param audioFile The instance of the EZAudioFile to use for initializing the EZAudioPlayer
@return The newly created instance of the EZAudioPlayer
*/
- (instancetype)initWithAudioFile:(EZAudioFile *)audioFile;
//------------------------------------------------------------------------------
/**
Initializes the EZAudioPlayer with an EZAudioFile instance and provides a way to assign the EZAudioPlayerDelegate on instantiation. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
@param audioFile The instance of the EZAudioFile to use for initializing the EZAudioPlayer
@param delegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the initWithAudioFile: function instead.
@return The newly created instance of the EZAudioPlayer
*/
- (instancetype)initWithAudioFile:(EZAudioFile *)audioFile
delegate:(id<EZAudioPlayerDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Initializes the EZAudioPlayer with an EZAudioPlayerDelegate.
@param delegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the initWithAudioFile: function instead.
@return The newly created instance of the EZAudioPlayer
*/
- (instancetype)initWithDelegate:(id<EZAudioPlayerDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Initializes the EZAudioPlayer with an NSURL instance representing the file path of the audio file.
@param url The NSURL instance representing the file path of the audio file.
@return The newly created instance of the EZAudioPlayer
*/
- (instancetype)initWithURL:(NSURL*)url;
//------------------------------------------------------------------------------
/**
Initializes the EZAudioPlayer with an NSURL instance representing the file path of the audio file and a caller to assign as the EZAudioPlayerDelegate on instantiation.
@param url The NSURL instance representing the file path of the audio file.
@param delegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the initWithAudioFile: function instead.
@return The newly created instance of the EZAudioPlayer
*/
- (instancetype)initWithURL:(NSURL*)url
delegate:(id<EZAudioPlayerDelegate>)delegate;
//------------------------------------------------------------------------------
#pragma mark - Class Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Class Initializers
///-----------------------------------------------------------
/**
Class initializer that creates a default EZAudioPlayer.
@return The newly created instance of the EZAudioPlayer
*/
+ (instancetype)audioPlayer;
//------------------------------------------------------------------------------
/**
Class initializer that creates the EZAudioPlayer with an EZAudioFile instance. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
@param audioFile The instance of the EZAudioFile to use for initializing the EZAudioPlayer
@return The newly created instance of the EZAudioPlayer
*/
+ (instancetype)audioPlayerWithAudioFile:(EZAudioFile *)audioFile;
//------------------------------------------------------------------------------
/**
Class initializer that creates the EZAudioPlayer with an EZAudioFile instance and provides a way to assign the EZAudioPlayerDelegate on instantiation. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
@param audioFile The instance of the EZAudioFile to use for initializing the EZAudioPlayer
@param delegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the audioPlayerWithAudioFile: function instead.
@return The newly created instance of the EZAudioPlayer
*/
+ (instancetype)audioPlayerWithAudioFile:(EZAudioFile *)audioFile
delegate:(id<EZAudioPlayerDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Class initializer that creates a default EZAudioPlayer with an EZAudioPlayerDelegate..
@return The newly created instance of the EZAudioPlayer
*/
+ (instancetype)audioPlayerWithDelegate:(id<EZAudioPlayerDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Class initializer that creates the EZAudioPlayer with an NSURL instance representing the file path of the audio file.
@param url The NSURL instance representing the file path of the audio file.
@return The newly created instance of the EZAudioPlayer
*/
+ (instancetype)audioPlayerWithURL:(NSURL*)url;
//------------------------------------------------------------------------------
/**
Class initializer that creates the EZAudioPlayer with an NSURL instance representing the file path of the audio file and a caller to assign as the EZAudioPlayerDelegate on instantiation.
@param url The NSURL instance representing the file path of the audio file.
@param delegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the audioPlayerWithURL: function instead.
@return The newly created instance of the EZAudioPlayer
*/
+ (instancetype)audioPlayerWithURL:(NSURL*)url
delegate:(id<EZAudioPlayerDelegate>)delegate;
//------------------------------------------------------------------------------
#pragma mark - Singleton
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Shared Instance
///-----------------------------------------------------------
/**
The shared instance (singleton) of the audio player. Most applications will only have one instance of the EZAudioPlayer that can be reused with multiple different audio files.
* @return The shared instance of the EZAudioPlayer.
*/
+ (instancetype)sharedAudioPlayer;
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Properties
///-----------------------------------------------------------
/**
Provides the EZAudioFile instance that is being used as the datasource for playback. When set it creates a copy of the EZAudioFile provided for internal use. This does not use the EZAudioFile by reference, but instead creates a copy of the EZAudioFile instance provided.
*/
@property (nonatomic, readwrite, copy) EZAudioFile *audioFile;
//------------------------------------------------------------------------------
/**
Provides the current offset in the audio file as an NSTimeInterval (i.e. in seconds). When setting this it will determine the correct frame offset and perform a `seekToFrame` to the new time offset.
@warning Make sure the new current time offset is less than the `duration` or you will receive an invalid seek assertion.
*/
@property (nonatomic, readwrite) NSTimeInterval currentTime;
//------------------------------------------------------------------------------
/**
The EZAudioDevice instance that is being used by the `output`. Similarly, setting this just sets the `device` property of the `output`.
*/
@property (readwrite) EZAudioDevice *device;
//------------------------------------------------------------------------------
/**
Provides the duration of the audio file in seconds.
*/
@property (readonly) NSTimeInterval duration;
//------------------------------------------------------------------------------
/**
Provides the current time as an NSString with the time format MM:SS.
*/
@property (readonly) NSString *formattedCurrentTime;
//------------------------------------------------------------------------------
/**
Provides the duration as an NSString with the time format MM:SS.
*/
@property (readonly) NSString *formattedDuration;
//------------------------------------------------------------------------------
/**
Provides the EZOutput that is being used to handle the actual playback of the audio data. This property is also settable, but note that the EZAudioPlayer will become the output's EZOutputDataSource and EZOutputDelegate. To listen for the EZOutput's delegate methods your view should implement the EZAudioPlayerDelegate and set itself as the EZAudioPlayer's `delegate`.
*/
@property (nonatomic, strong, readwrite) EZOutput *output;
//------------------------------------------------------------------------------
/**
Provides the frame index (a.k.a the seek positon) within the audio file being used for playback. This can be helpful when seeking through the audio file.
@return An SInt64 representing the current frame index within the audio file used for playback.
*/
@property (readonly) SInt64 frameIndex;
//------------------------------------------------------------------------------
/**
Provides a flag indicating whether the EZAudioPlayer is currently playing back any audio.
@return A BOOL indicating whether or not the EZAudioPlayer is performing playback,
*/
@property (readonly) BOOL isPlaying;
//------------------------------------------------------------------------------
/**
Provides the current pan from the audio player's internal `output` component. Setting the pan adjusts the direction of the audio signal from left (0) to right (1). Default is 0.5 (middle).
*/
@property (nonatomic, assign) float pan;
//------------------------------------------------------------------------------
/**
Provides the total amount of frames in the current audio file being used for playback.
@return A SInt64 representing the total amount of frames in the current audio file being used for playback.
*/
@property (readonly) SInt64 totalFrames;
//------------------------------------------------------------------------------
/**
Provides the file path that's currently being used by the player for playback.
@return The NSURL representing the file path of the audio file being used for playback.
*/
@property (nonatomic, copy, readonly) NSURL *url;
//------------------------------------------------------------------------------
/**
Provides the current volume from the audio player's internal `output` component. Setting the volume adjusts the gain of the output between 0 and 1. Default is 1.
*/
@property (nonatomic, assign) float volume;
//------------------------------------------------------------------------------
#pragma mark - Actions
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Controlling Playback
///-----------------------------------------------------------
/**
Starts playback.
*/
- (void)play;
//------------------------------------------------------------------------------
/**
Loads an EZAudioFile and immediately starts playing it.
@param audioFile An EZAudioFile to use for immediate playback.
*/
- (void)playAudioFile:(EZAudioFile *)audioFile;
//------------------------------------------------------------------------------
/**
Pauses playback.
*/
- (void)pause;
//------------------------------------------------------------------------------
/**
Seeks playback to a specified frame within the internal EZAudioFile. This will notify the EZAudioFileDelegate (if specified) with the audioPlayer:updatedPosition:inAudioFile: function.
@param frame The new frame position to seek to as a SInt64.
*/
- (void)seekToFrame:(SInt64)frame;
@end
+441
View File
@@ -0,0 +1,441 @@
//
// EZAudioPlayer.m
// EZAudio
//
// Created by Syed Haris Ali on 1/16/14.
// Copyright (c) 2014 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "EZAudioPlayer.h"
#import "EZAudioUtilities.h"
//------------------------------------------------------------------------------
#pragma mark - Notifications
//------------------------------------------------------------------------------
NSString * const EZAudioPlayerDidChangeAudioFileNotification = @"EZAudioPlayerDidChangeAudioFileNotification";
NSString * const EZAudioPlayerDidChangeOutputDeviceNotification = @"EZAudioPlayerDidChangeOutputDeviceNotification";
NSString * const EZAudioPlayerDidChangePanNotification = @"EZAudioPlayerDidChangePanNotification";
NSString * const EZAudioPlayerDidChangePlayStateNotification = @"EZAudioPlayerDidChangePlayStateNotification";
NSString * const EZAudioPlayerDidChangeVolumeNotification = @"EZAudioPlayerDidChangeVolumeNotification";
NSString * const EZAudioPlayerDidReachEndOfFileNotification = @"EZAudioPlayerDidReachEndOfFileNotification";
NSString * const EZAudioPlayerDidSeekNotification = @"EZAudioPlayerDidSeekNotification";
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlayer (Implementation)
//------------------------------------------------------------------------------
@implementation EZAudioPlayer
//------------------------------------------------------------------------------
#pragma mark - Class Methods
//------------------------------------------------------------------------------
+ (instancetype)audioPlayer
{
return [[self alloc] init];
}
//------------------------------------------------------------------------------
+ (instancetype)audioPlayerWithDelegate:(id<EZAudioPlayerDelegate>)delegate
{
return [[self alloc] initWithDelegate:delegate];
}
//------------------------------------------------------------------------------
+ (instancetype)audioPlayerWithAudioFile:(EZAudioFile *)audioFile
{
return [[self alloc] initWithAudioFile:audioFile];
}
//------------------------------------------------------------------------------
+ (instancetype)audioPlayerWithAudioFile:(EZAudioFile *)audioFile
delegate:(id<EZAudioPlayerDelegate>)delegate
{
return [[self alloc] initWithAudioFile:audioFile
delegate:delegate];
}
//------------------------------------------------------------------------------
+ (instancetype)audioPlayerWithURL:(NSURL *)url
{
return [[self alloc] initWithURL:url];
}
//------------------------------------------------------------------------------
+ (instancetype)audioPlayerWithURL:(NSURL *)url
delegate:(id<EZAudioPlayerDelegate>)delegate
{
return [[self alloc] initWithURL:url delegate:delegate];
}
//------------------------------------------------------------------------------
#pragma mark - Initialization
//------------------------------------------------------------------------------
- (instancetype)init
{
self = [super init];
if (self)
{
[self setup];
}
return self;
}
//------------------------------------------------------------------------------
- (instancetype)initWithDelegate:(id<EZAudioPlayerDelegate>)delegate
{
self = [self init];
if (self)
{
self.delegate = delegate;
}
return self;
}
//------------------------------------------------------------------------------
- (instancetype)initWithAudioFile:(EZAudioFile *)audioFile
{
return [self initWithAudioFile:audioFile delegate:nil];
}
//------------------------------------------------------------------------------
- (instancetype)initWithAudioFile:(EZAudioFile *)audioFile
delegate:(id<EZAudioPlayerDelegate>)delegate
{
self = [self initWithDelegate:delegate];
if (self)
{
self.audioFile = audioFile;
}
return self;
}
//------------------------------------------------------------------------------
- (instancetype)initWithURL:(NSURL *)url
{
return [self initWithURL:url delegate:nil];
}
//------------------------------------------------------------------------------
- (instancetype)initWithURL:(NSURL *)url
delegate:(id<EZAudioPlayerDelegate>)delegate
{
self = [self initWithDelegate:delegate];
if (self)
{
self.audioFile = [EZAudioFile audioFileWithURL:url delegate:self];
}
return self;
}
//------------------------------------------------------------------------------
#pragma mark - Singleton
//------------------------------------------------------------------------------
+ (instancetype)sharedAudioPlayer
{
static EZAudioPlayer *player;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^
{
player = [[self alloc] init];
});
return player;
}
//------------------------------------------------------------------------------
#pragma mark - Setup
//------------------------------------------------------------------------------
- (void)setup
{
self.output = [EZOutput output];
}
//------------------------------------------------------------------------------
#pragma mark - Getters
//------------------------------------------------------------------------------
- (NSTimeInterval)currentTime
{
return [self.audioFile currentTime];
}
//------------------------------------------------------------------------------
- (EZAudioDevice *)device
{
return [self.output device];
}
//------------------------------------------------------------------------------
- (NSTimeInterval)duration
{
return [self.audioFile duration];
}
//------------------------------------------------------------------------------
- (NSString *)formattedCurrentTime
{
return [self.audioFile formattedCurrentTime];
}
//------------------------------------------------------------------------------
- (NSString *)formattedDuration
{
return [self.audioFile formattedDuration];
}
//------------------------------------------------------------------------------
- (SInt64)frameIndex
{
return [self.audioFile frameIndex];
}
//------------------------------------------------------------------------------
- (BOOL)isPlaying
{
return [self.output isPlaying];
}
//------------------------------------------------------------------------------
- (float)pan
{
return [self.output pan];
}
//------------------------------------------------------------------------------
- (SInt64)totalFrames
{
return [self.audioFile totalFrames];
}
//------------------------------------------------------------------------------
- (float)volume
{
return [self.output volume];
}
//------------------------------------------------------------------------------
#pragma mark - Setters
//------------------------------------------------------------------------------
- (void)setAudioFile:(EZAudioFile *)audioFile
{
_audioFile = [audioFile copy];
_audioFile.delegate = self;
AudioStreamBasicDescription inputFormat = _audioFile.clientFormat;
[self.output setInputFormat:inputFormat];
[[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidChangeAudioFileNotification
object:self];
}
//------------------------------------------------------------------------------
- (void)setCurrentTime:(NSTimeInterval)currentTime
{
[self.audioFile setCurrentTime:currentTime];
[[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidSeekNotification
object:self];
}
//------------------------------------------------------------------------------
- (void)setDevice:(EZAudioDevice *)device
{
[self.output setDevice:device];
}
//------------------------------------------------------------------------------
- (void)setOutput:(EZOutput *)output
{
_output = output;
_output.dataSource = self;
_output.delegate = self;
}
//------------------------------------------------------------------------------
- (void)setPan:(float)pan
{
[self.output setPan:pan];
[[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidChangePanNotification
object:self];
}
//------------------------------------------------------------------------------
- (void)setVolume:(float)volume
{
[self.output setVolume:volume];
[[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidChangeVolumeNotification
object:self];
}
//------------------------------------------------------------------------------
#pragma mark - Actions
//------------------------------------------------------------------------------
- (void)play
{
[self.output startPlayback];
}
//------------------------------------------------------------------------------
- (void)playAudioFile:(EZAudioFile *)audioFile
{
//
// stop playing anything that might currently be playing
//
[self pause];
//
// set new stream
//
self.audioFile = audioFile;
//
// begin playback
//
[self play];
}
//------------------------------------------------------------------------------
- (void)pause
{
[self.output stopPlayback];
}
//------------------------------------------------------------------------------
- (void)seekToFrame:(SInt64)frame
{
[self.audioFile seekToFrame:frame];
[[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidSeekNotification
object:self];
}
//------------------------------------------------------------------------------
#pragma mark - EZOutputDataSource
//------------------------------------------------------------------------------
- (OSStatus) output:(EZOutput *)output
shouldFillAudioBufferList:(AudioBufferList *)audioBufferList
withNumberOfFrames:(UInt32)frames
timestamp:(const AudioTimeStamp *)timestamp
{
if (self.audioFile)
{
UInt32 bufferSize;
BOOL eof;
[self.audioFile readFrames:frames
audioBufferList:audioBufferList
bufferSize:&bufferSize
eof:&eof];
if (eof && self.shouldLoop)
{
[self seekToFrame:0];
}
else if (eof)
{
[self pause];
[self seekToFrame:0];
[[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidReachEndOfFileNotification
object:self];
}
}
return noErr;
}
//------------------------------------------------------------------------------
#pragma mark - EZAudioFileDelegate
//------------------------------------------------------------------------------
- (void)audioFile:(EZAudioFile *)audioFile updatedPosition:(SInt64)framePosition
{
if ([self.delegate respondsToSelector:@selector(audioPlayer:updatedPosition:inAudioFile:)])
{
[self.delegate audioPlayer:self
updatedPosition:framePosition
inAudioFile:audioFile];
}
}
//------------------------------------------------------------------------------
#pragma mark - EZOutputDelegate
//------------------------------------------------------------------------------
- (void)output:(EZOutput *)output changedDevice:(EZAudioDevice *)device
{
[[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidChangeOutputDeviceNotification
object:self];
}
//------------------------------------------------------------------------------
- (void)output:(EZOutput *)output changedPlayingState:(BOOL)isPlaying
{
[[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidChangePlayStateNotification
object:self];
}
//------------------------------------------------------------------------------
- (void) output:(EZOutput *)output
playedAudio:(float **)buffer
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels
{
if ([self.delegate respondsToSelector:@selector(audioPlayer:playedAudio:withBufferSize:withNumberOfChannels:inAudioFile:)])
{
[self.delegate audioPlayer:self
playedAudio:buffer
withBufferSize:bufferSize
withNumberOfChannels:numberOfChannels
inAudioFile:self.audioFile];
}
}
//------------------------------------------------------------------------------
@end
@@ -3,7 +3,7 @@
// EZAudio
//
// Created by Syed Haris Ali on 9/2/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -36,7 +36,7 @@
//------------------------------------------------------------------------------
/**
The delegate for the EZMicrophone provides a receiver for the incoming audio data events. When the microphone has been successfully internally configured it will try to send its delegate an AudioStreamBasicDescription describing the format of the incoming audio data.
The EZMicrophoneDelegate for the EZMicrophone provides a receiver for the incoming audio data events. When the microphone has been successfully internally configured it will try to send its delegate an AudioStreamBasicDescription describing the format of the incoming audio data.
The audio data itself is sent back to the delegate in various forms:
@@ -55,10 +55,9 @@
///-----------------------------------------------------------
/**
Called anytime the input device changes on an `EZMicrophone` instance. Mac only.
Called anytime the input device changes on an `EZMicrophone` instance.
@param microphone The instance of the EZMicrophone that triggered the event.
@param device The instance of the new EZAudioDevice the microphone is using to pull input.
@param notification Incase the device changed because of a notification (like from AVAudioSession) then we provide that notification to give the full context of the change.
*/
- (void)microphone:(EZMicrophone *)microphone changedDevice:(EZAudioDevice *)device;
@@ -77,7 +76,7 @@
///-----------------------------------------------------------
/**
Returns back a float array of the audio received. This occurs on the background thread so any drawing code must explicity perform its functions on the main thread.
This method provides an array of float arrays of the audio received, each float array representing a channel of audio data This occurs on the background thread so any drawing code must explicity perform its functions on the main thread.
@param microphone The instance of the EZMicrophone that triggered the event.
@param buffer The audio data as an array of float arrays. In a stereo signal buffer[0] represents the left channel while buffer[1] would represent the right channel.
@param bufferSize The size of each of the buffers (the length of each float array).
@@ -304,7 +303,9 @@
*/
- (AudioUnit *)audioUnit;
//------------------------------------------------------------------------------
#pragma mark - Setters
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Customizing The Microphone Stream Format
@@ -3,7 +3,7 @@
// EZAudio
//
// Created by Syed Haris Ali on 9/2/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -41,6 +41,17 @@ typedef struct EZMicrophoneInfo
AudioStreamBasicDescription streamFormat;
} EZMicrophoneInfo;
//------------------------------------------------------------------------------
#pragma mark - Callbacks
//------------------------------------------------------------------------------
static OSStatus EZAudioMicrophoneCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData);
//------------------------------------------------------------------------------
#pragma mark - EZMicrophone (Interface Extension)
//------------------------------------------------------------------------------
@@ -66,53 +77,6 @@ typedef struct EZMicrophoneInfo
free(self.info);
}
//------------------------------------------------------------------------------
#pragma mark - Callbacks
//------------------------------------------------------------------------------
static OSStatus EZAudioMicrophoneCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData)
{
EZMicrophone *microphone = (__bridge EZMicrophone *)inRefCon;
EZMicrophoneInfo *info = (EZMicrophoneInfo *)microphone.info;
// render audio into buffer
OSStatus result = AudioUnitRender(info->audioUnit,
ioActionFlags,
inTimeStamp,
inBusNumber,
inNumberFrames,
info->audioBufferList);
// notify delegate of new buffer list to process
if ([microphone.delegate respondsToSelector:@selector(microphone:hasBufferList:withBufferSize:withNumberOfChannels:)])
{
[microphone.delegate microphone:microphone
hasBufferList:info->audioBufferList
withBufferSize:inNumberFrames
withNumberOfChannels:info->streamFormat.mChannelsPerFrame];
}
// notify delegate of new float data processed
if ([microphone.delegate respondsToSelector:@selector(microphone:hasAudioReceived:withBufferSize:withNumberOfChannels:)])
{
// convert to float
[microphone.floatConverter convertDataFromAudioBufferList:info->audioBufferList
withNumberOfFrames:inNumberFrames
toFloatBuffers:info->floatData];
[microphone.delegate microphone:microphone
hasAudioReceived:info->floatData
withBufferSize:inNumberFrames
withNumberOfChannels:info->streamFormat.mChannelsPerFrame];
}
return result;
}
//------------------------------------------------------------------------------
#pragma mark - Initialization
//------------------------------------------------------------------------------
@@ -571,21 +535,23 @@ static OSStatus EZAudioMicrophoneCallback(void *inRefCon,
- (void)setOutput:(EZOutput *)output
{
_output = output;
[_output setAudioStreamBasicDescription:self.audioStreamBasicDescription];
_output.outputDataSource = self;
_output.inputFormat = self.audioStreamBasicDescription;
_output.dataSource = self;
}
//------------------------------------------------------------------------------
#pragma mark - EZOutputDataSource
//------------------------------------------------------------------------------
- (void) output:(EZOutput *)output
- (OSStatus) output:(EZOutput *)output
shouldFillAudioBufferList:(AudioBufferList *)audioBufferList
withNumberOfFrames:(UInt32)frames
timestamp:(const AudioTimeStamp *)timestamp
{
memcpy(audioBufferList,
self.info->audioBufferList,
sizeof(AudioBufferList) + (self.info->audioBufferList->mNumberBuffers - 1)*sizeof(AudioBuffer));
return noErr;
}
//------------------------------------------------------------------------------
@@ -602,9 +568,60 @@ static OSStatus EZAudioMicrophoneCallback(void *inRefCon,
- (UInt32)numberOfChannels
{
#if TARGET_OS_IPHONE
return 1;
#elif TARGET_OS_MAC
return (UInt32)self.device.inputChannelCount;
#endif
}
//------------------------------------------------------------------------------
@end
@end
//------------------------------------------------------------------------------
#pragma mark - Callbacks
//------------------------------------------------------------------------------
static OSStatus EZAudioMicrophoneCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData)
{
EZMicrophone *microphone = (__bridge EZMicrophone *)inRefCon;
EZMicrophoneInfo *info = (EZMicrophoneInfo *)microphone.info;
// render audio into buffer
OSStatus result = AudioUnitRender(info->audioUnit,
ioActionFlags,
inTimeStamp,
inBusNumber,
inNumberFrames,
info->audioBufferList);
// notify delegate of new buffer list to process
if ([microphone.delegate respondsToSelector:@selector(microphone:hasBufferList:withBufferSize:withNumberOfChannels:)])
{
[microphone.delegate microphone:microphone
hasBufferList:info->audioBufferList
withBufferSize:inNumberFrames
withNumberOfChannels:info->streamFormat.mChannelsPerFrame];
}
// notify delegate of new float data processed
if ([microphone.delegate respondsToSelector:@selector(microphone:hasAudioReceived:withBufferSize:withNumberOfChannels:)])
{
// convert to float
[microphone.floatConverter convertDataFromAudioBufferList:info->audioBufferList
withNumberOfFrames:inNumberFrames
toFloatBuffers:info->floatData];
[microphone.delegate microphone:microphone
hasAudioReceived:info->floatData
withBufferSize:inNumberFrames
withNumberOfChannels:info->streamFormat.mChannelsPerFrame];
}
return result;
}
+376
View File
@@ -0,0 +1,376 @@
//
// EZOutput.h
// EZAudio
//
// Created by Syed Haris Ali on 12/2/13.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
#if TARGET_OS_IPHONE
#elif TARGET_OS_MAC
#import <AudioUnit/AudioUnit.h>
#endif
@class EZAudioDevice;
@class EZOutput;
//------------------------------------------------------------------------------
#pragma mark - Constants
//------------------------------------------------------------------------------
FOUNDATION_EXPORT UInt32 const EZOutputMaximumFramesPerSlice;
FOUNDATION_EXPORT Float64 const EZOutputDefaultSampleRate;
//------------------------------------------------------------------------------
#pragma mark - EZOutputDataSource
//------------------------------------------------------------------------------
/**
The EZOutputDataSource specifies a receiver to provide audio data when the EZOutput is started. Since the 0.4.0 release this has been simplified to only one data source method.
*/
@protocol EZOutputDataSource <NSObject>
@optional
///-----------------------------------------------------------
/// @name Providing Audio Data
///-----------------------------------------------------------
@required
/**
Provides a way to provide output with data anytime the EZOutput needs audio data to play. This function provides an already allocated AudioBufferList to use for providing audio data into the output buffer. The expected format of the audio data provided here is specified by the EZOutput `inputFormat` property. This audio data will be converted into the client format specified by the EZOutput `clientFormat` property.
@param output The instance of the EZOutput that asked for the data.
@param audioBufferList The AudioBufferList structure pointer that needs to be filled with audio data
@param frames The amount of frames as a UInt32 that output will need to properly fill its output buffer.
@param timestamp A AudioTimeStamp pointer to use if you need the current host time.
@return An OSStatus code. If there was no error then use the noErr status code.
*/
- (OSStatus) output:(EZOutput *)output
shouldFillAudioBufferList:(AudioBufferList *)audioBufferList
withNumberOfFrames:(UInt32)frames
timestamp:(const AudioTimeStamp *)timestamp;
@end
//------------------------------------------------------------------------------
#pragma mark - EZOutputDelegate
//------------------------------------------------------------------------------
/**
The EZOutputDelegate for the EZOutput component provides a receiver to handle play state, device, and audio data change events. This is very similar to the EZMicrophoneDelegate for the EZMicrophone and the EZAudioFileDelegate for the EZAudioFile.
*/
@protocol EZOutputDelegate <NSObject>
@optional
/**
Called anytime the EZOutput starts or stops.
@param output The instance of the EZOutput that triggered the event.
@param isPlaying A BOOL indicating whether the EZOutput instance is playing or not.
*/
- (void)output:(EZOutput *)output changedPlayingState:(BOOL)isPlaying;
//------------------------------------------------------------------------------
/**
Called anytime the `device` changes on an EZOutput instance.
@param output The instance of the EZOutput that triggered the event.
@param device The instance of the new EZAudioDevice the output is using to play audio data.
*/
- (void)output:(EZOutput *)output changedDevice:(EZAudioDevice *)device;
//------------------------------------------------------------------------------
/**
Like the EZMicrophoneDelegate, for the EZOutput this method provides an array of float arrays of the audio received, each float array representing a channel of audio data. This occurs on the background thread so any drawing code must explicity perform its functions on the main thread.
@param output The instance of the EZOutput that triggered the event.
@param buffer The audio data as an array of float arrays. In a stereo signal buffer[0] represents the left channel while buffer[1] would represent the right channel.
@param bufferSize A UInt32 representing the size of each of the buffers (the length of each float array).
@param numberOfChannels A UInt32 representing the number of channels (you can use this to know how many float arrays are in the `buffer` parameter.
@warning This function executes on a background thread to avoid blocking any audio operations. If operations should be performed on any other thread (like the main thread) it should be performed within a dispatch block like so: dispatch_async(dispatch_get_main_queue(), ^{ ...Your Code... })
*/
- (void) output:(EZOutput *)output
playedAudio:(float **)buffer
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels;
//------------------------------------------------------------------------------
@end
/**
The EZOutput component provides a generic output to glue all the other EZAudio components together and push whatever sound you've created to the default output device (think opposite of the microphone). The EZOutputDataSource provides the required AudioBufferList needed to populate the output buffer while the EZOutputDelegate provides the same kind of mechanism as the EZMicrophoneDelegate or EZAudioFileDelegate in that you will receive a callback that provides non-interleaved, float data for visualizing the output (done using an internal float converter). As of 0.4.0 the EZOutput has been simplified to a single EZOutputDataSource method and now uses an AUGraph to provide format conversion from the `inputFormat` to the playback graph's `clientFormat` linear PCM formats, mixer controls for setting volume and pan settings, hooks to add in any number of effect audio units (see the `connectOutputOfSourceNode:sourceNodeOutputBus:toDestinationNode:destinationNodeInputBus:inGraph:` subclass method), and hardware device toggling (via EZAudioDevice).
*/
@interface EZOutput : NSObject
//------------------------------------------------------------------------------
#pragma mark - Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Initializers
///-----------------------------------------------------------
/**
Creates a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
@param dataSource The EZOutputDataSource that will be used to pull the audio data for the output callback.
@return A newly created instance of the EZOutput class.
*/
- (instancetype)initWithDataSource:(id<EZOutputDataSource>)dataSource;
/**
Creates a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
@param dataSource The EZOutputDataSource that will be used to pull the audio data for the output callback.
@param inputFormat The AudioStreamBasicDescription of the EZOutput.
@warning AudioStreamBasicDescription input formats must be linear PCM!
@return A newly created instance of the EZOutput class.
*/
- (instancetype)initWithDataSource:(id<EZOutputDataSource>)dataSource
inputFormat:(AudioStreamBasicDescription)inputFormat;
//------------------------------------------------------------------------------
#pragma mark - Class Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Class Initializers
///-----------------------------------------------------------
/**
Class method to create a new instance of the EZOutput
@return A newly created instance of the EZOutput class.
*/
+ (instancetype)output;
/**
Class method to create a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
@param dataSource The EZOutputDataSource that will be used to pull the audio data for the output callback.
@return A newly created instance of the EZOutput class.
*/
+ (instancetype)outputWithDataSource:(id<EZOutputDataSource>)dataSource;
/**
Class method to create a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
@param dataSource The EZOutputDataSource that will be used to pull the audio data for the output callback.
@param audioStreamBasicDescription The AudioStreamBasicDescription of the EZOutput.
@warning AudioStreamBasicDescriptions that are invalid will cause the EZOutput to fail to initialize
@return A newly created instance of the EZOutput class.
*/
+ (instancetype)outputWithDataSource:(id<EZOutputDataSource>)dataSource
inputFormat:(AudioStreamBasicDescription)inputFormat;
//------------------------------------------------------------------------------
#pragma mark - Singleton
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Shared Instance
///-----------------------------------------------------------
/**
Creates a shared instance of the EZOutput (one app will usually only need one output and share the role of the EZOutputDataSource).
@return The shared instance of the EZOutput class.
*/
+ (instancetype)sharedOutput;
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Setting/Getting The Stream Formats
///-----------------------------------------------------------
/**
Provides the AudioStreamBasicDescription structure used at the beginning of the playback graph which is then converted into the `clientFormat` using the AUConverter audio unit.
@warning The AudioStreamBasicDescription set here must be linear PCM. Compressed formats are not supported...the EZAudioFile's clientFormat performs the audio conversion on the fly from compressed to linear PCM so there is no additional work to be done there.
@return An AudioStreamBasicDescription structure describing
*/
@property (nonatomic, readwrite) AudioStreamBasicDescription inputFormat;
//------------------------------------------------------------------------------
/**
Provides the AudioStreamBasicDescription structure that serves as the common format used throughout the playback graph (similar to how the EZAudioFile as a clientFormat that is linear PCM to be shared amongst other components). The `inputFormat` is converted into this format at the beginning of the playback graph using an AUConverter audio unit. Defaults to the whatever the `defaultClientFormat` method returns is if a custom one isn't explicitly set.
@warning The AudioStreamBasicDescription set here must be linear PCM. Compressed formats are not supported by Audio Units.
@return An AudioStreamBasicDescription structure describing the common client format for the playback graph.
*/
@property (nonatomic, readwrite) AudioStreamBasicDescription clientFormat;
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Setting/Getting The Data Source and Delegate
///-----------------------------------------------------------
/**
The EZOutputDataSource that provides the audio data in the `inputFormat` for the EZOutput to play. If an EZOutputDataSource is not specified then the EZOutput will just output silence.
*/
@property (nonatomic, weak) id<EZOutputDataSource> dataSource;
//------------------------------------------------------------------------------
/**
The EZOutputDelegate for which to handle the output callbacks
*/
@property (nonatomic, weak) id<EZOutputDelegate> delegate;
//------------------------------------------------------------------------------
/**
Provides a flag indicating whether the EZOutput is pulling audio data from the EZOutputDataSource for playback.
@return YES if the EZOutput is running, NO if it is stopped
*/
@property (readonly) BOOL isPlaying;
//------------------------------------------------------------------------------
/**
Provides the current pan from the audio player's mixer audio unit in the playback graph. Setting the pan adjusts the direction of the audio signal from left (0) to right (1). Default is 0.5 (middle).
*/
@property (nonatomic, assign) float pan;
//------------------------------------------------------------------------------
/**
Provides the current volume from the audio player's mixer audio unit in the playback graph. Setting the volume adjusts the gain of the output between 0 and 1. Default is 1.
*/
@property (nonatomic, assign) float volume;
//------------------------------------------------------------------------------
#pragma mark - Core Audio Properties
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Core Audio Properties
///-----------------------------------------------------------
/**
The AUGraph used to chain together the converter, mixer, and output audio units.
*/
@property (readonly) AUGraph graph;
//------------------------------------------------------------------------------
/**
The AudioUnit that is being used to convert the audio data coming into the output's playback graph.
*/
@property (readonly) AudioUnit converterAudioUnit;
//------------------------------------------------------------------------------
/**
The AudioUnit that is being used as the mixer to adjust the volume on the output's playback graph.
*/
@property (readonly) AudioUnit mixerAudioUnit;
//------------------------------------------------------------------------------
/**
The AudioUnit that is being used as the hardware output for the output's playback graph.
*/
@property (readonly) AudioUnit outputAudioUnit;
//------------------------------------------------------------------------------
#pragma mark - Setters
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Getting/Setting The Output's Hardware Device
///-----------------------------------------------------------
/**
An EZAudioDevice instance that is used to route the audio data out to the speaker. To find a list of available output devices see the EZAudioDevice `outputDevices` method.
*/
@property (nonatomic, strong, readwrite) EZAudioDevice *device;
//------------------------------------------------------------------------------
#pragma mark - Actions
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Starting/Stopping The Output
///-----------------------------------------------------------
/**
Starts pulling audio data from the EZOutputDataSource to the default device output.
*/
- (void)startPlayback;
///-----------------------------------------------------------
/**
Stops pulling audio data from the EZOutputDataSource to the default device output.
*/
- (void)stopPlayback;
//------------------------------------------------------------------------------
#pragma mark - Subclass
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Subclass
///-----------------------------------------------------------
/**
This method handles connecting the converter node to the mixer node within the AUGraph that is being used as the playback graph. Subclasses can override this method and insert their custom nodes to perform effects processing on the audio data being rendered.
This was inspired by Daniel Kennett's blog post on how to add a custom equalizer to a CocoaLibSpotify SPCoreAudioController's AUGraph. For more information see Daniel's post and example code here: http://ikennd.ac/blog/2012/04/augraph-basics-in-cocoalibspotify/.
@param sourceNode An AUNode representing the node the audio data is coming from.
@param sourceNodeOutputBus A UInt32 representing the output bus from the source node that should be connected into the next node's input bus.
@param destinationNode An AUNode representing the node the audio data should be connected to.
@param destinationNodeInputBus A UInt32 representing the input bus the source node's output bus should be connecting to.
@param graph The AUGraph that is being used to hold the playback graph. Same as from the `graph` property.
@return An OSStatus code. For no error return back `noErr`.
*/
- (OSStatus)connectOutputOfSourceNode:(AUNode)sourceNode
sourceNodeOutputBus:(UInt32)sourceNodeOutputBus
toDestinationNode:(AUNode)destinationNode
destinationNodeInputBus:(UInt32)destinationNodeInputBus
inGraph:(AUGraph)graph;
//------------------------------------------------------------------------------
/**
The default AudioStreamBasicDescription set as the client format of the output if no custom `clientFormat` is set. Defaults to a 44.1 kHz stereo, non-interleaved, float format.
@return An AudioStreamBasicDescription that will be used as the default stream format.
*/
- (AudioStreamBasicDescription)defaultClientFormat;
//------------------------------------------------------------------------------
/**
The default AudioStreamBasicDescription set as the `inputFormat` of the output if no custom `inputFormat` is set. Defaults to a 44.1 kHz stereo, non-interleaved, float format.
@return An AudioStreamBasicDescription that will be used as the default stream format.
*/
- (AudioStreamBasicDescription)defaultInputFormat;
//------------------------------------------------------------------------------
/**
The default value used as the AudioUnit subtype when creating the hardware output component. By default this is kAudioUnitSubType_RemoteIO for iOS and kAudioUnitSubType_HALOutput for OSX.
@warning If you change this to anything other than kAudioUnitSubType_HALOutput for OSX you will get a failed assertion because devices can only be set when using the HAL audio unit.
@return An OSType that represents the AudioUnit subtype for the hardware output component.
*/
- (OSType)outputAudioUnitSubType;
@end
+756
View File
@@ -0,0 +1,756 @@
//
// EZOutput.m
// EZAudio
//
// Created by Syed Haris Ali on 12/2/13.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "EZOutput.h"
#import "EZAudioDevice.h"
#import "EZAudioFloatConverter.h"
#import "EZAudioUtilities.h"
//------------------------------------------------------------------------------
#pragma mark - Constants
//------------------------------------------------------------------------------
UInt32 const EZOutputMaximumFramesPerSlice = 4096;
Float64 const EZOutputDefaultSampleRate = 44100.0f;
//------------------------------------------------------------------------------
#pragma mark - Data Structures
//------------------------------------------------------------------------------
typedef struct
{
// stream format params
AudioStreamBasicDescription inputFormat;
AudioStreamBasicDescription clientFormat;
// float converted data
float **floatData;
// nodes
EZAudioNodeInfo converterNodeInfo;
EZAudioNodeInfo mixerNodeInfo;
EZAudioNodeInfo outputNodeInfo;
// audio graph
AUGraph graph;
} EZOutputInfo;
//------------------------------------------------------------------------------
#pragma mark - Callbacks (Declaration)
//------------------------------------------------------------------------------
OSStatus EZOutputConverterInputCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData);
//------------------------------------------------------------------------------
OSStatus EZOutputGraphRenderCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData);
//------------------------------------------------------------------------------
#pragma mark - EZOutput (Interface Extension)
//------------------------------------------------------------------------------
@interface EZOutput ()
@property (nonatomic, strong) EZAudioFloatConverter *floatConverter;
@property (nonatomic, assign) EZOutputInfo *info;
@end
//------------------------------------------------------------------------------
#pragma mark - EZOutput (Implementation)
//------------------------------------------------------------------------------
@implementation EZOutput
//------------------------------------------------------------------------------
#pragma mark - Dealloc
//------------------------------------------------------------------------------
- (void)dealloc
{
if (self.floatConverter)
{
self.floatConverter = nil;
[EZAudioUtilities freeFloatBuffers:self.info->floatData
numberOfChannels:self.info->clientFormat.mChannelsPerFrame];
}
[EZAudioUtilities checkResult:AUGraphStop(self.info->graph)
operation:"Failed to stop graph"];
[EZAudioUtilities checkResult:AUGraphClose(self.info->graph)
operation:"Failed to close graph"];
[EZAudioUtilities checkResult:AUGraphUninitialize(self.info->graph)
operation:"Failed to uninitialize graph"];
free(self.info);
}
//------------------------------------------------------------------------------
#pragma mark - Initialization
//------------------------------------------------------------------------------
- (instancetype) init
{
self = [super init];
if (self)
{
[self setup];
}
return self;
}
//------------------------------------------------------------------------------
- (instancetype)initWithDataSource:(id<EZOutputDataSource>)dataSource
{
self = [self init];
if (self)
{
self.dataSource = dataSource;
}
return self;
}
//------------------------------------------------------------------------------
- (instancetype)initWithDataSource:(id<EZOutputDataSource>)dataSource
inputFormat:(AudioStreamBasicDescription)inputFormat
{
self = [self initWithDataSource:dataSource];
if (self)
{
self.inputFormat = inputFormat;
}
return self;
}
//------------------------------------------------------------------------------
#pragma mark - Class Initializers
//------------------------------------------------------------------------------
+ (instancetype)output
{
return [[self alloc] init];
}
//------------------------------------------------------------------------------
+ (instancetype)outputWithDataSource:(id<EZOutputDataSource>)dataSource
{
return [[self alloc] initWithDataSource:dataSource];
}
//------------------------------------------------------------------------------
+ (instancetype)outputWithDataSource:(id<EZOutputDataSource>)dataSource
inputFormat:(AudioStreamBasicDescription)inputFormat
{
return [[self alloc] initWithDataSource:dataSource
inputFormat:inputFormat];
}
//------------------------------------------------------------------------------
#pragma mark - Singleton
//------------------------------------------------------------------------------
+ (instancetype)sharedOutput
{
static EZOutput *output;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^
{
output = [[self alloc] init];
});
return output;
}
//------------------------------------------------------------------------------
#pragma mark - Setup
//------------------------------------------------------------------------------
- (void)setup
{
//
// Create structure to hold state data
//
self.info = (EZOutputInfo *)malloc(sizeof(EZOutputInfo));
memset(self.info, 0, sizeof(EZOutputInfo));
//
// Setup the audio graph
//
[EZAudioUtilities checkResult:NewAUGraph(&self.info->graph)
operation:"Failed to create graph"];
//
// Add converter node
//
AudioComponentDescription converterDescription;
converterDescription.componentType = kAudioUnitType_FormatConverter;
converterDescription.componentSubType = kAudioUnitSubType_AUConverter;
converterDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
[EZAudioUtilities checkResult:AUGraphAddNode(self.info->graph,
&converterDescription,
&self.info->converterNodeInfo.node)
operation:"Failed to add converter node to audio graph"];
//
// Add mixer node
//
AudioComponentDescription mixerDescription;
mixerDescription.componentType = kAudioUnitType_Mixer;
#if TARGET_OS_IPHONE
mixerDescription.componentSubType = kAudioUnitSubType_MultiChannelMixer;
#elif TARGET_OS_MAC
mixerDescription.componentSubType = kAudioUnitSubType_StereoMixer;
#endif
mixerDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
[EZAudioUtilities checkResult:AUGraphAddNode(self.info->graph,
&mixerDescription,
&self.info->mixerNodeInfo.node)
operation:"Failed to add mixer node to audio graph"];
//
// Add output node
//
AudioComponentDescription outputDescription;
outputDescription.componentType = kAudioUnitType_Output;
outputDescription.componentSubType = [self outputAudioUnitSubType];
outputDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
[EZAudioUtilities checkResult:AUGraphAddNode(self.info->graph,
&outputDescription,
&self.info->outputNodeInfo.node)
operation:"Failed to add output node to audio graph"];
//
// Open the graph
//
[EZAudioUtilities checkResult:AUGraphOpen(self.info->graph)
operation:"Failed to open graph"];
//
// Make node connections
//
OSStatus status = [self connectOutputOfSourceNode:self.info->converterNodeInfo.node
sourceNodeOutputBus:0
toDestinationNode:self.info->mixerNodeInfo.node
destinationNodeInputBus:0
inGraph:self.info->graph];
[EZAudioUtilities checkResult:status
operation:"Failed to connect output of source node to destination node in graph"];
//
// Connect mixer to output
//
[EZAudioUtilities checkResult:AUGraphConnectNodeInput(self.info->graph,
self.info->mixerNodeInfo.node,
0,
self.info->outputNodeInfo.node,
0)
operation:"Failed to connect mixer node to output node"];
//
// Get the audio units
//
[EZAudioUtilities checkResult:AUGraphNodeInfo(self.info->graph,
self.info->converterNodeInfo.node,
&converterDescription,
&self.info->converterNodeInfo.audioUnit)
operation:"Failed to get converter audio unit"];
[EZAudioUtilities checkResult:AUGraphNodeInfo(self.info->graph,
self.info->mixerNodeInfo.node,
&mixerDescription,
&self.info->mixerNodeInfo.audioUnit)
operation:"Failed to get mixer audio unit"];
[EZAudioUtilities checkResult:AUGraphNodeInfo(self.info->graph,
self.info->outputNodeInfo.node,
&outputDescription,
&self.info->outputNodeInfo.audioUnit)
operation:"Failed to get output audio unit"];
//
// Add a node input callback for the converter node
//
AURenderCallbackStruct converterCallback;
converterCallback.inputProc = EZOutputConverterInputCallback;
converterCallback.inputProcRefCon = (__bridge void *)(self);
[EZAudioUtilities checkResult:AUGraphSetNodeInputCallback(self.info->graph,
self.info->converterNodeInfo.node,
0,
&converterCallback)
operation:"Failed to set render callback on converter node"];
//
// Set stream formats
//
[self setClientFormat:[self defaultClientFormat]];
[self setInputFormat:[self defaultInputFormat]];
#if TARGET_OS_IPHONE
EZAudioDevice *currentOutputDevice = [EZAudioDevice currentOutputDevice];
[self setDevice:currentOutputDevice];
#elif TARGET_OS_MAC
NSArray *outputDevices = [EZAudioDevice outputDevices];
EZAudioDevice *defaultOutput = [outputDevices firstObject];
[self setDevice:defaultOutput];
#endif
//
// Set maximum frames per slice to 4096 to allow playback during
// lock screen (iOS only?)
//
UInt32 maximumFramesPerSlice = EZOutputMaximumFramesPerSlice;
[EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->mixerNodeInfo.audioUnit,
kAudioUnitProperty_MaximumFramesPerSlice,
kAudioUnitScope_Global,
0,
&maximumFramesPerSlice,
sizeof(maximumFramesPerSlice))
operation:"Failed to set maximum frames per slice on mixer node"];
//
// Initialize all the audio units in the graph
//
[EZAudioUtilities checkResult:AUGraphInitialize(self.info->graph)
operation:"Failed to initialize graph"];
//
// Add render callback
//
[EZAudioUtilities checkResult:AudioUnitAddRenderNotify(self.info->mixerNodeInfo.audioUnit,
EZOutputGraphRenderCallback,
(__bridge void *)(self))
operation:"Failed to add render callback"];
}
//------------------------------------------------------------------------------
#pragma mark - Actions
//------------------------------------------------------------------------------
- (void)startPlayback
{
//
// Start the AUGraph
//
[EZAudioUtilities checkResult:AUGraphStart(self.info->graph)
operation:"Failed to start graph"];
//
// Notify delegate
//
if ([self.delegate respondsToSelector:@selector(output:changedPlayingState:)])
{
[self.delegate output:self changedPlayingState:[self isPlaying]];
}
}
//------------------------------------------------------------------------------
- (void)stopPlayback
{
//
// Stop the AUGraph
//
[EZAudioUtilities checkResult:AUGraphStop(self.info->graph)
operation:"Failed to stop graph"];
//
// Notify delegate
//
if ([self.delegate respondsToSelector:@selector(output:changedPlayingState:)])
{
[self.delegate output:self changedPlayingState:[self isPlaying]];
}
}
//------------------------------------------------------------------------------
#pragma mark - Getters
//------------------------------------------------------------------------------
- (AudioStreamBasicDescription)clientFormat
{
return self.info->clientFormat;
}
//------------------------------------------------------------------------------
- (AudioStreamBasicDescription)inputFormat
{
return self.info->inputFormat;
}
//------------------------------------------------------------------------------
- (BOOL)isPlaying
{
Boolean isPlaying;
[EZAudioUtilities checkResult:AUGraphIsRunning(self.info->graph,
&isPlaying)
operation:"Failed to check if graph is running"];
return isPlaying;
}
//------------------------------------------------------------------------------
- (float)pan
{
AudioUnitParameterID param;
#if TARGET_OS_IPHONE
param = kMultiChannelMixerParam_Pan;
#elif TARGET_OS_MAC
param = kStereoMixerParam_Pan;
#endif
AudioUnitParameterValue pan;
[EZAudioUtilities checkResult:AudioUnitGetParameter(self.info->mixerNodeInfo.audioUnit,
param,
kAudioUnitScope_Input,
0,
&pan) operation:"Failed to get pan from mixer unit"];
return pan;
}
//------------------------------------------------------------------------------
- (float)volume
{
AudioUnitParameterID param;
#if TARGET_OS_IPHONE
param = kMultiChannelMixerParam_Volume;
#elif TARGET_OS_MAC
param = kStereoMixerParam_Volume;
#endif
AudioUnitParameterValue volume;
[EZAudioUtilities checkResult:AudioUnitGetParameter(self.info->mixerNodeInfo.audioUnit,
param,
kAudioUnitScope_Input,
0,
&volume)
operation:"Failed to get volume from mixer unit"];
return volume;
}
//------------------------------------------------------------------------------
#pragma mark - Setters
//------------------------------------------------------------------------------
- (void)setClientFormat:(AudioStreamBasicDescription)clientFormat
{
if (self.floatConverter)
{
self.floatConverter = nil;
[EZAudioUtilities freeFloatBuffers:self.info->floatData
numberOfChannels:self.clientFormat.mChannelsPerFrame];
}
self.info->clientFormat = clientFormat;
[EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->converterNodeInfo.audioUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
0,
&self.info->clientFormat,
sizeof(self.info->clientFormat))
operation:"Failed to set output client format on converter audio unit"];
[EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->mixerNodeInfo.audioUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
0,
&self.info->clientFormat,
sizeof(self.info->clientFormat))
operation:"Failed to set input client format on mixer audio unit"];
[EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->mixerNodeInfo.audioUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Output,
0,
&self.info->clientFormat,
sizeof(self.info->clientFormat))
operation:"Failed to set output client format on mixer audio unit"];
self.floatConverter = [[EZAudioFloatConverter alloc] initWithInputFormat:clientFormat];
self.info->floatData = [EZAudioUtilities floatBuffersWithNumberOfFrames:EZOutputMaximumFramesPerSlice
numberOfChannels:clientFormat.mChannelsPerFrame];
}
//------------------------------------------------------------------------------
- (void)setDevice:(EZAudioDevice *)device
{
#if TARGET_OS_IPHONE
// if the devices are equal then ignore
if ([device isEqual:self.device])
{
return;
}
NSError *error;
[[AVAudioSession sharedInstance] setOutputDataSource:device.dataSource error:&error];
if (error)
{
NSLog(@"Error setting output device data source (%@), reason: %@",
device.dataSource,
error.localizedDescription);
}
#elif TARGET_OS_MAC
UInt32 outputEnabled = device.outputChannelCount > 0;
NSAssert(outputEnabled, @"Selected EZAudioDevice does not have any output channels");
NSAssert([self outputAudioUnitSubType] == kAudioUnitSubType_HALOutput,
@"Audio device selection on OSX is only available when using the kAudioUnitSubType_HALOutput output unit subtype");
[EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->outputNodeInfo.audioUnit,
kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Output,
0,
&outputEnabled,
sizeof(outputEnabled))
operation:"Failed to set flag on device output"];
AudioDeviceID deviceId = device.deviceID;
[EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->outputNodeInfo.audioUnit,
kAudioOutputUnitProperty_CurrentDevice,
kAudioUnitScope_Global,
0,
&deviceId,
sizeof(AudioDeviceID))
operation:"Couldn't set default device on I/O unit"];
#endif
// store device
_device = device;
// notify delegate
if ([self.delegate respondsToSelector:@selector(output:changedDevice:)])
{
[self.delegate output:self changedDevice:device];
}
}
//------------------------------------------------------------------------------
- (void)setInputFormat:(AudioStreamBasicDescription)inputFormat
{
self.info->inputFormat = inputFormat;
[EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->converterNodeInfo.audioUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
0,
&inputFormat,
sizeof(inputFormat))
operation:"Failed to set input format on converter audio unit"];
}
//------------------------------------------------------------------------------
- (void)setPan:(float)pan
{
AudioUnitParameterID param;
#if TARGET_OS_IPHONE
param = kMultiChannelMixerParam_Pan;
#elif TARGET_OS_MAC
param = kStereoMixerParam_Pan;
#endif
[EZAudioUtilities checkResult:AudioUnitSetParameter(self.info->mixerNodeInfo.audioUnit,
param,
kAudioUnitScope_Input,
0,
pan,
0)
operation:"Failed to set volume on mixer unit"];
}
//------------------------------------------------------------------------------
- (void)setVolume:(float)volume
{
AudioUnitParameterID param;
#if TARGET_OS_IPHONE
param = kMultiChannelMixerParam_Volume;
#elif TARGET_OS_MAC
param = kStereoMixerParam_Volume;
#endif
[EZAudioUtilities checkResult:AudioUnitSetParameter(self.info->mixerNodeInfo.audioUnit,
param,
kAudioUnitScope_Input,
0,
volume,
0)
operation:"Failed to set volume on mixer unit"];
}
//------------------------------------------------------------------------------
#pragma mark - Core Audio Properties
//------------------------------------------------------------------------------
- (AUGraph)graph
{
return self.info->graph;
}
//------------------------------------------------------------------------------
- (AudioUnit)converterAudioUnit
{
return self.info->converterNodeInfo.audioUnit;
}
//------------------------------------------------------------------------------
- (AudioUnit)mixerAudioUnit
{
return self.info->mixerNodeInfo.audioUnit;
}
//------------------------------------------------------------------------------
- (AudioUnit)outputAudioUnit
{
return self.info->outputNodeInfo.audioUnit;
}
//------------------------------------------------------------------------------
#pragma mark - Subclass
//------------------------------------------------------------------------------
- (OSStatus)connectOutputOfSourceNode:(AUNode)sourceNode
sourceNodeOutputBus:(UInt32)sourceNodeOutputBus
toDestinationNode:(AUNode)destinationNode
destinationNodeInputBus:(UInt32)destinationNodeInputBus
inGraph:(AUGraph)graph
{
//
// Default implementation is to just connect the source to destination
//
[EZAudioUtilities checkResult:AUGraphConnectNodeInput(graph,
sourceNode,
sourceNodeOutputBus,
destinationNode,
destinationNodeInputBus)
operation:"Failed to connect converter node to mixer node"];
return noErr;
}
//------------------------------------------------------------------------------
- (AudioStreamBasicDescription)defaultClientFormat
{
return [EZAudioUtilities stereoFloatNonInterleavedFormatWithSampleRate:EZOutputDefaultSampleRate];
}
//------------------------------------------------------------------------------
- (AudioStreamBasicDescription)defaultInputFormat
{
return [EZAudioUtilities stereoFloatNonInterleavedFormatWithSampleRate:EZOutputDefaultSampleRate];
}
//------------------------------------------------------------------------------
- (OSType)outputAudioUnitSubType
{
#if TARGET_OS_IPHONE
return kAudioUnitSubType_RemoteIO;
#elif TARGET_OS_MAC
return kAudioUnitSubType_HALOutput;
#endif
}
//------------------------------------------------------------------------------
@end
//------------------------------------------------------------------------------
#pragma mark - Callbacks (Implementation)
//------------------------------------------------------------------------------
OSStatus EZOutputConverterInputCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData)
{
EZOutput *output = (__bridge EZOutput *)inRefCon;
//
// Try to ask the data source for audio data to fill out the output's
// buffer list
//
if ([output.dataSource respondsToSelector:@selector(output:shouldFillAudioBufferList:withNumberOfFrames:timestamp:)])
{
return [output.dataSource output:output
shouldFillAudioBufferList:ioData
withNumberOfFrames:inNumberFrames
timestamp:inTimeStamp];
}
else
{
//
// Silence if there is nothing to output
//
for (int i = 0; i < ioData->mNumberBuffers; i++)
{
memset(ioData->mBuffers[i].mData,
0,
ioData->mBuffers[i].mDataByteSize);
}
}
return noErr;
}
//------------------------------------------------------------------------------
OSStatus EZOutputGraphRenderCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData)
{
EZOutput *output = (__bridge EZOutput *)inRefCon;
//
// provide the audio received delegate callback
//
if (*ioActionFlags & kAudioUnitRenderAction_PostRender)
{
if ([output.delegate respondsToSelector:@selector(output:playedAudio:withBufferSize:withNumberOfChannels:)])
{
UInt32 frames = ioData->mBuffers[0].mDataByteSize / output.info->clientFormat.mBytesPerFrame;
[output.floatConverter convertDataFromAudioBufferList:ioData
withNumberOfFrames:frames
toFloatBuffers:output.info->floatData];
[output.delegate output:output
playedAudio:output.info->floatData
withBufferSize:inNumberFrames
withNumberOfChannels:output.info->clientFormat.mChannelsPerFrame];
}
}
return noErr;
}
@@ -3,7 +3,7 @@
// EZAudio
//
// Created by Syed Haris Ali on 12/1/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -3,7 +3,7 @@
// EZAudio
//
// Created by Syed Haris Ali on 12/1/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -80,11 +80,11 @@
{
case EZRecorderFileTypeAIFF:
asbd = [EZAudioUtilities AIFFFormatWithNumberOfChannels:sourceFormat.mChannelsPerFrame
sampleRate:sourceFormat.mSampleRate];
sampleRate:sourceFormat.mSampleRate];
break;
case EZRecorderFileTypeM4A:
asbd = [EZAudioUtilities M4AFormatWithNumberOfChannels:sourceFormat.mChannelsPerFrame
sampleRate:sourceFormat.mSampleRate];
sampleRate:sourceFormat.mSampleRate];
break;
case EZRecorderFileTypeWAV:
@@ -128,27 +128,27 @@
// Finish filling out the destination format description
UInt32 propSize = sizeof(_destinationFormat);
[EZAudioUtilities checkResult:AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
0,
NULL,
&propSize,
&_destinationFormat)
operation:"Failed to fill out rest of destination format"];
0,
NULL,
&propSize,
&_destinationFormat)
operation:"Failed to fill out rest of destination format"];
// Create the audio file
[EZAudioUtilities checkResult:ExtAudioFileCreateWithURL(_destinationFileURL,
_destinationFileTypeID,
&_destinationFormat,
NULL,
kAudioFileFlags_EraseFile,
&_destinationFile)
operation:"Failed to create audio file"];
_destinationFileTypeID,
&_destinationFormat,
NULL,
kAudioFileFlags_EraseFile,
&_destinationFile)
operation:"Failed to create audio file"];
// Set the client format (which should be equal to the source format)
[EZAudioUtilities checkResult:ExtAudioFileSetProperty(_destinationFile,
kExtAudioFileProperty_ClientDataFormat,
sizeof(_sourceFormat),
&_sourceFormat)
operation:"Failed to set client format on recorded audio file"];
kExtAudioFileProperty_ClientDataFormat,
sizeof(_sourceFormat),
&_sourceFormat)
operation:"Failed to set client format on recorded audio file"];
}
@@ -159,8 +159,8 @@
if (_destinationFile)
{
[EZAudioUtilities checkResult:ExtAudioFileWriteAsync(_destinationFile,
bufferSize,
bufferList)
bufferSize,
bufferList)
operation:"Failed to write audio data to recorded audio file"];
}
}
@@ -171,7 +171,7 @@
{
// Dispose of the audio file reference
[EZAudioUtilities checkResult:ExtAudioFileDispose(_destinationFile)
operation:"Failed to close audio file"];
operation:"Failed to close audio file"];
// Null out the file reference
_destinationFile = NULL;
+17 -9
View File
@@ -3,7 +3,7 @@
// EZAudio
//
// Created by Syed Haris Ali on 11/21/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,25 +25,33 @@
#import <Foundation/Foundation.h>
#pragma mark - 3rd Party Utilties
#import "TPCircularBuffer.h"
//------------------------------------------------------------------------------
#pragma mark - Core Components
//------------------------------------------------------------------------------
#import "EZAudioDevice.h"
#import "EZAudioFile.h"
#import "EZAudioFloatData.h"
#import "EZMicrophone.h"
#import "EZOutput.h"
#import "EZRecorder.h"
#import "EZAudioUtilities.h"
#pragma mark - Extended Components
#import "EZAudioPlayer.h"
//------------------------------------------------------------------------------
#pragma mark - Interface Components
//------------------------------------------------------------------------------
#import "EZPlot.h"
#import "EZAudioDisplayLink.h"
#import "EZAudioPlot.h"
#import "EZAudioPlotGL.h"
#import "EZAudioPlotGLKViewController.h"
//------------------------------------------------------------------------------
#pragma mark - Utility Components
//------------------------------------------------------------------------------
#import "EZAudioFloatConverter.h"
#import "EZAudioFloatData.h"
#import "EZAudioUtilities.h"
//------------------------------------------------------------------------------
@@ -0,0 +1,94 @@
//
// EZAudioDisplayLink.h
// EZAudio
//
// Created by Syed Haris Ali on 6/25/15.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>
@class EZAudioDisplayLink;
//------------------------------------------------------------------------------
#pragma mark - EZAudioDisplayLinkDelegate
//------------------------------------------------------------------------------
/**
The EZAudioDisplayLinkDelegate provides a means for an EZAudioDisplayLink instance to notify a receiver when it should redraw itself.
*/
@protocol EZAudioDisplayLinkDelegate <NSObject>
@required
/**
Required method for an EZAudioDisplayLinkDelegate to implement. This fires at the screen's display rate (typically 60 fps).
@param displayLink An EZAudioDisplayLink instance used by a receiver to draw itself at the screen's refresh rate.
*/
- (void)displayLinkNeedsDisplay:(EZAudioDisplayLink *)displayLink;
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioDisplayLink
//------------------------------------------------------------------------------
/**
The EZAudioDisplayLink provides a cross-platform (iOS and Mac) abstraction over the CADisplayLink for iOS and CVDisplayLink for Mac. The purpose of this class is to provide an accurate timer for views that need to redraw themselves at 60 fps. This class is used by the EZAudioPlot and, eventually, the EZAudioPlotGL to provide a timer mechanism to draw real-time plots.
*/
@interface EZAudioDisplayLink : NSObject
//------------------------------------------------------------------------------
#pragma mark - Class Methods
//------------------------------------------------------------------------------
/**
Class method to create an EZAudioDisplayLink. The caller should implement the EZAudioDisplayLinkDelegate protocol to receive the `displayLinkNeedsDisplay:` delegate method to know when to redraw itself.
@param delegate An instance that implements the EZAudioDisplayLinkDelegate protocol.
@return An instance of the EZAudioDisplayLink.
*/
+ (instancetype)displayLinkWithDelegate:(id<EZAudioDisplayLinkDelegate>)delegate;
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
/**
The EZAudioDisplayLinkDelegate for which to receive the redraw calls.
*/
@property (nonatomic, weak) id<EZAudioDisplayLinkDelegate> delegate;
//------------------------------------------------------------------------------
#pragma mark - Instance Methods
//------------------------------------------------------------------------------
/**
Method to start the display link and provide the `displayLinkNeedsDisplay:` calls to the `delegate`
*/
- (void)start;
/**
Method to stop the display link from providing the `displayLinkNeedsDisplay:` calls to the `delegate`
*/
- (void)stop;
//------------------------------------------------------------------------------
@end
@@ -0,0 +1,180 @@
//
// EZAudioDisplayLink.m
// EZAudio
//
// Created by Syed Haris Ali on 6/25/15.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "EZAudioDisplayLink.h"
//------------------------------------------------------------------------------
#pragma mark - CVDisplayLink Callback (Declaration)
//------------------------------------------------------------------------------
#if TARGET_OS_IPHONE
#elif TARGET_OS_MAC
static CVReturn EZAudioDisplayLinkCallback(CVDisplayLinkRef displayLinkRef,
const CVTimeStamp *now,
const CVTimeStamp *outputTime,
CVOptionFlags flagsIn,
CVOptionFlags *flagsOut,
void *displayLinkContext);
#endif
//------------------------------------------------------------------------------
#pragma mark - EZAudioDisplayLink (Interface Extension)
//------------------------------------------------------------------------------
@interface EZAudioDisplayLink ()
#if TARGET_OS_IPHONE
@property (nonatomic, strong) CADisplayLink *displayLink;
#elif TARGET_OS_MAC
@property (nonatomic, assign) CVDisplayLinkRef displayLink;
#endif
@property (nonatomic, assign) BOOL stopped;
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioDisplayLink (Implementation)
//------------------------------------------------------------------------------
@implementation EZAudioDisplayLink
//------------------------------------------------------------------------------
#pragma mark - Dealloc
//------------------------------------------------------------------------------
- (void)dealloc
{
#if TARGET_OS_IPHONE
[self.displayLink invalidate];
#elif TARGET_OS_MAC
CVDisplayLinkStop(self.displayLink);
CVDisplayLinkRelease(self.displayLink);
self.displayLink = nil;
#endif
}
//------------------------------------------------------------------------------
#pragma mark - Class Initialization
//------------------------------------------------------------------------------
+ (instancetype)displayLinkWithDelegate:(id<EZAudioDisplayLinkDelegate>)delegate
{
EZAudioDisplayLink *displayLink = [[self alloc] init];
displayLink.delegate = delegate;
return displayLink;
}
//------------------------------------------------------------------------------
#pragma mark - Initialization
//------------------------------------------------------------------------------
- (instancetype) init
{
self = [super init];
if (self)
{
[self setup];
}
return self;
}
//------------------------------------------------------------------------------
#pragma mark - Setup
//------------------------------------------------------------------------------
- (void)setup
{
self.stopped = YES;
#if TARGET_OS_IPHONE
self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(update)];
[self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
#elif TARGET_OS_MAC
CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink);
CVDisplayLinkSetOutputCallback(self.displayLink,
EZAudioDisplayLinkCallback,
(__bridge void *)(self));
CVDisplayLinkStart(self.displayLink);
#endif
}
//------------------------------------------------------------------------------
#pragma mark - Actions
//------------------------------------------------------------------------------
- (void)start
{
#if TARGET_OS_IPHONE
self.displayLink.paused = NO;
#elif TARGET_OS_MAC
CVDisplayLinkStart(self.displayLink);
#endif
self.stopped = NO;
}
//------------------------------------------------------------------------------
- (void)stop
{
#if TARGET_OS_IPHONE
self.displayLink.paused = YES;
#elif TARGET_OS_MAC
CVDisplayLinkStop(self.displayLink);
#endif
self.stopped = YES;
}
//------------------------------------------------------------------------------
- (void)update
{
if (!self.stopped)
{
if ([self.delegate respondsToSelector:@selector(displayLinkNeedsDisplay:)])
{
[self.delegate displayLinkNeedsDisplay:self];
}
}
}
//------------------------------------------------------------------------------
@end
//------------------------------------------------------------------------------
#pragma mark - CVDisplayLink Callback (Implementation)
//------------------------------------------------------------------------------
#if TARGET_OS_IPHONE
#elif TARGET_OS_MAC
static CVReturn EZAudioDisplayLinkCallback(CVDisplayLinkRef displayLinkRef,
const CVTimeStamp *now,
const CVTimeStamp *outputTime,
CVOptionFlags flagsIn,
CVOptionFlags *flagsOut,
void *displayLinkContext)
{
EZAudioDisplayLink *displayLink = (__bridge EZAudioDisplayLink*)displayLinkContext;
[displayLink update];
return kCVReturnSuccess;
}
#endif
+192
View File
@@ -0,0 +1,192 @@
//
// EZAudioPlot.h
// EZAudio
//
// Created by Syed Haris Ali on 9/2/13.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <QuartzCore/QuartzCore.h>
#import "EZPlot.h"
@class EZAudio;
//------------------------------------------------------------------------------
#pragma mark - Constants
//------------------------------------------------------------------------------
/**
The default value used for the maximum rolling history buffer length of any EZAudioPlot.
@deprecated This constant is deprecated starting in version 0.2.0.
@note Please use EZAudioPlotDefaultMaxHistoryBufferLength instead.
*/
FOUNDATION_EXPORT UInt32 const kEZAudioPlotMaxHistoryBufferLength __attribute__((deprecated));
/**
The default value used for the default rolling history buffer length of any EZAudioPlot.
@deprecated This constant is deprecated starting in version 0.2.0.
@note Please use EZAudioPlotDefaultHistoryBufferLength instead.
*/
FOUNDATION_EXPORT UInt32 const kEZAudioPlotDefaultHistoryBufferLength __attribute__((deprecated));
/**
The default value used for the default rolling history buffer length of any EZAudioPlot.
*/
FOUNDATION_EXPORT UInt32 const EZAudioPlotDefaultHistoryBufferLength;
/**
The default value used for the maximum rolling history buffer length of any EZAudioPlot.
*/
FOUNDATION_EXPORT UInt32 const EZAudioPlotDefaultMaxHistoryBufferLength;
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlotWaveformLayer
//------------------------------------------------------------------------------
/**
The EZAudioPlotWaveformLayer is a lightweight subclass of the CAShapeLayer that allows implicit animations on the `path` key.
*/
@interface EZAudioPlotWaveformLayer : CAShapeLayer
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlot
//------------------------------------------------------------------------------
/**
`EZAudioPlot`, a subclass of `EZPlot`, is a cross-platform (iOS and OSX) class that plots an audio waveform using Core Graphics.
The caller provides updates a constant stream of updated audio data in the `updateBuffer:withBufferSize:` function, which in turn will be plotted in one of the plot types:
* Buffer (`EZPlotTypeBuffer`) - A plot that only consists of the current buffer and buffer size from the last call to `updateBuffer:withBufferSize:`. This looks similar to the default openFrameworks input audio example.
* Rolling (`EZPlotTypeRolling`) - A plot that consists of a rolling history of values averaged from each buffer. This is the traditional waveform look.
#Parent Methods and Properties#
See EZPlot for full API methods and properties (colors, plot type, update function)
*/
@interface EZAudioPlot : EZPlot
/**
A BOOL that allows optimizing the audio plot's drawing for real-time displays. Since the update function may be updating the plot's data very quickly (over 60 frames per second) this property will throttle the drawing calls to be 60 frames per second (or whatever the screen rate is). Specifically, it disables implicit path change animations on the `waveformLayer` and sets up a display link to render 60 fps (audio updating the plot at 44.1 kHz causes it to re-render 86 fps - far greater than what is needed for a visual display).
*/
@property (nonatomic, assign) BOOL shouldOptimizeForRealtimePlot;
//------------------------------------------------------------------------------
/**
A BOOL indicating whether the plot should center itself vertically.
*/
@property (nonatomic, assign) BOOL shouldCenterYAxis;
//------------------------------------------------------------------------------
/**
An EZAudioPlotWaveformLayer that is used to render the actual waveform. By switching the drawing code to Core Animation layers in version 0.2.0 most work, specifically the compositing step, is now done on the GPU. Hence, multiple EZAudioPlot instances can be used simultaneously with very low CPU overhead so these are now practical for table and collection views.
*/
@property (nonatomic, strong) EZAudioPlotWaveformLayer *waveformLayer;
//------------------------------------------------------------------------------
#pragma mark - Adjust Resolution
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Adjusting The Resolution
///-----------------------------------------------------------
/**
Sets the length of the rolling history buffer (i.e. the number of points in the rolling plot's buffer). Can grow or shrink the display up to the maximum size specified by the `maximumRollingHistoryLength` method. Will return the actual set value, which will be either the given value if smaller than the `maximumRollingHistoryLength` or `maximumRollingHistoryLength` if a larger value is attempted to be set.
@param historyLength The new length of the rolling history buffer.
@return The new value equal to the historyLength or the `maximumRollingHistoryLength`.
*/
-(int)setRollingHistoryLength:(int)historyLength;
//------------------------------------------------------------------------------
/**
Provides the length of the rolling history buffer (i.e. the number of points in the rolling plot's buffer).
* @return An int representing the length of the rolling history buffer
*/
-(int)rollingHistoryLength;
//------------------------------------------------------------------------------
#pragma mark - Subclass Methods
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Subclass Methods
///-----------------------------------------------------------
/**
Main method that handles converting the points created from the `updatedBuffer:withBufferSize:` method into a CGPathRef to store in the `waveformLayer`. In this method you can create any path you'd like using the point array (for instance, maybe mapping the points to a circle instead of the standard 2D plane).
@param points An array of CGPoint structures, with the x values ranging from 0 - (pointCount - 1) and y values containing the last audio data's buffer.
@param pointCount A UInt32 of the length of the point array.
@param rect An EZRect (CGRect on iOS or NSRect on OSX) that the path should be created relative to.
@return A CGPathRef that is the path you'd like to store on the `waveformLayer` to visualize the audio data.
*/
- (CGPathRef)createPathWithPoints:(CGPoint *)points
pointCount:(UInt32)pointCount
inRect:(EZRect)rect;
//------------------------------------------------------------------------------
/**
Provides the default length of the rolling history buffer when the plot is initialized. Default is `EZAudioPlotDefaultHistoryBufferLength` constant.
@return An int describing the initial length of the rolling history buffer.
*/
- (int)defaultRollingHistoryLength;
//------------------------------------------------------------------------------
/**
Provides the default number of points that will be used to initialize the graph's points data structure that holds. Essentially the plot starts off as a flat line of this many points. Default is 100.
@return An int describing the initial number of points the plot should have when flat lined.
*/
- (int)initialPointCount;
//------------------------------------------------------------------------------
/**
Provides the default maximum rolling history length - that is, the maximum amount of points the `setRollingHistoryLength:` method may be set to. If a length higher than this is set then the plot will likely crash because the appropriate resources are only allocated once during the plot's initialization step. Defualt is `EZAudioPlotDefaultMaxHistoryBufferLength` constant.
@return An int describing the maximum length of the absolute rolling history buffer.
*/
- (int)maximumRollingHistoryLength;
//------------------------------------------------------------------------------
/**
Method to cause the waveform layer's path to get recreated and redrawn on screen using the last buffer of data provided. This is the equivalent to the drawRect: method used to normally subclass a view's drawing. This normally don't need to be overrode though - a better approach would be to override the `createPathWithPoints:pointCount:inRect:` method.
*/
- (void)redraw;
//------------------------------------------------------------------------------
/**
Main method used to copy the sample data from the source buffer and update the
plot. Subclasses can overwrite this method for custom behavior.
@param data A float array of the sample data. Subclasses should copy this data to a separate array to avoid threading issues.
@param length The length of the float array as an int.
*/
-(void)setSampleData:(float *)data length:(int)length;
//------------------------------------------------------------------------------
@end
+451
View File
@@ -0,0 +1,451 @@
//
// EZAudioPlot.m
// EZAudio
//
// Created by Syed Haris Ali on 9/2/13.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "EZAudioPlot.h"
#import "EZAudioDisplayLink.h"
//------------------------------------------------------------------------------
#pragma mark - Constants
//------------------------------------------------------------------------------
UInt32 const kEZAudioPlotMaxHistoryBufferLength = 8192;
UInt32 const kEZAudioPlotDefaultHistoryBufferLength = 512;
UInt32 const EZAudioPlotDefaultHistoryBufferLength = 512;
UInt32 const EZAudioPlotDefaultMaxHistoryBufferLength = 8192;
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlot (Interface Extension)
//------------------------------------------------------------------------------
@interface EZAudioPlot () <EZAudioDisplayLinkDelegate>
@property (nonatomic, strong) EZAudioDisplayLink *displayLink;
@property (nonatomic, assign) EZPlotHistoryInfo *historyInfo;
@property (nonatomic, assign) CGPoint *points;
@property (nonatomic, assign) UInt32 pointCount;
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlot (Implementation)
//------------------------------------------------------------------------------
@implementation EZAudioPlot
//------------------------------------------------------------------------------
#pragma mark - Dealloc
//------------------------------------------------------------------------------
- (void)dealloc
{
[EZAudioUtilities freeHistoryInfo:self.historyInfo];
free(self.points);
}
//------------------------------------------------------------------------------
#pragma mark - Initialization
//------------------------------------------------------------------------------
- (id)init
{
self = [super init];
if (self)
{
[self initPlot];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self)
{
[self initPlot];
}
return self;
}
#if TARGET_OS_IPHONE
- (id)initWithFrame:(CGRect)frameRect
#elif TARGET_OS_MAC
- (id)initWithFrame:(NSRect)frameRect
#endif
{
self = [super initWithFrame:frameRect];
if (self)
{
[self initPlot];
}
return self;
}
#if TARGET_OS_IPHONE
- (void)layoutSubviews
{
[super layoutSubviews];
[CATransaction begin];
[CATransaction setDisableActions:YES];
self.waveformLayer.frame = self.bounds;
[self redraw];
[CATransaction commit];
}
#elif TARGET_OS_MAC
- (void)layout
{
[super layout];
[CATransaction begin];
[CATransaction setDisableActions:YES];
self.waveformLayer.frame = self.bounds;
[self redraw];
[CATransaction commit];
}
#endif
- (void)initPlot
{
self.shouldCenterYAxis = YES;
self.shouldOptimizeForRealtimePlot = YES;
self.gain = 1.0;
self.plotType = EZPlotTypeBuffer;
self.shouldMirror = NO;
self.shouldFill = NO;
// Setup history window
[self resetHistoryBuffers];
self.waveformLayer = [EZAudioPlotWaveformLayer layer];
self.waveformLayer.frame = self.bounds;
self.waveformLayer.lineWidth = 1.0f;
self.waveformLayer.fillColor = nil;
self.waveformLayer.backgroundColor = nil;
self.waveformLayer.opaque = YES;
#if TARGET_OS_IPHONE
self.color = [UIColor colorWithHue:0 saturation:1.0 brightness:1.0 alpha:1.0];
#elif TARGET_OS_MAC
self.color = [NSColor colorWithCalibratedHue:0 saturation:1.0 brightness:1.0 alpha:1.0];
self.wantsLayer = YES;
self.layerContentsRedrawPolicy = NSViewLayerContentsRedrawOnSetNeedsDisplay;
#endif
self.backgroundColor = nil;
[self.layer insertSublayer:self.waveformLayer atIndex:0];
self.points = calloc(EZAudioPlotDefaultMaxHistoryBufferLength, sizeof(CGPoint));
self.pointCount = [self initialPointCount];
[self redraw];
}
//------------------------------------------------------------------------------
#pragma mark - Setup
//------------------------------------------------------------------------------
- (void)resetHistoryBuffers
{
//
// Clear any existing data
//
if (self.historyInfo)
{
[EZAudioUtilities freeHistoryInfo:self.historyInfo];
}
self.historyInfo = [EZAudioUtilities historyInfoWithDefaultLength:[self defaultRollingHistoryLength]
maximumLength:[self maximumRollingHistoryLength]];
}
//------------------------------------------------------------------------------
#pragma mark - Setters
//------------------------------------------------------------------------------
- (void)setBackgroundColor:(id)backgroundColor
{
[super setBackgroundColor:backgroundColor];
self.layer.backgroundColor = [backgroundColor CGColor];
}
//------------------------------------------------------------------------------
- (void)setColor:(id)color
{
[super setColor:color];
self.waveformLayer.strokeColor = [color CGColor];
if (self.shouldFill)
{
self.waveformLayer.fillColor = [color CGColor];
}
}
//------------------------------------------------------------------------------
- (void)setShouldOptimizeForRealtimePlot:(BOOL)shouldOptimizeForRealtimePlot
{
_shouldOptimizeForRealtimePlot = shouldOptimizeForRealtimePlot;
if (shouldOptimizeForRealtimePlot && !self.displayLink)
{
self.displayLink = [EZAudioDisplayLink displayLinkWithDelegate:self];
[self.displayLink start];
}
else
{
[self.displayLink stop];
self.displayLink = nil;
}
}
//------------------------------------------------------------------------------
- (void)setShouldFill:(BOOL)shouldFill
{
[super setShouldFill:shouldFill];
self.waveformLayer.fillColor = shouldFill ? [self.color CGColor] : nil;
}
//------------------------------------------------------------------------------
#pragma mark - Drawing
//------------------------------------------------------------------------------
- (void)clear
{
if (self.pointCount > 0)
{
[self resetHistoryBuffers];
float data[self.pointCount];
memset(data, 0, self.pointCount * sizeof(float));
[self setSampleData:data length:self.pointCount];
[self redraw];
}
}
//------------------------------------------------------------------------------
- (void)redraw
{
EZRect frame = [self.waveformLayer frame];
CGPathRef path = [self createPathWithPoints:self.points
pointCount:self.pointCount
inRect:frame];
if (self.shouldOptimizeForRealtimePlot)
{
[CATransaction begin];
[CATransaction setDisableActions:YES];
self.waveformLayer.path = path;
[CATransaction commit];
}
else
{
self.waveformLayer.path = path;
}
CGPathRelease(path);
}
//------------------------------------------------------------------------------
- (CGPathRef)createPathWithPoints:(CGPoint *)points
pointCount:(UInt32)pointCount
inRect:(EZRect)rect
{
CGMutablePathRef path = NULL;
if (pointCount > 0)
{
path = CGPathCreateMutable();
double xscale = (rect.size.width) / ((float)self.pointCount);
double halfHeight = floor(rect.size.height / 2.0);
int deviceOriginFlipped = [self isDeviceOriginFlipped] ? -1 : 1;
CGAffineTransform xf = CGAffineTransformIdentity;
CGFloat translateY = 0.0f;
if (!self.shouldCenterYAxis)
{
#if TARGET_OS_IPHONE
translateY = CGRectGetHeight(rect);
#elif TARGET_OS_MAC
translateY = 0.0f;
#endif
}
else
{
translateY = halfHeight + rect.origin.y;
}
xf = CGAffineTransformTranslate(xf, 0.0, translateY);
double yScaleFactor = halfHeight;
if (!self.shouldCenterYAxis)
{
yScaleFactor = 2.0 * halfHeight;
}
xf = CGAffineTransformScale(xf, xscale, deviceOriginFlipped * yScaleFactor);
CGPathAddLines(path, &xf, self.points, self.pointCount);
if (self.shouldMirror)
{
xf = CGAffineTransformScale(xf, 1.0f, -1.0f);
CGPathAddLines(path, &xf, self.points, self.pointCount);
}
if (self.shouldFill)
{
CGPathCloseSubpath(path);
}
}
return path;
}
//------------------------------------------------------------------------------
#pragma mark - Update
//------------------------------------------------------------------------------
- (void)updateBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize
{
// append the buffer to the history
[EZAudioUtilities appendBuffer:buffer
withBufferSize:bufferSize
toHistoryInfo:self.historyInfo];
// copy samples
switch (self.plotType)
{
case EZPlotTypeBuffer:
[self setSampleData:buffer
length:bufferSize];
break;
case EZPlotTypeRolling:
[self setSampleData:self.historyInfo->buffer
length:self.historyInfo->bufferSize];
break;
default:
break;
}
// update drawing
if (!self.shouldOptimizeForRealtimePlot)
{
[self redraw];
}
}
//------------------------------------------------------------------------------
- (void)setSampleData:(float *)data length:(int)length
{
CGPoint *points = self.points;
for (int i = 0; i < length; i++)
{
points[i].x = i;
points[i].y = data[i] * self.gain;
}
points[0].y = points[length - 1].y = 0.0f;
self.pointCount = length;
}
//------------------------------------------------------------------------------
#pragma mark - Adjusting History Resolution
//------------------------------------------------------------------------------
- (int)rollingHistoryLength
{
return self.historyInfo->bufferSize;
}
//------------------------------------------------------------------------------
- (int)setRollingHistoryLength:(int)historyLength
{
self.historyInfo->bufferSize = MIN(EZAudioPlotDefaultMaxHistoryBufferLength, historyLength);
return self.historyInfo->bufferSize;
}
//------------------------------------------------------------------------------
#pragma mark - Subclass
//------------------------------------------------------------------------------
- (int)defaultRollingHistoryLength
{
return EZAudioPlotDefaultHistoryBufferLength;
}
//------------------------------------------------------------------------------
- (int)initialPointCount
{
return 100;
}
//------------------------------------------------------------------------------
- (int)maximumRollingHistoryLength
{
return EZAudioPlotDefaultMaxHistoryBufferLength;
}
//------------------------------------------------------------------------------
#pragma mark - Utility
//------------------------------------------------------------------------------
- (BOOL)isDeviceOriginFlipped
{
BOOL isDeviceOriginFlipped = NO;
#if TARGET_OS_IPHONE
isDeviceOriginFlipped = YES;
#elif TARGET_OS_MAC
#endif
return isDeviceOriginFlipped;
}
//------------------------------------------------------------------------------
#pragma mark - EZAudioDisplayLinkDelegate
//------------------------------------------------------------------------------
- (void)displayLinkNeedsDisplay:(EZAudioDisplayLink *)displayLink
{
[self redraw];
}
//------------------------------------------------------------------------------
@end
////------------------------------------------------------------------------------
#pragma mark - EZAudioPlotWaveformLayer (Implementation)
////------------------------------------------------------------------------------
@implementation EZAudioPlotWaveformLayer
- (id<CAAction>)actionForKey:(NSString *)event
{
if ([event isEqualToString:@"path"])
{
if ([CATransaction disableActions])
{
return nil;
}
else
{
CABasicAnimation *animation = [CABasicAnimation animation];
animation.timingFunction = [CATransaction animationTimingFunction];
animation.duration = [CATransaction animationDuration];
return animation;
}
return nil;
}
return [super actionForKey:event];
}
@end
@@ -0,0 +1,221 @@
//
// EZAudioPlotGL.h
// EZAudio
//
// Created by Syed Haris Ali on 11/22/13.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <GLKit/GLKit.h>
#import "EZPlot.h"
#if !TARGET_OS_IPHONE
#import <OpenGL/OpenGL.h>
#endif
//------------------------------------------------------------------------------
#pragma mark - Data Structures
//------------------------------------------------------------------------------
typedef struct
{
GLfloat x;
GLfloat y;
} EZAudioPlotGLPoint;
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlotGL
//------------------------------------------------------------------------------
/**
EZAudioPlotGL is a subclass of either a GLKView on iOS or an NSOpenGLView on OSX. As of 0.6.0 this class no longer depends on an embedded GLKViewController for iOS as the display link is just manually managed within this single view instead. The EZAudioPlotGL provides the same kind of audio plot as the EZAudioPlot, but uses OpenGL to GPU-accelerate the drawing of the points, which means you can fit a lot more points and complex geometries.
*/
#if TARGET_OS_IPHONE
@interface EZAudioPlotGL : GLKView
#elif TARGET_OS_MAC
@interface EZAudioPlotGL : NSOpenGLView
#endif
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Customizing The Plot's Appearance
///-----------------------------------------------------------
/**
The default background color of the plot. For iOS the color is specified as a UIColor while for OSX the color is an NSColor. The default value on both platforms is a sweet looking green.
@warning On OSX, if you set the background to a value where the alpha component is 0 then the EZAudioPlotGL will automatically set its superview to be layer-backed.
*/
@property (nonatomic, strong) id backgroundColor;
//------------------------------------------------------------------------------
/**
The default color of the plot's data (i.e. waveform, y-axis values). For iOS the color is specified as a UIColor while for OSX the color is an NSColor. The default value on both platforms is white.
*/
@property (nonatomic, strong) id color;
//------------------------------------------------------------------------------
/**
The plot's gain value, which controls the scale of the y-axis values. The default value of the gain is 1.0f and should always be greater than 0.0f.
*/
@property (nonatomic, assign) float gain;
//------------------------------------------------------------------------------
/**
The type of plot as specified by the `EZPlotType` enumeration (i.e. a buffer or rolling plot type). Default is EZPlotTypeBuffer.
*/
@property (nonatomic, assign) EZPlotType plotType;
//------------------------------------------------------------------------------
/**
A BOOL indicating whether or not to fill in the graph. A value of YES will make a filled graph (filling in the space between the x-axis and the y-value), while a value of NO will create a stroked graph (connecting the points along the y-axis). Default is NO.
*/
@property (nonatomic, assign) BOOL shouldFill;
//------------------------------------------------------------------------------
/**
A boolean indicating whether the graph should be rotated along the x-axis to give a mirrored reflection. This is typical for audio plots to produce the classic waveform look. A value of YES will produce a mirrored reflection of the y-values about the x-axis, while a value of NO will only plot the y-values. Default is NO.
*/
@property (nonatomic, assign) BOOL shouldMirror;
//------------------------------------------------------------------------------
#pragma mark - Updating The Plot
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Updating The Plot
///-----------------------------------------------------------
/**
Updates the plot with the new buffer data and tells the view to redraw itself. Caller will provide a float array with the values they expect to see on the y-axis. The plot will internally handle mapping the x-axis and y-axis to the current view port, any interpolation for fills effects, and mirroring.
@param buffer A float array of values to map to the y-axis.
@param bufferSize The size of the float array that will be mapped to the y-axis.
*/
-(void)updateBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize;
//------------------------------------------------------------------------------
#pragma mark - Adjust Resolution
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Adjusting The Resolution
///-----------------------------------------------------------
/**
Sets the length of the rolling history buffer (i.e. the number of points in the rolling plot's buffer). Can grow or shrink the display up to the maximum size specified by the `maximumRollingHistoryLength` method. Will return the actual set value, which will be either the given value if smaller than the `maximumRollingHistoryLength` or `maximumRollingHistoryLength` if a larger value is attempted to be set.
@param historyLength The new length of the rolling history buffer.
@return The new value equal to the historyLength or the `maximumRollingHistoryLength`.
*/
-(int)setRollingHistoryLength:(int)historyLength;
//------------------------------------------------------------------------------
/**
Provides the length of the rolling history buffer (i.e. the number of points in the rolling plot's buffer).
* @return An int representing the length of the rolling history buffer
*/
-(int)rollingHistoryLength;
//------------------------------------------------------------------------------
#pragma mark - Clearing The Plot
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Clearing The Plot
///-----------------------------------------------------------
/**
Clears all data from the audio plot (includes both EZPlotTypeBuffer and EZPlotTypeRolling)
*/
-(void)clear;
//------------------------------------------------------------------------------
#pragma mark - Start/Stop Display Link
//------------------------------------------------------------------------------
/**
Call this method to tell the EZAudioDisplayLink to stop drawing temporarily.
*/
- (void)pauseDrawing;
//------------------------------------------------------------------------------
/**
Call this method to manually tell the EZAudioDisplayLink to start drawing again.
*/
- (void)resumeDrawing;
//------------------------------------------------------------------------------
#pragma mark - Subclass
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Customizing The Drawing
///-----------------------------------------------------------
/**
This method is used to perform the actual OpenGL drawing code to clear the background and draw the lines representing the 2D audio plot. Subclasses can use the current implementation as an example and implement their own custom geometries. This is the analogy of overriding the drawRect: method in an NSView or UIView.
@param points An array of EZAudioPlotGLPoint structures representing the mapped audio data to x,y coordinates. The x-axis goes from 0 to the number of points (pointCount) while the y-axis goes from -1 to 1. Check out the implementation of this method to see how the model view matrix of the base effect is transformed to map this properly to the viewport.
@param pointCount A UInt32 representing the number of points contained in the points array.
@param baseEffect An optional GLKBaseEffect to use as a default shader. Call prepareToDraw on the base effect before any glDrawArrays call.
@param vbo The Vertex Buffer Object used to buffer the point data.
@param vab The Vertex Array Buffer used to bind the Vertex Buffer Object. This is a Mac only thing, you can ignore this completely on iOS.
@param interpolated A BOOL indicating whether the data has been interpolated. This means the point data is twice as long, where every other point is 0 on the y-axis to allow drawing triangle stripes for filled in waveforms. Typically if the point data is interpolated you will be using the GL_TRIANGLE_STRIP drawing mode, while non-interpolated plots will just use a GL_LINE_STRIP drawing mode.
@param mirrored A BOOL indicating whether the plot should be mirrored about the y-axis (or whatever geometry you come up with).
@param gain A float representing a gain that should be used to influence the height or intensity of your geometry's shape. A gain of 0.0 means silence, a gain of 1.0 means full volume (you're welcome to boost this to whatever you want).
*/
- (void)redrawWithPoints:(EZAudioPlotGLPoint *)points
pointCount:(UInt32)pointCount
baseEffect:(GLKBaseEffect *)baseEffect
vertexBufferObject:(GLuint)vbo
vertexArrayBuffer:(GLuint)vab
interpolated:(BOOL)interpolated
mirrored:(BOOL)mirrored
gain:(float)gain;
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Subclass Methods
///-----------------------------------------------------------
/**
Provides the default length of the rolling history buffer when the plot is initialized. Default is `EZAudioPlotDefaultHistoryBufferLength` constant.
@return An int describing the initial length of the rolling history buffer.
*/
- (int)defaultRollingHistoryLength;
//------------------------------------------------------------------------------
/**
Provides the default maximum rolling history length - that is, the maximum amount of points the `setRollingHistoryLength:` method may be set to. If a length higher than this is set then the plot will likely crash because the appropriate resources are only allocated once during the plot's initialization step. Defualt is `EZAudioPlotDefaultMaxHistoryBufferLength` constant.
@return An int describing the maximum length of the absolute rolling history buffer.
*/
- (int)maximumRollingHistoryLength;
//------------------------------------------------------------------------------
@end
@@ -0,0 +1,533 @@
//
// EZAudioPlotGL.m
// EZAudio
//
// Created by Syed Haris Ali on 11/22/13.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "EZAudioPlotGL.h"
#import "EZAudioDisplayLink.h"
#import "EZAudioUtilities.h"
#import "EZAudioPlot.h"
//------------------------------------------------------------------------------
#pragma mark - Data Structures
//------------------------------------------------------------------------------
typedef struct
{
BOOL interpolated;
EZPlotHistoryInfo *historyInfo;
EZAudioPlotGLPoint *points;
UInt32 pointCount;
GLuint vbo;
GLuint vab;
} EZAudioPlotGLInfo;
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlotGL (Interface Extension)
//------------------------------------------------------------------------------
@interface EZAudioPlotGL () <EZAudioDisplayLinkDelegate>
@property (nonatomic, strong) GLKBaseEffect *baseEffect;
@property (nonatomic, strong) EZAudioDisplayLink *displayLink;
@property (nonatomic, assign) EZAudioPlotGLInfo *info;
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlotGL (Implementation)
//------------------------------------------------------------------------------
@implementation EZAudioPlotGL
//------------------------------------------------------------------------------
#pragma mark - Dealloc
//------------------------------------------------------------------------------
- (void)dealloc
{
[self.displayLink stop];
self.displayLink = nil;
[EZAudioUtilities freeHistoryInfo:self.info->historyInfo];
#if !TARGET_OS_IPHONE
glDeleteVertexArrays(1, &self.info->vab);
#endif
glDeleteBuffers(1, &self.info->vbo);
free(self.info->points);
free(self.info);
self.baseEffect = nil;
}
//------------------------------------------------------------------------------
#pragma mark - Initialization
//------------------------------------------------------------------------------
- (instancetype)init
{
self = [super init];
if (self)
{
[self setup];
}
return self;
}
//------------------------------------------------------------------------------
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self)
{
[self setup];
}
return self;
}
//------------------------------------------------------------------------------
- (instancetype)initWithFrame:(EZRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
[self setup];
}
return self;
}
//------------------------------------------------------------------------------
#if TARGET_OS_IPHONE
- (instancetype)initWithFrame:(CGRect)frame
context:(EAGLContext *)context
{
self = [super initWithFrame:frame context:context];
if (self)
{
[self setup];
}
return self;
}
#elif TARGET_OS_MAC
- (instancetype)initWithFrame:(NSRect)frameRect
pixelFormat:(NSOpenGLPixelFormat *)format
{
self = [super initWithFrame:frameRect pixelFormat:format];
if (self)
{
[self setup];
}
return self;
}
#endif
//------------------------------------------------------------------------------
#pragma mark - Setup
//------------------------------------------------------------------------------
- (void)setup
{
//
// Setup info data structure
//
self.info = (EZAudioPlotGLInfo *)malloc(sizeof(EZAudioPlotGLInfo));
memset(self.info, 0, sizeof(EZAudioPlotGLInfo));
//
// Create points array
//
UInt32 pointCount = [self maximumRollingHistoryLength];
self.info->points = (EZAudioPlotGLPoint *)calloc(sizeof(EZAudioPlotGLPoint), pointCount);
self.info->pointCount = pointCount;
//
// Create the history data structure to hold the rolling data
//
self.info->historyInfo = [EZAudioUtilities historyInfoWithDefaultLength:[self defaultRollingHistoryLength]
maximumLength:[self maximumRollingHistoryLength]];
//
// Setup OpenGL specific stuff
//
[self setupOpenGL];
//
// Setup view properties
//
self.gain = 1.0f;
#if TARGET_OS_IPHONE
self.backgroundColor = [UIColor colorWithRed:0.569f green:0.82f blue:0.478f alpha:1.0f];
self.color = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f];
#elif TARGET_OS_MAC
self.backgroundColor = [NSColor colorWithCalibratedRed:0.569f green:0.82f blue:0.478f alpha:1.0f];
self.color = [NSColor colorWithCalibratedRed:1.0f green:1.0f blue:1.0f alpha:1.0f];
#endif
//
// Create the display link
//
self.displayLink = [EZAudioDisplayLink displayLinkWithDelegate:self];
[self.displayLink start];
}
//------------------------------------------------------------------------------
- (void)setupOpenGL
{
self.baseEffect = [[GLKBaseEffect alloc] init];
self.baseEffect.useConstantColor = YES;
#if TARGET_OS_IPHONE
if (!self.context)
{
self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
}
[EAGLContext setCurrentContext:self.context];
self.drawableColorFormat = GLKViewDrawableColorFormatRGBA8888;
self.drawableDepthFormat = GLKViewDrawableDepthFormat24;
self.drawableStencilFormat = GLKViewDrawableStencilFormat8;
self.drawableMultisample = GLKViewDrawableMultisample4X;
self.opaque = NO;
self.enableSetNeedsDisplay = NO;
#elif TARGET_OS_MAC
self.wantsBestResolutionOpenGLSurface = YES;
self.wantsLayer = YES;
self.layer.opaque = YES;
self.layer.backgroundColor = [NSColor clearColor].CGColor;
if (!self.pixelFormat)
{
NSOpenGLPixelFormatAttribute attrs[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAMultisample,
NSOpenGLPFASampleBuffers, 1,
NSOpenGLPFASamples, 4,
NSOpenGLPFADepthSize, 24,
NSOpenGLPFAOpenGLProfile,
NSOpenGLProfileVersion3_2Core, 0
};
self.pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
}
#if DEBUG
NSAssert(self.pixelFormat, @"Could not create OpenGL pixel format so context is not valid");
#endif
self.openGLContext = [[NSOpenGLContext alloc] initWithFormat:self.pixelFormat
shareContext:nil];
GLint swapInt = 1; GLint surfaceOpacity = 0;
[self.openGLContext setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
[self.openGLContext setValues:&surfaceOpacity forParameter:NSOpenGLCPSurfaceOpacity];
[self.openGLContext lock];
glGenVertexArrays(1, &self.info->vab);
glBindVertexArray(self.info->vab);
#endif
glGenBuffers(1, &self.info->vbo);
glBindBuffer(GL_ARRAY_BUFFER, self.info->vbo);
glBufferData(GL_ARRAY_BUFFER,
self.info->pointCount * sizeof(EZAudioPlotGLPoint),
self.info->points,
GL_STREAM_DRAW);
#if !TARGET_OS_IPHONE
[self.openGLContext unlock];
#endif
}
//------------------------------------------------------------------------------
#pragma mark - Updating The Plot
//------------------------------------------------------------------------------
- (void)updateBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize
{
//
// Update history
//
[EZAudioUtilities appendBuffer:buffer
withBufferSize:bufferSize
toHistoryInfo:self.info->historyInfo];
//
// Convert this data to point data
//
switch (self.plotType)
{
case EZPlotTypeBuffer:
[self setSampleData:buffer
length:bufferSize];
break;
case EZPlotTypeRolling:
[self setSampleData:self.info->historyInfo->buffer
length:self.info->historyInfo->bufferSize];
break;
default:
break;
}
}
//------------------------------------------------------------------------------
- (void)setSampleData:(float *)data length:(int)length
{
int pointCount = self.shouldFill ? length * 2 : length;
EZAudioPlotGLPoint *points = self.info->points;
for (int i = 0; i < length; i++)
{
if (self.shouldFill)
{
points[i * 2].x = points[i * 2 + 1].x = i;
points[i * 2].y = data[i];
points[i * 2 + 1].y = 0.0f;
}
else
{
points[i].x = i;
points[i].y = data[i];
}
}
points[0].y = points[pointCount - 1].y = 0.0f;
self.info->pointCount = pointCount;
self.info->interpolated = self.shouldFill;
#if !TARGET_OS_IPHONE
[self.openGLContext lock];
glBindVertexArray(self.info->vab);
#endif
glBindBuffer(GL_ARRAY_BUFFER, self.info->vbo);
glBufferSubData(GL_ARRAY_BUFFER,
0,
pointCount * sizeof(EZAudioPlotGLPoint),
self.info->points);
#if !TARGET_OS_IPHONE
[self.openGLContext unlock];
#endif
}
//------------------------------------------------------------------------------
#pragma mark - Adjusting History Resolution
//------------------------------------------------------------------------------
- (int)rollingHistoryLength
{
return self.info->historyInfo->bufferSize;
}
//------------------------------------------------------------------------------
- (int)setRollingHistoryLength:(int)historyLength
{
self.info->historyInfo->bufferSize = MIN(EZAudioPlotDefaultMaxHistoryBufferLength, historyLength);
return self.info->historyInfo->bufferSize;
}
//------------------------------------------------------------------------------
#pragma mark - Clearing The Plot
//------------------------------------------------------------------------------
- (void)clear
{
float emptyBuffer[1];
emptyBuffer[0] = 0.0f;
[self setSampleData:emptyBuffer length:1];
[EZAudioUtilities clearHistoryInfo:self.info->historyInfo];
#if TARGET_OS_IPHONE
[self display];
#elif TARGET_OS_MAC
[self redraw];
#endif
}
//------------------------------------------------------------------------------
#pragma mark - Start/Stop Display Link
//------------------------------------------------------------------------------
- (void)pauseDrawing
{
[self.displayLink stop];
}
//------------------------------------------------------------------------------
- (void)resumeDrawing
{
[self.displayLink start];
}
//------------------------------------------------------------------------------
#pragma mark - Setters
//------------------------------------------------------------------------------
- (void)setBackgroundColor:(id)backgroundColor
{
_backgroundColor = backgroundColor;
if (backgroundColor)
{
CGColorRef colorRef = [backgroundColor CGColor];
CGFloat red; CGFloat green; CGFloat blue; CGFloat alpha;
[EZAudioUtilities getColorComponentsFromCGColor:colorRef
red:&red
green:&green
blue:&blue
alpha:&alpha];
//
// Note! If you set the alpha to be 0 on mac for a transparent view
// the EZAudioPlotGL will make the superview layer-backed to make
// sure there is a surface to display itself on (or else you will get
// some pretty weird drawing glitches
//
#if !TARGET_OS_IPHONE
if (alpha == 0.0f)
{
[self.superview setWantsLayer:YES];
}
#endif
glClearColor(red, green, blue, alpha);
}
else
{
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
}
}
//------------------------------------------------------------------------------
- (void)setColor:(id)color
{
_color = color;
if (color)
{
CGColorRef colorRef = [color CGColor];
CGFloat red; CGFloat green; CGFloat blue; CGFloat alpha;
[EZAudioUtilities getColorComponentsFromCGColor:colorRef
red:&red
green:&green
blue:&blue
alpha:&alpha];
self.baseEffect.constantColor = GLKVector4Make(red, green, blue, alpha);
}
else
{
self.baseEffect.constantColor = GLKVector4Make(0.0f, 0.0f, 0.0f, 0.0f);
}
}
//------------------------------------------------------------------------------
#pragma mark - Drawing
//------------------------------------------------------------------------------
- (void)drawRect:(EZRect)rect
{
[self redraw];
}
//------------------------------------------------------------------------------
- (void)redraw
{
#if !TARGET_OS_IPHONE
[self.openGLContext makeCurrentContext];
[self.openGLContext lock];
#endif
[self redrawWithPoints:self.info->points
pointCount:self.info->pointCount
baseEffect:self.baseEffect
vertexBufferObject:self.info->vbo
vertexArrayBuffer:self.info->vab
interpolated:self.info->interpolated
mirrored:self.shouldMirror
gain:self.gain];
#if !TARGET_OS_IPHONE
[self.openGLContext flushBuffer];
[self.openGLContext unlock];
#endif
}
//------------------------------------------------------------------------------
- (void)redrawWithPoints:(EZAudioPlotGLPoint *)points
pointCount:(UInt32)pointCount
baseEffect:(GLKBaseEffect *)baseEffect
vertexBufferObject:(GLuint)vbo
vertexArrayBuffer:(GLuint)vab
interpolated:(BOOL)interpolated
mirrored:(BOOL)mirrored
gain:(float)gain
{
glClear(GL_COLOR_BUFFER_BIT);
GLenum mode = interpolated ? GL_TRIANGLE_STRIP : GL_LINE_STRIP;
float interpolatedFactor = interpolated ? 2.0f : 1.0f;
float xscale = 2.0f / ((float)pointCount / interpolatedFactor);
float yscale = 1.0f * gain;
GLKMatrix4 transform = GLKMatrix4MakeTranslation(-1.0f, 0.0f, 0.0f);
transform = GLKMatrix4Scale(transform, xscale, yscale, 1.0f);
baseEffect.transform.modelviewMatrix = transform;
#if !TARGET_OS_IPHONE
glBindVertexArray(vab);
#endif
glBindBuffer(GL_ARRAY_BUFFER, vbo);
[baseEffect prepareToDraw];
glEnableVertexAttribArray(GLKVertexAttribPosition);
glVertexAttribPointer(GLKVertexAttribPosition,
2,
GL_FLOAT,
GL_FALSE,
sizeof(EZAudioPlotGLPoint),
NULL);
glDrawArrays(mode, 0, pointCount);
if (mirrored)
{
baseEffect.transform.modelviewMatrix = GLKMatrix4Rotate(transform, M_PI, 1.0f, 0.0f, 0.0f);
[baseEffect prepareToDraw];
glDrawArrays(mode, 0, pointCount);
}
}
//------------------------------------------------------------------------------
#pragma mark - Subclass
//------------------------------------------------------------------------------
- (int)defaultRollingHistoryLength
{
return EZAudioPlotDefaultHistoryBufferLength;
}
//------------------------------------------------------------------------------
- (int)maximumRollingHistoryLength
{
return EZAudioPlotDefaultMaxHistoryBufferLength;
}
//------------------------------------------------------------------------------
#pragma mark - EZAudioDisplayLinkDelegate
//------------------------------------------------------------------------------
- (void)displayLinkNeedsDisplay:(EZAudioDisplayLink *)displayLink
{
#if TARGET_OS_IPHONE
if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive)
{
[self display];
}
#elif TARGET_OS_MAC
[self redraw];
#endif
}
//------------------------------------------------------------------------------
@end
@@ -3,7 +3,7 @@
// EZAudio
//
// Created by Syed Haris Ali on 11/24/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -24,8 +24,12 @@
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import "EZAudioUtilities.h"
//------------------------------------------------------------------------------
#pragma mark - Enumerations
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Plot Types
///-----------------------------------------------------------
@@ -33,15 +37,17 @@
/**
The types of plots that can be displayed in the view using the data.
*/
typedef NS_ENUM(NSInteger,EZPlotType){
/**
Plot that displays only the samples of the current buffer
*/
EZPlotTypeBuffer,
/**
Plot that displays a rolling history of values using the RMS calculated for each incoming buffer
*/
EZPlotTypeRolling
typedef NS_ENUM(NSInteger, EZPlotType)
{
/**
Plot that displays only the samples of the current buffer
*/
EZPlotTypeBuffer,
/**
Plot that displays a rolling history of values using the RMS calculated for each incoming buffer
*/
EZPlotTypeRolling
};
/**
@@ -59,7 +65,10 @@ typedef NS_ENUM(NSInteger,EZPlotType){
@interface EZPlot : NSView
#endif
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Customizing The Plot's Appearance
///-----------------------------------------------------------
@@ -93,7 +102,10 @@ typedef NS_ENUM(NSInteger,EZPlotType){
*/
@property (nonatomic,assign,setter=setShouldMirror:) BOOL shouldMirror;
//------------------------------------------------------------------------------
#pragma mark - Clearing
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Clearing The Plot
///-----------------------------------------------------------
@@ -103,7 +115,10 @@ typedef NS_ENUM(NSInteger,EZPlotType){
*/
-(void)clear;
//------------------------------------------------------------------------------
#pragma mark - Get Samples
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Updating The Plot
///-----------------------------------------------------------
@@ -3,7 +3,7 @@
// EZAudio
//
// Created by Syed Haris Ali on 11/24/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -3,7 +3,7 @@
// EZAudio
//
// Created by Syed Haris Ali on 6/23/15.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -3,7 +3,7 @@
// EZAudio
//
// Created by Syed Haris Ali on 6/23/15.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -60,7 +60,7 @@ OSStatus EZAudioFloatConverterCallback(AudioConverterRef inAudioConv
AudioBufferList *sourceBuffer = (AudioBufferList *)inUserData;
memcpy(ioData,
sourceBuffer,
sizeof(AudioBufferList) + (sourceBuffer->mNumberBuffers - 1)*sizeof(AudioBuffer));
sizeof(AudioBufferList) + (sourceBuffer->mNumberBuffers - 1) * sizeof(AudioBuffer));
return noErr;
}
@@ -3,7 +3,7 @@
// EZAudio
//
// Created by Syed Haris Ali on 6/23/15.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -3,7 +3,7 @@
// EZAudio
//
// Created by Syed Haris Ali on 6/23/15.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -3,7 +3,7 @@
// EZAudio
//
// Created by Syed Haris Ali on 6/23/15.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -25,7 +25,49 @@
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
#import <TargetConditionals.h>
#import "TPCircularBuffer.h"
#if TARGET_OS_IPHONE
#import <AVFoundation/AVFoundation.h>
#import <UIKit/UIKit.h>
#elif TARGET_OS_MAC
#import <AppKit/AppKit.h>
#endif
//------------------------------------------------------------------------------
#pragma mark - Data Structures
//------------------------------------------------------------------------------
/**
A data structure that holds information about audio data over time. It contains a circular buffer to incrementally write the audio data to and a scratch buffer to hold a window of audio data relative to the whole circular buffer. In use, this will provide a way to continuously append data while having an adjustable viewable window described by the bufferSize.
*/
typedef struct
{
float *buffer;
int bufferSize;
TPCircularBuffer circularBuffer;
} EZPlotHistoryInfo;
//------------------------------------------------------------------------------
/**
A data structure that holds information about a node in the context of an AUGraph.
*/
typedef struct
{
AudioUnit audioUnit;
AUNode node;
} EZAudioNodeInfo;
//------------------------------------------------------------------------------
#pragma mark - Types
//------------------------------------------------------------------------------
#if TARGET_OS_IPHONE
typedef CGRect EZRect;
#elif TARGET_OS_MAC
typedef NSRect EZRect;
#endif
//------------------------------------------------------------------------------
#pragma mark - EZAudioUtilities
@@ -364,6 +406,28 @@
*/
+ (NSString *)stringFromUInt32Code:(UInt32)code;
//------------------------------------------------------------------------------
#pragma mark - Color Utility
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Color Utility
///-----------------------------------------------------------
/**
Helper function to get the color components from a CGColorRef in the RGBA colorspace.
@param color A CGColorRef that represents a color.
@param red A pointer to a CGFloat to hold the value of the red component. This value will be between 0 and 1.
@param green A pointer to a CGFloat to hold the value of the green component. This value will be between 0 and 1.
@param blue A pointer to a CGFloat to hold the value of the blue component. This value will be between 0 and 1.
@param alpha A pointer to a CGFloat to hold the value of the alpha component. This value will be between 0 and 1.
*/
+ (void)getColorComponentsFromCGColor:(CGColorRef)color
red:(CGFloat *)red
green:(CGFloat *)green
blue:(CGFloat *)blue
alpha:(CGFloat *)alpha;
//------------------------------------------------------------------------------
#pragma mark - Plot Utility
//------------------------------------------------------------------------------
@@ -422,6 +486,47 @@
*/
+ (void)freeCircularBuffer:(TPCircularBuffer*)circularBuffer;
//------------------------------------------------------------------------------
#pragma mark - EZPlotHistoryInfo Utility
//------------------------------------------------------------------------------
/**
Calculates the RMS of a float array containing audio data and appends it to the tail of a EZPlotHistoryInfo data structure. Thread-safe.
@param buffer A float array containing the incoming audio buffer to append to the history buffer
@param bufferSize A UInt32 representing the length of the incoming audio buffer
@param historyInfo A pointer to a EZPlotHistoryInfo structure to use for managing the history buffers
*/
+ (void)appendBuffer:(float *)buffer
withBufferSize:(UInt32)bufferSize
toHistoryInfo:(EZPlotHistoryInfo *)historyInfo;
//------------------------------------------------------------------------------
/**
Zeroes out a EZPlotHistoryInfo data structure without freeing the resources.
@param historyInfo A pointer to a EZPlotHistoryInfo data structure
*/
+ (void)clearHistoryInfo:(EZPlotHistoryInfo *)historyInfo;
//------------------------------------------------------------------------------
/**
Frees a EZPlotHistoryInfo data structure
@param historyInfo A pointer to a EZPlotHistoryInfo data structure
*/
+ (void)freeHistoryInfo:(EZPlotHistoryInfo *)historyInfo;
//------------------------------------------------------------------------------
/**
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.
@param defaultLength An int representing the default length (i.e. the number of points that will be displayed on screen) of the history window.
@param 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 A pointer to the EZPlotHistoryInfo created. The caller is responsible for freeing this structure using the `freeHistoryInfo` method above.
*/
+ (EZPlotHistoryInfo *)historyInfoWithDefaultLength:(int)defaultLength
maximumLength:(int)maximumLength;
//------------------------------------------------------------------------------
@end
@@ -3,7 +3,7 @@
// EZAudio
//
// Created by Syed Haris Ali on 6/23/15.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -61,6 +61,7 @@ BOOL __shouldExitOnCheckResultFail = YES;
audioBufferList->mBuffers[i].mNumberChannels = channels;
audioBufferList->mBuffers[i].mDataByteSize = channels * outputBufferSize;
audioBufferList->mBuffers[i].mData = (float *)malloc(channels * sizeof(float) *outputBufferSize);
memset(audioBufferList->mBuffers[i].mData, 0, frames);
}
return audioBufferList;
}
@@ -533,6 +534,31 @@ BOOL __shouldExitOnCheckResultFail = YES;
}
}
//------------------------------------------------------------------------------
#pragma mark - Color Utility
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Color Utility
///-----------------------------------------------------------
+ (void)getColorComponentsFromCGColor:(CGColorRef)color
red:(CGFloat *)red
green:(CGFloat *)green
blue:(CGFloat *)blue
alpha:(CGFloat *)alpha
{
size_t componentCount = CGColorGetNumberOfComponents(color);
if (componentCount == 4)
{
const CGFloat *components = CGColorGetComponents(color);
*red = components[0];
*green = components[1];
*blue = components[2];
*alpha = components[3];
}
}
//------------------------------------------------------------------------------
#pragma mark - TPCircularBuffer Utility
//------------------------------------------------------------------------------
@@ -560,6 +586,82 @@ BOOL __shouldExitOnCheckResultFail = YES;
TPCircularBufferCleanup(circularBuffer);
}
//------------------------------------------------------------------------------
#pragma mark - EZPlotHistoryInfo Utility
//------------------------------------------------------------------------------
+ (void)appendBuffer:(float *)buffer
withBufferSize:(UInt32)bufferSize
toHistoryInfo:(EZPlotHistoryInfo *)historyInfo
{
//
// Do nothing if there is no buffer
//
if (bufferSize == 0)
{
return;
}
//
// Update the scroll history datasource
//
float rms = [EZAudioUtilities RMS:buffer length:bufferSize];
float src[1];
src[0] = isnan(rms) ? 0.0 : rms;
TPCircularBufferProduceBytes(&historyInfo->circularBuffer, src, sizeof(src));
int32_t targetBytes = historyInfo->bufferSize * sizeof(float);
int32_t availableBytes = 0;
float *historyBuffer = TPCircularBufferTail(&historyInfo->circularBuffer, &availableBytes);
int32_t bytes = MIN(targetBytes, availableBytes);
memmove(historyInfo->buffer, historyBuffer, bytes);
if (targetBytes <= availableBytes)
{
TPCircularBufferConsume(&historyInfo->circularBuffer, availableBytes - targetBytes);
}
}
//------------------------------------------------------------------------------
+ (void)clearHistoryInfo:(EZPlotHistoryInfo *)historyInfo
{
memset(historyInfo->buffer, 0, historyInfo->bufferSize * sizeof(float));
TPCircularBufferClear(&historyInfo->circularBuffer);
}
//------------------------------------------------------------------------------
+ (void)freeHistoryInfo:(EZPlotHistoryInfo *)historyInfo
{
free(historyInfo->buffer);
free(historyInfo);
TPCircularBufferCleanup(&historyInfo->circularBuffer);
}
//------------------------------------------------------------------------------
+ (EZPlotHistoryInfo *)historyInfoWithDefaultLength:(int)defaultLength
maximumLength:(int)maximumLength
{
//
// Setup buffers
//
EZPlotHistoryInfo *historyInfo = (EZPlotHistoryInfo *)malloc(sizeof(EZPlotHistoryInfo));
historyInfo->bufferSize = defaultLength;
historyInfo->buffer = calloc(maximumLength, sizeof(float));
TPCircularBufferInit(&historyInfo->circularBuffer, maximumLength);
//
// Zero out circular buffer
//
float emptyBuffer[maximumLength];
memset(emptyBuffer, 0, sizeof(emptyBuffer));
TPCircularBufferProduceBytes(&historyInfo->circularBuffer,
emptyBuffer,
(int32_t)sizeof(emptyBuffer));
return historyInfo;
}
//------------------------------------------------------------------------------
@end
+26 -16
View File
@@ -1,17 +1,27 @@
Pod::Spec.new do |s|
s.name = "EZAudio"
s.version = "0.1.0"
s.summary = "A simple, intuitive audio framework for iOS and OSX useful for anyone doing audio processing and/or audio-based visualizations."
s.homepage = "https://github.com/syedhali/EZAudio"
s.screenshots = "https://s3-us-west-1.amazonaws.com/ezaudio-media/EZAudioSummary.png"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Syed Haris Ali" => "syedhali07@gmail.com" }
s.ios.deployment_target = '6.0'
s.osx.deployment_target = '10.8'
s.source = { :git => "https://github.com/syedhali/EZAudio.git", :tag => s.version }
s.source_files = 'EZAudio/*.{h,m,c}'
s.exclude_files = 'EZAudio/VERSION'
s.ios.frameworks = 'AudioToolbox','AVFoundation','GLKit'
s.osx.frameworks = 'AudioToolbox','AudioUnit','CoreAudio','QuartzCore','OpenGL','GLKit'
s.requires_arc = true;
end
s.name = "EZAudio"
s.version = "0.7.1"
s.summary = "A simple, intuitive audio framework for iOS and OSX useful for anyone doing audio processing and/or audio-based visualizations."
s.homepage = "https://github.com/syedhali/EZAudio"
s.screenshots = "https://s3-us-west-1.amazonaws.com/ezaudio-media/EZAudioSummary.png"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { "Syed Haris Ali" => "syedhali07@gmail.com" }
s.ios.deployment_target = '6.0'
s.osx.deployment_target = '10.8'
s.source = { :git => "https://github.com/syedhali/EZAudio.git", :tag => s.version }
s.exclude_files = [ 'EZAudio/VERSION', 'EZAudio/TPCircularBuffer.{h,c}' ]
s.ios.frameworks = 'AudioToolbox','AVFoundation','GLKit'
s.osx.frameworks = 'AudioToolbox','AudioUnit','CoreAudio','QuartzCore','OpenGL','GLKit'
s.requires_arc = true;
s.default_subspec = 'Full'
s.subspec 'Core' do |core|
core.source_files = 'EZAudio/*.{h,m,c}'
end
s.subspec 'Full' do |full|
full.dependency 'TPCircularBuffer', '~> 0.0'
full.dependency 'EZAudio/Core'
end
end
-124
View File
@@ -1,124 +0,0 @@
//
// AEFloatConverter.h
// The Amazing Audio Engine
//
// Created by Michael Tyson on 25/10/2012.
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
#ifdef __cplusplus
extern "C" {
#endif
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
/*!
* Universal converter to float format
*
* Use this class to easily convert arbitrary audio formats to floating point
* for use with utilities like the Accelerate framework.
*/
@interface AEFloatConverter : NSObject
/*!
* Initialize
*
* @param sourceFormat The audio format to use
*/
- (id)initWithSourceFormat:(AudioStreamBasicDescription)sourceFormat;
/*!
* Convert audio to floating-point
*
* This C function, safe to use in a Core Audio realtime thread context, will take
* an audio buffer list of audio in the format you provided at initialisation, and
* convert it into a noninterleaved float array.
*
* @param converter Pointer to the converter object.
* @param sourceBuffer An audio buffer list containing the source audio.
* @param targetBuffers An array of floating-point arrays to store the converted float audio into.
* Note that you must provide the correct number of arrays, to match the number of channels.
* @param frames The number of frames to convert.
* @return YES on success; NO on failure
*/
BOOL AEFloatConverterToFloat(AEFloatConverter* converter, AudioBufferList *sourceBuffer, float * const * targetBuffers, UInt32 frames);
/*!
* Convert audio to floating-point, in a buffer list
*
* This C function, safe to use in a Core Audio realtime thread context, will take
* an audio buffer list of audio in the format you provided at initialisation, and
* convert it into a noninterleaved float format.
*
* @param converter Pointer to the converter object.
* @param sourceBuffer An audio buffer list containing the source audio.
* @param targetBuffer An audio buffer list to store the converted floating-point audio.
* @param frames The number of frames to convert.
* @return YES on success; NO on failure
*/
BOOL AEFloatConverterToFloatBufferList(AEFloatConverter* converter, AudioBufferList *sourceBuffer, AudioBufferList *targetBuffer, UInt32 frames);
/*!
* Convert audio from floating-point
*
* This C function, safe to use in a Core Audio realtime thread context, will take
* an audio buffer list of audio in the format you provided at initialisation, and
* convert it into a float array.
*
* @param converter Pointer to the converter object.
* @param sourceBuffers An array of floating-point arrays containing the floating-point audio to convert.
* Note that you must provide the correct number of arrays, to match the number of channels.
* @param targetBuffer An audio buffer list to store the converted audio into.
* @param frames The number of frames to convert.
* @return YES on success; NO on failure
*/
BOOL AEFloatConverterFromFloat(AEFloatConverter* converter, float * const * sourceBuffers, AudioBufferList *targetBuffer, UInt32 frames);
/*!
* Convert audio from floating-point, in a buffer list
*
* This C function, safe to use in a Core Audio realtime thread context, will take
* an audio buffer list of audio in the format you provided at initialisation, and
* convert it into a float array.
*
* @param converter Pointer to the converter object.
* @param sourceBuffer An audio buffer list containing the source audio.
* @param targetBuffer An audio buffer list to store the converted audio into.
* @param frames The number of frames to convert.
* @return YES on success; NO on failure
*/
BOOL AEFloatConverterFromFloatBufferList(AEFloatConverter* converter, AudioBufferList *sourceBuffer, AudioBufferList *targetBuffer, UInt32 frames);
/*!
* The AudioStreamBasicDescription representing the converted floating-point format
*/
@property (nonatomic, readonly) AudioStreamBasicDescription floatingPointAudioDescription;
/*!
* The source audio format set at initialization
*/
@property (nonatomic, readonly) AudioStreamBasicDescription sourceFormat;
@end
#ifdef __cplusplus
}
#endif
-211
View File
@@ -1,211 +0,0 @@
//
// AEFloatConverter.m
// The Amazing Audio Engine
//
// Created by Michael Tyson on 25/10/2012.
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
#import "AEFloatConverter.h"
#define checkResult(result,operation) (_checkResult((result),(operation),strrchr(__FILE__, '/')+1,__LINE__))
static inline BOOL _checkResult(OSStatus result, const char *operation, const char* file, int line) {
if (result != noErr) {
NSLog(@"%s:%d: %s result %d %08X %4.4s", file, line, operation, (int)result, (int)result, (char*)&result);
return NO;
}
return YES;
}
#define kNoMoreDataErr -2222
struct complexInputDataProc_t {
AudioBufferList *sourceBuffer;
};
@interface AEFloatConverter () {
AudioStreamBasicDescription _sourceAudioDescription;
AudioStreamBasicDescription _floatAudioDescription;
AudioConverterRef _toFloatConverter;
AudioConverterRef _fromFloatConverter;
AudioBufferList *_scratchFloatBufferList;
}
static OSStatus complexInputDataProc(AudioConverterRef inAudioConverter,
UInt32 *ioNumberDataPackets,
AudioBufferList *ioData,
AudioStreamPacketDescription **outDataPacketDescription,
void *inUserData);
@end
@implementation AEFloatConverter
@synthesize sourceFormat = _sourceAudioDescription;
-(id)initWithSourceFormat:(AudioStreamBasicDescription)sourceFormat {
if (!(self = [super init])) return nil;
_floatAudioDescription.mFormatID = kAudioFormatLinearPCM;
_floatAudioDescription.mFormatFlags = kAudioFormatFlagIsFloat | kAudioFormatFlagIsPacked | kAudioFormatFlagIsNonInterleaved;
_floatAudioDescription.mChannelsPerFrame = sourceFormat.mChannelsPerFrame;
_floatAudioDescription.mBytesPerPacket = sizeof(float);
_floatAudioDescription.mFramesPerPacket = 1;
_floatAudioDescription.mBytesPerFrame = sizeof(float);
_floatAudioDescription.mBitsPerChannel = 8 * sizeof(float);
_floatAudioDescription.mSampleRate = sourceFormat.mSampleRate;
_sourceAudioDescription = sourceFormat;
if (memcmp(&sourceFormat, &_floatAudioDescription, sizeof(AudioStreamBasicDescription)) != 0) {
checkResult(AudioConverterNew(&sourceFormat, &_floatAudioDescription, &_toFloatConverter), "AudioConverterNew");
checkResult(AudioConverterNew(&_floatAudioDescription, &sourceFormat, &_fromFloatConverter), "AudioConverterNew");
_scratchFloatBufferList = (AudioBufferList*)malloc(sizeof(AudioBufferList) + (_floatAudioDescription.mChannelsPerFrame-1)*sizeof(AudioBuffer));
_scratchFloatBufferList->mNumberBuffers = _floatAudioDescription.mChannelsPerFrame;
for ( int i=0; i<_scratchFloatBufferList->mNumberBuffers; i++) {
_scratchFloatBufferList->mBuffers[i].mNumberChannels = 1;
}
}
return self;
}
-(void)dealloc {
if (_toFloatConverter) AudioConverterDispose(_toFloatConverter);
if (_fromFloatConverter) AudioConverterDispose(_fromFloatConverter);
if (_scratchFloatBufferList) free(_scratchFloatBufferList);
// [super dealloc];
}
BOOL AEFloatConverterToFloat(AEFloatConverter* THIS, AudioBufferList *sourceBuffer, float * const * targetBuffers, UInt32 frames) {
if (frames == 0) return YES;
if (THIS->_toFloatConverter) {
UInt32 priorDataByteSize = sourceBuffer->mBuffers[0].mDataByteSize;
for ( int i=0; i<sourceBuffer->mNumberBuffers; i++) {
sourceBuffer->mBuffers[i].mDataByteSize = frames * THIS->_sourceAudioDescription.mBytesPerFrame;
}
for ( int i=0; i<THIS->_scratchFloatBufferList->mNumberBuffers; i++) {
THIS->_scratchFloatBufferList->mBuffers[i].mData = targetBuffers[i];
THIS->_scratchFloatBufferList->mBuffers[i].mDataByteSize = frames * sizeof(float);
}
OSStatus result = AudioConverterFillComplexBuffer(THIS->_toFloatConverter,
complexInputDataProc,
&(struct complexInputDataProc_t) { .sourceBuffer = sourceBuffer },
&frames,
THIS->_scratchFloatBufferList,
NULL);
for ( int i=0; i<sourceBuffer->mNumberBuffers; i++) {
sourceBuffer->mBuffers[i].mDataByteSize = priorDataByteSize;
}
if (!checkResult(result, "AudioConverterConvertComplexBuffer")) {
return NO;
}
} else {
for ( int i=0; i<sourceBuffer->mNumberBuffers; i++) {
memcpy(targetBuffers[i], sourceBuffer->mBuffers[i].mData, frames * sizeof(float));
}
}
return YES;
}
BOOL AEFloatConverterToFloatBufferList(AEFloatConverter* converter, AudioBufferList *sourceBuffer, AudioBufferList *targetBuffer, UInt32 frames) {
assert(targetBuffer->mNumberBuffers == converter->_floatAudioDescription.mChannelsPerFrame);
float *targetBuffers[targetBuffer->mNumberBuffers];
for ( int i=0; i<targetBuffer->mNumberBuffers; i++) {
targetBuffers[i] = (float*)targetBuffer->mBuffers[i].mData;
}
return AEFloatConverterToFloat(converter, sourceBuffer, targetBuffers, frames);
}
BOOL AEFloatConverterFromFloat(AEFloatConverter* THIS, float * const * sourceBuffers, AudioBufferList *targetBuffer, UInt32 frames) {
if (frames == 0) return YES;
if (THIS->_fromFloatConverter) {
for ( int i=0; i<THIS->_scratchFloatBufferList->mNumberBuffers; i++) {
THIS->_scratchFloatBufferList->mBuffers[i].mData = sourceBuffers[i];
THIS->_scratchFloatBufferList->mBuffers[i].mDataByteSize = frames * sizeof(float);
}
UInt32 priorDataByteSize = targetBuffer->mBuffers[0].mDataByteSize;
for ( int i=0; i<targetBuffer->mNumberBuffers; i++) {
targetBuffer->mBuffers[i].mDataByteSize = frames * THIS->_sourceAudioDescription.mBytesPerFrame;
}
OSStatus result = AudioConverterFillComplexBuffer(THIS->_fromFloatConverter,
complexInputDataProc,
&(struct complexInputDataProc_t) { .sourceBuffer = THIS->_scratchFloatBufferList },
&frames,
targetBuffer,
NULL);
for ( int i=0; i<targetBuffer->mNumberBuffers; i++) {
targetBuffer->mBuffers[i].mDataByteSize = priorDataByteSize;
}
if (!checkResult(result, "AudioConverterConvertComplexBuffer")) {
return NO;
}
} else {
for ( int i=0; i<targetBuffer->mNumberBuffers; i++) {
memcpy(targetBuffer->mBuffers[i].mData, sourceBuffers[i], frames * sizeof(float));
}
}
return YES;
}
BOOL AEFloatConverterFromFloatBufferList(AEFloatConverter* converter, AudioBufferList *sourceBuffer, AudioBufferList *targetBuffer, UInt32 frames) {
assert(sourceBuffer->mNumberBuffers == converter->_floatAudioDescription.mChannelsPerFrame);
float *sourceBuffers[sourceBuffer->mNumberBuffers];
for ( int i=0; i<sourceBuffer->mNumberBuffers; i++) {
sourceBuffers[i] = (float*)sourceBuffer->mBuffers[i].mData;
}
return AEFloatConverterFromFloat(converter, sourceBuffers, targetBuffer, frames);
}
static OSStatus complexInputDataProc(AudioConverterRef inAudioConverter,
UInt32 *ioNumberDataPackets,
AudioBufferList *ioData,
AudioStreamPacketDescription **outDataPacketDescription,
void *inUserData) {
struct complexInputDataProc_t *arg = (struct complexInputDataProc_t*)inUserData;
if (!arg->sourceBuffer) {
return kNoMoreDataErr;
}
memcpy(ioData, arg->sourceBuffer, sizeof(AudioBufferList) + (arg->sourceBuffer->mNumberBuffers-1)*sizeof(AudioBuffer));
arg->sourceBuffer = NULL;
return noErr;
}
-(AudioStreamBasicDescription)floatingPointAudioDescription {
return _floatAudioDescription;
}
@end
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:OSX/EZAudio.xcodeproj">
</FileRef>
<FileRef
location = "group:iOS/EZAudio.xcodeproj">
</FileRef>
</Workspace>
-241
View File
@@ -1,241 +0,0 @@
//
// EZAudioFile.h
// EZAudio
//
// Created by Syed Haris Ali on 12/1/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
@class EZAudio;
@class EZAudioFile;
/**
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.
*/
@protocol EZAudioFileDelegate <NSObject>
@optional
/**
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.
@param audioFile The instance of the EZAudioFile that triggered the event.
@param 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.
@param bufferSize The length of the buffers float arrays
@param numberOfChannels The number of channels. 2 for stereo, 1 for mono.
*/
-(void) audioFile:(EZAudioFile*)audioFile
readAudio:(float**)buffer
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels;
/**
Occurs when the audio file's internal seek position has been updated by the EZAudioFile functions `readFrames:audioBufferList:bufferSize:eof:` or `audioFile:updatedPosition:`.
@param audioFile The instance of the EZAudio in which the change occured
@param framePosition The new frame index as a 64-bit signed integer
*/
-(void)audioFile:(EZAudioFile*)audioFile
updatedPosition:(SInt64)framePosition;
@end
/**
The EZAudioFile provides a lightweight and intuitive way to asynchronously interact with audio files. These interactions included reading audio data, seeking within an audio file, getting information about the file, and pulling the waveform data for visualizing the contents of the audio file. The EZAudioFileDelegate provides event callbacks for when reads, seeks, and various updates happen within the audio file to allow the caller to interact with the action in meaningful ways. Common use cases here could be to read the audio file's data as AudioBufferList structures for output (see EZOutput) and visualizing the audio file's data as a float array using an audio plot (see EZAudioPlot).
*/
@interface EZAudioFile : NSObject
#pragma mark - Blocks
/**
A block used when returning back the waveform data. The waveform data itself will be an array of float values and the length indicates the total length of the float array.
@param waveformData An array of float values representing the amplitude data from the audio waveform
@param length The length of the waveform data's float array
*/
typedef void (^WaveformDataCompletionBlock)(float *waveformData, UInt32 length);
#pragma mark - Properties
/**
A EZAudioFileDelegate for the audio file that is used to return events such as new seek positions within the file and the read audio data as a float array.
*/
@property (nonatomic,assign) id<EZAudioFileDelegate> audioFileDelegate;
/**
The resolution of the waveform data. This value specifies how the recommendedDrawingFrameRate chooses itself. A low value like 128 will render a waveform containing 128 points representing a low resolution waveform while a high value like 4096 will render a high quality waveform. Higher resolutions provide more detail, but take more work to render in the audio waveform plots (EZAudioPlot or EZAudioPlotGL) while lower resolutions providel less detail, but work better for displaying many at a time (like in a UITableView)
*/
@property (nonatomic,assign) UInt32 waveformResolution;
#pragma mark - Initializers
///-----------------------------------------------------------
/// @name Initializers
///-----------------------------------------------------------
/**
Creates a new instance of the EZAudioFile using a file path URL.
@param url The file path reference of the audio file as an NSURL.
@return The newly created EZAudioFile instance.
*/
-(EZAudioFile*)initWithURL:(NSURL*)url;
/**
Creates a new instance of the EZAudioFile using a file path URL and allows specifying an EZAudioFileDelegate.
@param url The file path reference of the audio file as an NSURL.
@param delegate The audio file delegate that receives events specified by the EZAudioFileDelegate protocol
@return The newly created EZAudioFile instance.
*/
-(EZAudioFile*)initWithURL:(NSURL*)url
andDelegate:(id<EZAudioFileDelegate>)delegate;
#pragma mark - Class Initializers
///-----------------------------------------------------------
/// @name Class Initializers
///-----------------------------------------------------------
/**
Class method that creates a new instance of the EZAudioFile using a file path URL.
@param url The file path reference of the audio file as an NSURL.
@return The newly created EZAudioFile instance.
*/
+(EZAudioFile*)audioFileWithURL:(NSURL*)url;
/**
Class method that creates a new instance of the EZAudioFile using a file path URL and allows specifying an EZAudioFileDelegate.
@param url The file path reference of the audio file as an NSURL.
@param delegate The audio file delegate that receives events specified by the EZAudioFileDelegate protocol
@return The newly created EZAudioFile instance.
*/
+(EZAudioFile*)audioFileWithURL:(NSURL*)url
andDelegate:(id<EZAudioFileDelegate>)delegate;
#pragma mark - Class Methods
///-----------------------------------------------------------
/// @name Class Methods
///-----------------------------------------------------------
/**
Provides an array of the supported audio files types. Each audio file type is provided as a string, i.e. @"caf". Useful for filtering lists of files in an open panel to only the types allowed.
@return An array of NSString objects representing the represented file types.
*/
+(NSArray*)supportedAudioFileTypes;
#pragma mark - Events
///-----------------------------------------------------------
/// @name Reading The Audio File
///-----------------------------------------------------------
/**
Reads a specified number of frames from the audio file. In addition, this will notify the EZAudioFileDelegate (if specified) of the read data as a float array with the audioFile:readAudio:withBufferSize:withNumberOfChannels: event and the new seek position within the file with the audioFile:updatedPosition: event.
@param frames The number of frames to read from the file.
@param audioBufferList An allocated AudioBufferList structure in which to store the read audio data
@param bufferSize A pointer to a UInt32 in which to store the read buffersize
@param eof A pointer to a BOOL in which to store whether the read operation reached the end of the audio file.
*/
-(void)readFrames:(UInt32)frames
audioBufferList:(AudioBufferList*)audioBufferList
bufferSize:(UInt32*)bufferSize
eof:(BOOL*)eof;
///-----------------------------------------------------------
/// @name Seeking Through The Audio File
///-----------------------------------------------------------
/**
Seeks through an audio file to a specified frame. This will notify the EZAudioFileDelegate (if specified) with the audioFile:updatedPosition: function.
@param frame The new frame position to seek to as a SInt64.
*/
-(void)seekToFrame:(SInt64)frame;
#pragma mark - Getters
///-----------------------------------------------------------
/// @name Getting Information About The Audio File
///-----------------------------------------------------------
/**
Provides the AudioStreamBasicDescription structure used within the app. The file's format will be converted to this format and then sent back as either a float array or a `AudioBufferList` pointer. Use this when communicating with other EZAudio components.
@return An AudioStreamBasicDescription structure describing the format of the audio file.
*/
-(AudioStreamBasicDescription)clientFormat;
/**
Provides the AudioStreamBasicDescription structure containing the format of the file.
@return An AudioStreamBasicDescription structure describing the format of the audio file.
*/
-(AudioStreamBasicDescription)fileFormat;
/**
Provides the frame index (a.k.a the seek positon) within the audio file as an integer. This can be helpful when seeking through the audio file.
@return The current frame index within the audio file as a SInt64.
*/
-(SInt64)frameIndex;
/**
Provides a dictionary containing the metadata (ID3) tags that are included in the header for the audio file. Typically this contains stuff like artist, title, release year, etc.
@return An NSDictionary containing the metadata for the audio file.
*/
-(NSDictionary *)metadata;
/**
Provides the total duration of the audio file in seconds.
@return The total duration of the audio file as a Float32.
*/
-(Float32)totalDuration;
/**
Provides the total frame count of the audio file.
@return The total number of frames in the audio file as a SInt64.
*/
-(SInt64)totalFrames;
/**
Provides the NSURL for the audio file.
@return An NSURL representing the path of the EZAudioFile instance.
*/
-(NSURL*)url;
#pragma mark - Helpers
///-----------------------------------------------------------
/// @name Manipulating The Audio Data
///-----------------------------------------------------------
/**
Tells the caller whether the EZAudioFile has cached waveform data that was loaded via the getWaveformDataWithCompletionBlock: function.
* @return A BOOL indicating whether there is cached waveform data
*/
-(BOOL)hasLoadedAudioData;
/**
Asynchronously pulls the waveform amplitude data into a float array for the receiver.
@param waveformDataCompletionBlock A WaveformDataCompletionBlock that executes when the waveform data has been extracted. Provides the waveform data as a float array and the length of the array.
*/
-(void)getWaveformDataWithCompletionBlock:(WaveformDataCompletionBlock)waveformDataCompletionBlock;
/**
Provides the minimum number of buffers that would be required with the constant frames read rate provided.
@param frameRate A constant frame rate to use when calculating the number of buffers needed as a UInt32.
@return The minimum number of buffers required for the constant frames read rate provided as a UInt32.
*/
-(UInt32)minBuffersWithFrameRate:(UInt32)frameRate;
/**
Provides a frame rate to use when drawing and averaging a bin of values to create each point in a graph. The ideal amount of end buffers seems to be between 1000-3000 so we determine a frame rate per audio file that can achieve a high degree of detail for the entire waveform.
@return A frame rate value as a UInt32 to use when reading frames in a file.
*/
-(UInt32)recommendedDrawingFrameRate;
@end
-366
View File
@@ -1,366 +0,0 @@
//
// EZAudioFile.m
// EZAudio
//
// Created by Syed Haris Ali on 12/1/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "EZAudioFile.h"
#import "AEFloatConverter.h"
#import "EZAudioUtilities.h"
#define kEZAudioFileWaveformDefaultResolution (1024)
@interface EZAudioFile (){
// Reading from the audio file
ExtAudioFileRef _audioFile;
AudioStreamBasicDescription _clientFormat;
AudioStreamBasicDescription _fileFormat;
float **_floatBuffers;
AEFloatConverter *_floatConverter;
SInt64 _frameIndex;
CFURLRef _sourceURL;
Float32 _totalDuration;
SInt64 _totalFrames;
// Waveform Data
float *_waveformData;
UInt32 _waveformFrameRate;
UInt32 _waveformTotalBuffers;
}
@end
@implementation EZAudioFile
@synthesize audioFileDelegate = _audioFileDelegate;
@synthesize waveformResolution = _waveformResolution;
#pragma mark - Initializers
-(EZAudioFile*)initWithURL:(NSURL*)url {
self = [super init];
if(self){
_sourceURL = (__bridge CFURLRef)url;
[self _configureAudioFile];
}
return self;
}
-(EZAudioFile *)initWithURL:(NSURL *)url andDelegate:(id<EZAudioFileDelegate>)delegate {
self = [self initWithURL:url];
if(self){
self.audioFileDelegate = delegate;
}
return self;
}
#pragma mark - Class Initializers
+(EZAudioFile*)audioFileWithURL:(NSURL*)url {
return [[EZAudioFile alloc] initWithURL:url];
}
+(EZAudioFile *)audioFileWithURL:(NSURL *)url andDelegate:(id<EZAudioFileDelegate>)delegate {
return [[EZAudioFile alloc] initWithURL:url andDelegate:delegate];
}
#pragma mark - Class Methods
+(NSArray *)supportedAudioFileTypes {
return @[ @"aac",
@"caf",
@"aif",
@"aiff",
@"aifc",
@"mp3",
@"mp4",
@"m4a",
@"snd",
@"au",
@"sd2",
@"wav" ];
}
#pragma mark - Private Configuation
-(void)_configureAudioFile {
// Source URL should not be nil
NSAssert(_sourceURL,@"Source URL was not specified correctly.");
// Try to open the file for reading
[EZAudioUtilities checkResult:ExtAudioFileOpenURL(_sourceURL,&_audioFile)
operation:"Failed to open audio file for reading"];
// Try pulling the stream description
UInt32 size = sizeof(_fileFormat);
[EZAudioUtilities checkResult:ExtAudioFileGetProperty(_audioFile,kExtAudioFileProperty_FileDataFormat, &size, &_fileFormat)
operation:"Failed to get audio stream basic description of input file"];
// Try pulling the total frame size
size = sizeof(_totalFrames);
[EZAudioUtilities checkResult:ExtAudioFileGetProperty(_audioFile,kExtAudioFileProperty_FileLengthFrames, &size, &_totalFrames)
operation:"Failed to get total frames of input file"];
_totalFrames = MAX(1, _totalFrames);
// Total duration
_totalDuration = _totalFrames / _fileFormat.mSampleRate;
// Set the client format on the stream
switch (_fileFormat.mChannelsPerFrame) {
case 1:
_clientFormat = [EZAudioUtilities monoFloatFormatWithSampleRate:_fileFormat.mSampleRate];
break;
case 2:
_clientFormat = [EZAudioUtilities stereoFloatInterleavedFormatWithSampleRate:_fileFormat.mSampleRate];
break;
default:
break;
}
[EZAudioUtilities checkResult:ExtAudioFileSetProperty(_audioFile,
kExtAudioFileProperty_ClientDataFormat,
sizeof (AudioStreamBasicDescription),
&_clientFormat)
operation:"Couldn't set client data format on input ext file"];
// Allocate the float buffers
_floatConverter = [[AEFloatConverter alloc] initWithSourceFormat:_clientFormat];
size_t sizeToAllocate = sizeof(float*) * _clientFormat.mChannelsPerFrame;
sizeToAllocate = MAX(8, sizeToAllocate);
_floatBuffers = (float**)malloc( sizeToAllocate);
UInt32 outputBufferSize = 32 * 1024; // 32 KB
for ( int i=0; i< _clientFormat.mChannelsPerFrame; i++) {
_floatBuffers[i] = (float*)malloc(outputBufferSize);
}
[EZAudioUtilities printASBD:_fileFormat];
// There's no waveform data yet
_waveformData = NULL;
// Set the default resolution for the waveform data
_waveformResolution = kEZAudioFileWaveformDefaultResolution;
}
#pragma mark - Events
-(void)readFrames:(UInt32)frames
audioBufferList:(AudioBufferList *)audioBufferList
bufferSize:(UInt32 *)bufferSize
eof:(BOOL *)eof {
[EZAudioUtilities checkResult:ExtAudioFileRead(_audioFile,
&frames,
audioBufferList)
operation:"Failed to read audio data from audio file"];
*bufferSize = audioBufferList->mBuffers[0].mDataByteSize/sizeof(float);
*eof = frames == 0;
_frameIndex += frames;
if (self.audioFileDelegate){
if ([self.audioFileDelegate respondsToSelector:@selector(audioFile:updatedPosition:)]){
[self.audioFileDelegate audioFile:self
updatedPosition:_frameIndex];
}
if ([self.audioFileDelegate respondsToSelector:@selector(audioFile:readAudio:withBufferSize:withNumberOfChannels:)]){
AEFloatConverterToFloat(_floatConverter,audioBufferList,_floatBuffers,frames);
[self.audioFileDelegate audioFile:self
readAudio:_floatBuffers
withBufferSize:frames
withNumberOfChannels:_clientFormat.mChannelsPerFrame];
}
}
}
-(void)seekToFrame:(SInt64)frame {
[EZAudioUtilities checkResult:ExtAudioFileSeek(_audioFile,frame)
operation:"Failed to seek frame position within audio file"];
_frameIndex = frame;
if (self.audioFileDelegate){
if ([self.audioFileDelegate respondsToSelector:@selector(audioFile:updatedPosition:)]){
[self.audioFileDelegate audioFile:self updatedPosition:_frameIndex];
}
}
}
#pragma mark - Getters
-(BOOL)hasLoadedAudioData {
return _waveformData != NULL;
}
-(void)getWaveformDataWithCompletionBlock:(WaveformDataCompletionBlock)waveformDataCompletionBlock {
SInt64 currentFramePosition = _frameIndex;
if (_waveformData != NULL){
waveformDataCompletionBlock( _waveformData, _waveformTotalBuffers);
return;
}
_waveformFrameRate = [self recommendedDrawingFrameRate];
_waveformTotalBuffers = [self minBuffersWithFrameRate:_waveformFrameRate];
_waveformData = (float*)malloc(sizeof(float)*_waveformTotalBuffers);
if (self.totalFrames == 0){
waveformDataCompletionBlock( _waveformData, _waveformTotalBuffers);
return;
}
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0ul), ^{
for( int i = 0; i < _waveformTotalBuffers; i++){
// Take a snapshot of each buffer through the audio file to form the waveform
AudioBufferList *bufferList = [EZAudioUtilities audioBufferListWithNumberOfFrames:_waveformFrameRate
numberOfChannels:_clientFormat.mChannelsPerFrame
interleaved:YES];
UInt32 bufferSize;
BOOL eof;
// Read in the specified number of frames
[EZAudioUtilities checkResult:ExtAudioFileRead(_audioFile,
&_waveformFrameRate,
bufferList)
operation:"Failed to read audio data from audio file"];
bufferSize = bufferList->mBuffers[0].mDataByteSize/sizeof(float);
bufferSize = MAX(1, bufferSize);
eof = _waveformFrameRate == 0;
_frameIndex += _waveformFrameRate;
// Calculate RMS of each buffer
float rms = [EZAudioUtilities RMS:bufferList->mBuffers[0].mData
length:bufferSize];
_waveformData[i] = rms;
// Since we malloc'ed, we should cleanup
[EZAudioUtilities freeBufferList:bufferList];
}
// Seek the audio file back to the beginning
[EZAudioUtilities checkResult:ExtAudioFileSeek(_audioFile,currentFramePosition)
operation:"Failed to seek frame position within audio file"];
_frameIndex = currentFramePosition;
// Once we're done send off the waveform data
dispatch_async(dispatch_get_main_queue(), ^{
waveformDataCompletionBlock( _waveformData, _waveformTotalBuffers);
});
});
}
-(AudioStreamBasicDescription)clientFormat {
return _clientFormat;
}
-(AudioStreamBasicDescription)fileFormat {
return _fileFormat;
}
-(SInt64)frameIndex {
return _frameIndex;
}
-(NSDictionary *)metadata
{
AudioFileID audioFileID;
UInt32 propSize = sizeof(audioFileID);
[EZAudioUtilities checkResult:ExtAudioFileGetProperty(_audioFile,
kExtAudioFileProperty_AudioFile,
&propSize,
&audioFileID)
operation:"Failed to get audio file id"];
CFDictionaryRef metadata;
UInt32 isWritable;
[EZAudioUtilities checkResult:AudioFileGetPropertyInfo(audioFileID,
kAudioFilePropertyInfoDictionary,
&propSize,
&isWritable)
operation:"Failed to get the size of the metadata dictionary"];
[EZAudioUtilities checkResult:AudioFileGetProperty(audioFileID,
kAudioFilePropertyInfoDictionary,
&propSize,
&metadata)
operation:"Failed to get metadata dictionary"];
return (__bridge NSDictionary *)metadata;
}
-(Float32)totalDuration {
return _totalDuration;
}
-(SInt64)totalFrames {
return _totalFrames;
}
-(NSURL *)url {
return (__bridge NSURL*)_sourceURL;
}
#pragma mark - Setters
-(void)setWaveformResolution:(UInt32)waveformResolution {
if (_waveformResolution != waveformResolution){
_waveformResolution = waveformResolution;
if (_waveformData){
free(_waveformData);
_waveformData = NULL;
}
}
}
#pragma mark - Helpers
-(UInt32)minBuffersWithFrameRate:(UInt32)frameRate {
frameRate = frameRate > 0 ? frameRate : 1;
UInt32 val = (UInt32) _totalFrames / frameRate + 1;
return MAX(1, val);
}
-(UInt32)recommendedDrawingFrameRate {
UInt32 val = 1;
if(_waveformResolution > 0){
val = (UInt32) _totalFrames / _waveformResolution;
if(val > 1)
--val;
}
return MAX(1, val);
}
#pragma mark - Cleanup
-(void)dealloc {
if (_waveformData){
free(_waveformData);
_waveformData = NULL;
}
// if (_floatBuffers){
// free(_floatBuffers);
// _floatBuffers = NULL;
// }
_frameIndex = 0;
_waveformFrameRate = 0;
_waveformTotalBuffers = 0;
if (_audioFile){
[EZAudioUtilities checkResult:ExtAudioFileDispose(_audioFile)
operation:"Failed to dispose of audio file"];
}
}
@end
-301
View File
@@ -1,301 +0,0 @@
//
// EZAudioPlayer.h
// EZAudio
//
// Created by Syed Haris Ali on 1/16/14.
// Copyright (c) 2014 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import "TargetConditionals.h"
#import "EZAudioFile.h"
#import "EZOutput.h"
#if TARGET_OS_IPHONE
#import <AVFoundation/AVFoundation.h>
#elif TARGET_OS_MAC
#endif
@class EZAudioPlayer;
/**
The EZAudioPlayerDelegate provides event callbacks for the EZAudioPlayer. These type of events are triggered by changes in the EZAudioPlayer's state and allow someone implementing the EZAudioPlayer to more easily update their user interface. Events are triggered anytime the EZAudioPlayer resumes/pauses playback, reaches the end of the file, reads audio data and converts it to float data visualizations (using the EZAudioFile), and updates its cursor position within the audio file during playback (use this for the play position on a slider on the user interface).
@warning These callbacks don't necessarily occur on the main thread so make sure you wrap any UI code in a GCD block like: dispatch_async(dispatch_get_main_queue(), ^{ // Update UI });
*/
@protocol EZAudioPlayerDelegate <NSObject>
@optional
/**
Triggered by the EZAudioPlayer when the playback has been resumed or started.
@param audioPlayer The instance of the EZAudioPlayer that triggered the event
@param audioFile The instance of the EZAudioFile that the event was triggered from
*/
-(void)audioPlayer:(EZAudioPlayer*)audioPlayer didResumePlaybackOnAudioFile:(EZAudioFile*)audioFile;
/**
Triggered by the EZAudioPlayer when the playback has been paused.
@param audioPlayer The instance of the EZAudioPlayer that triggered the event
@param audioFile The instance of the EZAudioFile that the event was triggered from
*/
-(void)audioPlayer:(EZAudioPlayer*)audioPlayer didPausePlaybackOnAudioFile:(EZAudioFile*)audioFile;
/**
Triggered by the EZAudioPlayer when the output has reached the end of the EZAudioFile it's playing. If the EZAudioPlayer has its `shouldLoop` property set to true this will trigger, but playback will continue to loop once its hit the end of the audio file.
@param audioPlayer The instance of the EZAudioPlayer that triggered the event
@param audioFile The instance of the EZAudioFile that the event was triggered from
*/
-(void)audioPlayer:(EZAudioPlayer*)audioPlayer reachedEndOfAudioFile:(EZAudioFile*)audioFile;
/**
Triggered by the EZAudioPlayer's internal EZAudioFile's EZAudioFileDelegate callback and notifies 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.
@param audioPlayer The instance of the EZAudioPlayer that triggered the event
@param 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.
@param bufferSize The length of the buffers float arrays
@param numberOfChannels The number of channels. 2 for stereo, 1 for mono.
@param audioFile The instance of the EZAudioFile that the event was triggered from
*/
-(void) audioPlayer:(EZAudioPlayer*)audioPlayer
readAudio:(float**)buffer
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels
inAudioFile:(EZAudioFile*)audioFile;;
/**
Triggered by EZAudioPlayer's internal EZAudioFile's EZAudioFileDelegate callback and notifies the delegate of the current playback position. The framePosition provides the current frame position and can be calculated against the EZAudioPlayer's total frames using the `totalFrames` function from the EZAudioPlayer.
@param audioPlayer The instance of the EZAudioPlayer that triggered the event
@param framePosition The new frame index as a 64-bit signed integer
@param audioFile The instance of the EZAudioFile that the event was triggered from
*/
-(void)audioPlayer:(EZAudioPlayer*)audioPlayer
updatedPosition:(SInt64)framePosition
inAudioFile:(EZAudioFile*)audioFile;
@end
/**
The EZAudioPlayer acts as the master delegate (the EZAudioFileDelegate) over whatever EZAudioFile it is using for playback. Classes that want to get the EZAudioFileDelegate callbacks should implement the EZAudioPlayer's EZAudioPlayerDelegate on the EZAudioPlayer instance.
*/
@interface EZAudioPlayer : NSObject
#pragma mark - Properties
///-----------------------------------------------------------
/// @name Properties
///-----------------------------------------------------------
/**
The EZAudioPlayerDelegate that will handle the audio player callbacks
*/
@property (nonatomic,assign) id<EZAudioPlayerDelegate> audioPlayerDelegate;
/**
A BOOL indicating whether the player should loop the file
*/
@property (nonatomic,assign) BOOL shouldLoop;
#pragma mark - Initializers
///-----------------------------------------------------------
/// @name Initializers
///-----------------------------------------------------------
/**
Initializes the EZAudioPlayer with an EZAudioFile instance. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
@param audioFile The instance of the EZAudioFile to use for initializing the EZAudioPlayer
@return The newly created instance of the EZAudioPlayer
*/
-(EZAudioPlayer*)initWithEZAudioFile:(EZAudioFile*)audioFile;
/**
Initializes the EZAudioPlayer with an EZAudioFile instance and provides a way to assign the EZAudioPlayerDelegate on instantiation. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
@param audioFile The instance of the EZAudioFile to use for initializing the EZAudioPlayer
@param audioPlayerDelegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the initWithEZAudioFile: function instead.
@return The newly created instance of the EZAudioPlayer
*/
-(EZAudioPlayer*)initWithEZAudioFile:(EZAudioFile*)audioFile
withDelegate:(id<EZAudioPlayerDelegate>)audioPlayerDelegate;
/**
Initializes the EZAudioPlayer with an NSURL instance representing the file path of the audio file.
@param url The NSURL instance representing the file path of the audio file.
@return The newly created instance of the EZAudioPlayer
*/
-(EZAudioPlayer*)initWithURL:(NSURL*)url;
/**
Initializes the EZAudioPlayer with an NSURL instance representing the file path of the audio file and a caller to assign as the EZAudioPlayerDelegate on instantiation.
@param url The NSURL instance representing the file path of the audio file.
@param audioPlayerDelegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the initWithEZAudioFile: function instead.
@return The newly created instance of the EZAudioPlayer
*/
-(EZAudioPlayer*)initWithURL:(NSURL*)url
withDelegate:(id<EZAudioPlayerDelegate>)audioPlayerDelegate;
#pragma mark - Class Initializers
///-----------------------------------------------------------
/// @name Class Initializers
///-----------------------------------------------------------
/**
Class initializer that initializes the EZAudioPlayer with an EZAudioFile instance. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
@param audioFile The instance of the EZAudioFile to use for initializing the EZAudioPlayer
@return The newly created instance of the EZAudioPlayer
*/
+(EZAudioPlayer*)audioPlayerWithEZAudioFile:(EZAudioFile*)audioFile;
/**
Class initializer that initializes the EZAudioPlayer with an EZAudioFile instance and provides a way to assign the EZAudioPlayerDelegate on instantiation. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
@param audioFile The instance of the EZAudioFile to use for initializing the EZAudioPlayer
@param audioPlayerDelegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the audioPlayerWithEZAudioFile: function instead.
@return The newly created instance of the EZAudioPlayer
*/
+(EZAudioPlayer*)audioPlayerWithEZAudioFile:(EZAudioFile*)audioFile
withDelegate:(id<EZAudioPlayerDelegate>)audioPlayerDelegate;
/**
Class initializer that initializes the EZAudioPlayer with an NSURL instance representing the file path of the audio file.
@param url The NSURL instance representing the file path of the audio file.
@return The newly created instance of the EZAudioPlayer
*/
+(EZAudioPlayer*)audioPlayerWithURL:(NSURL*)url;
/**
Class initializer that initializes the EZAudioPlayer with an NSURL instance representing the file path of the audio file and a caller to assign as the EZAudioPlayerDelegate on instantiation.
@param url The NSURL instance representing the file path of the audio file.
@param audioPlayerDelegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the audioPlayerWithURL: function instead.
@return The newly created instance of the EZAudioPlayer
*/
+(EZAudioPlayer*)audioPlayerWithURL:(NSURL*)url
withDelegate:(id<EZAudioPlayerDelegate>)audioPlayerDelegate;
#pragma mark - Singleton
///-----------------------------------------------------------
/// @name Shared Instance
///-----------------------------------------------------------
/**
The shared instance (singleton) of the audio player. Most applications will only have one instance of the EZAudioPlayer that can be reused with multiple different audio files.
* @return The shared instance of the EZAudioPlayer.
*/
+(EZAudioPlayer*)sharedAudioPlayer;
#pragma mark - Getters
///-----------------------------------------------------------
/// @name Getting The Audio Player's Properties
///-----------------------------------------------------------
/**
Provides the EZAudioFile instance that is being used as the datasource for playback.
@return The EZAudioFile instance that is currently being used for playback.
*/
-(EZAudioFile*)audioFile;
/**
Provides the current time (a.k.a. the seek position) in seconds within the audio file that's being used for playback. This can be helpful when displaying the audio player's current time over duration.
@return A float representing the current time within the audio file used for playback.
*/
-(float)currentTime;
/**
Provides a flag indicating whether the EZAudioPlayer has reached the end of the audio file used for playback.
@return A BOOL indicating whether or not the EZAudioPlayer has reached the end of the file it is using for playback.
*/
-(BOOL)endOfFile;
/**
Provides the frame index (a.k.a the seek positon) within the audio file being used for playback. This can be helpful when seeking through the audio file.
@return An SInt64 representing the current frame index within the audio file used for playback.
*/
-(SInt64)frameIndex;
/**
Provides a flag indicating whether the EZAudioPlayer is currently playing back any audio.
@return A BOOL indicating whether or not the EZAudioPlayer is performing playback,
*/
-(BOOL)isPlaying;
/**
Provides the EZOutput instance that is being used to provide playback to the system output.
@return The EZOutput instance that is currently being used for output playback.
*/
-(EZOutput*)output;
/**
Provides the total duration of the current audio file being used for playback (in seconds).
@return A float representing the total duration of the current audio file being used for playback in seconds.
*/
-(float)totalDuration;
/**
Provides the total amount of frames in the current audio file being used for playback.
@return A SInt64 representing the total amount of frames in the current audio file being used for playback.
*/
-(SInt64)totalFrames;
/**
Provides the file path that's currently being used by the player for playback.
@return The NSURL representing the file path of the audio file being used for playback.
*/
-(NSURL*)url;
#pragma mark - Setters
///-----------------------------------------------------------
/// @name Setting The File/Output
///-----------------------------------------------------------
/**
Sets the EZAudioFile to use for playback. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
@param audioFile The new EZAudioFile instance that should be used for playback
*/
-(void)setAudioFile:(EZAudioFile*)audioFile;
/**
Sets the EZOutput to route playback. By default this uses the [EZOutput sharedOutput] singleton.
@param output The new EZOutput instance that should be used for playback
*/
-(void)setOutput:(EZOutput*)output;
#pragma mark - Methods
///-----------------------------------------------------------
/// @name Play/Pause/Seeking the Player
///-----------------------------------------------------------
/**
Starts or resumes playback.
*/
-(void)play;
/**
Pauses playback.
*/
-(void)pause;
/**
Stops playback.
*/
-(void)stop;
/**
Seeks playback to a specified frame within the internal EZAudioFile. This will notify the EZAudioFileDelegate (if specified) with the audioPlayer:updatedPosition:inAudioFile: function.
@param frame The new frame position to seek to as a SInt64.
*/
-(void)seekToFrame:(SInt64)frame;
@end
-297
View File
@@ -1,297 +0,0 @@
//
// EZAudioPlayer.m
// EZAudio
//
// Created by Syed Haris Ali on 1/16/14.
// Copyright (c) 2014 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "EZAudioPlayer.h"
#import "EZAudioUtilities.h"
#if TARGET_OS_IPHONE
#elif TARGET_OS_MAC
#endif
@interface EZAudioPlayer () <EZAudioFileDelegate,EZOutputDataSource>
{
BOOL _eof;
}
@property (nonatomic,strong,setter=setAudioFile:) EZAudioFile *audioFile;
@property (nonatomic,strong,setter=setOutput:) EZOutput *output;
@end
@implementation EZAudioPlayer
@synthesize audioFile = _audioFile;
@synthesize audioPlayerDelegate = _audioPlayerDelegate;
@synthesize output = _output;
@synthesize shouldLoop = _shouldLoop;
#pragma mark - Initializers
-(id)init {
self = [super init];
if(self){
[self _configureAudioPlayer];
}
return self;
}
-(EZAudioPlayer*)initWithEZAudioFile:(EZAudioFile *)audioFile {
return [self initWithEZAudioFile:audioFile withDelegate:nil];
}
-(EZAudioPlayer *)initWithEZAudioFile:(EZAudioFile *)audioFile
withDelegate:(id<EZAudioPlayerDelegate>)audioPlayerDelegate {
self = [super init];
if(self){
// This should make a separate reference to the audio file
[self _configureAudioPlayer];
self.audioFile = audioFile;
self.audioPlayerDelegate = audioPlayerDelegate;
}
return self;
}
-(EZAudioPlayer *)initWithURL:(NSURL *)url {
return [self initWithURL:url withDelegate:nil];
}
-(EZAudioPlayer *)initWithURL:(NSURL *)url
withDelegate:(id<EZAudioPlayerDelegate>)audioPlayerDelegate {
self = [super init];
if(self){
[self _configureAudioPlayer];
self.audioFile = [EZAudioFile audioFileWithURL:url andDelegate:self];
self.audioPlayerDelegate = audioPlayerDelegate;
}
return self;
}
#pragma mark - Class Initializers
+(EZAudioPlayer *)audioPlayerWithEZAudioFile:(EZAudioFile *)audioFile {
return [[EZAudioPlayer alloc] initWithEZAudioFile:audioFile];
}
+(EZAudioPlayer *)audioPlayerWithEZAudioFile:(EZAudioFile *)audioFile
withDelegate:(id<EZAudioPlayerDelegate>)audioPlayerDelegate {
return [[EZAudioPlayer alloc] initWithEZAudioFile:audioFile
withDelegate:audioPlayerDelegate];
}
+(EZAudioPlayer *)audioPlayerWithURL:(NSURL *)url {
return [[EZAudioPlayer alloc] initWithURL:url];
}
+(EZAudioPlayer *)audioPlayerWithURL:(NSURL *)url
withDelegate:(id<EZAudioPlayerDelegate>)audioPlayerDelegate {
return [[EZAudioPlayer alloc] initWithURL:url
withDelegate:audioPlayerDelegate];
}
#pragma mark - Singleton
+(EZAudioPlayer *)sharedAudioPlayer {
static EZAudioPlayer *_sharedAudioPlayer = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedAudioPlayer = [[EZAudioPlayer alloc] init];
});
return _sharedAudioPlayer;
}
#pragma mark - Private Configuration
-(void)_configureAudioPlayer {
// Defaults
self.output = [EZOutput sharedOutput];
#if TARGET_OS_IPHONE
// Configure the AVSession
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
NSError *err = NULL;
[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&err];
if (err){
NSLog(@"There was an error creating the audio session");
}
[audioSession overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:NULL];
if (err){
NSLog(@"There was an error sending the audio to the speakers");
}
#elif TARGET_OS_MAC
#endif
}
#pragma mark - Getters
-(EZAudioFile*)audioFile {
return _audioFile;
}
-(float)currentTime {
NSAssert(_audioFile,@"No audio file to perform the seek on, check that EZAudioFile is not nil");
return [EZAudioUtilities MAP:self.audioFile.frameIndex
leftMin:0
leftMax:self.audioFile.totalFrames
rightMin:0
rightMax:self.audioFile.totalDuration];
}
-(BOOL)endOfFile {
return _eof;
}
-(SInt64)frameIndex {
NSAssert(_audioFile,@"No audio file to perform the seek on, check that EZAudioFile is not nil");
return _audioFile.frameIndex;
}
-(BOOL)isPlaying {
return self.output.isPlaying;
}
-(EZOutput*)output {
NSAssert(_output,@"No output was found, this should by default be the EZOutput shared instance");
return _output;
}
-(float)totalDuration {
NSAssert(_audioFile,@"No audio file to perform the seek on, check that EZAudioFile is not nil");
return _audioFile.totalDuration;
}
-(SInt64)totalFrames {
NSAssert(_audioFile,@"No audio file to perform the seek on, check that EZAudioFile is not nil");
return _audioFile.totalFrames;
}
-(NSURL *)url {
NSAssert(_audioFile,@"No audio file to perform the seek on, check that EZAudioFile is not nil");
return _audioFile.url;
}
#pragma mark - Setters
-(void)setAudioFile:(EZAudioFile *)audioFile {
if (_audioFile){
_audioFile.audioFileDelegate = nil;
}
_eof = NO;
_audioFile = [EZAudioFile audioFileWithURL:audioFile.url andDelegate:self];
NSAssert(_output,@"No output was found, this should by default be the EZOutput shared instance");
[_output setAudioStreamBasicDescription:self.audioFile.clientFormat];
}
-(void)setOutput:(EZOutput*)output {
_output = output;
_output.outputDataSource = self;
}
#pragma mark - Methods
-(void)play {
NSAssert(_audioFile,@"No audio file to perform the seek on, check that EZAudioFile is not nil");
if (_audioFile){
[_output startPlayback];
if (self.frameIndex != self.totalFrames){
_eof = NO;
}
if (self.audioPlayerDelegate){
if ([self.audioPlayerDelegate respondsToSelector:@selector(audioPlayer:didResumePlaybackOnAudioFile:)]){
// Notify the delegate we're starting playback
[self.audioPlayerDelegate audioPlayer:self didResumePlaybackOnAudioFile:_audioFile];
}
}
}
}
-(void)pause {
NSAssert(self.audioFile,@"No audio file to perform the seek on, check that EZAudioFile is not nil");
if (_audioFile){
[_output stopPlayback];
if (self.audioPlayerDelegate){
if ([self.audioPlayerDelegate respondsToSelector:@selector(audioPlayer:didPausePlaybackOnAudioFile:)]){
// Notify the delegate we're pausing playback
[self.audioPlayerDelegate audioPlayer:self didPausePlaybackOnAudioFile:_audioFile];
}
}
}
}
-(void)seekToFrame:(SInt64)frame {
NSAssert(_audioFile,@"No audio file to perform the seek on, check that EZAudioFile is not nil");
if (_audioFile){
[_audioFile seekToFrame:frame];
}
if (self.frameIndex != self.totalFrames){
_eof = NO;
}
}
-(void)stop {
NSAssert(_audioFile,@"No audio file to perform the seek on, check that EZAudioFile is not nil");
if (_audioFile){
[_output stopPlayback];
[_audioFile seekToFrame:0];
_eof = NO;
}
}
#pragma mark - EZAudioFileDelegate
-(void)audioFile:(EZAudioFile *)audioFile
readAudio:(float **)buffer
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels {
if (self.audioPlayerDelegate){
if ([self.audioPlayerDelegate respondsToSelector:@selector(audioPlayer:readAudio:withBufferSize:withNumberOfChannels:inAudioFile:)]){
[self.audioPlayerDelegate audioPlayer:self
readAudio:buffer
withBufferSize:bufferSize
withNumberOfChannels:numberOfChannels
inAudioFile:audioFile];
}
}
}
-(void)audioFile:(EZAudioFile *)audioFile updatedPosition:(SInt64)framePosition {
if (self.audioPlayerDelegate){
if ([self.audioPlayerDelegate respondsToSelector:@selector(audioPlayer:updatedPosition:inAudioFile:)]){
[self.audioPlayerDelegate audioPlayer:self
updatedPosition:framePosition
inAudioFile:audioFile];
}
}
}
#pragma mark - EZOutputDataSource
-(void) output:(EZOutput *)output
shouldFillAudioBufferList:(AudioBufferList *)audioBufferList
withNumberOfFrames:(UInt32)frames
{
if (self.audioFile)
{
UInt32 bufferSize;
[self.audioFile readFrames:frames
audioBufferList:audioBufferList
bufferSize:&bufferSize
eof:&_eof];
if (_eof && self.shouldLoop)
{
[self seekToFrame:0];
}
}
}
@end
-82
View File
@@ -1,82 +0,0 @@
//
// EZAudioPlot.h
// EZAudio
//
// Created by Syed Haris Ali on 9/2/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "TargetConditionals.h"
#import "EZPlot.h"
@class EZAudio;
#define kEZAudioPlotMaxHistoryBufferLength (8192)
#define kEZAudioPlotDefaultHistoryBufferLength (1024)
/**
`EZAudioPlot`, a subclass of `EZPlot`, is a cross-platform (iOS and OSX) class that plots an audio waveform using Core Graphics.
The caller provides updates a constant stream of updated audio data in the `updateBuffer:withBufferSize:` function, which in turn will be plotted in one of the plot types:
* Buffer (`EZPlotTypeBuffer`) - A plot that only consists of the current buffer and buffer size from the last call to `updateBuffer:withBufferSize:`. This looks similar to the default openFrameworks input audio example.
* Rolling (`EZPlotTypeRolling`) - A plot that consists of a rolling history of values averaged from each buffer. This is the traditional waveform look.
#Parent Methods and Properties#
See EZPlot for full API methods and properties (colors, plot type, update function)
*/
@interface EZAudioPlot : EZPlot
{
CGPoint *plotData;
UInt32 plotLength;
}
#pragma mark - Adjust Resolution
///-----------------------------------------------------------
/// @name Adjusting The Resolution
///-----------------------------------------------------------
/**
Sets the length of the rolling history display. Can grow or shrink the display up to the maximum size specified by the kEZAudioPlotMaxHistoryBufferLength macro. Will return the actual set value, which will be either the given value if smaller than the kEZAudioPlotMaxHistoryBufferLength or kEZAudioPlotMaxHistoryBufferLength if a larger value is attempted to be set.
@param historyLength The new length of the rolling history buffer.
@return The new value equal to the historyLength or the kEZAudioPlotMaxHistoryBufferLength.
*/
-(int)setRollingHistoryLength:(int)historyLength;
/**
Provides the length of the rolling history buffer
* @return An int representing the length of the rolling history buffer
*/
-(int)rollingHistoryLength;
#pragma mark - Subclass Methods
/**
<#Description#>
@param data <#theplotData description#>
@param length <#length description#>
*/
-(void)setSampleData:(float *)data
length:(int)length;
@end
-297
View File
@@ -1,297 +0,0 @@
//
// EZAudioPlot.m
// EZAudio
//
// Created by Syed Haris Ali on 9/2/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "EZAudioPlot.h"
#import "EZAudioUtilities.h"
@interface EZAudioPlot () {
// BOOL _hasData;
// TPCircularBuffer _historyBuffer;
// Rolling History
BOOL _setMaxLength;
float *_scrollHistory;
int _scrollHistoryIndex;
UInt32 _scrollHistoryLength;
BOOL _changingHistorySize;
}
@end
@implementation EZAudioPlot
@synthesize backgroundColor = _backgroundColor;
@synthesize color = _color;
@synthesize gain = _gain;
@synthesize plotType = _plotType;
@synthesize shouldFill = _shouldFill;
@synthesize shouldMirror = _shouldMirror;
#pragma mark - Initialization
-(id)init {
self = [super init];
if(self){
[self initPlot];
}
return self;
}
-(id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if(self){
[self initPlot];
}
return self;
}
#if TARGET_OS_IPHONE
-(id)initWithFrame:(CGRect)frameRect {
#elif TARGET_OS_MAC
-(id)initWithFrame:(NSRect)frameRect {
#endif
self = [super initWithFrame:frameRect];
if(self){
[self initPlot];
}
return self;
}
-(void)initPlot {
#if TARGET_OS_IPHONE
self.backgroundColor = [UIColor blackColor];
self.color = [UIColor colorWithHue:0 saturation:1.0 brightness:1.0 alpha:1.0];
#elif TARGET_OS_MAC
self.backgroundColor = [NSColor blackColor];
self.color = [NSColor colorWithCalibratedHue:0 saturation:1.0 brightness:1.0 alpha:1.0];
#endif
self.gain = 1.0;
self.plotType = EZPlotTypeRolling;
self.shouldMirror = NO;
self.shouldFill = NO;
plotData = NULL;
_scrollHistory = NULL;
_scrollHistoryLength = kEZAudioPlotDefaultHistoryBufferLength;
}
#pragma mark - Setters
-(void)setBackgroundColor:(id)backgroundColor {
_backgroundColor = backgroundColor;
[self _refreshDisplay];
}
-(void)setColor:(id)color {
_color = color;
[self _refreshDisplay];
}
-(void)setGain:(float)gain {
_gain = gain;
[self _refreshDisplay];
}
-(void)setPlotType:(EZPlotType)plotType {
_plotType = plotType;
[self _refreshDisplay];
}
-(void)setShouldFill:(BOOL)shouldFill {
_shouldFill = shouldFill;
[self _refreshDisplay];
}
-(void)setShouldMirror:(BOOL)shouldMirror {
_shouldMirror = shouldMirror;
[self _refreshDisplay];
}
-(void)_refreshDisplay {
#if TARGET_OS_IPHONE
[self setNeedsDisplay];
#elif TARGET_OS_MAC
[self setNeedsDisplay:YES];
#endif
}
#pragma mark - Get Data
-(void)setSampleData:(float *)data
length:(int)length {
if (plotData != nil){
free(plotData);
}
plotData = (CGPoint *)calloc(sizeof(CGPoint),length);
plotLength = length;
for(int i = 0; i < length; i++) {
data[i] = i == 0 ? 0 : data[i];
plotData[i] = CGPointMake(i,data[i] * _gain);
}
[self _refreshDisplay];
}
#pragma mark - Update
-(void)updateBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize {
if (_plotType == EZPlotTypeRolling){
// Update the scroll history datasource
[EZAudioUtilities updateScrollHistory:&_scrollHistory
withLength:_scrollHistoryLength
atIndex:&_scrollHistoryIndex
withBuffer:buffer
withBufferSize:bufferSize
isResolutionChanging:&_changingHistorySize];
//
[self setSampleData:_scrollHistory
length:(!_setMaxLength?kEZAudioPlotMaxHistoryBufferLength:_scrollHistoryLength)];
_setMaxLength = YES;
}
else if (_plotType == EZPlotTypeBuffer){
[self setSampleData:buffer
length:bufferSize];
}
else {
// Unknown plot type
}
}
#if TARGET_OS_IPHONE
- (void)drawRect:(CGRect)rect
{
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextSaveGState(ctx);
CGRect frame = self.bounds;
#elif TARGET_OS_MAC
- (void)drawRect:(NSRect)dirtyRect
{
[[NSGraphicsContext currentContext] saveGraphicsState];
NSGraphicsContext * nsGraphicsContext = [NSGraphicsContext currentContext];
CGContextRef ctx = (CGContextRef) [nsGraphicsContext graphicsPort];
NSRect frame = self.bounds;
#endif
#if TARGET_OS_IPHONE
// Set the background color
[(UIColor*)self.backgroundColor set];
UIRectFill(frame);
// Set the waveform line color
[(UIColor*)self.color set];
#elif TARGET_OS_MAC
[(NSColor*)self.backgroundColor set];
NSRectFill(frame);
[(NSColor*)self.color set];
#endif
if(plotLength > 0) {
plotData[plotLength-1] = CGPointMake(plotLength-1,0.0f);
CGMutablePathRef halfPath = CGPathCreateMutable();
CGPathAddLines(halfPath,
NULL,
plotData,
plotLength);
CGMutablePathRef path = CGPathCreateMutable();
double xscale = (frame.size.width) / (float)plotLength;
double halfHeight = floor( frame.size.height / 2.0);
// iOS drawing origin is flipped by default so make sure we account for that
int deviceOriginFlipped = 1;
#if TARGET_OS_IPHONE
deviceOriginFlipped = -1;
#elif TARGET_OS_MAC
deviceOriginFlipped = 1;
#endif
CGAffineTransform xf = CGAffineTransformIdentity;
xf = CGAffineTransformTranslate( xf, frame.origin.x , halfHeight + frame.origin.y);
xf = CGAffineTransformScale( xf, xscale, deviceOriginFlipped*halfHeight);
CGPathAddPath( path, &xf, halfPath);
if (self.shouldMirror){
xf = CGAffineTransformIdentity;
xf = CGAffineTransformTranslate( xf, frame.origin.x , halfHeight + frame.origin.y);
xf = CGAffineTransformScale( xf, xscale, -deviceOriginFlipped*(halfHeight));
CGPathAddPath( path, &xf, halfPath);
}
CGPathRelease( halfPath);
// Now, path contains the full waveform path.
CGContextAddPath(ctx, path);
// Make this color customizable
if (self.shouldFill){
CGContextFillPath(ctx);
}
else {
CGContextStrokePath(ctx);
}
CGPathRelease(path);
}
#if TARGET_OS_IPHONE
CGContextRestoreGState(ctx);
#elif TARGET_OS_MAC
[[NSGraphicsContext currentContext] restoreGraphicsState];
#endif
}
#pragma mark - Adjust Resolution
-(int)setRollingHistoryLength:(int)historyLength {
historyLength = MIN(historyLength,kEZAudioPlotMaxHistoryBufferLength);
size_t floatByteSize = sizeof(float);
_changingHistorySize = YES;
if (_scrollHistoryLength != historyLength){
_scrollHistoryLength = historyLength;
}
_scrollHistory = realloc(_scrollHistory,_scrollHistoryLength*floatByteSize);
if (_scrollHistoryIndex < _scrollHistoryLength){
memset(&_scrollHistory[_scrollHistoryIndex],
0,
(_scrollHistoryLength-_scrollHistoryIndex)*floatByteSize);
}
else {
_scrollHistoryIndex = _scrollHistoryLength;
}
_changingHistorySize = NO;
return historyLength;
}
-(int)rollingHistoryLength {
return _scrollHistoryLength;
}
-(void)dealloc {
if (plotData){
free(plotData);
}
}
@end
-183
View File
@@ -1,183 +0,0 @@
//
// EZAudioPlotGL.h
// EZAudio
//
// Created by Syed Haris Ali on 11/22/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "TargetConditionals.h"
#import "EZPlot.h"
#if TARGET_OS_IPHONE
#import <GLKit/GLKit.h>
@class EZAudioPlotGLKViewController;
#elif TARGET_OS_MAC
#import <Cocoa/Cocoa.h>
#import <GLKit/GLKit.h>
#import <OpenGL/gl3.h>
#import <QuartzCore/CVDisplayLink.h>
#endif
#pragma mark - Enumerations
/**
Constant drawing types wrapping around the OpenGL equivalents. In the audio drawings the line strip will be the stroked graph while the triangle will provide the filled equivalent.
*/
typedef NS_ENUM(NSUInteger,EZAudioPlotGLDrawType){
/**
* Maps to the OpenGL constant for a line strip, which for the audio graph will correspond to a stroked drawing (no fill).
*/
EZAudioPlotGLDrawTypeLineStrip = GL_LINE_STRIP,
/**
* Maps to the OpenGL constant for a triangle strip, which for the audio graph will correspond to a filled drawing.
*/
EZAudioPlotGLDrawTypeTriangleStrip = GL_TRIANGLE_STRIP
};
#pragma mark - Structures
/**
A structure describing a 2D point (x,y) in space for an audio plot.
*/
typedef struct {
GLfloat x;
GLfloat y;
} EZAudioPlotGLPoint;
/**
EZAudioPlotGL is a subclass of either the EZPlot on iOS or an NSOpenGLView on OSX. I apologize ahead of time for the weirdness in the docs for this class, but I had to do a bit of hackery to get a universal namespace for something works on both iOS and OSX without any additional components. The EZAudioPlotGL provides an the same utilities and interface as the EZAudioPlot with the added benefit of being GPU-accelerated. This is the recommended plot to use on iOS devices to get super fast real-time drawings of audio streams. For the methods and properties below I've included notes on the bottom just indicating which OS they correspond to. In most (if not all) use cases you can just refer to the EZPlot documentation to see which custom properties can be setup. There update function is the same as the EZPlot as well: `updateBuffer:withBufferSize:`
*/
#if TARGET_OS_IPHONE
@interface EZAudioPlotGL : EZPlot
#elif TARGET_OS_MAC
@interface EZAudioPlotGL : NSOpenGLView
#endif
#if TARGET_OS_IPHONE
// Inherited from EZPlot
#elif TARGET_OS_MAC
#pragma mark - Properties
///-----------------------------------------------------------
/// @name Customizing The Plot's Appearance
///-----------------------------------------------------------
/**
The default background color of the plot. For iOS the color is specified as a UIColor while for OSX the color is an NSColor. The default value on both platforms is black.
*/
@property (nonatomic,strong) id backgroundColor;
/**
The default color of the plot's data (i.e. waveform, y-axis values). For iOS the color is specified as a UIColor while for OSX the color is an NSColor. The default value on both platforms is red.
*/
@property (nonatomic,strong) id color;
/**
The plot's gain value, which controls the scale of the y-axis values. The default value of the gain is 1.0f and should always be greater than 0.0f.
*/
@property (nonatomic,assign,setter=setGain:) float gain;
/**
The type of plot as specified by the `EZPlotType` enumeration (i.e. a buffer or rolling plot type).
*/
@property (nonatomic,assign,setter=setPlotType:) EZPlotType plotType;
/**
A BOOL indicating whether or not to fill in the graph. A value of YES will make a filled graph (filling in the space between the x-axis and the y-value), while a value of NO will create a stroked graph (connecting the points along the y-axis).
*/
@property (nonatomic,assign,setter=setShouldFill:) BOOL shouldFill;
/**
A boolean indicating whether the graph should be rotated along the x-axis to give a mirrored reflection. This is typical for audio plots to produce the classic waveform look. A value of YES will produce a mirrored reflection of the y-values about the x-axis, while a value of NO will only plot the y-values.
*/
@property (nonatomic,assign,setter=setShouldMirror:) BOOL shouldMirror;
#pragma mark - Get Samples
///-----------------------------------------------------------
/// @name Updating The Plot
///-----------------------------------------------------------
/**
Updates the plot with the new buffer data and tells the view to redraw itself. Caller will provide a float array with the values they expect to see on the y-axis. The plot will internally handle mapping the x-axis and y-axis to the current view port, any interpolation for fills effects, and mirroring.
@param buffer A float array of values to map to the y-axis.
@param bufferSize The size of the float array that will be mapped to the y-axis.
@warning The bufferSize is expected to be the same, constant value once initial triggered. For plots using OpenGL a vertex buffer object will be allocated with a maximum buffersize of (2 * the initial given buffer size) to account for any interpolation necessary for filling in the graph. Updates use the glBufferSubData(...) function, which will crash if the buffersize exceeds the initial maximum allocated size.
*/
-(void)updateBuffer:(float *)buffer
withBufferSize:(UInt32)bufferSize;
#endif
#pragma mark - Adjust Resolution
///-----------------------------------------------------------
/// @name Adjusting The Resolution
///-----------------------------------------------------------
/**
Sets the length of the rolling history display. Can grow or shrink the display up to the maximum size specified by the kEZAudioPlotMaxHistoryBufferLength macro. Will return the actual set value, which will be either the given value if smaller than the kEZAudioPlotMaxHistoryBufferLength or kEZAudioPlotMaxHistoryBufferLength if a larger value is attempted to be set.
@param historyLength The new length of the rolling history buffer.
@return The new value equal to the historyLength or the kEZAudioPlotMaxHistoryBufferLength.
*/
-(int)setRollingHistoryLength:(int)historyLength;
/**
Provides the length of the rolling history buffer
* @return An int representing the length of the rolling history buffer
*/
-(int)rollingHistoryLength;
#pragma mark - Shared Methods
///-----------------------------------------------------------
/// @name Clearing The Plot
///-----------------------------------------------------------
/**
Clears all data from the audio plot (includes both EZPlotTypeBuffer and EZPlotTypeRolling)
*/
-(void)clear;
///-----------------------------------------------------------
/// @name Shared OpenGL Methods
///-----------------------------------------------------------
/**
Converts a float array to an array of EZAudioPlotGLPoint structures that hold the (x,y) values the OpenGL buffer needs to properly plot its points.
@param graph A pointer to the array that should hold the EZAudioPlotGLPoint structures.
@param graphSize The size (or length) of the array with the EZAudioPlotGLPoint structures.
@param drawingType The EZAudioPlotGLDrawType constant defining whether the plot should interpolate between points for a triangle strip (filled waveform) or not for a line strip (stroked waveform)
@param buffer The float array holding the audio data
@param bufferSize The size of the float array holding the audio data
@param gain The gain (always greater than 0.0) to apply to the amplitudes (y-values) of the graph. Y-values can only range from -1.0 to 1.0 so any value that's greater will be rounded to -1.0 or 1.0.
*/
+(void)fillGraph:(EZAudioPlotGLPoint*)graph
withGraphSize:(UInt32)graphSize
forDrawingType:(EZAudioPlotGLDrawType)drawingType
withBuffer:(float*)buffer
withBufferSize:(UInt32)bufferSize
withGain:(float)gain;
/**
Determines the proper size of a graph given a EZAudioPlotGLDrawType (line strip or triangle strip) and the size of the incoming buffer. Triangle strips require interpolating between points so the buffer becomes 2*bufferSize
@param drawingType The EZAudioPlotGLDraw type (line strip or triangle strip)
@param bufferSize The size of the float array holding the audio data coming in.
@return A Int32 representing the proper graph size that should be used to account for any necessary interpolating between points.
*/
+(UInt32)graphSizeForDrawingType:(EZAudioPlotGLDrawType)drawingType
withBufferSize:(UInt32)bufferSize;
@end
-771
View File
@@ -1,771 +0,0 @@
//
// EZAudioPlotGL.m
// EZAudio
//
// Created by Syed Haris Ali on 11/22/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "EZAudioPlotGL.h"
#import "EZAudioUtilities.h"
#import "EZAudioPlot.h"
#if TARGET_OS_IPHONE
#import "EZAudioPlotGLKViewController.h"
@interface EZAudioPlotGL ()
@property (nonatomic,strong,readonly) EZAudioPlotGLKViewController *glViewController;
@end
#elif TARGET_OS_MAC
@interface EZAudioPlotGL (){
// Flags indicating whether the plots have been instantiated
BOOL _hasBufferPlotData;
BOOL _hasRollingPlotData;
// Vertex Array Buffers
GLuint _bufferPlotVAB;
GLuint _rollingPlotVAB;
// Vertex Buffer Objects
GLuint _bufferPlotVBO;
GLuint _rollingPlotVBO;
// Display Link
CVDisplayLinkRef _displayLink;
// Buffers size
UInt32 _bufferPlotGraphSize;
UInt32 _rollingPlotGraphSize;
// Rolling History
BOOL _setMaxLength;
float *_scrollHistory;
int _scrollHistoryIndex;
UInt32 _scrollHistoryLength;
BOOL _changingHistorySize;
// Copied buffer data
float *_copiedBuffer;
UInt32 _copiedBufferSize;
}
@property (nonatomic,assign,readonly) EZAudioPlotGLDrawType drawingType;
@property (nonatomic,strong) GLKBaseEffect *baseEffect;
@end
#endif
@implementation EZAudioPlotGL
#if TARGET_OS_IPHONE
@synthesize glViewController = _glViewController;
#elif TARGET_OS_MAC
@synthesize baseEffect = _baseEffect;
#endif
@synthesize backgroundColor = _backgroundColor;
@synthesize color = _color;
@synthesize gain = _gain;
@synthesize plotType = _plotType;
@synthesize shouldFill = _shouldFill;
@synthesize shouldMirror = _shouldMirror;
#pragma mark - Initialization
-(id)init
{
self = [super init];
if (self) {
[self initializeView];
}
return self;
}
-(id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if(self){
[self initializeView];
}
return self;
}
-(id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initializeView];
}
return self;
}
#pragma mark - Initialize Properties Here
-(void)initializeView {
#if TARGET_OS_IPHONE
// Initialize the subview controller
_glViewController = [[EZAudioPlotGLKViewController alloc] init];
_glViewController.view.frame = self.bounds;
[self insertSubview:self.glViewController.view atIndex:0];
#elif TARGET_OS_MAC
_copiedBuffer = NULL;
#endif
// Set the default properties
self.gain = 1.0;
self.plotType = EZPlotTypeBuffer;
#if TARGET_OS_IPHONE
self.backgroundColor = [UIColor colorWithRed:0.796 green:0.749 blue:0.663 alpha:1];
self.color = [UIColor colorWithRed:0.481 green:0.548 blue:0.637 alpha:1];
#elif TARGET_OS_MAC
_scrollHistory = NULL;
_scrollHistoryLength = kEZAudioPlotDefaultHistoryBufferLength;
#endif
self.shouldFill = NO;
self.shouldMirror = NO;
}
#pragma mark - Setters
-(void)setBackgroundColor:(id)backgroundColor {
_backgroundColor = backgroundColor;
#if TARGET_OS_IPHONE
self.glViewController.backgroundColor = backgroundColor;
#elif TARGET_OS_MAC
[self _refreshWithBackgroundColor:backgroundColor];
#endif
}
-(void)setColor:(id)color {
_color = color;
#if TARGET_OS_IPHONE
self.glViewController.color = color;
#elif TARGET_OS_MAC
[self _refreshWithColor:color];
#endif
}
#if TARGET_OS_IPHONE
#elif TARGET_OS_MAC
-(void)setDrawingType:(EZAudioPlotGLDrawType)drawingType {
CGLLockContext([[self openGLContext] CGLContextObj]);
_drawingType = drawingType;
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
#endif
#if TARGET_OS_IPHONE
-(void)setGain:(float)gain {
_gain = gain;
self.glViewController.gain = gain;
}
#elif TARGET_OS_MAC
// Gain changed mac
#endif
#if TARGET_OS_IPHONE
-(void)setPlotType:(EZPlotType)plotType {
_plotType = plotType;
self.glViewController.plotType = plotType;
}
#elif TARGET_OS_MAC
// Plot type changed mac
#endif
-(void)setShouldFill:(BOOL)shouldFill {
_shouldFill = shouldFill;
#if TARGET_OS_IPHONE
self.glViewController.drawingType = shouldFill ? EZAudioPlotGLDrawTypeTriangleStrip : EZAudioPlotGLDrawTypeLineStrip;
#elif TARGET_OS_MAC
// Fill flag changed mac
self.drawingType = shouldFill ? EZAudioPlotGLDrawTypeTriangleStrip : EZAudioPlotGLDrawTypeLineStrip;
#endif
}
#if TARGET_OS_IPHONE
-(void)setShouldMirror:(BOOL)shouldMirror {
_shouldMirror = shouldMirror;
self.glViewController.shouldMirror = shouldMirror;
}
#elif TARGET_OS_MAC
// Mirror flag changed mac
#endif
#pragma mark - Get Samples
-(void)updateBuffer:(float *)buffer
withBufferSize:(UInt32)bufferSize {
#if TARGET_OS_IPHONE
[self.glViewController updateBuffer:buffer
withBufferSize:bufferSize];
#elif TARGET_OS_MAC
if (_copiedBuffer == NULL){
_copiedBuffer = (float*)malloc(bufferSize*sizeof(float));
}
_copiedBufferSize = bufferSize;
// Copy the buffer
memcpy(_copiedBuffer,
buffer,
bufferSize*sizeof(float));
// Draw based on plot type
switch(_plotType) {
case EZPlotTypeBuffer:
[self _updateBufferPlotBufferWithAudioReceived:_copiedBuffer
withBufferSize:_copiedBufferSize];
break;
case EZPlotTypeRolling:
[self _updateRollingPlotBufferWithAudioReceived:_copiedBuffer
withBufferSize:_copiedBufferSize];
break;
default:
break;
}
#endif
}
#pragma mark - OSX Specific GL Implementation
#if TARGET_OS_IPHONE
// Handled by the embedded GLKViewController
#elif TARGET_OS_MAC
#pragma mark - Awake
-(void)awakeFromNib {
// Setup the base effect
[self _setupBaseEffect];
// Setup the OpenGL Pixel Format and Context
[self _setupProfile];
// Setup view
[self _setupView];
}
-(void)_setupBaseEffect {
self.baseEffect = [[GLKBaseEffect alloc] init];
self.baseEffect.useConstantColor = GL_TRUE;
self.baseEffect.constantColor = GLKVector4Make(0.489, 0.34, 0.185, 1.0);
}
-(void)_setupProfile {
NSOpenGLPixelFormatAttribute attrs[] =
{
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAMultisample,
NSOpenGLPFASampleBuffers, 1,
NSOpenGLPFASamples, 4,
NSOpenGLPFADepthSize, 24,
NSOpenGLPFAOpenGLProfile,
NSOpenGLProfileVersion3_2Core, 0
};
NSOpenGLPixelFormat *pf = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
NSOpenGLContext *context = [[NSOpenGLContext alloc] initWithFormat:pf
shareContext:nil];
if (!pf)
{
NSLog(@"No OpenGL pixel format");
}
// Debug only
CGLEnable([context CGLContextObj], kCGLCECrashOnRemovedFunctions);
self.pixelFormat = pf;
self.openGLContext = context;
}
-(void)_setupView {
self.backgroundColor = [NSColor colorWithCalibratedRed: 0.796 green: 0.749 blue: 0.663 alpha: 1];
self.color = [NSColor colorWithCalibratedRed: 0.481 green: 0.548 blue: 0.637 alpha: 1];
}
#pragma mark - Prepare
-(void)prepareOpenGL {
[super prepareOpenGL];
GLint swapInt = 1;
[self.openGLContext setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
////////////////////////////////////////////////////////////////////////////
// Setup VABs and VBOs //
////////////////////////////////////////////////////////////////////////////
// Buffer
glGenVertexArrays(1,&_bufferPlotVAB);
glBindVertexArray(_bufferPlotVAB);
glGenBuffers(1,&_bufferPlotVBO);
glBindBuffer(GL_ARRAY_BUFFER,_bufferPlotVBO);
// Rolling
glGenVertexArrays(1,&_rollingPlotVAB);
glBindVertexArray(_rollingPlotVAB);
glGenBuffers(1,&_rollingPlotVBO);
glBindBuffer(GL_ARRAY_BUFFER,_rollingPlotVBO);
if (self.shouldFill){
glBindVertexArray(_rollingPlotVAB);
glBindBuffer(GL_ARRAY_BUFFER,_rollingPlotVBO);
}
// Enable anti-aliasing
glEnable(GL_MULTISAMPLE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glClearColor(0, 0, 0, 0);
self.layer = nil;
self.wantsBestResolutionOpenGLSurface = YES;
// Set the background color
[self _refreshWithBackgroundColor:self.backgroundColor];
[self _refreshWithColor:self.color];
// Setup the display link (rendering loop)
[self _setupDisplayLink];
}
-(void)_setupDisplayLink {
// Create a display link capable of being used with all active displays
CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink);
// Set the renderer output callback function
CVDisplayLinkSetOutputCallback(_displayLink, &DisplayLinkCallback, (__bridge void *)(self));
// Set the display link for the current renderer
CGLContextObj cglContext = self.openGLContext.CGLContextObj;
CGLPixelFormatObj cglPixelFormat = self.pixelFormat.CGLPixelFormatObj;
CVDisplayLinkSetCurrentCGDisplayFromOpenGLContext(_displayLink, cglContext, cglPixelFormat);
// Activate the display link
CVDisplayLinkStart(_displayLink);
// Register to be notified when the window closes so we can stop the displaylink
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(windowWillClose:)
name:NSWindowWillCloseNotification
object:[self window]];
}
- (void) windowWillClose:(NSNotification*)notification
{
// Stop the display link when the window is closing because default
// OpenGL render buffers will be destroyed. If display link continues to
// fire without renderbuffers, OpenGL draw calls will set errors.
CVDisplayLinkStop(_displayLink);
}
#pragma mark - Display Link Callback
// This is the renderer output callback function
static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink,
const CVTimeStamp* now,
const CVTimeStamp* outputTime,
CVOptionFlags flagsIn,
CVOptionFlags* flagsOut,
void* displayLinkContext)
{
CVReturn result = [(__bridge EZAudioPlotGL*)displayLinkContext getFrameForTime:outputTime];
return result;
}
- (CVReturn)getFrameForTime:(const CVTimeStamp*)outputTime
{
@autoreleasepool {
[self drawFrame];
}
return kCVReturnSuccess;
}
#pragma mark - Buffer Updating By Type
-(void)_updateBufferPlotBufferWithAudioReceived:(float*)buffer
withBufferSize:(UInt32)bufferSize {
// Lock
CGLLockContext([[self openGLContext] CGLContextObj]);
// Bind to buffer VBO
glBindVertexArray(_bufferPlotVAB);
glBindBuffer(GL_ARRAY_BUFFER,_bufferPlotVBO);
// If starting with a VBO of half of our max size make sure we initialize it to anticipate
// a filled graph (which needs 2 * bufferSize) to allocate its resources properly
if (!_hasBufferPlotData && _drawingType == EZAudioPlotGLDrawTypeLineStrip){
EZAudioPlotGLPoint maxGraph[2*bufferSize];
glBufferData(GL_ARRAY_BUFFER, sizeof(maxGraph), maxGraph, GL_STREAM_DRAW);
_hasBufferPlotData = YES;
}
// Setup the buffer plot's graph size
_bufferPlotGraphSize = [EZAudioPlotGL graphSizeForDrawingType:_drawingType
withBufferSize:bufferSize];
// Setup the graph
EZAudioPlotGLPoint graph[_bufferPlotGraphSize];
// Fill in graph data
[EZAudioPlotGL fillGraph:graph
withGraphSize:_bufferPlotGraphSize
forDrawingType:_drawingType
withBuffer:buffer
withBufferSize:bufferSize
withGain:self.gain];
// Update the drawing
if (!_hasBufferPlotData){
glBufferData(GL_ARRAY_BUFFER, sizeof(graph) , graph, GL_STREAM_DRAW);
_hasBufferPlotData = YES;
}
else {
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(graph), graph);
}
// Unlock
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
-(void)_updateRollingPlotBufferWithAudioReceived:(float*)buffer
withBufferSize:(UInt32)bufferSize {
// Lock
CGLLockContext([[self openGLContext] CGLContextObj]);
// Bind to rolling VBO
glBindVertexArray(_rollingPlotVAB);
glBindBuffer(GL_ARRAY_BUFFER,_rollingPlotVBO);
// If starting with a VBO of half of our max size make sure we initialize it to anticipate
// a filled graph (which needs 2 * bufferSize) to allocate its resources properly
if (!_hasRollingPlotData){
EZAudioPlotGLPoint maxGraph[2*kEZAudioPlotMaxHistoryBufferLength];
glBufferData(GL_ARRAY_BUFFER, sizeof(maxGraph), maxGraph, GL_STREAM_DRAW);
_hasRollingPlotData = YES;
}
// Setup the plot
_rollingPlotGraphSize = [EZAudioPlotGL graphSizeForDrawingType:_drawingType
withBufferSize:_scrollHistoryLength];
// Fill the graph with data
EZAudioPlotGLPoint graph[_rollingPlotGraphSize];
// Update the scroll history datasource
[EZAudioUtilities updateScrollHistory:&_scrollHistory
withLength:_scrollHistoryLength
atIndex:&_scrollHistoryIndex
withBuffer:buffer
withBufferSize:bufferSize
isResolutionChanging:&_changingHistorySize];
// Fill in graph data
[EZAudioPlotGL fillGraph:graph
withGraphSize:_rollingPlotGraphSize
forDrawingType:_drawingType
withBuffer:_scrollHistory
withBufferSize:_scrollHistoryLength
withGain:self.gain];
// Update the drawing
if (!_hasRollingPlotData){
glBufferData(GL_ARRAY_BUFFER, sizeof(graph), graph, GL_STREAM_DRAW);
_hasRollingPlotData = YES;
}
else {
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(graph), graph);
}
// Unlock
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
//#pragma mark - Render
-(void)drawFrame {
// Avoid flickering during resize by drawing
[[self openGLContext] makeCurrentContext];
// Lock
CGLLockContext([[self openGLContext] CGLContextObj]);
// Draw frame
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (_hasBufferPlotData || _hasRollingPlotData){
// Plot either a buffer plot or a rolling plot
switch(_plotType) {
case EZPlotTypeBuffer:
[self _drawBufferPlot];
break;
case EZPlotTypeRolling:
[self _drawRollingPlot];
break;
default:
break;
}
}
// Flush and unlock
CGLFlushDrawable([[self openGLContext] CGLContextObj]);
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
-(void)_drawBufferPlot {
glBindVertexArray(_bufferPlotVAB);
glBindBuffer(GL_ARRAY_BUFFER,_bufferPlotVBO);
[self.baseEffect prepareToDraw];
self.baseEffect.transform.modelviewMatrix = GLKMatrix4MakeXRotation(0);
// Enable the vertex data
glEnableVertexAttribArray(GLKVertexAttribPosition);
// Define the vertex data size & layout
glVertexAttribPointer(GLKVertexAttribPosition, 2, GL_FLOAT, GL_FALSE, sizeof(EZAudioPlotGLPoint), NULL);
// Draw the triangle
glDrawArrays(_drawingType,0,_bufferPlotGraphSize);
// Mirrored
if (self.shouldMirror){
[self.baseEffect prepareToDraw];
self.baseEffect.transform.modelviewMatrix = GLKMatrix4MakeXRotation(M_PI);
// Enable the vertex data
glEnableVertexAttribArray(GLKVertexAttribPosition);
// Define the vertex data size & layout
glVertexAttribPointer(GLKVertexAttribPosition, 2, GL_FLOAT, GL_FALSE, sizeof(EZAudioPlotGLPoint), NULL);
// Draw the triangle
glDrawArrays(_drawingType, 0, _bufferPlotGraphSize);
}
}
-(void)_drawRollingPlot {
glBindVertexArray(_rollingPlotVAB);
glBindBuffer(GL_ARRAY_BUFFER,_rollingPlotVBO);
[self.baseEffect prepareToDraw];
self.baseEffect.transform.modelviewMatrix = GLKMatrix4MakeXRotation(0);
// Enable the vertex data
glEnableVertexAttribArray(GLKVertexAttribPosition);
// Define the vertex data size & layout
glVertexAttribPointer(GLKVertexAttribPosition, 2, GL_FLOAT, GL_FALSE, sizeof(EZAudioPlotGLPoint), NULL);
// Draw the triangle
glDrawArrays(_drawingType, 0,_rollingPlotGraphSize);
// Mirrored
if (self.shouldMirror){
[self.baseEffect prepareToDraw];
self.baseEffect.transform.modelviewMatrix = GLKMatrix4MakeXRotation(M_PI);
// Enable the vertex data
glEnableVertexAttribArray(GLKVertexAttribPosition);
// Define the vertex data size & layout
glVertexAttribPointer(GLKVertexAttribPosition, 2, GL_FLOAT, GL_FALSE, sizeof(EZAudioPlotGLPoint), NULL);
// Draw the triangle
glDrawArrays(_drawingType, 0,_rollingPlotGraphSize);
}
}
-(void)drawRect:(NSRect)dirtyRect {
[self drawFrame];
}
#pragma mark - Reshape
-(void)reshape {
[super reshape];
// We draw on a secondary thread through the display link. However, when
// resizing the view, -drawRect is called on the main thread.
// Add a mutex around to avoid the threads accessing the context
// simultaneously when resizing.
CGLLockContext([[self openGLContext] CGLContextObj]);
// Get the view size in Points
NSRect viewRectPoints = [self bounds];
NSRect viewRectPixels = [self convertRectToBacking:viewRectPoints];
// Set the new dimensions in our renderer
glViewport(0, 0, viewRectPixels.size.width, viewRectPixels.size.height);
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
#pragma mark - Private Setters
-(void)_refreshWithBackgroundColor:(NSColor*)backgroundColor {
CGLLockContext([[self openGLContext] CGLContextObj]);
// Extract colors
CGFloat red; CGFloat green; CGFloat blue; CGFloat alpha;
[backgroundColor getRed:&red
green:&green
blue:&blue
alpha:&alpha];
// Set them on the context
glClearColor((GLclampf)red,(GLclampf)green,(GLclampf)blue,(GLclampf)alpha);
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
-(void)_refreshWithColor:(NSColor*)color {
CGLLockContext([[self openGLContext] CGLContextObj]);
// Extract colors
CGFloat red; CGFloat green; CGFloat blue; CGFloat alpha;
[color getRed:&red
green:&green
blue:&blue
alpha:&alpha];
// Set them on the base shader
self.baseEffect.constantColor = GLKVector4Make((GLclampf)red,(GLclampf)green,(GLclampf)blue,(GLclampf)alpha);
CGLUnlockContext([[self openGLContext] CGLContextObj]);
}
#pragma mark - Cleanup
- (void) dealloc
{
// Stop the display link BEFORE releasing anything in the view
// otherwise the display link thread may call into the view and crash
// when it encounters something that has been release
CVDisplayLinkStop(_displayLink);
CVDisplayLinkRelease(_displayLink);
if (_copiedBuffer != NULL){
free( _copiedBuffer);
}
}
#endif
#pragma mark - Adjust Resolution
-(int)setRollingHistoryLength:(int)historyLength {
#if TARGET_OS_IPHONE
int result = [self.glViewController setRollingHistoryLength:historyLength];
return result;
#elif TARGET_OS_MAC
historyLength = MIN(historyLength,kEZAudioPlotMaxHistoryBufferLength);
size_t floatByteSize = sizeof(float);
_changingHistorySize = YES;
if (_scrollHistoryLength != historyLength){
_scrollHistoryLength = historyLength;
}
_scrollHistory = realloc(_scrollHistory,_scrollHistoryLength*floatByteSize);
if (_scrollHistoryIndex < _scrollHistoryLength){
memset(&_scrollHistory[_scrollHistoryIndex],
0,
(_scrollHistoryLength-_scrollHistoryIndex)*floatByteSize);
}
else {
_scrollHistoryIndex = _scrollHistoryLength;
}
_changingHistorySize = NO;
return historyLength;
#endif
return kEZAudioPlotDefaultHistoryBufferLength;
}
-(int)rollingHistoryLength {
#if TARGET_OS_IPHONE
return self.glViewController.rollingHistoryLength;
#elif TARGET_OS_MAC
return _scrollHistoryLength;
#endif
}
#pragma mark - Clearing
-(void)clear {
#if TARGET_OS_IPHONE
[self.glViewController clear];
#elif TARGET_OS_MAC
#endif
}
#pragma mark - Graph Methods
+(void)fillGraph:(EZAudioPlotGLPoint*)graph
withGraphSize:(UInt32)graphSize
forDrawingType:(EZAudioPlotGLDrawType)drawingType
withBuffer:(float*)buffer
withBufferSize:(UInt32)bufferSize
withGain:(float)gain {
if (drawingType == EZAudioPlotGLDrawTypeLineStrip){
// graph size = buffer size to stroke waveform
for(int i = 0; i < graphSize; i++){
float x = [EZAudioUtilities MAP:i
leftMin:0
leftMax:bufferSize
rightMin:-1.0
rightMax:1.0];
graph[i].x = x;
graph[i].y = gain*buffer[i];
}
}
else if (drawingType == EZAudioPlotGLDrawTypeTriangleStrip) {
// graph size = 2 * buffer size to draw triangles and fill regions properly
for(int i = 0; i < graphSize; i+=2){
int bufferIndex = (int)[EZAudioUtilities MAP:i
leftMin:0
leftMax:graphSize
rightMin:0
rightMax:bufferSize];
float x = [EZAudioUtilities MAP:bufferIndex
leftMin:0
leftMax:bufferSize
rightMin:-1.0
rightMax:1.0];
graph[i].x = x;
graph[i].y = 0.0f;
}
for(int i = 0; i < graphSize; i+=2){
int bufferIndex = (int)[EZAudioUtilities
MAP:i
leftMin:0
leftMax:graphSize
rightMin:0
rightMax:bufferSize];
float x = [EZAudioUtilities MAP:bufferIndex
leftMin:0
leftMax:bufferSize
rightMin:-1.0
rightMax:1.0];
graph[i+1].x = x;
graph[i+1].y = gain*buffer[bufferIndex];
}
}
}
+(UInt32)graphSizeForDrawingType:(EZAudioPlotGLDrawType)drawingType
withBufferSize:(UInt32)bufferSize {
UInt32 graphSize = bufferSize;
switch(drawingType) {
case EZAudioPlotGLDrawTypeLineStrip:
graphSize = bufferSize;
break;
case EZAudioPlotGLDrawTypeTriangleStrip:
graphSize = 2*bufferSize;
break;
default:
break;
}
return graphSize;
}
@end
-486
View File
@@ -1,486 +0,0 @@
//
// EZAudioPlotGLKViewController.m
// EZAudio
//
// Created by Syed Haris Ali on 11/22/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#if TARGET_OS_IPHONE
#import "EZAudioPlotGLKViewController.h"
#import "EZAudioUtilities.h"
#import "EZAudioPlot.h"
@interface EZAudioPlotGLKViewController () {
// Flags indicating whether the plots have been instantiated
BOOL _hasBufferPlotData;
BOOL _hasRollingPlotData;
// The buffers
GLuint _bufferPlotVBO;
GLuint _rollingPlotVBO;
// Buffers size
UInt32 _bufferPlotGraphSize;
UInt32 _rollingPlotGraphSize;
// Rolling History
BOOL _setMaxLength;
float *_scrollHistory;
int _scrollHistoryIndex;
UInt32 _scrollHistoryLength;
BOOL _changingHistorySize;
}
@end
@implementation EZAudioPlotGLKViewController
@synthesize baseEffect = _baseEffect;
@synthesize context = _context;
@synthesize drawingType = _drawingType;
@synthesize plotType = _plotType;
@synthesize shouldMirror = _shouldMirror;
#pragma mark - Initialization
-(id)init
{
self = [super init];
if (self) {
[self initializeView];
}
return self;
}
-(id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if(self){
[self initializeView];
}
return self;
}
-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if(self){
[self initializeView];
}
return self;
}
#pragma mark - Initialize Properties Here
-(void)initializeView {
// Setup the base effect
self.baseEffect = [[GLKBaseEffect alloc] init];
self.baseEffect.useConstantColor = GL_TRUE;
self.preferredFramesPerSecond = 60;
_scrollHistory = NULL;
_scrollHistoryLength = kEZAudioPlotDefaultHistoryBufferLength;
}
#pragma mark - View Did Load
-(void)viewDidLoad {
[super viewDidLoad];
// Setup the context
if (![EAGLContext currentContext])
{
self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
}
else
{
self.context = [EAGLContext currentContext];
}
if (!self.context) {
NSLog(@"Failed to create ES context");
}
else {
EAGLContext.currentContext = self.context;
}
// Set the view's context
GLKView *view = (GLKView *)self.view;
view.context = self.context;
view.drawableMultisample = GLKViewDrawableMultisample4X;
view.opaque = NO;
// Generate both the buffer id references
glGenBuffers(1, &_bufferPlotVBO);
glGenBuffers(1, &_rollingPlotVBO);
// Refresh color values
[self _refreshWithBackgroundColor: self.backgroundColor];
[self _refreshWithColor: self.color];
// Set the line width for the context
glLineWidth(2.0);
}
#pragma mark - Adjust Resolution
-(int)setRollingHistoryLength:(int)historyLength {
_changingHistorySize = YES;
historyLength = MIN(historyLength,kEZAudioPlotMaxHistoryBufferLength);
size_t floatByteSize = sizeof(float);
if (_scrollHistoryLength != historyLength){
_scrollHistoryLength = historyLength;
}
_scrollHistory = realloc(_scrollHistory,_scrollHistoryLength*floatByteSize);
if (_scrollHistoryIndex < _scrollHistoryLength){
memset(&_scrollHistory[_scrollHistoryIndex],
0,
(_scrollHistoryLength-_scrollHistoryIndex)*floatByteSize);
}
else {
_scrollHistoryIndex = _scrollHistoryLength;
}
[self _updateRollingPlotDisplay];
_changingHistorySize = NO;
return historyLength;
}
-(int)rollingHistoryLength {
return _scrollHistoryLength;
}
#pragma mark - Clearing
-(void)clear
{
_scrollHistoryIndex = 0;
[self _clearBufferPlot];
[self _clearRollingPlot];
}
-(void)_clearBufferPlot
{
if (_hasBufferPlotData)
{
float empty[_bufferPlotGraphSize];
memset( empty, 0.0f, sizeof(float));
[self _updateBufferPlotBufferWithAudioReceived:empty
withBufferSize:_bufferPlotGraphSize];
}
}
-(void)_clearRollingPlot
{
if (_hasRollingPlotData)
{
float empty[_rollingPlotGraphSize];
EZAudioPlotGLPoint graph[_rollingPlotGraphSize];
// Figure out better way to do this
for(int i = 0; i < _rollingPlotGraphSize; i++)
{
empty[i] = 0.0f;
}
for(int i = 0; i < _scrollHistoryLength; i++)
{
_scrollHistory[i] = 0.0f;
}
// Update the scroll history datasource
[EZAudioUtilities updateScrollHistory:&_scrollHistory
withLength:_scrollHistoryLength
atIndex:&_scrollHistoryIndex
withBuffer:empty
withBufferSize:_rollingPlotGraphSize
isResolutionChanging:&_changingHistorySize];
// Fill in graph data
[EZAudioPlotGL fillGraph:graph
withGraphSize:_rollingPlotGraphSize
forDrawingType:_drawingType
withBuffer:_scrollHistory
withBufferSize:_scrollHistoryLength
withGain:self.gain];
// Update the drawing
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(graph), graph);
}
}
#pragma mark - Get Samples
-(void)updateBuffer:(float *)buffer
withBufferSize:(UInt32)bufferSize {
// Make sure the update render loop is active
if (self.paused) self.paused = NO;
// Make sure we are updating the buffers on the correct gl context.
EAGLContext.currentContext = self.context;
// Draw based on plot type
switch(_plotType) {
case EZPlotTypeBuffer:
[self _updateBufferPlotBufferWithAudioReceived:buffer
withBufferSize:bufferSize];
break;
case EZPlotTypeRolling:
[self _updateRollingPlotBufferWithAudioReceived:buffer
withBufferSize:bufferSize];
break;
default:
break;
}
}
#pragma mark - Buffer Updating By Type
-(void)_updateBufferPlotBufferWithAudioReceived:(float*)buffer
withBufferSize:(UInt32)bufferSize {
glBindBuffer(GL_ARRAY_BUFFER, _bufferPlotVBO);
// If starting with a VBO of half of our max size make sure we initialize it to anticipate
// a filled graph (which needs 2 * bufferSize) to allocate its resources properly
if (!_hasBufferPlotData && _drawingType == EZAudioPlotGLDrawTypeLineStrip){
EZAudioPlotGLPoint maxGraph[2*bufferSize];
glBufferData(GL_ARRAY_BUFFER, sizeof(maxGraph), maxGraph, GL_STREAM_DRAW);
_hasBufferPlotData = YES;
}
// Setup the buffer plot's graph size
_bufferPlotGraphSize = [EZAudioPlotGL graphSizeForDrawingType:_drawingType
withBufferSize:bufferSize];
// Setup the graph
EZAudioPlotGLPoint graph[_bufferPlotGraphSize];
// Fill in graph data
[EZAudioPlotGL fillGraph:graph
withGraphSize:_bufferPlotGraphSize
forDrawingType:_drawingType
withBuffer:buffer
withBufferSize:bufferSize
withGain:self.gain];
if (!_hasBufferPlotData){
glBufferData( GL_ARRAY_BUFFER, sizeof(graph), graph, GL_STREAM_DRAW);
_hasBufferPlotData = YES;
}
else {
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(graph), graph);
}
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
-(void)_updateRollingPlotBufferWithAudioReceived:(float*)buffer
withBufferSize:(UInt32)bufferSize {
glBindBuffer(GL_ARRAY_BUFFER, _rollingPlotVBO);
// If starting with a VBO of half of our max size make sure we initialize it to anticipate
// a filled graph (which needs 2 * bufferSize) to allocate its resources properly
if (!_hasRollingPlotData){
EZAudioPlotGLPoint maxGraph[2*kEZAudioPlotMaxHistoryBufferLength];
glBufferData( GL_ARRAY_BUFFER, sizeof(maxGraph), maxGraph, GL_STREAM_DRAW);
_hasRollingPlotData = YES;
}
// Setup the plot
_rollingPlotGraphSize = [EZAudioPlotGL graphSizeForDrawingType:_drawingType
withBufferSize:_scrollHistoryLength];
// Fill the graph with data
EZAudioPlotGLPoint graph[_rollingPlotGraphSize];
// Update the scroll history datasource
[EZAudioUtilities updateScrollHistory:&_scrollHistory
withLength:_scrollHistoryLength
atIndex:&_scrollHistoryIndex
withBuffer:buffer
withBufferSize:bufferSize
isResolutionChanging:&_changingHistorySize];
// Fill in graph data
[EZAudioPlotGL fillGraph:graph
withGraphSize:_rollingPlotGraphSize
forDrawingType:_drawingType
withBuffer:_scrollHistory
withBufferSize:_scrollHistoryLength
withGain:self.gain];
// Update the drawing
if (!_hasRollingPlotData){
glBufferData( GL_ARRAY_BUFFER, sizeof(graph) , graph, GL_STREAM_DRAW);
_hasRollingPlotData = YES;
}
else {
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(graph), graph);
}
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
-(void)_updateRollingPlotDisplay {
// Setup the plot
_rollingPlotGraphSize = [EZAudioPlotGL graphSizeForDrawingType:_drawingType
withBufferSize:_scrollHistoryLength];
// Fill the graph with data
EZAudioPlotGLPoint graph[_rollingPlotGraphSize];
// Fill in graph data
[EZAudioPlotGL fillGraph:graph
withGraphSize:_rollingPlotGraphSize
forDrawingType:_drawingType
withBuffer:_scrollHistory
withBufferSize:_scrollHistoryLength
withGain:self.gain];
// Update the drawing
if (_hasRollingPlotData){
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(graph), graph);
}
}
#pragma mark - Drawing
-(void)glkView:(GLKView *)view drawInRect:(CGRect)rect {
EAGLContext.currentContext = self.context;
// Clear the context
glClear(GL_COLOR_BUFFER_BIT);
if (_hasBufferPlotData || _hasRollingPlotData){
// Prepare the effect for drawing
[self.baseEffect prepareToDraw];
// Plot either a buffer plot or a rolling plot
switch(_plotType) {
case EZPlotTypeBuffer:
[self _drawBufferPlotWithView:view
drawInRect:rect];
break;
case EZPlotTypeRolling:
[self _drawRollingPlotWithView:view
drawInRect:rect];
break;
default:
break;
}
}
}
#pragma mark - Private Drawing
-(void)_drawBufferPlotWithView:(GLKView*)view drawInRect:(CGRect)rect {
if (_hasBufferPlotData){
glBindBuffer(GL_ARRAY_BUFFER, _bufferPlotVBO);
glEnableVertexAttribArray(GLKVertexAttribPosition);
glVertexAttribPointer(GLKVertexAttribPosition, 2, GL_FLOAT, GL_FALSE, sizeof(EZAudioPlotGLPoint), NULL);
// Normal plot
self.baseEffect.transform.modelviewMatrix = GLKMatrix4MakeXRotation(0);
glDrawArrays(_drawingType, 0, _bufferPlotGraphSize);
if (self.shouldMirror){
// Mirrored plot
[self.baseEffect prepareToDraw];
self.baseEffect.transform.modelviewMatrix = GLKMatrix4MakeXRotation(M_PI);
glDrawArrays(_drawingType, 0, _bufferPlotGraphSize);
}
glBindBuffer(GL_ARRAY_BUFFER,0);
}
}
-(void)_drawRollingPlotWithView:(GLKView*)view drawInRect:(CGRect)rect {
if (_hasRollingPlotData){
// Normal plot
glBindBuffer(GL_ARRAY_BUFFER, _rollingPlotVBO);
glEnableVertexAttribArray(GLKVertexAttribPosition);
glVertexAttribPointer(GLKVertexAttribPosition, 2, GL_FLOAT, GL_FALSE, sizeof(EZAudioPlotGLPoint), NULL);
// Normal plot
self.baseEffect.transform.modelviewMatrix = GLKMatrix4MakeXRotation(0);
glDrawArrays(_drawingType, 0, _rollingPlotGraphSize);
if (self.shouldMirror){
// Mirrored plot
[self.baseEffect prepareToDraw];
self.baseEffect.transform.modelviewMatrix = GLKMatrix4MakeXRotation(3.14159265359);
glDrawArrays(_drawingType, 0, _rollingPlotGraphSize);
}
glBindBuffer(GL_ARRAY_BUFFER,0);
}
}
#pragma mark - Setters
-(void)setBackgroundColor:(UIColor *)backgroundColor {
// Set the background color
_backgroundColor = backgroundColor;
// Refresh background color (map to GL vector)
[self _refreshWithBackgroundColor:backgroundColor];
}
-(void)setColor:(UIColor *)color {
// Set the color
_color = color;
// Refresh the color (map to GL vector)
[self _refreshWithColor:color];
}
#pragma mark - Private Setters
-(void)_refreshWithBackgroundColor:(UIColor*)backgroundColor {
// Extract colors
CGFloat red; CGFloat green; CGFloat blue; CGFloat alpha;
[backgroundColor getRed:&red
green:&green
blue:&blue
alpha:&alpha];
// Set them on the context
glClearColor((GLclampf)red,(GLclampf)green,(GLclampf)blue,(GLclampf)alpha);
}
-(void)_refreshWithColor:(UIColor*)color {
// Extract colors
CGFloat red; CGFloat green; CGFloat blue; CGFloat alpha;
[color getRed:&red
green:&green
blue:&blue
alpha:&alpha];
// Set them on the base shader
self.baseEffect.constantColor = GLKVector4Make((GLclampf)red,(GLclampf)green,(GLclampf)blue,(GLclampf)alpha);
}
@end
#elif TARGET_OS_MAC
#endif
-201
View File
@@ -1,201 +0,0 @@
//
// EZOutput.h
// EZAudio
//
// Created by Syed Haris Ali on 12/2/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
#if TARGET_OS_IPHONE
#elif TARGET_OS_MAC
#import <AudioUnit/AudioUnit.h>
#endif
#import "TPCircularBuffer.h"
@class EZOutput;
/**
The EZOutputDataSource (required for the EZOutput) specifies a receiver to provide audio data when the EZOutput is started. Only ONE datasource method is expected to be implemented and priority is given as such:
1.) `output:callbackWithActionFlags:inTimeStamp:inBusNumber:inNumberFrames:ioData:`
2.) `outputShouldUseCircularBuffer:`
3.) `output:needsBufferListWithFrames:withBufferSize:`
*/
@protocol EZOutputDataSource <NSObject>
@optional
///-----------------------------------------------------------
/// @name Pulling The Audio Data
///-----------------------------------------------------------
/**
Provides complete override of the output callback function. The delegate is expected to
@param output The instance of the EZOutput that asked for the data
@param ioActionFlags AudioUnitRenderActionFlags provided by the output callback
@param inTimeStamp AudioTimeStamp reference provided by the output callback
@param inBusNumber UInt32 representing the bus number provided by the output callback
@param inNumberFrames UInt32 representing the number of frames provided by the output callback
@param ioData AudioBufferList pointer representing the audio data that will be used for output provided by the output callback (fill this!)
*/
-(void)output:(EZOutput*)output
callbackWithActionFlags:(AudioUnitRenderActionFlags*)ioActionFlags
inTimeStamp:(const AudioTimeStamp*)inTimeStamp
inBusNumber:(UInt32)inBusNumber
inNumberFrames:(UInt32)inNumberFrames
ioData:(AudioBufferList*)ioData;
/**
Provides output using a circular
@param output The instance of the EZOutput that asked for the data
@return The EZOutputDataSource's TPCircularBuffer structure holding the audio data in a circular buffer
*/
-(TPCircularBuffer*)outputShouldUseCircularBuffer:(EZOutput *)output;
/**
Provides a way to provide output with data anytime the EZOutput needs audio data to play. This function provides an already allocated AudioBufferList to use for providing audio data into the output buffer.
@param output The instance of the EZOutput that asked for the data.
@param audioBufferList The AudioBufferList structure pointer that needs to be filled with audio data
@param frames The amount of frames as a UInt32 that output will need to properly fill its output buffer.
@return A pointer to the AudioBufferList structure holding the audio data. If nil or NULL, will output silence.
*/
-(void) output:(EZOutput *)output
shouldFillAudioBufferList:(AudioBufferList*)audioBufferList
withNumberOfFrames:(UInt32)frames;
@end
/**
The EZOutput component provides a generic output to glue all the other EZAudio components together and push whatever sound you've created to the default output device (think opposite of the microphone). The EZOutputDataSource provides the required AudioBufferList needed to populate the output buffer.
*/
@interface EZOutput : NSObject
#pragma mark - Properties
/**
The EZOutputDataSource that provides the required AudioBufferList to the output callback function
*/
@property (nonatomic,assign) id<EZOutputDataSource>outputDataSource;
#pragma mark - Initializers
///-----------------------------------------------------------
/// @name Initializers
///-----------------------------------------------------------
/**
Creates a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
@param dataSource The EZOutputDataSource that will be used to pull the audio data for the output callback.
@return A newly created instance of the EZOutput class.
*/
-(id)initWithDataSource:(id<EZOutputDataSource>)dataSource;
/**
Creates a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
@param dataSource The EZOutputDataSource that will be used to pull the audio data for the output callback.
@param audioStreamBasicDescription The AudioStreamBasicDescription of the EZOutput.
@warning AudioStreamBasicDescriptions that are invalid will cause the EZOutput to fail to initialize
@return A newly created instance of the EZOutput class.
*/
-(id) initWithDataSource:(id<EZOutputDataSource>)dataSource
withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription;
#pragma mark - Class Initializers
///-----------------------------------------------------------
/// @name Class Initializers
///-----------------------------------------------------------
/**
Class method to create a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
@param dataSource The EZOutputDataSource that will be used to pull the audio data for the output callback.
@return A newly created instance of the EZOutput class.
*/
+(EZOutput*)outputWithDataSource:(id<EZOutputDataSource>)dataSource;
/**
Class method to create a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
@param dataSource The EZOutputDataSource that will be used to pull the audio data for the output callback.
@param audioStreamBasicDescription The AudioStreamBasicDescription of the EZOutput.
@warning AudioStreamBasicDescriptions that are invalid will cause the EZOutput to fail to initialize
@return A newly created instance of the EZOutput class.
*/
+(EZOutput*)outputWithDataSource:(id<EZOutputDataSource>)dataSource
withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription;
#pragma mark - Singleton
///-----------------------------------------------------------
/// @name Shared Instance
///-----------------------------------------------------------
/**
Creates a shared instance of the EZOutput (one app will usually only need one output and share the role of the EZOutputDataSource).
@return The shared instance of the EZOutput class.
*/
+(EZOutput*)sharedOutput;
#pragma mark - Events
///-----------------------------------------------------------
/// @name Starting/Stopping The Output
///-----------------------------------------------------------
/**
Starts pulling audio data from the EZOutputDataSource to the default device output.
*/
-(void)startPlayback;
/**
Stops pulling audio data from the EZOutputDataSource to the default device output.
*/
-(void)stopPlayback;
#pragma mark - Getters
///-----------------------------------------------------------
/// @name Getting The Output Audio Format
///-----------------------------------------------------------
/**
Provides the AudioStreamBasicDescription structure containing the format of the microphone's audio.
@return An AudioStreamBasicDescription structure describing the format of the microphone's audio.
*/
-(AudioStreamBasicDescription)audioStreamBasicDescription;
///-----------------------------------------------------------
/// @name Getting The State Of The Output
///-----------------------------------------------------------
/**
Provides a flag indicating whether the EZOutput is pulling audio data from the EZOutputDataSource for playback.
@return YES if the EZOutput is pulling audio data to the output device, NO if it is stopped
*/
-(BOOL)isPlaying;
#pragma mark - Setters
///-----------------------------------------------------------
/// @name Customizing The Output Format
///-----------------------------------------------------------
/**
Sets the AudioStreamBasicDescription on the output.
@warning Do not set this during playback.
@param asbd The new AudioStreamBasicDescription to use in place of the current audio format description.
*/
-(void)setAudioStreamBasicDescription:(AudioStreamBasicDescription)asbd;
@end
-373
View File
@@ -1,373 +0,0 @@
//
// EZOutput.m
// EZAudio
//
// Created by Syed Haris Ali on 12/2/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "EZOutput.h"
#import "EZAudioUtilities.h"
@interface EZOutput (){
BOOL _customASBD;
BOOL _isPlaying;
AudioStreamBasicDescription _outputASBD;
AudioUnit _outputUnit;
}
@end
@implementation EZOutput
@synthesize outputDataSource = _outputDataSource;
static OSStatus OutputRenderCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData){
// NSLog(@"output something");
EZOutput *output = (__bridge EZOutput*)inRefCon;
// Manual override
if ([output.outputDataSource respondsToSelector:@selector(output:callbackWithActionFlags:inTimeStamp:inBusNumber:inNumberFrames:ioData:)]){
[output.outputDataSource output:output
callbackWithActionFlags:ioActionFlags
inTimeStamp:inTimeStamp
inBusNumber:inBusNumber
inNumberFrames:inNumberFrames
ioData:ioData];
}
else if ([output.outputDataSource respondsToSelector:@selector(outputShouldUseCircularBuffer:)]){
TPCircularBuffer *circularBuffer = [output.outputDataSource outputShouldUseCircularBuffer:output];
if (!circularBuffer){
float *left = (float*)ioData->mBuffers[0].mData;
float *right = (float*)ioData->mBuffers[1].mData;
for(int i = 0; i < inNumberFrames; i++){
left[ i ] = 0.0f;
right[ i ] = 0.0f;
}
return noErr;
};
/**
Thank you Michael Tyson (A Tasty Pixel) for writing the TPCircularBuffer, you are amazing!
*/
// Get the desired amount of bytes to copy
int32_t bytesToCopy = ioData->mBuffers[0].mDataByteSize;
float *left = (float*)ioData->mBuffers[0].mData;
float *right = (float*)ioData->mBuffers[1].mData;
// Get the available bytes in the circular buffer
int32_t availableBytes;
float *buffer = TPCircularBufferTail(circularBuffer,&availableBytes);
// Ideally we'd have all the bytes to be copied, but compare it against the available bytes (get min)
int32_t amount = MIN(bytesToCopy,availableBytes);
memcpy( left, buffer, amount);
memcpy( right, buffer, amount);
// Consume those bytes ( this will internally push the head of the circular buffer)
TPCircularBufferConsume(circularBuffer,amount);
}
// Provided an AudioBufferList (defaults to silence)
else if ([output.outputDataSource respondsToSelector:@selector(output:shouldFillAudioBufferList:withNumberOfFrames:)]) {
[output.outputDataSource output:output
shouldFillAudioBufferList:ioData
withNumberOfFrames:inNumberFrames];
}
return noErr;
}
#pragma mark - Initialization
-(id)init {
self = [super init];
if(self){
[self _configureOutput];
}
return self;
}
-(id)initWithDataSource:(id<EZOutputDataSource>)dataSource {
self = [super init];
if(self){
self.outputDataSource = dataSource;
[self _configureOutput];
}
return self;
}
-(id) initWithDataSource:(id<EZOutputDataSource>)dataSource
withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription {
self = [super init];
if(self){
_customASBD = YES;
_outputASBD = audioStreamBasicDescription;
self.outputDataSource = dataSource;
[self _configureOutput];
}
return self;
}
#pragma mark - Class Initializers
+(EZOutput*)outputWithDataSource:(id<EZOutputDataSource>)dataSource {
return [[EZOutput alloc] initWithDataSource:dataSource];
}
+(EZOutput *)outputWithDataSource:(id<EZOutputDataSource>)dataSource
withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription {
return [[EZOutput alloc] initWithDataSource:dataSource withAudioStreamBasicDescription:audioStreamBasicDescription];
}
#pragma mark - Singleton
+(EZOutput*)sharedOutput {
static EZOutput *_sharedOutput = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedOutput = [[EZOutput alloc] init];
});
return _sharedOutput;
}
#pragma mark - Audio Component Initialization
-(AudioComponentDescription)_getOutputAudioComponentDescription {
// Create an output component description for default output device
AudioComponentDescription outputComponentDescription;
outputComponentDescription.componentFlags = 0;
outputComponentDescription.componentFlagsMask = 0;
outputComponentDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
#if TARGET_OS_IPHONE
outputComponentDescription.componentSubType = kAudioUnitSubType_RemoteIO;
#elif TARGET_OS_MAC
outputComponentDescription.componentSubType = kAudioUnitSubType_DefaultOutput;
#endif
outputComponentDescription.componentType = kAudioUnitType_Output;
return outputComponentDescription;
}
-(AudioComponent)_getOutputComponentWithAudioComponentDescription:(AudioComponentDescription)outputComponentDescription {
// Try and find the component
AudioComponent outputComponent = AudioComponentFindNext( NULL , &outputComponentDescription);
NSAssert(outputComponent,@"Couldn't get input component unit!");
return outputComponent;
}
-(void)_createNewInstanceForOutputComponent:(AudioComponent)outputComponent {
//
[EZAudioUtilities checkResult:AudioComponentInstanceNew( outputComponent, &_outputUnit)
operation:"Failed to open component for output unit"];
}
#pragma mark - Configure The Output Unit
//-(void)_configureOutput {
//
// // Get component description for output
// AudioComponentDescription outputComponentDescription = [self _getOutputAudioComponentDescription];
//
// // Get the output component
// AudioComponent outputComponent = [self _getOutputComponentWithAudioComponentDescription:outputComponentDescription];
//
// // Create a new instance of the component and store it for internal use
// [self _createNewInstanceForOutputComponent:outputComponent];
//
//}
#if TARGET_OS_IPHONE
-(void)_configureOutput {
//
AudioComponentDescription outputcd;
outputcd.componentFlags = 0;
outputcd.componentFlagsMask = 0;
outputcd.componentManufacturer = kAudioUnitManufacturer_Apple;
outputcd.componentSubType = kAudioUnitSubType_RemoteIO;
outputcd.componentType = kAudioUnitType_Output;
//
AudioComponent comp = AudioComponentFindNext(NULL,&outputcd);
[EZAudioUtilities checkResult:AudioComponentInstanceNew(comp,&_outputUnit)
operation:"Failed to get output unit"];
// Setup the output unit for playback
UInt32 oneFlag = 1;
AudioUnitElement bus0 = 0;
[EZAudioUtilities checkResult:AudioUnitSetProperty(_outputUnit,
kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Output,
bus0,
&oneFlag,
sizeof(oneFlag))
operation:"Failed to enable output unit"];
// Get the hardware sample rate
Float64 hardwareSampleRate = 44100;
#if !(TARGET_IPHONE_SIMULATOR)
hardwareSampleRate = [[AVAudioSession sharedInstance] sampleRate];
#endif
// Setup an ASBD in canonical format by default
if (!_customASBD){
_outputASBD = [EZAudioUtilities stereoCanonicalNonInterleavedFormatWithSampleRate:hardwareSampleRate];
}
// Set the format for output
[EZAudioUtilities checkResult:AudioUnitSetProperty(_outputUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
bus0,
&_outputASBD,
sizeof(_outputASBD))
operation:"Couldn't set the ASBD for input scope/bos 0"];
//
AURenderCallbackStruct input;
input.inputProc = OutputRenderCallback;
input.inputProcRefCon = (__bridge void *)self;
[EZAudioUtilities checkResult:AudioUnitSetProperty(_outputUnit,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input,
bus0,
&input,
sizeof(input))
operation:"Failed to set the render callback on the output unit"];
//
[EZAudioUtilities checkResult:AudioUnitInitialize(_outputUnit)
operation:"Couldn't initialize output unit"];
}
#elif TARGET_OS_MAC
-(void)_configureOutput {
//
AudioComponentDescription outputcd;
outputcd.componentType = kAudioUnitType_Output;
outputcd.componentSubType = kAudioUnitSubType_DefaultOutput;
outputcd.componentManufacturer = kAudioUnitManufacturer_Apple;
//
AudioComponent comp = AudioComponentFindNext(NULL, &outputcd);
if (comp == NULL){
NSLog(@"Failed to get output unit");
exit(-1);
}
[EZAudioUtilities checkResult:AudioComponentInstanceNew(comp, &_outputUnit)
operation:"Failed to open component for output unit"];
// Setup an ASBD in canonical format by default
if (!_customASBD){
_outputASBD = [EZAudioUtilities stereoFloatNonInterleavedFormatWithSampleRate:44100];
}
// Set the format for output
[EZAudioUtilities checkResult:AudioUnitSetProperty(_outputUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
0,
&_outputASBD,
sizeof(_outputASBD))
operation:"Couldn't set the ASBD for input scope/bos 0"];
//
AURenderCallbackStruct input;
input.inputProc = OutputRenderCallback;
input.inputProcRefCon = (__bridge void *)(self);
[EZAudioUtilities checkResult:AudioUnitSetProperty(_outputUnit,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input,
0,
&input,
sizeof(input))
operation:"Failed to set the render callback on the output unit"];
//
[EZAudioUtilities checkResult:AudioUnitInitialize(_outputUnit)
operation:"Couldn't initialize output unit"];
}
#endif
#pragma mark - Events
-(void)startPlayback {
if (!_isPlaying){
[EZAudioUtilities checkResult:AudioOutputUnitStart(_outputUnit)
operation:"Failed to start output unit"];
_isPlaying = YES;
}
}
-(void)stopPlayback {
if (_isPlaying){
[EZAudioUtilities checkResult:AudioOutputUnitStop(_outputUnit)
operation:"Failed to stop output unit"];
_isPlaying = NO;
}
}
#pragma mark - Getters
-(AudioStreamBasicDescription)audioStreamBasicDescription {
return _outputASBD;
}
-(BOOL)isPlaying {
return _isPlaying;
}
#pragma mark - Setters
-(void)setAudioStreamBasicDescription:(AudioStreamBasicDescription)asbd {
BOOL wasPlaying = NO;
if (self.isPlaying){
[self stopPlayback];
wasPlaying = YES;
}
_customASBD = YES;
_outputASBD = asbd;
// Set the format for output
[EZAudioUtilities checkResult:AudioUnitSetProperty(_outputUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
0,
&_outputASBD,
sizeof(_outputASBD))
operation:"Couldn't set the ASBD for input scope/bos 0"];
if (wasPlaying)
{
[self startPlayback];
}
}
-(void)dealloc {
[EZAudioUtilities checkResult:AudioOutputUnitStop(_outputUnit)
operation:"Failed to uninitialize output unit"];
[EZAudioUtilities checkResult:AudioUnitUninitialize(_outputUnit)
operation:"Failed to uninitialize output unit"];
[EZAudioUtilities checkResult:AudioComponentInstanceDispose(_outputUnit)
operation:"Failed to uninitialize output unit"];
}
@end
+1
View File
@@ -0,0 +1 @@
Versions/Current/EZAudio
+1
View File
@@ -0,0 +1 @@
Versions/Current/Headers
+1
View File
@@ -0,0 +1 @@
Versions/Current/Modules
+1
View File
@@ -0,0 +1 @@
Versions/Current/Resources
Binary file not shown.
@@ -0,0 +1,521 @@
//
// EZAudio.h
// EZAudio
//
// Created by Syed Haris Ali on 11/21/13.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
//------------------------------------------------------------------------------
#pragma mark - Core Components
//------------------------------------------------------------------------------
#import "EZAudioDevice.h"
#import "EZAudioFile.h"
#import "EZMicrophone.h"
#import "EZOutput.h"
#import "EZRecorder.h"
#import "EZAudioPlayer.h"
//------------------------------------------------------------------------------
#pragma mark - Interface Components
//------------------------------------------------------------------------------
#import "EZPlot.h"
#import "EZAudioDisplayLink.h"
#import "EZAudioPlot.h"
#import "EZAudioPlotGL.h"
//------------------------------------------------------------------------------
#pragma mark - Utility Components
//------------------------------------------------------------------------------
#import "EZAudioFloatConverter.h"
#import "EZAudioFloatData.h"
#import "EZAudioUtilities.h"
//------------------------------------------------------------------------------
/**
EZAudio is a simple, intuitive framework for iOS and OSX. The goal of EZAudio was to provide a modular, cross-platform framework to simplify performing everyday audio operations like getting microphone input, creating audio waveforms, recording/playing audio files, etc. The visualization tools like the EZAudioPlot and EZAudioPlotGL were created to plug right into the framework's various components and provide highly optimized drawing routines that work in harmony with audio callback loops. All components retain the same namespace whether you're on an iOS device or a Mac computer so an EZAudioPlot understands it will subclass an UIView on an iOS device or an NSView on a Mac.
Class methods for EZAudio are provided as utility methods used throughout the other modules within the framework. For instance, these methods help make sense of error codes (checkResult:operation:), map values betwen coordinate systems (MAP:leftMin:leftMax:rightMin:rightMax:), calculate root mean squared values for buffers (RMS:length:), etc.
@warning As of 1.0 these methods have been moved over to `EZAudioUtilities` to allow using specific modules without requiring the whole library.
*/
@interface EZAudio : NSObject
//------------------------------------------------------------------------------
#pragma mark - Debugging
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Debugging EZAudio
///-----------------------------------------------------------
/**
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.
@param shouldExitOnCheckResultFail A BOOL indicating whether or not the running program should exist due to a `checkResult:operation:` fail.
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
*/
+ (void)setShouldExitOnCheckResultFail:(BOOL)shouldExitOnCheckResultFail __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Provides a flag indicating whether or not the program will exit if a `checkResult:operation:` fails.
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return A BOOL indicating whether or not the program will exit if a `checkResult:operation:` fails.
*/
+ (BOOL)shouldExitOnCheckResultFail __attribute__((deprecated));
//------------------------------------------------------------------------------
#pragma mark - AudioBufferList Utility
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name AudioBufferList Utility
///-----------------------------------------------------------
/**
Allocates an AudioBufferList structure. Make sure to call freeBufferList when done using AudioBufferList or it will leak.
@param frames The number of frames that will be stored within each audio buffer
@param channels The number of channels (e.g. 2 for stereo, 1 for mono, etc.)
@param 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)
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return An AudioBufferList struct that has been allocated in memory
*/
+ (AudioBufferList *)audioBufferListWithNumberOfFrames:(UInt32)frames
numberOfChannels:(UInt32)channels
interleaved:(BOOL)interleaved __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Allocates an array of float arrays given the number of frames needed to store in each float array.
@param frames A UInt32 representing the number of frames to store in each float buffer
@param channels A UInt32 representing the number of channels (i.e. the number of float arrays to allocate)
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return An array of float arrays, each the length of the number of frames specified
*/
+ (float **)floatBuffersWithNumberOfFrames:(UInt32)frames
numberOfChannels:(UInt32)channels __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Deallocates an AudioBufferList structure from memory.
@param bufferList A pointer to the buffer list you would like to free
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
*/
+ (void)freeBufferList:(AudioBufferList *)bufferList __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Deallocates an array of float buffers
@param buffers An array of float arrays
@param channels A UInt32 representing the number of channels (i.e. the number of float arrays to deallocate)
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
*/
+ (void)freeFloatBuffers:(float **)buffers numberOfChannels:(UInt32)channels __attribute__((deprecated));
//------------------------------------------------------------------------------
#pragma mark - AudioStreamBasicDescription Utilties
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Creating An AudioStreamBasicDescription
///-----------------------------------------------------------
/**
Creates a signed-integer, interleaved AudioStreamBasicDescription for the number of channels specified for an AIFF format.
@param channels The desired number of channels
@param sampleRate A float representing the sample rate.
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return A new AudioStreamBasicDescription with the specified format.
*/
+ (AudioStreamBasicDescription)AIFFFormatWithNumberOfChannels:(UInt32)channels
sampleRate:(float)sampleRate __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Creates an AudioStreamBasicDescription for the iLBC narrow band speech codec.
@param sampleRate A float representing the sample rate.
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return A new AudioStreamBasicDescription with the specified format.
*/
+ (AudioStreamBasicDescription)iLBCFormatWithSampleRate:(float)sampleRate __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Creates a float-based, non-interleaved AudioStreamBasicDescription for the number of channels specified.
@param channels A UInt32 representing the number of channels.
@param sampleRate A float representing the sample rate.
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return A float-based AudioStreamBasicDescription with the number of channels specified.
*/
+ (AudioStreamBasicDescription)floatFormatWithNumberOfChannels:(UInt32)channels
sampleRate:(float)sampleRate __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Creates an AudioStreamBasicDescription for an M4A AAC format.
@param channels The desired number of channels
@param sampleRate A float representing the sample rate.
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return A new AudioStreamBasicDescription with the specified format.
*/
+ (AudioStreamBasicDescription)M4AFormatWithNumberOfChannels:(UInt32)channels
sampleRate:(float)sampleRate __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Creates a single-channel, float-based AudioStreamBasicDescription.
@param sampleRate A float representing the sample rate.
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return A new AudioStreamBasicDescription with the specified format.
*/
+ (AudioStreamBasicDescription)monoFloatFormatWithSampleRate:(float)sampleRate __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Creates a single-channel, float-based AudioStreamBasicDescription (as of 0.0.6 this is the same as `monoFloatFormatWithSampleRate:`).
@param sampleRate A float representing the sample rate.
@return A new AudioStreamBasicDescription with the specified format.
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
*/
+ (AudioStreamBasicDescription)monoCanonicalFormatWithSampleRate:(float)sampleRate __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Creates a two-channel, non-interleaved, float-based AudioStreamBasicDescription (as of 0.0.6 this is the same as `stereoFloatNonInterleavedFormatWithSampleRate:`).
@param sampleRate A float representing the sample rate.
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return A new AudioStreamBasicDescription with the specified format.
*/
+ (AudioStreamBasicDescription)stereoCanonicalNonInterleavedFormatWithSampleRate:(float)sampleRate __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Creates a two-channel, interleaved, float-based AudioStreamBasicDescription.
@param sampleRate A float representing the sample rate.
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return A new AudioStreamBasicDescription with the specified format.
*/
+ (AudioStreamBasicDescription)stereoFloatInterleavedFormatWithSampleRate:(float)sampleRate __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Creates a two-channel, non-interleaved, float-based AudioStreamBasicDescription.
@param sampleRate A float representing the sample rate.
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return A new AudioStreamBasicDescription with the specified format.
*/
+ (AudioStreamBasicDescription)stereoFloatNonInterleavedFormatWithSampleRate:(float)sameRate __attribute__((deprecated));
//------------------------------------------------------------------------------
// @name AudioStreamBasicDescription Helper Functions
//------------------------------------------------------------------------------
/**
Checks an AudioStreamBasicDescription to see if it is a float-based format (as opposed to a signed integer based format).
@param asbd A valid AudioStreamBasicDescription
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return A BOOL indicating whether or not the AudioStreamBasicDescription is a float format.
*/
+ (BOOL)isFloatFormat:(AudioStreamBasicDescription)asbd __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
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
@param asbd A valid AudioStreamBasicDescription
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return A BOOL indicating whether or not the AudioStreamBasicDescription is interleaved
*/
+ (BOOL)isInterleaved:(AudioStreamBasicDescription)asbd __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Checks an AudioStreamBasicDescription to see if it is a linear PCM format (uncompressed,
1 frame per packet)
@param asbd A valid AudioStreamBasicDescription
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return A BOOL indicating whether or not the AudioStreamBasicDescription is linear PCM.
*/
+ (BOOL)isLinearPCM:(AudioStreamBasicDescription)asbd __attribute__((deprecated));
///-----------------------------------------------------------
/// @name AudioStreamBasicDescription Utilities
///-----------------------------------------------------------
/**
Nicely logs out the contents of an AudioStreamBasicDescription struct
@param asbd The AudioStreamBasicDescription struct with content to print out
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
*/
+ (void)printASBD:(AudioStreamBasicDescription)asbd __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Converts seconds into a string formatted as MM:SS
@param seconds An NSTimeInterval representing the number of seconds
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return An NSString instance formatted as MM:SS from the seconds provided.
*/
+ (NSString *)displayTimeStringFromSeconds:(NSTimeInterval)seconds __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Creates a string to use when logging out the contents of an AudioStreamBasicDescription
@param asbd A valid AudioStreamBasicDescription struct.
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return An NSString representing the contents of the AudioStreamBasicDescription.
*/
+ (NSString *)stringForAudioStreamBasicDescription:(AudioStreamBasicDescription)asbd __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Just a wrapper around the setCanonical function provided in the Core Audio Utility C++ class.
@param asbd The AudioStreamBasicDescription structure to modify
@param nChannels The number of expected channels on the description
@param interleaved A flag indicating whether the stereo samples should be interleaved in the buffer
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
*/
+ (void)setCanonicalAudioStreamBasicDescription:(AudioStreamBasicDescription*)asbd
numberOfChannels:(UInt32)nChannels
interleaved:(BOOL)interleaved __attribute__((deprecated));
//------------------------------------------------------------------------------
#pragma mark - Math Utilities
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Math Utilities
///-----------------------------------------------------------
/**
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.
@param buffer A float array of values to append to the tail of the history buffer
@param bufferLength The length of the float array being appended to the history buffer
@param scrollHistory The target history buffer in which to append the values
@param scrollHistoryLength The length of the target history buffer
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
*/
+ (void)appendBufferAndShift:(float*)buffer
withBufferSize:(int)bufferLength
toScrollHistory:(float*)scrollHistory
withScrollHistorySize:(int)scrollHistoryLength __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Appends a value to a history buffer and performs an internal shift to add the value to the tail and remove the 0th value.
@param value The float value to append to the history array
@param scrollHistory The target history buffer in which to append the values
@param scrollHistoryLength The length of the target history buffer
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
*/
+(void) appendValue:(float)value
toScrollHistory:(float*)scrollHistory
withScrollHistorySize:(int)scrollHistoryLength __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
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.
@param value The value expressed in the first coordinate system
@param leftMin The minimum of the first coordinate system
@param leftMax The maximum of the first coordinate system
@param rightMin The minimum of the second coordindate system
@param rightMax The maximum of the second coordinate system
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return The mapped value in terms of the second coordinate system
*/
+ (float)MAP:(float)value
leftMin:(float)leftMin
leftMax:(float)leftMax
rightMin:(float)rightMin
rightMax:(float)rightMax __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Calculates the root mean squared for a buffer.
@param buffer A float buffer array of values whose root mean squared to calculate
@param bufferSize The size of the float buffer
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return The root mean squared of the buffer
*/
+ (float)RMS:(float*)buffer length:(int)bufferSize __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Calculate the sign function sgn(x) =
{ -1 , x < 0,
{ 0 , x = 0,
{ 1 , x > 0
@param value The float value for which to use as x
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return The float sign value
*/
+ (float)SGN:(float)value __attribute__((deprecated));
//------------------------------------------------------------------------------
#pragma mark - OSStatus Utility
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name OSStatus Utility
///-----------------------------------------------------------
/**
Basic check result function useful for checking each step of the audio setup process
@param result The OSStatus representing the result of an operation
@param operation A string (const char, not NSString) describing the operation taking place (will print if fails)
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
*/
+ (void)checkResult:(OSStatus)result operation:(const char *)operation __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Provides a string representation of the often cryptic Core Audio error codes
@param code A UInt32 representing an error code
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
@return An NSString with a human readable version of the error code.
*/
+ (NSString *)stringFromUInt32Code:(UInt32)code __attribute__((deprecated));
//------------------------------------------------------------------------------
#pragma mark - Plot Utility
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Plot Utility
///-----------------------------------------------------------
/**
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.
@param scrollHistory An array of float arrays being used to hold the history values for each channel.
@param scrollHistoryLength An int representing the length of the history window.
@param index An int pointer to the index of the current read index of the history buffer.
@param buffer A float array representing the incoming audio data.
@param bufferSize An int representing the length of the incoming audio data.
@param isChanging A BOOL pointer representing whether the resolution (length of the history window) is currently changing.
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
*/
+ (void)updateScrollHistory:(float **)scrollHistory
withLength:(int)scrollHistoryLength
atIndex:(int *)index
withBuffer:(float *)buffer
withBufferSize:(int)bufferSize
isResolutionChanging:(BOOL *)isChanging __attribute__((deprecated));
//------------------------------------------------------------------------------
#pragma mark - TPCircularBuffer Utility
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name TPCircularBuffer Utility
///-----------------------------------------------------------
/**
Appends the data from the audio buffer list to the circular buffer
@param circularBuffer Pointer to the instance of the TPCircularBuffer to add the audio data to
@param audioBufferList Pointer to the instance of the AudioBufferList with the audio data
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
*/
+ (void)appendDataToCircularBuffer:(TPCircularBuffer*)circularBuffer
fromAudioBufferList:(AudioBufferList*)audioBufferList __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Initializes the circular buffer (just a wrapper around the C method)
* @param circularBuffer Pointer to an instance of the TPCircularBuffer
* @param size The length of the TPCircularBuffer (usually 1024)
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
*/
+ (void)circularBuffer:(TPCircularBuffer*)circularBuffer
withSize:(int)size __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Frees a circular buffer
@param circularBuffer Pointer to the circular buffer to clear
@deprecated This method is deprecated starting in version 0.1.0.
@note Please use same method in EZAudioUtilities class instead.
*/
+ (void)freeCircularBuffer:(TPCircularBuffer*)circularBuffer __attribute__((deprecated));
//------------------------------------------------------------------------------
@end
@@ -0,0 +1,168 @@
//
// EZAudioDevice.h
// MicrophoneTest
//
// Created by Syed Haris Ali on 4/3/15.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
#if TARGET_OS_IPHONE
#import <AVFoundation/AVFoundation.h>
#elif TARGET_OS_MAC
#endif
/**
The EZAudioDevice provides an interface for getting the available input and output hardware devices on iOS and OSX. On iOS the EZAudioDevice uses the available devices found from the AVAudioSession, while on OSX the EZAudioDevice wraps the AudioHardware API to find any devices that are connected including the built-in devices (for instance, Built-In Microphone, Display Audio). Since the AVAudioSession and AudioHardware APIs are quite different the EZAudioDevice has different properties available on each platform. The EZMicrophone now supports setting any specific EZAudioDevice from the `inputDevices` function.
*/
@interface EZAudioDevice : NSObject
//------------------------------------------------------------------------------
#pragma mark - Class Methods
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// @name Getting The Devices
//------------------------------------------------------------------------------
/**
Enumerates all the available input devices and returns the result in an NSArray of EZAudioDevice instances.
@return An NSArray containing EZAudioDevice instances, one for each available input device.
*/
+ (NSArray *)inputDevices;
//------------------------------------------------------------------------------
/**
Enumerates all the available output devices and returns the result in an NSArray of EZAudioDevice instances.
@return An NSArray of output EZAudioDevice instances.
*/
+ (NSArray *)outputDevices;
#if TARGET_OS_IPHONE
/**
Provides the current EZAudioDevice that is being used to pull input.
- iOS only
@return An EZAudioDevice instance representing the currently selected input device.
*/
+ (EZAudioDevice *)currentInputDevice;
/**
Provides the current EZAudioDevice that is being used to output audio.
- iOS only
@return An EZAudioDevice instance representing the currently selected ouotput device.
*/
+ (EZAudioDevice *)currentOutputDevice;
//------------------------------------------------------------------------------
/**
Enumerates all the available input devices.
- iOS only
@param block When enumerating this block executes repeatedly for each EZAudioDevice found. It contains two arguments - first, the EZAudioDevice found, then a pointer to a stop BOOL to allow breaking out of the enumeration)
*/
+ (void)enumerateInputDevicesUsingBlock:(void(^)(EZAudioDevice *device,
BOOL *stop))block;
//------------------------------------------------------------------------------
/**
Enumerates all the available output devices.
- iOS only
@param block When enumerating this block executes repeatedly for each EZAudioDevice found. It contains two arguments - first, the EZAudioDevice found, then a pointer to a stop BOOL to allow breaking out of the enumeration)
*/
+ (void)enumerateOutputDevicesUsingBlock:(void (^)(EZAudioDevice *device,
BOOL *stop))block;
#elif TARGET_OS_MAC
/**
Enumerates all the available devices and returns the result in an NSArray of EZAudioDevice instances.
- OSX only
@return An NSArray of input and output EZAudioDevice instances.
*/
+ (NSArray *)devices;
//------------------------------------------------------------------------------
/**
Enumerates all the available devices.
- OSX only
@param block When enumerating this block executes repeatedly for each EZAudioDevice found. It contains two arguments - first, the EZAudioDevice found, then a pointer to a stop BOOL to allow breaking out of the enumeration)
*/
+ (void)enumerateDevicesUsingBlock:(void(^)(EZAudioDevice *device,
BOOL *stop))block;
#endif
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
/**
An NSString representing a human-reable version of the device.
*/
@property (nonatomic, copy, readonly) NSString *name;
#if TARGET_OS_IPHONE
/**
An AVAudioSessionPortDescription describing an input or output hardware port.
- iOS only
*/
@property (nonatomic, strong, readonly) AVAudioSessionPortDescription *port;
//------------------------------------------------------------------------------
/**
An AVAudioSessionDataSourceDescription describing a specific data source for the `port` provided.
- iOS only
*/
@property (nonatomic, strong, readonly) AVAudioSessionDataSourceDescription *dataSource;
#elif TARGET_OS_MAC
/**
An AudioDeviceID representing the device in the AudioHardware API.
- OSX only
*/
@property (nonatomic, assign, readonly) AudioDeviceID deviceID;
//------------------------------------------------------------------------------
/**
An NSString representing the name of the manufacturer of the device.
- OSX only
*/
@property (nonatomic, copy, readonly) NSString *manufacturer;
//------------------------------------------------------------------------------
/**
An NSInteger representing the number of input channels available.
- OSX only
*/
@property (nonatomic, assign, readonly) NSInteger inputChannelCount;
//------------------------------------------------------------------------------
/**
An NSInteger representing the number of output channels available.
- OSX only
*/
@property (nonatomic, assign, readonly) NSInteger outputChannelCount;
//------------------------------------------------------------------------------
/**
An NSString representing the persistent identifier for the AudioDevice.
- OSX only
*/
@property (nonatomic, copy, readonly) NSString *UID;
#endif
@end
@@ -0,0 +1,94 @@
//
// EZAudioDisplayLink.h
// EZAudio
//
// Created by Syed Haris Ali on 6/25/15.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>
@class EZAudioDisplayLink;
//------------------------------------------------------------------------------
#pragma mark - EZAudioDisplayLinkDelegate
//------------------------------------------------------------------------------
/**
The EZAudioDisplayLinkDelegate provides a means for an EZAudioDisplayLink instance to notify a receiver when it should redraw itself.
*/
@protocol EZAudioDisplayLinkDelegate <NSObject>
@required
/**
Required method for an EZAudioDisplayLinkDelegate to implement. This fires at the screen's display rate (typically 60 fps).
@param displayLink An EZAudioDisplayLink instance used by a receiver to draw itself at the screen's refresh rate.
*/
- (void)displayLinkNeedsDisplay:(EZAudioDisplayLink *)displayLink;
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioDisplayLink
//------------------------------------------------------------------------------
/**
The EZAudioDisplayLink provides a cross-platform (iOS and Mac) abstraction over the CADisplayLink for iOS and CVDisplayLink for Mac. The purpose of this class is to provide an accurate timer for views that need to redraw themselves at 60 fps. This class is used by the EZAudioPlot and, eventually, the EZAudioPlotGL to provide a timer mechanism to draw real-time plots.
*/
@interface EZAudioDisplayLink : NSObject
//------------------------------------------------------------------------------
#pragma mark - Class Methods
//------------------------------------------------------------------------------
/**
Class method to create an EZAudioDisplayLink. The caller should implement the EZAudioDisplayLinkDelegate protocol to receive the `displayLinkNeedsDisplay:` delegate method to know when to redraw itself.
@param delegate An instance that implements the EZAudioDisplayLinkDelegate protocol.
@return An instance of the EZAudioDisplayLink.
*/
+ (instancetype)displayLinkWithDelegate:(id<EZAudioDisplayLinkDelegate>)delegate;
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
/**
The EZAudioDisplayLinkDelegate for which to receive the redraw calls.
*/
@property (nonatomic, weak) id<EZAudioDisplayLinkDelegate> delegate;
//------------------------------------------------------------------------------
#pragma mark - Instance Methods
//------------------------------------------------------------------------------
/**
Method to start the display link and provide the `displayLinkNeedsDisplay:` calls to the `delegate`
*/
- (void)start;
/**
Method to stop the display link from providing the `displayLinkNeedsDisplay:` calls to the `delegate`
*/
- (void)stop;
//------------------------------------------------------------------------------
@end
@@ -0,0 +1,368 @@
//
// EZAudioFile.h
// EZAudio
//
// Created by Syed Haris Ali on 12/1/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
#import "EZAudioFloatData.h"
//------------------------------------------------------------------------------
@class EZAudio;
@class EZAudioFile;
//------------------------------------------------------------------------------
#pragma mark - Blocks
//------------------------------------------------------------------------------
/**
A block used when returning back the waveform data. The waveform data itself will be an array of float arrays, one for each channel, and the length indicates the total length of each float array.
@param waveformData An array of float arrays, each representing a channel of audio data from the file
@param length An int representing the length of each channel of float audio data
*/
typedef void (^EZAudioWaveformDataCompletionBlock)(float **waveformData, int length);
//------------------------------------------------------------------------------
#pragma mark - EZAudioFileDelegate
//------------------------------------------------------------------------------
/**
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.
*/
@protocol EZAudioFileDelegate <NSObject>
@optional
/**
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.
@param audioFile The instance of the EZAudioFile that triggered the event.
@param 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.
@param bufferSize The length of the buffers float arrays
@param numberOfChannels The number of channels. 2 for stereo, 1 for mono.
*/
- (void) audioFile:(EZAudioFile *)audioFile
readAudio:(float **)buffer
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels;
//------------------------------------------------------------------------------
/**
Occurs when the audio file's internal seek position has been updated by the EZAudioFile functions `readFrames:audioBufferList:bufferSize:eof:` or `audioFile:updatedPosition:`.
@param audioFile The instance of the EZAudio in which the change occured
@param framePosition The new frame index as a 64-bit signed integer
*/
- (void)audioFile:(EZAudioFile *)audioFile updatedPosition:(SInt64)framePosition;
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioFile
//------------------------------------------------------------------------------
/**
The EZAudioFile provides a lightweight and intuitive way to asynchronously interact with audio files. These interactions included reading audio data, seeking within an audio file, getting information about the file, and pulling the waveform data for visualizing the contents of the audio file. The EZAudioFileDelegate provides event callbacks for when reads, seeks, and various updates happen within the audio file to allow the caller to interact with the action in meaningful ways. Common use cases here could be to read the audio file's data as AudioBufferList structures for output (see EZOutput) and visualizing the audio file's data as a float array using an audio plot (see EZAudioPlot).
*/
@interface EZAudioFile : NSObject <NSCopying>
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
/**
A EZAudioFileDelegate for the audio file that is used to return events such as new seek positions within the file and the read audio data as a float array.
*/
@property (nonatomic, weak) id<EZAudioFileDelegate> delegate;
//------------------------------------------------------------------------------
#pragma mark - Initialization
//------------------------------------------------------------------------------
/**
@name Initialization
*/
/**
Creates a new instance of the EZAudioFile using a file path URL.
@param url The file path reference of the audio file as an NSURL.
@return The newly created EZAudioFile instance. nil if the file path does not exist.
*/
- (instancetype)initWithURL:(NSURL *)url;
/**
Creates a new instance of the EZAudioFile using a file path URL with a delegate conforming to the EZAudioFileDelegate protocol.
@param delegate The audio file delegate that receives events specified by the EZAudioFileDelegate protocol
@param url The file path reference of the audio file as an NSURL.
@return The newly created EZAudioFile instance.
*/
- (instancetype)initWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Creates a new instance of the EZAudioFile using a file path URL with a delegate conforming to the EZAudioFileDelegate protocol and a client format.
@param url The file path reference of the audio file as an NSURL.
@param delegate The audio file delegate that receives events specified by the EZAudioFileDelegate protocol
@param clientFormat An AudioStreamBasicDescription that will be used as the client format on the audio file. For instance, the audio file might be in a 22.5 kHz sample rate format in its file format, but your app wants to read the samples at a sample rate of 44.1 kHz so it can iterate with other components (like a audio processing graph) without any weird playback effects. If this initializer is not used then a non-interleaved float format will be assumed.
@return The newly created EZAudioFile instance.
*/
- (instancetype)initWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate
clientFormat:(AudioStreamBasicDescription)clientFormat;
//------------------------------------------------------------------------------
#pragma mark - Class Initializers
//------------------------------------------------------------------------------
/**
@name Class Initializers
*/
/**
Class method that creates a new instance of the EZAudioFile using a file path URL.
@param url The file path reference of the audio file as an NSURL.
@return The newly created EZAudioFile instance.
*/
+ (instancetype)audioFileWithURL:(NSURL *)url;
//------------------------------------------------------------------------------
/**
Class method that creates a new instance of the EZAudioFile using a file path URL with a delegate conforming to the EZAudioFileDelegate protocol.
@param url The file path reference of the audio file as an NSURL.
@param delegate The audio file delegate that receives events specified by the EZAudioFileDelegate protocol
@return The newly created EZAudioFile instance.
*/
+ (instancetype)audioFileWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Class method that creates a new instance of the EZAudioFile using a file path URL with a delegate conforming to the EZAudioFileDelegate protocol and a client format.
@param url The file path reference of the audio file as an NSURL.
@param delegate The audio file delegate that receives events specified by the EZAudioFileDelegate protocol
@param clientFormat An AudioStreamBasicDescription that will be used as the client format on the audio file. For instance, the audio file might be in a 22.5 kHz sample rate, interleaved MP3 file format, but your app wants to read linear PCM samples at a sample rate of 44.1 kHz so it can be read in the context of other components sharing a common stream format (like a audio processing graph). If this initializer is not used then the `defaultClientFormat` will be used as teh default value for the client format.
@return The newly created EZAudioFile instance.
*/
+ (instancetype)audioFileWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate
clientFormat:(AudioStreamBasicDescription)clientFormat;
//------------------------------------------------------------------------------
#pragma mark - Class Methods
//------------------------------------------------------------------------------
/**
@name Class Methods
*/
/**
A class method that subclasses can override to specify the default client format that will be used to read audio data from this file. A client format is different from the file format in that it is the format of the other components interacting with this file. For instance, the file on disk could be a 22.5 kHz, float format, but we might have an audio processing graph that has a 44.1 kHz, signed integer format that we'd like to interact with. The client format lets us set that 44.1 kHz format on the audio file to properly read samples from it with any interpolation or format conversion that must take place done automatically within the EZAudioFile `readFrames:audioBufferList:bufferSize:eof:` method. Default is stereo, non-interleaved, 44.1 kHz.
@return An AudioStreamBasicDescription that serves as the audio file's client format.
*/
+ (AudioStreamBasicDescription)defaultClientFormat;
//------------------------------------------------------------------------------
/**
A class method that subclasses can override to specify the default sample rate that will be used in the `defaultClientFormat` method. Default is 44100.0 (44.1 kHz).
@return A Float64 representing the sample rate that should be used in the default client format.
*/
+ (Float64)defaultClientFormatSampleRate;
//------------------------------------------------------------------------------
/**
Provides an array of the supported audio files types. Each audio file type is provided as a string, i.e. @"caf". Useful for filtering lists of files in an open panel to only the types allowed.
@return An array of NSString objects representing the represented file types.
*/
+ (NSArray *)supportedAudioFileTypes;
//------------------------------------------------------------------------------
#pragma mark - Events
//------------------------------------------------------------------------------
/**
@name Reading From The Audio File
*/
/**
Reads a specified number of frames from the audio file. In addition, this will notify the EZAudioFileDelegate (if specified) of the read data as a float array with the audioFile:readAudio:withBufferSize:withNumberOfChannels: event and the new seek position within the file with the audioFile:updatedPosition: event.
@param frames The number of frames to read from the file.
@param audioBufferList An allocated AudioBufferList structure in which to store the read audio data
@param bufferSize A pointer to a UInt32 in which to store the read buffersize
@param eof A pointer to a BOOL in which to store whether the read operation reached the end of the audio file.
*/
- (void)readFrames:(UInt32)frames
audioBufferList:(AudioBufferList *)audioBufferList
bufferSize:(UInt32 *)bufferSize
eof:(BOOL *)eof;
//------------------------------------------------------------------------------
/**
@name Seeking Through The Audio File
*/
/**
Seeks through an audio file to a specified frame. This will notify the EZAudioFileDelegate (if specified) with the audioFile:updatedPosition: function.
@param frame The new frame position to seek to as a SInt64.
*/
- (void)seekToFrame:(SInt64)frame;
//------------------------------------------------------------------------------
#pragma mark - Getters
//------------------------------------------------------------------------------
/**
@name Getting Information About The Audio File
*/
/**
Provides the AudioStreamBasicDescription structure used within the app. The file's format will be converted to this format and then sent back as either a float array or a `AudioBufferList` pointer. For instance, the file on disk could be a 22.5 kHz, float format, but we might have an audio processing graph that has a 44.1 kHz, signed integer format that we'd like to interact with. The client format lets us set that 44.1 kHz format on the audio file to properly read samples from it with any interpolation or format conversion that must take place done automatically within the EZAudioFile `readFrames:audioBufferList:bufferSize:eof:` method. Default is stereo, non-interleaved, 44.1 kHz.
@warning This must be a linear PCM format!
@return An AudioStreamBasicDescription structure describing the format of the audio file.
*/
@property (readwrite) AudioStreamBasicDescription clientFormat;
//------------------------------------------------------------------------------
/**
Provides the current offset in the audio file as an NSTimeInterval (i.e. in seconds). When setting this it will determine the correct frame offset and perform a `seekToFrame` to the new time offset.
@warning Make sure the new current time offset is less than the `duration` or you will receive an invalid seek assertion.
*/
@property (nonatomic, readwrite) NSTimeInterval currentTime;
//------------------------------------------------------------------------------
/**
Provides the duration of the audio file in seconds.
*/
@property (readonly) NSTimeInterval duration;
//------------------------------------------------------------------------------
/**
Provides the AudioStreamBasicDescription structure containing the format of the file.
@return An AudioStreamBasicDescription structure describing the format of the audio file.
*/
@property (readonly) AudioStreamBasicDescription fileFormat;
//------------------------------------------------------------------------------
/**
Provides the current time as an NSString with the time format MM:SS.
*/
@property (readonly) NSString *formattedCurrentTime;
//------------------------------------------------------------------------------
/**
Provides the duration as an NSString with the time format MM:SS.
*/
@property (readonly) NSString *formattedDuration;
//------------------------------------------------------------------------------
/**
Provides the frame index (a.k.a the seek positon) within the audio file as SInt64. This can be helpful when seeking through the audio file.
@return The current frame index within the audio file as a SInt64.
*/
@property (readonly) SInt64 frameIndex;
//------------------------------------------------------------------------------
/**
Provides a dictionary containing the metadata (ID3) tags that are included in the header for the audio file. Typically this contains stuff like artist, title, release year, etc.
@return An NSDictionary containing the metadata for the audio file.
*/
@property (readonly) NSDictionary *metadata;
//------------------------------------------------------------------------------
/**
Provides the total duration of the audio file in seconds.
@deprecated This property is deprecated starting in version 0.3.0.
@note Please use `duration` property instead.
@return The total duration of the audio file as a Float32.
*/
@property (readonly) NSTimeInterval totalDuration __attribute__((deprecated));;
//------------------------------------------------------------------------------
/**
Provides the total frame count of the audio file in the client format.
@return The total number of frames in the audio file in the AudioStreamBasicDescription representing the client format as a SInt64.
*/
@property (readonly) SInt64 totalClientFrames;
//------------------------------------------------------------------------------
/**
Provides the total frame count of the audio file in the file format.
@return The total number of frames in the audio file in the AudioStreamBasicDescription representing the file format as a SInt64.
*/
@property (readonly) SInt64 totalFrames;
//------------------------------------------------------------------------------
/**
Provides the NSURL for the audio file.
@return An NSURL representing the path of the EZAudioFile instance.
*/
@property (nonatomic, copy, readonly) NSURL *url;
//------------------------------------------------------------------------------
#pragma mark - Helpers
//------------------------------------------------------------------------------
/**
Synchronously pulls the waveform amplitude data into a float array for the receiver. This returns a waveform with a default resolution of 1024, meaning there are 1024 data points to plot the waveform.
@param numberOfPoints A UInt32 representing the number of data points you need. The higher the number of points the more detailed the waveform will be.
@return A EZAudioFloatData instance containing the audio data for all channels of the audio.
*/
- (EZAudioFloatData *)getWaveformData;
//------------------------------------------------------------------------------
/**
Synchronously pulls the waveform amplitude data into a float array for the receiver.
@param numberOfPoints A UInt32 representing the number of data points you need. The higher the number of points the more detailed the waveform will be.
@return A EZAudioFloatData instance containing the audio data for all channels of the audio.
*/
- (EZAudioFloatData *)getWaveformDataWithNumberOfPoints:(UInt32)numberOfPoints;
//------------------------------------------------------------------------------
/**
Asynchronously pulls the waveform amplitude data into a float array for the receiver. This returns a waveform with a default resolution of 1024, meaning there are 1024 data points to plot the waveform.
@param completion A EZAudioWaveformDataCompletionBlock that executes when the waveform data has been extracted. Provides a `EZAudioFloatData` instance containing the waveform data for all audio channels.
*/
- (void)getWaveformDataWithCompletionBlock:(EZAudioWaveformDataCompletionBlock)completion;
//------------------------------------------------------------------------------
/**
Asynchronously pulls the waveform amplitude data into a float array for the receiver.
@param numberOfPoints A UInt32 representing the number of data points you need. The higher the number of points the more detailed the waveform will be.
@param completion A EZAudioWaveformDataCompletionBlock that executes when the waveform data has been extracted. Provides a `EZAudioFloatData` instance containing the waveform data for all audio channels.
*/
- (void)getWaveformDataWithNumberOfPoints:(UInt32)numberOfPoints
completion:(EZAudioWaveformDataCompletionBlock)completion;
//------------------------------------------------------------------------------
@end
@@ -0,0 +1,75 @@
//
// EZAudioFloatConverter.h
// EZAudio
//
// Created by Syed Haris Ali on 6/23/15.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
//------------------------------------------------------------------------------
#pragma mark - Constants
//------------------------------------------------------------------------------
FOUNDATION_EXPORT UInt32 const EZAudioFloatConverterDefaultPacketSize;
//------------------------------------------------------------------------------
#pragma mark - EZAudioFloatConverter
//------------------------------------------------------------------------------
@interface EZAudioFloatConverter : NSObject
//------------------------------------------------------------------------------
#pragma mark - Class Methods
//------------------------------------------------------------------------------
+ (instancetype)converterWithInputFormat:(AudioStreamBasicDescription)inputFormat;
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
@property (nonatomic, assign, readonly) AudioStreamBasicDescription inputFormat;
@property (nonatomic, assign, readonly) AudioStreamBasicDescription floatFormat;
//------------------------------------------------------------------------------
#pragma mark - Instance Methods
//------------------------------------------------------------------------------
- (instancetype)initWithInputFormat:(AudioStreamBasicDescription)inputFormat;
//------------------------------------------------------------------------------
- (void)convertDataFromAudioBufferList:(AudioBufferList *)audioBufferList
withNumberOfFrames:(UInt32)frames
toFloatBuffers:(float **)buffers;
//------------------------------------------------------------------------------
- (void)convertDataFromAudioBufferList:(AudioBufferList *)audioBufferList
withNumberOfFrames:(UInt32)frames
toFloatBuffers:(float **)buffers
packetDescriptions:(AudioStreamPacketDescription *)packetDescriptions;
//------------------------------------------------------------------------------
@end
@@ -0,0 +1,52 @@
//
// EZAudioFloatData.h
// EZAudio
//
// Created by Syed Haris Ali on 6/23/15.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
//------------------------------------------------------------------------------
#pragma mark - EZAudioFloatData
//------------------------------------------------------------------------------
@interface EZAudioFloatData : NSObject
//------------------------------------------------------------------------------
+ (instancetype)dataWithNumberOfChannels:(int)numberOfChannels
buffers:(float **)buffers
bufferSize:(UInt32)bufferSize;
//------------------------------------------------------------------------------
@property (nonatomic, assign, readonly) int numberOfChannels;
@property (nonatomic, assign, readonly) float **buffers;
@property (nonatomic, assign, readonly) UInt32 bufferSize;
//------------------------------------------------------------------------------
- (float *)bufferForChannel:(int)channel;
//------------------------------------------------------------------------------
@end
@@ -0,0 +1,414 @@
//
// EZAudioPlayer.h
// EZAudio
//
// Created by Syed Haris Ali on 1/16/14.
// Copyright (c) 2014 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import "TargetConditionals.h"
#import "EZAudioFile.h"
#import "EZOutput.h"
@class EZAudioPlayer;
//------------------------------------------------------------------------------
#pragma mark - Notifications
//------------------------------------------------------------------------------
/**
Notification that occurs whenever the EZAudioPlayer changes its `audioFile` property. Check the new value using the EZAudioPlayer's `audioFile` property.
*/
FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangeAudioFileNotification;
/**
Notification that occurs whenever the EZAudioPlayer changes its `device` property. Check the new value using the EZAudioPlayer's `device` property.
*/
FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangeOutputDeviceNotification;
/**
Notification that occurs whenever the EZAudioPlayer changes its `output` component's `pan` property. Check the new value using the EZAudioPlayer's `pan` property.
*/
FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangePanNotification;
/**
Notification that occurs whenever the EZAudioPlayer changes its `output` component's play state. Check the new value using the EZAudioPlayer's `isPlaying` property.
*/
FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangePlayStateNotification;
/**
Notification that occurs whenever the EZAudioPlayer changes its `output` component's `volume` property. Check the new value using the EZAudioPlayer's `volume` property.
*/
FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangeVolumeNotification;
/**
Notification that occurs whenever the EZAudioPlayer has reached the end of a file and its `shouldLoop` property has been set to NO.
*/
FOUNDATION_EXPORT NSString * const EZAudioPlayerDidReachEndOfFileNotification;
/**
Notification that occurs whenever the EZAudioPlayer performs a seek via the `seekToFrame` method or `setCurrentTime:` property setter. Check the new `currentTime` or `frameIndex` value using the EZAudioPlayer's `currentTime` or `frameIndex` property, respectively.
*/
FOUNDATION_EXPORT NSString * const EZAudioPlayerDidSeekNotification;
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlayerDelegate
//------------------------------------------------------------------------------
/**
The EZAudioPlayerDelegate provides event callbacks for the EZAudioPlayer. Since 0.5.0 the EZAudioPlayerDelegate provides a smaller set of delegate methods in favor of notifications to allow multiple receivers of the EZAudioPlayer event callbacks since only one player is typically used in an application. Specifically, these methods are provided for high frequency callbacks that wrap the EZAudioPlayer's internal EZAudioFile and EZOutput instances.
@warning These callbacks don't necessarily occur on the main thread so make sure you wrap any UI code in a GCD block like: dispatch_async(dispatch_get_main_queue(), ^{ // Update UI });
*/
@protocol EZAudioPlayerDelegate <NSObject>
@optional
//------------------------------------------------------------------------------
/**
Triggered by the EZAudioPlayer's internal EZAudioFile's EZAudioFileDelegate callback and notifies 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.
@param audioPlayer The instance of the EZAudioPlayer that triggered the event
@param 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.
@param bufferSize The length of the buffers float arrays
@param numberOfChannels The number of channels. 2 for stereo, 1 for mono.
@param audioFile The instance of the EZAudioFile that the event was triggered from
*/
- (void) audioPlayer:(EZAudioPlayer *)audioPlayer
playedAudio:(float **)buffer
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels
inAudioFile:(EZAudioFile *)audioFile;;
//------------------------------------------------------------------------------
/**
Triggered by EZAudioPlayer's internal EZAudioFile's EZAudioFileDelegate callback and notifies the delegate of the current playback position. The framePosition provides the current frame position and can be calculated against the EZAudioPlayer's total frames using the `totalFrames` function from the EZAudioPlayer.
@param audioPlayer The instance of the EZAudioPlayer that triggered the event
@param framePosition The new frame index as a 64-bit signed integer
@param audioFile The instance of the EZAudioFile that the event was triggered from
*/
- (void)audioPlayer:(EZAudioPlayer *)audioPlayer
updatedPosition:(SInt64)framePosition
inAudioFile:(EZAudioFile *)audioFile;
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlayer
//------------------------------------------------------------------------------
/**
The EZAudioPlayer provides an interface that combines the EZAudioFile and EZOutput to play local audio files. This class acts as the master delegate (the EZAudioFileDelegate) over whatever EZAudioFile instance, the `audioFile` property, it is using for playback as well as the EZOutputDelegate and EZOutputDataSource over whatever EZOutput instance is set as the `output`. Classes that want to get the EZAudioFileDelegate callbacks should implement the EZAudioPlayer's EZAudioPlayerDelegate on the EZAudioPlayer instance. Since 0.5.0 the EZAudioPlayer offers notifications over the usual delegate methods to allow multiple receivers to get the EZAudioPlayer's state changes since one player will typically be used in one application. The EZAudioPlayerDelegate, the `delegate`, provides callbacks for high frequency methods that simply wrap the EZAudioFileDelegate and EZOutputDelegate callbacks for providing the audio buffer played as well as the position updating (you will typically have one scrub bar in an application).
*/
@interface EZAudioPlayer : NSObject <EZAudioFileDelegate,
EZOutputDataSource,
EZOutputDelegate>
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Properties
///-----------------------------------------------------------
/**
The EZAudioPlayerDelegate that will handle the audio player callbacks
*/
@property (nonatomic, weak) id<EZAudioPlayerDelegate> delegate;
//------------------------------------------------------------------------------
/**
A BOOL indicating whether the player should loop the file
*/
@property (nonatomic, assign) BOOL shouldLoop;
//------------------------------------------------------------------------------
#pragma mark - Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Initializers
///-----------------------------------------------------------
/**
Initializes the EZAudioPlayer with an EZAudioFile instance. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
@param audioFile The instance of the EZAudioFile to use for initializing the EZAudioPlayer
@return The newly created instance of the EZAudioPlayer
*/
- (instancetype)initWithAudioFile:(EZAudioFile *)audioFile;
//------------------------------------------------------------------------------
/**
Initializes the EZAudioPlayer with an EZAudioFile instance and provides a way to assign the EZAudioPlayerDelegate on instantiation. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
@param audioFile The instance of the EZAudioFile to use for initializing the EZAudioPlayer
@param delegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the initWithAudioFile: function instead.
@return The newly created instance of the EZAudioPlayer
*/
- (instancetype)initWithAudioFile:(EZAudioFile *)audioFile
delegate:(id<EZAudioPlayerDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Initializes the EZAudioPlayer with an EZAudioPlayerDelegate.
@param delegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the initWithAudioFile: function instead.
@return The newly created instance of the EZAudioPlayer
*/
- (instancetype)initWithDelegate:(id<EZAudioPlayerDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Initializes the EZAudioPlayer with an NSURL instance representing the file path of the audio file.
@param url The NSURL instance representing the file path of the audio file.
@return The newly created instance of the EZAudioPlayer
*/
- (instancetype)initWithURL:(NSURL*)url;
//------------------------------------------------------------------------------
/**
Initializes the EZAudioPlayer with an NSURL instance representing the file path of the audio file and a caller to assign as the EZAudioPlayerDelegate on instantiation.
@param url The NSURL instance representing the file path of the audio file.
@param delegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the initWithAudioFile: function instead.
@return The newly created instance of the EZAudioPlayer
*/
- (instancetype)initWithURL:(NSURL*)url
delegate:(id<EZAudioPlayerDelegate>)delegate;
//------------------------------------------------------------------------------
#pragma mark - Class Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Class Initializers
///-----------------------------------------------------------
/**
Class initializer that creates a default EZAudioPlayer.
@return The newly created instance of the EZAudioPlayer
*/
+ (instancetype)audioPlayer;
//------------------------------------------------------------------------------
/**
Class initializer that creates the EZAudioPlayer with an EZAudioFile instance. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
@param audioFile The instance of the EZAudioFile to use for initializing the EZAudioPlayer
@return The newly created instance of the EZAudioPlayer
*/
+ (instancetype)audioPlayerWithAudioFile:(EZAudioFile *)audioFile;
//------------------------------------------------------------------------------
/**
Class initializer that creates the EZAudioPlayer with an EZAudioFile instance and provides a way to assign the EZAudioPlayerDelegate on instantiation. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
@param audioFile The instance of the EZAudioFile to use for initializing the EZAudioPlayer
@param delegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the audioPlayerWithAudioFile: function instead.
@return The newly created instance of the EZAudioPlayer
*/
+ (instancetype)audioPlayerWithAudioFile:(EZAudioFile *)audioFile
delegate:(id<EZAudioPlayerDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Class initializer that creates a default EZAudioPlayer with an EZAudioPlayerDelegate..
@return The newly created instance of the EZAudioPlayer
*/
+ (instancetype)audioPlayerWithDelegate:(id<EZAudioPlayerDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Class initializer that creates the EZAudioPlayer with an NSURL instance representing the file path of the audio file.
@param url The NSURL instance representing the file path of the audio file.
@return The newly created instance of the EZAudioPlayer
*/
+ (instancetype)audioPlayerWithURL:(NSURL*)url;
//------------------------------------------------------------------------------
/**
Class initializer that creates the EZAudioPlayer with an NSURL instance representing the file path of the audio file and a caller to assign as the EZAudioPlayerDelegate on instantiation.
@param url The NSURL instance representing the file path of the audio file.
@param delegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the audioPlayerWithURL: function instead.
@return The newly created instance of the EZAudioPlayer
*/
+ (instancetype)audioPlayerWithURL:(NSURL*)url
delegate:(id<EZAudioPlayerDelegate>)delegate;
//------------------------------------------------------------------------------
#pragma mark - Singleton
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Shared Instance
///-----------------------------------------------------------
/**
The shared instance (singleton) of the audio player. Most applications will only have one instance of the EZAudioPlayer that can be reused with multiple different audio files.
* @return The shared instance of the EZAudioPlayer.
*/
+ (instancetype)sharedAudioPlayer;
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Properties
///-----------------------------------------------------------
/**
Provides the EZAudioFile instance that is being used as the datasource for playback. When set it creates a copy of the EZAudioFile provided for internal use. This does not use the EZAudioFile by reference, but instead creates a copy of the EZAudioFile instance provided.
*/
@property (nonatomic, readwrite, copy) EZAudioFile *audioFile;
//------------------------------------------------------------------------------
/**
Provides the current offset in the audio file as an NSTimeInterval (i.e. in seconds). When setting this it will determine the correct frame offset and perform a `seekToFrame` to the new time offset.
@warning Make sure the new current time offset is less than the `duration` or you will receive an invalid seek assertion.
*/
@property (nonatomic, readwrite) NSTimeInterval currentTime;
//------------------------------------------------------------------------------
/**
The EZAudioDevice instance that is being used by the `output`. Similarly, setting this just sets the `device` property of the `output`.
*/
@property (readwrite) EZAudioDevice *device;
//------------------------------------------------------------------------------
/**
Provides the duration of the audio file in seconds.
*/
@property (readonly) NSTimeInterval duration;
//------------------------------------------------------------------------------
/**
Provides the current time as an NSString with the time format MM:SS.
*/
@property (readonly) NSString *formattedCurrentTime;
//------------------------------------------------------------------------------
/**
Provides the duration as an NSString with the time format MM:SS.
*/
@property (readonly) NSString *formattedDuration;
//------------------------------------------------------------------------------
/**
Provides the EZOutput that is being used to handle the actual playback of the audio data. This property is also settable, but note that the EZAudioPlayer will become the output's EZOutputDataSource and EZOutputDelegate. To listen for the EZOutput's delegate methods your view should implement the EZAudioPlayerDelegate and set itself as the EZAudioPlayer's `delegate`.
*/
@property (nonatomic, strong, readwrite) EZOutput *output;
//------------------------------------------------------------------------------
/**
Provides the frame index (a.k.a the seek positon) within the audio file being used for playback. This can be helpful when seeking through the audio file.
@return An SInt64 representing the current frame index within the audio file used for playback.
*/
@property (readonly) SInt64 frameIndex;
//------------------------------------------------------------------------------
/**
Provides a flag indicating whether the EZAudioPlayer is currently playing back any audio.
@return A BOOL indicating whether or not the EZAudioPlayer is performing playback,
*/
@property (readonly) BOOL isPlaying;
//------------------------------------------------------------------------------
/**
Provides the current pan from the audio player's internal `output` component. Setting the pan adjusts the direction of the audio signal from left (0) to right (1). Default is 0.5 (middle).
*/
@property (nonatomic, assign) float pan;
//------------------------------------------------------------------------------
/**
Provides the total amount of frames in the current audio file being used for playback.
@return A SInt64 representing the total amount of frames in the current audio file being used for playback.
*/
@property (readonly) SInt64 totalFrames;
//------------------------------------------------------------------------------
/**
Provides the file path that's currently being used by the player for playback.
@return The NSURL representing the file path of the audio file being used for playback.
*/
@property (nonatomic, copy, readonly) NSURL *url;
//------------------------------------------------------------------------------
/**
Provides the current volume from the audio player's internal `output` component. Setting the volume adjusts the gain of the output between 0 and 1. Default is 1.
*/
@property (nonatomic, assign) float volume;
//------------------------------------------------------------------------------
#pragma mark - Actions
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Controlling Playback
///-----------------------------------------------------------
/**
Starts playback.
*/
- (void)play;
//------------------------------------------------------------------------------
/**
Loads an EZAudioFile and immediately starts playing it.
@param audioFile An EZAudioFile to use for immediate playback.
*/
- (void)playAudioFile:(EZAudioFile *)audioFile;
//------------------------------------------------------------------------------
/**
Pauses playback.
*/
- (void)pause;
//------------------------------------------------------------------------------
/**
Seeks playback to a specified frame within the internal EZAudioFile. This will notify the EZAudioFileDelegate (if specified) with the audioPlayer:updatedPosition:inAudioFile: function.
@param frame The new frame position to seek to as a SInt64.
*/
- (void)seekToFrame:(SInt64)frame;
@end
@@ -0,0 +1,192 @@
//
// EZAudioPlot.h
// EZAudio
//
// Created by Syed Haris Ali on 9/2/13.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <QuartzCore/QuartzCore.h>
#import "EZPlot.h"
@class EZAudio;
//------------------------------------------------------------------------------
#pragma mark - Constants
//------------------------------------------------------------------------------
/**
The default value used for the maximum rolling history buffer length of any EZAudioPlot.
@deprecated This constant is deprecated starting in version 0.2.0.
@note Please use EZAudioPlotDefaultMaxHistoryBufferLength instead.
*/
FOUNDATION_EXPORT UInt32 const kEZAudioPlotMaxHistoryBufferLength __attribute__((deprecated));
/**
The default value used for the default rolling history buffer length of any EZAudioPlot.
@deprecated This constant is deprecated starting in version 0.2.0.
@note Please use EZAudioPlotDefaultHistoryBufferLength instead.
*/
FOUNDATION_EXPORT UInt32 const kEZAudioPlotDefaultHistoryBufferLength __attribute__((deprecated));
/**
The default value used for the default rolling history buffer length of any EZAudioPlot.
*/
FOUNDATION_EXPORT UInt32 const EZAudioPlotDefaultHistoryBufferLength;
/**
The default value used for the maximum rolling history buffer length of any EZAudioPlot.
*/
FOUNDATION_EXPORT UInt32 const EZAudioPlotDefaultMaxHistoryBufferLength;
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlotWaveformLayer
//------------------------------------------------------------------------------
/**
The EZAudioPlotWaveformLayer is a lightweight subclass of the CAShapeLayer that allows implicit animations on the `path` key.
*/
@interface EZAudioPlotWaveformLayer : CAShapeLayer
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlot
//------------------------------------------------------------------------------
/**
`EZAudioPlot`, a subclass of `EZPlot`, is a cross-platform (iOS and OSX) class that plots an audio waveform using Core Graphics.
The caller provides updates a constant stream of updated audio data in the `updateBuffer:withBufferSize:` function, which in turn will be plotted in one of the plot types:
* Buffer (`EZPlotTypeBuffer`) - A plot that only consists of the current buffer and buffer size from the last call to `updateBuffer:withBufferSize:`. This looks similar to the default openFrameworks input audio example.
* Rolling (`EZPlotTypeRolling`) - A plot that consists of a rolling history of values averaged from each buffer. This is the traditional waveform look.
#Parent Methods and Properties#
See EZPlot for full API methods and properties (colors, plot type, update function)
*/
@interface EZAudioPlot : EZPlot
/**
A BOOL that allows optimizing the audio plot's drawing for real-time displays. Since the update function may be updating the plot's data very quickly (over 60 frames per second) this property will throttle the drawing calls to be 60 frames per second (or whatever the screen rate is). Specifically, it disables implicit path change animations on the `waveformLayer` and sets up a display link to render 60 fps (audio updating the plot at 44.1 kHz causes it to re-render 86 fps - far greater than what is needed for a visual display).
*/
@property (nonatomic, assign) BOOL shouldOptimizeForRealtimePlot;
//------------------------------------------------------------------------------
/**
A BOOL indicating whether the plot should center itself vertically.
*/
@property (nonatomic, assign) BOOL shouldCenterYAxis;
//------------------------------------------------------------------------------
/**
An EZAudioPlotWaveformLayer that is used to render the actual waveform. By switching the drawing code to Core Animation layers in version 0.2.0 most work, specifically the compositing step, is now done on the GPU. Hence, multiple EZAudioPlot instances can be used simultaneously with very low CPU overhead so these are now practical for table and collection views.
*/
@property (nonatomic, strong) EZAudioPlotWaveformLayer *waveformLayer;
//------------------------------------------------------------------------------
#pragma mark - Adjust Resolution
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Adjusting The Resolution
///-----------------------------------------------------------
/**
Sets the length of the rolling history buffer (i.e. the number of points in the rolling plot's buffer). Can grow or shrink the display up to the maximum size specified by the `maximumRollingHistoryLength` method. Will return the actual set value, which will be either the given value if smaller than the `maximumRollingHistoryLength` or `maximumRollingHistoryLength` if a larger value is attempted to be set.
@param historyLength The new length of the rolling history buffer.
@return The new value equal to the historyLength or the `maximumRollingHistoryLength`.
*/
-(int)setRollingHistoryLength:(int)historyLength;
//------------------------------------------------------------------------------
/**
Provides the length of the rolling history buffer (i.e. the number of points in the rolling plot's buffer).
* @return An int representing the length of the rolling history buffer
*/
-(int)rollingHistoryLength;
//------------------------------------------------------------------------------
#pragma mark - Subclass Methods
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Subclass Methods
///-----------------------------------------------------------
/**
Main method that handles converting the points created from the `updatedBuffer:withBufferSize:` method into a CGPathRef to store in the `waveformLayer`. In this method you can create any path you'd like using the point array (for instance, maybe mapping the points to a circle instead of the standard 2D plane).
@param points An array of CGPoint structures, with the x values ranging from 0 - (pointCount - 1) and y values containing the last audio data's buffer.
@param pointCount A UInt32 of the length of the point array.
@param rect An EZRect (CGRect on iOS or NSRect on OSX) that the path should be created relative to.
@return A CGPathRef that is the path you'd like to store on the `waveformLayer` to visualize the audio data.
*/
- (CGPathRef)createPathWithPoints:(CGPoint *)points
pointCount:(UInt32)pointCount
inRect:(EZRect)rect;
//------------------------------------------------------------------------------
/**
Provides the default length of the rolling history buffer when the plot is initialized. Default is `EZAudioPlotDefaultHistoryBufferLength` constant.
@return An int describing the initial length of the rolling history buffer.
*/
- (int)defaultRollingHistoryLength;
//------------------------------------------------------------------------------
/**
Provides the default number of points that will be used to initialize the graph's points data structure that holds. Essentially the plot starts off as a flat line of this many points. Default is 100.
@return An int describing the initial number of points the plot should have when flat lined.
*/
- (int)initialPointCount;
//------------------------------------------------------------------------------
/**
Provides the default maximum rolling history length - that is, the maximum amount of points the `setRollingHistoryLength:` method may be set to. If a length higher than this is set then the plot will likely crash because the appropriate resources are only allocated once during the plot's initialization step. Defualt is `EZAudioPlotDefaultMaxHistoryBufferLength` constant.
@return An int describing the maximum length of the absolute rolling history buffer.
*/
- (int)maximumRollingHistoryLength;
//------------------------------------------------------------------------------
/**
Method to cause the waveform layer's path to get recreated and redrawn on screen using the last buffer of data provided. This is the equivalent to the drawRect: method used to normally subclass a view's drawing. This normally don't need to be overrode though - a better approach would be to override the `createPathWithPoints:pointCount:inRect:` method.
*/
- (void)redraw;
//------------------------------------------------------------------------------
/**
Main method used to copy the sample data from the source buffer and update the
plot. Subclasses can overwrite this method for custom behavior.
@param data A float array of the sample data. Subclasses should copy this data to a separate array to avoid threading issues.
@param length The length of the float array as an int.
*/
-(void)setSampleData:(float *)data length:(int)length;
//------------------------------------------------------------------------------
@end
@@ -0,0 +1,221 @@
//
// EZAudioPlotGL.h
// EZAudio
//
// Created by Syed Haris Ali on 11/22/13.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <GLKit/GLKit.h>
#import "EZPlot.h"
#if !TARGET_OS_IPHONE
#import <OpenGL/OpenGL.h>
#endif
//------------------------------------------------------------------------------
#pragma mark - Data Structures
//------------------------------------------------------------------------------
typedef struct
{
GLfloat x;
GLfloat y;
} EZAudioPlotGLPoint;
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlotGL
//------------------------------------------------------------------------------
/**
EZAudioPlotGL is a subclass of either a GLKView on iOS or an NSOpenGLView on OSX. As of 0.6.0 this class no longer depends on an embedded GLKViewController for iOS as the display link is just manually managed within this single view instead. The EZAudioPlotGL provides the same kind of audio plot as the EZAudioPlot, but uses OpenGL to GPU-accelerate the drawing of the points, which means you can fit a lot more points and complex geometries.
*/
#if TARGET_OS_IPHONE
@interface EZAudioPlotGL : GLKView
#elif TARGET_OS_MAC
@interface EZAudioPlotGL : NSOpenGLView
#endif
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Customizing The Plot's Appearance
///-----------------------------------------------------------
/**
The default background color of the plot. For iOS the color is specified as a UIColor while for OSX the color is an NSColor. The default value on both platforms is a sweet looking green.
@warning On OSX, if you set the background to a value where the alpha component is 0 then the EZAudioPlotGL will automatically set its superview to be layer-backed.
*/
@property (nonatomic, strong) id backgroundColor;
//------------------------------------------------------------------------------
/**
The default color of the plot's data (i.e. waveform, y-axis values). For iOS the color is specified as a UIColor while for OSX the color is an NSColor. The default value on both platforms is white.
*/
@property (nonatomic, strong) id color;
//------------------------------------------------------------------------------
/**
The plot's gain value, which controls the scale of the y-axis values. The default value of the gain is 1.0f and should always be greater than 0.0f.
*/
@property (nonatomic, assign) float gain;
//------------------------------------------------------------------------------
/**
The type of plot as specified by the `EZPlotType` enumeration (i.e. a buffer or rolling plot type). Default is EZPlotTypeBuffer.
*/
@property (nonatomic, assign) EZPlotType plotType;
//------------------------------------------------------------------------------
/**
A BOOL indicating whether or not to fill in the graph. A value of YES will make a filled graph (filling in the space between the x-axis and the y-value), while a value of NO will create a stroked graph (connecting the points along the y-axis). Default is NO.
*/
@property (nonatomic, assign) BOOL shouldFill;
//------------------------------------------------------------------------------
/**
A boolean indicating whether the graph should be rotated along the x-axis to give a mirrored reflection. This is typical for audio plots to produce the classic waveform look. A value of YES will produce a mirrored reflection of the y-values about the x-axis, while a value of NO will only plot the y-values. Default is NO.
*/
@property (nonatomic, assign) BOOL shouldMirror;
//------------------------------------------------------------------------------
#pragma mark - Updating The Plot
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Updating The Plot
///-----------------------------------------------------------
/**
Updates the plot with the new buffer data and tells the view to redraw itself. Caller will provide a float array with the values they expect to see on the y-axis. The plot will internally handle mapping the x-axis and y-axis to the current view port, any interpolation for fills effects, and mirroring.
@param buffer A float array of values to map to the y-axis.
@param bufferSize The size of the float array that will be mapped to the y-axis.
*/
-(void)updateBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize;
//------------------------------------------------------------------------------
#pragma mark - Adjust Resolution
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Adjusting The Resolution
///-----------------------------------------------------------
/**
Sets the length of the rolling history buffer (i.e. the number of points in the rolling plot's buffer). Can grow or shrink the display up to the maximum size specified by the `maximumRollingHistoryLength` method. Will return the actual set value, which will be either the given value if smaller than the `maximumRollingHistoryLength` or `maximumRollingHistoryLength` if a larger value is attempted to be set.
@param historyLength The new length of the rolling history buffer.
@return The new value equal to the historyLength or the `maximumRollingHistoryLength`.
*/
-(int)setRollingHistoryLength:(int)historyLength;
//------------------------------------------------------------------------------
/**
Provides the length of the rolling history buffer (i.e. the number of points in the rolling plot's buffer).
* @return An int representing the length of the rolling history buffer
*/
-(int)rollingHistoryLength;
//------------------------------------------------------------------------------
#pragma mark - Clearing The Plot
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Clearing The Plot
///-----------------------------------------------------------
/**
Clears all data from the audio plot (includes both EZPlotTypeBuffer and EZPlotTypeRolling)
*/
-(void)clear;
//------------------------------------------------------------------------------
#pragma mark - Start/Stop Display Link
//------------------------------------------------------------------------------
/**
Call this method to tell the EZAudioDisplayLink to stop drawing temporarily.
*/
- (void)pauseDrawing;
//------------------------------------------------------------------------------
/**
Call this method to manually tell the EZAudioDisplayLink to start drawing again.
*/
- (void)resumeDrawing;
//------------------------------------------------------------------------------
#pragma mark - Subclass
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Customizing The Drawing
///-----------------------------------------------------------
/**
This method is used to perform the actual OpenGL drawing code to clear the background and draw the lines representing the 2D audio plot. Subclasses can use the current implementation as an example and implement their own custom geometries. This is the analogy of overriding the drawRect: method in an NSView or UIView.
@param points An array of EZAudioPlotGLPoint structures representing the mapped audio data to x,y coordinates. The x-axis goes from 0 to the number of points (pointCount) while the y-axis goes from -1 to 1. Check out the implementation of this method to see how the model view matrix of the base effect is transformed to map this properly to the viewport.
@param pointCount A UInt32 representing the number of points contained in the points array.
@param baseEffect An optional GLKBaseEffect to use as a default shader. Call prepareToDraw on the base effect before any glDrawArrays call.
@param vbo The Vertex Buffer Object used to buffer the point data.
@param vab The Vertex Array Buffer used to bind the Vertex Buffer Object. This is a Mac only thing, you can ignore this completely on iOS.
@param interpolated A BOOL indicating whether the data has been interpolated. This means the point data is twice as long, where every other point is 0 on the y-axis to allow drawing triangle stripes for filled in waveforms. Typically if the point data is interpolated you will be using the GL_TRIANGLE_STRIP drawing mode, while non-interpolated plots will just use a GL_LINE_STRIP drawing mode.
@param mirrored A BOOL indicating whether the plot should be mirrored about the y-axis (or whatever geometry you come up with).
@param gain A float representing a gain that should be used to influence the height or intensity of your geometry's shape. A gain of 0.0 means silence, a gain of 1.0 means full volume (you're welcome to boost this to whatever you want).
*/
- (void)redrawWithPoints:(EZAudioPlotGLPoint *)points
pointCount:(UInt32)pointCount
baseEffect:(GLKBaseEffect *)baseEffect
vertexBufferObject:(GLuint)vbo
vertexArrayBuffer:(GLuint)vab
interpolated:(BOOL)interpolated
mirrored:(BOOL)mirrored
gain:(float)gain;
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Subclass Methods
///-----------------------------------------------------------
/**
Provides the default length of the rolling history buffer when the plot is initialized. Default is `EZAudioPlotDefaultHistoryBufferLength` constant.
@return An int describing the initial length of the rolling history buffer.
*/
- (int)defaultRollingHistoryLength;
//------------------------------------------------------------------------------
/**
Provides the default maximum rolling history length - that is, the maximum amount of points the `setRollingHistoryLength:` method may be set to. If a length higher than this is set then the plot will likely crash because the appropriate resources are only allocated once during the plot's initialization step. Defualt is `EZAudioPlotDefaultMaxHistoryBufferLength` constant.
@return An int describing the maximum length of the absolute rolling history buffer.
*/
- (int)maximumRollingHistoryLength;
//------------------------------------------------------------------------------
@end
@@ -0,0 +1,532 @@
//
// EZAudioUtilities.h
// EZAudio
//
// Created by Syed Haris Ali on 6/23/15.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
#import <TargetConditionals.h>
#import "TPCircularBuffer.h"
#if TARGET_OS_IPHONE
#import <AVFoundation/AVFoundation.h>
#import <UIKit/UIKit.h>
#elif TARGET_OS_MAC
#import <AppKit/AppKit.h>
#endif
//------------------------------------------------------------------------------
#pragma mark - Data Structures
//------------------------------------------------------------------------------
/**
A data structure that holds information about audio data over time. It contains a circular buffer to incrementally write the audio data to and a scratch buffer to hold a window of audio data relative to the whole circular buffer. In use, this will provide a way to continuously append data while having an adjustable viewable window described by the bufferSize.
*/
typedef struct
{
float *buffer;
int bufferSize;
TPCircularBuffer circularBuffer;
} EZPlotHistoryInfo;
//------------------------------------------------------------------------------
/**
A data structure that holds information about a node in the context of an AUGraph.
*/
typedef struct
{
AudioUnit audioUnit;
AUNode node;
} EZAudioNodeInfo;
//------------------------------------------------------------------------------
#pragma mark - Types
//------------------------------------------------------------------------------
#if TARGET_OS_IPHONE
typedef CGRect EZRect;
#elif TARGET_OS_MAC
typedef NSRect EZRect;
#endif
//------------------------------------------------------------------------------
#pragma mark - EZAudioUtilities
//------------------------------------------------------------------------------
/**
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.
*/
@interface EZAudioUtilities : NSObject
//------------------------------------------------------------------------------
#pragma mark - Debugging
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Debugging EZAudio
///-----------------------------------------------------------
/**
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.
@param shouldExitOnCheckResultFail A BOOL indicating whether or not the running program should exist due to a `checkResult:operation:` fail.
*/
+ (void)setShouldExitOnCheckResultFail:(BOOL)shouldExitOnCheckResultFail;
//------------------------------------------------------------------------------
/**
Provides a flag indicating whether or not the program will exit if a `checkResult:operation:` fails.
@return A BOOL indicating whether or not the program will exit if a `checkResult:operation:` fails.
*/
+ (BOOL)shouldExitOnCheckResultFail;
//------------------------------------------------------------------------------
#pragma mark - AudioBufferList Utility
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name AudioBufferList Utility
///-----------------------------------------------------------
/**
Allocates an AudioBufferList structure. Make sure to call freeBufferList when done using AudioBufferList or it will leak.
@param frames The number of frames that will be stored within each audio buffer
@param channels The number of channels (e.g. 2 for stereo, 1 for mono, etc.)
@param 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 An AudioBufferList struct that has been allocated in memory
*/
+ (AudioBufferList *)audioBufferListWithNumberOfFrames:(UInt32)frames
numberOfChannels:(UInt32)channels
interleaved:(BOOL)interleaved;
//------------------------------------------------------------------------------
/**
Allocates an array of float arrays given the number of frames needed to store in each float array.
@param frames A UInt32 representing the number of frames to store in each float buffer
@param channels A UInt32 representing the number of channels (i.e. the number of float arrays to allocate)
@return An array of float arrays, each the length of the number of frames specified
*/
+ (float **)floatBuffersWithNumberOfFrames:(UInt32)frames
numberOfChannels:(UInt32)channels;
//------------------------------------------------------------------------------
/**
Deallocates an AudioBufferList structure from memory.
@param bufferList A pointer to the buffer list you would like to free
*/
+ (void)freeBufferList:(AudioBufferList *)bufferList;
//------------------------------------------------------------------------------
/**
Deallocates an array of float buffers
@param buffers An array of float arrays
@param channels A UInt32 representing the number of channels (i.e. the number of float arrays to deallocate)
*/
+ (void)freeFloatBuffers:(float **)buffers numberOfChannels:(UInt32)channels;
//------------------------------------------------------------------------------
#pragma mark - AudioStreamBasicDescription Utilties
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Creating An AudioStreamBasicDescription
///-----------------------------------------------------------
/**
Creates a signed-integer, interleaved AudioStreamBasicDescription for the number of channels specified for an AIFF format.
@param channels The desired number of channels
@param sampleRate A float representing the sample rate.
@return A new AudioStreamBasicDescription with the specified format.
*/
+ (AudioStreamBasicDescription)AIFFFormatWithNumberOfChannels:(UInt32)channels
sampleRate:(float)sampleRate;
//------------------------------------------------------------------------------
/**
Creates an AudioStreamBasicDescription for the iLBC narrow band speech codec.
@param sampleRate A float representing the sample rate.
@return A new AudioStreamBasicDescription with the specified format.
*/
+ (AudioStreamBasicDescription)iLBCFormatWithSampleRate:(float)sampleRate;
//------------------------------------------------------------------------------
/**
Creates a float-based, non-interleaved AudioStreamBasicDescription for the number of channels specified.
@param channels A UInt32 representing the number of channels.
@param sampleRate A float representing the sample rate.
@return A float-based AudioStreamBasicDescription with the number of channels specified.
*/
+ (AudioStreamBasicDescription)floatFormatWithNumberOfChannels:(UInt32)channels
sampleRate:(float)sampleRate;
//------------------------------------------------------------------------------
/**
Creates an AudioStreamBasicDescription for an M4A AAC format.
@param channels The desired number of channels
@param sampleRate A float representing the sample rate.
@return A new AudioStreamBasicDescription with the specified format.
*/
+ (AudioStreamBasicDescription)M4AFormatWithNumberOfChannels:(UInt32)channels
sampleRate:(float)sampleRate;
//------------------------------------------------------------------------------
/**
Creates a single-channel, float-based AudioStreamBasicDescription.
@param sampleRate A float representing the sample rate.
@return A new AudioStreamBasicDescription with the specified format.
*/
+ (AudioStreamBasicDescription)monoFloatFormatWithSampleRate:(float)sampleRate;
//------------------------------------------------------------------------------
/**
Creates a single-channel, float-based AudioStreamBasicDescription (as of 0.0.6 this is the same as `monoFloatFormatWithSampleRate:`).
@param sampleRate A float representing the sample rate.
@return A new AudioStreamBasicDescription with the specified format.
*/
+ (AudioStreamBasicDescription)monoCanonicalFormatWithSampleRate:(float)sampleRate;
//------------------------------------------------------------------------------
/**
Creates a two-channel, non-interleaved, float-based AudioStreamBasicDescription (as of 0.0.6 this is the same as `stereoFloatNonInterleavedFormatWithSampleRate:`).
@param sampleRate A float representing the sample rate.
@return A new AudioStreamBasicDescription with the specified format.
*/
+ (AudioStreamBasicDescription)stereoCanonicalNonInterleavedFormatWithSampleRate:(float)sampleRate;
//------------------------------------------------------------------------------
/**
Creates a two-channel, interleaved, float-based AudioStreamBasicDescription.
@param sampleRate A float representing the sample rate.
@return A new AudioStreamBasicDescription with the specified format.
*/
+ (AudioStreamBasicDescription)stereoFloatInterleavedFormatWithSampleRate:(float)sampleRate;
//------------------------------------------------------------------------------
/**
Creates a two-channel, non-interleaved, float-based AudioStreamBasicDescription.
@param sampleRate A float representing the sample rate.
@return A new AudioStreamBasicDescription with the specified format.
*/
+ (AudioStreamBasicDescription)stereoFloatNonInterleavedFormatWithSampleRate:(float)sameRate;
//------------------------------------------------------------------------------
// @name AudioStreamBasicDescription Helper Functions
//------------------------------------------------------------------------------
/**
Checks an AudioStreamBasicDescription to see if it is a float-based format (as opposed to a signed integer based format).
@param asbd A valid AudioStreamBasicDescription
@return A BOOL indicating whether or not the AudioStreamBasicDescription is a float format.
*/
+ (BOOL)isFloatFormat:(AudioStreamBasicDescription)asbd;
//------------------------------------------------------------------------------
/**
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
@param asbd A valid AudioStreamBasicDescription
@return A BOOL indicating whether or not the AudioStreamBasicDescription is interleaved
*/
+ (BOOL)isInterleaved:(AudioStreamBasicDescription)asbd;
//------------------------------------------------------------------------------
/**
Checks an AudioStreamBasicDescription to see if it is a linear PCM format (uncompressed,
1 frame per packet)
@param asbd A valid AudioStreamBasicDescription
@return A BOOL indicating whether or not the AudioStreamBasicDescription is linear PCM.
*/
+ (BOOL)isLinearPCM:(AudioStreamBasicDescription)asbd;
///-----------------------------------------------------------
/// @name AudioStreamBasicDescription Utilities
///-----------------------------------------------------------
/**
Nicely logs out the contents of an AudioStreamBasicDescription struct
@param asbd The AudioStreamBasicDescription struct with content to print out
*/
+ (void)printASBD:(AudioStreamBasicDescription)asbd;
//------------------------------------------------------------------------------
/**
Converts seconds into a string formatted as MM:SS
@param seconds An NSTimeInterval representing the number of seconds
@return An NSString instance formatted as MM:SS from the seconds provided.
*/
+ (NSString *)displayTimeStringFromSeconds:(NSTimeInterval)seconds;
//------------------------------------------------------------------------------
/**
Creates a string to use when logging out the contents of an AudioStreamBasicDescription
@param asbd A valid AudioStreamBasicDescription struct.
@return An NSString representing the contents of the AudioStreamBasicDescription.
*/
+ (NSString *)stringForAudioStreamBasicDescription:(AudioStreamBasicDescription)asbd;
//------------------------------------------------------------------------------
/**
Just a wrapper around the setCanonical function provided in the Core Audio Utility C++ class.
@param asbd The AudioStreamBasicDescription structure to modify
@param nChannels The number of expected channels on the description
@param interleaved A flag indicating whether the stereo samples should be interleaved in the buffer
*/
+ (void)setCanonicalAudioStreamBasicDescription:(AudioStreamBasicDescription*)asbd
numberOfChannels:(UInt32)nChannels
interleaved:(BOOL)interleaved;
//------------------------------------------------------------------------------
#pragma mark - Math Utilities
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Math Utilities
///-----------------------------------------------------------
/**
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.
@param buffer A float array of values to append to the tail of the history buffer
@param bufferLength The length of the float array being appended to the history buffer
@param scrollHistory The target history buffer in which to append the values
@param scrollHistoryLength The length of the target history buffer
*/
+ (void)appendBufferAndShift:(float*)buffer
withBufferSize:(int)bufferLength
toScrollHistory:(float*)scrollHistory
withScrollHistorySize:(int)scrollHistoryLength;
//------------------------------------------------------------------------------
/**
Appends a value to a history buffer and performs an internal shift to add the value to the tail and remove the 0th value.
@param value The float value to append to the history array
@param scrollHistory The target history buffer in which to append the values
@param scrollHistoryLength The length of the target history buffer
*/
+(void) appendValue:(float)value
toScrollHistory:(float*)scrollHistory
withScrollHistorySize:(int)scrollHistoryLength;
//------------------------------------------------------------------------------
/**
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.
@param value The value expressed in the first coordinate system
@param leftMin The minimum of the first coordinate system
@param leftMax The maximum of the first coordinate system
@param rightMin The minimum of the second coordindate system
@param rightMax The maximum of the second coordinate system
@return The mapped value in terms of the second coordinate system
*/
+ (float)MAP:(float)value
leftMin:(float)leftMin
leftMax:(float)leftMax
rightMin:(float)rightMin
rightMax:(float)rightMax;
//------------------------------------------------------------------------------
/**
Calculates the root mean squared for a buffer.
@param buffer A float buffer array of values whose root mean squared to calculate
@param bufferSize The size of the float buffer
@return The root mean squared of the buffer
*/
+ (float)RMS:(float*)buffer length:(int)bufferSize;
//------------------------------------------------------------------------------
/**
Calculate the sign function sgn(x) =
{ -1 , x < 0,
{ 0 , x = 0,
{ 1 , x > 0
@param value The float value for which to use as x
@return The float sign value
*/
+ (float)SGN:(float)value;
//------------------------------------------------------------------------------
#pragma mark - OSStatus Utility
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name OSStatus Utility
///-----------------------------------------------------------
/**
Basic check result function useful for checking each step of the audio setup process
@param result The OSStatus representing the result of an operation
@param operation A string (const char, not NSString) describing the operation taking place (will print if fails)
*/
+ (void)checkResult:(OSStatus)result operation:(const char *)operation;
//------------------------------------------------------------------------------
/**
Provides a string representation of the often cryptic Core Audio error codes
@param code A UInt32 representing an error code
@return An NSString with a human readable version of the error code.
*/
+ (NSString *)stringFromUInt32Code:(UInt32)code;
//------------------------------------------------------------------------------
#pragma mark - Color Utility
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Color Utility
///-----------------------------------------------------------
/**
Helper function to get the color components from a CGColorRef in the RGBA colorspace.
@param color A CGColorRef that represents a color.
@param red A pointer to a CGFloat to hold the value of the red component. This value will be between 0 and 1.
@param green A pointer to a CGFloat to hold the value of the green component. This value will be between 0 and 1.
@param blue A pointer to a CGFloat to hold the value of the blue component. This value will be between 0 and 1.
@param alpha A pointer to a CGFloat to hold the value of the alpha component. This value will be between 0 and 1.
*/
+ (void)getColorComponentsFromCGColor:(CGColorRef)color
red:(CGFloat *)red
green:(CGFloat *)green
blue:(CGFloat *)blue
alpha:(CGFloat *)alpha;
//------------------------------------------------------------------------------
#pragma mark - Plot Utility
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Plot Utility
///-----------------------------------------------------------
/**
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.
@param scrollHistory An array of float arrays being used to hold the history values for each channel.
@param scrollHistoryLength An int representing the length of the history window.
@param index An int pointer to the index of the current read index of the history buffer.
@param buffer A float array representing the incoming audio data.
@param bufferSize An int representing the length of the incoming audio data.
@param isChanging A BOOL pointer representing whether the resolution (length of the history window) is currently changing.
*/
+ (void)updateScrollHistory:(float **)scrollHistory
withLength:(int)scrollHistoryLength
atIndex:(int *)index
withBuffer:(float *)buffer
withBufferSize:(int)bufferSize
isResolutionChanging:(BOOL *)isChanging;
//------------------------------------------------------------------------------
#pragma mark - TPCircularBuffer Utility
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name TPCircularBuffer Utility
///-----------------------------------------------------------
/**
Appends the data from the audio buffer list to the circular buffer
@param circularBuffer Pointer to the instance of the TPCircularBuffer to add the audio data to
@param audioBufferList Pointer to the instance of the AudioBufferList with the audio data
*/
+ (void)appendDataToCircularBuffer:(TPCircularBuffer*)circularBuffer
fromAudioBufferList:(AudioBufferList*)audioBufferList;
//------------------------------------------------------------------------------
/**
Initializes the circular buffer (just a wrapper around the C method)
* @param circularBuffer Pointer to an instance of the TPCircularBuffer
* @param size The length of the TPCircularBuffer (usually 1024)
*/
+ (void)circularBuffer:(TPCircularBuffer*)circularBuffer
withSize:(int)size;
//------------------------------------------------------------------------------
/**
Frees a circular buffer
@param circularBuffer Pointer to the circular buffer to clear
*/
+ (void)freeCircularBuffer:(TPCircularBuffer*)circularBuffer;
//------------------------------------------------------------------------------
#pragma mark - EZPlotHistoryInfo Utility
//------------------------------------------------------------------------------
/**
Calculates the RMS of a float array containing audio data and appends it to the tail of a EZPlotHistoryInfo data structure. Thread-safe.
@param buffer A float array containing the incoming audio buffer to append to the history buffer
@param bufferSize A UInt32 representing the length of the incoming audio buffer
@param historyInfo A pointer to a EZPlotHistoryInfo structure to use for managing the history buffers
*/
+ (void)appendBuffer:(float *)buffer
withBufferSize:(UInt32)bufferSize
toHistoryInfo:(EZPlotHistoryInfo *)historyInfo;
//------------------------------------------------------------------------------
/**
Zeroes out a EZPlotHistoryInfo data structure without freeing the resources.
@param historyInfo A pointer to a EZPlotHistoryInfo data structure
*/
+ (void)clearHistoryInfo:(EZPlotHistoryInfo *)historyInfo;
//------------------------------------------------------------------------------
/**
Frees a EZPlotHistoryInfo data structure
@param historyInfo A pointer to a EZPlotHistoryInfo data structure
*/
+ (void)freeHistoryInfo:(EZPlotHistoryInfo *)historyInfo;
//------------------------------------------------------------------------------
/**
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.
@param defaultLength An int representing the default length (i.e. the number of points that will be displayed on screen) of the history window.
@param 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 A pointer to the EZPlotHistoryInfo created. The caller is responsible for freeing this structure using the `freeHistoryInfo` method above.
*/
+ (EZPlotHistoryInfo *)historyInfoWithDefaultLength:(int)defaultLength
maximumLength:(int)maximumLength;
//------------------------------------------------------------------------------
@end
@@ -0,0 +1,372 @@
//
// EZMicrophone.h
// EZAudio
//
// Created by Syed Haris Ali on 9/2/13.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
#import "TargetConditionals.h"
#import "EZAudioDevice.h"
#import "EZOutput.h"
@class EZMicrophone;
//------------------------------------------------------------------------------
#pragma mark - EZMicrophoneDelegate
//------------------------------------------------------------------------------
/**
The EZMicrophoneDelegate for the EZMicrophone provides a receiver for the incoming audio data events. When the microphone has been successfully internally configured it will try to send its delegate an AudioStreamBasicDescription describing the format of the incoming audio data.
The audio data itself is sent back to the delegate in various forms:
-`microphone:hasAudioReceived:withBufferSize:withNumberOfChannels:`
Provides float arrays instead of the AudioBufferList structure to hold the audio data. There could be a number of float arrays depending on the number of channels (see the function description below). These are useful for doing any visualizations that would like to make use of the raw audio data.
-`microphone:hasBufferList:withBufferSize:withNumberOfChannels:`
Provides the AudioBufferList structures holding the audio data. These are the native structures Core Audio uses to hold the buffer information and useful for piping out directly to an output (see EZOutput).
*/
@protocol EZMicrophoneDelegate <NSObject>
@optional
///-----------------------------------------------------------
/// @name Audio Data Description
///-----------------------------------------------------------
/**
Called anytime the input device changes on an `EZMicrophone` instance.
@param microphone The instance of the EZMicrophone that triggered the event.
@param device The instance of the new EZAudioDevice the microphone is using to pull input.
*/
- (void)microphone:(EZMicrophone *)microphone changedDevice:(EZAudioDevice *)device;
//------------------------------------------------------------------------------
/**
Returns back the audio stream basic description as soon as it has been initialized. This is guaranteed to occur before the stream callbacks, `microphone:hasBufferList:withBufferSize:withNumberOfChannels:` or `microphone:hasAudioReceived:withBufferSize:withNumberOfChannels:`
@param microphone The instance of the EZMicrophone that triggered the event.
@param audioStreamBasicDescription The AudioStreamBasicDescription that was created for the microphone instance.
*/
- (void) microphone:(EZMicrophone *)microphone
hasAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription;
///-----------------------------------------------------------
/// @name Audio Data Callbacks
///-----------------------------------------------------------
/**
This method provides an array of float arrays of the audio received, each float array representing a channel of audio data This occurs on the background thread so any drawing code must explicity perform its functions on the main thread.
@param microphone The instance of the EZMicrophone that triggered the event.
@param buffer The audio data as an array of float arrays. In a stereo signal buffer[0] represents the left channel while buffer[1] would represent the right channel.
@param bufferSize The size of each of the buffers (the length of each float array).
@param numberOfChannels The number of channels for the incoming audio.
@warning This function executes on a background thread to avoid blocking any audio operations. If operations should be performed on any other thread (like the main thread) it should be performed within a dispatch block like so: dispatch_async(dispatch_get_main_queue(), ^{ ...Your Code... })
*/
- (void) microphone:(EZMicrophone *)microphone
hasAudioReceived:(float **)buffer
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels;
//------------------------------------------------------------------------------
/**
Returns back the buffer list containing the audio received. This occurs on the background thread so any drawing code must explicity perform its functions on the main thread.
@param microphone The instance of the EZMicrophone that triggered the event.
@param bufferList The AudioBufferList holding the audio data.
@param bufferSize The size of each of the buffers of the AudioBufferList.
@param numberOfChannels The number of channels for the incoming audio.
@warning This function executes on a background thread to avoid blocking any audio operations. If operations should be performed on any other thread (like the main thread) it should be performed within a dispatch block like so: dispatch_async(dispatch_get_main_queue(), ^{ ...Your Code... })
*/
- (void) microphone:(EZMicrophone *)microphone
hasBufferList:(AudioBufferList *)bufferList
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels;
@end
//------------------------------------------------------------------------------
#pragma mark - EZMicrophone
//------------------------------------------------------------------------------
/**
The EZMicrophone provides a component to get audio data from the default device microphone. On OSX this is the default selected input device in the system preferences while on iOS this defaults to use the default RemoteIO audio unit. The microphone data is converted to a float buffer array and returned back to the caller via the EZMicrophoneDelegate protocol.
*/
@interface EZMicrophone : NSObject <EZOutputDataSource>
//------------------------------------------------------------------------------
/**
The EZMicrophoneDelegate for which to handle the microphone callbacks
*/
@property (nonatomic, weak) id<EZMicrophoneDelegate> delegate;
//------------------------------------------------------------------------------
/**
The EZAudioDevice being used to pull the microphone data.
- On iOS this can be any of the available microphones on the iPhone/iPad devices (usually there are 3). Defaults to the first microphone found (bottom mic)
- On OSX this can be any of the plugged in devices that Core Audio can detect (see kAudioUnitSubType_HALOutput for more information)
System Preferences -> Sound for the available inputs)
*/
@property (nonatomic, strong) EZAudioDevice *device;
//------------------------------------------------------------------------------
/**
A BOOL describing whether the microphone is on and passing back audio data to its delegate.
*/
@property (nonatomic, assign) BOOL microphoneOn;
//------------------------------------------------------------------------------
/**
An EZOutput to use for porting the microphone input out (passthrough).
*/
@property (nonatomic, strong) EZOutput *output;
//------------------------------------------------------------------------------
#pragma mark - Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Initializers
///-----------------------------------------------------------
/**
Creates an instance of the EZMicrophone with a delegate to respond to the audioReceived callback. This will not start fetching the audio until startFetchingAudio has been called. Use initWithMicrophoneDelegate:startsImmediately: to instantiate this class and immediately start fetching audio data.
@param delegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
@return An instance of the EZMicrophone class. This should be strongly retained.
*/
- (EZMicrophone *)initWithMicrophoneDelegate:(id<EZMicrophoneDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Creates an instance of the EZMicrophone with a custom AudioStreamBasicDescription and provides the caller to specify a delegate to respond to the audioReceived callback. This will not start fetching the audio until startFetchingAudio has been called. Use initWithMicrophoneDelegate:startsImmediately: to instantiate this class and immediately start fetching audio data.
@param microphoneDelegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
@param audioStreamBasicDescription A custom AudioStreamBasicFormat for the microphone input.
@return An instance of the EZMicrophone class. This should be strongly retained.
*/
-(EZMicrophone *)initWithMicrophoneDelegate:(id<EZMicrophoneDelegate>)delegate
withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription;
//------------------------------------------------------------------------------
/**
Creates an instance of the EZMicrophone with a delegate to respond to the audioReceived callback and allows the caller to specify whether they'd immediately like to start fetching the audio data.
@param delegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
@param startsImmediately A boolean indicating whether to start fetching the data immediately. IF YES, the delegate's audioReceived callback will immediately start getting called.
@return An instance of the EZMicrophone class. This should be strongly retained.
*/
- (EZMicrophone *)initWithMicrophoneDelegate:(id<EZMicrophoneDelegate>)delegate
startsImmediately:(BOOL)startsImmediately;
//------------------------------------------------------------------------------
/**
Creates an instance of the EZMicrophone with a custom AudioStreamBasicDescription and provides the caller with a delegate to respond to the audioReceived callback and allows the caller to specify whether they'd immediately like to start fetching the audio data.
@param delegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
@param audioStreamBasicDescription A custom AudioStreamBasicFormat for the microphone input.
@param startsImmediately A boolean indicating whether to start fetching the data immediately. IF YES, the delegate's audioReceived callback will immediately start getting called.
@return An instance of the EZMicrophone class. This should be strongly retained.
*/
- (EZMicrophone *)initWithMicrophoneDelegate:(id<EZMicrophoneDelegate>)delegate
withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription
startsImmediately:(BOOL)startsImmediately;
//------------------------------------------------------------------------------
#pragma mark - Class Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Class Initializers
///-----------------------------------------------------------
/**
Creates an instance of the EZMicrophone with a delegate to respond to the audioReceived callback. This will not start fetching the audio until startFetchingAudio has been called. Use microphoneWithDelegate:startsImmediately: to instantiate this class and immediately start fetching audio data.
@param delegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
@return An instance of the EZMicrophone class. This should be declared as a strong property!
*/
+ (EZMicrophone *)microphoneWithDelegate:(id<EZMicrophoneDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Creates an instance of the EZMicrophone with a delegate to respond to the audioReceived callback. This will not start fetching the audio until startFetchingAudio has been called. Use microphoneWithDelegate:startsImmediately: to instantiate this class and immediately start fetching audio data.
@param delegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
@param audioStreamBasicDescription A custom AudioStreamBasicFormat for the microphone input.
@return An instance of the EZMicrophone class. This should be declared as a strong property!
*/
+ (EZMicrophone *)microphoneWithDelegate:(id<EZMicrophoneDelegate>)delegate
withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription;
//------------------------------------------------------------------------------
/**
Creates an instance of the EZMicrophone with a delegate to respond to the audioReceived callback and allows the caller to specify whether they'd immediately like to start fetching the audio data.
@param microphoneDelegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
@param startsImmediately A boolean indicating whether to start fetching the data immediately. IF YES, the delegate's audioReceived callback will immediately start getting called.
@return An instance of the EZMicrophone class. This should be strongly retained.
*/
+ (EZMicrophone *)microphoneWithDelegate:(id<EZMicrophoneDelegate>)delegate
startsImmediately:(BOOL)startsImmediately;
//------------------------------------------------------------------------------
/**
Creates an instance of the EZMicrophone with a delegate to respond to the audioReceived callback and allows the caller to specify whether they'd immediately like to start fetching the audio data.
@param microphoneDelegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
@param audioStreamBasicDescription A custom AudioStreamBasicFormat for the microphone input.
@param startsImmediately A boolean indicating whether to start fetching the data immediately. IF YES, the delegate's audioReceived callback will immediately start getting called.
@return An instance of the EZMicrophone class. This should be strongly retained.
*/
+ (EZMicrophone *)microphoneWithDelegate:(id<EZMicrophoneDelegate>)delegate
withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription
startsImmediately:(BOOL)startsImmediately;
//------------------------------------------------------------------------------
#pragma mark - Shared Instance
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Shared Instance
///-----------------------------------------------------------
/**
A shared instance of the microphone component. Most applications will only need to use one instance of the microphone component across multiple views. Make sure to call the `startFetchingAudio` method to receive the audio data in the microphone delegate.
@return A shared instance of the `EZAudioMicrophone` component.
*/
+ (EZMicrophone *)sharedMicrophone;
//------------------------------------------------------------------------------
#pragma mark - Events
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Starting/Stopping The Microphone
///-----------------------------------------------------------
/**
Starts fetching audio from the default microphone. Will notify delegate with audioReceived callback.
*/
- (void)startFetchingAudio;
//------------------------------------------------------------------------------
/**
Stops fetching audio. Will stop notifying the delegate's audioReceived callback.
*/
- (void)stopFetchingAudio;
//------------------------------------------------------------------------------
#pragma mark - Getters
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Getting The Microphone's Audio Format
///-----------------------------------------------------------
/**
Provides the AudioStreamBasicDescription structure containing the format of the microphone's audio.
@return An AudioStreamBasicDescription structure describing the format of the microphone's audio.
*/
- (AudioStreamBasicDescription)audioStreamBasicDescription;
//------------------------------------------------------------------------------
/**
Provides the underlying Audio Unit that is being used to fetch the audio.
@return The AudioUnit used for the microphone
*/
- (AudioUnit *)audioUnit;
//------------------------------------------------------------------------------
#pragma mark - Setters
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Customizing The Microphone Stream Format
///-----------------------------------------------------------
/**
Sets the AudioStreamBasicDescription on the microphone input. Must be linear PCM and must be the same sample rate as the stream format coming in (check the current `audioStreamBasicDescription` before setting).
@warning Do not set this while fetching audio (startFetchingAudio)
@param asbd The new AudioStreamBasicDescription to use in place of the current audio format description.
*/
- (void)setAudioStreamBasicDescription:(AudioStreamBasicDescription)asbd;
///-----------------------------------------------------------
/// @name Setting The Microphone's Hardware Device
///-----------------------------------------------------------
/**
Sets the EZAudioDevice being used to pull the microphone data.
- On iOS this can be any of the available microphones on the iPhone/iPad devices (usually there are 3). Defaults to the first microphone found (bottom mic)
- On OSX this can be any of the plugged in devices that Core Audio can detect (see kAudioUnitSubType_HALOutput for more information)
System Preferences -> Sound for the available inputs)
@param device An EZAudioDevice instance that should be used to fetch the microphone data.
*/
- (void)setDevice:(EZAudioDevice *)device;
//------------------------------------------------------------------------------
#pragma mark - Direct Output
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Setting The Microphone's Output (Direct Out)
///-----------------------------------------------------------
/**
When set this will pipe out the contents of the microphone into an EZOutput. This is known as a passthrough or direct out that will simply pipe the microphone input to an output.
@param output An EZOutput instance that the microphone will use to output its audio data to the speaker.
*/
- (void)setOutput:(EZOutput *)output;
//------------------------------------------------------------------------------
#pragma mark - Subclass Methods
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Subclass
///-----------------------------------------------------------
/**
The default AudioStreamBasicDescription set as the stream format of the microphone if no custom description is set. Defaults to a non-interleaved float format with the number of channels specified by the `numberOfChannels` method.
@return An AudioStreamBasicDescription that will be used as the default stream format.
*/
- (AudioStreamBasicDescription)defaultStreamFormat;
//------------------------------------------------------------------------------
/**
The number of channels the input microphone is expected to have. Defaults to 1 (assumes microphone is mono).
@return A UInt32 representing the number of channels expected for the microphone.
*/
- (UInt32)numberOfChannels;
//------------------------------------------------------------------------------
@end
@@ -0,0 +1,376 @@
//
// EZOutput.h
// EZAudio
//
// Created by Syed Haris Ali on 12/2/13.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
#if TARGET_OS_IPHONE
#elif TARGET_OS_MAC
#import <AudioUnit/AudioUnit.h>
#endif
@class EZAudioDevice;
@class EZOutput;
//------------------------------------------------------------------------------
#pragma mark - Constants
//------------------------------------------------------------------------------
FOUNDATION_EXPORT UInt32 const EZOutputMaximumFramesPerSlice;
FOUNDATION_EXPORT Float64 const EZOutputDefaultSampleRate;
//------------------------------------------------------------------------------
#pragma mark - EZOutputDataSource
//------------------------------------------------------------------------------
/**
The EZOutputDataSource specifies a receiver to provide audio data when the EZOutput is started. Since the 0.4.0 release this has been simplified to only one data source method.
*/
@protocol EZOutputDataSource <NSObject>
@optional
///-----------------------------------------------------------
/// @name Providing Audio Data
///-----------------------------------------------------------
@required
/**
Provides a way to provide output with data anytime the EZOutput needs audio data to play. This function provides an already allocated AudioBufferList to use for providing audio data into the output buffer. The expected format of the audio data provided here is specified by the EZOutput `inputFormat` property. This audio data will be converted into the client format specified by the EZOutput `clientFormat` property.
@param output The instance of the EZOutput that asked for the data.
@param audioBufferList The AudioBufferList structure pointer that needs to be filled with audio data
@param frames The amount of frames as a UInt32 that output will need to properly fill its output buffer.
@param timestamp A AudioTimeStamp pointer to use if you need the current host time.
@return An OSStatus code. If there was no error then use the noErr status code.
*/
- (OSStatus) output:(EZOutput *)output
shouldFillAudioBufferList:(AudioBufferList *)audioBufferList
withNumberOfFrames:(UInt32)frames
timestamp:(const AudioTimeStamp *)timestamp;
@end
//------------------------------------------------------------------------------
#pragma mark - EZOutputDelegate
//------------------------------------------------------------------------------
/**
The EZOutputDelegate for the EZOutput component provides a receiver to handle play state, device, and audio data change events. This is very similar to the EZMicrophoneDelegate for the EZMicrophone and the EZAudioFileDelegate for the EZAudioFile.
*/
@protocol EZOutputDelegate <NSObject>
@optional
/**
Called anytime the EZOutput starts or stops.
@param output The instance of the EZOutput that triggered the event.
@param isPlaying A BOOL indicating whether the EZOutput instance is playing or not.
*/
- (void)output:(EZOutput *)output changedPlayingState:(BOOL)isPlaying;
//------------------------------------------------------------------------------
/**
Called anytime the `device` changes on an EZOutput instance.
@param output The instance of the EZOutput that triggered the event.
@param device The instance of the new EZAudioDevice the output is using to play audio data.
*/
- (void)output:(EZOutput *)output changedDevice:(EZAudioDevice *)device;
//------------------------------------------------------------------------------
/**
Like the EZMicrophoneDelegate, for the EZOutput this method provides an array of float arrays of the audio received, each float array representing a channel of audio data. This occurs on the background thread so any drawing code must explicity perform its functions on the main thread.
@param output The instance of the EZOutput that triggered the event.
@param buffer The audio data as an array of float arrays. In a stereo signal buffer[0] represents the left channel while buffer[1] would represent the right channel.
@param bufferSize A UInt32 representing the size of each of the buffers (the length of each float array).
@param numberOfChannels A UInt32 representing the number of channels (you can use this to know how many float arrays are in the `buffer` parameter.
@warning This function executes on a background thread to avoid blocking any audio operations. If operations should be performed on any other thread (like the main thread) it should be performed within a dispatch block like so: dispatch_async(dispatch_get_main_queue(), ^{ ...Your Code... })
*/
- (void) output:(EZOutput *)output
playedAudio:(float **)buffer
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels;
//------------------------------------------------------------------------------
@end
/**
The EZOutput component provides a generic output to glue all the other EZAudio components together and push whatever sound you've created to the default output device (think opposite of the microphone). The EZOutputDataSource provides the required AudioBufferList needed to populate the output buffer while the EZOutputDelegate provides the same kind of mechanism as the EZMicrophoneDelegate or EZAudioFileDelegate in that you will receive a callback that provides non-interleaved, float data for visualizing the output (done using an internal float converter). As of 0.4.0 the EZOutput has been simplified to a single EZOutputDataSource method and now uses an AUGraph to provide format conversion from the `inputFormat` to the playback graph's `clientFormat` linear PCM formats, mixer controls for setting volume and pan settings, hooks to add in any number of effect audio units (see the `connectOutputOfSourceNode:sourceNodeOutputBus:toDestinationNode:destinationNodeInputBus:inGraph:` subclass method), and hardware device toggling (via EZAudioDevice).
*/
@interface EZOutput : NSObject
//------------------------------------------------------------------------------
#pragma mark - Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Initializers
///-----------------------------------------------------------
/**
Creates a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
@param dataSource The EZOutputDataSource that will be used to pull the audio data for the output callback.
@return A newly created instance of the EZOutput class.
*/
- (instancetype)initWithDataSource:(id<EZOutputDataSource>)dataSource;
/**
Creates a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
@param dataSource The EZOutputDataSource that will be used to pull the audio data for the output callback.
@param inputFormat The AudioStreamBasicDescription of the EZOutput.
@warning AudioStreamBasicDescription input formats must be linear PCM!
@return A newly created instance of the EZOutput class.
*/
- (instancetype)initWithDataSource:(id<EZOutputDataSource>)dataSource
inputFormat:(AudioStreamBasicDescription)inputFormat;
//------------------------------------------------------------------------------
#pragma mark - Class Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Class Initializers
///-----------------------------------------------------------
/**
Class method to create a new instance of the EZOutput
@return A newly created instance of the EZOutput class.
*/
+ (instancetype)output;
/**
Class method to create a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
@param dataSource The EZOutputDataSource that will be used to pull the audio data for the output callback.
@return A newly created instance of the EZOutput class.
*/
+ (instancetype)outputWithDataSource:(id<EZOutputDataSource>)dataSource;
/**
Class method to create a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
@param dataSource The EZOutputDataSource that will be used to pull the audio data for the output callback.
@param audioStreamBasicDescription The AudioStreamBasicDescription of the EZOutput.
@warning AudioStreamBasicDescriptions that are invalid will cause the EZOutput to fail to initialize
@return A newly created instance of the EZOutput class.
*/
+ (instancetype)outputWithDataSource:(id<EZOutputDataSource>)dataSource
inputFormat:(AudioStreamBasicDescription)inputFormat;
//------------------------------------------------------------------------------
#pragma mark - Singleton
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Shared Instance
///-----------------------------------------------------------
/**
Creates a shared instance of the EZOutput (one app will usually only need one output and share the role of the EZOutputDataSource).
@return The shared instance of the EZOutput class.
*/
+ (instancetype)sharedOutput;
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Setting/Getting The Stream Formats
///-----------------------------------------------------------
/**
Provides the AudioStreamBasicDescription structure used at the beginning of the playback graph which is then converted into the `clientFormat` using the AUConverter audio unit.
@warning The AudioStreamBasicDescription set here must be linear PCM. Compressed formats are not supported...the EZAudioFile's clientFormat performs the audio conversion on the fly from compressed to linear PCM so there is no additional work to be done there.
@return An AudioStreamBasicDescription structure describing
*/
@property (nonatomic, readwrite) AudioStreamBasicDescription inputFormat;
//------------------------------------------------------------------------------
/**
Provides the AudioStreamBasicDescription structure that serves as the common format used throughout the playback graph (similar to how the EZAudioFile as a clientFormat that is linear PCM to be shared amongst other components). The `inputFormat` is converted into this format at the beginning of the playback graph using an AUConverter audio unit. Defaults to the whatever the `defaultClientFormat` method returns is if a custom one isn't explicitly set.
@warning The AudioStreamBasicDescription set here must be linear PCM. Compressed formats are not supported by Audio Units.
@return An AudioStreamBasicDescription structure describing the common client format for the playback graph.
*/
@property (nonatomic, readwrite) AudioStreamBasicDescription clientFormat;
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Setting/Getting The Data Source and Delegate
///-----------------------------------------------------------
/**
The EZOutputDataSource that provides the audio data in the `inputFormat` for the EZOutput to play. If an EZOutputDataSource is not specified then the EZOutput will just output silence.
*/
@property (nonatomic, weak) id<EZOutputDataSource> dataSource;
//------------------------------------------------------------------------------
/**
The EZOutputDelegate for which to handle the output callbacks
*/
@property (nonatomic, weak) id<EZOutputDelegate> delegate;
//------------------------------------------------------------------------------
/**
Provides a flag indicating whether the EZOutput is pulling audio data from the EZOutputDataSource for playback.
@return YES if the EZOutput is running, NO if it is stopped
*/
@property (readonly) BOOL isPlaying;
//------------------------------------------------------------------------------
/**
Provides the current pan from the audio player's mixer audio unit in the playback graph. Setting the pan adjusts the direction of the audio signal from left (0) to right (1). Default is 0.5 (middle).
*/
@property (nonatomic, assign) float pan;
//------------------------------------------------------------------------------
/**
Provides the current volume from the audio player's mixer audio unit in the playback graph. Setting the volume adjusts the gain of the output between 0 and 1. Default is 1.
*/
@property (nonatomic, assign) float volume;
//------------------------------------------------------------------------------
#pragma mark - Core Audio Properties
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Core Audio Properties
///-----------------------------------------------------------
/**
The AUGraph used to chain together the converter, mixer, and output audio units.
*/
@property (readonly) AUGraph graph;
//------------------------------------------------------------------------------
/**
The AudioUnit that is being used to convert the audio data coming into the output's playback graph.
*/
@property (readonly) AudioUnit converterAudioUnit;
//------------------------------------------------------------------------------
/**
The AudioUnit that is being used as the mixer to adjust the volume on the output's playback graph.
*/
@property (readonly) AudioUnit mixerAudioUnit;
//------------------------------------------------------------------------------
/**
The AudioUnit that is being used as the hardware output for the output's playback graph.
*/
@property (readonly) AudioUnit outputAudioUnit;
//------------------------------------------------------------------------------
#pragma mark - Setters
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Getting/Setting The Output's Hardware Device
///-----------------------------------------------------------
/**
An EZAudioDevice instance that is used to route the audio data out to the speaker. To find a list of available output devices see the EZAudioDevice `outputDevices` method.
*/
@property (nonatomic, strong, readwrite) EZAudioDevice *device;
//------------------------------------------------------------------------------
#pragma mark - Actions
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Starting/Stopping The Output
///-----------------------------------------------------------
/**
Starts pulling audio data from the EZOutputDataSource to the default device output.
*/
- (void)startPlayback;
///-----------------------------------------------------------
/**
Stops pulling audio data from the EZOutputDataSource to the default device output.
*/
- (void)stopPlayback;
//------------------------------------------------------------------------------
#pragma mark - Subclass
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Subclass
///-----------------------------------------------------------
/**
This method handles connecting the converter node to the mixer node within the AUGraph that is being used as the playback graph. Subclasses can override this method and insert their custom nodes to perform effects processing on the audio data being rendered.
This was inspired by Daniel Kennett's blog post on how to add a custom equalizer to a CocoaLibSpotify SPCoreAudioController's AUGraph. For more information see Daniel's post and example code here: http://ikennd.ac/blog/2012/04/augraph-basics-in-cocoalibspotify/.
@param sourceNode An AUNode representing the node the audio data is coming from.
@param sourceNodeOutputBus A UInt32 representing the output bus from the source node that should be connected into the next node's input bus.
@param destinationNode An AUNode representing the node the audio data should be connected to.
@param destinationNodeInputBus A UInt32 representing the input bus the source node's output bus should be connecting to.
@param graph The AUGraph that is being used to hold the playback graph. Same as from the `graph` property.
@return An OSStatus code. For no error return back `noErr`.
*/
- (OSStatus)connectOutputOfSourceNode:(AUNode)sourceNode
sourceNodeOutputBus:(UInt32)sourceNodeOutputBus
toDestinationNode:(AUNode)destinationNode
destinationNodeInputBus:(UInt32)destinationNodeInputBus
inGraph:(AUGraph)graph;
//------------------------------------------------------------------------------
/**
The default AudioStreamBasicDescription set as the client format of the output if no custom `clientFormat` is set. Defaults to a 44.1 kHz stereo, non-interleaved, float format.
@return An AudioStreamBasicDescription that will be used as the default stream format.
*/
- (AudioStreamBasicDescription)defaultClientFormat;
//------------------------------------------------------------------------------
/**
The default AudioStreamBasicDescription set as the `inputFormat` of the output if no custom `inputFormat` is set. Defaults to a 44.1 kHz stereo, non-interleaved, float format.
@return An AudioStreamBasicDescription that will be used as the default stream format.
*/
- (AudioStreamBasicDescription)defaultInputFormat;
//------------------------------------------------------------------------------
/**
The default value used as the AudioUnit subtype when creating the hardware output component. By default this is kAudioUnitSubType_RemoteIO for iOS and kAudioUnitSubType_HALOutput for OSX.
@warning If you change this to anything other than kAudioUnitSubType_HALOutput for OSX you will get a failed assertion because devices can only be set when using the HAL audio unit.
@return An OSType that represents the AudioUnit subtype for the hardware output component.
*/
- (OSType)outputAudioUnitSubType;
@end
@@ -1,9 +1,9 @@
//
// EZAudioPlotGLKViewController.h
// EZPlot.h
// EZAudio
//
// Created by Syed Haris Ali on 11/22/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
// Created by Syed Haris Ali on 11/24/13.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -23,47 +23,64 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "TargetConditionals.h"
#import <Foundation/Foundation.h>
#import "EZAudioUtilities.h"
#if TARGET_OS_IPHONE
//------------------------------------------------------------------------------
#pragma mark - Enumerations
//------------------------------------------------------------------------------
#import "EZAudioPlotGL.h"
@class EZAudio;
///-----------------------------------------------------------
/// @name Plot Types
///-----------------------------------------------------------
/**
EZAudioPlotGLKViewController is a subclass of the GLKViewController and handles the OpenGL drawing routine for iOS OpenGL ES views. This class has not been used outside the scope of the EZAudioPlotGL, but should be safe to use by itself if the intended use case is to have a view controller take up the whole screen.
The types of plots that can be displayed in the view using the data.
*/
@interface EZAudioPlotGLKViewController : GLKViewController
typedef NS_ENUM(NSInteger, EZPlotType)
{
/**
Plot that displays only the samples of the current buffer
*/
EZPlotTypeBuffer,
/**
Plot that displays a rolling history of values using the RMS calculated for each incoming buffer
*/
EZPlotTypeRolling
};
/**
EZPlot is a cross-platform (iOS and OSX) class used to subclass the default view type (either UIView or NSView, respectively).
## Subclassing Notes
This class isn't meant to be directly used in practice, but instead establishes the default properties and behaviors subclasses should obey to provide consistent behavior accross multiple types of graphs (i.e. set background color, plot type, should fill in, etc.). Subclasses should make use of the inherited properties from this class to allow all child plots to benefit from the same
*/
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
@interface EZPlot : UIView
#elif TARGET_OS_MAC
#import <Cocoa/Cocoa.h>
@interface EZPlot : NSView
#endif
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Customizing The Plot's Appearance
///-----------------------------------------------------------
/**
The default background color of the plot. For iOS the color is specified as a UIColor while for OSX the color is an NSColor. The default value on both platforms is black.
*/
@property (nonatomic,strong) UIColor *backgroundColor;
/**
The default shader to use to fill the graph.
*/
@property (nonatomic,strong) GLKBaseEffect *baseEffect;
@property (nonatomic,strong) id backgroundColor;
/**
The default color of the plot's data (i.e. waveform, y-axis values). For iOS the color is specified as a UIColor while for OSX the color is an NSColor. The default value on both platforms is red.
*/
@property (nonatomic,strong) UIColor *color;
/**
The OpenGL ES context (EAGLContext) in which to perform the drawing
*/
@property (nonatomic,strong) EAGLContext *context;
/**
The EZAudioPlotGLDrawType specifying which OpenGL primitive to use for drawing (either line strip for stroke and no fill or triangle strip for fill)
*/
@property (nonatomic,assign) EZAudioPlotGLDrawType drawingType;
@property (nonatomic,strong) id color;
/**
The plot's gain value, which controls the scale of the y-axis values. The default value of the gain is 1.0f and should always be greater than 0.0f.
@@ -75,30 +92,20 @@
*/
@property (nonatomic,assign,setter=setPlotType:) EZPlotType plotType;
/**
A boolean indicating whether or not to fill in the graph. A value of YES will make a filled graph (filling in the space between the x-axis and the y-value), while a value of NO will create a stroked graph (connecting the points along the y-axis).
*/
@property (nonatomic,assign,setter=setShouldFill:) BOOL shouldFill;
/**
A boolean indicating whether the graph should be rotated along the x-axis to give a mirrored reflection. This is typical for audio plots to produce the classic waveform look. A value of YES will produce a mirrored reflection of the y-values about the x-axis, while a value of NO will only plot the y-values.
*/
@property (nonatomic,assign,setter=setShouldMirror:) BOOL shouldMirror;
#pragma mark - Adjust Resolution
///-----------------------------------------------------------
/// @name Adjusting The Resolution
///-----------------------------------------------------------
/**
Sets the length of the rolling history display. Can grow or shrink the display up to the maximum size specified by the kEZAudioPlotMaxHistoryBufferLength macro. Will return the actual set value, which will be either the given value if smaller than the kEZAudioPlotMaxHistoryBufferLength or kEZAudioPlotMaxHistoryBufferLength if a larger value is attempted to be set.
@param historyLength The new length of the rolling history buffer.
@return The new value equal to the historyLength or the kEZAudioPlotMaxHistoryBufferLength.
*/
-(int)setRollingHistoryLength:(int)historyLength;
/**
Provides the length of the rolling history buffer
* @return An int representing the length of the rolling history buffer
*/
-(int)rollingHistoryLength;
//------------------------------------------------------------------------------
#pragma mark - Clearing
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Clearing The Plot
///-----------------------------------------------------------
@@ -108,10 +115,14 @@
*/
-(void)clear;
//------------------------------------------------------------------------------
#pragma mark - Get Samples
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Updating The Plot
///-----------------------------------------------------------
/**
Updates the plot with the new buffer data and tells the view to redraw itself. Caller will provide a float array with the values they expect to see on the y-axis. The plot will internally handle mapping the x-axis and y-axis to the current view port, any interpolation for fills effects, and mirroring.
@param buffer A float array of values to map to the y-axis.
@@ -122,6 +133,3 @@
withBufferSize:(UInt32)bufferSize;
@end
#elif TARGET_OS_MAC
#endif
@@ -0,0 +1,123 @@
//
// EZRecorder.h
// EZAudio
//
// Created by Syed Haris Ali on 12/1/13.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
/**
To ensure valid recording formats are used when recording to a file the EZRecorderFileType describes the most common file types that a file can be encoded in. Each of these types can be used to output recordings as such:
EZRecorderFileTypeAIFF - .aif, .aiff, .aifc, .aac
EZRecorderFileTypeM4A - .m4a, .mp4
EZRecorderFileTypeWAV - .wav
*/
typedef NS_ENUM(NSInteger, EZRecorderFileType)
{
/**
Recording format that describes AIFF file types. These are uncompressed, LPCM files that are completely lossless, but are large in file size.
*/
EZRecorderFileTypeAIFF,
/**
Recording format that describes M4A file types. These are compressed, but yield great results especially when file size is an issue.
*/
EZRecorderFileTypeM4A,
/**
Recording format that describes WAV file types. These are uncompressed, LPCM files that are completely lossless, but are large in file size.
*/
EZRecorderFileTypeWAV
};
/**
The EZRecorder provides a flexible way to create an audio file and append raw audio data to it. The EZRecorder will convert the incoming audio on the fly to the destination format so no conversion is needed between this and any other component. Right now the only supported output format is 'caf'. Each output file should have its own EZRecorder instance (think 1 EZRecorder = 1 audio file).
*/
@interface EZRecorder : NSObject
#pragma mark - Initializers
///-----------------------------------------------------------
/// @name Initializers
///-----------------------------------------------------------
/**
Creates a new instance of an EZRecorder using a destination file path URL and the source format of the incoming audio.
@param url An NSURL specifying the file path location of where the audio file should be written to.
@param sourceFormat The AudioStreamBasicDescription for the incoming audio that will be written to the file.
@param destinationFileType A constant described by the EZRecorderFileType that corresponds to the type of destination file that should be written. For instance, an AAC file written using an '.m4a' extension would correspond to EZRecorderFileTypeM4A. See EZRecorderFileType for all the constants and mapping combinations.
@return The newly created EZRecorder instance.
*/
-(EZRecorder*)initWithDestinationURL:(NSURL*)url
sourceFormat:(AudioStreamBasicDescription)sourceFormat
destinationFileType:(EZRecorderFileType)destinationFileType;
#pragma mark - Class Initializers
///-----------------------------------------------------------
/// @name Class Initializers
///-----------------------------------------------------------
/**
Class method to create a new instance of an EZRecorder using a destination file path URL and the source format of the incoming audio.
@param url An NSURL specifying the file path location of where the audio file should be written to.
@param sourceFormat The AudioStreamBasicDescription for the incoming audio that will be written to the file.
@param destinationFileType A constant described by the EZRecorderFileType that corresponds to the type of destination file that should be written. For instance, an AAC file written using an '.m4a' extension would correspond to EZRecorderFileTypeM4A. See EZRecorderFileType for all the constants and mapping combinations.
@return The newly created EZRecorder instance.
*/
+(EZRecorder*)recorderWithDestinationURL:(NSURL*)url
sourceFormat:(AudioStreamBasicDescription)sourceFormat
destinationFileType:(EZRecorderFileType)destinationFileType;
#pragma mark - Getters
///-----------------------------------------------------------
/// @name Getting The Recorder's Properties
///-----------------------------------------------------------
/**
Provides the file path that's currently being used by the recorder.
@return The NSURL representing the file path of the audio file path being used for recording.
*/
-(NSURL*)url;
#pragma mark - Events
///-----------------------------------------------------------
/// @name Appending Data To The Audio File
///-----------------------------------------------------------
/**
Appends audio data to the tail of the output file from an AudioBufferList.
@param bufferList The AudioBufferList holding the audio data to append
@param bufferSize The size of each of the buffers in the buffer list.
*/
-(void)appendDataFromBufferList:(AudioBufferList*)bufferList
withBufferSize:(UInt32)bufferSize;
///-----------------------------------------------------------
/// @name Closing The Audio File
///-----------------------------------------------------------
/**
Finishes writes to the audio file and closes it.
*/
-(void)closeAudioFile;
@end
@@ -0,0 +1,195 @@
//
// TPCircularBuffer.h
// Circular/Ring buffer implementation
//
// https://github.com/michaeltyson/TPCircularBuffer
//
// Created by Michael Tyson on 10/12/2011.
//
//
// This implementation makes use of a virtual memory mapping technique that inserts a virtual copy
// of the buffer memory directly after the buffer's end, negating the need for any buffer wrap-around
// logic. Clients can simply use the returned memory address as if it were contiguous space.
//
// The implementation is thread-safe in the case of a single producer and single consumer.
//
// Virtual memory technique originally proposed by Philip Howard (http://vrb.slashusr.org/), and
// adapted to Darwin by Kurt Revis (http://www.snoize.com,
// http://www.snoize.com/Code/PlayBufferedSoundFile.tar.gz)
//
//
// Copyright (C) 2012-2013 A Tasty Pixel
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
#ifndef TPCircularBuffer_h
#define TPCircularBuffer_h
#include <libkern/OSAtomic.h>
#include <string.h>
#include <assert.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
void *buffer;
int32_t length;
int32_t tail;
int32_t head;
volatile int32_t fillCount;
} TPCircularBuffer;
/*!
* Initialise buffer
*
* Note that the length is advisory only: Because of the way the
* memory mirroring technique works, the true buffer length will
* be multiples of the device page size (e.g. 4096 bytes)
*
* @param buffer Circular buffer
* @param length Length of buffer
*/
bool TPCircularBufferInit(TPCircularBuffer *buffer, int32_t length);
/*!
* Cleanup buffer
*
* Releases buffer resources.
*/
void TPCircularBufferCleanup(TPCircularBuffer *buffer);
/*!
* Clear buffer
*
* Resets buffer to original, empty state.
*
* This is safe for use by consumer while producer is accessing
* buffer.
*/
void TPCircularBufferClear(TPCircularBuffer *buffer);
// Reading (consuming)
/*!
* Access end of buffer
*
* This gives you a pointer to the end of the buffer, ready
* for reading, and the number of available bytes to read.
*
* @param buffer Circular buffer
* @param availableBytes On output, the number of bytes ready for reading
* @return Pointer to the first bytes ready for reading, or NULL if buffer is empty
*/
static __inline__ __attribute__((always_inline)) void* TPCircularBufferTail(TPCircularBuffer *buffer, int32_t* availableBytes) {
*availableBytes = buffer->fillCount;
if (*availableBytes == 0) return NULL;
return (void*)((char*)buffer->buffer + buffer->tail);
}
/*!
* Consume bytes in buffer
*
* This frees up the just-read bytes, ready for writing again.
*
* @param buffer Circular buffer
* @param amount Number of bytes to consume
*/
static __inline__ __attribute__((always_inline)) void TPCircularBufferConsume(TPCircularBuffer *buffer, int32_t amount) {
buffer->tail = (buffer->tail + amount) % buffer->length;
OSAtomicAdd32Barrier(-amount, &buffer->fillCount);
assert(buffer->fillCount >= 0);
}
/*!
* Version of TPCircularBufferConsume without the memory barrier, for more optimal use in single-threaded contexts
*/
static __inline__ __attribute__((always_inline)) void TPCircularBufferConsumeNoBarrier(TPCircularBuffer *buffer, int32_t amount) {
buffer->tail = (buffer->tail + amount) % buffer->length;
buffer->fillCount -= amount;
assert(buffer->fillCount >= 0);
}
/*!
* Access front of buffer
*
* This gives you a pointer to the front of the buffer, ready
* for writing, and the number of available bytes to write.
*
* @param buffer Circular buffer
* @param availableBytes On output, the number of bytes ready for writing
* @return Pointer to the first bytes ready for writing, or NULL if buffer is full
*/
static __inline__ __attribute__((always_inline)) void* TPCircularBufferHead(TPCircularBuffer *buffer, int32_t* availableBytes) {
*availableBytes = (buffer->length - buffer->fillCount);
if (*availableBytes == 0) return NULL;
return (void*)((char*)buffer->buffer + buffer->head);
}
// Writing (producing)
/*!
* Produce bytes in buffer
*
* This marks the given section of the buffer ready for reading.
*
* @param buffer Circular buffer
* @param amount Number of bytes to produce
*/
static __inline__ __attribute__((always_inline)) void TPCircularBufferProduce(TPCircularBuffer *buffer, int amount) {
buffer->head = (buffer->head + amount) % buffer->length;
OSAtomicAdd32Barrier(amount, &buffer->fillCount);
assert(buffer->fillCount <= buffer->length);
}
/*!
* Version of TPCircularBufferProduce without the memory barrier, for more optimal use in single-threaded contexts
*/
static __inline__ __attribute__((always_inline)) void TPCircularBufferProduceNoBarrier(TPCircularBuffer *buffer, int amount) {
buffer->head = (buffer->head + amount) % buffer->length;
buffer->fillCount += amount;
assert(buffer->fillCount <= buffer->length);
}
/*!
* Helper routine to copy bytes to buffer
*
* This copies the given bytes to the buffer, and marks them ready for writing.
*
* @param buffer Circular buffer
* @param src Source buffer
* @param len Number of bytes in source buffer
* @return true if bytes copied, false if there was insufficient space
*/
static __inline__ __attribute__((always_inline)) bool TPCircularBufferProduceBytes(TPCircularBuffer *buffer, const void* src, int32_t len) {
int32_t space;
void *ptr = TPCircularBufferHead(buffer, &space);
if (space < len) return false;
memcpy(ptr, src, len);
TPCircularBufferProduce(buffer, len);
return true;
}
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,6 @@
framework module EZAudio {
umbrella header "EZAudio.h"
export *
module * { export * }
}
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>14E46</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>EZAudio</string>
<key>CFBundleIdentifier</key>
<string>com.sha.EZAudio</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>EZAudio</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>6E35b</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>14D125</string>
<key>DTSDKName</key>
<string>macosx10.10</string>
<key>DTXcode</key>
<string>0640</string>
<key>DTXcodeBuild</key>
<string>6E35b</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2015 Syed Haris Ali. All rights reserved.</string>
</dict>
</plist>
+1
View File
@@ -0,0 +1 @@
A
@@ -0,0 +1,441 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
6611CE781B45EB3200AE0EE8 /* EZAudioDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE571B45EB3200AE0EE8 /* EZAudioDevice.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE791B45EB3200AE0EE8 /* EZAudioDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE581B45EB3200AE0EE8 /* EZAudioDevice.m */; };
6611CE7A1B45EB3200AE0EE8 /* EZAudioFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE591B45EB3200AE0EE8 /* EZAudioFile.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE7B1B45EB3200AE0EE8 /* EZAudioFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE5A1B45EB3200AE0EE8 /* EZAudioFile.m */; };
6611CE7C1B45EB3200AE0EE8 /* EZAudioPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE5B1B45EB3200AE0EE8 /* EZAudioPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE7D1B45EB3200AE0EE8 /* EZAudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE5C1B45EB3200AE0EE8 /* EZAudioPlayer.m */; };
6611CE7E1B45EB3200AE0EE8 /* EZMicrophone.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE5D1B45EB3200AE0EE8 /* EZMicrophone.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE7F1B45EB3200AE0EE8 /* EZMicrophone.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE5E1B45EB3200AE0EE8 /* EZMicrophone.m */; };
6611CE801B45EB3200AE0EE8 /* EZOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE5F1B45EB3200AE0EE8 /* EZOutput.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE811B45EB3200AE0EE8 /* EZOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE601B45EB3200AE0EE8 /* EZOutput.m */; };
6611CE821B45EB3200AE0EE8 /* EZRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE611B45EB3200AE0EE8 /* EZRecorder.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE831B45EB3200AE0EE8 /* EZRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE621B45EB3200AE0EE8 /* EZRecorder.m */; };
6611CE841B45EB3200AE0EE8 /* TPCircularBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE641B45EB3200AE0EE8 /* TPCircularBuffer.c */; };
6611CE851B45EB3200AE0EE8 /* TPCircularBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE651B45EB3200AE0EE8 /* TPCircularBuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE861B45EB3200AE0EE8 /* EZAudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE661B45EB3200AE0EE8 /* EZAudio.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE871B45EB3200AE0EE8 /* EZAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE671B45EB3200AE0EE8 /* EZAudio.m */; };
6611CE881B45EB3200AE0EE8 /* EZAudioDisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE691B45EB3200AE0EE8 /* EZAudioDisplayLink.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE891B45EB3200AE0EE8 /* EZAudioDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE6A1B45EB3200AE0EE8 /* EZAudioDisplayLink.m */; };
6611CE8A1B45EB3200AE0EE8 /* EZAudioPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE6B1B45EB3200AE0EE8 /* EZAudioPlot.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE8B1B45EB3200AE0EE8 /* EZAudioPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE6C1B45EB3200AE0EE8 /* EZAudioPlot.m */; };
6611CE8C1B45EB3200AE0EE8 /* EZAudioPlotGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE6D1B45EB3200AE0EE8 /* EZAudioPlotGL.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE8D1B45EB3200AE0EE8 /* EZAudioPlotGL.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE6E1B45EB3200AE0EE8 /* EZAudioPlotGL.m */; };
6611CE8E1B45EB3200AE0EE8 /* EZPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE6F1B45EB3200AE0EE8 /* EZPlot.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE8F1B45EB3200AE0EE8 /* EZPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE701B45EB3200AE0EE8 /* EZPlot.m */; };
6611CE901B45EB3200AE0EE8 /* EZAudioFloatConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE721B45EB3200AE0EE8 /* EZAudioFloatConverter.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE911B45EB3200AE0EE8 /* EZAudioFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE731B45EB3200AE0EE8 /* EZAudioFloatConverter.m */; };
6611CE921B45EB3200AE0EE8 /* EZAudioFloatData.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE741B45EB3200AE0EE8 /* EZAudioFloatData.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE931B45EB3200AE0EE8 /* EZAudioFloatData.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE751B45EB3200AE0EE8 /* EZAudioFloatData.m */; };
6611CE941B45EB3200AE0EE8 /* EZAudioUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE761B45EB3200AE0EE8 /* EZAudioUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE951B45EB3200AE0EE8 /* EZAudioUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE771B45EB3200AE0EE8 /* EZAudioUtilities.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
6611CE571B45EB3200AE0EE8 /* EZAudioDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioDevice.h; sourceTree = "<group>"; };
6611CE581B45EB3200AE0EE8 /* EZAudioDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioDevice.m; sourceTree = "<group>"; };
6611CE591B45EB3200AE0EE8 /* EZAudioFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFile.h; sourceTree = "<group>"; };
6611CE5A1B45EB3200AE0EE8 /* EZAudioFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFile.m; sourceTree = "<group>"; };
6611CE5B1B45EB3200AE0EE8 /* EZAudioPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlayer.h; sourceTree = "<group>"; };
6611CE5C1B45EB3200AE0EE8 /* EZAudioPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlayer.m; sourceTree = "<group>"; };
6611CE5D1B45EB3200AE0EE8 /* EZMicrophone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZMicrophone.h; sourceTree = "<group>"; };
6611CE5E1B45EB3200AE0EE8 /* EZMicrophone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZMicrophone.m; sourceTree = "<group>"; };
6611CE5F1B45EB3200AE0EE8 /* EZOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZOutput.h; sourceTree = "<group>"; };
6611CE601B45EB3200AE0EE8 /* EZOutput.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZOutput.m; sourceTree = "<group>"; };
6611CE611B45EB3200AE0EE8 /* EZRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZRecorder.h; sourceTree = "<group>"; };
6611CE621B45EB3200AE0EE8 /* EZRecorder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZRecorder.m; sourceTree = "<group>"; };
6611CE641B45EB3200AE0EE8 /* TPCircularBuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = TPCircularBuffer.c; sourceTree = "<group>"; };
6611CE651B45EB3200AE0EE8 /* TPCircularBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPCircularBuffer.h; sourceTree = "<group>"; };
6611CE661B45EB3200AE0EE8 /* EZAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EZAudio.h; path = ../../../Classes/EZAudio.h; sourceTree = "<group>"; };
6611CE671B45EB3200AE0EE8 /* EZAudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EZAudio.m; path = ../../../Classes/EZAudio.m; sourceTree = "<group>"; };
6611CE691B45EB3200AE0EE8 /* EZAudioDisplayLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioDisplayLink.h; sourceTree = "<group>"; };
6611CE6A1B45EB3200AE0EE8 /* EZAudioDisplayLink.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioDisplayLink.m; sourceTree = "<group>"; };
6611CE6B1B45EB3200AE0EE8 /* EZAudioPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlot.h; sourceTree = "<group>"; };
6611CE6C1B45EB3200AE0EE8 /* EZAudioPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlot.m; sourceTree = "<group>"; };
6611CE6D1B45EB3200AE0EE8 /* EZAudioPlotGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGL.h; sourceTree = "<group>"; };
6611CE6E1B45EB3200AE0EE8 /* EZAudioPlotGL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGL.m; sourceTree = "<group>"; };
6611CE6F1B45EB3200AE0EE8 /* EZPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZPlot.h; sourceTree = "<group>"; };
6611CE701B45EB3200AE0EE8 /* EZPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZPlot.m; sourceTree = "<group>"; };
6611CE721B45EB3200AE0EE8 /* EZAudioFloatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatConverter.h; sourceTree = "<group>"; };
6611CE731B45EB3200AE0EE8 /* EZAudioFloatConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatConverter.m; sourceTree = "<group>"; };
6611CE741B45EB3200AE0EE8 /* EZAudioFloatData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatData.h; sourceTree = "<group>"; };
6611CE751B45EB3200AE0EE8 /* EZAudioFloatData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatData.m; sourceTree = "<group>"; };
6611CE761B45EB3200AE0EE8 /* EZAudioUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioUtilities.h; sourceTree = "<group>"; };
6611CE771B45EB3200AE0EE8 /* EZAudioUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioUtilities.m; sourceTree = "<group>"; };
662427121B4510F30069FFD7 /* EZAudio.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = EZAudio.framework; sourceTree = BUILT_PRODUCTS_DIR; };
662427161B4510F30069FFD7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
6624270E1B4510F30069FFD7 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
6611CE561B45EB3200AE0EE8 /* Core Components */ = {
isa = PBXGroup;
children = (
6611CE571B45EB3200AE0EE8 /* EZAudioDevice.h */,
6611CE581B45EB3200AE0EE8 /* EZAudioDevice.m */,
6611CE591B45EB3200AE0EE8 /* EZAudioFile.h */,
6611CE5A1B45EB3200AE0EE8 /* EZAudioFile.m */,
6611CE5B1B45EB3200AE0EE8 /* EZAudioPlayer.h */,
6611CE5C1B45EB3200AE0EE8 /* EZAudioPlayer.m */,
6611CE5D1B45EB3200AE0EE8 /* EZMicrophone.h */,
6611CE5E1B45EB3200AE0EE8 /* EZMicrophone.m */,
6611CE5F1B45EB3200AE0EE8 /* EZOutput.h */,
6611CE601B45EB3200AE0EE8 /* EZOutput.m */,
6611CE611B45EB3200AE0EE8 /* EZRecorder.h */,
6611CE621B45EB3200AE0EE8 /* EZRecorder.m */,
);
name = "Core Components";
path = "../../../Classes/Core Components";
sourceTree = "<group>";
};
6611CE631B45EB3200AE0EE8 /* External */ = {
isa = PBXGroup;
children = (
6611CE641B45EB3200AE0EE8 /* TPCircularBuffer.c */,
6611CE651B45EB3200AE0EE8 /* TPCircularBuffer.h */,
);
name = External;
path = ../../../Classes/External;
sourceTree = "<group>";
};
6611CE681B45EB3200AE0EE8 /* Interface Components */ = {
isa = PBXGroup;
children = (
6611CE691B45EB3200AE0EE8 /* EZAudioDisplayLink.h */,
6611CE6A1B45EB3200AE0EE8 /* EZAudioDisplayLink.m */,
6611CE6B1B45EB3200AE0EE8 /* EZAudioPlot.h */,
6611CE6C1B45EB3200AE0EE8 /* EZAudioPlot.m */,
6611CE6D1B45EB3200AE0EE8 /* EZAudioPlotGL.h */,
6611CE6E1B45EB3200AE0EE8 /* EZAudioPlotGL.m */,
6611CE6F1B45EB3200AE0EE8 /* EZPlot.h */,
6611CE701B45EB3200AE0EE8 /* EZPlot.m */,
);
name = "Interface Components";
path = "../../../Classes/Interface Components";
sourceTree = "<group>";
};
6611CE711B45EB3200AE0EE8 /* Utility Components */ = {
isa = PBXGroup;
children = (
6611CE721B45EB3200AE0EE8 /* EZAudioFloatConverter.h */,
6611CE731B45EB3200AE0EE8 /* EZAudioFloatConverter.m */,
6611CE741B45EB3200AE0EE8 /* EZAudioFloatData.h */,
6611CE751B45EB3200AE0EE8 /* EZAudioFloatData.m */,
6611CE761B45EB3200AE0EE8 /* EZAudioUtilities.h */,
6611CE771B45EB3200AE0EE8 /* EZAudioUtilities.m */,
);
name = "Utility Components";
path = "../../../Classes/Utility Components";
sourceTree = "<group>";
};
662427081B4510F30069FFD7 = {
isa = PBXGroup;
children = (
662427141B4510F30069FFD7 /* EZAudio */,
662427131B4510F30069FFD7 /* Products */,
);
sourceTree = "<group>";
};
662427131B4510F30069FFD7 /* Products */ = {
isa = PBXGroup;
children = (
662427121B4510F30069FFD7 /* EZAudio.framework */,
);
name = Products;
sourceTree = "<group>";
};
662427141B4510F30069FFD7 /* EZAudio */ = {
isa = PBXGroup;
children = (
6611CE661B45EB3200AE0EE8 /* EZAudio.h */,
6611CE671B45EB3200AE0EE8 /* EZAudio.m */,
6611CE561B45EB3200AE0EE8 /* Core Components */,
6611CE631B45EB3200AE0EE8 /* External */,
6611CE681B45EB3200AE0EE8 /* Interface Components */,
6611CE711B45EB3200AE0EE8 /* Utility Components */,
662427151B4510F30069FFD7 /* Supporting Files */,
);
path = EZAudio;
sourceTree = "<group>";
};
662427151B4510F30069FFD7 /* Supporting Files */ = {
isa = PBXGroup;
children = (
662427161B4510F30069FFD7 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
6624270F1B4510F30069FFD7 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
6611CE8C1B45EB3200AE0EE8 /* EZAudioPlotGL.h in Headers */,
6611CE861B45EB3200AE0EE8 /* EZAudio.h in Headers */,
6611CE7A1B45EB3200AE0EE8 /* EZAudioFile.h in Headers */,
6611CE781B45EB3200AE0EE8 /* EZAudioDevice.h in Headers */,
6611CE8A1B45EB3200AE0EE8 /* EZAudioPlot.h in Headers */,
6611CE881B45EB3200AE0EE8 /* EZAudioDisplayLink.h in Headers */,
6611CE7C1B45EB3200AE0EE8 /* EZAudioPlayer.h in Headers */,
6611CE921B45EB3200AE0EE8 /* EZAudioFloatData.h in Headers */,
6611CE851B45EB3200AE0EE8 /* TPCircularBuffer.h in Headers */,
6611CE8E1B45EB3200AE0EE8 /* EZPlot.h in Headers */,
6611CE801B45EB3200AE0EE8 /* EZOutput.h in Headers */,
6611CE901B45EB3200AE0EE8 /* EZAudioFloatConverter.h in Headers */,
6611CE941B45EB3200AE0EE8 /* EZAudioUtilities.h in Headers */,
6611CE7E1B45EB3200AE0EE8 /* EZMicrophone.h in Headers */,
6611CE821B45EB3200AE0EE8 /* EZRecorder.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
662427111B4510F30069FFD7 /* EZAudio */ = {
isa = PBXNativeTarget;
buildConfigurationList = 662427281B4510F30069FFD7 /* Build configuration list for PBXNativeTarget "EZAudio" */;
buildPhases = (
6624270D1B4510F30069FFD7 /* Sources */,
6624270E1B4510F30069FFD7 /* Frameworks */,
6624270F1B4510F30069FFD7 /* Headers */,
662427101B4510F30069FFD7 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = EZAudio;
productName = EZAudio;
productReference = 662427121B4510F30069FFD7 /* EZAudio.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
662427091B4510F30069FFD7 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0640;
ORGANIZATIONNAME = "Syed Haris Ali";
TargetAttributes = {
662427111B4510F30069FFD7 = {
CreatedOnToolsVersion = 6.4;
};
};
};
buildConfigurationList = 6624270C1B4510F30069FFD7 /* Build configuration list for PBXProject "EZAudio" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 662427081B4510F30069FFD7;
productRefGroup = 662427131B4510F30069FFD7 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
662427111B4510F30069FFD7 /* EZAudio */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
662427101B4510F30069FFD7 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
6624270D1B4510F30069FFD7 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6611CE8D1B45EB3200AE0EE8 /* EZAudioPlotGL.m in Sources */,
6611CE841B45EB3200AE0EE8 /* TPCircularBuffer.c in Sources */,
6611CE891B45EB3200AE0EE8 /* EZAudioDisplayLink.m in Sources */,
6611CE831B45EB3200AE0EE8 /* EZRecorder.m in Sources */,
6611CE7F1B45EB3200AE0EE8 /* EZMicrophone.m in Sources */,
6611CE791B45EB3200AE0EE8 /* EZAudioDevice.m in Sources */,
6611CE7B1B45EB3200AE0EE8 /* EZAudioFile.m in Sources */,
6611CE951B45EB3200AE0EE8 /* EZAudioUtilities.m in Sources */,
6611CE871B45EB3200AE0EE8 /* EZAudio.m in Sources */,
6611CE811B45EB3200AE0EE8 /* EZOutput.m in Sources */,
6611CE8F1B45EB3200AE0EE8 /* EZPlot.m in Sources */,
6611CE931B45EB3200AE0EE8 /* EZAudioFloatData.m in Sources */,
6611CE8B1B45EB3200AE0EE8 /* EZAudioPlot.m in Sources */,
6611CE911B45EB3200AE0EE8 /* EZAudioFloatConverter.m in Sources */,
6611CE7D1B45EB3200AE0EE8 /* EZAudioPlayer.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
662427261B4510F30069FFD7 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.8;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
662427271B4510F30069FFD7 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.8;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
662427291B4510F30069FFD7 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
CONFIGURATION_BUILD_DIR = $PROJECT_DIR;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = EZAudio/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
6624272A1B4510F30069FFD7 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = EZAudio/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
6624270C1B4510F30069FFD7 /* Build configuration list for PBXProject "EZAudio" */ = {
isa = XCConfigurationList;
buildConfigurations = (
662427261B4510F30069FFD7 /* Debug */,
662427271B4510F30069FFD7 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
662427281B4510F30069FFD7 /* Build configuration list for PBXNativeTarget "EZAudio" */ = {
isa = XCConfigurationList;
buildConfigurations = (
662427291B4510F30069FFD7 /* Debug */,
6624272A1B4510F30069FFD7 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 662427091B4510F30069FFD7 /* Project object */;
}
@@ -5,18 +5,24 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.sha.${PRODUCT_NAME:rfc1034identifier}</string>
<string>com.sha.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2015 Syed Haris Ali. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
-51
View File
@@ -1,51 +0,0 @@
EZAudio
Created by Syed Haris Ali
Copyright (c) 2013 Syed Haris Ali. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
==========================================================================================
0.0.1
Initial release.
Components include: EZAudioFile, EZAudioPlot, EZAudioPlotGL, EZMicrophone, EZOutput, and EZRecorder.
Provided 6 example projects: CoreGraphicsWaveform, OpenGLWaveform, WaveformFromFile, PassThrough, Record, and PlayFile.
0.0.2
Fix for Cocoapod spec. Forgot to include files with .c extension.
0.0.3
Changing EZAudioPlot and EZAudioPlotGL to scroll for the EZPlotTypeRolling instead of wiping the screen clean when hitting the end
Allowed EZMicrophone EZOutput to have custom AudioStreamBasicDescription setters
Fixed bug in EZAudioFile's getWaveformData function where it was not exiting after sending back cached waveform data (rereading from the audio file)
Added stereo support for EZMicrophone, EZAudioFile, EZRecorder, and EZOutput
Added more memory cleanup for EZAudioFile
Added adjustable rolling length for EZAudioPlot and EZAudioPlotGL so those rolling graphs can now range from 128 to 8192 whereas before it was fixed at 1024
Added adjustable resolution for waveform data coming from the EZAudioFile so output from the getWaveformDataWithCompletionBlock: function can literally be of any size. Try 128 for a low resolution waveform or 8192 for a much higher resolution waveform.
Added quick fix for EZOutput to properly route stereo data coming from a circular buffer datasource. Next version (0.0.4) needs to add EZConverter to allow quick conversions between non-interleaved and interleaved formats.
0.0.4
Added closeAudioFile to EZRecorder to properly dispose of internal audio file prior to trying to reload it using the EZAudioFile.
Added new EZOutputDataSource method that provides pre-allocated AudioBufferList to fill instead of caller allocating and disposing on AudioBufferList. Much less errors.
Added EZAudioPlayer for playback and visualization of local audio files (no network streaming yet).
Merged bug fixes from community for EZAudio file.
0.0.5
Added multiple destination recording formats to the EZRecorder (EZRecorderFileType)
-26
View File
@@ -1,26 +0,0 @@
EZAudio
Created by Syed Haris Ali
Copyright (c) 2013 Syed Haris Ali. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
==========================================================================================
0.0.5
@@ -0,0 +1,443 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
6611CE181B45CE2400AE0EE8 /* EZAudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CDF71B45CE2400AE0EE8 /* EZAudio.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE191B45CE2400AE0EE8 /* EZAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CDF81B45CE2400AE0EE8 /* EZAudio.m */; };
6611CE1A1B45CE2400AE0EE8 /* EZAudioDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CDF91B45CE2400AE0EE8 /* EZAudioDevice.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE1B1B45CE2400AE0EE8 /* EZAudioDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CDFA1B45CE2400AE0EE8 /* EZAudioDevice.m */; };
6611CE1C1B45CE2400AE0EE8 /* EZAudioDisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CDFB1B45CE2400AE0EE8 /* EZAudioDisplayLink.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE1D1B45CE2400AE0EE8 /* EZAudioDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CDFC1B45CE2400AE0EE8 /* EZAudioDisplayLink.m */; };
6611CE1E1B45CE2400AE0EE8 /* EZAudioFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CDFD1B45CE2400AE0EE8 /* EZAudioFile.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE1F1B45CE2400AE0EE8 /* EZAudioFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CDFE1B45CE2400AE0EE8 /* EZAudioFile.m */; };
6611CE201B45CE2400AE0EE8 /* EZAudioFloatConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CDFF1B45CE2400AE0EE8 /* EZAudioFloatConverter.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE211B45CE2400AE0EE8 /* EZAudioFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE001B45CE2400AE0EE8 /* EZAudioFloatConverter.m */; };
6611CE221B45CE2400AE0EE8 /* EZAudioFloatData.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE011B45CE2400AE0EE8 /* EZAudioFloatData.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE231B45CE2400AE0EE8 /* EZAudioFloatData.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE021B45CE2400AE0EE8 /* EZAudioFloatData.m */; };
6611CE241B45CE2400AE0EE8 /* EZAudioPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE031B45CE2400AE0EE8 /* EZAudioPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE251B45CE2400AE0EE8 /* EZAudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE041B45CE2400AE0EE8 /* EZAudioPlayer.m */; };
6611CE261B45CE2400AE0EE8 /* EZAudioPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE051B45CE2400AE0EE8 /* EZAudioPlot.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE271B45CE2400AE0EE8 /* EZAudioPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE061B45CE2400AE0EE8 /* EZAudioPlot.m */; };
6611CE281B45CE2400AE0EE8 /* EZAudioPlotGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE071B45CE2400AE0EE8 /* EZAudioPlotGL.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE291B45CE2400AE0EE8 /* EZAudioPlotGL.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE081B45CE2400AE0EE8 /* EZAudioPlotGL.m */; };
6611CE2A1B45CE2400AE0EE8 /* EZAudioUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE091B45CE2400AE0EE8 /* EZAudioUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE2B1B45CE2400AE0EE8 /* EZAudioUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE0A1B45CE2400AE0EE8 /* EZAudioUtilities.m */; };
6611CE2C1B45CE2400AE0EE8 /* EZMicrophone.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE0B1B45CE2400AE0EE8 /* EZMicrophone.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE2D1B45CE2400AE0EE8 /* EZMicrophone.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE0C1B45CE2400AE0EE8 /* EZMicrophone.m */; };
6611CE2E1B45CE2400AE0EE8 /* EZOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE0D1B45CE2400AE0EE8 /* EZOutput.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE2F1B45CE2400AE0EE8 /* EZOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE0E1B45CE2400AE0EE8 /* EZOutput.m */; };
6611CE301B45CE2400AE0EE8 /* EZPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE0F1B45CE2400AE0EE8 /* EZPlot.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE311B45CE2400AE0EE8 /* EZPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE101B45CE2400AE0EE8 /* EZPlot.m */; };
6611CE321B45CE2400AE0EE8 /* EZRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE111B45CE2400AE0EE8 /* EZRecorder.h */; settings = {ATTRIBUTES = (Public, ); }; };
6611CE331B45CE2400AE0EE8 /* EZRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE121B45CE2400AE0EE8 /* EZRecorder.m */; };
6611CE341B45CE2400AE0EE8 /* TPCircularBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 6611CE131B45CE2400AE0EE8 /* TPCircularBuffer.c */; };
6611CE351B45CE2400AE0EE8 /* TPCircularBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 6611CE141B45CE2400AE0EE8 /* TPCircularBuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
6611CDDA1B45CDD800AE0EE8 /* EZAudio.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = EZAudio.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6611CDDE1B45CDD800AE0EE8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6611CDF71B45CE2400AE0EE8 /* EZAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EZAudio.h; path = ../../../Classes/EZAudio.h; sourceTree = "<group>"; };
6611CDF81B45CE2400AE0EE8 /* EZAudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EZAudio.m; path = ../../../Classes/EZAudio.m; sourceTree = "<group>"; };
6611CDF91B45CE2400AE0EE8 /* EZAudioDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioDevice.h; sourceTree = "<group>"; };
6611CDFA1B45CE2400AE0EE8 /* EZAudioDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioDevice.m; sourceTree = "<group>"; };
6611CDFB1B45CE2400AE0EE8 /* EZAudioDisplayLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioDisplayLink.h; sourceTree = "<group>"; };
6611CDFC1B45CE2400AE0EE8 /* EZAudioDisplayLink.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioDisplayLink.m; sourceTree = "<group>"; };
6611CDFD1B45CE2400AE0EE8 /* EZAudioFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFile.h; sourceTree = "<group>"; };
6611CDFE1B45CE2400AE0EE8 /* EZAudioFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFile.m; sourceTree = "<group>"; };
6611CDFF1B45CE2400AE0EE8 /* EZAudioFloatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatConverter.h; sourceTree = "<group>"; };
6611CE001B45CE2400AE0EE8 /* EZAudioFloatConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatConverter.m; sourceTree = "<group>"; };
6611CE011B45CE2400AE0EE8 /* EZAudioFloatData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatData.h; sourceTree = "<group>"; };
6611CE021B45CE2400AE0EE8 /* EZAudioFloatData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatData.m; sourceTree = "<group>"; };
6611CE031B45CE2400AE0EE8 /* EZAudioPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlayer.h; sourceTree = "<group>"; };
6611CE041B45CE2400AE0EE8 /* EZAudioPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlayer.m; sourceTree = "<group>"; };
6611CE051B45CE2400AE0EE8 /* EZAudioPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlot.h; sourceTree = "<group>"; };
6611CE061B45CE2400AE0EE8 /* EZAudioPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlot.m; sourceTree = "<group>"; };
6611CE071B45CE2400AE0EE8 /* EZAudioPlotGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGL.h; sourceTree = "<group>"; };
6611CE081B45CE2400AE0EE8 /* EZAudioPlotGL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGL.m; sourceTree = "<group>"; };
6611CE091B45CE2400AE0EE8 /* EZAudioUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioUtilities.h; sourceTree = "<group>"; };
6611CE0A1B45CE2400AE0EE8 /* EZAudioUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioUtilities.m; sourceTree = "<group>"; };
6611CE0B1B45CE2400AE0EE8 /* EZMicrophone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZMicrophone.h; sourceTree = "<group>"; };
6611CE0C1B45CE2400AE0EE8 /* EZMicrophone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZMicrophone.m; sourceTree = "<group>"; };
6611CE0D1B45CE2400AE0EE8 /* EZOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZOutput.h; sourceTree = "<group>"; };
6611CE0E1B45CE2400AE0EE8 /* EZOutput.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZOutput.m; sourceTree = "<group>"; };
6611CE0F1B45CE2400AE0EE8 /* EZPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZPlot.h; sourceTree = "<group>"; };
6611CE101B45CE2400AE0EE8 /* EZPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZPlot.m; sourceTree = "<group>"; };
6611CE111B45CE2400AE0EE8 /* EZRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZRecorder.h; sourceTree = "<group>"; };
6611CE121B45CE2400AE0EE8 /* EZRecorder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZRecorder.m; sourceTree = "<group>"; };
6611CE131B45CE2400AE0EE8 /* TPCircularBuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = TPCircularBuffer.c; sourceTree = "<group>"; };
6611CE141B45CE2400AE0EE8 /* TPCircularBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPCircularBuffer.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
6611CDD61B45CDD800AE0EE8 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
6611CDD01B45CDD800AE0EE8 = {
isa = PBXGroup;
children = (
6611CDDC1B45CDD800AE0EE8 /* EZAudio */,
6611CDDB1B45CDD800AE0EE8 /* Products */,
);
sourceTree = "<group>";
};
6611CDDB1B45CDD800AE0EE8 /* Products */ = {
isa = PBXGroup;
children = (
6611CDDA1B45CDD800AE0EE8 /* EZAudio.framework */,
);
name = Products;
sourceTree = "<group>";
};
6611CDDC1B45CDD800AE0EE8 /* EZAudio */ = {
isa = PBXGroup;
children = (
6611CDF71B45CE2400AE0EE8 /* EZAudio.h */,
6611CDF81B45CE2400AE0EE8 /* EZAudio.m */,
6611CE4E1B45D87A00AE0EE8 /* Core Components */,
6611CE511B45D91500AE0EE8 /* External */,
6611CE4F1B45D8DE00AE0EE8 /* Interface Components */,
6611CE501B45D90A00AE0EE8 /* Utility Components */,
6611CDDD1B45CDD800AE0EE8 /* Supporting Files */,
);
path = EZAudio;
sourceTree = "<group>";
};
6611CDDD1B45CDD800AE0EE8 /* Supporting Files */ = {
isa = PBXGroup;
children = (
6611CDDE1B45CDD800AE0EE8 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
6611CE4E1B45D87A00AE0EE8 /* Core Components */ = {
isa = PBXGroup;
children = (
6611CDF91B45CE2400AE0EE8 /* EZAudioDevice.h */,
6611CDFA1B45CE2400AE0EE8 /* EZAudioDevice.m */,
6611CDFD1B45CE2400AE0EE8 /* EZAudioFile.h */,
6611CDFE1B45CE2400AE0EE8 /* EZAudioFile.m */,
6611CE031B45CE2400AE0EE8 /* EZAudioPlayer.h */,
6611CE041B45CE2400AE0EE8 /* EZAudioPlayer.m */,
6611CE0B1B45CE2400AE0EE8 /* EZMicrophone.h */,
6611CE0C1B45CE2400AE0EE8 /* EZMicrophone.m */,
6611CE0D1B45CE2400AE0EE8 /* EZOutput.h */,
6611CE0E1B45CE2400AE0EE8 /* EZOutput.m */,
6611CE111B45CE2400AE0EE8 /* EZRecorder.h */,
6611CE121B45CE2400AE0EE8 /* EZRecorder.m */,
);
name = "Core Components";
path = "../../../Classes/Core Components";
sourceTree = "<group>";
};
6611CE4F1B45D8DE00AE0EE8 /* Interface Components */ = {
isa = PBXGroup;
children = (
6611CDFB1B45CE2400AE0EE8 /* EZAudioDisplayLink.h */,
6611CDFC1B45CE2400AE0EE8 /* EZAudioDisplayLink.m */,
6611CE051B45CE2400AE0EE8 /* EZAudioPlot.h */,
6611CE061B45CE2400AE0EE8 /* EZAudioPlot.m */,
6611CE071B45CE2400AE0EE8 /* EZAudioPlotGL.h */,
6611CE081B45CE2400AE0EE8 /* EZAudioPlotGL.m */,
6611CE0F1B45CE2400AE0EE8 /* EZPlot.h */,
6611CE101B45CE2400AE0EE8 /* EZPlot.m */,
);
name = "Interface Components";
path = "../../../Classes/Interface Components";
sourceTree = "<group>";
};
6611CE501B45D90A00AE0EE8 /* Utility Components */ = {
isa = PBXGroup;
children = (
6611CDFF1B45CE2400AE0EE8 /* EZAudioFloatConverter.h */,
6611CE001B45CE2400AE0EE8 /* EZAudioFloatConverter.m */,
6611CE011B45CE2400AE0EE8 /* EZAudioFloatData.h */,
6611CE021B45CE2400AE0EE8 /* EZAudioFloatData.m */,
6611CE091B45CE2400AE0EE8 /* EZAudioUtilities.h */,
6611CE0A1B45CE2400AE0EE8 /* EZAudioUtilities.m */,
);
name = "Utility Components";
path = "../../../Classes/Utility Components";
sourceTree = "<group>";
};
6611CE511B45D91500AE0EE8 /* External */ = {
isa = PBXGroup;
children = (
6611CE131B45CE2400AE0EE8 /* TPCircularBuffer.c */,
6611CE141B45CE2400AE0EE8 /* TPCircularBuffer.h */,
);
name = External;
path = ../../../Classes/External;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
6611CDD71B45CDD800AE0EE8 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
6611CE2E1B45CE2400AE0EE8 /* EZOutput.h in Headers */,
6611CE301B45CE2400AE0EE8 /* EZPlot.h in Headers */,
6611CE1E1B45CE2400AE0EE8 /* EZAudioFile.h in Headers */,
6611CE221B45CE2400AE0EE8 /* EZAudioFloatData.h in Headers */,
6611CE2C1B45CE2400AE0EE8 /* EZMicrophone.h in Headers */,
6611CE1C1B45CE2400AE0EE8 /* EZAudioDisplayLink.h in Headers */,
6611CE261B45CE2400AE0EE8 /* EZAudioPlot.h in Headers */,
6611CE321B45CE2400AE0EE8 /* EZRecorder.h in Headers */,
6611CE1A1B45CE2400AE0EE8 /* EZAudioDevice.h in Headers */,
6611CE281B45CE2400AE0EE8 /* EZAudioPlotGL.h in Headers */,
6611CE181B45CE2400AE0EE8 /* EZAudio.h in Headers */,
6611CE2A1B45CE2400AE0EE8 /* EZAudioUtilities.h in Headers */,
6611CE241B45CE2400AE0EE8 /* EZAudioPlayer.h in Headers */,
6611CE351B45CE2400AE0EE8 /* TPCircularBuffer.h in Headers */,
6611CE201B45CE2400AE0EE8 /* EZAudioFloatConverter.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
6611CDD91B45CDD800AE0EE8 /* EZAudio */ = {
isa = PBXNativeTarget;
buildConfigurationList = 6611CDF01B45CDD800AE0EE8 /* Build configuration list for PBXNativeTarget "EZAudio" */;
buildPhases = (
6611CDD51B45CDD800AE0EE8 /* Sources */,
6611CDD61B45CDD800AE0EE8 /* Frameworks */,
6611CDD71B45CDD800AE0EE8 /* Headers */,
6611CDD81B45CDD800AE0EE8 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = EZAudio;
productName = EZAudio;
productReference = 6611CDDA1B45CDD800AE0EE8 /* EZAudio.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
6611CDD11B45CDD800AE0EE8 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0640;
ORGANIZATIONNAME = "Syed Haris Ali";
TargetAttributes = {
6611CDD91B45CDD800AE0EE8 = {
CreatedOnToolsVersion = 6.4;
};
};
};
buildConfigurationList = 6611CDD41B45CDD800AE0EE8 /* Build configuration list for PBXProject "EZAudio" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 6611CDD01B45CDD800AE0EE8;
productRefGroup = 6611CDDB1B45CDD800AE0EE8 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
6611CDD91B45CDD800AE0EE8 /* EZAudio */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
6611CDD81B45CDD800AE0EE8 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
6611CDD51B45CDD800AE0EE8 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6611CE271B45CE2400AE0EE8 /* EZAudioPlot.m in Sources */,
6611CE2F1B45CE2400AE0EE8 /* EZOutput.m in Sources */,
6611CE191B45CE2400AE0EE8 /* EZAudio.m in Sources */,
6611CE341B45CE2400AE0EE8 /* TPCircularBuffer.c in Sources */,
6611CE2B1B45CE2400AE0EE8 /* EZAudioUtilities.m in Sources */,
6611CE251B45CE2400AE0EE8 /* EZAudioPlayer.m in Sources */,
6611CE1F1B45CE2400AE0EE8 /* EZAudioFile.m in Sources */,
6611CE231B45CE2400AE0EE8 /* EZAudioFloatData.m in Sources */,
6611CE291B45CE2400AE0EE8 /* EZAudioPlotGL.m in Sources */,
6611CE1D1B45CE2400AE0EE8 /* EZAudioDisplayLink.m in Sources */,
6611CE1B1B45CE2400AE0EE8 /* EZAudioDevice.m in Sources */,
6611CE331B45CE2400AE0EE8 /* EZRecorder.m in Sources */,
6611CE211B45CE2400AE0EE8 /* EZAudioFloatConverter.m in Sources */,
6611CE2D1B45CE2400AE0EE8 /* EZMicrophone.m in Sources */,
6611CE311B45CE2400AE0EE8 /* EZPlot.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
6611CDEE1B45CDD800AE0EE8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
6611CDEF1B45CDD800AE0EE8 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
6611CDF11B45CDD800AE0EE8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = EZAudio/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
6611CDF21B45CDD800AE0EE8 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = EZAudio/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
6611CDD41B45CDD800AE0EE8 /* Build configuration list for PBXProject "EZAudio" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6611CDEE1B45CDD800AE0EE8 /* Debug */,
6611CDEF1B45CDD800AE0EE8 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
6611CDF01B45CDD800AE0EE8 /* Build configuration list for PBXNativeTarget "EZAudio" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6611CDF11B45CDD800AE0EE8 /* Debug */,
6611CDF21B45CDD800AE0EE8 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 6611CDD11B45CDD800AE0EE8 /* Project object */;
}
@@ -5,18 +5,22 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.sha.${PRODUCT_NAME:rfc1034identifier}</string>
<string>com.sha.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
@@ -21,24 +21,8 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
665956E81B38B256003E97A1 /* AEFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 665956C61B38B256003E97A1 /* AEFloatConverter.m */; };
665956E91B38B256003E97A1 /* EZAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 665956C81B38B256003E97A1 /* EZAudio.m */; };
665956EA1B38B256003E97A1 /* EZAudioDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 665956CA1B38B256003E97A1 /* EZAudioDevice.m */; };
665956EB1B38B256003E97A1 /* EZAudioFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 665956CC1B38B256003E97A1 /* EZAudioFile.m */; };
665956EC1B38B256003E97A1 /* EZAudioFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 665956CE1B38B256003E97A1 /* EZAudioFloatConverter.m */; };
665956ED1B38B256003E97A1 /* EZAudioFloatData.m in Sources */ = {isa = PBXBuildFile; fileRef = 665956D01B38B256003E97A1 /* EZAudioFloatData.m */; };
665956EE1B38B256003E97A1 /* EZAudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 665956D21B38B256003E97A1 /* EZAudioPlayer.m */; };
665956EF1B38B256003E97A1 /* EZAudioPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 665956D41B38B256003E97A1 /* EZAudioPlot.m */; };
665956F01B38B256003E97A1 /* EZAudioPlotGL.m in Sources */ = {isa = PBXBuildFile; fileRef = 665956D61B38B256003E97A1 /* EZAudioPlotGL.m */; };
665956F11B38B256003E97A1 /* EZAudioPlotGLKViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 665956D81B38B256003E97A1 /* EZAudioPlotGLKViewController.m */; };
665956F21B38B256003E97A1 /* EZAudioUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 665956DA1B38B256003E97A1 /* EZAudioUtilities.m */; };
665956F31B38B256003E97A1 /* EZMicrophone.m in Sources */ = {isa = PBXBuildFile; fileRef = 665956DC1B38B256003E97A1 /* EZMicrophone.m */; };
665956F41B38B256003E97A1 /* EZOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 665956DE1B38B256003E97A1 /* EZOutput.m */; };
665956F51B38B256003E97A1 /* EZPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 665956E01B38B256003E97A1 /* EZPlot.m */; };
665956F61B38B256003E97A1 /* EZRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 665956E21B38B256003E97A1 /* EZRecorder.m */; };
665956F71B38B256003E97A1 /* TPCircularBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 665956E31B38B256003E97A1 /* TPCircularBuffer.c */; };
665956F81B38B256003E97A1 /* CHANGELOG in Resources */ = {isa = PBXBuildFile; fileRef = 665956E61B38B256003E97A1 /* CHANGELOG */; };
665956F91B38B256003E97A1 /* VERSION in Resources */ = {isa = PBXBuildFile; fileRef = 665956E71B38B256003E97A1 /* VERSION */; };
6611CED71B46030C00AE0EE8 /* EZAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6611CED61B46030C00AE0EE8 /* EZAudio.framework */; };
6611CED81B46030C00AE0EE8 /* EZAudio.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 6611CED61B46030C00AE0EE8 /* EZAudio.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
94056D88185B97E300EB94BA /* CoreGraphicsWaveformViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 94056D86185B97E300EB94BA /* CoreGraphicsWaveformViewController.m */; };
94056D89185B97E300EB94BA /* CoreGraphicsWaveformViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 94056D87185B97E300EB94BA /* CoreGraphicsWaveformViewController.xib */; };
94373025185B931C00F315F0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94373024185B931C00F315F0 /* Cocoa.framework */; };
@@ -48,10 +32,6 @@
94373038185B931C00F315F0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 94373037185B931C00F315F0 /* AppDelegate.m */; };
9437303B185B931C00F315F0 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 94373039185B931C00F315F0 /* MainMenu.xib */; };
9437303D185B931C00F315F0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9437303C185B931C00F315F0 /* Images.xcassets */; };
94373044185B931C00F315F0 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94373043185B931C00F315F0 /* XCTest.framework */; };
94373045185B931C00F315F0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94373024185B931C00F315F0 /* Cocoa.framework */; };
9437304D185B931C00F315F0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9437304B185B931C00F315F0 /* InfoPlist.strings */; };
9437304F185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9437304E185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests.m */; };
94373080185B934900F315F0 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9437307D185B934900F315F0 /* AudioToolbox.framework */; };
94373081185B934900F315F0 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9437307E185B934900F315F0 /* AudioUnit.framework */; };
94373082185B934900F315F0 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9437307F185B934900F315F0 /* CoreAudio.framework */; };
@@ -60,51 +40,23 @@
94373088185B937E00F315F0 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94373087185B937E00F315F0 /* QuartzCore.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
94373046185B931C00F315F0 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 94373019185B931C00F315F0 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 94373020185B931C00F315F0;
remoteInfo = EZAudioCoreGraphicsWaveformExample;
/* Begin PBXCopyFilesBuildPhase section */
6611CED51B46026000AE0EE8 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
6611CED81B46030C00AE0EE8 /* EZAudio.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXContainerItemProxy section */
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
665956C51B38B256003E97A1 /* AEFloatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AEFloatConverter.h; sourceTree = "<group>"; };
665956C61B38B256003E97A1 /* AEFloatConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AEFloatConverter.m; sourceTree = "<group>"; };
665956C71B38B256003E97A1 /* EZAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudio.h; sourceTree = "<group>"; };
665956C81B38B256003E97A1 /* EZAudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudio.m; sourceTree = "<group>"; };
665956C91B38B256003E97A1 /* EZAudioDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioDevice.h; sourceTree = "<group>"; };
665956CA1B38B256003E97A1 /* EZAudioDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioDevice.m; sourceTree = "<group>"; };
665956CB1B38B256003E97A1 /* EZAudioFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFile.h; sourceTree = "<group>"; };
665956CC1B38B256003E97A1 /* EZAudioFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFile.m; sourceTree = "<group>"; };
665956CD1B38B256003E97A1 /* EZAudioFloatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatConverter.h; sourceTree = "<group>"; };
665956CE1B38B256003E97A1 /* EZAudioFloatConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatConverter.m; sourceTree = "<group>"; };
665956CF1B38B256003E97A1 /* EZAudioFloatData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatData.h; sourceTree = "<group>"; };
665956D01B38B256003E97A1 /* EZAudioFloatData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatData.m; sourceTree = "<group>"; };
665956D11B38B256003E97A1 /* EZAudioPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlayer.h; sourceTree = "<group>"; };
665956D21B38B256003E97A1 /* EZAudioPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlayer.m; sourceTree = "<group>"; };
665956D31B38B256003E97A1 /* EZAudioPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlot.h; sourceTree = "<group>"; };
665956D41B38B256003E97A1 /* EZAudioPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlot.m; sourceTree = "<group>"; };
665956D51B38B256003E97A1 /* EZAudioPlotGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGL.h; sourceTree = "<group>"; };
665956D61B38B256003E97A1 /* EZAudioPlotGL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGL.m; sourceTree = "<group>"; };
665956D71B38B256003E97A1 /* EZAudioPlotGLKViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGLKViewController.h; sourceTree = "<group>"; };
665956D81B38B256003E97A1 /* EZAudioPlotGLKViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGLKViewController.m; sourceTree = "<group>"; };
665956D91B38B256003E97A1 /* EZAudioUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioUtilities.h; sourceTree = "<group>"; };
665956DA1B38B256003E97A1 /* EZAudioUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioUtilities.m; sourceTree = "<group>"; };
665956DB1B38B256003E97A1 /* EZMicrophone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZMicrophone.h; sourceTree = "<group>"; };
665956DC1B38B256003E97A1 /* EZMicrophone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZMicrophone.m; sourceTree = "<group>"; };
665956DD1B38B256003E97A1 /* EZOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZOutput.h; sourceTree = "<group>"; };
665956DE1B38B256003E97A1 /* EZOutput.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZOutput.m; sourceTree = "<group>"; };
665956DF1B38B256003E97A1 /* EZPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZPlot.h; sourceTree = "<group>"; };
665956E01B38B256003E97A1 /* EZPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZPlot.m; sourceTree = "<group>"; };
665956E11B38B256003E97A1 /* EZRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZRecorder.h; sourceTree = "<group>"; };
665956E21B38B256003E97A1 /* EZRecorder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZRecorder.m; sourceTree = "<group>"; };
665956E31B38B256003E97A1 /* TPCircularBuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = TPCircularBuffer.c; sourceTree = "<group>"; };
665956E41B38B256003E97A1 /* TPCircularBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPCircularBuffer.h; sourceTree = "<group>"; };
665956E61B38B256003E97A1 /* CHANGELOG */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CHANGELOG; sourceTree = "<group>"; };
665956E71B38B256003E97A1 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = "<group>"; };
6611CECC1B46021F00AE0EE8 /* EZAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = EZAudio.framework; path = ../../../EZAudio/OSX/EZAudio.framework; sourceTree = "<group>"; };
6611CED61B46030C00AE0EE8 /* EZAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = EZAudio.framework; path = ../../../EZAudio/OSX/EZAudio.framework; sourceTree = "<group>"; };
94056D85185B97E300EB94BA /* CoreGraphicsWaveformViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CoreGraphicsWaveformViewController.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
94056D86185B97E300EB94BA /* CoreGraphicsWaveformViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CoreGraphicsWaveformViewController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
94056D87185B97E300EB94BA /* CoreGraphicsWaveformViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CoreGraphicsWaveformViewController.xib; sourceTree = "<group>"; };
@@ -122,11 +74,7 @@
94373037185B931C00F315F0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = AppDelegate.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
9437303A185B931C00F315F0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
9437303C185B931C00F315F0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
94373042185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EZAudioCoreGraphicsWaveformExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
94373043185B931C00F315F0 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
9437304A185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "EZAudioCoreGraphicsWaveformExampleTests-Info.plist"; sourceTree = "<group>"; };
9437304C185B931C00F315F0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
9437304E185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = EZAudioCoreGraphicsWaveformExampleTests.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
9437307D185B934900F315F0 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
9437307E185B934900F315F0 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; };
9437307F185B934900F315F0 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
@@ -146,77 +94,19 @@
94373080185B934900F315F0 /* AudioToolbox.framework in Frameworks */,
94373081185B934900F315F0 /* AudioUnit.framework in Frameworks */,
94373082185B934900F315F0 /* CoreAudio.framework in Frameworks */,
6611CED71B46030C00AE0EE8 /* EZAudio.framework in Frameworks */,
94373025185B931C00F315F0 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
9437303F185B931C00F315F0 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
94373045185B931C00F315F0 /* Cocoa.framework in Frameworks */,
94373044185B931C00F315F0 /* XCTest.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
665956C41B38B256003E97A1 /* EZAudio */ = {
isa = PBXGroup;
children = (
665956C51B38B256003E97A1 /* AEFloatConverter.h */,
665956C61B38B256003E97A1 /* AEFloatConverter.m */,
665956C71B38B256003E97A1 /* EZAudio.h */,
665956C81B38B256003E97A1 /* EZAudio.m */,
665956C91B38B256003E97A1 /* EZAudioDevice.h */,
665956CA1B38B256003E97A1 /* EZAudioDevice.m */,
665956CB1B38B256003E97A1 /* EZAudioFile.h */,
665956CC1B38B256003E97A1 /* EZAudioFile.m */,
665956CD1B38B256003E97A1 /* EZAudioFloatConverter.h */,
665956CE1B38B256003E97A1 /* EZAudioFloatConverter.m */,
665956CF1B38B256003E97A1 /* EZAudioFloatData.h */,
665956D01B38B256003E97A1 /* EZAudioFloatData.m */,
665956D11B38B256003E97A1 /* EZAudioPlayer.h */,
665956D21B38B256003E97A1 /* EZAudioPlayer.m */,
665956D31B38B256003E97A1 /* EZAudioPlot.h */,
665956D41B38B256003E97A1 /* EZAudioPlot.m */,
665956D51B38B256003E97A1 /* EZAudioPlotGL.h */,
665956D61B38B256003E97A1 /* EZAudioPlotGL.m */,
665956D71B38B256003E97A1 /* EZAudioPlotGLKViewController.h */,
665956D81B38B256003E97A1 /* EZAudioPlotGLKViewController.m */,
665956D91B38B256003E97A1 /* EZAudioUtilities.h */,
665956DA1B38B256003E97A1 /* EZAudioUtilities.m */,
665956DB1B38B256003E97A1 /* EZMicrophone.h */,
665956DC1B38B256003E97A1 /* EZMicrophone.m */,
665956DD1B38B256003E97A1 /* EZOutput.h */,
665956DE1B38B256003E97A1 /* EZOutput.m */,
665956DF1B38B256003E97A1 /* EZPlot.h */,
665956E01B38B256003E97A1 /* EZPlot.m */,
665956E11B38B256003E97A1 /* EZRecorder.h */,
665956E21B38B256003E97A1 /* EZRecorder.m */,
665956E31B38B256003E97A1 /* TPCircularBuffer.c */,
665956E41B38B256003E97A1 /* TPCircularBuffer.h */,
665956E51B38B256003E97A1 /* VERSION */,
);
name = EZAudio;
path = ../../../../EZAudio;
sourceTree = "<group>";
};
665956E51B38B256003E97A1 /* VERSION */ = {
isa = PBXGroup;
children = (
665956E61B38B256003E97A1 /* CHANGELOG */,
665956E71B38B256003E97A1 /* VERSION */,
);
path = VERSION;
sourceTree = "<group>";
};
94373018185B931C00F315F0 = {
isa = PBXGroup;
children = (
6611CED61B46030C00AE0EE8 /* EZAudio.framework */,
9437302A185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExample */,
94373048185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests */,
94373023185B931C00F315F0 /* Frameworks */,
94373022185B931C00F315F0 /* Products */,
);
@@ -226,7 +116,6 @@
isa = PBXGroup;
children = (
94373021185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExample.app */,
94373042185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests.xctest */,
);
name = Products;
sourceTree = "<group>";
@@ -234,6 +123,7 @@
94373023185B931C00F315F0 /* Frameworks */ = {
isa = PBXGroup;
children = (
6611CECC1B46021F00AE0EE8 /* EZAudio.framework */,
94373087185B937E00F315F0 /* QuartzCore.framework */,
94373085185B937100F315F0 /* OpenGL.framework */,
94373083185B936B00F315F0 /* GLKit.framework */,
@@ -260,7 +150,6 @@
9437302A185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExample */ = {
isa = PBXGroup;
children = (
665956C41B38B256003E97A1 /* EZAudio */,
94373036185B931C00F315F0 /* AppDelegate.h */,
94373037185B931C00F315F0 /* AppDelegate.m */,
94056D85185B97E300EB94BA /* CoreGraphicsWaveformViewController.h */,
@@ -285,24 +174,6 @@
name = "Supporting Files";
sourceTree = "<group>";
};
94373048185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests */ = {
isa = PBXGroup;
children = (
9437304E185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests.m */,
94373049185B931C00F315F0 /* Supporting Files */,
);
path = EZAudioCoreGraphicsWaveformExampleTests;
sourceTree = "<group>";
};
94373049185B931C00F315F0 /* Supporting Files */ = {
isa = PBXGroup;
children = (
9437304A185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests-Info.plist */,
9437304B185B931C00F315F0 /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -313,6 +184,7 @@
9437301D185B931C00F315F0 /* Sources */,
9437301E185B931C00F315F0 /* Frameworks */,
9437301F185B931C00F315F0 /* Resources */,
6611CED51B46026000AE0EE8 /* Embed Frameworks */,
);
buildRules = (
);
@@ -323,24 +195,6 @@
productReference = 94373021185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExample.app */;
productType = "com.apple.product-type.application";
};
94373041185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 94373055185B931D00F315F0 /* Build configuration list for PBXNativeTarget "EZAudioCoreGraphicsWaveformExampleTests" */;
buildPhases = (
9437303E185B931C00F315F0 /* Sources */,
9437303F185B931C00F315F0 /* Frameworks */,
94373040185B931C00F315F0 /* Resources */,
);
buildRules = (
);
dependencies = (
94373047185B931C00F315F0 /* PBXTargetDependency */,
);
name = EZAudioCoreGraphicsWaveformExampleTests;
productName = EZAudioCoreGraphicsWaveformExampleTests;
productReference = 94373042185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -349,11 +203,6 @@
attributes = {
LastUpgradeCheck = 0500;
ORGANIZATIONNAME = "Syed Haris Ali";
TargetAttributes = {
94373041185B931C00F315F0 = {
TestTargetID = 94373020185B931C00F315F0;
};
};
};
buildConfigurationList = 9437301C185B931C00F315F0 /* Build configuration list for PBXProject "EZAudioCoreGraphicsWaveformExample" */;
compatibilityVersion = "Xcode 3.2";
@@ -369,7 +218,6 @@
projectRoot = "";
targets = (
94373020185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExample */,
94373041185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests */,
94F8DF4A18C84203005C4CBD /* Generate Documentation */,
);
};
@@ -381,20 +229,10 @@
buildActionMask = 2147483647;
files = (
9437302F185B931C00F315F0 /* InfoPlist.strings in Resources */,
665956F91B38B256003E97A1 /* VERSION in Resources */,
9437303D185B931C00F315F0 /* Images.xcassets in Resources */,
94373035185B931C00F315F0 /* Credits.rtf in Resources */,
94056D89185B97E300EB94BA /* CoreGraphicsWaveformViewController.xib in Resources */,
9437303B185B931C00F315F0 /* MainMenu.xib in Resources */,
665956F81B38B256003E97A1 /* CHANGELOG in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
94373040185B931C00F315F0 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9437304D185B931C00F315F0 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -421,46 +259,14 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
665956F61B38B256003E97A1 /* EZRecorder.m in Sources */,
94056D88185B97E300EB94BA /* CoreGraphicsWaveformViewController.m in Sources */,
665956EC1B38B256003E97A1 /* EZAudioFloatConverter.m in Sources */,
665956ED1B38B256003E97A1 /* EZAudioFloatData.m in Sources */,
665956E81B38B256003E97A1 /* AEFloatConverter.m in Sources */,
665956EB1B38B256003E97A1 /* EZAudioFile.m in Sources */,
665956F41B38B256003E97A1 /* EZOutput.m in Sources */,
665956F01B38B256003E97A1 /* EZAudioPlotGL.m in Sources */,
665956F71B38B256003E97A1 /* TPCircularBuffer.c in Sources */,
665956EF1B38B256003E97A1 /* EZAudioPlot.m in Sources */,
94373038185B931C00F315F0 /* AppDelegate.m in Sources */,
665956F31B38B256003E97A1 /* EZMicrophone.m in Sources */,
665956EE1B38B256003E97A1 /* EZAudioPlayer.m in Sources */,
665956EA1B38B256003E97A1 /* EZAudioDevice.m in Sources */,
94373031185B931C00F315F0 /* main.m in Sources */,
665956F51B38B256003E97A1 /* EZPlot.m in Sources */,
665956E91B38B256003E97A1 /* EZAudio.m in Sources */,
665956F21B38B256003E97A1 /* EZAudioUtilities.m in Sources */,
665956F11B38B256003E97A1 /* EZAudioPlotGLKViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
9437303E185B931C00F315F0 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9437304F185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
94373047185B931C00F315F0 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 94373020185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExample */;
targetProxy = 94373046185B931C00F315F0 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
9437302D185B931C00F315F0 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
@@ -486,14 +292,6 @@
name = MainMenu.xib;
sourceTree = "<group>";
};
9437304B185B931C00F315F0 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
9437304C185B931C00F315F0 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
@@ -570,9 +368,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
/Users/haris/Documents/code/openSource/EZAudio/EZAudio/OSX,
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioCoreGraphicsWaveformExample/EZAudioCoreGraphicsWaveformExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioCoreGraphicsWaveformExample/EZAudioCoreGraphicsWaveformExample-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -583,54 +386,19 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
/Users/haris/Documents/code/openSource/EZAudio/EZAudio/OSX,
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioCoreGraphicsWaveformExample/EZAudioCoreGraphicsWaveformExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioCoreGraphicsWaveformExample/EZAudioCoreGraphicsWaveformExample-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
94373056185B931D00F315F0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/EZAudioCoreGraphicsWaveformExample.app/Contents/MacOS/EZAudioCoreGraphicsWaveformExample";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioCoreGraphicsWaveformExample/EZAudioCoreGraphicsWaveformExample-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = "EZAudioCoreGraphicsWaveformExampleTests/EZAudioCoreGraphicsWaveformExampleTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Debug;
};
94373057185B931D00F315F0 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/EZAudioCoreGraphicsWaveformExample.app/Contents/MacOS/EZAudioCoreGraphicsWaveformExample";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioCoreGraphicsWaveformExample/EZAudioCoreGraphicsWaveformExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioCoreGraphicsWaveformExampleTests/EZAudioCoreGraphicsWaveformExampleTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Release;
};
94F8DF4B18C84204005C4CBD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -666,15 +434,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
94373055185B931D00F315F0 /* Build configuration list for PBXNativeTarget "EZAudioCoreGraphicsWaveformExampleTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
94373056185B931D00F315F0 /* Debug */,
94373057185B931D00F315F0 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
94F8DF4D18C84204005C4CBD /* Build configuration list for PBXAggregateTarget "Generate Documentation" */ = {
isa = XCConfigurationList;
buildConfigurations = (
@@ -26,7 +26,7 @@
#import <Cocoa/Cocoa.h>
// Import EZAudio header
#import "EZAudio.h"
#import <EZAudio/EZAudio.h>
/**
We will allow this view controller to act as an EZMicrophoneDelegate. This is how we listen for the microphone callback.
@@ -102,10 +102,8 @@
for (int i = 0; i < self.microphone.device.inputChannelCount; i++)
{
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:@(i).stringValue
action:@selector(changedInputChannel:)
action:nil
keyEquivalent:@""];
item.representedObject = @(i);
item.target = self;
[menu addItem:item];
}
self.microphoneInputChannelPopUpButton.menu = menu;
@@ -124,12 +122,6 @@
//------------------------------------------------------------------------------
- (void)changedInputChannel:(id)sender
{
}
//------------------------------------------------------------------------------
- (void)changePlotType:(id)sender
{
NSInteger selectedSegment = [sender selectedSegment];
@@ -163,7 +155,10 @@
}
}
//------------------------------------------------------------------------------
#pragma mark - Action Extensions
//------------------------------------------------------------------------------
/*
Give the visualization of the current buffer (this is almost exactly the openFrameworks audio input eample)
*/
@@ -189,10 +184,10 @@
#pragma mark - EZMicrophoneDelegate
#warning Thread Safety
// Note that any callback that provides streamed audio data (like streaming microphone input) happens on a separate audio thread that should not be blocked. When we feed audio data into any of the UI components we need to explicity create a GCD block on the main thread to properly get the UI to work.
- (void)microphone:(EZMicrophone *)microphone
hasAudioReceived:(float **)buffer
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels
- (void) microphone:(EZMicrophone *)microphone
hasAudioReceived:(float **)buffer
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels
{
// See the Thread Safety warning above, but in a nutshell these callbacks happen on a separate audio thread. We wrap any UI updating in a GCD block on the main thread to avoid blocking that audio flow.
__weak typeof(self) weakSelf = self;
@@ -227,18 +222,19 @@ withNumberOfChannels:(UInt32)numberOfChannels
- (void)microphone:(EZMicrophone *)microphone
changedDevice:(EZAudioDevice *)device
{
__weak typeof (self) weakSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
//
// Set up the microphone input popup button's items to select
// between different microphone inputs
//
[self reloadMicrophoneInputPopUpButtonMenu];
[weakSelf reloadMicrophoneInputPopUpButtonMenu];
//
// Set up the microphone input popup button's items to select
// between different microphone input channels
//
[self reloadMicrophoneInputChannelPopUpButtonMenu];
[weakSelf reloadMicrophoneInputChannelPopUpButtonMenu];
});
}
@@ -80,17 +80,17 @@
</popUpButtonCell>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fi6-Uh-bvr">
<rect key="frame" x="18" y="43" width="31" height="14"/>
<rect key="frame" x="18" y="43" width="36" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Input" id="Png-Pk-fMc">
<font key="font" metaFont="smallSystem"/>
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="HVN-Im-3J1">
<rect key="frame" x="204" y="43" width="48" height="14"/>
<rect key="frame" x="204" y="43" width="55" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Channel" id="lkh-zp-WCY">
<font key="font" metaFont="smallSystem"/>
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
@@ -1,51 +0,0 @@
//
// EZAudioCoreGraphicsWaveformExampleTests.m
// EZAudioCoreGraphicsWaveformExampleTests
//
// Created by Syed Haris Ali on 12/1/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <XCTest/XCTest.h>
@interface EZAudioCoreGraphicsWaveformExampleTests : XCTestCase
@end
@implementation EZAudioCoreGraphicsWaveformExampleTests
- (void)setUp
{
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown
{
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample
{
XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
}
@end
@@ -1,2 +0,0 @@
/* Localized versions of Info.plist keys */
@@ -2,7 +2,10 @@
<Workspace
version = "1.0">
<FileRef
location = "group:EZAudioCoreGraphicsWaveformExample/EZAudioCoreGraphicsWaveformExample.xcodeproj">
location = "group:../../EZAudio/OSX/EZAudio.xcodeproj">
</FileRef>
<FileRef
location = "container:EZAudioCoreGraphicsWaveformExample/EZAudioCoreGraphicsWaveformExample.xcodeproj">
</FileRef>
<FileRef
location = "group:EZAudioOpenGLWaveformExample/EZAudioOpenGLWaveformExample.xcodeproj">
@@ -7,24 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
6628E2C61B3A1CCE00020E56 /* AEFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2A41B3A1CCE00020E56 /* AEFloatConverter.m */; };
6628E2C71B3A1CCE00020E56 /* EZAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2A61B3A1CCE00020E56 /* EZAudio.m */; };
6628E2C81B3A1CCE00020E56 /* EZAudioDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2A81B3A1CCE00020E56 /* EZAudioDevice.m */; };
6628E2C91B3A1CCE00020E56 /* EZAudioFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2AA1B3A1CCE00020E56 /* EZAudioFile.m */; };
6628E2CA1B3A1CCE00020E56 /* EZAudioFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2AC1B3A1CCE00020E56 /* EZAudioFloatConverter.m */; };
6628E2CB1B3A1CCE00020E56 /* EZAudioFloatData.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2AE1B3A1CCE00020E56 /* EZAudioFloatData.m */; };
6628E2CC1B3A1CCE00020E56 /* EZAudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2B01B3A1CCE00020E56 /* EZAudioPlayer.m */; };
6628E2CD1B3A1CCE00020E56 /* EZAudioPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2B21B3A1CCE00020E56 /* EZAudioPlot.m */; };
6628E2CE1B3A1CCE00020E56 /* EZAudioPlotGL.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2B41B3A1CCE00020E56 /* EZAudioPlotGL.m */; };
6628E2CF1B3A1CCE00020E56 /* EZAudioPlotGLKViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2B61B3A1CCE00020E56 /* EZAudioPlotGLKViewController.m */; };
6628E2D01B3A1CCE00020E56 /* EZAudioUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2B81B3A1CCE00020E56 /* EZAudioUtilities.m */; };
6628E2D11B3A1CCE00020E56 /* EZMicrophone.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2BA1B3A1CCE00020E56 /* EZMicrophone.m */; };
6628E2D21B3A1CCE00020E56 /* EZOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2BC1B3A1CCE00020E56 /* EZOutput.m */; };
6628E2D31B3A1CCE00020E56 /* EZPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2BE1B3A1CCE00020E56 /* EZPlot.m */; };
6628E2D41B3A1CCE00020E56 /* EZRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2C01B3A1CCE00020E56 /* EZRecorder.m */; };
6628E2D51B3A1CCE00020E56 /* TPCircularBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2C11B3A1CCE00020E56 /* TPCircularBuffer.c */; };
6628E2D61B3A1CCE00020E56 /* CHANGELOG in Resources */ = {isa = PBXBuildFile; fileRef = 6628E2C41B3A1CCE00020E56 /* CHANGELOG */; };
6628E2D71B3A1CCE00020E56 /* VERSION in Resources */ = {isa = PBXBuildFile; fileRef = 6628E2C51B3A1CCE00020E56 /* VERSION */; };
9417A8F71871492000D9D37B /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9417A8F61871492000D9D37B /* Cocoa.framework */; };
9417A9011871492000D9D37B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9417A8FF1871492000D9D37B /* InfoPlist.strings */; };
9417A9031871492000D9D37B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A9021871492000D9D37B /* main.m */; };
@@ -32,10 +14,6 @@
9417A90A1871492100D9D37B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A9091871492100D9D37B /* AppDelegate.m */; };
9417A90D1871492100D9D37B /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9417A90B1871492100D9D37B /* MainMenu.xib */; };
9417A90F1871492100D9D37B /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9417A90E1871492100D9D37B /* Images.xcassets */; };
9417A9161871492100D9D37B /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9417A9151871492100D9D37B /* XCTest.framework */; };
9417A9171871492100D9D37B /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9417A8F61871492000D9D37B /* Cocoa.framework */; };
9417A91F1871492100D9D37B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9417A91D1871492100D9D37B /* InfoPlist.strings */; };
9417A9211871492100D9D37B /* EZAudioFFTExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A9201871492100D9D37B /* EZAudioFFTExampleTests.m */; };
9417A954187149EA00D9D37B /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9417A951187149EA00D9D37B /* AudioToolbox.framework */; };
9417A955187149EA00D9D37B /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9417A952187149EA00D9D37B /* AudioUnit.framework */; };
9417A956187149EA00D9D37B /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9417A953187149EA00D9D37B /* CoreAudio.framework */; };
@@ -47,51 +25,7 @@
9417A9D71872130200D9D37B /* FFTViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9417A9D51872130200D9D37B /* FFTViewController.xib */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
9417A9181871492100D9D37B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 9417A8EB1871492000D9D37B /* Project object */;
proxyType = 1;
remoteGlobalIDString = 9417A8F21871492000D9D37B;
remoteInfo = EZAudioFFTExample;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
6628E2A31B3A1CCE00020E56 /* AEFloatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AEFloatConverter.h; sourceTree = "<group>"; };
6628E2A41B3A1CCE00020E56 /* AEFloatConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AEFloatConverter.m; sourceTree = "<group>"; };
6628E2A51B3A1CCE00020E56 /* EZAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudio.h; sourceTree = "<group>"; };
6628E2A61B3A1CCE00020E56 /* EZAudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudio.m; sourceTree = "<group>"; };
6628E2A71B3A1CCE00020E56 /* EZAudioDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioDevice.h; sourceTree = "<group>"; };
6628E2A81B3A1CCE00020E56 /* EZAudioDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioDevice.m; sourceTree = "<group>"; };
6628E2A91B3A1CCE00020E56 /* EZAudioFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFile.h; sourceTree = "<group>"; };
6628E2AA1B3A1CCE00020E56 /* EZAudioFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFile.m; sourceTree = "<group>"; };
6628E2AB1B3A1CCE00020E56 /* EZAudioFloatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatConverter.h; sourceTree = "<group>"; };
6628E2AC1B3A1CCE00020E56 /* EZAudioFloatConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatConverter.m; sourceTree = "<group>"; };
6628E2AD1B3A1CCE00020E56 /* EZAudioFloatData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatData.h; sourceTree = "<group>"; };
6628E2AE1B3A1CCE00020E56 /* EZAudioFloatData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatData.m; sourceTree = "<group>"; };
6628E2AF1B3A1CCE00020E56 /* EZAudioPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlayer.h; sourceTree = "<group>"; };
6628E2B01B3A1CCE00020E56 /* EZAudioPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlayer.m; sourceTree = "<group>"; };
6628E2B11B3A1CCE00020E56 /* EZAudioPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlot.h; sourceTree = "<group>"; };
6628E2B21B3A1CCE00020E56 /* EZAudioPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlot.m; sourceTree = "<group>"; };
6628E2B31B3A1CCE00020E56 /* EZAudioPlotGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGL.h; sourceTree = "<group>"; };
6628E2B41B3A1CCE00020E56 /* EZAudioPlotGL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGL.m; sourceTree = "<group>"; };
6628E2B51B3A1CCE00020E56 /* EZAudioPlotGLKViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGLKViewController.h; sourceTree = "<group>"; };
6628E2B61B3A1CCE00020E56 /* EZAudioPlotGLKViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGLKViewController.m; sourceTree = "<group>"; };
6628E2B71B3A1CCE00020E56 /* EZAudioUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioUtilities.h; sourceTree = "<group>"; };
6628E2B81B3A1CCE00020E56 /* EZAudioUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioUtilities.m; sourceTree = "<group>"; };
6628E2B91B3A1CCE00020E56 /* EZMicrophone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZMicrophone.h; sourceTree = "<group>"; };
6628E2BA1B3A1CCE00020E56 /* EZMicrophone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZMicrophone.m; sourceTree = "<group>"; };
6628E2BB1B3A1CCE00020E56 /* EZOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZOutput.h; sourceTree = "<group>"; };
6628E2BC1B3A1CCE00020E56 /* EZOutput.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZOutput.m; sourceTree = "<group>"; };
6628E2BD1B3A1CCE00020E56 /* EZPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZPlot.h; sourceTree = "<group>"; };
6628E2BE1B3A1CCE00020E56 /* EZPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZPlot.m; sourceTree = "<group>"; };
6628E2BF1B3A1CCE00020E56 /* EZRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZRecorder.h; sourceTree = "<group>"; };
6628E2C01B3A1CCE00020E56 /* EZRecorder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZRecorder.m; sourceTree = "<group>"; };
6628E2C11B3A1CCE00020E56 /* TPCircularBuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = TPCircularBuffer.c; sourceTree = "<group>"; };
6628E2C21B3A1CCE00020E56 /* TPCircularBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPCircularBuffer.h; sourceTree = "<group>"; };
6628E2C41B3A1CCE00020E56 /* CHANGELOG */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CHANGELOG; sourceTree = "<group>"; };
6628E2C51B3A1CCE00020E56 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = "<group>"; };
9417A8F31871492000D9D37B /* EZAudioFFTExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EZAudioFFTExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
9417A8F61871492000D9D37B /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
9417A8F91871492000D9D37B /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
@@ -106,11 +40,7 @@
9417A9091871492100D9D37B /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
9417A90C1871492100D9D37B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
9417A90E1871492100D9D37B /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
9417A9141871492100D9D37B /* EZAudioFFTExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EZAudioFFTExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
9417A9151871492100D9D37B /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
9417A91C1871492100D9D37B /* EZAudioFFTExampleTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "EZAudioFFTExampleTests-Info.plist"; sourceTree = "<group>"; };
9417A91E1871492100D9D37B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
9417A9201871492100D9D37B /* EZAudioFFTExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EZAudioFFTExampleTests.m; sourceTree = "<group>"; };
9417A951187149EA00D9D37B /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
9417A952187149EA00D9D37B /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; };
9417A953187149EA00D9D37B /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
@@ -139,73 +69,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
9417A9111871492100D9D37B /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9417A9171871492100D9D37B /* Cocoa.framework in Frameworks */,
9417A9161871492100D9D37B /* XCTest.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
6628E2A21B3A1CCE00020E56 /* EZAudio */ = {
isa = PBXGroup;
children = (
6628E2A31B3A1CCE00020E56 /* AEFloatConverter.h */,
6628E2A41B3A1CCE00020E56 /* AEFloatConverter.m */,
6628E2A51B3A1CCE00020E56 /* EZAudio.h */,
6628E2A61B3A1CCE00020E56 /* EZAudio.m */,
6628E2A71B3A1CCE00020E56 /* EZAudioDevice.h */,
6628E2A81B3A1CCE00020E56 /* EZAudioDevice.m */,
6628E2A91B3A1CCE00020E56 /* EZAudioFile.h */,
6628E2AA1B3A1CCE00020E56 /* EZAudioFile.m */,
6628E2AB1B3A1CCE00020E56 /* EZAudioFloatConverter.h */,
6628E2AC1B3A1CCE00020E56 /* EZAudioFloatConverter.m */,
6628E2AD1B3A1CCE00020E56 /* EZAudioFloatData.h */,
6628E2AE1B3A1CCE00020E56 /* EZAudioFloatData.m */,
6628E2AF1B3A1CCE00020E56 /* EZAudioPlayer.h */,
6628E2B01B3A1CCE00020E56 /* EZAudioPlayer.m */,
6628E2B11B3A1CCE00020E56 /* EZAudioPlot.h */,
6628E2B21B3A1CCE00020E56 /* EZAudioPlot.m */,
6628E2B31B3A1CCE00020E56 /* EZAudioPlotGL.h */,
6628E2B41B3A1CCE00020E56 /* EZAudioPlotGL.m */,
6628E2B51B3A1CCE00020E56 /* EZAudioPlotGLKViewController.h */,
6628E2B61B3A1CCE00020E56 /* EZAudioPlotGLKViewController.m */,
6628E2B71B3A1CCE00020E56 /* EZAudioUtilities.h */,
6628E2B81B3A1CCE00020E56 /* EZAudioUtilities.m */,
6628E2B91B3A1CCE00020E56 /* EZMicrophone.h */,
6628E2BA1B3A1CCE00020E56 /* EZMicrophone.m */,
6628E2BB1B3A1CCE00020E56 /* EZOutput.h */,
6628E2BC1B3A1CCE00020E56 /* EZOutput.m */,
6628E2BD1B3A1CCE00020E56 /* EZPlot.h */,
6628E2BE1B3A1CCE00020E56 /* EZPlot.m */,
6628E2BF1B3A1CCE00020E56 /* EZRecorder.h */,
6628E2C01B3A1CCE00020E56 /* EZRecorder.m */,
6628E2C11B3A1CCE00020E56 /* TPCircularBuffer.c */,
6628E2C21B3A1CCE00020E56 /* TPCircularBuffer.h */,
6628E2C31B3A1CCE00020E56 /* VERSION */,
);
name = EZAudio;
path = ../../../../EZAudio;
sourceTree = "<group>";
};
6628E2C31B3A1CCE00020E56 /* VERSION */ = {
isa = PBXGroup;
children = (
6628E2C41B3A1CCE00020E56 /* CHANGELOG */,
6628E2C51B3A1CCE00020E56 /* VERSION */,
);
path = VERSION;
sourceTree = "<group>";
};
9417A8EA1871492000D9D37B = {
isa = PBXGroup;
children = (
9417A8FC1871492000D9D37B /* EZAudioFFTExample */,
9417A91A1871492100D9D37B /* EZAudioFFTExampleTests */,
9417A8F51871492000D9D37B /* Frameworks */,
9417A8F41871492000D9D37B /* Products */,
);
@@ -215,7 +85,6 @@
isa = PBXGroup;
children = (
9417A8F31871492000D9D37B /* EZAudioFFTExample.app */,
9417A9141871492100D9D37B /* EZAudioFFTExampleTests.xctest */,
);
name = Products;
sourceTree = "<group>";
@@ -250,7 +119,6 @@
9417A8FC1871492000D9D37B /* EZAudioFFTExample */ = {
isa = PBXGroup;
children = (
6628E2A21B3A1CCE00020E56 /* EZAudio */,
9417A9081871492100D9D37B /* AppDelegate.h */,
9417A9091871492100D9D37B /* AppDelegate.m */,
9417A9D31872130200D9D37B /* FFTViewController.h */,
@@ -275,24 +143,6 @@
name = "Supporting Files";
sourceTree = "<group>";
};
9417A91A1871492100D9D37B /* EZAudioFFTExampleTests */ = {
isa = PBXGroup;
children = (
9417A9201871492100D9D37B /* EZAudioFFTExampleTests.m */,
9417A91B1871492100D9D37B /* Supporting Files */,
);
path = EZAudioFFTExampleTests;
sourceTree = "<group>";
};
9417A91B1871492100D9D37B /* Supporting Files */ = {
isa = PBXGroup;
children = (
9417A91C1871492100D9D37B /* EZAudioFFTExampleTests-Info.plist */,
9417A91D1871492100D9D37B /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -313,24 +163,6 @@
productReference = 9417A8F31871492000D9D37B /* EZAudioFFTExample.app */;
productType = "com.apple.product-type.application";
};
9417A9131871492100D9D37B /* EZAudioFFTExampleTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 9417A9271871492100D9D37B /* Build configuration list for PBXNativeTarget "EZAudioFFTExampleTests" */;
buildPhases = (
9417A9101871492100D9D37B /* Sources */,
9417A9111871492100D9D37B /* Frameworks */,
9417A9121871492100D9D37B /* Resources */,
);
buildRules = (
);
dependencies = (
9417A9191871492100D9D37B /* PBXTargetDependency */,
);
name = EZAudioFFTExampleTests;
productName = EZAudioFFTExampleTests;
productReference = 9417A9141871492100D9D37B /* EZAudioFFTExampleTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -339,11 +171,6 @@
attributes = {
LastUpgradeCheck = 0500;
ORGANIZATIONNAME = "Syed Haris Ali";
TargetAttributes = {
9417A9131871492100D9D37B = {
TestTargetID = 9417A8F21871492000D9D37B;
};
};
};
buildConfigurationList = 9417A8EE1871492000D9D37B /* Build configuration list for PBXProject "EZAudioFFTExample" */;
compatibilityVersion = "Xcode 3.2";
@@ -359,7 +186,6 @@
projectRoot = "";
targets = (
9417A8F21871492000D9D37B /* EZAudioFFTExample */,
9417A9131871492100D9D37B /* EZAudioFFTExampleTests */,
);
};
/* End PBXProject section */
@@ -370,20 +196,10 @@
buildActionMask = 2147483647;
files = (
9417A9011871492000D9D37B /* InfoPlist.strings in Resources */,
6628E2D71B3A1CCE00020E56 /* VERSION in Resources */,
9417A9D71872130200D9D37B /* FFTViewController.xib in Resources */,
9417A90F1871492100D9D37B /* Images.xcassets in Resources */,
9417A9071871492100D9D37B /* Credits.rtf in Resources */,
9417A90D1871492100D9D37B /* MainMenu.xib in Resources */,
6628E2D61B3A1CCE00020E56 /* CHANGELOG in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
9417A9121871492100D9D37B /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9417A91F1871492100D9D37B /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -394,46 +210,14 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6628E2D41B3A1CCE00020E56 /* EZRecorder.m in Sources */,
9417A9D61872130200D9D37B /* FFTViewController.m in Sources */,
6628E2CA1B3A1CCE00020E56 /* EZAudioFloatConverter.m in Sources */,
6628E2CB1B3A1CCE00020E56 /* EZAudioFloatData.m in Sources */,
6628E2C61B3A1CCE00020E56 /* AEFloatConverter.m in Sources */,
6628E2C91B3A1CCE00020E56 /* EZAudioFile.m in Sources */,
6628E2D21B3A1CCE00020E56 /* EZOutput.m in Sources */,
6628E2CE1B3A1CCE00020E56 /* EZAudioPlotGL.m in Sources */,
6628E2D51B3A1CCE00020E56 /* TPCircularBuffer.c in Sources */,
6628E2CD1B3A1CCE00020E56 /* EZAudioPlot.m in Sources */,
9417A90A1871492100D9D37B /* AppDelegate.m in Sources */,
6628E2D11B3A1CCE00020E56 /* EZMicrophone.m in Sources */,
6628E2CC1B3A1CCE00020E56 /* EZAudioPlayer.m in Sources */,
6628E2C81B3A1CCE00020E56 /* EZAudioDevice.m in Sources */,
9417A9031871492000D9D37B /* main.m in Sources */,
6628E2D31B3A1CCE00020E56 /* EZPlot.m in Sources */,
6628E2C71B3A1CCE00020E56 /* EZAudio.m in Sources */,
6628E2D01B3A1CCE00020E56 /* EZAudioUtilities.m in Sources */,
6628E2CF1B3A1CCE00020E56 /* EZAudioPlotGLKViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
9417A9101871492100D9D37B /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9417A9211871492100D9D37B /* EZAudioFFTExampleTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
9417A9191871492100D9D37B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 9417A8F21871492000D9D37B /* EZAudioFFTExample */;
targetProxy = 9417A9181871492100D9D37B /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
9417A8FF1871492000D9D37B /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
@@ -459,14 +243,6 @@
name = MainMenu.xib;
sourceTree = "<group>";
};
9417A91D1871492100D9D37B /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
9417A91E1871492100D9D37B /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
@@ -546,6 +322,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioFFTExample/EZAudioFFTExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioFFTExample/EZAudioFFTExample-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -559,51 +336,12 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioFFTExample/EZAudioFFTExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioFFTExample/EZAudioFFTExample-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
9417A9281871492100D9D37B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/EZAudioFFTExample.app/Contents/MacOS/EZAudioFFTExample";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioFFTExample/EZAudioFFTExample-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = "EZAudioFFTExampleTests/EZAudioFFTExampleTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Debug;
};
9417A9291871492100D9D37B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/EZAudioFFTExample.app/Contents/MacOS/EZAudioFFTExample";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioFFTExample/EZAudioFFTExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioFFTExampleTests/EZAudioFFTExampleTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -625,15 +363,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
9417A9271871492100D9D37B /* Build configuration list for PBXNativeTarget "EZAudioFFTExampleTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
9417A9281871492100D9D37B /* Debug */,
9417A9291871492100D9D37B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 9417A8EB1871492000D9D37B /* Project object */;
@@ -28,7 +28,7 @@
/**
EZAudio
*/
#import "EZAudio.h"
#import <EZAudio/EZAudio.h>
/**
Accelerate
@@ -44,7 +44,7 @@
/**
EZAudioPlot for frequency plot
*/
@property (nonatomic,weak) IBOutlet EZAudioPlotGL *audioPlotFreq;
@property (nonatomic,weak) IBOutlet EZAudioPlot *audioPlotFreq;
/**
EZAudioPlot for time plot
@@ -62,10 +62,11 @@
//
// Setup frequency domain audio plot
//
self.audioPlotFreq.backgroundColor = [NSColor colorWithCalibratedRed: 0.984 green: 0.471 blue: 0.525 alpha: 1];
self.audioPlotFreq.color = [NSColor colorWithCalibratedRed:1.0 green:1.0 blue:1.0 alpha:1.0];
self.audioPlotFreq.shouldFill = YES;
self.audioPlotFreq.plotType = EZPlotTypeBuffer;
self.audioPlotFreq.backgroundColor = [NSColor colorWithCalibratedRed: 0.984 green: 0.471 blue: 0.525 alpha: 1];
self.audioPlotFreq.color = [NSColor colorWithCalibratedRed:1.0 green:1.0 blue:1.0 alpha:1.0];
self.audioPlotFreq.shouldFill = YES;
self.audioPlotFreq.plotType = EZPlotTypeBuffer;
self.audioPlotFreq.shouldCenterYAxis = NO;
//
// Create an instance of the microphone and tell it to use this view controller instance as the delegate
@@ -25,7 +25,7 @@
<rect key="frame" x="0.0" y="0.0" width="480" height="132"/>
<autoresizingMask key="autoresizingMask"/>
</customView>
<customView fixedFrame="YES" id="4V2-1I-w64" customClass="EZAudioPlotGL">
<customView fixedFrame="YES" id="4V2-1I-w64" customClass="EZAudioPlot">
<rect key="frame" x="0.0" y="133" width="480" height="139"/>
<autoresizingMask key="autoresizingMask"/>
</customView>
@@ -1,34 +0,0 @@
//
// EZAudioFFTExampleTests.m
// EZAudioFFTExampleTests
//
// Created by Syed Haris Ali on 12/29/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
#import <XCTest/XCTest.h>
@interface EZAudioFFTExampleTests : XCTestCase
@end
@implementation EZAudioFFTExampleTests
- (void)setUp
{
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown
{
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample
{
XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
}
@end
@@ -1,2 +0,0 @@
/* Localized versions of Info.plist keys */
@@ -7,24 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
665957541B38B2B4003E97A1 /* AEFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957321B38B2B4003E97A1 /* AEFloatConverter.m */; };
665957551B38B2B4003E97A1 /* EZAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957341B38B2B4003E97A1 /* EZAudio.m */; };
665957561B38B2B4003E97A1 /* EZAudioDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957361B38B2B4003E97A1 /* EZAudioDevice.m */; };
665957571B38B2B4003E97A1 /* EZAudioFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957381B38B2B4003E97A1 /* EZAudioFile.m */; };
665957581B38B2B4003E97A1 /* EZAudioFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 6659573A1B38B2B4003E97A1 /* EZAudioFloatConverter.m */; };
665957591B38B2B4003E97A1 /* EZAudioFloatData.m in Sources */ = {isa = PBXBuildFile; fileRef = 6659573C1B38B2B4003E97A1 /* EZAudioFloatData.m */; };
6659575A1B38B2B4003E97A1 /* EZAudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6659573E1B38B2B4003E97A1 /* EZAudioPlayer.m */; };
6659575B1B38B2B4003E97A1 /* EZAudioPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957401B38B2B4003E97A1 /* EZAudioPlot.m */; };
6659575C1B38B2B4003E97A1 /* EZAudioPlotGL.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957421B38B2B4003E97A1 /* EZAudioPlotGL.m */; };
6659575D1B38B2B4003E97A1 /* EZAudioPlotGLKViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957441B38B2B4003E97A1 /* EZAudioPlotGLKViewController.m */; };
6659575E1B38B2B4003E97A1 /* EZAudioUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957461B38B2B4003E97A1 /* EZAudioUtilities.m */; };
6659575F1B38B2B4003E97A1 /* EZMicrophone.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957481B38B2B4003E97A1 /* EZMicrophone.m */; };
665957601B38B2B4003E97A1 /* EZOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 6659574A1B38B2B4003E97A1 /* EZOutput.m */; };
665957611B38B2B4003E97A1 /* EZPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 6659574C1B38B2B4003E97A1 /* EZPlot.m */; };
665957621B38B2B4003E97A1 /* EZRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 6659574E1B38B2B4003E97A1 /* EZRecorder.m */; };
665957631B38B2B4003E97A1 /* TPCircularBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 6659574F1B38B2B4003E97A1 /* TPCircularBuffer.c */; };
665957641B38B2B4003E97A1 /* CHANGELOG in Resources */ = {isa = PBXBuildFile; fileRef = 665957521B38B2B4003E97A1 /* CHANGELOG */; };
665957651B38B2B4003E97A1 /* VERSION in Resources */ = {isa = PBXBuildFile; fileRef = 665957531B38B2B4003E97A1 /* VERSION */; };
94056D97185BB0BC00EB94BA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94056D96185BB0BC00EB94BA /* Cocoa.framework */; };
94056DA1185BB0BC00EB94BA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 94056D9F185BB0BC00EB94BA /* InfoPlist.strings */; };
94056DA3185BB0BC00EB94BA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 94056DA2185BB0BC00EB94BA /* main.m */; };
@@ -32,10 +14,6 @@
94056DAA185BB0BC00EB94BA /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 94056DA9185BB0BC00EB94BA /* AppDelegate.m */; };
94056DAD185BB0BC00EB94BA /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 94056DAB185BB0BC00EB94BA /* MainMenu.xib */; };
94056DAF185BB0BC00EB94BA /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 94056DAE185BB0BC00EB94BA /* Images.xcassets */; };
94056DB6185BB0BC00EB94BA /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94056DB5185BB0BC00EB94BA /* XCTest.framework */; };
94056DB7185BB0BC00EB94BA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94056D96185BB0BC00EB94BA /* Cocoa.framework */; };
94056DBF185BB0BC00EB94BA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 94056DBD185BB0BC00EB94BA /* InfoPlist.strings */; };
94056DC1185BB0BC00EB94BA /* EZAudioOpenGLWaveformExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 94056DC0185BB0BC00EB94BA /* EZAudioOpenGLWaveformExampleTests.m */; };
94056DCD185BB0D600EB94BA /* OpenGLWaveformViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 94056DCB185BB0D600EB94BA /* OpenGLWaveformViewController.m */; };
94056DCE185BB0D600EB94BA /* OpenGLWaveformViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 94056DCC185BB0D600EB94BA /* OpenGLWaveformViewController.xib */; };
94056DD0185BB0E200EB94BA /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94056DCF185BB0E200EB94BA /* GLKit.framework */; };
@@ -46,51 +24,8 @@
94056DDA185BB0F400EB94BA /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94056DD7185BB0F400EB94BA /* CoreAudio.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
94056DB8185BB0BC00EB94BA /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 94056D8B185BB0BC00EB94BA /* Project object */;
proxyType = 1;
remoteGlobalIDString = 94056D92185BB0BC00EB94BA;
remoteInfo = EZAudioOpenGLWaveformExample;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
665957311B38B2B4003E97A1 /* AEFloatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AEFloatConverter.h; sourceTree = "<group>"; };
665957321B38B2B4003E97A1 /* AEFloatConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AEFloatConverter.m; sourceTree = "<group>"; };
665957331B38B2B4003E97A1 /* EZAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudio.h; sourceTree = "<group>"; };
665957341B38B2B4003E97A1 /* EZAudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudio.m; sourceTree = "<group>"; };
665957351B38B2B4003E97A1 /* EZAudioDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioDevice.h; sourceTree = "<group>"; };
665957361B38B2B4003E97A1 /* EZAudioDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioDevice.m; sourceTree = "<group>"; };
665957371B38B2B4003E97A1 /* EZAudioFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFile.h; sourceTree = "<group>"; };
665957381B38B2B4003E97A1 /* EZAudioFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFile.m; sourceTree = "<group>"; };
665957391B38B2B4003E97A1 /* EZAudioFloatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatConverter.h; sourceTree = "<group>"; };
6659573A1B38B2B4003E97A1 /* EZAudioFloatConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatConverter.m; sourceTree = "<group>"; };
6659573B1B38B2B4003E97A1 /* EZAudioFloatData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatData.h; sourceTree = "<group>"; };
6659573C1B38B2B4003E97A1 /* EZAudioFloatData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatData.m; sourceTree = "<group>"; };
6659573D1B38B2B4003E97A1 /* EZAudioPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlayer.h; sourceTree = "<group>"; };
6659573E1B38B2B4003E97A1 /* EZAudioPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlayer.m; sourceTree = "<group>"; };
6659573F1B38B2B4003E97A1 /* EZAudioPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlot.h; sourceTree = "<group>"; };
665957401B38B2B4003E97A1 /* EZAudioPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlot.m; sourceTree = "<group>"; };
665957411B38B2B4003E97A1 /* EZAudioPlotGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGL.h; sourceTree = "<group>"; };
665957421B38B2B4003E97A1 /* EZAudioPlotGL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGL.m; sourceTree = "<group>"; };
665957431B38B2B4003E97A1 /* EZAudioPlotGLKViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGLKViewController.h; sourceTree = "<group>"; };
665957441B38B2B4003E97A1 /* EZAudioPlotGLKViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGLKViewController.m; sourceTree = "<group>"; };
665957451B38B2B4003E97A1 /* EZAudioUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioUtilities.h; sourceTree = "<group>"; };
665957461B38B2B4003E97A1 /* EZAudioUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioUtilities.m; sourceTree = "<group>"; };
665957471B38B2B4003E97A1 /* EZMicrophone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZMicrophone.h; sourceTree = "<group>"; };
665957481B38B2B4003E97A1 /* EZMicrophone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZMicrophone.m; sourceTree = "<group>"; };
665957491B38B2B4003E97A1 /* EZOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZOutput.h; sourceTree = "<group>"; };
6659574A1B38B2B4003E97A1 /* EZOutput.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZOutput.m; sourceTree = "<group>"; };
6659574B1B38B2B4003E97A1 /* EZPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZPlot.h; sourceTree = "<group>"; };
6659574C1B38B2B4003E97A1 /* EZPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZPlot.m; sourceTree = "<group>"; };
6659574D1B38B2B4003E97A1 /* EZRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZRecorder.h; sourceTree = "<group>"; };
6659574E1B38B2B4003E97A1 /* EZRecorder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZRecorder.m; sourceTree = "<group>"; };
6659574F1B38B2B4003E97A1 /* TPCircularBuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = TPCircularBuffer.c; sourceTree = "<group>"; };
665957501B38B2B4003E97A1 /* TPCircularBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPCircularBuffer.h; sourceTree = "<group>"; };
665957521B38B2B4003E97A1 /* CHANGELOG */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CHANGELOG; sourceTree = "<group>"; };
665957531B38B2B4003E97A1 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = "<group>"; };
662428E11B451AEE0069FFD7 /* EZAudio.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = EZAudio.framework; path = ../../../EZAudio/OSX/EZAudio.framework; sourceTree = SOURCE_ROOT; };
94056D93185BB0BC00EB94BA /* EZAudioOpenGLWaveformExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EZAudioOpenGLWaveformExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
94056D96185BB0BC00EB94BA /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
94056D99185BB0BC00EB94BA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
@@ -105,11 +40,7 @@
94056DA9185BB0BC00EB94BA /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = AppDelegate.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
94056DAC185BB0BC00EB94BA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
94056DAE185BB0BC00EB94BA /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
94056DB4185BB0BC00EB94BA /* EZAudioOpenGLWaveformExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EZAudioOpenGLWaveformExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
94056DB5185BB0BC00EB94BA /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
94056DBC185BB0BC00EB94BA /* EZAudioOpenGLWaveformExampleTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "EZAudioOpenGLWaveformExampleTests-Info.plist"; sourceTree = "<group>"; };
94056DBE185BB0BC00EB94BA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
94056DC0185BB0BC00EB94BA /* EZAudioOpenGLWaveformExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = EZAudioOpenGLWaveformExampleTests.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
94056DCA185BB0D600EB94BA /* OpenGLWaveformViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = OpenGLWaveformViewController.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
94056DCB185BB0D600EB94BA /* OpenGLWaveformViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = OpenGLWaveformViewController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
94056DCC185BB0D600EB94BA /* OpenGLWaveformViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = OpenGLWaveformViewController.xib; sourceTree = "<group>"; };
@@ -136,73 +67,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
94056DB1185BB0BC00EB94BA /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
94056DB7185BB0BC00EB94BA /* Cocoa.framework in Frameworks */,
94056DB6185BB0BC00EB94BA /* XCTest.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
665957301B38B2B4003E97A1 /* EZAudio */ = {
isa = PBXGroup;
children = (
665957311B38B2B4003E97A1 /* AEFloatConverter.h */,
665957321B38B2B4003E97A1 /* AEFloatConverter.m */,
665957331B38B2B4003E97A1 /* EZAudio.h */,
665957341B38B2B4003E97A1 /* EZAudio.m */,
665957351B38B2B4003E97A1 /* EZAudioDevice.h */,
665957361B38B2B4003E97A1 /* EZAudioDevice.m */,
665957371B38B2B4003E97A1 /* EZAudioFile.h */,
665957381B38B2B4003E97A1 /* EZAudioFile.m */,
665957391B38B2B4003E97A1 /* EZAudioFloatConverter.h */,
6659573A1B38B2B4003E97A1 /* EZAudioFloatConverter.m */,
6659573B1B38B2B4003E97A1 /* EZAudioFloatData.h */,
6659573C1B38B2B4003E97A1 /* EZAudioFloatData.m */,
6659573D1B38B2B4003E97A1 /* EZAudioPlayer.h */,
6659573E1B38B2B4003E97A1 /* EZAudioPlayer.m */,
6659573F1B38B2B4003E97A1 /* EZAudioPlot.h */,
665957401B38B2B4003E97A1 /* EZAudioPlot.m */,
665957411B38B2B4003E97A1 /* EZAudioPlotGL.h */,
665957421B38B2B4003E97A1 /* EZAudioPlotGL.m */,
665957431B38B2B4003E97A1 /* EZAudioPlotGLKViewController.h */,
665957441B38B2B4003E97A1 /* EZAudioPlotGLKViewController.m */,
665957451B38B2B4003E97A1 /* EZAudioUtilities.h */,
665957461B38B2B4003E97A1 /* EZAudioUtilities.m */,
665957471B38B2B4003E97A1 /* EZMicrophone.h */,
665957481B38B2B4003E97A1 /* EZMicrophone.m */,
665957491B38B2B4003E97A1 /* EZOutput.h */,
6659574A1B38B2B4003E97A1 /* EZOutput.m */,
6659574B1B38B2B4003E97A1 /* EZPlot.h */,
6659574C1B38B2B4003E97A1 /* EZPlot.m */,
6659574D1B38B2B4003E97A1 /* EZRecorder.h */,
6659574E1B38B2B4003E97A1 /* EZRecorder.m */,
6659574F1B38B2B4003E97A1 /* TPCircularBuffer.c */,
665957501B38B2B4003E97A1 /* TPCircularBuffer.h */,
665957511B38B2B4003E97A1 /* VERSION */,
);
name = EZAudio;
path = ../../../../EZAudio;
sourceTree = "<group>";
};
665957511B38B2B4003E97A1 /* VERSION */ = {
isa = PBXGroup;
children = (
665957521B38B2B4003E97A1 /* CHANGELOG */,
665957531B38B2B4003E97A1 /* VERSION */,
);
path = VERSION;
sourceTree = "<group>";
};
94056D8A185BB0BC00EB94BA = {
isa = PBXGroup;
children = (
662428E11B451AEE0069FFD7 /* EZAudio.framework */,
94056D9C185BB0BC00EB94BA /* EZAudioOpenGLWaveformExample */,
94056DBA185BB0BC00EB94BA /* EZAudioOpenGLWaveformExampleTests */,
94056D95185BB0BC00EB94BA /* Frameworks */,
94056D94185BB0BC00EB94BA /* Products */,
);
@@ -212,7 +84,6 @@
isa = PBXGroup;
children = (
94056D93185BB0BC00EB94BA /* EZAudioOpenGLWaveformExample.app */,
94056DB4185BB0BC00EB94BA /* EZAudioOpenGLWaveformExampleTests.xctest */,
);
name = Products;
sourceTree = "<group>";
@@ -246,7 +117,6 @@
94056D9C185BB0BC00EB94BA /* EZAudioOpenGLWaveformExample */ = {
isa = PBXGroup;
children = (
665957301B38B2B4003E97A1 /* EZAudio */,
94056DA8185BB0BC00EB94BA /* AppDelegate.h */,
94056DA9185BB0BC00EB94BA /* AppDelegate.m */,
94056DCA185BB0D600EB94BA /* OpenGLWaveformViewController.h */,
@@ -271,24 +141,6 @@
name = "Supporting Files";
sourceTree = "<group>";
};
94056DBA185BB0BC00EB94BA /* EZAudioOpenGLWaveformExampleTests */ = {
isa = PBXGroup;
children = (
94056DC0185BB0BC00EB94BA /* EZAudioOpenGLWaveformExampleTests.m */,
94056DBB185BB0BC00EB94BA /* Supporting Files */,
);
path = EZAudioOpenGLWaveformExampleTests;
sourceTree = "<group>";
};
94056DBB185BB0BC00EB94BA /* Supporting Files */ = {
isa = PBXGroup;
children = (
94056DBC185BB0BC00EB94BA /* EZAudioOpenGLWaveformExampleTests-Info.plist */,
94056DBD185BB0BC00EB94BA /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -309,24 +161,6 @@
productReference = 94056D93185BB0BC00EB94BA /* EZAudioOpenGLWaveformExample.app */;
productType = "com.apple.product-type.application";
};
94056DB3185BB0BC00EB94BA /* EZAudioOpenGLWaveformExampleTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 94056DC7185BB0BC00EB94BA /* Build configuration list for PBXNativeTarget "EZAudioOpenGLWaveformExampleTests" */;
buildPhases = (
94056DB0185BB0BC00EB94BA /* Sources */,
94056DB1185BB0BC00EB94BA /* Frameworks */,
94056DB2185BB0BC00EB94BA /* Resources */,
);
buildRules = (
);
dependencies = (
94056DB9185BB0BC00EB94BA /* PBXTargetDependency */,
);
name = EZAudioOpenGLWaveformExampleTests;
productName = EZAudioOpenGLWaveformExampleTests;
productReference = 94056DB4185BB0BC00EB94BA /* EZAudioOpenGLWaveformExampleTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -335,11 +169,6 @@
attributes = {
LastUpgradeCheck = 0500;
ORGANIZATIONNAME = "Syed Haris Ali";
TargetAttributes = {
94056DB3185BB0BC00EB94BA = {
TestTargetID = 94056D92185BB0BC00EB94BA;
};
};
};
buildConfigurationList = 94056D8E185BB0BC00EB94BA /* Build configuration list for PBXProject "EZAudioOpenGLWaveformExample" */;
compatibilityVersion = "Xcode 3.2";
@@ -355,7 +184,6 @@
projectRoot = "";
targets = (
94056D92185BB0BC00EB94BA /* EZAudioOpenGLWaveformExample */,
94056DB3185BB0BC00EB94BA /* EZAudioOpenGLWaveformExampleTests */,
);
};
/* End PBXProject section */
@@ -366,20 +194,10 @@
buildActionMask = 2147483647;
files = (
94056DA1185BB0BC00EB94BA /* InfoPlist.strings in Resources */,
665957651B38B2B4003E97A1 /* VERSION in Resources */,
94056DAF185BB0BC00EB94BA /* Images.xcassets in Resources */,
94056DA7185BB0BC00EB94BA /* Credits.rtf in Resources */,
94056DCE185BB0D600EB94BA /* OpenGLWaveformViewController.xib in Resources */,
94056DAD185BB0BC00EB94BA /* MainMenu.xib in Resources */,
665957641B38B2B4003E97A1 /* CHANGELOG in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
94056DB2185BB0BC00EB94BA /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
94056DBF185BB0BC00EB94BA /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -390,46 +208,14 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
665957621B38B2B4003E97A1 /* EZRecorder.m in Sources */,
94056DAA185BB0BC00EB94BA /* AppDelegate.m in Sources */,
665957581B38B2B4003E97A1 /* EZAudioFloatConverter.m in Sources */,
665957591B38B2B4003E97A1 /* EZAudioFloatData.m in Sources */,
665957541B38B2B4003E97A1 /* AEFloatConverter.m in Sources */,
665957571B38B2B4003E97A1 /* EZAudioFile.m in Sources */,
665957601B38B2B4003E97A1 /* EZOutput.m in Sources */,
6659575C1B38B2B4003E97A1 /* EZAudioPlotGL.m in Sources */,
665957631B38B2B4003E97A1 /* TPCircularBuffer.c in Sources */,
6659575B1B38B2B4003E97A1 /* EZAudioPlot.m in Sources */,
94056DA3185BB0BC00EB94BA /* main.m in Sources */,
6659575F1B38B2B4003E97A1 /* EZMicrophone.m in Sources */,
6659575A1B38B2B4003E97A1 /* EZAudioPlayer.m in Sources */,
665957561B38B2B4003E97A1 /* EZAudioDevice.m in Sources */,
94056DCD185BB0D600EB94BA /* OpenGLWaveformViewController.m in Sources */,
665957611B38B2B4003E97A1 /* EZPlot.m in Sources */,
665957551B38B2B4003E97A1 /* EZAudio.m in Sources */,
6659575E1B38B2B4003E97A1 /* EZAudioUtilities.m in Sources */,
6659575D1B38B2B4003E97A1 /* EZAudioPlotGLKViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
94056DB0185BB0BC00EB94BA /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
94056DC1185BB0BC00EB94BA /* EZAudioOpenGLWaveformExampleTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
94056DB9185BB0BC00EB94BA /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 94056D92185BB0BC00EB94BA /* EZAudioOpenGLWaveformExample */;
targetProxy = 94056DB8185BB0BC00EB94BA /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
94056D9F185BB0BC00EB94BA /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
@@ -455,14 +241,6 @@
name = MainMenu.xib;
sourceTree = "<group>";
};
94056DBD185BB0BC00EB94BA /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
94056DBE185BB0BC00EB94BA /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
@@ -542,6 +320,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioOpenGLWaveformExample/EZAudioOpenGLWaveformExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioOpenGLWaveformExample/EZAudioOpenGLWaveformExample-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -555,51 +334,12 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioOpenGLWaveformExample/EZAudioOpenGLWaveformExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioOpenGLWaveformExample/EZAudioOpenGLWaveformExample-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
94056DC8185BB0BC00EB94BA /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/EZAudioOpenGLWaveformExample.app/Contents/MacOS/EZAudioOpenGLWaveformExample";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioOpenGLWaveformExample/EZAudioOpenGLWaveformExample-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = "EZAudioOpenGLWaveformExampleTests/EZAudioOpenGLWaveformExampleTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Debug;
};
94056DC9185BB0BC00EB94BA /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/EZAudioOpenGLWaveformExample.app/Contents/MacOS/EZAudioOpenGLWaveformExample";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioOpenGLWaveformExample/EZAudioOpenGLWaveformExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioOpenGLWaveformExampleTests/EZAudioOpenGLWaveformExampleTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -621,15 +361,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
94056DC7185BB0BC00EB94BA /* Build configuration list for PBXNativeTarget "EZAudioOpenGLWaveformExampleTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
94056DC8185BB0BC00EB94BA /* Debug */,
94056DC9185BB0BC00EB94BA /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 94056D8B185BB0BC00EB94BA /* Project object */;
@@ -26,7 +26,7 @@
#import <Cocoa/Cocoa.h>
// Import EZAudio header
#import "EZAudio.h"
#import <EZAudio/EZAudio.h>
//------------------------------------------------------------------------------
#pragma mark - OpenGLWaveformViewController
@@ -106,10 +106,8 @@
for (int i = 0; i < self.microphone.device.inputChannelCount; i++)
{
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:@(i).stringValue
action:@selector(changedInputChannel:)
action:nil
keyEquivalent:@""];
item.representedObject = @(i);
item.target = self;
[menu addItem:item];
}
self.microphoneInputChannelPopUpButton.menu = menu;
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7702" systemVersion="14C109" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7706" systemVersion="14E46" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment version="1070" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7702"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7706"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="OpenGLWaveformViewController">
@@ -80,17 +80,17 @@
</popUpButtonCell>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="AuX-d2-dD9">
<rect key="frame" x="18" y="43" width="31" height="14"/>
<rect key="frame" x="18" y="43" width="36" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Input" id="Fq3-tX-8aU">
<font key="font" metaFont="smallSystem"/>
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="PMV-Zt-Wg6">
<rect key="frame" x="204" y="43" width="48" height="14"/>
<rect key="frame" x="204" y="43" width="55" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Channel" id="PTE-g2-mTV">
<font key="font" metaFont="smallSystem"/>
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.sha.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
@@ -1,51 +0,0 @@
//
// EZAudioOpenGLWaveformExampleTests.m
// EZAudioOpenGLWaveformExampleTests
//
// Created by Syed Haris Ali on 12/1/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <XCTest/XCTest.h>
@interface EZAudioOpenGLWaveformExampleTests : XCTestCase
@end
@implementation EZAudioOpenGLWaveformExampleTests
- (void)setUp
{
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown
{
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample
{
XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
}
@end
@@ -1,2 +0,0 @@
/* Localized versions of Info.plist keys */
@@ -7,24 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
6628E2901B3A1CCA00020E56 /* AEFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E26E1B3A1CCA00020E56 /* AEFloatConverter.m */; };
6628E2911B3A1CCA00020E56 /* EZAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2701B3A1CCA00020E56 /* EZAudio.m */; };
6628E2921B3A1CCA00020E56 /* EZAudioDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2721B3A1CCA00020E56 /* EZAudioDevice.m */; };
6628E2931B3A1CCA00020E56 /* EZAudioFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2741B3A1CCA00020E56 /* EZAudioFile.m */; };
6628E2941B3A1CCA00020E56 /* EZAudioFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2761B3A1CCA00020E56 /* EZAudioFloatConverter.m */; };
6628E2951B3A1CCA00020E56 /* EZAudioFloatData.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2781B3A1CCA00020E56 /* EZAudioFloatData.m */; };
6628E2961B3A1CCA00020E56 /* EZAudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E27A1B3A1CCA00020E56 /* EZAudioPlayer.m */; };
6628E2971B3A1CCA00020E56 /* EZAudioPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E27C1B3A1CCA00020E56 /* EZAudioPlot.m */; };
6628E2981B3A1CCA00020E56 /* EZAudioPlotGL.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E27E1B3A1CCA00020E56 /* EZAudioPlotGL.m */; };
6628E2991B3A1CCA00020E56 /* EZAudioPlotGLKViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2801B3A1CCA00020E56 /* EZAudioPlotGLKViewController.m */; };
6628E29A1B3A1CCA00020E56 /* EZAudioUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2821B3A1CCA00020E56 /* EZAudioUtilities.m */; };
6628E29B1B3A1CCA00020E56 /* EZMicrophone.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2841B3A1CCA00020E56 /* EZMicrophone.m */; };
6628E29C1B3A1CCA00020E56 /* EZOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2861B3A1CCA00020E56 /* EZOutput.m */; };
6628E29D1B3A1CCA00020E56 /* EZPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E2881B3A1CCA00020E56 /* EZPlot.m */; };
6628E29E1B3A1CCA00020E56 /* EZRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 6628E28A1B3A1CCA00020E56 /* EZRecorder.m */; };
6628E29F1B3A1CCA00020E56 /* TPCircularBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 6628E28B1B3A1CCA00020E56 /* TPCircularBuffer.c */; };
6628E2A01B3A1CCA00020E56 /* CHANGELOG in Resources */ = {isa = PBXBuildFile; fileRef = 6628E28E1B3A1CCA00020E56 /* CHANGELOG */; };
6628E2A11B3A1CCA00020E56 /* VERSION in Resources */ = {isa = PBXBuildFile; fileRef = 6628E28F1B3A1CCA00020E56 /* VERSION */; };
941D71B81864C457007D52D8 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 941D71B71864C457007D52D8 /* Cocoa.framework */; };
941D71C21864C457007D52D8 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 941D71C01864C457007D52D8 /* InfoPlist.strings */; };
941D71C41864C457007D52D8 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 941D71C31864C457007D52D8 /* main.m */; };
@@ -32,10 +14,6 @@
941D71CB1864C457007D52D8 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 941D71CA1864C457007D52D8 /* AppDelegate.m */; };
941D71CE1864C457007D52D8 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 941D71CC1864C457007D52D8 /* MainMenu.xib */; };
941D71D01864C457007D52D8 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 941D71CF1864C457007D52D8 /* Images.xcassets */; };
941D71D71864C457007D52D8 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 941D71D61864C457007D52D8 /* XCTest.framework */; };
941D71D81864C457007D52D8 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 941D71B71864C457007D52D8 /* Cocoa.framework */; };
941D71E01864C457007D52D8 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 941D71DE1864C457007D52D8 /* InfoPlist.strings */; };
941D71E21864C457007D52D8 /* EZAudioPassThroughExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 941D71E11864C457007D52D8 /* EZAudioPassThroughExampleTests.m */; };
941D72151864C4A0007D52D8 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 941D72121864C4A0007D52D8 /* AudioToolbox.framework */; };
941D72161864C4A0007D52D8 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 941D72131864C4A0007D52D8 /* AudioUnit.framework */; };
941D72171864C4A0007D52D8 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 941D72141864C4A0007D52D8 /* CoreAudio.framework */; };
@@ -46,51 +24,7 @@
941D72221864C4D7007D52D8 /* PassThroughViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 941D72201864C4D7007D52D8 /* PassThroughViewController.xib */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
941D71D91864C457007D52D8 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 941D71AC1864C456007D52D8 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 941D71B31864C457007D52D8;
remoteInfo = EZAudioPassThroughExample;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
6628E26D1B3A1CCA00020E56 /* AEFloatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AEFloatConverter.h; sourceTree = "<group>"; };
6628E26E1B3A1CCA00020E56 /* AEFloatConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AEFloatConverter.m; sourceTree = "<group>"; };
6628E26F1B3A1CCA00020E56 /* EZAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudio.h; sourceTree = "<group>"; };
6628E2701B3A1CCA00020E56 /* EZAudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudio.m; sourceTree = "<group>"; };
6628E2711B3A1CCA00020E56 /* EZAudioDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioDevice.h; sourceTree = "<group>"; };
6628E2721B3A1CCA00020E56 /* EZAudioDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioDevice.m; sourceTree = "<group>"; };
6628E2731B3A1CCA00020E56 /* EZAudioFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFile.h; sourceTree = "<group>"; };
6628E2741B3A1CCA00020E56 /* EZAudioFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFile.m; sourceTree = "<group>"; };
6628E2751B3A1CCA00020E56 /* EZAudioFloatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatConverter.h; sourceTree = "<group>"; };
6628E2761B3A1CCA00020E56 /* EZAudioFloatConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatConverter.m; sourceTree = "<group>"; };
6628E2771B3A1CCA00020E56 /* EZAudioFloatData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatData.h; sourceTree = "<group>"; };
6628E2781B3A1CCA00020E56 /* EZAudioFloatData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatData.m; sourceTree = "<group>"; };
6628E2791B3A1CCA00020E56 /* EZAudioPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlayer.h; sourceTree = "<group>"; };
6628E27A1B3A1CCA00020E56 /* EZAudioPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlayer.m; sourceTree = "<group>"; };
6628E27B1B3A1CCA00020E56 /* EZAudioPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlot.h; sourceTree = "<group>"; };
6628E27C1B3A1CCA00020E56 /* EZAudioPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlot.m; sourceTree = "<group>"; };
6628E27D1B3A1CCA00020E56 /* EZAudioPlotGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGL.h; sourceTree = "<group>"; };
6628E27E1B3A1CCA00020E56 /* EZAudioPlotGL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGL.m; sourceTree = "<group>"; };
6628E27F1B3A1CCA00020E56 /* EZAudioPlotGLKViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGLKViewController.h; sourceTree = "<group>"; };
6628E2801B3A1CCA00020E56 /* EZAudioPlotGLKViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGLKViewController.m; sourceTree = "<group>"; };
6628E2811B3A1CCA00020E56 /* EZAudioUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioUtilities.h; sourceTree = "<group>"; };
6628E2821B3A1CCA00020E56 /* EZAudioUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioUtilities.m; sourceTree = "<group>"; };
6628E2831B3A1CCA00020E56 /* EZMicrophone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZMicrophone.h; sourceTree = "<group>"; };
6628E2841B3A1CCA00020E56 /* EZMicrophone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZMicrophone.m; sourceTree = "<group>"; };
6628E2851B3A1CCA00020E56 /* EZOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZOutput.h; sourceTree = "<group>"; };
6628E2861B3A1CCA00020E56 /* EZOutput.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZOutput.m; sourceTree = "<group>"; };
6628E2871B3A1CCA00020E56 /* EZPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZPlot.h; sourceTree = "<group>"; };
6628E2881B3A1CCA00020E56 /* EZPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZPlot.m; sourceTree = "<group>"; };
6628E2891B3A1CCA00020E56 /* EZRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZRecorder.h; sourceTree = "<group>"; };
6628E28A1B3A1CCA00020E56 /* EZRecorder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZRecorder.m; sourceTree = "<group>"; };
6628E28B1B3A1CCA00020E56 /* TPCircularBuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = TPCircularBuffer.c; sourceTree = "<group>"; };
6628E28C1B3A1CCA00020E56 /* TPCircularBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPCircularBuffer.h; sourceTree = "<group>"; };
6628E28E1B3A1CCA00020E56 /* CHANGELOG */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CHANGELOG; sourceTree = "<group>"; };
6628E28F1B3A1CCA00020E56 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = "<group>"; };
941D71B41864C457007D52D8 /* EZAudioPassThroughExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EZAudioPassThroughExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
941D71B71864C457007D52D8 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
941D71BA1864C457007D52D8 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
@@ -105,11 +39,7 @@
941D71CA1864C457007D52D8 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
941D71CD1864C457007D52D8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
941D71CF1864C457007D52D8 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
941D71D51864C457007D52D8 /* EZAudioPassThroughExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EZAudioPassThroughExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
941D71D61864C457007D52D8 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
941D71DD1864C457007D52D8 /* EZAudioPassThroughExampleTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "EZAudioPassThroughExampleTests-Info.plist"; sourceTree = "<group>"; };
941D71DF1864C457007D52D8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
941D71E11864C457007D52D8 /* EZAudioPassThroughExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EZAudioPassThroughExampleTests.m; sourceTree = "<group>"; };
941D72121864C4A0007D52D8 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
941D72131864C4A0007D52D8 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; };
941D72141864C4A0007D52D8 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
@@ -136,73 +66,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
941D71D21864C457007D52D8 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
941D71D81864C457007D52D8 /* Cocoa.framework in Frameworks */,
941D71D71864C457007D52D8 /* XCTest.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
6628E26C1B3A1CCA00020E56 /* EZAudio */ = {
isa = PBXGroup;
children = (
6628E26D1B3A1CCA00020E56 /* AEFloatConverter.h */,
6628E26E1B3A1CCA00020E56 /* AEFloatConverter.m */,
6628E26F1B3A1CCA00020E56 /* EZAudio.h */,
6628E2701B3A1CCA00020E56 /* EZAudio.m */,
6628E2711B3A1CCA00020E56 /* EZAudioDevice.h */,
6628E2721B3A1CCA00020E56 /* EZAudioDevice.m */,
6628E2731B3A1CCA00020E56 /* EZAudioFile.h */,
6628E2741B3A1CCA00020E56 /* EZAudioFile.m */,
6628E2751B3A1CCA00020E56 /* EZAudioFloatConverter.h */,
6628E2761B3A1CCA00020E56 /* EZAudioFloatConverter.m */,
6628E2771B3A1CCA00020E56 /* EZAudioFloatData.h */,
6628E2781B3A1CCA00020E56 /* EZAudioFloatData.m */,
6628E2791B3A1CCA00020E56 /* EZAudioPlayer.h */,
6628E27A1B3A1CCA00020E56 /* EZAudioPlayer.m */,
6628E27B1B3A1CCA00020E56 /* EZAudioPlot.h */,
6628E27C1B3A1CCA00020E56 /* EZAudioPlot.m */,
6628E27D1B3A1CCA00020E56 /* EZAudioPlotGL.h */,
6628E27E1B3A1CCA00020E56 /* EZAudioPlotGL.m */,
6628E27F1B3A1CCA00020E56 /* EZAudioPlotGLKViewController.h */,
6628E2801B3A1CCA00020E56 /* EZAudioPlotGLKViewController.m */,
6628E2811B3A1CCA00020E56 /* EZAudioUtilities.h */,
6628E2821B3A1CCA00020E56 /* EZAudioUtilities.m */,
6628E2831B3A1CCA00020E56 /* EZMicrophone.h */,
6628E2841B3A1CCA00020E56 /* EZMicrophone.m */,
6628E2851B3A1CCA00020E56 /* EZOutput.h */,
6628E2861B3A1CCA00020E56 /* EZOutput.m */,
6628E2871B3A1CCA00020E56 /* EZPlot.h */,
6628E2881B3A1CCA00020E56 /* EZPlot.m */,
6628E2891B3A1CCA00020E56 /* EZRecorder.h */,
6628E28A1B3A1CCA00020E56 /* EZRecorder.m */,
6628E28B1B3A1CCA00020E56 /* TPCircularBuffer.c */,
6628E28C1B3A1CCA00020E56 /* TPCircularBuffer.h */,
6628E28D1B3A1CCA00020E56 /* VERSION */,
);
name = EZAudio;
path = ../../../../EZAudio;
sourceTree = "<group>";
};
6628E28D1B3A1CCA00020E56 /* VERSION */ = {
isa = PBXGroup;
children = (
6628E28E1B3A1CCA00020E56 /* CHANGELOG */,
6628E28F1B3A1CCA00020E56 /* VERSION */,
);
path = VERSION;
sourceTree = "<group>";
};
941D71AB1864C456007D52D8 = {
isa = PBXGroup;
children = (
941D71BD1864C457007D52D8 /* EZAudioPassThroughExample */,
941D71DB1864C457007D52D8 /* EZAudioPassThroughExampleTests */,
941D71B61864C457007D52D8 /* Frameworks */,
941D71B51864C457007D52D8 /* Products */,
);
@@ -212,7 +82,6 @@
isa = PBXGroup;
children = (
941D71B41864C457007D52D8 /* EZAudioPassThroughExample.app */,
941D71D51864C457007D52D8 /* EZAudioPassThroughExampleTests.xctest */,
);
name = Products;
sourceTree = "<group>";
@@ -246,7 +115,6 @@
941D71BD1864C457007D52D8 /* EZAudioPassThroughExample */ = {
isa = PBXGroup;
children = (
6628E26C1B3A1CCA00020E56 /* EZAudio */,
941D71C91864C457007D52D8 /* AppDelegate.h */,
941D71CA1864C457007D52D8 /* AppDelegate.m */,
941D721E1864C4D7007D52D8 /* PassThroughViewController.h */,
@@ -271,24 +139,6 @@
name = "Supporting Files";
sourceTree = "<group>";
};
941D71DB1864C457007D52D8 /* EZAudioPassThroughExampleTests */ = {
isa = PBXGroup;
children = (
941D71E11864C457007D52D8 /* EZAudioPassThroughExampleTests.m */,
941D71DC1864C457007D52D8 /* Supporting Files */,
);
path = EZAudioPassThroughExampleTests;
sourceTree = "<group>";
};
941D71DC1864C457007D52D8 /* Supporting Files */ = {
isa = PBXGroup;
children = (
941D71DD1864C457007D52D8 /* EZAudioPassThroughExampleTests-Info.plist */,
941D71DE1864C457007D52D8 /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -309,24 +159,6 @@
productReference = 941D71B41864C457007D52D8 /* EZAudioPassThroughExample.app */;
productType = "com.apple.product-type.application";
};
941D71D41864C457007D52D8 /* EZAudioPassThroughExampleTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 941D71E81864C457007D52D8 /* Build configuration list for PBXNativeTarget "EZAudioPassThroughExampleTests" */;
buildPhases = (
941D71D11864C457007D52D8 /* Sources */,
941D71D21864C457007D52D8 /* Frameworks */,
941D71D31864C457007D52D8 /* Resources */,
);
buildRules = (
);
dependencies = (
941D71DA1864C457007D52D8 /* PBXTargetDependency */,
);
name = EZAudioPassThroughExampleTests;
productName = EZAudioPassThroughExampleTests;
productReference = 941D71D51864C457007D52D8 /* EZAudioPassThroughExampleTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -335,11 +167,6 @@
attributes = {
LastUpgradeCheck = 0500;
ORGANIZATIONNAME = "Syed Haris Ali";
TargetAttributes = {
941D71D41864C457007D52D8 = {
TestTargetID = 941D71B31864C457007D52D8;
};
};
};
buildConfigurationList = 941D71AF1864C456007D52D8 /* Build configuration list for PBXProject "EZAudioPassThroughExample" */;
compatibilityVersion = "Xcode 3.2";
@@ -355,7 +182,6 @@
projectRoot = "";
targets = (
941D71B31864C457007D52D8 /* EZAudioPassThroughExample */,
941D71D41864C457007D52D8 /* EZAudioPassThroughExampleTests */,
);
};
/* End PBXProject section */
@@ -366,20 +192,10 @@
buildActionMask = 2147483647;
files = (
941D72221864C4D7007D52D8 /* PassThroughViewController.xib in Resources */,
6628E2A11B3A1CCA00020E56 /* VERSION in Resources */,
941D71C21864C457007D52D8 /* InfoPlist.strings in Resources */,
941D71D01864C457007D52D8 /* Images.xcassets in Resources */,
941D71C81864C457007D52D8 /* Credits.rtf in Resources */,
941D71CE1864C457007D52D8 /* MainMenu.xib in Resources */,
6628E2A01B3A1CCA00020E56 /* CHANGELOG in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
941D71D31864C457007D52D8 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
941D71E01864C457007D52D8 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -390,46 +206,14 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6628E29E1B3A1CCA00020E56 /* EZRecorder.m in Sources */,
941D72211864C4D7007D52D8 /* PassThroughViewController.m in Sources */,
6628E2941B3A1CCA00020E56 /* EZAudioFloatConverter.m in Sources */,
6628E2951B3A1CCA00020E56 /* EZAudioFloatData.m in Sources */,
6628E2901B3A1CCA00020E56 /* AEFloatConverter.m in Sources */,
6628E2931B3A1CCA00020E56 /* EZAudioFile.m in Sources */,
6628E29C1B3A1CCA00020E56 /* EZOutput.m in Sources */,
6628E2981B3A1CCA00020E56 /* EZAudioPlotGL.m in Sources */,
6628E29F1B3A1CCA00020E56 /* TPCircularBuffer.c in Sources */,
6628E2971B3A1CCA00020E56 /* EZAudioPlot.m in Sources */,
941D71CB1864C457007D52D8 /* AppDelegate.m in Sources */,
6628E29B1B3A1CCA00020E56 /* EZMicrophone.m in Sources */,
6628E2961B3A1CCA00020E56 /* EZAudioPlayer.m in Sources */,
6628E2921B3A1CCA00020E56 /* EZAudioDevice.m in Sources */,
941D71C41864C457007D52D8 /* main.m in Sources */,
6628E29D1B3A1CCA00020E56 /* EZPlot.m in Sources */,
6628E2911B3A1CCA00020E56 /* EZAudio.m in Sources */,
6628E29A1B3A1CCA00020E56 /* EZAudioUtilities.m in Sources */,
6628E2991B3A1CCA00020E56 /* EZAudioPlotGLKViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
941D71D11864C457007D52D8 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
941D71E21864C457007D52D8 /* EZAudioPassThroughExampleTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
941D71DA1864C457007D52D8 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 941D71B31864C457007D52D8 /* EZAudioPassThroughExample */;
targetProxy = 941D71D91864C457007D52D8 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
941D71C01864C457007D52D8 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
@@ -455,14 +239,6 @@
name = MainMenu.xib;
sourceTree = "<group>";
};
941D71DE1864C457007D52D8 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
941D71DF1864C457007D52D8 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
@@ -542,6 +318,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioPassThroughExample/EZAudioPassThroughExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioPassThroughExample/EZAudioPassThroughExample-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -555,51 +332,12 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioPassThroughExample/EZAudioPassThroughExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioPassThroughExample/EZAudioPassThroughExample-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
941D71E91864C457007D52D8 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/EZAudioPassThroughExample.app/Contents/MacOS/EZAudioPassThroughExample";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioPassThroughExample/EZAudioPassThroughExample-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = "EZAudioPassThroughExampleTests/EZAudioPassThroughExampleTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Debug;
};
941D71EA1864C457007D52D8 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/EZAudioPassThroughExample.app/Contents/MacOS/EZAudioPassThroughExample";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioPassThroughExample/EZAudioPassThroughExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioPassThroughExampleTests/EZAudioPassThroughExampleTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -621,15 +359,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
941D71E81864C457007D52D8 /* Build configuration list for PBXNativeTarget "EZAudioPassThroughExampleTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
941D71E91864C457007D52D8 /* Debug */,
941D71EA1864C457007D52D8 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 941D71AC1864C456007D52D8 /* Project object */;
@@ -28,9 +28,9 @@
/**
Import EZAudio
*/
#import "EZAudio.h"
#import <EZAudio/EZAudio.h>
@interface PassThroughViewController : NSViewController <EZMicrophoneDelegate,EZOutputDataSource>
@interface PassThroughViewController : NSViewController <EZMicrophoneDelegate>
//------------------------------------------------------------------------------
#pragma mark - Components
@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.sha.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
@@ -1,34 +0,0 @@
//
// EZAudioPassThroughExampleTests.m
// EZAudioPassThroughExampleTests
//
// Created by Syed Haris Ali on 12/20/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
#import <XCTest/XCTest.h>
@interface EZAudioPassThroughExampleTests : XCTestCase
@end
@implementation EZAudioPassThroughExampleTests
- (void)setUp
{
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown
{
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample
{
XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
}
@end
@@ -1,2 +0,0 @@
/* Localized versions of Info.plist keys */
@@ -8,24 +8,6 @@
/* Begin PBXBuildFile section */
6628E2351B3A121A00020E56 /* simple-drum-beat.wav in Resources */ = {isa = PBXBuildFile; fileRef = 6628E2341B3A121A00020E56 /* simple-drum-beat.wav */; };
6659578A1B38B352003E97A1 /* AEFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957681B38B352003E97A1 /* AEFloatConverter.m */; };
6659578B1B38B352003E97A1 /* EZAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 6659576A1B38B352003E97A1 /* EZAudio.m */; };
6659578C1B38B352003E97A1 /* EZAudioDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 6659576C1B38B352003E97A1 /* EZAudioDevice.m */; };
6659578D1B38B352003E97A1 /* EZAudioFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 6659576E1B38B352003E97A1 /* EZAudioFile.m */; };
6659578E1B38B352003E97A1 /* EZAudioFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957701B38B352003E97A1 /* EZAudioFloatConverter.m */; };
6659578F1B38B352003E97A1 /* EZAudioFloatData.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957721B38B352003E97A1 /* EZAudioFloatData.m */; };
665957901B38B352003E97A1 /* EZAudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957741B38B352003E97A1 /* EZAudioPlayer.m */; };
665957911B38B352003E97A1 /* EZAudioPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957761B38B352003E97A1 /* EZAudioPlot.m */; };
665957921B38B352003E97A1 /* EZAudioPlotGL.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957781B38B352003E97A1 /* EZAudioPlotGL.m */; };
665957931B38B352003E97A1 /* EZAudioPlotGLKViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6659577A1B38B352003E97A1 /* EZAudioPlotGLKViewController.m */; };
665957941B38B352003E97A1 /* EZAudioUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 6659577C1B38B352003E97A1 /* EZAudioUtilities.m */; };
665957951B38B352003E97A1 /* EZMicrophone.m in Sources */ = {isa = PBXBuildFile; fileRef = 6659577E1B38B352003E97A1 /* EZMicrophone.m */; };
665957961B38B352003E97A1 /* EZOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957801B38B352003E97A1 /* EZOutput.m */; };
665957971B38B352003E97A1 /* EZPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957821B38B352003E97A1 /* EZPlot.m */; };
665957981B38B352003E97A1 /* EZRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 665957841B38B352003E97A1 /* EZRecorder.m */; };
665957991B38B352003E97A1 /* TPCircularBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 665957851B38B352003E97A1 /* TPCircularBuffer.c */; };
6659579A1B38B352003E97A1 /* CHANGELOG in Resources */ = {isa = PBXBuildFile; fileRef = 665957881B38B352003E97A1 /* CHANGELOG */; };
6659579B1B38B352003E97A1 /* VERSION in Resources */ = {isa = PBXBuildFile; fileRef = 665957891B38B352003E97A1 /* VERSION */; };
94056EFB185BD83400EB94BA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94056EFA185BD83400EB94BA /* Cocoa.framework */; };
94056F05185BD83400EB94BA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 94056F03185BD83400EB94BA /* InfoPlist.strings */; };
94056F07185BD83400EB94BA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 94056F06185BD83400EB94BA /* main.m */; };
@@ -33,10 +15,6 @@
94056F0E185BD83400EB94BA /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 94056F0D185BD83400EB94BA /* AppDelegate.m */; };
94056F11185BD83400EB94BA /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 94056F0F185BD83400EB94BA /* MainMenu.xib */; };
94056F13185BD83400EB94BA /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 94056F12185BD83400EB94BA /* Images.xcassets */; };
94056F1A185BD83400EB94BA /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94056F19185BD83400EB94BA /* XCTest.framework */; };
94056F1B185BD83400EB94BA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94056EFA185BD83400EB94BA /* Cocoa.framework */; };
94056F23185BD83400EB94BA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 94056F21185BD83400EB94BA /* InfoPlist.strings */; };
94056F25185BD83400EB94BA /* EZAudioPlayFileExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 94056F24185BD83400EB94BA /* EZAudioPlayFileExampleTests.m */; };
94056F31185BD86D00EB94BA /* PlayFileViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 94056F2F185BD86D00EB94BA /* PlayFileViewController.m */; };
94056F32185BD86D00EB94BA /* PlayFileViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 94056F30185BD86D00EB94BA /* PlayFileViewController.xib */; };
94056F5D185BDB3500EB94BA /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94056F5C185BDB3500EB94BA /* OpenGL.framework */; };
@@ -47,52 +25,8 @@
94056F67185BDB4700EB94BA /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94056F64185BDB4700EB94BA /* CoreAudio.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
94056F1C185BD83400EB94BA /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 94056EEF185BD83400EB94BA /* Project object */;
proxyType = 1;
remoteGlobalIDString = 94056EF6185BD83400EB94BA;
remoteInfo = EZAudioPlayFileExample;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
6628E2341B3A121A00020E56 /* simple-drum-beat.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = "simple-drum-beat.wav"; path = "../../../simple-drum-beat.wav"; sourceTree = "<group>"; };
665957671B38B352003E97A1 /* AEFloatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AEFloatConverter.h; sourceTree = "<group>"; };
665957681B38B352003E97A1 /* AEFloatConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AEFloatConverter.m; sourceTree = "<group>"; };
665957691B38B352003E97A1 /* EZAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudio.h; sourceTree = "<group>"; };
6659576A1B38B352003E97A1 /* EZAudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudio.m; sourceTree = "<group>"; };
6659576B1B38B352003E97A1 /* EZAudioDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioDevice.h; sourceTree = "<group>"; };
6659576C1B38B352003E97A1 /* EZAudioDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioDevice.m; sourceTree = "<group>"; };
6659576D1B38B352003E97A1 /* EZAudioFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFile.h; sourceTree = "<group>"; };
6659576E1B38B352003E97A1 /* EZAudioFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFile.m; sourceTree = "<group>"; };
6659576F1B38B352003E97A1 /* EZAudioFloatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatConverter.h; sourceTree = "<group>"; };
665957701B38B352003E97A1 /* EZAudioFloatConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatConverter.m; sourceTree = "<group>"; };
665957711B38B352003E97A1 /* EZAudioFloatData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatData.h; sourceTree = "<group>"; };
665957721B38B352003E97A1 /* EZAudioFloatData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatData.m; sourceTree = "<group>"; };
665957731B38B352003E97A1 /* EZAudioPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlayer.h; sourceTree = "<group>"; };
665957741B38B352003E97A1 /* EZAudioPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlayer.m; sourceTree = "<group>"; };
665957751B38B352003E97A1 /* EZAudioPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlot.h; sourceTree = "<group>"; };
665957761B38B352003E97A1 /* EZAudioPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlot.m; sourceTree = "<group>"; };
665957771B38B352003E97A1 /* EZAudioPlotGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGL.h; sourceTree = "<group>"; };
665957781B38B352003E97A1 /* EZAudioPlotGL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGL.m; sourceTree = "<group>"; };
665957791B38B352003E97A1 /* EZAudioPlotGLKViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGLKViewController.h; sourceTree = "<group>"; };
6659577A1B38B352003E97A1 /* EZAudioPlotGLKViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGLKViewController.m; sourceTree = "<group>"; };
6659577B1B38B352003E97A1 /* EZAudioUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioUtilities.h; sourceTree = "<group>"; };
6659577C1B38B352003E97A1 /* EZAudioUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioUtilities.m; sourceTree = "<group>"; };
6659577D1B38B352003E97A1 /* EZMicrophone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZMicrophone.h; sourceTree = "<group>"; };
6659577E1B38B352003E97A1 /* EZMicrophone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZMicrophone.m; sourceTree = "<group>"; };
6659577F1B38B352003E97A1 /* EZOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZOutput.h; sourceTree = "<group>"; };
665957801B38B352003E97A1 /* EZOutput.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZOutput.m; sourceTree = "<group>"; };
665957811B38B352003E97A1 /* EZPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZPlot.h; sourceTree = "<group>"; };
665957821B38B352003E97A1 /* EZPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZPlot.m; sourceTree = "<group>"; };
665957831B38B352003E97A1 /* EZRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZRecorder.h; sourceTree = "<group>"; };
665957841B38B352003E97A1 /* EZRecorder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZRecorder.m; sourceTree = "<group>"; };
665957851B38B352003E97A1 /* TPCircularBuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = TPCircularBuffer.c; sourceTree = "<group>"; };
665957861B38B352003E97A1 /* TPCircularBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPCircularBuffer.h; sourceTree = "<group>"; };
665957881B38B352003E97A1 /* CHANGELOG */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CHANGELOG; sourceTree = "<group>"; };
665957891B38B352003E97A1 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = "<group>"; };
94056EF7185BD83400EB94BA /* EZAudioPlayFileExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EZAudioPlayFileExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
94056EFA185BD83400EB94BA /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
94056EFD185BD83400EB94BA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
@@ -107,11 +41,7 @@
94056F0D185BD83400EB94BA /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
94056F10185BD83400EB94BA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
94056F12185BD83400EB94BA /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
94056F18185BD83400EB94BA /* EZAudioPlayFileExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EZAudioPlayFileExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
94056F19185BD83400EB94BA /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
94056F20185BD83400EB94BA /* EZAudioPlayFileExampleTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "EZAudioPlayFileExampleTests-Info.plist"; sourceTree = "<group>"; };
94056F22185BD83400EB94BA /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
94056F24185BD83400EB94BA /* EZAudioPlayFileExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlayFileExampleTests.m; sourceTree = "<group>"; };
94056F2E185BD86D00EB94BA /* PlayFileViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlayFileViewController.h; sourceTree = "<group>"; };
94056F2F185BD86D00EB94BA /* PlayFileViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PlayFileViewController.m; sourceTree = "<group>"; };
94056F30185BD86D00EB94BA /* PlayFileViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PlayFileViewController.xib; sourceTree = "<group>"; };
@@ -138,73 +68,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
94056F15185BD83400EB94BA /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
94056F1B185BD83400EB94BA /* Cocoa.framework in Frameworks */,
94056F1A185BD83400EB94BA /* XCTest.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
665957661B38B352003E97A1 /* EZAudio */ = {
isa = PBXGroup;
children = (
665957671B38B352003E97A1 /* AEFloatConverter.h */,
665957681B38B352003E97A1 /* AEFloatConverter.m */,
665957691B38B352003E97A1 /* EZAudio.h */,
6659576A1B38B352003E97A1 /* EZAudio.m */,
6659576B1B38B352003E97A1 /* EZAudioDevice.h */,
6659576C1B38B352003E97A1 /* EZAudioDevice.m */,
6659576D1B38B352003E97A1 /* EZAudioFile.h */,
6659576E1B38B352003E97A1 /* EZAudioFile.m */,
6659576F1B38B352003E97A1 /* EZAudioFloatConverter.h */,
665957701B38B352003E97A1 /* EZAudioFloatConverter.m */,
665957711B38B352003E97A1 /* EZAudioFloatData.h */,
665957721B38B352003E97A1 /* EZAudioFloatData.m */,
665957731B38B352003E97A1 /* EZAudioPlayer.h */,
665957741B38B352003E97A1 /* EZAudioPlayer.m */,
665957751B38B352003E97A1 /* EZAudioPlot.h */,
665957761B38B352003E97A1 /* EZAudioPlot.m */,
665957771B38B352003E97A1 /* EZAudioPlotGL.h */,
665957781B38B352003E97A1 /* EZAudioPlotGL.m */,
665957791B38B352003E97A1 /* EZAudioPlotGLKViewController.h */,
6659577A1B38B352003E97A1 /* EZAudioPlotGLKViewController.m */,
6659577B1B38B352003E97A1 /* EZAudioUtilities.h */,
6659577C1B38B352003E97A1 /* EZAudioUtilities.m */,
6659577D1B38B352003E97A1 /* EZMicrophone.h */,
6659577E1B38B352003E97A1 /* EZMicrophone.m */,
6659577F1B38B352003E97A1 /* EZOutput.h */,
665957801B38B352003E97A1 /* EZOutput.m */,
665957811B38B352003E97A1 /* EZPlot.h */,
665957821B38B352003E97A1 /* EZPlot.m */,
665957831B38B352003E97A1 /* EZRecorder.h */,
665957841B38B352003E97A1 /* EZRecorder.m */,
665957851B38B352003E97A1 /* TPCircularBuffer.c */,
665957861B38B352003E97A1 /* TPCircularBuffer.h */,
665957871B38B352003E97A1 /* VERSION */,
);
name = EZAudio;
path = ../../../../EZAudio;
sourceTree = "<group>";
};
665957871B38B352003E97A1 /* VERSION */ = {
isa = PBXGroup;
children = (
665957881B38B352003E97A1 /* CHANGELOG */,
665957891B38B352003E97A1 /* VERSION */,
);
path = VERSION;
sourceTree = "<group>";
};
94056EEE185BD83400EB94BA = {
isa = PBXGroup;
children = (
94056F00185BD83400EB94BA /* EZAudioPlayFileExample */,
94056F1E185BD83400EB94BA /* EZAudioPlayFileExampleTests */,
94056EF9185BD83400EB94BA /* Frameworks */,
94056EF8185BD83400EB94BA /* Products */,
);
@@ -214,7 +84,6 @@
isa = PBXGroup;
children = (
94056EF7185BD83400EB94BA /* EZAudioPlayFileExample.app */,
94056F18185BD83400EB94BA /* EZAudioPlayFileExampleTests.xctest */,
);
name = Products;
sourceTree = "<group>";
@@ -248,7 +117,6 @@
94056F00185BD83400EB94BA /* EZAudioPlayFileExample */ = {
isa = PBXGroup;
children = (
665957661B38B352003E97A1 /* EZAudio */,
94056F0C185BD83400EB94BA /* AppDelegate.h */,
94056F0D185BD83400EB94BA /* AppDelegate.m */,
94056F2E185BD86D00EB94BA /* PlayFileViewController.h */,
@@ -274,24 +142,6 @@
name = "Supporting Files";
sourceTree = "<group>";
};
94056F1E185BD83400EB94BA /* EZAudioPlayFileExampleTests */ = {
isa = PBXGroup;
children = (
94056F24185BD83400EB94BA /* EZAudioPlayFileExampleTests.m */,
94056F1F185BD83400EB94BA /* Supporting Files */,
);
path = EZAudioPlayFileExampleTests;
sourceTree = "<group>";
};
94056F1F185BD83400EB94BA /* Supporting Files */ = {
isa = PBXGroup;
children = (
94056F20185BD83400EB94BA /* EZAudioPlayFileExampleTests-Info.plist */,
94056F21185BD83400EB94BA /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -312,24 +162,6 @@
productReference = 94056EF7185BD83400EB94BA /* EZAudioPlayFileExample.app */;
productType = "com.apple.product-type.application";
};
94056F17185BD83400EB94BA /* EZAudioPlayFileExampleTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 94056F2B185BD83400EB94BA /* Build configuration list for PBXNativeTarget "EZAudioPlayFileExampleTests" */;
buildPhases = (
94056F14185BD83400EB94BA /* Sources */,
94056F15185BD83400EB94BA /* Frameworks */,
94056F16185BD83400EB94BA /* Resources */,
);
buildRules = (
);
dependencies = (
94056F1D185BD83400EB94BA /* PBXTargetDependency */,
);
name = EZAudioPlayFileExampleTests;
productName = EZAudioPlayFileExampleTests;
productReference = 94056F18185BD83400EB94BA /* EZAudioPlayFileExampleTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -338,11 +170,6 @@
attributes = {
LastUpgradeCheck = 0500;
ORGANIZATIONNAME = "Syed Haris Ali";
TargetAttributes = {
94056F17185BD83400EB94BA = {
TestTargetID = 94056EF6185BD83400EB94BA;
};
};
};
buildConfigurationList = 94056EF2185BD83400EB94BA /* Build configuration list for PBXProject "EZAudioPlayFileExample" */;
compatibilityVersion = "Xcode 3.2";
@@ -358,7 +185,6 @@
projectRoot = "";
targets = (
94056EF6185BD83400EB94BA /* EZAudioPlayFileExample */,
94056F17185BD83400EB94BA /* EZAudioPlayFileExampleTests */,
);
};
/* End PBXProject section */
@@ -371,22 +197,12 @@
6628E2351B3A121A00020E56 /* simple-drum-beat.wav in Resources */,
94056F05185BD83400EB94BA /* InfoPlist.strings in Resources */,
94056F13185BD83400EB94BA /* Images.xcassets in Resources */,
6659579A1B38B352003E97A1 /* CHANGELOG in Resources */,
94056F0B185BD83400EB94BA /* Credits.rtf in Resources */,
6659579B1B38B352003E97A1 /* VERSION in Resources */,
94056F32185BD86D00EB94BA /* PlayFileViewController.xib in Resources */,
94056F11185BD83400EB94BA /* MainMenu.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
94056F16185BD83400EB94BA /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
94056F23185BD83400EB94BA /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -394,46 +210,14 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
665957981B38B352003E97A1 /* EZRecorder.m in Sources */,
94056F31185BD86D00EB94BA /* PlayFileViewController.m in Sources */,
6659578E1B38B352003E97A1 /* EZAudioFloatConverter.m in Sources */,
6659578F1B38B352003E97A1 /* EZAudioFloatData.m in Sources */,
6659578A1B38B352003E97A1 /* AEFloatConverter.m in Sources */,
6659578D1B38B352003E97A1 /* EZAudioFile.m in Sources */,
665957961B38B352003E97A1 /* EZOutput.m in Sources */,
665957921B38B352003E97A1 /* EZAudioPlotGL.m in Sources */,
665957991B38B352003E97A1 /* TPCircularBuffer.c in Sources */,
665957911B38B352003E97A1 /* EZAudioPlot.m in Sources */,
94056F0E185BD83400EB94BA /* AppDelegate.m in Sources */,
665957951B38B352003E97A1 /* EZMicrophone.m in Sources */,
665957901B38B352003E97A1 /* EZAudioPlayer.m in Sources */,
6659578C1B38B352003E97A1 /* EZAudioDevice.m in Sources */,
94056F07185BD83400EB94BA /* main.m in Sources */,
665957971B38B352003E97A1 /* EZPlot.m in Sources */,
6659578B1B38B352003E97A1 /* EZAudio.m in Sources */,
665957941B38B352003E97A1 /* EZAudioUtilities.m in Sources */,
665957931B38B352003E97A1 /* EZAudioPlotGLKViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
94056F14185BD83400EB94BA /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
94056F25185BD83400EB94BA /* EZAudioPlayFileExampleTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
94056F1D185BD83400EB94BA /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 94056EF6185BD83400EB94BA /* EZAudioPlayFileExample */;
targetProxy = 94056F1C185BD83400EB94BA /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
94056F03185BD83400EB94BA /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
@@ -459,14 +243,6 @@
name = MainMenu.xib;
sourceTree = "<group>";
};
94056F21185BD83400EB94BA /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
94056F22185BD83400EB94BA /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
@@ -543,9 +319,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/EZAudioExamplesOSX-coaaitxpxjzwgfdbxuusgvrdmjux/Build/Products/Debug",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioPlayFileExample/EZAudioPlayFileExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioPlayFileExample/EZAudioPlayFileExample-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -556,54 +337,19 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/EZAudioExamplesOSX-coaaitxpxjzwgfdbxuusgvrdmjux/Build/Products/Debug",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioPlayFileExample/EZAudioPlayFileExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioPlayFileExample/EZAudioPlayFileExample-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
94056F2C185BD83400EB94BA /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/EZAudioPlayFileExample.app/Contents/MacOS/EZAudioPlayFileExample";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioPlayFileExample/EZAudioPlayFileExample-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = "EZAudioPlayFileExampleTests/EZAudioPlayFileExampleTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Debug;
};
94056F2D185BD83400EB94BA /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/EZAudioPlayFileExample.app/Contents/MacOS/EZAudioPlayFileExample";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioPlayFileExample/EZAudioPlayFileExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioPlayFileExampleTests/EZAudioPlayFileExampleTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -625,15 +371,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
94056F2B185BD83400EB94BA /* Build configuration list for PBXNativeTarget "EZAudioPlayFileExampleTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
94056F2C185BD83400EB94BA /* Debug */,
94056F2D185BD83400EB94BA /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 94056EEF185BD83400EB94BA /* Project object */;

Some files were not shown because too many files have changed in this diff Show More