Compare commits

..

318 Commits

Author SHA1 Message Date
Syed Haris Ali b3c6a8611f Update README.md 2022-03-22 14:06:28 -05:00
Syed Haris Ali 9ee64a8f3d Fixed another formatting issue 2017-04-09 17:17:17 -05:00
Syed Haris Ali c8ecd0c67b Cleaned up formatting issues in README 2017-04-09 17:16:26 -05:00
Syed Haris Ali 59c1540fa4 Restoring README w/ deprecated note at bottom
Restoring README back to what it was for people still forking and moved deprecated note to bottom.
2016-11-29 14:08:38 -06:00
Syed Haris Ali 984ea1928b Update README.md 2016-11-18 16:15:46 -06:00
Syed Haris Ali 983ae27301 Merge pull request #327 from syedhali/ha-deprecated
Added deprecated message to README
2016-06-13 09:35:29 -07:00
Syed Haris Ali c9e26fd58d Update README.md 2016-06-13 11:31:23 -05:00
Syed Haris Ali 2fafb7b181 Update README.md 2016-06-12 20:08:05 -07:00
Syed Haris Ali c8fb1432fd Added Tunerval to apps using EZAudio 2016-03-11 15:02:01 -06:00
Syed Haris Ali fb94503ac5 More updates to fix broken links and example names 2016-02-17 09:26:49 -06:00
Syed Haris Ali b37c24c16b Fixed broken links with new examples 2016-02-17 09:21:13 -06:00
Syed Haris Ali 1ce36b9c62 Merge pull request #278 from JanX2/master
Changing paths for “simple-drum-beat.wav” to be relative.
2016-02-14 10:56:35 -08:00
Jan Weiß caaad3ef67 Changing paths for “simple-drum-beat.wav” to be relative. 2016-02-14 11:39:38 +01:00
Syed Haris Ali 1ef90f0ce9 Merge pull request #275 from streeter/updated-initialization
Initialize struct values to 0 based on docs
2016-02-04 13:49:05 -06:00
Chris Streeter 664f788719 Initialize struct values to 0 based on docs
The docs for AudioComponentDescription say that componentFlags and
componentFlagsMask must be set to 0 unless specific values are
requested.

Different platforms (32 vs 64 bit) initialize data to different starting
values. Ensure the AudioComponentDescription is initialized to prevent
unwanted side effects.
2016-02-04 11:39:02 -08:00
Syed Haris Ali 5ff1d0454a Added Aure's Analog Synth X app to featured apps 2016-02-02 18:47:21 -06:00
Syed Haris Ali 5095bad10b bumped version to 1.1.5 2016-01-29 01:30:34 -08:00
Syed Haris Ali e2a1921954 Added carthage header files to exclude files in cocoapods 2016-01-29 01:30:02 -08:00
Syed Haris Ali 4ec22d1f29 Fixed TPCircularBuffer dependency 2016-01-24 03:27:14 -06:00
Syed Haris Ali 00479834b6 bumping version to 1.1.4 2016-01-24 03:18:13 -06:00
Syed Haris Ali 79ae7d4d76 switching TPCircularBuffer back to 1.2 2016-01-24 03:11:11 -06:00
Syed Haris Ali 3b02bb0e72 Updated podspec for TPCircularBuffer 2016-01-24 02:55:46 -06:00
Syed Haris Ali c5c19c3a84 bumping version to 1.1.3 2016-01-24 02:50:47 -06:00
Syed Haris Ali 6c39476b01 Added fix to make sure iOS record example plays back to the speaker 2016-01-24 02:38:00 -06:00
Syed Haris Ali bba89fee5c Merge pull request #265 from syedhali/ha-updated_examples_and_bug_fixes
Fixed bugs and updated examples for Xcode 7.2 + iOS 9
2016-01-24 02:33:24 -06:00
Syed Haris Ali 2750e91fef Cleanup 2016-01-24 02:33:00 -06:00
Syed Haris Ali 660107b1bc Updated license info 2016-01-24 02:29:31 -06:00
Syed Haris Ali 8c382994d8 Added bug fix for properly setting the EZMicrophone's bufferByteSize 2016-01-24 02:17:30 -06:00
Syed Haris Ali a4ea920b78 Clean up, switched back to sync write 2016-01-24 02:16:41 -06:00
Syed Haris Ali 58bead9770 Removed old FFT example 2016-01-24 02:02:19 -06:00
Syed Haris Ali 16412c12da attempting to fix recorder using async write 2016-01-24 01:25:56 -06:00
Syed Haris Ali aff42b0b1a Changed iOS deployment target to 8.0 2016-01-24 01:06:07 -06:00
Syed Haris Ali ea4536f4fe Added fix for invalid input buffer size error 2016-01-24 01:05:24 -06:00
Syed Haris Ali f4ee040119 Updated OSX app icons 2016-01-23 22:25:57 -06:00
Syed Haris Ali be92f132f6 renamed iOS examples workspace 2016-01-23 22:18:30 -06:00
Syed Haris Ali 66b7006e92 Updated iOS assets 2016-01-23 22:17:09 -06:00
Syed Haris Ali b68a2b9425 Added new PassThrough example for iOS 2016-01-23 22:06:26 -06:00
Syed Haris Ali 18a8962ef5 Removing old PassThrough example 2016-01-23 22:05:04 -06:00
Syed Haris Ali 88d88620d4 Added appicon set 2016-01-23 21:51:46 -06:00
Syed Haris Ali a34823a2a7 Added new WaveformFromFile example for iOS 2016-01-23 21:47:47 -06:00
Syed Haris Ali 2866f4021a Removing old WaveformFromFile example 2016-01-23 21:47:11 -06:00
Syed Haris Ali 6b61f97c99 Added cleanup 2016-01-23 21:36:57 -06:00
Syed Haris Ali 058562f809 deleted files 2016-01-23 21:30:13 -06:00
Syed Haris Ali ab378c5278 Added new RecordFile example for iOS 2016-01-23 21:29:10 -06:00
Syed Haris Ali 6ec5a2266c Removing old RecordFile example 2016-01-23 21:28:52 -06:00
Syed Haris Ali cb6550cc44 Added new RecordFile example for iOS 2016-01-23 21:27:48 -06:00
Syed Haris Ali 3cd3672692 Some minor cleanup 2016-01-23 21:13:10 -06:00
Syed Haris Ali 4bdd5bfd67 Some minor cleanup 2016-01-23 21:12:51 -06:00
Syed Haris Ali e788d77f0e Cleaned up comments 2016-01-23 21:10:14 -06:00
Syed Haris Ali 81d47c9eaa Removing old PlayFile example 2016-01-23 21:08:41 -06:00
Syed Haris Ali 94eac1f209 Added new PlayFile example for iOS 2016-01-23 21:06:32 -06:00
Syed Haris Ali 39f070e1b7 Added new OpenGLWaveform example for iOS 2016-01-23 20:50:20 -06:00
Syed Haris Ali 497214c893 Removing old OpenGLWaveform example 2016-01-23 20:45:44 -06:00
Syed Haris Ali aa855ba5f0 Removing old CoreGraphics example 2016-01-23 20:34:44 -06:00
Syed Haris Ali c783620404 Added new CoreGraphics example for iOS 2016-01-23 20:34:24 -06:00
Syed Haris Ali 7938ccfd3e Added proper license to top 2016-01-23 18:43:58 -06:00
Syed Haris Ali 0337197cef fixed warning 2016-01-23 18:41:29 -06:00
Syed Haris Ali 2aa9b43c1b Added EZAudio as embedded project to make each example standalone 2016-01-23 18:35:14 -06:00
Syed Haris Ali 761ca0d0df Changed deployment target of all examples to 10.8 2016-01-23 18:30:36 -06:00
Syed Haris Ali 91ef98df80 Finished up PassThrough mac example 2016-01-23 18:28:02 -06:00
Syed Haris Ali 6c316284fb Finished up FFT mac example 2016-01-23 18:16:36 -06:00
Syed Haris Ali 08c7795abf Removed OpenGL embedded project 2016-01-23 18:06:18 -06:00
Syed Haris Ali 1c85669b14 Finished up WaveformFromFile mac example 2016-01-23 18:04:56 -06:00
Syed Haris Ali a6836807b7 Finished up RecordFile mac example 2016-01-23 17:32:09 -06:00
Syed Haris Ali 1e4a0eb7e7 Cleaned header 2016-01-23 17:12:54 -06:00
Syed Haris Ali 950061a623 Replaced PlayFile with clean example 2016-01-23 17:12:23 -06:00
Syed Haris Ali 4154aff80a Updated OpenGLWaveform Mac example 2016-01-23 15:48:42 -06:00
Syed Haris Ali ba1f045e40 Clean up 2016-01-23 15:35:18 -06:00
Syed Haris Ali 7ba8ef1342 Fixed top license section 2016-01-23 15:31:14 -06:00
Syed Haris Ali b00946c63d Set OSX deployment target to 10.8 2016-01-23 15:21:01 -06:00
Syed Haris Ali ba04f637a1 Updated TPCircularBuffer (warnings) and updated CoreGraphics waveform exampl 2016-01-23 15:20:16 -06:00
Syed Haris Ali 5a1d0960ab Merge branch 'master' of https://github.com/syedhali/EZAudio 2015-12-25 22:42:32 -05:00
Syed Haris Ali f27e299258 Merge pull request #211 from AndrewSB/master
Add support for Carthage (iOS)
2015-10-27 11:55:30 -05:00
Syed Haris Ali 358084fdf6 Merge branch 'master' of https://github.com/AndrewSB/EZAudio 2015-10-27 02:08:18 -05:00
Tommaso Piazza 470d3cdd8b Changing import path to respect module map 2015-10-26 12:49:17 -07:00
Tommaso Piazza b47a663b95 Adding Umbrella headers 2015-10-26 12:49:16 -07:00
Tommaso Piazza 1fed713ea3 Adding OSX target 2015-10-26 12:49:16 -07:00
Andrew Breckenridge 7f0716d497 expose EZAudioDisplayLinkDelegate in the public header file 2015-10-26 12:49:16 -07:00
Ian Ownbey 797f21cd76 Made header files public 2015-10-26 12:49:16 -07:00
Andrew Breckenridge 8e8f8a22d0 create xcodeproj and shared scheme 2015-10-26 12:49:16 -07:00
Syed Haris Ali 26057a3332 Adding jumpshare to apps using EZAudio 2015-10-21 14:28:02 -07:00
Syed Haris Ali e32636a688 Merge pull request #197 from ppaulojr/ppaulojr-patch-1
Fix static analyzer errors
2015-09-14 22:59:47 -07:00
Syed Haris Ali f0b5013bb6 Merge pull request #219 from aure/master
Update EZAudio.h
2015-09-14 22:48:41 -07:00
Aurelius Prochazka 34ab1ce782 Update EZAudioUtilities.h
Same changes as EZAudio.h
2015-08-23 15:05:34 -07:00
Aurelius Prochazka 1622452bdc Update EZAudio.h
This may be a deprecated method, but the stars in front of the @params were causing warnings in documentation generation
2015-08-23 15:02:47 -07:00
Aurelius Prochazka b18783ae7e Update EZAudio.h
Just a typo which was warning on documentation generation
2015-08-23 14:58:38 -07:00
Syed Haris Ali ff92fe1d7f Merge branch 'master' of https://github.com/syedhali/EZAudio 2015-08-14 16:56:23 -07:00
Syed Haris Ali 8209c9d263 added app icons to all iOS examples 2015-08-14 16:56:06 -07:00
Syed Haris Ali 78a867bd39 Update README.md 2015-08-14 15:39:05 -07:00
Syed Haris Ali b999ac1184 Added new EZAudio logo 2015-08-14 14:15:00 -07:00
Pedro Paulo Jr 5a3ad39fac Update EZAudio.podspec
Proper handling of `fabs` vs `labs` in the dependency
2015-07-20 17:29:38 -03:00
Pedro Paulo Jr c773cdc05a prevent division by zero
prevent division by zero - identified by static analyzer
2015-07-20 17:19:15 -03:00
Syed Haris Ali b4bb38c8d6 Updated to 1.1.2 with avaudiosession fix on FFT example 2015-07-14 10:09:31 -07:00
Syed Haris Ali 7ae6c39e30 Merge pull request #192 from syedhali/session_fix_fft_example
Added play/record session to FFT iOS example
2015-07-14 10:07:38 -07:00
Syed Haris Ali b51786cb55 added play/record session 2015-07-14 10:06:46 -07:00
Syed Haris Ali 4900649287 added david's audioBufferList fix 2015-07-13 17:15:07 -07:00
Syed Haris Ali b99af54f31 style tweak 2015-07-13 17:08:54 -07:00
Syed Haris Ali b99f4b5366 Merge pull request #190 from dedjw/djw-audio-buffer-fix
Fix for audioBufferListWithNumberOfFrames: to match CoreAudio expectations
2015-07-13 17:07:41 -07:00
David Williams 78ea296cb2 Fix for audioBufferListWithNumberOfFrames:... to match CoreAudio expectations.
CoreAudio was giving a kAudioConverterErr_InvalidInputSize error when trying to
use bufferLists created by audioBufferListWithNumberOfFrames. The
mNumberBuffers, mNumberChannels, mDataByteSize needs to be self consistent.
Hopefully, this change fixes that.
Also, replaced the malloc/memset pair with calloc. memset was zeroing
only number of frames bytes, rather than the buffer size. Switching
to calloc ensures the buffer is zeroed out.
2015-07-13 16:46:22 -07:00
Syed Haris Ali 10b00754a9 removed debug line 2015-07-13 15:15:28 -07:00
Syed Haris Ali a35bb9a763 bumped version to 1.1.0 2015-07-13 15:14:27 -07:00
Syed Haris Ali 67199afe0b Update README.md 2015-07-13 15:11:58 -07:00
Syed Haris Ali 05cbfc8aa7 Merge pull request #189 from syedhali/ezfft_addition
Added EZAudioFFT, EZAudioFFTRolling, and fixed bug with appendBuffer: history funct
2015-07-13 13:22:01 -07:00
Syed Haris Ali 8732437e4a added music note utility method and updated examples 2015-07-13 13:19:07 -07:00
Syed Haris Ali 4b94107876 updated examples 2015-07-11 18:49:12 -07:00
Syed Haris Ali 65ee73736f added accelerate to list of dependencies 2015-07-11 17:40:11 -07:00
Syed Haris Ali 0cef3d22c9 added accelerate to list of dependencies 2015-07-11 17:39:22 -07:00
Syed Haris Ali f93e083af4 renamed to EZAudioFFT and added documentation 2015-07-11 17:34:36 -07:00
Syed Haris Ali 5404546901 adding EZFFT and fixed bug with appendBuffer utility function 2015-07-11 15:42:03 -07:00
Syed Haris Ali d08d7d6bfd Merge pull request #187 from syedhali/better_rolling_history_methods
Added more explicit methods for rolling history data structure
2015-07-11 12:36:42 -07:00
Syed Haris Ali e996ba60f8 added more explicit methods for rolling history data structure 2015-07-11 12:28:05 -07:00
Syed Haris Ali c148139fdd bumped version to 1.0.1 2015-07-09 13:46:38 -07:00
Syed Haris Ali 7a91b9b456 Merge pull request #180 from antonm76/master
EXC_BAD_ACCESS is fixed
2015-07-09 13:44:20 -07:00
Syed Haris Ali 2bd4993b31 Update EZAudioDevice.m 2015-07-06 19:25:47 -07:00
Syed Haris Ali d287995165 Update EZAudioDevice.h 2015-07-06 19:25:36 -07:00
Syed Haris Ali 7281f6cfcc updated podspec to 1.0.0 2015-07-06 19:20:07 -07:00
Syed Haris Ali 7ce2e67e91 Updated for 1.0.0 2015-07-06 19:17:32 -07:00
Syed Haris Ali 0279ce4fcc Added welcome message and projects request 2015-07-06 19:14:23 -07:00
Syed Haris Ali 3fc8fbd421 Added missing links 2015-07-06 18:57:26 -07:00
Syed Haris Ali 2736de1a8b Added description for EZAudioPlayer 2015-07-06 18:55:30 -07:00
Syed Haris Ali dd0139ed38 Added EZAudioPlayer 2015-07-06 18:34:44 -07:00
Syed Haris Ali 1b82915277 Update README.md 2015-07-06 18:15:33 -07:00
Syed Haris Ali 8d91213255 Add EZOutput effect chain explanation 2015-07-06 18:15:06 -07:00
Syed Haris Ali d2cc488dfb Update README.md 2015-07-06 17:56:22 -07:00
Syed Haris Ali 9a499a7c09 Update README.md 2015-07-06 17:36:48 -07:00
Syed Haris Ali 0c389efb0f Update README.md 2015-07-06 17:31:53 -07:00
Syed Haris Ali 89c8c808d3 Update README.md 2015-07-06 17:29:05 -07:00
Syed Haris Ali a6d3a02a91 Update README.md 2015-07-06 17:26:07 -07:00
Syed Haris Ali b52c819d02 Update README.md 2015-07-06 17:21:19 -07:00
Syed Haris Ali caf9062275 Added extended description of EZAudioDevice usage 2015-07-06 17:15:34 -07:00
Syed Haris Ali e77116aa1b Added EZAudioDevice + EZOutput device selection 2015-07-06 16:57:35 -07:00
Syed Haris Ali 67c9e3b1cb Updated FFT gif 2015-07-06 16:06:24 -07:00
Syed Haris Ali 4cc46687aa Update README.md 2015-07-06 15:57:03 -07:00
Syed Haris Ali 71337ca4bd Updated EZRecorder description and snippets 2015-07-06 15:53:49 -07:00
Syed Haris Ali 1e6cb271ed Finished up EZOutput description 2015-07-06 15:10:00 -07:00
Syed Haris Ali 5c8de38ad0 Updated EZOutputDataSource sine implementation
Added code snippet and description
2015-07-06 15:07:41 -07:00
Syed Haris Ali d3767afc76 Update README.md 2015-07-06 15:02:14 -07:00
Syed Haris Ali 2bdfe29e09 Updated EZAudioPlotGL description 2015-07-06 14:04:40 -07:00
Syed Haris Ali 0da69ab293 Updated interface builder instructions with gifs 2015-07-06 13:55:04 -07:00
Syed Haris Ali 834b1d9254 Updated EZAudioPlot and EZAudioPlotGL
Updated code snippets and descriptions
2015-07-06 12:23:22 -07:00
Syed Haris Ali e651d09f3d fixed stuff, removed circular buffer part of output 2015-07-06 00:30:31 -07:00
Syed Haris Ali 1adeea40b9 Merge pull request #184 from syedhali/new_readme
Updated EZAudioFile & EZMicrophone README
2015-07-06 00:27:45 -07:00
Syed Haris Ali 880a6c54e4 updated EZMicrophone code snippets 2015-07-06 00:26:40 -07:00
Syed Haris Ali 1ff2bc4ae9 updated more EZAudioFile code snippets 2015-07-06 00:20:02 -07:00
Syed Haris Ali 8636bc4cae updated EZAudioFile documentation and code snippets 2015-07-06 00:09:28 -07:00
Syed Haris Ali 021ae59035 updated audio file section 2015-07-05 23:52:09 -07:00
Syed Haris Ali cce54d802e updated example descriptions and component count 2015-07-05 23:43:47 -07:00
Syed Haris Ali 44f724b4ab changed title position 2015-07-05 23:33:57 -07:00
Syed Haris Ali 6631a15f66 added gifs to example projects 2015-07-05 23:29:22 -07:00
Syed Haris Ali b6e00fd8eb updated to 0.9.1 2015-07-05 21:51:18 -07:00
Syed Haris Ali 445e2fa530 Merge pull request #183 from syedhali/update_examples
Updated examples
2015-07-05 21:48:16 -07:00
Syed Haris Ali 3bb1b914a2 tiny tweak 2015-07-05 21:46:24 -07:00
Syed Haris Ali 6d00378ab0 removed warning 2015-07-05 21:45:50 -07:00
Syed Haris Ali ac07210263 bug fixes, UI updates, and added inspectable attributes 2015-07-05 21:45:00 -07:00
Syed Haris Ali 5920e7a61e added inspectable attributes to gl plot 2015-07-05 21:04:52 -07:00
Syed Haris Ali 4ef91004ea updated podspec to 0.9.0 2015-07-05 20:42:04 -07:00
Syed Haris Ali 1c6213c9c6 Merge branch 'master' of https://github.com/syedhali/EZAudio 2015-07-05 20:09:06 -07:00
Syed Haris Ali 59bd612164 updated examples for OSX 2015-07-05 20:08:57 -07:00
Syed Haris Ali b89b2254f0 Merge pull request #178 from hakanw/audio_file_reached_end_delegate_method 2015-07-05 15:30:43 -07:00
Håkan Waara 086ce50a54 document new audioplayer delegate method and fix styling nit 2015-07-05 23:18:53 +02:00
Syed Haris Ali 6684a874aa added current device for OSX, updated OSX examples to new window style 2015-07-05 13:23:34 -07:00
Syed Haris Ali 0c7226b3b0 updated podspec and readme to 0.8.0 2015-07-04 13:07:57 -07:00
Syed Haris Ali 9516768b1c Merge pull request #182 from syedhali/recorder_rewriter
Rewrote EZRecorder
2015-07-04 12:56:37 -07:00
Syed Haris Ali cf9dafc961 updated recording OSX example 2015-07-04 12:54:46 -07:00
Syed Haris Ali a74b1cf612 made current time readonly 2015-07-04 11:38:47 -07:00
Syed Haris Ali 1e7975e6cc little bit more cleanup 2015-07-04 11:33:41 -07:00
Syed Haris Ali cdd1372e30 added a ton of documentation 2015-07-03 21:29:44 -07:00
Syed Haris Ali 9f9c352f43 cleaned up header 2015-07-03 20:48:06 -07:00
Syed Haris Ali 9aab703069 updated recording example 2015-07-03 20:46:33 -07:00
Syed Haris Ali 3706a21e83 updated recorder to have API similar to EZAudioFile 2015-07-03 20:46:15 -07:00
Syed Haris Ali effa122525 updated client format doc 2015-07-03 20:44:54 -07:00
Syed Haris Ali 825e22e135 added play state delegate methods to mic 2015-07-03 20:40:49 -07:00
Syed Haris Ali 33c9ca84a2 added new initializers and class initializers 2015-07-03 18:31:41 -07:00
Syed Haris Ali 1a74a7def5 updating recorder to use same kind of API as EZAudioFile 2015-07-03 17:14:24 -07:00
Syed Haris Ali dcaadd43ce updated README 2015-07-03 10:49:08 -07:00
Syed Haris Ali 03db74e842 bumped version to 0.7.2 2015-07-03 10:44:56 -07:00
Syed Haris Ali ec19d44d86 Merge pull request #181 from syedhali/bug_fixes
Bug fixes
2015-07-03 10:43:37 -07:00
Syed Haris Ali 1e23f95dc2 added proper graph disposal 2015-07-03 10:41:58 -07:00
Syed Haris Ali 4d0b40d730 fixed crash in EZMicrophone due to running setup twice 2015-07-03 10:37:00 -07:00
Syed Haris Ali 732cf79963 Updated with The Amazing Audio Engine stuff 2015-07-02 12:36:15 -07:00
Syed Haris Ali 7e84f8744f Fixed typo 2015-07-02 12:25:08 -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
Anton Myshkovsky 5baeec30ce EXC_BAD_ACCESS is fixed
Occuring in initWithMicrophoneDelegate:withAudioStreamBasicDescription: during initial creation of EZMicrophone.
2015-07-02 15:30:14 +03:00
Håkan Waara 4f31db3d0e implement delegate method to find out when an audio file reached end, and also which file. 2015-07-02 11:59:02 +02: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
Syed Haris Ali 2822b1952d updated readme 2015-06-24 01:49:49 -07:00
Syed Haris Ali 05fc557b47 updated podspec 2015-06-24 01:48:09 -07:00
Syed Haris Ali 319b377204 updated license headers 2015-06-24 01:46:04 -07:00
Syed Haris Ali 2b191c2934 Merge branch 'microphone_rewrite' 2015-06-24 01:38:06 -07:00
Syed Haris Ali 1e7ecccb34 updated background color 2015-06-24 01:33:16 -07:00
Syed Haris Ali d6df17dd77 minor tweak 2015-06-24 01:12:48 -07:00
Syed Haris Ali 6fa604744d cleaning up with .gitignore 2015-06-24 01:09:40 -07:00
Syed Haris Ali c85d2d15f0 last commit before global gitignore 2015-06-24 01:08:33 -07:00
Syed Haris Ali 7299edd94e updated gitignore 2015-06-24 01:05:24 -07:00
Syed Haris Ali 786019aada added documentation 2015-06-24 00:58:35 -07:00
Syed Haris Ali 7852b391f2 added code to make sure info structures that are malloc'ed are also initalized to 0 (memset) 2015-06-24 00:44:36 -07:00
Syed Haris Ali 1978023fed tweaked deprecated attributes documentation 2015-06-24 00:21:57 -07:00
Syed Haris Ali 20df3f3531 mapped EZAudio to EZAudioUtilities and added deprecated warnings 2015-06-24 00:13:29 -07:00
Syed Haris Ali 73b478e28b got rid of warnings from deprecated use of EZAudio methods 2015-06-23 23:47:57 -07:00
Syed Haris Ali a00df48ea1 added additional documentation 2015-06-23 22:26:37 -07:00
Syed Haris Ali 98e953ce98 cleaned up utilities and added license to header 2015-06-23 21:09:04 -07:00
Syed Haris Ali d63cd4dc40 added documentation to shouldExistOnCheckResultFail 2015-06-23 17:28:50 -07:00
Syed Haris Ali fd37dcdda0 cleaned up float converter + data classes 2015-06-23 17:16:24 -07:00
Syed Haris Ali ee6cc530d8 beginning to add documentation to EZAudioDevice 2015-06-23 17:13:21 -07:00
Syed Haris Ali 682b41ecd7 added tweak to opengl plot to properly render on retina macbooks 2015-06-23 16:39:55 -07:00
Syed Haris Ali 46526a0151 added print line to pass through example to show input device used 2015-06-23 16:38:33 -07:00
Syed Haris Ali 7bbe1c8335 cleaned up recording and passthrough examples 2015-06-23 16:34:52 -07:00
Syed Haris Ali 2f4e2492b2 added memory clean up for FFT example 2015-06-23 16:17:45 -07:00
Syed Haris Ali e72b5697bc updated FFT example for OSX 2015-06-23 16:16:03 -07:00
Syed Haris Ali 07b93765ae more cleanup for waveform from file example 2015-06-23 15:59:50 -07:00
Syed Haris Ali 4a7fb90ffa fixed waveform from file example for OSX 2015-06-23 15:58:03 -07:00
Syed Haris Ali cdd6e2b099 minor UI tweaks 2015-06-23 15:49:31 -07:00
Syed Haris Ali 6c77e38d39 updated OSX play file example 2015-06-23 15:46:55 -07:00
Syed Haris Ali 2c3c267859 all iOS examples have been updated 2015-06-23 15:11:03 -07:00
Syed Haris Ali f6e07602a0 cleaned up passthrough example 2015-06-23 15:08:31 -07:00
Syed Haris Ali 3915791e43 more support for direct out 2015-06-23 14:50:40 -07:00
Syed Haris Ali bdfb9956fa added support to microphone to allow direct out to EZOutput 2015-06-23 14:38:55 -07:00
Syed Haris Ali f5b0c727c4 added interruption handling for iOS 2015-06-23 14:24:12 -07:00
Syed Haris Ali 1e58da11ed tweaked microphone to respect custom asbd 2015-06-23 14:17:27 -07:00
Syed Haris Ali 35fdfb4c71 updated passthrough exampe 2015-06-23 14:06:31 -07:00
Syed Haris Ali ac9937a40a updated FFT example 2015-06-23 14:02:48 -07:00
Syed Haris Ali bbfe60861d updated record example ui for iOS project 2015-06-23 13:53:43 -07:00
Syed Haris Ali 8fb459635f tweaked styles for play file example 2015-06-23 13:38:20 -07:00
Syed Haris Ali 4cf8544cbf replaced iphone/ipad storyboards with universal storyboards 2015-06-23 13:35:55 -07:00
Syed Haris Ali 9fadbd3c1c updating recording example for iOS 2015-06-23 11:23:40 -07:00
Syed Haris Ali 32e27759d2 updated core graphics and openGL waveforms on iOS examples 2015-06-23 11:13:02 -07:00
Syed Haris Ali 3a3ab955f2 cleaning up EZMicrophone interface 2015-06-23 11:09:43 -07:00
Syed Haris Ali 47ebde3903 made microphone mono by default 2015-06-23 10:52:13 -07:00
Syed Haris Ali 38253f0923 more cleanup 2015-06-22 14:37:03 -07:00
Syed Haris Ali ade9cc9d1e updating OSX examples 2015-06-22 14:35:04 -07:00
Syed Haris Ali 1e923f2c85 added new float converter (EZAudioFloatConverter), float data object (EZAudioFloatData), and device selector (EZAudioDevice) 2015-06-22 14:18:13 -07:00
Syed Haris Ali d0bae18885 going to fix examples 2015-06-22 14:09:05 -07:00
Syed Haris Ali 46fe0bbb4c removed DS_Store from iOS examples 2015-06-22 14:04:46 -07:00
Syed Haris Ali dca7aec551 removed DS_Store from OSX example 2015-06-22 14:04:10 -07:00
Syed Haris Ali 23e3a216c7 Merge pull request #150 from JamieCruwys/master
Fixed memory leak in EZAudioFile
2015-04-25 12:24:09 -07:00
Jamie Cruwys 1b1d0bf81d Fixed memory leak in EZAudioFile
The variable _floatBuffers is allocated but is not subsequently
deallocated (freed). Some memory management was present for
_floatBuffers in this commit:
https://github.com/syedhali/EZAudio/commit/2431b2520496118cdc09af6b99846
61285e38c52. However, this was subsequently commented out in a later
commit:
https://github.com/syedhali/EZAudio/commit/1dc2fc2ba902f6fa9b1f8ec2c0c77
94aa7d66ee2. I have uncommented and improved this.
2015-04-25 18:39:15 +01:00
Syed Haris Ali e3be762414 Merge pull request #149 from JamieCruwys/master
Fixed two memory leaks in EZMicrophone
2015-04-24 15:27:24 -07:00
Jamie Cruwys da6bd9445a Fixed two memory leaks in EZMicrophone
The variables microphoneInputBuffer and floatBuffers are allocated but
are not subsequently deallocated (freed). The memory leaks are visible
in this leaks instrumentation screenshot:
http://i.imgur.com/vvO3GBt.png. After running this fix, the leaks are
gone as per the results here: http://i.imgur.com/mbtS3Rb.png.
2015-04-24 23:00:24 +01:00
Syed Haris Ali ba6d8582c8 merged msater 2015-02-14 21:21:11 -08:00
Syed Haris Ali e25baaa21e removing DS_Store 2015-02-14 21:18:42 -08:00
Syed Haris Ali e1d404238b Adding files to develop branch 2014-05-28 23:37:44 -07:00
621 changed files with 29353 additions and 25972 deletions
Vendored
BIN
View File
Binary file not shown.
+17
View File
@@ -0,0 +1,17 @@
.DS_Store
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
+23 -15
View File
@@ -1,17 +1,25 @@
Pod::Spec.new do |s|
s.name = "EZAudio"
s.version = "0.0.6"
s.summary = "A simple, intuitive audio framework for iOS and OSX useful for anyone doing audio processing and/or audio-based visualizations."
s.homepage = "http://syedharisali.com/projects/EZAudio/getting-started"
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 => "0.0.6" }
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;
s.name = "EZAudio"
s.version = "1.1.5"
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 = '8.0'
s.osx.deployment_target = '10.8'
s.source = { :git => "https://github.com/syedhali/EZAudio.git", :tag => s.version }
s.exclude_files = [ 'EZAudio/TPCircularBuffer.{h,c}', 'EZAudio/EZAudioiOS.h', 'EZAudio/EZAudioOSX.h' ]
s.ios.frameworks = 'AudioToolbox','AVFoundation','GLKit', 'Accelerate'
s.osx.frameworks = 'AudioToolbox','AudioUnit','CoreAudio','QuartzCore','OpenGL','GLKit', 'Accelerate'
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', '1.1'
full.dependency 'EZAudio/Core'
end
end
+587
View File
@@ -0,0 +1,587 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
469F4D1E1B749FEC00666A46 /* EZAudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4CFE1B749FEC00666A46 /* EZAudio.h */; settings = {ATTRIBUTES = (Public, ); }; };
469F4D1F1B749FEC00666A46 /* EZAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4CFF1B749FEC00666A46 /* EZAudio.m */; };
469F4D201B749FEC00666A46 /* EZAudioDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D001B749FEC00666A46 /* EZAudioDevice.h */; settings = {ATTRIBUTES = (Public, ); }; };
469F4D211B749FEC00666A46 /* EZAudioDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D011B749FEC00666A46 /* EZAudioDevice.m */; };
469F4D221B749FEC00666A46 /* EZAudioDisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D021B749FEC00666A46 /* EZAudioDisplayLink.h */; settings = {ATTRIBUTES = (Public, ); }; };
469F4D231B749FEC00666A46 /* EZAudioDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D031B749FEC00666A46 /* EZAudioDisplayLink.m */; };
469F4D241B749FEC00666A46 /* EZAudioFFT.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D041B749FEC00666A46 /* EZAudioFFT.h */; settings = {ATTRIBUTES = (Public, ); }; };
469F4D251B749FEC00666A46 /* EZAudioFFT.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D051B749FEC00666A46 /* EZAudioFFT.m */; };
469F4D261B749FEC00666A46 /* EZAudioFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D061B749FEC00666A46 /* EZAudioFile.h */; settings = {ATTRIBUTES = (Public, ); }; };
469F4D271B749FEC00666A46 /* EZAudioFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D071B749FEC00666A46 /* EZAudioFile.m */; };
469F4D281B749FEC00666A46 /* EZAudioFloatConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D081B749FEC00666A46 /* EZAudioFloatConverter.h */; settings = {ATTRIBUTES = (Public, ); }; };
469F4D291B749FEC00666A46 /* EZAudioFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D091B749FEC00666A46 /* EZAudioFloatConverter.m */; };
469F4D2A1B749FEC00666A46 /* EZAudioFloatData.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D0A1B749FEC00666A46 /* EZAudioFloatData.h */; settings = {ATTRIBUTES = (Public, ); }; };
469F4D2B1B749FEC00666A46 /* EZAudioFloatData.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D0B1B749FEC00666A46 /* EZAudioFloatData.m */; };
469F4D2C1B749FEC00666A46 /* EZAudioPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D0C1B749FEC00666A46 /* EZAudioPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
469F4D2D1B749FEC00666A46 /* EZAudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D0D1B749FEC00666A46 /* EZAudioPlayer.m */; };
469F4D2E1B749FEC00666A46 /* EZAudioPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D0E1B749FEC00666A46 /* EZAudioPlot.h */; settings = {ATTRIBUTES = (Public, ); }; };
469F4D2F1B749FEC00666A46 /* EZAudioPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D0F1B749FEC00666A46 /* EZAudioPlot.m */; };
469F4D301B749FEC00666A46 /* EZAudioPlotGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D101B749FEC00666A46 /* EZAudioPlotGL.h */; settings = {ATTRIBUTES = (Public, ); }; };
469F4D311B749FEC00666A46 /* EZAudioPlotGL.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D111B749FEC00666A46 /* EZAudioPlotGL.m */; };
469F4D321B749FEC00666A46 /* EZAudioUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D121B749FEC00666A46 /* EZAudioUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
469F4D331B749FEC00666A46 /* EZAudioUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D131B749FEC00666A46 /* EZAudioUtilities.m */; };
469F4D341B749FEC00666A46 /* EZMicrophone.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D141B749FEC00666A46 /* EZMicrophone.h */; settings = {ATTRIBUTES = (Public, ); }; };
469F4D351B749FEC00666A46 /* EZMicrophone.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D151B749FEC00666A46 /* EZMicrophone.m */; };
469F4D361B749FEC00666A46 /* EZOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D161B749FEC00666A46 /* EZOutput.h */; settings = {ATTRIBUTES = (Public, ); }; };
469F4D371B749FEC00666A46 /* EZOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D171B749FEC00666A46 /* EZOutput.m */; };
469F4D381B749FEC00666A46 /* EZPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D181B749FEC00666A46 /* EZPlot.h */; settings = {ATTRIBUTES = (Public, ); }; };
469F4D391B749FEC00666A46 /* EZPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D191B749FEC00666A46 /* EZPlot.m */; };
469F4D3A1B749FEC00666A46 /* EZRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D1A1B749FEC00666A46 /* EZRecorder.h */; settings = {ATTRIBUTES = (Public, ); }; };
469F4D3B1B749FEC00666A46 /* EZRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D1B1B749FEC00666A46 /* EZRecorder.m */; };
469F4D3C1B749FEC00666A46 /* TPCircularBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D1C1B749FEC00666A46 /* TPCircularBuffer.c */; };
469F4D3D1B749FEC00666A46 /* TPCircularBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D1D1B749FEC00666A46 /* TPCircularBuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BB31BBBDD6D00A8A048 /* EZAudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4CFE1B749FEC00666A46 /* EZAudio.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BB41BBBDD6D00A8A048 /* EZAudioDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D001B749FEC00666A46 /* EZAudioDevice.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BB51BBBDD6D00A8A048 /* EZAudioDisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D021B749FEC00666A46 /* EZAudioDisplayLink.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BB61BBBDD6D00A8A048 /* EZAudioFFT.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D041B749FEC00666A46 /* EZAudioFFT.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BB71BBBDD6D00A8A048 /* EZAudioFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D061B749FEC00666A46 /* EZAudioFile.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BB81BBBDD6D00A8A048 /* EZAudioFloatConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D081B749FEC00666A46 /* EZAudioFloatConverter.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BB91BBBDD6D00A8A048 /* EZAudioFloatData.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D0A1B749FEC00666A46 /* EZAudioFloatData.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BBA1BBBDD6D00A8A048 /* EZAudioPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D0C1B749FEC00666A46 /* EZAudioPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BBB1BBBDD6D00A8A048 /* EZAudioPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D0E1B749FEC00666A46 /* EZAudioPlot.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BBC1BBBDD6D00A8A048 /* EZAudioPlotGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D101B749FEC00666A46 /* EZAudioPlotGL.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BBD1BBBDD6D00A8A048 /* EZAudioUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D121B749FEC00666A46 /* EZAudioUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BBE1BBBDD6D00A8A048 /* EZMicrophone.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D141B749FEC00666A46 /* EZMicrophone.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BBF1BBBDD6D00A8A048 /* EZOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D161B749FEC00666A46 /* EZOutput.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BC01BBBDD6D00A8A048 /* EZPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D181B749FEC00666A46 /* EZPlot.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BC11BBBDD6D00A8A048 /* EZRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D1A1B749FEC00666A46 /* EZRecorder.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BC21BBBDD6E00A8A048 /* TPCircularBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D1D1B749FEC00666A46 /* TPCircularBuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BC31BBBDD7E00A8A048 /* EZAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4CFF1B749FEC00666A46 /* EZAudio.m */; };
8A5A4BC41BBBDD7E00A8A048 /* EZAudioDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D011B749FEC00666A46 /* EZAudioDevice.m */; };
8A5A4BC51BBBDD7E00A8A048 /* EZAudioDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D031B749FEC00666A46 /* EZAudioDisplayLink.m */; };
8A5A4BC61BBBDD7E00A8A048 /* EZAudioFFT.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D051B749FEC00666A46 /* EZAudioFFT.m */; };
8A5A4BC71BBBDD7E00A8A048 /* EZAudioFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D071B749FEC00666A46 /* EZAudioFile.m */; };
8A5A4BC81BBBDD7E00A8A048 /* EZAudioFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D091B749FEC00666A46 /* EZAudioFloatConverter.m */; };
8A5A4BC91BBBDD7E00A8A048 /* EZAudioFloatData.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D0B1B749FEC00666A46 /* EZAudioFloatData.m */; };
8A5A4BCA1BBBDD7E00A8A048 /* EZAudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D0D1B749FEC00666A46 /* EZAudioPlayer.m */; };
8A5A4BCB1BBBDD7E00A8A048 /* EZAudioPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D0F1B749FEC00666A46 /* EZAudioPlot.m */; };
8A5A4BCC1BBBDD7E00A8A048 /* EZAudioPlotGL.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D111B749FEC00666A46 /* EZAudioPlotGL.m */; };
8A5A4BCD1BBBDD7E00A8A048 /* EZAudioUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D131B749FEC00666A46 /* EZAudioUtilities.m */; };
8A5A4BCE1BBBDD7E00A8A048 /* EZMicrophone.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D151B749FEC00666A46 /* EZMicrophone.m */; };
8A5A4BCF1BBBDD7E00A8A048 /* EZOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D171B749FEC00666A46 /* EZOutput.m */; };
8A5A4BD01BBBDD7E00A8A048 /* EZPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D191B749FEC00666A46 /* EZPlot.m */; };
8A5A4BD11BBBDD7E00A8A048 /* EZRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D1B1B749FEC00666A46 /* EZRecorder.m */; };
8A5A4BD21BBBDE2800A8A048 /* TPCircularBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D1C1B749FEC00666A46 /* TPCircularBuffer.c */; };
8A5A4BF31BBBFFA000A8A048 /* EZAudioOSX.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A5A4BF11BBBFF5600A8A048 /* EZAudioOSX.h */; settings = {ATTRIBUTES = (Public, ); }; };
8A5A4BF41BBC025600A8A048 /* EZAudioiOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A5A4BEF1BBBFF0A00A8A048 /* EZAudioiOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
469F4CF31B749F7800666A46 /* EZAudioiOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = EZAudioiOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
469F4CF81B749F7800666A46 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
469F4CFE1B749FEC00666A46 /* EZAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudio.h; sourceTree = "<group>"; };
469F4CFF1B749FEC00666A46 /* EZAudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudio.m; sourceTree = "<group>"; };
469F4D001B749FEC00666A46 /* EZAudioDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioDevice.h; sourceTree = "<group>"; };
469F4D011B749FEC00666A46 /* EZAudioDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioDevice.m; sourceTree = "<group>"; };
469F4D021B749FEC00666A46 /* EZAudioDisplayLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioDisplayLink.h; sourceTree = "<group>"; };
469F4D031B749FEC00666A46 /* EZAudioDisplayLink.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioDisplayLink.m; sourceTree = "<group>"; };
469F4D041B749FEC00666A46 /* EZAudioFFT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFFT.h; sourceTree = "<group>"; };
469F4D051B749FEC00666A46 /* EZAudioFFT.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFFT.m; sourceTree = "<group>"; };
469F4D061B749FEC00666A46 /* EZAudioFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFile.h; sourceTree = "<group>"; };
469F4D071B749FEC00666A46 /* EZAudioFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFile.m; sourceTree = "<group>"; };
469F4D081B749FEC00666A46 /* EZAudioFloatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatConverter.h; sourceTree = "<group>"; };
469F4D091B749FEC00666A46 /* EZAudioFloatConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatConverter.m; sourceTree = "<group>"; };
469F4D0A1B749FEC00666A46 /* EZAudioFloatData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatData.h; sourceTree = "<group>"; };
469F4D0B1B749FEC00666A46 /* EZAudioFloatData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatData.m; sourceTree = "<group>"; };
469F4D0C1B749FEC00666A46 /* EZAudioPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlayer.h; sourceTree = "<group>"; };
469F4D0D1B749FEC00666A46 /* EZAudioPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlayer.m; sourceTree = "<group>"; };
469F4D0E1B749FEC00666A46 /* EZAudioPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlot.h; sourceTree = "<group>"; };
469F4D0F1B749FEC00666A46 /* EZAudioPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlot.m; sourceTree = "<group>"; };
469F4D101B749FEC00666A46 /* EZAudioPlotGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGL.h; sourceTree = "<group>"; };
469F4D111B749FEC00666A46 /* EZAudioPlotGL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGL.m; sourceTree = "<group>"; };
469F4D121B749FEC00666A46 /* EZAudioUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioUtilities.h; sourceTree = "<group>"; };
469F4D131B749FEC00666A46 /* EZAudioUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioUtilities.m; sourceTree = "<group>"; };
469F4D141B749FEC00666A46 /* EZMicrophone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZMicrophone.h; sourceTree = "<group>"; };
469F4D151B749FEC00666A46 /* EZMicrophone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZMicrophone.m; sourceTree = "<group>"; };
469F4D161B749FEC00666A46 /* EZOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZOutput.h; sourceTree = "<group>"; };
469F4D171B749FEC00666A46 /* EZOutput.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZOutput.m; sourceTree = "<group>"; };
469F4D181B749FEC00666A46 /* EZPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZPlot.h; sourceTree = "<group>"; };
469F4D191B749FEC00666A46 /* EZPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZPlot.m; sourceTree = "<group>"; };
469F4D1A1B749FEC00666A46 /* EZRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZRecorder.h; sourceTree = "<group>"; };
469F4D1B1B749FEC00666A46 /* EZRecorder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZRecorder.m; sourceTree = "<group>"; };
469F4D1C1B749FEC00666A46 /* TPCircularBuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = TPCircularBuffer.c; sourceTree = "<group>"; };
469F4D1D1B749FEC00666A46 /* TPCircularBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPCircularBuffer.h; sourceTree = "<group>"; };
8A5A4B9C1BBBDCB200A8A048 /* EZAudioOSX.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = EZAudioOSX.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8A5A4BEF1BBBFF0A00A8A048 /* EZAudioiOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioiOS.h; sourceTree = "<group>"; };
8A5A4BF11BBBFF5600A8A048 /* EZAudioOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioOSX.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
469F4CEF1B749F7800666A46 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
8A5A4B981BBBDCB200A8A048 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
469F4CE91B749F7800666A46 = {
isa = PBXGroup;
children = (
469F4CF51B749F7800666A46 /* EZAudio */,
469F4CF41B749F7800666A46 /* Products */,
);
sourceTree = "<group>";
};
469F4CF41B749F7800666A46 /* Products */ = {
isa = PBXGroup;
children = (
469F4CF31B749F7800666A46 /* EZAudioiOS.framework */,
8A5A4B9C1BBBDCB200A8A048 /* EZAudioOSX.framework */,
);
name = Products;
sourceTree = "<group>";
};
469F4CF51B749F7800666A46 /* EZAudio */ = {
isa = PBXGroup;
children = (
469F4CFE1B749FEC00666A46 /* EZAudio.h */,
469F4CFF1B749FEC00666A46 /* EZAudio.m */,
469F4D001B749FEC00666A46 /* EZAudioDevice.h */,
469F4D011B749FEC00666A46 /* EZAudioDevice.m */,
469F4D021B749FEC00666A46 /* EZAudioDisplayLink.h */,
469F4D031B749FEC00666A46 /* EZAudioDisplayLink.m */,
469F4D041B749FEC00666A46 /* EZAudioFFT.h */,
469F4D051B749FEC00666A46 /* EZAudioFFT.m */,
469F4D061B749FEC00666A46 /* EZAudioFile.h */,
469F4D071B749FEC00666A46 /* EZAudioFile.m */,
469F4D081B749FEC00666A46 /* EZAudioFloatConverter.h */,
469F4D091B749FEC00666A46 /* EZAudioFloatConverter.m */,
469F4D0A1B749FEC00666A46 /* EZAudioFloatData.h */,
469F4D0B1B749FEC00666A46 /* EZAudioFloatData.m */,
469F4D0C1B749FEC00666A46 /* EZAudioPlayer.h */,
469F4D0D1B749FEC00666A46 /* EZAudioPlayer.m */,
469F4D0E1B749FEC00666A46 /* EZAudioPlot.h */,
469F4D0F1B749FEC00666A46 /* EZAudioPlot.m */,
469F4D101B749FEC00666A46 /* EZAudioPlotGL.h */,
469F4D111B749FEC00666A46 /* EZAudioPlotGL.m */,
469F4D121B749FEC00666A46 /* EZAudioUtilities.h */,
469F4D131B749FEC00666A46 /* EZAudioUtilities.m */,
469F4D141B749FEC00666A46 /* EZMicrophone.h */,
469F4D151B749FEC00666A46 /* EZMicrophone.m */,
469F4D161B749FEC00666A46 /* EZOutput.h */,
469F4D171B749FEC00666A46 /* EZOutput.m */,
469F4D181B749FEC00666A46 /* EZPlot.h */,
469F4D191B749FEC00666A46 /* EZPlot.m */,
469F4D1A1B749FEC00666A46 /* EZRecorder.h */,
469F4D1B1B749FEC00666A46 /* EZRecorder.m */,
469F4D1C1B749FEC00666A46 /* TPCircularBuffer.c */,
469F4D1D1B749FEC00666A46 /* TPCircularBuffer.h */,
8A5A4BEF1BBBFF0A00A8A048 /* EZAudioiOS.h */,
8A5A4BF11BBBFF5600A8A048 /* EZAudioOSX.h */,
469F4D3E1B749FF000666A46 /* Supporting Files */,
);
path = EZAudio;
sourceTree = "<group>";
};
469F4D3E1B749FF000666A46 /* Supporting Files */ = {
isa = PBXGroup;
children = (
469F4CF81B749F7800666A46 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
469F4CF01B749F7800666A46 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
8A5A4BF41BBC025600A8A048 /* EZAudioiOS.h in Headers */,
469F4D301B749FEC00666A46 /* EZAudioPlotGL.h in Headers */,
469F4D2A1B749FEC00666A46 /* EZAudioFloatData.h in Headers */,
469F4D221B749FEC00666A46 /* EZAudioDisplayLink.h in Headers */,
469F4D201B749FEC00666A46 /* EZAudioDevice.h in Headers */,
469F4D2E1B749FEC00666A46 /* EZAudioPlot.h in Headers */,
469F4D2C1B749FEC00666A46 /* EZAudioPlayer.h in Headers */,
469F4D381B749FEC00666A46 /* EZPlot.h in Headers */,
469F4D261B749FEC00666A46 /* EZAudioFile.h in Headers */,
469F4D341B749FEC00666A46 /* EZMicrophone.h in Headers */,
469F4D361B749FEC00666A46 /* EZOutput.h in Headers */,
469F4D1E1B749FEC00666A46 /* EZAudio.h in Headers */,
469F4D3D1B749FEC00666A46 /* TPCircularBuffer.h in Headers */,
469F4D3A1B749FEC00666A46 /* EZRecorder.h in Headers */,
469F4D321B749FEC00666A46 /* EZAudioUtilities.h in Headers */,
469F4D281B749FEC00666A46 /* EZAudioFloatConverter.h in Headers */,
469F4D241B749FEC00666A46 /* EZAudioFFT.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
8A5A4B991BBBDCB200A8A048 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
8A5A4BF31BBBFFA000A8A048 /* EZAudioOSX.h in Headers */,
8A5A4BB31BBBDD6D00A8A048 /* EZAudio.h in Headers */,
8A5A4BB41BBBDD6D00A8A048 /* EZAudioDevice.h in Headers */,
8A5A4BB51BBBDD6D00A8A048 /* EZAudioDisplayLink.h in Headers */,
8A5A4BB61BBBDD6D00A8A048 /* EZAudioFFT.h in Headers */,
8A5A4BB71BBBDD6D00A8A048 /* EZAudioFile.h in Headers */,
8A5A4BB81BBBDD6D00A8A048 /* EZAudioFloatConverter.h in Headers */,
8A5A4BB91BBBDD6D00A8A048 /* EZAudioFloatData.h in Headers */,
8A5A4BBA1BBBDD6D00A8A048 /* EZAudioPlayer.h in Headers */,
8A5A4BBB1BBBDD6D00A8A048 /* EZAudioPlot.h in Headers */,
8A5A4BBC1BBBDD6D00A8A048 /* EZAudioPlotGL.h in Headers */,
8A5A4BBD1BBBDD6D00A8A048 /* EZAudioUtilities.h in Headers */,
8A5A4BBE1BBBDD6D00A8A048 /* EZMicrophone.h in Headers */,
8A5A4BBF1BBBDD6D00A8A048 /* EZOutput.h in Headers */,
8A5A4BC01BBBDD6D00A8A048 /* EZPlot.h in Headers */,
8A5A4BC11BBBDD6D00A8A048 /* EZRecorder.h in Headers */,
8A5A4BC21BBBDD6E00A8A048 /* TPCircularBuffer.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
469F4CF21B749F7800666A46 /* EZAudioiOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 469F4CFB1B749F7800666A46 /* Build configuration list for PBXNativeTarget "EZAudioiOS" */;
buildPhases = (
469F4CEE1B749F7800666A46 /* Sources */,
469F4CEF1B749F7800666A46 /* Frameworks */,
469F4CF01B749F7800666A46 /* Headers */,
469F4CF11B749F7800666A46 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = EZAudioiOS;
productName = EZAudio;
productReference = 469F4CF31B749F7800666A46 /* EZAudioiOS.framework */;
productType = "com.apple.product-type.framework";
};
8A5A4B9B1BBBDCB200A8A048 /* EZAudioOSX */ = {
isa = PBXNativeTarget;
buildConfigurationList = 8A5A4BAD1BBBDCB200A8A048 /* Build configuration list for PBXNativeTarget "EZAudioOSX" */;
buildPhases = (
8A5A4B971BBBDCB200A8A048 /* Sources */,
8A5A4B981BBBDCB200A8A048 /* Frameworks */,
8A5A4B991BBBDCB200A8A048 /* Headers */,
8A5A4B9A1BBBDCB200A8A048 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = EZAudioOSX;
productName = EZAudioOSX;
productReference = 8A5A4B9C1BBBDCB200A8A048 /* EZAudioOSX.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
469F4CEA1B749F7800666A46 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = "Andrew Breckenridge";
TargetAttributes = {
469F4CF21B749F7800666A46 = {
CreatedOnToolsVersion = 7.0;
};
8A5A4B9B1BBBDCB200A8A048 = {
CreatedOnToolsVersion = 7.0;
};
};
};
buildConfigurationList = 469F4CED1B749F7800666A46 /* Build configuration list for PBXProject "EZAudio" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 469F4CE91B749F7800666A46;
productRefGroup = 469F4CF41B749F7800666A46 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
469F4CF21B749F7800666A46 /* EZAudioiOS */,
8A5A4B9B1BBBDCB200A8A048 /* EZAudioOSX */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
469F4CF11B749F7800666A46 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
8A5A4B9A1BBBDCB200A8A048 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
469F4CEE1B749F7800666A46 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
469F4D2F1B749FEC00666A46 /* EZAudioPlot.m in Sources */,
469F4D2D1B749FEC00666A46 /* EZAudioPlayer.m in Sources */,
469F4D251B749FEC00666A46 /* EZAudioFFT.m in Sources */,
469F4D391B749FEC00666A46 /* EZPlot.m in Sources */,
469F4D291B749FEC00666A46 /* EZAudioFloatConverter.m in Sources */,
469F4D1F1B749FEC00666A46 /* EZAudio.m in Sources */,
469F4D3C1B749FEC00666A46 /* TPCircularBuffer.c in Sources */,
469F4D3B1B749FEC00666A46 /* EZRecorder.m in Sources */,
469F4D311B749FEC00666A46 /* EZAudioPlotGL.m in Sources */,
469F4D331B749FEC00666A46 /* EZAudioUtilities.m in Sources */,
469F4D2B1B749FEC00666A46 /* EZAudioFloatData.m in Sources */,
469F4D351B749FEC00666A46 /* EZMicrophone.m in Sources */,
469F4D271B749FEC00666A46 /* EZAudioFile.m in Sources */,
469F4D231B749FEC00666A46 /* EZAudioDisplayLink.m in Sources */,
469F4D371B749FEC00666A46 /* EZOutput.m in Sources */,
469F4D211B749FEC00666A46 /* EZAudioDevice.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
8A5A4B971BBBDCB200A8A048 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8A5A4BD21BBBDE2800A8A048 /* TPCircularBuffer.c in Sources */,
8A5A4BC31BBBDD7E00A8A048 /* EZAudio.m in Sources */,
8A5A4BC41BBBDD7E00A8A048 /* EZAudioDevice.m in Sources */,
8A5A4BC51BBBDD7E00A8A048 /* EZAudioDisplayLink.m in Sources */,
8A5A4BC61BBBDD7E00A8A048 /* EZAudioFFT.m in Sources */,
8A5A4BC71BBBDD7E00A8A048 /* EZAudioFile.m in Sources */,
8A5A4BC81BBBDD7E00A8A048 /* EZAudioFloatConverter.m in Sources */,
8A5A4BC91BBBDD7E00A8A048 /* EZAudioFloatData.m in Sources */,
8A5A4BCA1BBBDD7E00A8A048 /* EZAudioPlayer.m in Sources */,
8A5A4BCB1BBBDD7E00A8A048 /* EZAudioPlot.m in Sources */,
8A5A4BCC1BBBDD7E00A8A048 /* EZAudioPlotGL.m in Sources */,
8A5A4BCD1BBBDD7E00A8A048 /* EZAudioUtilities.m in Sources */,
8A5A4BCE1BBBDD7E00A8A048 /* EZMicrophone.m in Sources */,
8A5A4BCF1BBBDD7E00A8A048 /* EZOutput.m in Sources */,
8A5A4BD01BBBDD7E00A8A048 /* EZPlot.m in Sources */,
8A5A4BD11BBBDD7E00A8A048 /* EZRecorder.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
469F4CF91B749F7800666A46 /* 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;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = 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_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;
};
469F4CFA1B749F7800666A46 /* 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;
};
469F4CFC1B749F7800666A46 /* 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";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = ezaudio.EZAudioiOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
469F4CFD1B749F7800666A46 /* 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";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = ezaudio.EZAudioiOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
8A5A4BAE1BBBDCB200A8A048 /* Debug */ = {
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 = "$(SRCROOT)/EZAudio/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.8;
PRODUCT_BUNDLE_IDENTIFIER = ezaudio.EZAudioOSX;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
};
name = Debug;
};
8A5A4BAF1BBBDCB200A8A048 /* 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 = "$(SRCROOT)/EZAudio/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.8;
PRODUCT_BUNDLE_IDENTIFIER = ezaudio.EZAudioOSX;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
469F4CED1B749F7800666A46 /* Build configuration list for PBXProject "EZAudio" */ = {
isa = XCConfigurationList;
buildConfigurations = (
469F4CF91B749F7800666A46 /* Debug */,
469F4CFA1B749F7800666A46 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
469F4CFB1B749F7800666A46 /* Build configuration list for PBXNativeTarget "EZAudioiOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
469F4CFC1B749F7800666A46 /* Debug */,
469F4CFD1B749F7800666A46 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8A5A4BAD1BBBDCB200A8A048 /* Build configuration list for PBXNativeTarget "EZAudioOSX" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8A5A4BAE1BBBDCB200A8A048 /* Debug */,
8A5A4BAF1BBBDCB200A8A048 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
/* End XCConfigurationList section */
};
rootObject = 469F4CEA1B749F7800666A46 /* Project object */;
}
@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:EZAudioRecordExample.xcodeproj">
location = "self:EZAudio.xcodeproj">
</FileRef>
</Workspace>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0510"
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -14,77 +14,80 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9417A9671871E88300D9D37B"
BuildableName = "EZAudioFFTExample.app"
BlueprintName = "EZAudioFFTExample"
ReferencedContainer = "container:EZAudioFFTExample.xcodeproj">
BlueprintIdentifier = "8A5A4B9B1BBBDCB200A8A048"
BuildableName = "EZAudioOSX.framework"
BlueprintName = "EZAudioOSX"
ReferencedContainer = "container:EZAudio.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9417A98B1871E88300D9D37B"
BuildableName = "EZAudioFFTExampleTests.xctest"
BlueprintName = "EZAudioFFTExampleTests"
ReferencedContainer = "container:EZAudioFFTExample.xcodeproj">
BlueprintIdentifier = "8A5A4BA41BBBDCB200A8A048"
BuildableName = "EZAudioOSXTests.xctest"
BlueprintName = "EZAudioOSXTests"
ReferencedContainer = "container:EZAudio.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9417A9671871E88300D9D37B"
BuildableName = "EZAudioFFTExample.app"
BlueprintName = "EZAudioFFTExample"
ReferencedContainer = "container:EZAudioFFTExample.xcodeproj">
BlueprintIdentifier = "8A5A4B9B1BBBDCB200A8A048"
BuildableName = "EZAudioOSX.framework"
BlueprintName = "EZAudioOSX"
ReferencedContainer = "container:EZAudio.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9417A9671871E88300D9D37B"
BuildableName = "EZAudioFFTExample.app"
BlueprintName = "EZAudioFFTExample"
ReferencedContainer = "container:EZAudioFFTExample.xcodeproj">
BlueprintIdentifier = "8A5A4B9B1BBBDCB200A8A048"
BuildableName = "EZAudioOSX.framework"
BlueprintName = "EZAudioOSX"
ReferencedContainer = "container:EZAudio.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9417A9671871E88300D9D37B"
BuildableName = "EZAudioFFTExample.app"
BlueprintName = "EZAudioFFTExample"
ReferencedContainer = "container:EZAudioFFTExample.xcodeproj">
BlueprintIdentifier = "8A5A4B9B1BBBDCB200A8A048"
BuildableName = "EZAudioOSX.framework"
BlueprintName = "EZAudioOSX"
ReferencedContainer = "container:EZAudio.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0510"
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -14,77 +14,61 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "940570C7185E7F8300EB94BA"
BuildableName = "EZAudioRecordExample.app"
BlueprintName = "EZAudioRecordExample"
ReferencedContainer = "container:EZAudioRecordExample.xcodeproj">
BlueprintIdentifier = "469F4CF21B749F7800666A46"
BuildableName = "EZAudioiOS.framework"
BlueprintName = "EZAudioiOS"
ReferencedContainer = "container:EZAudio.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "940570EB185E7F8300EB94BA"
BuildableName = "EZAudioRecordExampleTests.xctest"
BlueprintName = "EZAudioRecordExampleTests"
ReferencedContainer = "container:EZAudioRecordExample.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "940570C7185E7F8300EB94BA"
BuildableName = "EZAudioRecordExample.app"
BlueprintName = "EZAudioRecordExample"
ReferencedContainer = "container:EZAudioRecordExample.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "940570C7185E7F8300EB94BA"
BuildableName = "EZAudioRecordExample.app"
BlueprintName = "EZAudioRecordExample"
ReferencedContainer = "container:EZAudioRecordExample.xcodeproj">
BlueprintIdentifier = "469F4CF21B749F7800666A46"
BuildableName = "EZAudioiOS.framework"
BlueprintName = "EZAudioiOS"
ReferencedContainer = "container:EZAudio.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "940570C7185E7F8300EB94BA"
BuildableName = "EZAudioRecordExample.app"
BlueprintName = "EZAudioRecordExample"
ReferencedContainer = "container:EZAudioRecordExample.xcodeproj">
BlueprintIdentifier = "469F4CF21B749F7800666A46"
BuildableName = "EZAudioiOS.framework"
BlueprintName = "EZAudioiOS"
ReferencedContainer = "container:EZAudio.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
+349 -112
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,34 +25,82 @@
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
//! Project version number for teat.
FOUNDATION_EXPORT double EZAudioVersionNumber;
#pragma mark - 3rd Party Utilties
#import "TPCircularBuffer.h"
//! Project version string for teat.
FOUNDATION_EXPORT const unsigned char EZAudioVersionString[];
//#pragma mark - Core Components
//#import "EZAudioFile.h"
//#import "EZMicrophone.h"
//#import "EZOutput.h"
//#import "EZRecorder.h"
//
//#pragma mark - Extended Components
//#import "EZAudioPlayer.h"
//
//#pragma mark - Interface Components
//#import "EZPlot.h"
//#import "EZAudioPlot.h"
//#import "EZAudioPlotGL.h"
//#import "EZAudioPlotGLKViewController.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 "EZAudioFFT.h"
#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
///-----------------------------------------------------------
@@ -62,98 +110,195 @@
@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;
+ (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;
+ (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 The desired sample rate
@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;
+ (AudioStreamBasicDescription)AIFFFormatWithNumberOfChannels:(UInt32)channels
sampleRate:(float)sampleRate __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
@param sampleRate The desired sample rate
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;
+ (AudioStreamBasicDescription)iLBCFormatWithSampleRate:(float)sampleRate __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Checks an AudioStreamBasicDescription for an interleaved flag, meaning samples are
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)sampleRate __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;
+ (BOOL)isInterleaved:(AudioStreamBasicDescription)asbd __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Checks an AudioStreamBasicDescription to see if it is linear PCM, which is an
uncompressed, non-variable bit rate type format
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
@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;
/**
@param channels The desired number of channels
@param sampleRate The desired sample rate
@return A new AudioStreamBasicDescription with the specified format.
*/
+(AudioStreamBasicDescription)M4AFormatWithNumberOfChannels:(UInt32)channels
sampleRate:(float)sampleRate;
/**
@param sampleRate The desired sample rate
@return A new AudioStreamBasicDescription with the specified format.
*/
+(AudioStreamBasicDescription)monoFloatFormatWithSampleRate:(float)sampleRate;
/**
@param sampleRate The desired sample rate
@return A new AudioStreamBasicDescription with the specified format.
*/
+(AudioStreamBasicDescription)monoCanonicalFormatWithSampleRate:(float)sampleRate;
/**
@param sampleRate The desired sample rate
@return A new AudioStreamBasicDescription with the specified format.
*/
+(AudioStreamBasicDescription)stereoCanonicalNonInterleavedFormatWithSampleRate:(float)sampleRate;
/**
@param sampleRate The desired sample rate
@return A new AudioStreamBasicDescription with the specified format.
*/
+(AudioStreamBasicDescription)stereoFloatInterleavedFormatWithSampleRate:(float)sampleRate;
/**
@param sampleRate The desired sample rate
@return A new AudioStreamBasicDescription with the specified format.
*/
+(AudioStreamBasicDescription)stereoFloatNonInterleavedFormatWithSampleRate:(float)sameRate;
+ (BOOL)isLinearPCM:(AudioStreamBasicDescription)asbd __attribute__((deprecated));
///-----------------------------------------------------------
/// @name AudioStreamBasicDescription Utilities
@@ -161,21 +306,52 @@
/**
Nicely logs out the contents of an AudioStreamBasicDescription struct
@param asbd The AudioStreamBasicDescription struct with content to print out
@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;
+ (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;
+ (void)setCanonicalAudioStreamBasicDescription:(AudioStreamBasicDescription*)asbd
numberOfChannels:(UInt32)nChannels
interleaved:(BOOL)interleaved __attribute__((deprecated));
//------------------------------------------------------------------------------
#pragma mark - Math Utilities
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Math Utilities
///-----------------------------------------------------------
@@ -186,21 +362,29 @@
@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;
+ (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;
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.
@@ -209,22 +393,29 @@
@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;
+ (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;
+ (float)RMS:(float*)buffer length:(int)bufferSize __attribute__((deprecated));
//------------------------------------------------------------------------------
/**
Calculate the sign function sgn(x) =
@@ -232,11 +423,16 @@
{ 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;
+ (float)SGN:(float)value __attribute__((deprecated));
//------------------------------------------------------------------------------
#pragma mark - OSStatus Utility
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name OSStatus Utility
///-----------------------------------------------------------
@@ -245,23 +441,52 @@
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;
+ (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
///-----------------------------------------------------------
+(void)updateScrollHistory:(float**)scrollHistory
withLength:(int)scrollHistoryLength
atIndex:(int*)index
withBuffer:(float*)buffer
withBufferSize:(int)bufferSize
isResolutionChanging:(BOOL*)isChanging;
/**
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
///-----------------------------------------------------------
@@ -270,22 +495,34 @@
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;
+ (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)
@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;
+ (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;
+ (void)freeCircularBuffer:(TPCircularBuffer*)circularBuffer __attribute__((deprecated));
//------------------------------------------------------------------------------
@end
+244 -306
View File
@@ -1,369 +1,307 @@
//
// EZAudio.m
// EZAudio
// EZAudioCoreGraphicsWaveformExample
//
// Created by Syed Haris Ali on 11/21/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
// Created by Syed Haris Ali on 5/13/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 "EZAudio.h"
@implementation EZAudio
//------------------------------------------------------------------------------
#pragma mark - Debugging
//------------------------------------------------------------------------------
+ (void)setShouldExitOnCheckResultFail:(BOOL)shouldExitOnCheckResultFail
{
[EZAudioUtilities setShouldExitOnCheckResultFail:shouldExitOnCheckResultFail];
}
//------------------------------------------------------------------------------
+ (BOOL)shouldExitOnCheckResultFail
{
return [EZAudioUtilities shouldExitOnCheckResultFail];
}
//------------------------------------------------------------------------------
#pragma mark - AudioBufferList Utility
+(AudioBufferList *)audioBufferListWithNumberOfFrames:(UInt32)frames
numberOfChannels:(UInt32)channels
interleaved:(BOOL)interleaved
//------------------------------------------------------------------------------
+ (AudioBufferList *)audioBufferListWithNumberOfFrames:(UInt32)frames
numberOfChannels:(UInt32)channels
interleaved:(BOOL)interleaved
{
AudioBufferList *audioBufferList = (AudioBufferList*)malloc(sizeof(AudioBufferList) + sizeof(AudioBuffer)*(channels-1));
UInt32 outputBufferSize = 32 * frames; // 32 KB
audioBufferList->mNumberBuffers = interleaved ? 1 : channels;
for( int i = 0; i < audioBufferList->mNumberBuffers; i++ )
{
audioBufferList->mBuffers[i].mNumberChannels = channels;
audioBufferList->mBuffers[i].mDataByteSize = channels * outputBufferSize;
audioBufferList->mBuffers[i].mData = (float*)malloc(channels * sizeof(float) * outputBufferSize);
}
return audioBufferList;
return [EZAudioUtilities audioBufferListWithNumberOfFrames:frames
numberOfChannels:channels
interleaved:interleaved];
}
+(void)freeBufferList:(AudioBufferList *)bufferList
//------------------------------------------------------------------------------
+ (float **)floatBuffersWithNumberOfFrames:(UInt32)frames
numberOfChannels:(UInt32)channels
{
if( bufferList )
{
if( bufferList->mNumberBuffers )
{
for( int i = 0; i < bufferList->mNumberBuffers; i++ )
{
if( bufferList->mBuffers[i].mData )
{
free(bufferList->mBuffers[i].mData);
}
}
}
free(bufferList);
}
bufferList = NULL;
return [EZAudioUtilities floatBuffersWithNumberOfFrames:frames
numberOfChannels:channels];
}
//------------------------------------------------------------------------------
+ (void)freeBufferList:(AudioBufferList *)bufferList
{
[EZAudioUtilities freeBufferList:bufferList];
}
//------------------------------------------------------------------------------
+ (void)freeFloatBuffers:(float **)buffers numberOfChannels:(UInt32)channels
{
[EZAudioUtilities freeFloatBuffers:buffers numberOfChannels:channels];
}
//------------------------------------------------------------------------------
#pragma mark - AudioStreamBasicDescription Utility
+(AudioStreamBasicDescription)AIFFFormatWithNumberOfChannels:(UInt32)channels
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)AIFFFormatWithNumberOfChannels:(UInt32)channels
sampleRate:(float)sampleRate
{
return [EZAudioUtilities AIFFFormatWithNumberOfChannels:channels
sampleRate:sampleRate];
}
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)iLBCFormatWithSampleRate:(float)sampleRate
{
return [EZAudioUtilities iLBCFormatWithSampleRate:sampleRate];
}
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)floatFormatWithNumberOfChannels:(UInt32)channels
sampleRate:(float)sampleRate
{
return [EZAudioUtilities floatFormatWithNumberOfChannels:channels
sampleRate:sampleRate];
}
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)M4AFormatWithNumberOfChannels:(UInt32)channels
sampleRate:(float)sampleRate
{
AudioStreamBasicDescription asbd;
memset(&asbd, 0, sizeof(asbd));
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mFormatFlags = kAudioFormatFlagIsBigEndian|kAudioFormatFlagIsPacked|kAudioFormatFlagIsSignedInteger;
asbd.mSampleRate = sampleRate;
asbd.mChannelsPerFrame = channels;
asbd.mBitsPerChannel = 32;
asbd.mBytesPerPacket = (asbd.mBitsPerChannel / 8) * asbd.mChannelsPerFrame;
asbd.mFramesPerPacket = 1;
asbd.mBytesPerFrame = (asbd.mBitsPerChannel / 8) * asbd.mChannelsPerFrame;
return asbd;
return [EZAudioUtilities M4AFormatWithNumberOfChannels:channels
sampleRate:sampleRate];
}
+(AudioStreamBasicDescription)iLBCFormatWithSampleRate:(float)sampleRate
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)monoFloatFormatWithSampleRate:(float)sampleRate
{
AudioStreamBasicDescription asbd;
memset(&asbd, 0, sizeof(asbd));
asbd.mFormatID = kAudioFormatiLBC;
asbd.mChannelsPerFrame = 1;
asbd.mSampleRate = sampleRate;
// Fill in the rest of the descriptions using the Audio Format API
UInt32 propSize = sizeof(asbd);
[EZAudio checkResult:AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
0,
NULL,
&propSize,
&asbd)
operation:"Failed to fill out the rest of the m4a AudioStreamBasicDescription"];
return asbd;
return [EZAudioUtilities monoFloatFormatWithSampleRate:sampleRate];
}
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)monoCanonicalFormatWithSampleRate:(float)sampleRate
{
return [EZAudioUtilities monoCanonicalFormatWithSampleRate:sampleRate];
}
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)stereoCanonicalNonInterleavedFormatWithSampleRate:(float)sampleRate
{
return [EZAudioUtilities stereoCanonicalNonInterleavedFormatWithSampleRate:sampleRate];
}
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)stereoFloatInterleavedFormatWithSampleRate:(float)sampleRate
{
return [EZAudioUtilities stereoFloatInterleavedFormatWithSampleRate:sampleRate];
}
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)stereoFloatNonInterleavedFormatWithSampleRate:(float)sampleRate
{
return [EZAudioUtilities stereoFloatNonInterleavedFormatWithSampleRate:sampleRate];
}
//------------------------------------------------------------------------------
+ (BOOL)isFloatFormat:(AudioStreamBasicDescription)asbd
{
return [EZAudioUtilities isFloatFormat:asbd];
}
//------------------------------------------------------------------------------
+ (BOOL)isInterleaved:(AudioStreamBasicDescription)asbd
{
return !(asbd.mFormatFlags & kAudioFormatFlagIsNonInterleaved);
return [EZAudioUtilities isInterleaved:asbd];
}
//------------------------------------------------------------------------------
+ (BOOL)isLinearPCM:(AudioStreamBasicDescription)asbd
{
return asbd.mFormatID == kAudioFormatLinearPCM;
return [EZAudioUtilities isLinearPCM:asbd];
}
+(AudioStreamBasicDescription)M4AFormatWithNumberOfChannels:(UInt32)channels
sampleRate:(float)sampleRate
//------------------------------------------------------------------------------
+ (void)printASBD:(AudioStreamBasicDescription)asbd
{
AudioStreamBasicDescription asbd;
memset(&asbd, 0, sizeof(asbd));
asbd.mFormatID = kAudioFormatMPEG4AAC;
asbd.mChannelsPerFrame = channels;
asbd.mSampleRate = sampleRate;
// Fill in the rest of the descriptions using the Audio Format API
UInt32 propSize = sizeof(asbd);
[EZAudio checkResult:AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
0,
NULL,
&propSize,
&asbd)
operation:"Failed to fill out the rest of the m4a AudioStreamBasicDescription"];
return asbd;
[EZAudioUtilities printASBD:asbd];
}
+(AudioStreamBasicDescription)monoFloatFormatWithSampleRate:(float)sampleRate
//------------------------------------------------------------------------------
+ (NSString *)displayTimeStringFromSeconds:(NSTimeInterval)seconds
{
AudioStreamBasicDescription asbd;
UInt32 byteSize = sizeof(float);
asbd.mBitsPerChannel = 8 * byteSize;
asbd.mBytesPerFrame = byteSize;
asbd.mBytesPerPacket = byteSize;
asbd.mChannelsPerFrame = 1;
asbd.mFormatFlags = kAudioFormatFlagIsPacked|kAudioFormatFlagIsFloat;
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mFramesPerPacket = 1;
asbd.mSampleRate = sampleRate;
return asbd;
return [EZAudioUtilities displayTimeStringFromSeconds:seconds];
}
+(AudioStreamBasicDescription)monoCanonicalFormatWithSampleRate:(float)sampleRate
//------------------------------------------------------------------------------
+ (NSString *)stringForAudioStreamBasicDescription:(AudioStreamBasicDescription)asbd
{
AudioStreamBasicDescription asbd;
UInt32 byteSize = sizeof(float);
asbd.mBitsPerChannel = 8 * byteSize;
asbd.mBytesPerFrame = byteSize;
asbd.mBytesPerPacket = byteSize;
asbd.mChannelsPerFrame = 1;
asbd.mFormatFlags = kAudioFormatFlagsNativeFloatPacked|kAudioFormatFlagIsNonInterleaved;
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mFramesPerPacket = 1;
asbd.mSampleRate = sampleRate;
return asbd;
return [EZAudioUtilities stringForAudioStreamBasicDescription:asbd];
}
+(AudioStreamBasicDescription)stereoCanonicalNonInterleavedFormatWithSampleRate:(float)sampleRate
//------------------------------------------------------------------------------
+ (void)setCanonicalAudioStreamBasicDescription:(AudioStreamBasicDescription*)asbd
numberOfChannels:(UInt32)nChannels
interleaved:(BOOL)interleaved
{
AudioStreamBasicDescription asbd;
UInt32 byteSize = sizeof(float);
asbd.mBitsPerChannel = 8 * byteSize;
asbd.mBytesPerFrame = byteSize;
asbd.mBytesPerPacket = byteSize;
asbd.mChannelsPerFrame = 2;
asbd.mFormatFlags = kAudioFormatFlagsNativeFloatPacked|kAudioFormatFlagIsNonInterleaved;
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mFramesPerPacket = 1;
asbd.mSampleRate = sampleRate;
return asbd;
[EZAudioUtilities setCanonicalAudioStreamBasicDescription:asbd
numberOfChannels:nChannels
interleaved:interleaved];
}
+(AudioStreamBasicDescription)stereoFloatInterleavedFormatWithSampleRate:(float)sampleRate
//------------------------------------------------------------------------------
#pragma mark - Math Utilities
//------------------------------------------------------------------------------
+ (void)appendBufferAndShift:(float*)buffer
withBufferSize:(int)bufferLength
toScrollHistory:(float*)scrollHistory
withScrollHistorySize:(int)scrollHistoryLength
{
AudioStreamBasicDescription asbd;
UInt32 floatByteSize = sizeof(float);
asbd.mChannelsPerFrame = 2;
asbd.mBitsPerChannel = 8 * floatByteSize;
asbd.mBytesPerFrame = asbd.mChannelsPerFrame * floatByteSize;
asbd.mBytesPerPacket = asbd.mChannelsPerFrame * floatByteSize;
asbd.mFormatFlags = kAudioFormatFlagIsPacked|kAudioFormatFlagIsFloat;
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mFramesPerPacket = 1;
asbd.mSampleRate = sampleRate;
return asbd;
[EZAudioUtilities appendBufferAndShift:buffer
withBufferSize:bufferLength
toScrollHistory:scrollHistory
withScrollHistorySize:scrollHistoryLength];
}
+(AudioStreamBasicDescription)stereoFloatNonInterleavedFormatWithSampleRate:(float)sampleRate
{
AudioStreamBasicDescription asbd;
UInt32 floatByteSize = sizeof(float);
asbd.mBitsPerChannel = 8 * floatByteSize;
asbd.mBytesPerFrame = floatByteSize;
asbd.mBytesPerPacket = floatByteSize;
asbd.mChannelsPerFrame = 2;
asbd.mFormatFlags = kAudioFormatFlagIsFloat|kAudioFormatFlagIsNonInterleaved;
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mFramesPerPacket = 1;
asbd.mSampleRate = sampleRate;
return asbd;
}
//------------------------------------------------------------------------------
+(void)printASBD:(AudioStreamBasicDescription)asbd {
char formatIDString[5];
UInt32 formatID = CFSwapInt32HostToBig(asbd.mFormatID);
bcopy (&formatID, formatIDString, 4);
formatIDString[4] = '\0';
NSLog (@" Sample Rate: %10.0f", asbd.mSampleRate);
NSLog (@" Format ID: %10s", formatIDString);
NSLog (@" Format Flags: %10X", (unsigned int)asbd.mFormatFlags);
NSLog (@" Bytes per Packet: %10d", (unsigned int)asbd.mBytesPerPacket);
NSLog (@" Frames per Packet: %10d", (unsigned int)asbd.mFramesPerPacket);
NSLog (@" Bytes per Frame: %10d", (unsigned int)asbd.mBytesPerFrame);
NSLog (@" Channels per Frame: %10d", (unsigned int)asbd.mChannelsPerFrame);
NSLog (@" Bits per Channel: %10d", (unsigned int)asbd.mBitsPerChannel);
}
+(void)setCanonicalAudioStreamBasicDescription:(AudioStreamBasicDescription*)asbd
numberOfChannels:(UInt32)nChannels
interleaved:(BOOL)interleaved {
asbd->mFormatID = kAudioFormatLinearPCM;
#if TARGET_OS_IPHONE
int sampleSize = sizeof(float);
asbd->mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
#elif TARGET_OS_MAC
int sampleSize = sizeof(Float32);
asbd->mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
#endif
asbd->mBitsPerChannel = 8 * sampleSize;
asbd->mChannelsPerFrame = nChannels;
asbd->mFramesPerPacket = 1;
if (interleaved)
asbd->mBytesPerPacket = asbd->mBytesPerFrame = nChannels * sampleSize;
else {
asbd->mBytesPerPacket = asbd->mBytesPerFrame = sampleSize;
asbd->mFormatFlags |= kAudioFormatFlagIsNonInterleaved;
}
}
#pragma mark - OSStatus Utility
+(void)checkResult:(OSStatus)result
operation:(const char *)operation {
if (result == noErr) return;
char errorString[20];
// see if it appears to be a 4-char-code
*(UInt32 *)(errorString + 1) = CFSwapInt32HostToBig(result);
if (isprint(errorString[1]) && isprint(errorString[2]) && isprint(errorString[3]) && isprint(errorString[4])) {
errorString[0] = errorString[5] = '\'';
errorString[6] = '\0';
} else
// no, format it as an integer
sprintf(errorString, "%d", (int)result);
fprintf(stderr, "Error: %s (%s)\n", operation, errorString);
exit(1);
}
#pragma mark - Math Utility
+(void)appendBufferAndShift:(float*)buffer
withBufferSize:(int)bufferLength
toScrollHistory:(float*)scrollHistory
withScrollHistorySize:(int)scrollHistoryLength {
NSAssert(scrollHistoryLength>=bufferLength,@"Scroll history array length must be greater buffer length");
NSAssert(scrollHistoryLength>0,@"Scroll history array length must be greater than 0");
NSAssert(bufferLength>0,@"Buffer array length must be greater than 0");
int shiftLength = scrollHistoryLength - bufferLength;
size_t floatByteSize = sizeof(float);
size_t shiftByteSize = shiftLength * floatByteSize;
size_t bufferByteSize = bufferLength * floatByteSize;
memmove(&scrollHistory[0],
&scrollHistory[bufferLength],
shiftByteSize);
memmove(&scrollHistory[shiftLength],
&buffer[0],
bufferByteSize);
}
+(void) appendValue:(float)value
+ (void) appendValue:(float)value
toScrollHistory:(float*)scrollHistory
withScrollHistorySize:(int)scrollHistoryLength {
float val[1]; val[0] = value;
[self appendBufferAndShift:val
withBufferSize:1
toScrollHistory:scrollHistory
withScrollHistorySize:scrollHistoryLength];
}
+(float)MAP:(float)value
leftMin:(float)leftMin
leftMax:(float)leftMax
rightMin:(float)rightMin
rightMax:(float)rightMax {
float leftSpan = leftMax - leftMin;
float rightSpan = rightMax - rightMin;
float valueScaled = ( value - leftMin ) / leftSpan;
return rightMin + (valueScaled * rightSpan);
}
+(float)RMS:(float *)buffer
length:(int)bufferSize {
float sum = 0.0;
for(int i = 0; i < bufferSize; i++)
sum += buffer[i] * buffer[i];
return sqrtf( sum / bufferSize );
}
+(float)SGN:(float)value
withScrollHistorySize:(int)scrollHistoryLength
{
return value < 0 ? -1.0f : ( value > 0 ? 1.0f : 0.0f );
[EZAudioUtilities appendValue:value
toScrollHistory:scrollHistory
withScrollHistorySize:scrollHistoryLength];
}
//------------------------------------------------------------------------------
+ (float)MAP:(float)value
leftMin:(float)leftMin
leftMax:(float)leftMax
rightMin:(float)rightMin
rightMax:(float)rightMax
{
return [EZAudioUtilities MAP:value
leftMin:leftMin
leftMax:leftMax
rightMin:rightMin
rightMax:rightMax];
}
//------------------------------------------------------------------------------
+ (float)RMS:(float *)buffer length:(int)bufferSize
{
return [EZAudioUtilities RMS:buffer length:bufferSize];
}
//------------------------------------------------------------------------------
+ (float)SGN:(float)value
{
return [EZAudioUtilities SGN:value];
}
//------------------------------------------------------------------------------
#pragma mark - OSStatus Utility
//------------------------------------------------------------------------------
+ (void)checkResult:(OSStatus)result operation:(const char *)operation
{
[EZAudioUtilities checkResult:result
operation:operation];
}
//------------------------------------------------------------------------------
+ (NSString *)stringFromUInt32Code:(UInt32)code
{
return [EZAudioUtilities stringFromUInt32Code:code];
}
//------------------------------------------------------------------------------
#pragma mark - Plot Utility
+(void)updateScrollHistory:(float **)scrollHistory
withLength:(int)scrollHistoryLength
atIndex:(int*)index
withBuffer:(float *)buffer
withBufferSize:(int)bufferSize
isResolutionChanging:(BOOL*)isChanging {
//
size_t floatByteSize = sizeof(float);
//
if( *scrollHistory == NULL ){
// Create the history buffer
*scrollHistory = (float*)calloc(1024,floatByteSize);
}
//
if( !*isChanging ){
float rms = [EZAudio RMS:buffer length:bufferSize];
if( *index < scrollHistoryLength ){
float *hist = *scrollHistory;
hist[*index] = rms;
(*index)++;
}
else {
[EZAudio appendValue:rms
toScrollHistory:*scrollHistory
withScrollHistorySize:scrollHistoryLength];
}
}
//------------------------------------------------------------------------------
+ (void)updateScrollHistory:(float **)scrollHistory
withLength:(int)scrollHistoryLength
atIndex:(int *)index
withBuffer:(float *)buffer
withBufferSize:(int)bufferSize
isResolutionChanging:(BOOL *)isChanging
{
[EZAudioUtilities updateScrollHistory:scrollHistory
withLength:scrollHistoryLength
atIndex:index
withBuffer:buffer
withBufferSize:bufferSize
isResolutionChanging:isChanging];
}
//------------------------------------------------------------------------------
#pragma mark - TPCircularBuffer Utility
+(void)circularBuffer:(TPCircularBuffer *)circularBuffer withSize:(int)size {
TPCircularBufferInit(circularBuffer,size);
//------------------------------------------------------------------------------
+ (void)appendDataToCircularBuffer:(TPCircularBuffer *)circularBuffer
fromAudioBufferList:(AudioBufferList *)audioBufferList
{
[EZAudioUtilities appendDataToCircularBuffer:circularBuffer
fromAudioBufferList:audioBufferList];
}
+(void)appendDataToCircularBuffer:(TPCircularBuffer*)circularBuffer
fromAudioBufferList:(AudioBufferList*)audioBufferList {
TPCircularBufferProduceBytes(circularBuffer,
audioBufferList->mBuffers[0].mData,
audioBufferList->mBuffers[0].mDataByteSize);
//------------------------------------------------------------------------------
+ (void)circularBuffer:(TPCircularBuffer *)circularBuffer withSize:(int)size
{
[EZAudioUtilities circularBuffer:circularBuffer withSize:size];
}
+(void)freeCircularBuffer:(TPCircularBuffer *)circularBuffer {
TPCircularBufferClear(circularBuffer);
TPCircularBufferCleanup(circularBuffer);
//------------------------------------------------------------------------------
+ (void)freeCircularBuffer:(TPCircularBuffer *)circularBuffer
{
[EZAudioUtilities freeCircularBuffer:circularBuffer];
}
//------------------------------------------------------------------------------
@end
-20
View File
@@ -1,20 +0,0 @@
//
// EZAudioConverter.h
// EZAudioPlayFileExample
//
// Created by Syed Haris Ali on 2/14/15.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
@interface EZAudioConverter : NSObject
@property (nonatomic, assign, readonly) AudioStreamBasicDescription inputFormat;
@property (nonatomic, assign, readonly) AudioStreamBasicDescription outputFormat;
+ (instancetype) converterWithInputFormat:(AudioStreamBasicDescription)inputFormat
outputFormat:(AudioStreamBasicDescription)outputFormat;
@end
-38
View File
@@ -1,38 +0,0 @@
//
// EZAudioConverter.m
// EZAudioPlayFileExample
//
// Created by Syed Haris Ali on 2/14/15.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
#import "EZAudioConverter.h"
typedef struct
{
AudioConverterRef converterRef;
AudioStreamBasicDescription inputFormat;
AudioStreamBasicDescription outputFormat;
} EZAudioConverterInfo;
@interface EZAudioConverter ()
@property (nonatomic, assign) EZAudioConverterInfo info;
@end
@implementation EZAudioConverter
+ (instancetype)converterWithInputFormat:(AudioStreamBasicDescription)inputFormat
outputFormat:(AudioStreamBasicDescription)outputFormat
{
id converter = [[self alloc] init];
EZAudioConverterInfo info;
memset(&info, 0, sizeof(info));
info.inputFormat = inputFormat;
info.outputFormat = outputFormat;
((EZAudioConverter *)converter).info = info;
return converter;
}
@end
+187
View File
@@ -0,0 +1,187 @@
//
// EZAudioDevice.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 <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
//------------------------------------------------------------------------------
/**
Provides the current EZAudioDevice that is being used to pull input.
@return An EZAudioDevice instance representing the currently selected input device.
*/
+ (EZAudioDevice *)currentInputDevice;
//------------------------------------------------------------------------------
/**
Provides the current EZAudioDevice that is being used to output audio.
@return An EZAudioDevice instance representing the currently selected ouotput device.
*/
+ (EZAudioDevice *)currentOutputDevice;
//------------------------------------------------------------------------------
/**
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
//------------------------------------------------------------------------------
/**
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
+475
View File
@@ -0,0 +1,475 @@
//
// EZAudioDevice.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 "EZAudioDevice.h"
#import "EZAudioUtilities.h"
@interface EZAudioDevice ()
@property (nonatomic, copy, readwrite) NSString *name;
#if TARGET_OS_IPHONE
@property (nonatomic, strong, readwrite) AVAudioSessionPortDescription *port;
@property (nonatomic, strong, readwrite) AVAudioSessionDataSourceDescription *dataSource;
#elif TARGET_OS_MAC
@property (nonatomic, assign, readwrite) AudioDeviceID deviceID;
@property (nonatomic, copy, readwrite) NSString *manufacturer;
@property (nonatomic, assign, readwrite) NSInteger inputChannelCount;
@property (nonatomic, assign, readwrite) NSInteger outputChannelCount;
@property (nonatomic, copy, readwrite) NSString *UID;
#endif
@end
@implementation EZAudioDevice
#if TARGET_OS_IPHONE
//------------------------------------------------------------------------------
+ (EZAudioDevice *)currentInputDevice
{
AVAudioSession *session = [AVAudioSession sharedInstance];
AVAudioSessionPortDescription *port = [[[session currentRoute] inputs] firstObject];
AVAudioSessionDataSourceDescription *dataSource = [session inputDataSource];
EZAudioDevice *device = [[EZAudioDevice alloc] init];
device.port = port;
device.dataSource = dataSource;
return device;
}
//------------------------------------------------------------------------------
+ (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];
[self enumerateInputDevicesUsingBlock:^(EZAudioDevice *device, BOOL *stop)
{
[devices addObject:device];
}];
return devices;
}
//------------------------------------------------------------------------------
+ (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)
{
return;
}
NSArray *inputs = [[AVAudioSession sharedInstance] availableInputs];
if (inputs == nil)
{
NSLog(@"Audio session is not active! In order to enumerate the audio devices you must set the category and set active the audio session for your iOS app before calling this function.");
return;
}
BOOL stop;
for (AVAudioSessionPortDescription *inputDevicePortDescription in inputs)
{
// add any additional sub-devices
NSArray *dataSources = [inputDevicePortDescription dataSources];
if (dataSources.count)
{
for (AVAudioSessionDataSourceDescription *inputDeviceDataSourceDescription in dataSources)
{
EZAudioDevice *device = [[EZAudioDevice alloc] init];
device.port = inputDevicePortDescription;
device.dataSource = inputDeviceDataSourceDescription;
block(device, &stop);
}
}
else
{
EZAudioDevice *device = [[EZAudioDevice alloc] init];
device.port = inputDevicePortDescription;
block(device, &stop);
}
}
}
//------------------------------------------------------------------------------
+ (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];
if (self.port)
{
[name appendString:self.port.portName];
}
if (self.dataSource)
{
[name appendFormat:@": %@", self.dataSource.dataSourceName];
}
return name;
}
//------------------------------------------------------------------------------
- (NSString *)description
{
return [NSString stringWithFormat:@"%@ { port: %@, data source: %@ }",
[super description],
self.port,
self.dataSource];
}
//------------------------------------------------------------------------------
- (BOOL)isEqual:(id)object
{
if ([object isKindOfClass:self.class])
{
EZAudioDevice *device = (EZAudioDevice *)object;
BOOL isPortUIDEqual = [device.port.UID isEqualToString:self.port.UID];
BOOL isDataSourceIDEqual = device.dataSource.dataSourceID.longValue == self.dataSource.dataSourceID.longValue;
return isPortUIDEqual && isDataSourceIDEqual;
}
else
{
return [super isEqual:object];
}
}
#elif TARGET_OS_MAC
+ (void)enumerateDevicesUsingBlock:(void(^)(EZAudioDevice *device,
BOOL *stop))block
{
if (!block)
{
return;
}
// get the present system devices
AudioObjectPropertyAddress address = [self addressForPropertySelector:kAudioHardwarePropertyDevices];
UInt32 devicesDataSize;
[EZAudioUtilities checkResult:AudioObjectGetPropertyDataSize(kAudioObjectSystemObject,
&address,
0,
NULL,
&devicesDataSize)
operation:"Failed to get data size"];
// enumerate devices
NSInteger count = devicesDataSize / sizeof(AudioDeviceID);
AudioDeviceID *deviceIDs = (AudioDeviceID *)malloc(devicesDataSize);
// fill in the devices
[EZAudioUtilities checkResult:AudioObjectGetPropertyData(kAudioObjectSystemObject,
&address,
0,
NULL,
&devicesDataSize,
deviceIDs)
operation:"Failed to get device IDs for available devices on OSX"];
BOOL stop = NO;
for (UInt32 i = 0; i < count; i++)
{
AudioDeviceID deviceID = deviceIDs[i];
EZAudioDevice *device = [[EZAudioDevice alloc] init];
device.deviceID = deviceID;
device.manufacturer = [self manufacturerForDeviceID:deviceID];
device.name = [self namePropertyForDeviceID:deviceID];
device.UID = [self UIDPropertyForDeviceID:deviceID];
device.inputChannelCount = [self channelCountForScope:kAudioObjectPropertyScopeInput forDeviceID:deviceID];
device.outputChannelCount = [self channelCountForScope:kAudioObjectPropertyScopeOutput forDeviceID:deviceID];
block(device, &stop);
if (stop)
{
break;
}
}
free(deviceIDs);
}
//------------------------------------------------------------------------------
+ (NSArray *)devices
{
__block NSMutableArray *devices = [NSMutableArray array];
[self enumerateDevicesUsingBlock:^(EZAudioDevice *device, BOOL *stop)
{
[devices addObject:device];
}];
return devices;
}
//------------------------------------------------------------------------------
+ (EZAudioDevice *)deviceWithPropertySelector:(AudioObjectPropertySelector)propertySelector
{
AudioDeviceID deviceID;
UInt32 propSize = sizeof(AudioDeviceID);
AudioObjectPropertyAddress address = [self addressForPropertySelector:propertySelector];
[EZAudioUtilities checkResult:AudioObjectGetPropertyData(kAudioObjectSystemObject,
&address,
0,
NULL,
&propSize,
&deviceID)
operation:"Failed to get device device on OSX"];
EZAudioDevice *device = [[EZAudioDevice alloc] init];
device.deviceID = deviceID;
device.manufacturer = [self manufacturerForDeviceID:deviceID];
device.name = [self namePropertyForDeviceID:deviceID];
device.UID = [self UIDPropertyForDeviceID:deviceID];
device.inputChannelCount = [self channelCountForScope:kAudioObjectPropertyScopeInput forDeviceID:deviceID];
device.outputChannelCount = [self channelCountForScope:kAudioObjectPropertyScopeOutput forDeviceID:deviceID];
return device;
}
//------------------------------------------------------------------------------
+ (EZAudioDevice *)currentInputDevice
{
return [self deviceWithPropertySelector:kAudioHardwarePropertyDefaultInputDevice];
}
//------------------------------------------------------------------------------
+ (EZAudioDevice *)currentOutputDevice
{
return [self deviceWithPropertySelector:kAudioHardwarePropertyDefaultOutputDevice];
}
//------------------------------------------------------------------------------
+ (NSArray *)inputDevices
{
__block NSMutableArray *devices = [NSMutableArray array];
[self enumerateDevicesUsingBlock:^(EZAudioDevice *device, BOOL *stop)
{
if (device.inputChannelCount > 0)
{
[devices addObject:device];
}
}];
return devices;
}
//------------------------------------------------------------------------------
+ (NSArray *)outputDevices
{
__block NSMutableArray *devices = [NSMutableArray array];
[self enumerateDevicesUsingBlock:^(EZAudioDevice *device, BOOL *stop)
{
if (device.outputChannelCount > 0)
{
[devices addObject:device];
}
}];
return devices;
}
//------------------------------------------------------------------------------
#pragma mark - Utility
//------------------------------------------------------------------------------
+ (AudioObjectPropertyAddress)addressForPropertySelector:(AudioObjectPropertySelector)selector
{
AudioObjectPropertyAddress address;
address.mScope = kAudioObjectPropertyScopeGlobal;
address.mElement = kAudioObjectPropertyElementMaster;
address.mSelector = selector;
return address;
}
//------------------------------------------------------------------------------
+ (NSString *)stringPropertyForSelector:(AudioObjectPropertySelector)selector
withDeviceID:(AudioDeviceID)deviceID
{
AudioObjectPropertyAddress address = [self addressForPropertySelector:selector];
CFStringRef string;
UInt32 propSize = sizeof(CFStringRef);
NSString *errorString = [NSString stringWithFormat:@"Failed to get device property (%u)",(unsigned int)selector];
[EZAudioUtilities checkResult:AudioObjectGetPropertyData(deviceID,
&address,
0,
NULL,
&propSize,
&string)
operation:errorString.UTF8String];
return (__bridge_transfer NSString *)string;
}
//------------------------------------------------------------------------------
+ (NSInteger)channelCountForScope:(AudioObjectPropertyScope)scope
forDeviceID:(AudioDeviceID)deviceID
{
AudioObjectPropertyAddress address;
address.mScope = scope;
address.mElement = kAudioObjectPropertyElementMaster;
address.mSelector = kAudioDevicePropertyStreamConfiguration;
AudioBufferList streamConfiguration;
UInt32 propSize = sizeof(streamConfiguration);
[EZAudioUtilities checkResult:AudioObjectGetPropertyData(deviceID,
&address,
0,
NULL,
&propSize,
&streamConfiguration)
operation:"Failed to get frame size"];
NSInteger channelCount = 0;
for (NSInteger i = 0; i < streamConfiguration.mNumberBuffers; i++)
{
channelCount += streamConfiguration.mBuffers[i].mNumberChannels;
}
return channelCount;
}
//------------------------------------------------------------------------------
+ (NSString *)manufacturerForDeviceID:(AudioDeviceID)deviceID
{
return [self stringPropertyForSelector:kAudioDevicePropertyDeviceManufacturerCFString
withDeviceID:deviceID];
}
//------------------------------------------------------------------------------
+ (NSString *)namePropertyForDeviceID:(AudioDeviceID)deviceID
{
return [self stringPropertyForSelector:kAudioDevicePropertyDeviceNameCFString
withDeviceID:deviceID];
}
//------------------------------------------------------------------------------
+ (NSString *)UIDPropertyForDeviceID:(AudioDeviceID)deviceID
{
return [self stringPropertyForSelector:kAudioDevicePropertyDeviceUID
withDeviceID:deviceID];
}
//------------------------------------------------------------------------------
- (NSString *)description
{
return [NSString stringWithFormat:@"%@ { deviceID: %i, manufacturer: %@, name: %@, UID: %@, inputChannelCount: %ld, outputChannelCount: %ld }",
[super description],
self.deviceID,
self.manufacturer,
self.name,
self.UID,
self.inputChannelCount,
self.outputChannelCount];
}
//------------------------------------------------------------------------------
- (BOOL)isEqual:(id)object
{
if ([object isKindOfClass:self.class])
{
EZAudioDevice *device = (EZAudioDevice *)object;
return [self.UID isEqualToString:device.UID];
}
else
{
return [super isEqual:object];
}
}
//------------------------------------------------------------------------------
#endif
@end
+94
View File
@@ -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
+180
View File
@@ -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
+392
View File
@@ -0,0 +1,392 @@
//
// EZAudioFFT.h
// EZAudio
//
// Created by Syed Haris Ali on 7/10/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 <Accelerate/Accelerate.h>
@class EZAudioFFT;
//------------------------------------------------------------------------------
#pragma mark - EZAudioFFTDelegate
//------------------------------------------------------------------------------
/**
The EZAudioFFTDelegate provides event callbacks for the EZAudioFFT (and subclasses such as the EZAudioFFTRolling) whenvever the FFT is computed.
*/
@protocol EZAudioFFTDelegate <NSObject>
@optional
///-----------------------------------------------------------
/// @name Getting FFT Output Data
///-----------------------------------------------------------
/**
Triggered when the EZAudioFFT computes an FFT from a buffer of input data. Provides an array of float data representing the computed FFT.
@param fft The EZAudioFFT instance that triggered the event.
@param fftData A float pointer representing the float array of FFT data.
@param bufferSize A vDSP_Length (unsigned long) representing the length of the float array.
*/
- (void) fft:(EZAudioFFT *)fft
updatedWithFFTData:(float *)fftData
bufferSize:(vDSP_Length)bufferSize;
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioFFT
//------------------------------------------------------------------------------
/**
The EZAudioFFT provides a base class to quickly calculate the FFT of incoming audio data using the Accelerate framework. In addition, the EZAudioFFT contains an EZAudioFFTDelegate to receive an event anytime an FFT is computed.
*/
@interface EZAudioFFT : NSObject
//------------------------------------------------------------------------------
#pragma mark - Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Initializers
///-----------------------------------------------------------
/**
Initializes an EZAudioFFT (or subclass) instance with a maximum buffer size and sample rate. The sample rate is used specifically to calculate the `maxFrequency` property. If you don't care about the `maxFrequency` property then you can set the sample rate to 0.
@param maximumBufferSize A vDSP_Length (unsigned long) representing the maximum length of the incoming audio data.
@param sampleRate A float representing the sample rate of the incoming audio data.
@return A newly created EZAudioFFT (or subclass) instance.
*/
- (instancetype)initWithMaximumBufferSize:(vDSP_Length)maximumBufferSize
sampleRate:(float)sampleRate;
//------------------------------------------------------------------------------
/**
Initializes an EZAudioFFT (or subclass) instance with a maximum buffer size, sample rate, and EZAudioFFTDelegate. The sample rate is used specifically to calculate the `maxFrequency` property. If you don't care about the `maxFrequency` property then you can set the sample rate to 0. The EZAudioFFTDelegate will act as a receive to get an event whenever the FFT is calculated.
@param maximumBufferSize A vDSP_Length (unsigned long) representing the maximum length of the incoming audio data.
@param sampleRate A float representing the sample rate of the incoming audio data.
@param delegate An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.
@return A newly created EZAudioFFT (or subclass) instance.
*/
- (instancetype)initWithMaximumBufferSize:(vDSP_Length)maximumBufferSize
sampleRate:(float)sampleRate
delegate:(id<EZAudioFFTDelegate>)delegate;
//------------------------------------------------------------------------------
#pragma mark - Class Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Class Initializers
///-----------------------------------------------------------
/**
Class method to initialize an EZAudioFFT (or subclass) instance with a maximum buffer size and sample rate. The sample rate is used specifically to calculate the `maxFrequency` property. If you don't care about the `maxFrequency` property then you can set the sample rate to 0.
@param maximumBufferSize A vDSP_Length (unsigned long) representing the maximum length of the incoming audio data.
@param sampleRate A float representing the sample rate of the incoming audio data.
@return A newly created EZAudioFFT (or subclass) instance.
*/
+ (instancetype)fftWithMaximumBufferSize:(vDSP_Length)maximumBufferSize
sampleRate:(float)sampleRate;
//------------------------------------------------------------------------------
/**
Class method to initialize an EZAudioFFT (or subclass) instance with a maximum buffer size, sample rate, and EZAudioFFTDelegate. The sample rate is used specifically to calculate the `maxFrequency` property. If you don't care about the `maxFrequency` property then you can set the sample rate to 0. The EZAudioFFTDelegate will act as a receive to get an event whenever the FFT is calculated.
@param maximumBufferSize A vDSP_Length (unsigned long) representing the maximum length of the incoming audio data.
@param sampleRate A float representing the sample rate of the incoming audio data.
@param delegate An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.
@return A newly created EZAudioFFT (or subclass) instance.
*/
+ (instancetype)fftWithMaximumBufferSize:(vDSP_Length)maximumBufferSize
sampleRate:(float)sampleRate
delegate:(id<EZAudioFFTDelegate>)delegate;
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Properties
///-----------------------------------------------------------
/**
An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.
*/
@property (weak, nonatomic) id<EZAudioFFTDelegate> delegate;
//------------------------------------------------------------------------------
/**
A COMPLEX_SPLIT data structure used to hold the FFT's imaginary and real components.
*/
@property (readonly, nonatomic) COMPLEX_SPLIT complexSplit;
//------------------------------------------------------------------------------
/**
A float array containing the last calculated FFT data.
*/
@property (readonly, nonatomic) float *fftData;
//------------------------------------------------------------------------------
/**
An FFTSetup data structure used to internally calculate the FFT using Accelerate.
*/
@property (readonly, nonatomic) FFTSetup fftSetup;
//------------------------------------------------------------------------------
/**
A float array containing the last calculated inverse FFT data (the time domain signal).
*/
@property (readonly, nonatomic) float *inversedFFTData;
//------------------------------------------------------------------------------
/**
A float representing the frequency with the highest energy is the last FFT calculation.
*/
@property (readonly, nonatomic) float maxFrequency;
//------------------------------------------------------------------------------
/**
A vDSP_Length (unsigned long) representing the index of the frequency with the highest energy is the last FFT calculation.
*/
@property (readonly, nonatomic) vDSP_Length maxFrequencyIndex;
//------------------------------------------------------------------------------
/**
A float representing the magnitude of the frequency with the highest energy is the last FFT calculation.
*/
@property (readonly, nonatomic) float maxFrequencyMagnitude;
//------------------------------------------------------------------------------
/**
A vDSP_Length (unsigned long) representing the maximum buffer size. This is the maximum length the incoming audio data in the `computeFFTWithBuffer:withBufferSize` method can be.
*/
@property (readonly, nonatomic) vDSP_Length maximumBufferSize;
//------------------------------------------------------------------------------
/**
A float representing the sample rate of the incoming audio data.
*/
@property (readwrite, nonatomic) float sampleRate;
//------------------------------------------------------------------------------
#pragma mark - Actions
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Computing The FFT
///-----------------------------------------------------------
/**
Computes the FFT for a float array representing an incoming audio signal. This will trigger the EZAudioFFTDelegate method `fft:updatedWithFFTData:bufferSize:`.
@param buffer A float array representing the audio data.
@param bufferSize The length of the float array of audio data.
@return A float array containing the computed FFT data. The length of the output will be half the incoming buffer (half the `bufferSize` argument).
*/
- (float *)computeFFTWithBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize;
//------------------------------------------------------------------------------
/**
Provides the frequency corresponding to an index in the last computed FFT data.
@param index A vDSP_Length (unsigned integer) representing the index of the frequency bin value you'd like to get
@return A float representing the frequency value at that index.
*/
- (float)frequencyAtIndex:(vDSP_Length)index;
//------------------------------------------------------------------------------
/**
Provides the magnitude of the frequenecy corresponding to an index in the last computed FFT data.
@param index A vDSP_Length (unsigned integer) representing the index of the frequency bin value you'd like to get
@return A float representing the frequency magnitude value at that index.
*/
- (float)frequencyMagnitudeAtIndex:(vDSP_Length)index;
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioFFTRolling
//------------------------------------------------------------------------------
/**
The EZAudioFFTRolling, a subclass of EZAudioFFT, provides a class to calculate an FFT for an incoming audio signal while maintaining a history of audio data to allow much higher resolution FFTs. For instance, the EZMicrophone typically provides 512 frames at a time, but you would probably want to provide 2048 or 4096 frames for a decent looking FFT if you're trying to extract precise frequency components. You will typically be using this class for variable length FFTs instead of the EZAudioFFT base class.
*/
@interface EZAudioFFTRolling : EZAudioFFT
//------------------------------------------------------------------------------
#pragma mark - Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Initializers
///-----------------------------------------------------------
/**
Initializes an EZAudioFFTRolling instance with a window size and a sample rate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT and a float representing the sample rate of the incoming audio (can be 0 if you don't care about the `maxFrequency` property). The history buffer size in this case is the `windowSize` * 8, which is pretty good for most cases.
@param windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).
@param sampleRate A float representing the sample rate of the incoming audio signal.
@return A newly created EZAudioFFTRolling instance.
*/
- (instancetype)initWithWindowSize:(vDSP_Length)windowSize
sampleRate:(float)sampleRate;
//------------------------------------------------------------------------------
/**
Initializes an EZAudioFFTRolling instance with a window size, a sample rate, and an EZAudioFFTDelegate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a float representing the sample rate of the incoming audio (can be 0 if you don't care about the `maxFrequency` property), and an EZAudioFFTDelegate to receive a callback anytime the FFT is calculated. The history buffer size in this case is the `windowSize` * 8, which is pretty good for most cases.
@param windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).
@param sampleRate A float representing the sample rate of the incoming audio signal.
@param delegate An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.
@return A newly created EZAudioFFTRolling instance.
*/
- (instancetype)initWithWindowSize:(vDSP_Length)windowSize
sampleRate:(float)sampleRate
delegate:(id<EZAudioFFTDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Initializes an EZAudioFFTRolling instance with a window size, a history buffer size, and a sample rate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a history buffer size representing the maximum length of the sliding window's underlying circular buffer, and a float representing the sample rate of the incoming audio (can be 0 if you don't care about the `maxFrequency` property).
@param windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).
@param historyBufferSize A vDSP_Length (unsigned long) representing the length of the history buffer. This should be AT LEAST the size of the window. A recommended value for this would be at least 8x greater than the `windowSize` argument.
@param sampleRate A float representing the sample rate of the incoming audio signal.
@return A newly created EZAudioFFTRolling instance.
*/
- (instancetype)initWithWindowSize:(vDSP_Length)windowSize
historyBufferSize:(vDSP_Length)historyBufferSize
sampleRate:(float)sampleRate;
//------------------------------------------------------------------------------
/**
Initializes an EZAudioFFTRolling instance with a window size, a history buffer size, a sample rate, and an EZAudioFFTDelegate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a history buffer size representing the maximum length of the sliding window's underlying circular buffer, a float representing the sample rate of the incoming audio (can be 0 if you don't care about the `maxFrequency` property), and an EZAudioFFTDelegate to receive a callback anytime the FFT is calculated.
@param windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).
@param historyBufferSize A vDSP_Length (unsigned long) representing the length of the history buffer. This should be AT LEAST the size of the window. A recommended value for this would be at least 8x greater than the `windowSize` argument.
@param sampleRate A float representing the sample rate of the incoming audio signal.
@param delegate An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.
@return A newly created EZAudioFFTRolling instance.
*/
- (instancetype)initWithWindowSize:(vDSP_Length)windowSize
historyBufferSize:(vDSP_Length)historyBufferSize
sampleRate:(float)sampleRate
delegate:(id<EZAudioFFTDelegate>)delegate;
//------------------------------------------------------------------------------
#pragma mark - Class Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Class Initializers
///-----------------------------------------------------------
/**
Class method to initialize an EZAudioFFTRolling instance with a window size and a sample rate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT and a float representing the sample rate of the incoming audio (can be 0 if you don't care about the `maxFrequency` property). The history buffer size in this case is the `windowSize` * 8, which is pretty good for most cases.
@param windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).
@param sampleRate A float representing the sample rate of the incoming audio signal.
@return A newly created EZAudioFFTRolling instance.
*/
+ (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
sampleRate:(float)sampleRate;
//------------------------------------------------------------------------------
/**
Class method to initialize an EZAudioFFTRolling instance with a window size, a sample rate, and an EZAudioFFTDelegate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a float representing the sample rate of the incoming audio (can be 0 if you don't care about the `maxFrequency` property), and an EZAudioFFTDelegate to receive a callback anytime the FFT is calculated. The history buffer size in this case is the `windowSize` * 8, which is pretty good for most cases.
@param windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).
@param sampleRate A float representing the sample rate of the incoming audio signal.
@param delegate An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.
@return A newly created EZAudioFFTRolling instance.
*/
+ (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
sampleRate:(float)sampleRate
delegate:(id<EZAudioFFTDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Class method to initialize an EZAudioFFTRolling instance with a window size, a history buffer size, and a sample rate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a history buffer size representing the maximum length of the sliding window's underlying circular buffer, and a float representing the sample rate of the incoming audio (can be 0 if you don't care about the `maxFrequency` property).
@param windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).
@param historyBufferSize A vDSP_Length (unsigned long) representing the length of the history buffer. This should be AT LEAST the size of the window. A recommended value for this would be at least 8x greater than the `windowSize` argument.
@param sampleRate A float representing the sample rate of the incoming audio signal.
@return A newly created EZAudioFFTRolling instance.
*/
+ (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
historyBufferSize:(vDSP_Length)historyBufferSize
sampleRate:(float)sampleRate;
//------------------------------------------------------------------------------
/**
Class method to initialize an EZAudioFFTRolling instance with a window size, a history buffer size, a sample rate, and an EZAudioFFTDelegate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a history buffer size representing the maximum length of the sliding window's underlying circular buffer, a float representing the sample rate of the incoming audio (can be 0 if you don't care about the `maxFrequency` property), and an EZAudioFFTDelegate to receive a callback anytime the FFT is calculated.
@param windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).
@param historyBufferSize A vDSP_Length (unsigned long) representing the length of the history buffer. This should be AT LEAST the size of the window. A recommended value for this would be at least 8x greater than the `windowSize` argument.
@param sampleRate A float representing the sample rate of the incoming audio signal.
@param delegate An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.
@return A newly created EZAudioFFTRolling instance.
*/
+ (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
historyBufferSize:(vDSP_Length)historyBufferSize
sampleRate:(float)sampleRate
delegate:(id<EZAudioFFTDelegate>)delegate;
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Properties
///-----------------------------------------------------------
/**
A vDSP_Length (unsigned long) representing the length of the FFT window.
*/
@property (readonly, nonatomic) vDSP_Length windowSize;
//------------------------------------------------------------------------------
/**
A float array representing the audio data in the internal circular buffer used to perform the FFT. This will increase as more data is appended to the internal circular buffer via the `computeFFTWithBuffer:withBufferSize:` method. The length of this array is the `timeDomainBufferSize` property.
*/
@property (readonly, nonatomic) float *timeDomainData;
//------------------------------------------------------------------------------
/**
A UInt32 representing the length of the audio data used to perform the FFT.
*/
@property (readonly, nonatomic) UInt32 timeDomainBufferSize;
@end
+444
View File
@@ -0,0 +1,444 @@
//
// EZAudioFFT.m
// EZAudio
//
// Created by Syed Haris Ali on 7/10/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 "EZAudioFFT.h"
#import "EZAudioUtilities.h"
//------------------------------------------------------------------------------
#pragma mark - Data Structures
//------------------------------------------------------------------------------
typedef struct EZAudioFFTInfo
{
FFTSetup fftSetup;
COMPLEX_SPLIT complexA;
float *outFFTData;
vDSP_Length outFFTDataLength;
float *inversedFFTData;
vDSP_Length maxFrequencyIndex;
float maxFrequencyMangitude;
float maxFrequency;
} EZAudioFFTInfo;
//------------------------------------------------------------------------------
#pragma mark - EZAudioFFT (Interface Extension)
//------------------------------------------------------------------------------
@interface EZAudioFFT ()
@property (assign, nonatomic) EZAudioFFTInfo *info;
@property (readwrite, nonatomic) vDSP_Length maximumBufferSize;
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioFFT (Implementation)
//------------------------------------------------------------------------------
@implementation EZAudioFFT
//------------------------------------------------------------------------------
#pragma mark - Dealloc
//------------------------------------------------------------------------------
- (void)dealloc
{
vDSP_destroy_fftsetup(self.info->fftSetup);
free(self.info->complexA.realp);
free(self.info->complexA.imagp);
free(self.info->outFFTData);
free(self.info->inversedFFTData);
}
//------------------------------------------------------------------------------
#pragma mark - Initializers
//------------------------------------------------------------------------------
- (instancetype)initWithMaximumBufferSize:(vDSP_Length)maximumBufferSize
sampleRate:(float)sampleRate
{
return [self initWithMaximumBufferSize:maximumBufferSize
sampleRate:sampleRate
delegate:nil];
}
//------------------------------------------------------------------------------
- (instancetype)initWithMaximumBufferSize:(vDSP_Length)maximumBufferSize
sampleRate:(float)sampleRate
delegate:(id<EZAudioFFTDelegate>)delegate
{
self = [super init];
if (self)
{
self.maximumBufferSize = (vDSP_Length)maximumBufferSize;
self.sampleRate = sampleRate;
self.delegate = delegate;
[self setup];
}
return self;
}
//------------------------------------------------------------------------------
#pragma mark - Class Initializers
//------------------------------------------------------------------------------
+ (instancetype)fftWithMaximumBufferSize:(vDSP_Length)maximumBufferSize
sampleRate:(float)sampleRate
{
return [[self alloc] initWithMaximumBufferSize:maximumBufferSize
sampleRate:sampleRate];
}
//------------------------------------------------------------------------------
+ (instancetype)fftWithMaximumBufferSize:(vDSP_Length)maximumBufferSize
sampleRate:(float)sampleRate
delegate:(id<EZAudioFFTDelegate>)delegate
{
return [[self alloc] initWithMaximumBufferSize:maximumBufferSize
sampleRate:sampleRate
delegate:delegate];
}
//------------------------------------------------------------------------------
#pragma mark - Setup
//------------------------------------------------------------------------------
- (void)setup
{
NSAssert(self.maximumBufferSize > 0, @"Expected FFT buffer size to be greater than 0!");
//
// Initialize FFT
//
float maximumBufferSizeBytes = self.maximumBufferSize * sizeof(float);
self.info = (EZAudioFFTInfo *)calloc(1, sizeof(EZAudioFFTInfo));
vDSP_Length log2n = log2f(self.maximumBufferSize);
self.info->fftSetup = vDSP_create_fftsetup(log2n, FFT_RADIX2);
long nOver2 = maximumBufferSizeBytes / 2;
size_t maximumSizePerComponentBytes = nOver2 * sizeof(float);
self.info->complexA.realp = (float *)malloc(maximumSizePerComponentBytes);
self.info->complexA.imagp = (float *)malloc(maximumSizePerComponentBytes);
self.info->outFFTData = (float *)malloc(maximumSizePerComponentBytes);
memset(self.info->outFFTData, 0, maximumSizePerComponentBytes);
self.info->inversedFFTData = (float *)malloc(maximumSizePerComponentBytes);
}
//------------------------------------------------------------------------------
#pragma mark - Actions
//------------------------------------------------------------------------------
- (float *)computeFFTWithBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize
{
if (buffer == NULL)
{
return NULL;
}
//
// Calculate real + imaginary components and normalize
//
vDSP_Length log2n = log2f(bufferSize);
long nOver2 = bufferSize / 2;
float mFFTNormFactor = 10.0 / (2 * bufferSize);
vDSP_ctoz((COMPLEX*)buffer, 2, &(self.info->complexA), 1, nOver2);
vDSP_fft_zrip(self.info->fftSetup, &(self.info->complexA), 1, log2n, FFT_FORWARD);
vDSP_vsmul(self.info->complexA.realp, 1, &mFFTNormFactor, self.info->complexA.realp, 1, nOver2);
vDSP_vsmul(self.info->complexA.imagp, 1, &mFFTNormFactor, self.info->complexA.imagp, 1, nOver2);
vDSP_zvmags(&(self.info->complexA), 1, self.info->outFFTData, 1, nOver2);
vDSP_fft_zrip(self.info->fftSetup, &(self.info->complexA), 1, log2n, FFT_INVERSE);
vDSP_ztoc(&(self.info->complexA), 1, (COMPLEX *) self.info->inversedFFTData , 2, nOver2);
self.info->outFFTDataLength = nOver2;
//
// Calculate max freq
//
if (self.sampleRate > 0.0f)
{
vDSP_maxvi(self.info->outFFTData, 1, &self.info->maxFrequencyMangitude, &self.info->maxFrequencyIndex, nOver2);
self.info->maxFrequency = [self frequencyAtIndex:self.info->maxFrequencyIndex];
}
//
// Notify delegate
//
if ([self.delegate respondsToSelector:@selector(fft:updatedWithFFTData:bufferSize:)])
{
[self.delegate fft:self
updatedWithFFTData:self.info->outFFTData
bufferSize:nOver2];
}
//
// Return the FFT
//
return self.info->outFFTData;
}
//------------------------------------------------------------------------------
- (float)frequencyAtIndex:(vDSP_Length)index
{
if (!(self.info->outFFTData == NULL || self.sampleRate == 0.0f))
{
float nyquistMaxFreq = self.sampleRate / 2.0;
return ((float)index / (float)self.info->outFFTDataLength) * nyquistMaxFreq;
}
return NSNotFound;
}
//------------------------------------------------------------------------------
- (float)frequencyMagnitudeAtIndex:(vDSP_Length)index
{
if (self.info->outFFTData != NULL)
{
return self.info->outFFTData[index];
}
return NSNotFound;
}
//------------------------------------------------------------------------------
#pragma mark - Getters
//------------------------------------------------------------------------------
- (COMPLEX_SPLIT)complexSplit
{
return self.info->complexA;
}
//------------------------------------------------------------------------------
- (float *)fftData
{
return self.info->outFFTData;
}
//------------------------------------------------------------------------------
- (FFTSetup)fftSetup
{
return self.info->fftSetup;
}
//------------------------------------------------------------------------------
- (float *)inversedFFTData
{
return self.info->inversedFFTData;
}
//------------------------------------------------------------------------------
- (vDSP_Length)maxFrequencyIndex
{
return self.info->maxFrequencyIndex;
}
//------------------------------------------------------------------------------
- (float)maxFrequencyMagnitude
{
return self.info->maxFrequencyMangitude;
}
//------------------------------------------------------------------------------
- (float)maxFrequency
{
return self.info->maxFrequency;
}
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioFFTRolling
//------------------------------------------------------------------------------
@interface EZAudioFFTRolling ()
@property (assign, nonatomic) EZPlotHistoryInfo *historyInfo;
@property (readwrite, nonatomic) vDSP_Length windowSize;
@end
@implementation EZAudioFFTRolling
//------------------------------------------------------------------------------
#pragma mark - Dealloc
//------------------------------------------------------------------------------
- (void)dealloc
{
[EZAudioUtilities freeHistoryInfo:self.historyInfo];
}
//------------------------------------------------------------------------------
#pragma mark - Initialization
//------------------------------------------------------------------------------
- (instancetype)initWithWindowSize:(vDSP_Length)windowSize
sampleRate:(float)sampleRate
{
return [self initWithWindowSize:windowSize
historyBufferSize:windowSize * 8
sampleRate:sampleRate
delegate:nil];
}
//------------------------------------------------------------------------------
- (instancetype)initWithWindowSize:(vDSP_Length)windowSize
sampleRate:(float)sampleRate
delegate:(id<EZAudioFFTDelegate>)delegate
{
return [self initWithWindowSize:windowSize
historyBufferSize:windowSize * 8
sampleRate:sampleRate
delegate:delegate];
}
//------------------------------------------------------------------------------
- (instancetype)initWithWindowSize:(vDSP_Length)windowSize
historyBufferSize:(vDSP_Length)historyBufferSize
sampleRate:(float)sampleRate
{
return [self initWithWindowSize:windowSize
historyBufferSize:historyBufferSize
sampleRate:sampleRate
delegate:nil];
}
//------------------------------------------------------------------------------
- (instancetype)initWithWindowSize:(vDSP_Length)windowSize
historyBufferSize:(vDSP_Length)historyBufferSize
sampleRate:(float)sampleRate
delegate:(id<EZAudioFFTDelegate>)delegate
{
self = [super initWithMaximumBufferSize:historyBufferSize
sampleRate:sampleRate];
if (self)
{
self.delegate = delegate;
self.windowSize = windowSize;
//
// Allocate an appropriately sized history buffer in bytes
//
self.historyInfo = [EZAudioUtilities historyInfoWithDefaultLength:(UInt32)windowSize
maximumLength:(UInt32)historyBufferSize];
}
return self;
}
//------------------------------------------------------------------------------
#pragma mark - Class Initializers
//------------------------------------------------------------------------------
+ (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
sampleRate:(float)sampleRate
{
return [[self alloc] initWithWindowSize:windowSize
sampleRate:sampleRate];
}
//------------------------------------------------------------------------------
+ (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
sampleRate:(float)sampleRate
delegate:(id<EZAudioFFTDelegate>)delegate
{
return [[self alloc] initWithWindowSize:windowSize
sampleRate:sampleRate
delegate:delegate];
}
//------------------------------------------------------------------------------
+ (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
historyBufferSize:(vDSP_Length)historyBufferSize
sampleRate:(float)sampleRate
{
return [[self alloc] initWithWindowSize:windowSize
historyBufferSize:historyBufferSize
sampleRate:sampleRate];
}
//------------------------------------------------------------------------------
+ (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
historyBufferSize:(vDSP_Length)historyBufferSize
sampleRate:(float)sampleRate
delegate:(id<EZAudioFFTDelegate>)delegate
{
return [[self alloc] initWithWindowSize:windowSize
historyBufferSize:historyBufferSize
sampleRate:sampleRate
delegate:delegate];
}
//------------------------------------------------------------------------------
#pragma mark - Actions
//------------------------------------------------------------------------------
- (float *)computeFFTWithBuffer:(float *)buffer
withBufferSize:(UInt32)bufferSize
{
if (buffer == NULL)
{
return NULL;
}
//
// Append buffer to history window
//
[EZAudioUtilities appendBuffer:buffer
withBufferSize:bufferSize
toHistoryInfo:self.historyInfo];
//
// Call super to calculate the FFT of the window
//
return [super computeFFTWithBuffer:self.historyInfo->buffer
withBufferSize:self.historyInfo->bufferSize];
}
//------------------------------------------------------------------------------
#pragma mark - Getters
//------------------------------------------------------------------------------
- (UInt32)timeDomainBufferSize
{
return self.historyInfo->bufferSize;
}
//------------------------------------------------------------------------------
- (float *)timeDomainData
{
return self.historyInfo->buffer;
}
@end
+114 -127
View File
@@ -25,22 +25,22 @@
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
#import "EZAudioWaveformData.h"
#import "EZAudioFloatData.h"
//------------------------------------------------------------------------------
@class EZAudio;
@class EZAudioConverter;
@class EZAudioFile;
//------------------------------------------------------------------------------
typedef NS_ENUM(NSUInteger, EZAudioFilePermission)
{
EZAudioFilePermissionRead = kAudioFileReadPermission,
EZAudioFilePermissionWrite = kAudioFileWritePermission,
EZAudioFilePermissionReadWrite = kAudioFileReadWritePermission,
};
#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
@@ -58,20 +58,30 @@ typedef NS_ENUM(NSUInteger, EZAudioFilePermission)
@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
- (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:`. As of 0.8.0 this is the preferred method of listening for position updates on the audio file since a user may want the pull the currentTime, formattedCurrentTime, or the frame index from the EZAudioFile instance provided.
@param audioFile The instance of the EZAudio in which the change occured.
*/
- (void)audioFileUpdatedPosition:(EZAudioFile *)audioFile;
//------------------------------------------------------------------------------
/**
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
@deprecated This property is deprecated starting in version 0.8.0.
@note Please use `audioFileUpdatedPosition:` property instead.
*/
- (void) audioFile:(EZAudioFile*)audioFile
updatedPosition:(SInt64)framePosition;
- (void)audioFile:(EZAudioFile *)audioFile
updatedPosition:(SInt64)framePosition __attribute__((deprecated));
@end
@@ -81,21 +91,12 @@ typedef NS_ENUM(NSUInteger, EZAudioFilePermission)
/**
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)(EZAudioWaveformData *waveformData);
@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.
*/
@@ -108,56 +109,33 @@ typedef void (^WaveformDataCompletionBlock)(EZAudioWaveformData *waveformData);
@name Initialization
*/
/**
Creates a new instance of the EZAudioFile using a file path URL. Read only.
@param url The file path reference of the audio file as an NSURL.
@return The newly created EZAudioFile instance.
*/
- (instancetype)initWithURL:(NSURL*)url;
//------------------------------------------------------------------------------
/**
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.
@param permission A constant describing what we intend on doing with the audio file (read, write, or both)
@param fileFormat An AudioStreamBasicDescription that will be used to create the audio file if it does not exist if the permission argument is set to EZAudioFilePermissionWrite or EZAudioFilePermissionReadWrite. Not used for EZAudioFilePermissionRead permission.
@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
permission:(EZAudioFilePermission)permission
fileFormat:(AudioStreamBasicDescription)fileFormat;
- (instancetype)initWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Creates a new instance of the EZAudioFile using a file path URL and allows specifying an EZAudioFileDelegate.
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 permission A constant describing what we intend on doing with the audio file (read, write, or both)
@param fileFormat An AudioStreamBasicDescription that will be used to create the audio file if it does not exist if the permission argument is set to EZAudioFilePermissionWrite or EZAudioFilePermissionReadWrite. Not used for EZAudioFilePermissionRead permission.
@return The newly created EZAudioFile instance.
*/
- (instancetype)initWithURL:(NSURL*)url
delegate:(id<EZAudioFileDelegate>)delegate
permission:(EZAudioFilePermission)permission
fileFormat:(AudioStreamBasicDescription)fileFormat;
//------------------------------------------------------------------------------
/**
Class method that creates a new instance of the EZAudioFile using a file path URL and allows specifying an EZAudioFileDelegate, a read/write permission, a file format incase a new file is being written, and a client format for a format that will be used when read samples (different from file 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 permission A constant describing what we intend on doing with the audio file (read, write, or both)
@param fileFormat An AudioStreamBasicDescription that will be used to create the audio file if it does not exist if the permission argument is set to EZAudioFilePermissionWrite or EZAudioFilePermissionReadWrite. Not used for EZAudioFilePermissionRead permission.
@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
- (instancetype)initWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate
permission:(EZAudioFilePermission)permission
fileFormat:(AudioStreamBasicDescription)fileFormat
clientFormat:(AudioStreamBasicDescription)clientFormat;
//------------------------------------------------------------------------------
@@ -172,52 +150,31 @@ typedef void (^WaveformDataCompletionBlock)(EZAudioWaveformData *waveformData);
@param url The file path reference of the audio file as an NSURL.
@return The newly created EZAudioFile instance.
*/
+ (instancetype)audioFileWithURL:(NSURL*)url;
+ (instancetype)audioFileWithURL:(NSURL *)url;
//------------------------------------------------------------------------------
/**
Class method that creates a new instance of the EZAudioFile using a file path 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 permission A constant describing what we intend on doing with the audio file (read, write, or both)
@param fileFormat An AudioStreamBasicDescription that will be used to create the audio file if it does not exist if the permission argument is set to EZAudioFilePermissionWrite or EZAudioFilePermissionReadWrite. Not used for EZAudioFilePermissionRead permission.
@param delegate The audio file delegate that receives events specified by the EZAudioFileDelegate protocol
@return The newly created EZAudioFile instance.
*/
+ (instancetype)audioFileWithURL:(NSURL*)url
permission:(EZAudioFilePermission)permission
fileFormat:(AudioStreamBasicDescription)fileFormat;
+ (instancetype)audioFileWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate;
//------------------------------------------------------------------------------
/**
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.
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 permission A constant describing what we intend on doing with the audio file (read, write, or both)
@param fileFormat An AudioStreamBasicDescription that will be used to create the audio file if it does not exist if the permission argument is set to EZAudioFilePermissionWrite or EZAudioFilePermissionReadWrite. Not used for EZAudioFilePermissionRead permission.
@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
permission:(EZAudioFilePermission)permission
fileFormat:(AudioStreamBasicDescription)fileFormat;
//------------------------------------------------------------------------------
/**
Class method that creates a new instance of the EZAudioFile using a file path URL and allows specifying an EZAudioFileDelegate, a read/write permission, a file format incase a new file is being written, and a client format for a format that will be used when read samples (different from file 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 permission A constant describing what we intend on doing with the audio file (read, write, or both)
@param fileFormat An AudioStreamBasicDescription that will be used to create the audio file if it does not exist if the permission argument is set to EZAudioFilePermissionWrite or EZAudioFilePermissionReadWrite. Not used for EZAudioFilePermissionRead permission.
@param clientFormat An AudioStreamBasicDescription that will be used as the client format on the audio 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. If not specified the default value is equal to the class method, 'defaultClientFormat'
@return The newly created EZAudioFile instance.
*/
+ (instancetype)audioFileWithURL:(NSURL*)url
+ (instancetype)audioFileWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate
permission:(EZAudioFilePermission)permission
fileFormat:(AudioStreamBasicDescription)fileFormat
clientFormat:(AudioStreamBasicDescription)clientFormat;;
clientFormat:(AudioStreamBasicDescription)clientFormat;
//------------------------------------------------------------------------------
#pragma mark - Class Methods
@@ -227,11 +184,21 @@ typedef void (^WaveformDataCompletionBlock)(EZAudioWaveformData *waveformData);
*/
/**
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. Default is stereo, non-interleaved, 44.1 kHz.
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.
@@ -242,7 +209,7 @@ typedef void (^WaveformDataCompletionBlock)(EZAudioWaveformData *waveformData);
#pragma mark - Events
//------------------------------------------------------------------------------
/**
@name Reading The Audio File
@name Reading From The Audio File
*/
/**
@@ -252,15 +219,13 @@ typedef void (^WaveformDataCompletionBlock)(EZAudioWaveformData *waveformData);
@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;
- (void)readFrames:(UInt32)frames
audioBufferList:(AudioBufferList *)audioBufferList
bufferSize:(UInt32 *)bufferSize
eof:(BOOL *)eof;
//------------------------------------------------------------------------------
#pragma mark - Seeking Through The Audio File
//------------------------------------------------------------------------------
/**
@name Seeking Through The Audio File
*/
@@ -279,10 +244,26 @@ typedef void (^WaveformDataCompletionBlock)(EZAudioWaveformData *waveformData);
*/
/**
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.
Provides the common AudioStreamBasicDescription that will be used for in-app interaction. 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.
*/
- (AudioStreamBasicDescription)clientFormat;
@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;
//------------------------------------------------------------------------------
@@ -290,15 +271,29 @@ typedef void (^WaveformDataCompletionBlock)(EZAudioWaveformData *waveformData);
Provides the AudioStreamBasicDescription structure containing the format of the file.
@return An AudioStreamBasicDescription structure describing the format of the audio file.
*/
- (AudioStreamBasicDescription)fileFormat;
@property (readonly) 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.
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.
*/
- (SInt64)frameIndex;
@property (readonly) SInt64 frameIndex;
//------------------------------------------------------------------------------
@@ -306,15 +301,17 @@ typedef void (^WaveformDataCompletionBlock)(EZAudioWaveformData *waveformData);
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;
@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.
*/
- (NSTimeInterval)totalDuration;
@property (readonly) NSTimeInterval totalDuration __attribute__((deprecated));
//------------------------------------------------------------------------------
@@ -322,7 +319,7 @@ typedef void (^WaveformDataCompletionBlock)(EZAudioWaveformData *waveformData);
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.
*/
- (SInt64)totalClientFrames;
@property (readonly) SInt64 totalClientFrames;
//------------------------------------------------------------------------------
@@ -330,7 +327,7 @@ typedef void (^WaveformDataCompletionBlock)(EZAudioWaveformData *waveformData);
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.
*/
- (SInt64)totalFrames;
@property (readonly) SInt64 totalFrames;
//------------------------------------------------------------------------------
@@ -338,17 +335,7 @@ typedef void (^WaveformDataCompletionBlock)(EZAudioWaveformData *waveformData);
Provides the NSURL for the audio file.
@return An NSURL representing the path of the EZAudioFile instance.
*/
- (NSURL*)url;
//------------------------------------------------------------------------------
#pragma mark - Setters
//------------------------------------------------------------------------------
/**
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. Default is stereo, non-interleaved, 44.1 kHz.
@param clientFormat An AudioStreamBasicDescription that should serve as the audio file's client format.
*/
- (void)setClientFormat:(AudioStreamBasicDescription)clientFormat;
@property (nonatomic, copy, readonly) NSURL *url;
//------------------------------------------------------------------------------
#pragma mark - Helpers
@@ -357,36 +344,36 @@ typedef void (^WaveformDataCompletionBlock)(EZAudioWaveformData *waveformData);
/**
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 EZAudioWaveformData instance containing the audio data for all channels of the audio.
@return A EZAudioFloatData instance containing the audio data for all channels of the audio.
*/
- (EZAudioWaveformData *)getWaveformData;
- (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 EZAudioWaveformData instance containing the audio data for all channels of the audio.
@return A EZAudioFloatData instance containing the audio data for all channels of the audio.
*/
- (EZAudioWaveformData *)getWaveformDataWithNumberOfPoints:(UInt32)numberOfPoints;
- (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 WaveformDataCompletionBlock that executes when the waveform data has been extracted. Provides a `EZAudioWaveformData` instance containing the waveform data for all audio channels.
@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:(WaveformDataCompletionBlock)completion;
- (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 WaveformDataCompletionBlock that executes when the waveform data has been extracted. Provides a `EZAudioWaveformData` instance containing the waveform data for all audio channels.
@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:(WaveformDataCompletionBlock)completion;
completion:(EZAudioWaveformDataCompletionBlock)completion;
//------------------------------------------------------------------------------
+349 -238
View File
@@ -28,15 +28,10 @@
//------------------------------------------------------------------------------
#import "EZAudio.h"
#import "EZAudioConverter.h"
#import "EZAudioWaveformData.h"
#import "EZAudioFloatConverter.h"
#import "EZAudioFloatData.h"
#include <pthread.h>
//------------------------------------------------------------------------------
// errors
static OSStatus EZAudioFileReadPermissionFileDoesNotExistCode = -88776;
// constants
static UInt32 EZAudioFileWaveformDefaultResolution = 1024;
static NSString *EZAudioFileWaveformDataQueueIdentifier = @"com.ezaudio.waveformQueue";
@@ -47,11 +42,10 @@ typedef struct
{
AudioFileID audioFileID;
AudioStreamBasicDescription clientFormat;
Float32 duration;
NSTimeInterval duration;
ExtAudioFileRef extAudioFileRef;
AudioStreamBasicDescription fileFormat;
SInt64 frames;
EZAudioFilePermission permission;
CFURLRef sourceURL;
} EZAudioFileInfo;
@@ -60,15 +54,30 @@ typedef struct
//------------------------------------------------------------------------------
@interface EZAudioFile ()
@property (nonatomic) EZAudioFileInfo info;
@property (nonatomic) pthread_mutex_t lock;
@property (nonatomic) dispatch_queue_t waveformQueue;
@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
//------------------------------------------------------------------------------
@@ -78,8 +87,8 @@ typedef struct
self = [super init];
if (self)
{
memset(&_info, 0, sizeof(_info));
_info.permission = EZAudioFilePermissionRead;
self.info = (EZAudioFileInfo *)malloc(sizeof(EZAudioFileInfo));
_floatData = NULL;
pthread_mutex_init(&_lock, NULL);
_waveformQueue = dispatch_queue_create(EZAudioFileWaveformDataQueueIdentifier.UTF8String, DISPATCH_QUEUE_PRIORITY_DEFAULT);
}
@@ -90,55 +99,35 @@ typedef struct
- (instancetype)initWithURL:(NSURL *)url
{
AudioStreamBasicDescription asbd;
return [self initWithURL:url
permission:EZAudioFilePermissionRead
fileFormat:asbd];
return [self initWithURL:url delegate:nil];
}
//------------------------------------------------------------------------------
- (instancetype)initWithURL:(NSURL*)url
permission:(EZAudioFilePermission)permission
fileFormat:(AudioStreamBasicDescription)fileFormat
{
return [self initWithURL:url
delegate:nil
permission:permission
fileFormat:fileFormat];
}
//------------------------------------------------------------------------------
- (instancetype)initWithURL:(NSURL*)url
- (instancetype)initWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate
permission:(EZAudioFilePermission)permission
fileFormat:(AudioStreamBasicDescription)fileFormat
{
return [self initWithURL:url
delegate:delegate
permission:permission
fileFormat:fileFormat
clientFormat:[self.class defaultClientFormat]];
}
//------------------------------------------------------------------------------
- (instancetype)initWithURL:(NSURL*)url
- (instancetype)initWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate
permission:(EZAudioFilePermission)permission
fileFormat:(AudioStreamBasicDescription)fileFormat
clientFormat:(AudioStreamBasicDescription)clientFormat
{
self = [self init];
if(self)
if (self)
{
_info.clientFormat = clientFormat;
_info.fileFormat = fileFormat;
_info.permission = permission;
_info.sourceURL = (__bridge CFURLRef)url;
self.delegate = delegate;
[self setup];
self.info->sourceURL = (__bridge CFURLRef)(url);
self.info->clientFormat = clientFormat;
self.delegate = delegate;
if (![self setup])
{
return nil;
}
}
return self;
}
@@ -147,64 +136,61 @@ typedef struct
#pragma mark - Class Initializers
//------------------------------------------------------------------------------
+ (instancetype)audioFileWithURL:(NSURL*)url
+ (instancetype)audioFileWithURL:(NSURL *)url
{
return [[self alloc] initWithURL:url];
}
//------------------------------------------------------------------------------
+ (instancetype)audioFileWithURL:(NSURL*)url
permission:(EZAudioFilePermission)permission
fileFormat:(AudioStreamBasicDescription)fileFormat
+ (instancetype)audioFileWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate
{
return [[self alloc] initWithURL:url
permission:permission
fileFormat:fileFormat];
return [[self alloc] initWithURL:url delegate:delegate];
}
//------------------------------------------------------------------------------
+ (instancetype)audioFileWithURL:(NSURL*)url
+ (instancetype)audioFileWithURL:(NSURL *)url
delegate:(id<EZAudioFileDelegate>)delegate
permission:(EZAudioFilePermission)permission
fileFormat:(AudioStreamBasicDescription)fileFormat
{
return [[self alloc] initWithURL:url
delegate:delegate
permission:permission
fileFormat:fileFormat];
}
//------------------------------------------------------------------------------
+ (instancetype)audioFileWithURL:(NSURL*)url
delegate:(id<EZAudioFileDelegate>)delegate
permission:(EZAudioFilePermission)permission
fileFormat:(AudioStreamBasicDescription)fileFormat
clientFormat:(AudioStreamBasicDescription)clientFormat
{
return [[self alloc] initWithURL:url
delegate:delegate
permission:permission
fileFormat:fileFormat
clientFormat:clientFormat];
}
//------------------------------------------------------------------------------
#pragma mark - NSCopying
//------------------------------------------------------------------------------
- (id)copyWithZone:(NSZone *)zone
{
return [EZAudioFile audioFileWithURL:self.url];
}
//------------------------------------------------------------------------------
#pragma mark - Class Methods
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)defaultClientFormat
{
return [EZAudio stereoFloatInterleavedFormatWithSampleRate:44100];
return [EZAudioUtilities stereoFloatNonInterleavedFormatWithSampleRate:[self defaultClientFormatSampleRate]];
}
//------------------------------------------------------------------------------
+ (Float64)defaultClientFormatSampleRate
{
return 44100.0f;
}
//------------------------------------------------------------------------------
+ (NSArray *)supportedAudioFileTypes
{
return @[
return @
[
@"aac",
@"caf",
@"aif",
@@ -224,88 +210,88 @@ typedef struct
#pragma mark - Setup
//------------------------------------------------------------------------------
- (void)setup
- (BOOL)setup
{
// we open the file differently depending on the permissions specified
[EZAudio checkResult:[self openAudioFile]
operation:"Failed to create/open audio file"];
//
// 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;
//
// Set the client format
//
self.clientFormat = self.info->clientFormat;
return YES;
}
//------------------------------------------------------------------------------
#pragma mark - Creating/Opening Audio File
//------------------------------------------------------------------------------
- (OSStatus)openAudioFile
- (BOOL)openAudioFile
{
// need a source url
NSAssert(_info.sourceURL, @"EZAudioFile cannot be created without a source url!");
//
// 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];
//
// Determine if the file actually exists
//
CFURLRef url = self.info->sourceURL;
NSURL *fileURL = (__bridge NSURL *)(url);
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:fileURL.path];
// create the file wrapper slightly differently depending what we are
// trying to do with it
OSStatus result = noErr;
EZAudioFilePermission permission = self.info.permission;
UInt32 propSize;
//
// Create an ExtAudioFileRef for the file handle
//
if (fileExists)
{
result = AudioFileOpenURL(url,
permission,
0,
&_info.audioFileID);
[EZAudio checkResult:result
operation:"failed to open audio file"];
[EZAudioUtilities checkResult:ExtAudioFileOpenURL(url, &self.info->extAudioFileRef)
operation:"Failed to create ExtAudioFileRef"];
}
else
{
// read permission is not applicable because the file does not exist
if (permission == EZAudioFilePermissionRead)
{
result = EZAudioFileReadPermissionFileDoesNotExistCode;
}
else
{
result = AudioFileCreateWithURL(url,
0,
&_info.fileFormat,
kAudioFileFlags_EraseFile,
&_info.audioFileID);
}
return NO;
}
// get the ExtAudioFile wrapper
if (result == noErr)
{
[EZAudio checkResult:ExtAudioFileWrapAudioFileID(self.info.audioFileID,
false,
&_info.extAudioFileRef)
operation:"Failed to wrap audio file ID in ext audio file ref"];
}
//
// 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 if we opened an existing file
if (fileExists)
{
propSize = sizeof(self.info.fileFormat);
[EZAudio checkResult:ExtAudioFileGetProperty(self.info.extAudioFileRef,
kExtAudioFileProperty_FileDataFormat,
&propSize,
&_info.fileFormat)
operation:"Failed to get file audio format on existing audio file"];
}
//
// 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"];
NSLog(@"file format......................");
[EZAudio printASBD:self.info.fileFormat];
NSLog(@"client format....................");
[EZAudio printASBD:self.info.clientFormat];
//
// 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;
// done
return result;
return YES;
}
//------------------------------------------------------------------------------
@@ -320,27 +306,49 @@ typedef struct
if (pthread_mutex_trylock(&_lock) == 0)
{
// perform read
[EZAudio checkResult:ExtAudioFileRead(self.info.extAudioFileRef,
&frames,
audioBufferList)
operation:"Failed to read audio data from file"];
[EZAudioUtilities checkResult:ExtAudioFileRead(self.info->extAudioFileRef,
&frames,
audioBufferList)
operation:"Failed to read audio data from file"];
*bufferSize = frames;
*eof = frames == 0;
pthread_mutex_unlock(&_lock);
// notify delegate
//
// Notify delegate
//
if ([self.delegate respondsToSelector:@selector(audioFileUpdatedPosition:)])
{
[self.delegate audioFileUpdatedPosition:self];
}
//
// Deprecated, but supported until 1.0
//
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
if ([self.delegate respondsToSelector:@selector(audioFile:updatedPosition:)])
{
[self.delegate audioFile:self
updatedPosition:self.frameIndex];
[self.delegate audioFile:self updatedPosition:[self frameIndex]];
}
#pragma GCC diagnostic pop
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:nil
readAudio:self.floatData
withBufferSize:*bufferSize
withNumberOfChannels:self.info.clientFormat.mChannelsPerFrame];
withNumberOfChannels:channels];
}
pthread_mutex_unlock(&_lock);
}
}
@@ -350,17 +358,30 @@ typedef struct
{
if (pthread_mutex_trylock(&_lock) == 0)
{
[EZAudio checkResult:ExtAudioFileSeek(self.info.extAudioFileRef,
frame)
[EZAudioUtilities checkResult:ExtAudioFileSeek(self.info->extAudioFileRef,
frame)
operation:"Failed to seek frame position within audio file"];
pthread_mutex_unlock(&_lock);
// notify delegate
//
// Notify delegate
//
if ([self.delegate respondsToSelector:@selector(audioFileUpdatedPosition:)])
{
[self.delegate audioFileUpdatedPosition:self];
}
//
// Deprecated, but supported until 1.0
//
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
if ([self.delegate respondsToSelector:@selector(audioFile:updatedPosition:)])
{
[self.delegate audioFile:self
updatedPosition:self.frameIndex];
[self.delegate audioFile:self updatedPosition:[self frameIndex]];
}
#pragma GCC diagnostic pop
}
}
@@ -368,56 +389,66 @@ typedef struct
#pragma mark - Getters
//------------------------------------------------------------------------------
- (EZAudioWaveformData *)getWaveformData
- (AudioStreamBasicDescription)floatFormat
{
return [EZAudioUtilities stereoFloatNonInterleavedFormatWithSampleRate:44100.0f];
}
//------------------------------------------------------------------------------
- (EZAudioFloatData *)getWaveformData
{
return [self getWaveformDataWithNumberOfPoints:EZAudioFileWaveformDefaultResolution];
}
//------------------------------------------------------------------------------
- (EZAudioWaveformData *)getWaveformDataWithNumberOfPoints:(UInt32)numberOfPoints
- (EZAudioFloatData *)getWaveformDataWithNumberOfPoints:(UInt32)numberOfPoints
{
EZAudioWaveformData *waveformData;
EZAudioFloatData *waveformData;
if (pthread_mutex_trylock(&_lock) == 0)
{
// store current frame
SInt64 currentFrame = self.frameIndex;
UInt32 channels = self.clientFormat.mChannelsPerFrame;
BOOL interleaved = [EZAudio isInterleaved:self.clientFormat];
SInt64 totalFrames = self.totalClientFrames;
SInt64 framesPerBuffer = ((SInt64) totalFrames / numberOfPoints);
SInt64 framesPerChannel = framesPerBuffer / channels;
float **data = (float **)malloc( sizeof(float*) * channels );
SInt64 currentFrame = self.frameIndex;
BOOL interleaved = [EZAudioUtilities isInterleaved:self.clientFormat];
UInt32 channels = self.clientFormat.mChannelsPerFrame;
if (channels == 0)
{
// prevent division by zero
pthread_mutex_unlock(&_lock);
return nil;
}
float **data = (float **)malloc( sizeof(float*) * channels );
for (int i = 0; i < channels; i++)
{
data[i] = (float *)malloc( sizeof(float) * numberOfPoints );
}
// seek to 0
[EZAudio checkResult:ExtAudioFileSeek(self.info.extAudioFileRef,
0)
operation:"Failed to seek frame position within audio file"];
[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 = [EZAudio audioBufferListWithNumberOfFrames:(UInt32)totalFrames
numberOfChannels:self.info.clientFormat.mChannelsPerFrame
interleaved:interleaved];
UInt32 bufferSize = (UInt32)totalFrames;
[EZAudio checkResult:ExtAudioFileRead(self.info.extAudioFileRef,
&bufferSize,
audioBufferList)
operation:"Failed to read audio data from file waveform"];
AudioBufferList *audioBufferList = [EZAudioUtilities audioBufferListWithNumberOfFrames:(UInt32)framesPerBuffer
numberOfChannels:self.info->clientFormat.mChannelsPerFrame
interleaved:interleaved];
// read through file and calculate rms at each point
SInt64 offset = 0;
for (SInt64 i = 0; i < numberOfPoints; i++)
{
float buffer[framesPerBuffer];
UInt32 bufferSize = (UInt32) framesPerBuffer;
[EZAudioUtilities checkResult:ExtAudioFileRead(self.info->extAudioFileRef,
&bufferSize,
audioBufferList)
operation:"Failed to read audio data from file waveform"];
if (interleaved)
{
float *samples = (float *)audioBufferList->mBuffers[0].mData;
memcpy(buffer, &samples[offset], framesPerBuffer * sizeof(float));
float *buffer = (float *)audioBufferList->mBuffers[0].mData;
for (int channel = 0; channel < channels; channel++)
{
float channelData[framesPerChannel];
@@ -425,37 +456,34 @@ typedef struct
{
channelData[frame] = buffer[frame * channels + channel];
}
float rms = [EZAudio RMS:channelData length:(UInt32)framesPerChannel];
float rms = [EZAudioUtilities RMS:channelData length:(UInt32)framesPerChannel];
data[channel][i] = rms;
}
offset += channels * framesPerBuffer;
}
else
{
for (int channel = 0; channel < channels; channel++)
{
float *samples = (float *)audioBufferList->mBuffers[channel].mData;
memcpy(buffer, &samples[offset], framesPerBuffer * sizeof(float));
float rms = [EZAudio RMS:buffer length:(UInt32)framesPerBuffer];
float *channelData = audioBufferList->mBuffers[channel].mData;
float rms = [EZAudioUtilities RMS:channelData length:bufferSize];
data[channel][i] = rms;
}
offset += framesPerBuffer;
}
}
// clean up
[EZAudio freeBufferList:audioBufferList];
[EZAudioUtilities freeBufferList:audioBufferList];
// seek back to previous position
[EZAudio checkResult:ExtAudioFileSeek(self.info.extAudioFileRef,
currentFrame)
operation:"Failed to seek frame position within audio file"];
[EZAudioUtilities checkResult:ExtAudioFileSeek(self.info->extAudioFileRef,
currentFrame)
operation:"Failed to seek frame position within audio file"];
pthread_mutex_unlock(&_lock);
waveformData = [EZAudioWaveformData dataWithNumberOfChannels:channels
buffers:(float **)data
bufferSize:numberOfPoints];
waveformData = [EZAudioFloatData dataWithNumberOfChannels:channels
buffers:(float **)data
bufferSize:numberOfPoints];
// cleanup
for (int i = 0; i < channels; i++)
@@ -469,7 +497,7 @@ typedef struct
//------------------------------------------------------------------------------
- (void)getWaveformDataWithCompletionBlock:(WaveformDataCompletionBlock)waveformDataCompletionBlock
- (void)getWaveformDataWithCompletionBlock:(EZAudioWaveformDataCompletionBlock)waveformDataCompletionBlock
{
[self getWaveformDataWithNumberOfPoints:EZAudioFileWaveformDefaultResolution
completion:waveformDataCompletionBlock];
@@ -478,7 +506,7 @@ typedef struct
//------------------------------------------------------------------------------
- (void)getWaveformDataWithNumberOfPoints:(UInt32)numberOfPoints
completion:(WaveformDataCompletionBlock)completion
completion:(EZAudioWaveformDataCompletionBlock)completion
{
if (!completion)
{
@@ -486,10 +514,11 @@ typedef struct
}
// async get waveform data
__weak EZAudioFile *weakSelf = self;
dispatch_async(self.waveformQueue, ^{
EZAudioWaveformData *waveformData = [self getWaveformDataWithNumberOfPoints:numberOfPoints];
EZAudioFloatData *waveformData = [weakSelf getWaveformDataWithNumberOfPoints:numberOfPoints];
dispatch_async(dispatch_get_main_queue(), ^{
completion(waveformData);
completion(waveformData.buffers, waveformData.bufferSize);
});
});
}
@@ -498,14 +527,46 @@ typedef struct
- (AudioStreamBasicDescription)clientFormat
{
return self.info.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;
return self.info->fileFormat;
}
//------------------------------------------------------------------------------
- (NSString *)formattedCurrentTime
{
return [EZAudioUtilities displayTimeStringFromSeconds:[self currentTime]];
}
//------------------------------------------------------------------------------
- (NSString *)formattedDuration
{
return [EZAudioUtilities displayTimeStringFromSeconds:[self duration]];
}
//------------------------------------------------------------------------------
@@ -513,8 +574,8 @@ typedef struct
- (SInt64)frameIndex
{
SInt64 frameIndex;
[EZAudio checkResult:ExtAudioFileTell(self.info.extAudioFileRef, &frameIndex)
operation:"Failed to get frame index"];
[EZAudioUtilities checkResult:ExtAudioFileTell(self.info->extAudioFileRef, &frameIndex)
operation:"Failed to get frame index"];
return frameIndex;
}
@@ -523,21 +584,21 @@ typedef struct
- (NSDictionary *)metadata
{
// get size of metadata property (dictionary)
UInt32 propSize = sizeof(_info.audioFileID);
UInt32 propSize = sizeof(self.info->audioFileID);
CFDictionaryRef metadata;
UInt32 writable;
[EZAudio checkResult:AudioFileGetPropertyInfo(self.info.audioFileID,
kAudioFilePropertyInfoDictionary,
&propSize,
&writable)
operation:"Failed to get the size of the metadata dictionary"];
[EZAudioUtilities checkResult:AudioFileGetPropertyInfo(self.info->audioFileID,
kAudioFilePropertyInfoDictionary,
&propSize,
&writable)
operation:"Failed to get the size of the metadata dictionary"];
// pull metadata
[EZAudio checkResult:AudioFileGetProperty(self.info.audioFileID,
kAudioFilePropertyInfoDictionary,
&propSize,
&metadata)
operation:"Failed to get metadata dictionary"];
[EZAudioUtilities checkResult:AudioFileGetProperty(self.info->audioFileID,
kAudioFilePropertyInfoDictionary,
&propSize,
&metadata)
operation:"Failed to get metadata dictionary"];
// cast to NSDictionary
return (__bridge NSDictionary*)metadata;
@@ -547,8 +608,7 @@ typedef struct
- (NSTimeInterval)totalDuration
{
SInt64 totalFrames = [self totalFrames];
return (NSTimeInterval) totalFrames / self.info.fileFormat.mSampleRate;
return self.info->duration;
}
//------------------------------------------------------------------------------
@@ -556,17 +616,13 @@ typedef struct
- (SInt64)totalClientFrames
{
SInt64 totalFrames = [self totalFrames];
// check sample rate of client vs file format
AudioStreamBasicDescription clientFormat = self.info.clientFormat;
AudioStreamBasicDescription fileFormat = self.info.fileFormat;
AudioStreamBasicDescription clientFormat = self.info->clientFormat;
AudioStreamBasicDescription fileFormat = self.info->fileFormat;
BOOL sameSampleRate = clientFormat.mSampleRate == fileFormat.mSampleRate;
if (!sameSampleRate)
{
NSTimeInterval duration = [self totalDuration];
totalFrames = duration * clientFormat.mSampleRate;
totalFrames = self.info->duration * clientFormat.mSampleRate;
}
return totalFrames;
}
@@ -574,21 +630,14 @@ typedef struct
- (SInt64)totalFrames
{
SInt64 totalFrames;
UInt32 size = sizeof(SInt64);
[EZAudio checkResult:ExtAudioFileGetProperty(self.info.extAudioFileRef,
kExtAudioFileProperty_FileLengthFrames,
&size,
&totalFrames)
operation:"Failed to get total frames"];
return totalFrames;
return self.info->frames;
}
//------------------------------------------------------------------------------
- (NSURL*)url
- (NSURL *)url
{
return (__bridge NSURL*)self.info.sourceURL;
return (__bridge NSURL*)self.info->sourceURL;
}
//------------------------------------------------------------------------------
@@ -597,26 +646,88 @@ typedef struct
- (void)setClientFormat:(AudioStreamBasicDescription)clientFormat
{
NSAssert([EZAudio isLinearPCM:clientFormat], @"Client format must be linear PCM");
//
// Clear any float data currently cached
//
if (self.floatData)
{
self.floatData = nil;
}
// store the client format
_info.clientFormat = clientFormat;
//
// Client format can only be linear PCM!
//
NSAssert([EZAudioUtilities isLinearPCM:clientFormat], @"Client format must be linear PCM");
// set the client format on the extended audio file ref
[EZAudio checkResult:ExtAudioFileSetProperty(self.info.extAudioFileRef,
kExtAudioFileProperty_ClientDataFormat,
sizeof(clientFormat),
&clientFormat)
operation:"Couldn't set client data format on file"];
//
// 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)dealloc
- (void)setCurrentTime:(NSTimeInterval)currentTime
{
pthread_mutex_destroy(&_lock);
[EZAudio checkResult:AudioFileClose(self.info.audioFileID) operation:"Failed to close audio file"];
[EZAudio checkResult:ExtAudioFileDispose(self.info.extAudioFileRef) operation:"Failed to dispose of ext audio file"];
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]]];
}
//------------------------------------------------------------------------------
+75
View File
@@ -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
+239
View File
@@ -0,0 +1,239 @@
//
// EZAudioFloatConverter.m
// 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 "EZAudioFloatConverter.h"
#import "EZAudioUtilities.h"
//------------------------------------------------------------------------------
#pragma mark - Constants
//------------------------------------------------------------------------------
static UInt32 EZAudioFloatConverterDefaultOutputBufferSize = 128 * 32;
UInt32 const EZAudioFloatConverterDefaultPacketSize = 2048;
//------------------------------------------------------------------------------
#pragma mark - Data Structures
//------------------------------------------------------------------------------
typedef struct
{
AudioConverterRef converterRef;
AudioBufferList *floatAudioBufferList;
AudioStreamBasicDescription inputFormat;
AudioStreamBasicDescription outputFormat;
AudioStreamPacketDescription *packetDescriptions;
UInt32 packetsPerBuffer;
} EZAudioFloatConverterInfo;
//------------------------------------------------------------------------------
#pragma mark - Callbacks
//------------------------------------------------------------------------------
OSStatus EZAudioFloatConverterCallback(AudioConverterRef inAudioConverter,
UInt32 *ioNumberDataPackets,
AudioBufferList *ioData,
AudioStreamPacketDescription **outDataPacketDescription,
void *inUserData)
{
AudioBufferList *sourceBuffer = (AudioBufferList *)inUserData;
memcpy(ioData,
sourceBuffer,
sizeof(AudioBufferList) + (sourceBuffer->mNumberBuffers - 1) * sizeof(AudioBuffer));
sourceBuffer = NULL;
return noErr;
}
//------------------------------------------------------------------------------
#pragma mark - EZAudioFloatConverter (Interface Extension)
//------------------------------------------------------------------------------
@interface EZAudioFloatConverter ()
@property (nonatomic, assign) EZAudioFloatConverterInfo *info;
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioFloatConverter (Implementation)
//------------------------------------------------------------------------------
@implementation EZAudioFloatConverter
//------------------------------------------------------------------------------
#pragma mark - Class Methods
//------------------------------------------------------------------------------
+ (instancetype)converterWithInputFormat:(AudioStreamBasicDescription)inputFormat
{
return [[self alloc] initWithInputFormat:inputFormat];
}
//------------------------------------------------------------------------------
#pragma mark - Dealloc
//------------------------------------------------------------------------------
- (void)dealloc
{
AudioConverterDispose(self.info->converterRef);
[EZAudioUtilities freeBufferList:self.info->floatAudioBufferList];
free(self.info->packetDescriptions);
free(self.info);
}
//------------------------------------------------------------------------------
#pragma mark - Initialization
//------------------------------------------------------------------------------
- (instancetype)initWithInputFormat:(AudioStreamBasicDescription)inputFormat
{
self = [super init];
if (self)
{
self.info = (EZAudioFloatConverterInfo *)malloc(sizeof(EZAudioFloatConverterInfo));
memset(self.info, 0, sizeof(EZAudioFloatConverterInfo));
self.info->inputFormat = inputFormat;
[self setup];
}
return self;
}
//------------------------------------------------------------------------------
#pragma mark - Setup
//------------------------------------------------------------------------------
- (void)setup
{
// create output format
self.info->outputFormat = [EZAudioUtilities floatFormatWithNumberOfChannels:self.info->inputFormat.mChannelsPerFrame
sampleRate:self.info->inputFormat.mSampleRate];
// create a new instance of the audio converter
[EZAudioUtilities checkResult:AudioConverterNew(&self.info->inputFormat,
&self.info->outputFormat,
&self.info->converterRef)
operation:"Failed to create new audio converter"];
// get max packets per buffer so you can allocate a proper AudioBufferList
UInt32 packetsPerBuffer = 0;
UInt32 outputBufferSize = EZAudioFloatConverterDefaultOutputBufferSize;
UInt32 sizePerPacket = self.info->inputFormat.mBytesPerPacket;
BOOL isVBR = sizePerPacket == 0;
// VBR
if (isVBR)
{
// determine the max output buffer size
UInt32 maxOutputPacketSize;
UInt32 propSize = sizeof(maxOutputPacketSize);
OSStatus result = AudioConverterGetProperty(self.info->converterRef,
kAudioConverterPropertyMaximumOutputPacketSize,
&propSize,
&maxOutputPacketSize);
if (result != noErr)
{
maxOutputPacketSize = EZAudioFloatConverterDefaultPacketSize;
}
// set the output buffer size to at least the max output size
if (maxOutputPacketSize > outputBufferSize)
{
outputBufferSize = maxOutputPacketSize;
}
packetsPerBuffer = outputBufferSize / maxOutputPacketSize;
// allocate memory for the packet descriptions
self.info->packetDescriptions = (AudioStreamPacketDescription *)malloc(sizeof(AudioStreamPacketDescription) * packetsPerBuffer);
}
else
{
packetsPerBuffer = outputBufferSize / sizePerPacket;
}
self.info->packetsPerBuffer = packetsPerBuffer;
// allocate the AudioBufferList to hold the float values
BOOL isInterleaved = [EZAudioUtilities isInterleaved:self.info->outputFormat];
self.info->floatAudioBufferList = [EZAudioUtilities audioBufferListWithNumberOfFrames:packetsPerBuffer
numberOfChannels:self.info->outputFormat.mChannelsPerFrame
interleaved:isInterleaved];
}
//------------------------------------------------------------------------------
#pragma mark - Events
//------------------------------------------------------------------------------
- (void)convertDataFromAudioBufferList:(AudioBufferList *)audioBufferList
withNumberOfFrames:(UInt32)frames
toFloatBuffers:(float **)buffers
{
[self convertDataFromAudioBufferList:audioBufferList
withNumberOfFrames:frames
toFloatBuffers:buffers
packetDescriptions:self.info->packetDescriptions];
}
//------------------------------------------------------------------------------
- (void)convertDataFromAudioBufferList:(AudioBufferList *)audioBufferList
withNumberOfFrames:(UInt32)frames
toFloatBuffers:(float **)buffers
packetDescriptions:(AudioStreamPacketDescription *)packetDescriptions
{
if (frames != 0)
{
//
// Make sure the data size coming in is consistent with the number
// of frames we're actually getting
//
for (int i = 0; i < audioBufferList->mNumberBuffers; i++) {
audioBufferList->mBuffers[i].mDataByteSize = frames * self.info->inputFormat.mBytesPerFrame;
}
//
// Fill out the audio converter with the source buffer
//
[EZAudioUtilities checkResult:AudioConverterFillComplexBuffer(self.info->converterRef,
EZAudioFloatConverterCallback,
audioBufferList,
&frames,
self.info->floatAudioBufferList,
packetDescriptions ? packetDescriptions : self.info->packetDescriptions)
operation:"Failed to fill complex buffer in float converter"];
//
// Copy the converted buffers into the float buffer array stored
// in memory
//
for (int i = 0; i < self.info->floatAudioBufferList->mNumberBuffers; i++)
{
memcpy(buffers[i],
self.info->floatAudioBufferList->mBuffers[i].mData,
self.info->floatAudioBufferList->mBuffers[i].mDataByteSize);
}
}
}
//------------------------------------------------------------------------------
@end
+52
View File
@@ -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
+85
View File
@@ -0,0 +1,85 @@
//
// EZAudioFloatData.m
// 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 "EZAudioFloatData.h"
#import "EZAudioUtilities.h"
//------------------------------------------------------------------------------
#pragma mark - EZAudioFloatData
//------------------------------------------------------------------------------
@interface EZAudioFloatData ()
@property (nonatomic, assign, readwrite) int numberOfChannels;
@property (nonatomic, assign, readwrite) float **buffers;
@property (nonatomic, assign, readwrite) UInt32 bufferSize;
@end
//------------------------------------------------------------------------------
@implementation EZAudioFloatData
//------------------------------------------------------------------------------
- (void)dealloc
{
[EZAudioUtilities freeFloatBuffers:self.buffers
numberOfChannels:self.numberOfChannels];
}
//------------------------------------------------------------------------------
+ (instancetype)dataWithNumberOfChannels:(int)numberOfChannels
buffers:(float **)buffers
bufferSize:(UInt32)bufferSize
{
id data = [[self alloc] init];
size_t size = sizeof(float) * bufferSize;
float **buffersCopy = [EZAudioUtilities floatBuffersWithNumberOfFrames:bufferSize
numberOfChannels:numberOfChannels];
for (int i = 0; i < numberOfChannels; i++)
{
memcpy(buffersCopy[i], buffers[i], size);
}
((EZAudioFloatData *)data).buffers = buffersCopy;
((EZAudioFloatData *)data).bufferSize = bufferSize;
((EZAudioFloatData *)data).numberOfChannels = numberOfChannels;
return data;
}
//------------------------------------------------------------------------------
- (float *)bufferForChannel:(int)channel
{
float *buffer = NULL;
if (channel < self.numberOfChannels)
{
buffer = self.buffers[channel];
}
return buffer;
}
//------------------------------------------------------------------------------
@end
@@ -1,9 +1,9 @@
//
// main.m
// EZAudioWaveformFromFileExample
// EZAudioOSX.m
// EZAudio
//
// Created by Syed Haris Ali on 12/1/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
// Created by Tommaso Piazza on 30/09/15.
// Copyright © 2015 Andrew Breckenridge. 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,9 +23,4 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Cocoa/Cocoa.h>
int main(int argc, const char * argv[])
{
return NSApplicationMain(argc, argv);
}
#import <EZAudioOSX/EZAudio.h>
+251 -107
View File
@@ -25,43 +25,77 @@
#import <Foundation/Foundation.h>
#import "TargetConditionals.h"
#import "EZAudio.h"
#if TARGET_OS_IPHONE
#import <AVFoundation/AVFoundation.h>
#elif TARGET_OS_MAC
#endif
#import "EZAudioFile.h"
#import "EZOutput.h"
@class EZAudioPlayer;
//------------------------------------------------------------------------------
#pragma mark - Data Structures
//------------------------------------------------------------------------------
typedef NS_ENUM(NSUInteger, EZAudioPlayerState)
{
EZAudioPlayerStateEndOfFile,
EZAudioPlayerStatePaused,
EZAudioPlayerStatePlaying,
EZAudioPlayerStateReadyToPlay,
EZAudioPlayerStateSeeking,
EZAudioPlayerStateUnknown,
};
//------------------------------------------------------------------------------
#pragma mark - Notifications
//------------------------------------------------------------------------------
/**
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).
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 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.
@@ -71,11 +105,13 @@
@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
- (void) audioPlayer:(EZAudioPlayer *)audioPlayer
playedAudio:(float **)buffer
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels
inAudioFile:(EZAudioFile*)audioFile;;
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.
@@ -83,18 +119,36 @@
@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;
- (void)audioPlayer:(EZAudioPlayer *)audioPlayer
updatedPosition:(SInt64)framePosition
inAudioFile:(EZAudioFile *)audioFile;
/**
Triggered by EZAudioPlayer's internal EZAudioFile's EZAudioFileDelegate callback and notifies the delegate that the end of the file has been reached.
@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;
@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 - 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
///-----------------------------------------------------------
@@ -102,14 +156,26 @@
/**
The EZAudioPlayerDelegate that will handle the audio player callbacks
*/
@property (nonatomic,assign) id<EZAudioPlayerDelegate> audioPlayerDelegate;
@property (nonatomic, weak) id<EZAudioPlayerDelegate> delegate;
//------------------------------------------------------------------------------
/**
A BOOL indicating whether the player should loop the file
*/
@property (nonatomic,assign) BOOL shouldLoop;
@property (nonatomic, assign) BOOL shouldLoop;
//------------------------------------------------------------------------------
/**
An EZAudioPlayerState value representing the current internal playback and file state of the EZAudioPlayer instance.
*/
@property (nonatomic, assign, readonly) EZAudioPlayerState state;
//------------------------------------------------------------------------------
#pragma mark - Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Initializers
///-----------------------------------------------------------
@@ -119,72 +185,114 @@
@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;
- (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 audioPlayerDelegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the initWithEZAudioFile: function instead.
@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
*/
-(EZAudioPlayer*)initWithEZAudioFile:(EZAudioFile*)audioFile
withDelegate:(id<EZAudioPlayerDelegate>)audioPlayerDelegate;
- (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
*/
-(EZAudioPlayer*)initWithURL:(NSURL*)url;
- (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 audioPlayerDelegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the initWithEZAudioFile: function instead.
@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
*/
-(EZAudioPlayer*)initWithURL:(NSURL*)url
withDelegate:(id<EZAudioPlayerDelegate>)audioPlayerDelegate;
- (instancetype)initWithURL:(NSURL*)url
delegate:(id<EZAudioPlayerDelegate>)delegate;
//------------------------------------------------------------------------------
#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.
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
*/
+(EZAudioPlayer*)audioPlayerWithEZAudioFile:(EZAudioFile*)audioFile;
+ (instancetype)audioPlayerWithAudioFile:(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.
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 audioPlayerDelegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the audioPlayerWithEZAudioFile: function instead.
@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
*/
+(EZAudioPlayer*)audioPlayerWithEZAudioFile:(EZAudioFile*)audioFile
withDelegate:(id<EZAudioPlayerDelegate>)audioPlayerDelegate;
+ (instancetype)audioPlayerWithAudioFile:(EZAudioFile *)audioFile
delegate:(id<EZAudioPlayerDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Class initializer that initializes the EZAudioPlayer with an NSURL instance representing the file path of the audio file.
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
*/
+(EZAudioPlayer*)audioPlayerWithURL:(NSURL*)url;
+ (instancetype)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.
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 audioPlayerDelegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the audioPlayerWithURL: function instead.
@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
*/
+(EZAudioPlayer*)audioPlayerWithURL:(NSURL*)url
withDelegate:(id<EZAudioPlayerDelegate>)audioPlayerDelegate;
+ (instancetype)audioPlayerWithURL:(NSURL*)url
delegate:(id<EZAudioPlayerDelegate>)delegate;
//------------------------------------------------------------------------------
#pragma mark - Singleton
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Shared Instance
///-----------------------------------------------------------
@@ -193,108 +301,144 @@
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;
+ (instancetype)sharedAudioPlayer;
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
#pragma mark - Getters
///-----------------------------------------------------------
/// @name Getting The Audio Player's Properties
/// @name 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.
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.
*/
-(EZAudioFile*)audioFile;
@property (nonatomic, readwrite, copy) 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.
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.
*/
-(float)currentTime;
@property (nonatomic, readwrite) NSTimeInterval 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.
The EZAudioDevice instance that is being used by the `output`. Similarly, setting this just sets the `device` property of the `output`.
*/
-(BOOL)endOfFile;
@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.
*/
-(SInt64)frameIndex;
@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,
*/
-(BOOL)isPlaying;
@property (readonly) 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.
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).
*/
-(EZOutput*)output;
@property (nonatomic, assign) float pan;
/**
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;
@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.
*/
-(NSURL*)url;
@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
//------------------------------------------------------------------------------
#pragma mark - Setters
///-----------------------------------------------------------
/// @name Setting The File/Output
/// @name Controlling Playback
///-----------------------------------------------------------
/**
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
Starts playback.
*/
-(void)setAudioFile:(EZAudioFile*)audioFile;
- (void)play;
//------------------------------------------------------------------------------
/**
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
Loads an EZAudioFile and immediately starts playing it.
@param audioFile An EZAudioFile to use for immediate playback.
*/
-(void)setOutput:(EZOutput*)output;
- (void)playAudioFile:(EZAudioFile *)audioFile;
#pragma mark - Methods
///-----------------------------------------------------------
/// @name Play/Pause/Seeking the Player
///-----------------------------------------------------------
/**
Starts or resumes playback.
*/
-(void)play;
//------------------------------------------------------------------------------
/**
Pauses playback.
*/
-(void)pause;
- (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;
- (void)seekToFrame:(SInt64)frame;
@end
+353 -190
View File
@@ -24,273 +24,436 @@
// 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;
//------------------------------------------------------------------------------
#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 (Interface Extension)
//------------------------------------------------------------------------------
@interface EZAudioPlayer ()
@property (nonatomic, assign, readwrite) EZAudioPlayerState state;
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlayer (Implementation)
//------------------------------------------------------------------------------
@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;
//------------------------------------------------------------------------------
#pragma mark - Class Methods
//------------------------------------------------------------------------------
+ (instancetype)audioPlayer
{
return [[self alloc] init];
}
-(EZAudioPlayer*)initWithEZAudioFile:(EZAudioFile *)audioFile {
return [self initWithEZAudioFile:audioFile withDelegate:nil];
//------------------------------------------------------------------------------
+ (instancetype)audioPlayerWithDelegate:(id<EZAudioPlayerDelegate>)delegate
{
return [[self alloc] initWithDelegate:delegate];
}
-(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;
//------------------------------------------------------------------------------
+ (instancetype)audioPlayerWithAudioFile:(EZAudioFile *)audioFile
{
return [[self alloc] initWithAudioFile:audioFile];
}
-(EZAudioPlayer *)initWithURL:(NSURL *)url {
return [self initWithURL:url withDelegate:nil];
//------------------------------------------------------------------------------
+ (instancetype)audioPlayerWithAudioFile:(EZAudioFile *)audioFile
delegate:(id<EZAudioPlayerDelegate>)delegate
{
return [[self alloc] initWithAudioFile:audioFile
delegate:delegate];
}
-(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;
//------------------------------------------------------------------------------
+ (instancetype)audioPlayerWithURL:(NSURL *)url
{
return [[self alloc] initWithURL:url];
}
#pragma mark - Class Initializers
+(EZAudioPlayer *)audioPlayerWithEZAudioFile:(EZAudioFile *)audioFile {
return [[EZAudioPlayer alloc] initWithEZAudioFile:audioFile];
//------------------------------------------------------------------------------
+ (instancetype)audioPlayerWithURL:(NSURL *)url
delegate:(id<EZAudioPlayerDelegate>)delegate
{
return [[self alloc] initWithURL:url delegate:delegate];
}
+(EZAudioPlayer *)audioPlayerWithEZAudioFile:(EZAudioFile *)audioFile
withDelegate:(id<EZAudioPlayerDelegate>)audioPlayerDelegate {
return [[EZAudioPlayer alloc] initWithEZAudioFile:audioFile
withDelegate:audioPlayerDelegate];
//------------------------------------------------------------------------------
#pragma mark - Initialization
//------------------------------------------------------------------------------
- (instancetype)init
{
self = [super init];
if (self)
{
[self setup];
}
return self;
}
+(EZAudioPlayer *)audioPlayerWithURL:(NSURL *)url {
return [[EZAudioPlayer alloc] initWithURL:url];
//------------------------------------------------------------------------------
- (instancetype)initWithDelegate:(id<EZAudioPlayerDelegate>)delegate
{
self = [self init];
if (self)
{
self.delegate = delegate;
}
return self;
}
+(EZAudioPlayer *)audioPlayerWithURL:(NSURL *)url
withDelegate:(id<EZAudioPlayerDelegate>)audioPlayerDelegate {
return [[EZAudioPlayer alloc] initWithURL:url
withDelegate:audioPlayerDelegate];
//------------------------------------------------------------------------------
- (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
+(EZAudioPlayer *)sharedAudioPlayer {
static EZAudioPlayer *_sharedAudioPlayer = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedAudioPlayer = [[EZAudioPlayer alloc] init];
});
return _sharedAudioPlayer;
//------------------------------------------------------------------------------
+ (instancetype)sharedAudioPlayer
{
static EZAudioPlayer *player;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^
{
player = [[self alloc] init];
});
return player;
}
#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 - Setup
//------------------------------------------------------------------------------
- (void)setup
{
self.output = [EZOutput output];
self.state = EZAudioPlayerStateReadyToPlay;
}
//------------------------------------------------------------------------------
#pragma mark - Getters
-(EZAudioFile*)audioFile {
return _audioFile;
//------------------------------------------------------------------------------
- (NSTimeInterval)currentTime
{
return [self.audioFile currentTime];
}
-(float)currentTime {
NSAssert(_audioFile,@"No audio file to perform the seek on, check that EZAudioFile is not nil");
return [EZAudio MAP:self.audioFile.frameIndex
leftMin:0
leftMax:self.audioFile.totalFrames
rightMin:0
rightMax:self.audioFile.totalDuration];
//------------------------------------------------------------------------------
- (EZAudioDevice *)device
{
return [self.output device];
}
-(BOOL)endOfFile {
return _eof;
//------------------------------------------------------------------------------
- (NSTimeInterval)duration
{
return [self.audioFile duration];
}
-(SInt64)frameIndex {
NSAssert(_audioFile,@"No audio file to perform the seek on, check that EZAudioFile is not nil");
return _audioFile.frameIndex;
//------------------------------------------------------------------------------
- (NSString *)formattedCurrentTime
{
return [self.audioFile formattedCurrentTime];
}
-(BOOL)isPlaying {
return self.output.isPlaying;
//------------------------------------------------------------------------------
- (NSString *)formattedDuration
{
return [self.audioFile formattedDuration];
}
-(EZOutput*)output {
NSAssert(_output,@"No output was found, this should by default be the EZOutput shared instance");
return _output;
//------------------------------------------------------------------------------
- (SInt64)frameIndex
{
return [self.audioFile frameIndex];
}
-(float)totalDuration {
NSAssert(_audioFile,@"No audio file to perform the seek on, check that EZAudioFile is not nil");
return _audioFile.totalDuration;
//------------------------------------------------------------------------------
- (BOOL)isPlaying
{
return [self.output isPlaying];
}
-(SInt64)totalFrames {
NSAssert(_audioFile,@"No audio file to perform the seek on, check that EZAudioFile is not nil");
return _audioFile.totalFrames;
//------------------------------------------------------------------------------
- (float)pan
{
return [self.output pan];
}
-(NSURL *)url {
NSAssert(_audioFile,@"No audio file to perform the seek on, check that EZAudioFile is not nil");
return _audioFile.url;
//------------------------------------------------------------------------------
- (SInt64)totalFrames
{
return [self.audioFile totalFrames];
}
//------------------------------------------------------------------------------
- (float)volume
{
return [self.output volume];
}
//------------------------------------------------------------------------------
#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)setAudioFile:(EZAudioFile *)audioFile
{
_audioFile = [audioFile copy];
_audioFile.delegate = self;
AudioStreamBasicDescription inputFormat = _audioFile.clientFormat;
[self.output setInputFormat:inputFormat];
[[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidChangeAudioFileNotification
object:self];
}
-(void)setOutput:(EZOutput*)output {
_output = output;
_output.outputDataSource = self;
//------------------------------------------------------------------------------
- (void)setCurrentTime:(NSTimeInterval)currentTime
{
[self.audioFile setCurrentTime:currentTime];
[[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidSeekNotification
object: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)setDevice:(EZAudioDevice *)device
{
[self.output setDevice:device];
}
-(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)setOutput:(EZOutput *)output
{
_output = output;
_output.dataSource = self;
_output.delegate = self;
}
-(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)setPan:(float)pan
{
[self.output setPan:pan];
[[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidChangePanNotification
object:self];
}
-(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;
}
//------------------------------------------------------------------------------
- (void)setVolume:(float)volume
{
[self.output setVolume:volume];
[[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidChangeVolumeNotification
object:self];
}
#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];
}
}
//------------------------------------------------------------------------------
#pragma mark - Actions
//------------------------------------------------------------------------------
- (void)play
{
[self.output startPlayback];
self.state = EZAudioPlayerStatePlaying;
}
-(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];
}
}
//------------------------------------------------------------------------------
- (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];
self.state = EZAudioPlayerStatePaused;
}
//------------------------------------------------------------------------------
- (void)seekToFrame:(SInt64)frame
{
self.state = EZAudioPlayerStateSeeking;
[self.audioFile seekToFrame:frame];
self.state = self.isPlaying ? EZAudioPlayerStatePlaying : EZAudioPlayerStatePaused;
[[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidSeekNotification
object:self];
}
//------------------------------------------------------------------------------
#pragma mark - EZOutputDataSource
-(void) output:(EZOutput *)output
//------------------------------------------------------------------------------
- (OSStatus) output:(EZOutput *)output
shouldFillAudioBufferList:(AudioBufferList *)audioBufferList
withNumberOfFrames:(UInt32)frames
timestamp:(const AudioTimeStamp *)timestamp
{
if( self.audioFile )
if (self.audioFile)
{
UInt32 bufferSize;
BOOL eof;
[self.audioFile readFrames:frames
audioBufferList:audioBufferList
bufferSize:&bufferSize
eof:&_eof];
if( _eof && self.shouldLoop )
eof:&eof];
if (eof && [self.delegate respondsToSelector:@selector(audioPlayer:reachedEndOfAudioFile:)])
{
[self.delegate audioPlayer:self reachedEndOfAudioFile:self.audioFile];
}
if (eof && self.shouldLoop)
{
[self seekToFrame:0];
}
else if (eof)
{
[self pause];
[self seekToFrame:0];
self.state = EZAudioPlayerStateEndOfFile;
[[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidReachEndOfFileNotification
object:self];
}
}
return noErr;
}
//------------------------------------------------------------------------------
#pragma mark - EZAudioFileDelegate
//------------------------------------------------------------------------------
- (void)audioFileUpdatedPosition:(EZAudioFile *)audioFile
{
if ([self.delegate respondsToSelector:@selector(audioPlayer:updatedPosition:inAudioFile:)])
{
[self.delegate audioPlayer:self
updatedPosition:[audioFile frameIndex]
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
+141 -16
View File
@@ -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
@@ -23,14 +23,53 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "TargetConditionals.h"
#import <QuartzCore/QuartzCore.h>
#import "EZPlot.h"
#import "EZAudioDisplayLink.h"
@class EZAudio;
#define kEZAudioPlotMaxHistoryBufferLength (8192)
//------------------------------------------------------------------------------
#pragma mark - Constants
//------------------------------------------------------------------------------
#define kEZAudioPlotDefaultHistoryBufferLength (1024)
/**
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.
@@ -46,37 +85,123 @@
*/
@interface EZAudioPlot : EZPlot
{
CGPoint *plotData;
UInt32 plotLength;
}
/**
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 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.
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 kEZAudioPlotMaxHistoryBufferLength.
@return The new value equal to the historyLength or the `maximumRollingHistoryLength`.
*/
-(int)setRollingHistoryLength:(int)historyLength;
//------------------------------------------------------------------------------
/**
Provides the length of the rolling history buffer
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
///-----------------------------------------------------------
/**
<#Description#>
@param data <#theplotData description#>
@param length <#length description#>
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.
*/
-(void)setSampleData:(float *)data
length:(int)length;
- (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;
//------------------------------------------------------------------------------
/**
Called after the view has been created. Subclasses should use to add any additional methods needed instead of overriding the init methods.
*/
- (void)setupPlot;
//------------------------------------------------------------------------------
/**
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
@interface EZAudioPlot () <EZAudioDisplayLinkDelegate>
@property (nonatomic, strong) EZAudioDisplayLink *displayLink;
@property (nonatomic, assign) EZPlotHistoryInfo *historyInfo;
@property (nonatomic, assign) CGPoint *points;
@property (nonatomic, assign) UInt32 pointCount;
@end
+404 -249
View File
@@ -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
@@ -25,274 +25,429 @@
#import "EZAudioPlot.h"
#import "EZAudio.h"
//------------------------------------------------------------------------------
#pragma mark - Constants
//------------------------------------------------------------------------------
@interface EZAudioPlot () {
// BOOL _hasData;
// TPCircularBuffer _historyBuffer;
UInt32 const kEZAudioPlotMaxHistoryBufferLength = 8192;
UInt32 const kEZAudioPlotDefaultHistoryBufferLength = 512;
UInt32 const EZAudioPlotDefaultHistoryBufferLength = 512;
UInt32 const EZAudioPlotDefaultMaxHistoryBufferLength = 8192;
// Rolling History
BOOL _setMaxLength;
float *_scrollHistory;
int _scrollHistoryIndex;
UInt32 _scrollHistoryLength;
BOOL _changingHistorySize;
}
@end
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlot (Implementation)
//------------------------------------------------------------------------------
@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;
}
//------------------------------------------------------------------------------
#pragma mark - Dealloc
//------------------------------------------------------------------------------
-(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
[EZAudio 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
- (void)dealloc
{
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextSaveGState(ctx);
CGRect frame = self.bounds;
[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
- (void)drawRect:(NSRect)dirtyRect
{
[[NSGraphicsContext currentContext] saveGraphicsState];
NSGraphicsContext * nsGraphicsContext = [NSGraphicsContext currentContext];
CGContextRef ctx = (CGContextRef) [nsGraphicsContext graphicsPort];
NSRect frame = self.bounds;
- (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
// Set the background color
[(UIColor*)self.backgroundColor set];
UIRectFill(frame);
// Set the waveform line color
[(UIColor*)self.color set];
self.color = [UIColor colorWithHue:0 saturation:1.0 brightness:1.0 alpha:1.0];
#elif TARGET_OS_MAC
[(NSColor*)self.backgroundColor set];
NSRectFill(frame);
[(NSColor*)self.color set];
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];
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);
//
// Allow subclass to initialize plot
//
[self setupPlot];
self.points = calloc(EZAudioPlotDefaultMaxHistoryBufferLength, sizeof(CGPoint));
self.pointCount = [self initialPointCount];
[self redraw];
}
//------------------------------------------------------------------------------
- (void)setupPlot
{
//
// Override in subclass
//
}
//------------------------------------------------------------------------------
#pragma mark - Setup
//------------------------------------------------------------------------------
- (void)resetHistoryBuffers
{
//
// Clear any existing data
//
if (self.historyInfo)
{
[EZAudioUtilities freeHistoryInfo:self.historyInfo];
}
#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;
self.historyInfo = [EZAudioUtilities historyInfoWithDefaultLength:[self defaultRollingHistoryLength]
maximumLength:[self maximumRollingHistoryLength]];
}
-(int)rollingHistoryLength {
return _scrollHistoryLength;
//------------------------------------------------------------------------------
#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 appendBufferRMS:buffer
withBufferSize:bufferSize
toHistoryInfo:self.historyInfo];
-(void)dealloc {
if( plotData ){
free(plotData);
}
// 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
+156 -88
View File
@@ -3,7 +3,7 @@
// EZAudio
//
// Created by Syed Haris Ali on 11/22/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
@@ -23,126 +23,134 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import "TargetConditionals.h"
#import <GLKit/GLKit.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>
#if !TARGET_OS_IPHONE
#import <OpenGL/OpenGL.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 - Data Structures
//------------------------------------------------------------------------------
#pragma mark - Structures
/**
A structure describing a 2D point (x,y) in space for an audio plot.
*/
typedef struct {
GLfloat x;
GLfloat y;
typedef struct
{
GLfloat x;
GLfloat y;
} EZAudioPlotGLPoint;
//------------------------------------------------------------------------------
#pragma mark - EZAudioPlotGL
//------------------------------------------------------------------------------
/**
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:`
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 : EZPlot
@interface EZAudioPlotGL : GLKView
#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.
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 color;
#if TARGET_OS_IPHONE
@property (nonatomic, strong) IBInspectable UIColor *backgroundColor;
#elif TARGET_OS_MAC
@property (nonatomic, strong) IBInspectable NSColor *backgroundColor;
#endif
//------------------------------------------------------------------------------
/**
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.
*/
#if TARGET_OS_IPHONE
@property (nonatomic, strong) IBInspectable UIColor *color;
#elif TARGET_OS_MAC
@property (nonatomic, strong) IBInspectable NSColor *color;
#endif
//------------------------------------------------------------------------------
/**
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;
@property (nonatomic, assign) IBInspectable float gain;
//------------------------------------------------------------------------------
/**
The type of plot as specified by the `EZPlotType` enumeration (i.e. a buffer or rolling plot type).
The type of plot as specified by the `EZPlotType` enumeration (i.e. a buffer or rolling plot type). Default is EZPlotTypeBuffer.
*/
@property (nonatomic,assign,setter=setPlotType:) EZPlotType plotType;
@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).
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,setter=setShouldFill:) BOOL shouldFill;
@property (nonatomic, assign) IBInspectable 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.
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,setter=setShouldMirror:) BOOL shouldMirror;
@property (nonatomic, assign) IBInspectable BOOL shouldMirror;
//------------------------------------------------------------------------------
#pragma mark - Updating The Plot
//------------------------------------------------------------------------------
#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
-(void)updateBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize;
//------------------------------------------------------------------------------
#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.
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 kEZAudioPlotMaxHistoryBufferLength.
@return The new value equal to the historyLength or the `maximumRollingHistoryLength`.
*/
-(int)setRollingHistoryLength:(int)historyLength;
//------------------------------------------------------------------------------
/**
Provides the length of the rolling history buffer
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 - Shared Methods
//------------------------------------------------------------------------------
#pragma mark - Clearing The Plot
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Clearing The Plot
///-----------------------------------------------------------
@@ -152,32 +160,92 @@ typedef struct {
*/
-(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;
//------------------------------------------------------------------------------
#pragma mark - Start/Stop Display Link
//------------------------------------------------------------------------------
/**
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.
Call this method to tell the EZAudioDisplayLink to stop drawing temporarily.
*/
+(UInt32)graphSizeForDrawingType:(EZAudioPlotGLDrawType)drawingType
withBufferSize:(UInt32)bufferSize;
- (void)pauseDrawing;
@end
//------------------------------------------------------------------------------
/**
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;
//------------------------------------------------------------------------------
/**
Called during the OpenGL run loop to constantly update the drawing 60 fps. Callers can use this force update the screen while subclasses can override this for complete control over their rendering. However, subclasses are more encouraged to use the `redrawWithPoints:pointCount:baseEffect:vertexBufferObject:vertexArrayBuffer:interpolated:mirrored:gain:`
*/
- (void)redraw;
//------------------------------------------------------------------------------
/**
Called after the view has been created. Subclasses should use to add any additional methods needed instead of overriding the init methods.
*/
- (void)setup;
//------------------------------------------------------------------------------
/**
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;
///-----------------------------------------------------------
/// @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
+488 -711
View File
File diff suppressed because it is too large Load Diff
-127
View File
@@ -1,127 +0,0 @@
//
// EZAudioPlotGLKViewController.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"
#if TARGET_OS_IPHONE
#import "EZAudioPlotGL.h"
@class EZAudio;
/**
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.
*/
@interface EZAudioPlotGLKViewController : GLKViewController
#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;
/**
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;
/**
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 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
///-----------------------------------------------------------
/**
Clears all data from the audio plot (includes both EZPlotTypeBuffer and EZPlotTypeRolling)
*/
-(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.
@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;
@end
#elif TARGET_OS_MAC
#endif
-483
View File
@@ -1,483 +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 "EZAudio.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;
// 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
[EZAudio 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
[EZAudio 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
+549
View File
@@ -0,0 +1,549 @@
//
// 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>
#elif TARGET_OS_MAC
#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)sampleRate;
//------------------------------------------------------------------------------
// @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 - Music Utilities
//------------------------------------------------------------------------------
+ (NSString *)noteNameStringForFrequency:(float)frequency
includeOctave:(BOOL)includeOctave;
//------------------------------------------------------------------------------
#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)appendBufferRMS:(float *)buffer
withBufferSize:(UInt32)bufferSize
toHistoryInfo:(EZPlotHistoryInfo *)historyInfo;
//------------------------------------------------------------------------------
/**
Appends a buffer of audio data 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
+744
View File
@@ -0,0 +1,744 @@
//
// EZAudioUtilities.m
// 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 "EZAudioUtilities.h"
static float const EZAudioUtilitiesFixedNoteA = 440.0f;
static int const EZAudioUtilitiesFixedNoteAIndex = 9;
static int const EZAudioUtilitiesFixedNoteAOctave = 4;
static float const EZAudioUtilitiesEQFrequencyRatio = 1.059463094359f;
static int const EZAudioUtilitiesNotesLength = 12;
static NSString * const EZAudioUtilitiesNotes[EZAudioUtilitiesNotesLength] =
{
@"C", @"C#",
@"D", @"D#",
@"E",
@"F", @"F#",
@"G", @"G#",
@"A", @"A#",
@"B"
};
BOOL __shouldExitOnCheckResultFail = YES;
@implementation EZAudioUtilities
//------------------------------------------------------------------------------
#pragma mark - Debugging
//------------------------------------------------------------------------------
+ (void)setShouldExitOnCheckResultFail:(BOOL)shouldExitOnCheckResultFail
{
__shouldExitOnCheckResultFail = shouldExitOnCheckResultFail;
}
//------------------------------------------------------------------------------
+ (BOOL)shouldExitOnCheckResultFail
{
return __shouldExitOnCheckResultFail;
}
//------------------------------------------------------------------------------
#pragma mark - AudioBufferList Utility
//------------------------------------------------------------------------------
+ (AudioBufferList *)audioBufferListWithNumberOfFrames:(UInt32)frames
numberOfChannels:(UInt32)channels
interleaved:(BOOL)interleaved
{
unsigned nBuffers;
unsigned bufferSize;
unsigned channelsPerBuffer;
if (interleaved)
{
nBuffers = 1;
bufferSize = sizeof(float) * frames * channels;
channelsPerBuffer = channels;
}
else
{
nBuffers = channels;
bufferSize = sizeof(float) * frames;
channelsPerBuffer = 1;
}
AudioBufferList *audioBufferList = (AudioBufferList *)malloc(sizeof(AudioBufferList) + sizeof(AudioBuffer) * (channels-1));
audioBufferList->mNumberBuffers = nBuffers;
for(unsigned i = 0; i < nBuffers; i++)
{
audioBufferList->mBuffers[i].mNumberChannels = channelsPerBuffer;
audioBufferList->mBuffers[i].mDataByteSize = bufferSize;
audioBufferList->mBuffers[i].mData = calloc(bufferSize, 1);
}
return audioBufferList;
}
//------------------------------------------------------------------------------
+ (float **)floatBuffersWithNumberOfFrames:(UInt32)frames
numberOfChannels:(UInt32)channels
{
size_t size = sizeof(float *) * channels;
float **buffers = (float **)malloc(size);
for (int i = 0; i < channels; i++)
{
size = sizeof(float) * frames;
buffers[i] = (float *)malloc(size);
}
return buffers;
}
//------------------------------------------------------------------------------
+ (void)freeBufferList:(AudioBufferList *)bufferList
{
if (bufferList)
{
if (bufferList->mNumberBuffers)
{
for( int i = 0; i < bufferList->mNumberBuffers; i++)
{
if (bufferList->mBuffers[i].mData)
{
free(bufferList->mBuffers[i].mData);
}
}
}
free(bufferList);
}
bufferList = NULL;
}
//------------------------------------------------------------------------------
+ (void)freeFloatBuffers:(float **)buffers numberOfChannels:(UInt32)channels
{
if (!buffers || !*buffers)
{
return;
}
for (int i = 0; i < channels; i++)
{
free(buffers[i]);
}
free(buffers);
}
//------------------------------------------------------------------------------
#pragma mark - AudioStreamBasicDescription Utility
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)AIFFFormatWithNumberOfChannels:(UInt32)channels
sampleRate:(float)sampleRate
{
AudioStreamBasicDescription asbd;
memset(&asbd, 0, sizeof(asbd));
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mFormatFlags = kAudioFormatFlagIsBigEndian|kAudioFormatFlagIsPacked|kAudioFormatFlagIsSignedInteger;
asbd.mSampleRate = sampleRate;
asbd.mChannelsPerFrame = channels;
asbd.mBitsPerChannel = 32;
asbd.mBytesPerPacket = (asbd.mBitsPerChannel / 8) * asbd.mChannelsPerFrame;
asbd.mFramesPerPacket = 1;
asbd.mBytesPerFrame = (asbd.mBitsPerChannel / 8) * asbd.mChannelsPerFrame;
return asbd;
}
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)iLBCFormatWithSampleRate:(float)sampleRate
{
AudioStreamBasicDescription asbd;
memset(&asbd, 0, sizeof(asbd));
asbd.mFormatID = kAudioFormatiLBC;
asbd.mChannelsPerFrame = 1;
asbd.mSampleRate = sampleRate;
// Fill in the rest of the descriptions using the Audio Format API
UInt32 propSize = sizeof(asbd);
[EZAudioUtilities checkResult:AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
0,
NULL,
&propSize,
&asbd)
operation:"Failed to fill out the rest of the iLBC AudioStreamBasicDescription"];
return asbd;
}
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)floatFormatWithNumberOfChannels:(UInt32)channels
sampleRate:(float)sampleRate
{
AudioStreamBasicDescription asbd;
UInt32 floatByteSize = sizeof(float);
asbd.mBitsPerChannel = 8 * floatByteSize;
asbd.mBytesPerFrame = floatByteSize;
asbd.mBytesPerPacket = floatByteSize;
asbd.mChannelsPerFrame = channels;
asbd.mFormatFlags = kAudioFormatFlagIsFloat|kAudioFormatFlagIsNonInterleaved;
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mFramesPerPacket = 1;
asbd.mSampleRate = sampleRate;
return asbd;
}
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)M4AFormatWithNumberOfChannels:(UInt32)channels
sampleRate:(float)sampleRate
{
AudioStreamBasicDescription asbd;
memset(&asbd, 0, sizeof(asbd));
asbd.mFormatID = kAudioFormatMPEG4AAC;
asbd.mChannelsPerFrame = channels;
asbd.mSampleRate = sampleRate;
// Fill in the rest of the descriptions using the Audio Format API
UInt32 propSize = sizeof(asbd);
[EZAudioUtilities checkResult:AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
0,
NULL,
&propSize,
&asbd)
operation:"Failed to fill out the rest of the m4a AudioStreamBasicDescription"];
return asbd;
}
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)monoFloatFormatWithSampleRate:(float)sampleRate
{
AudioStreamBasicDescription asbd;
UInt32 byteSize = sizeof(float);
asbd.mBitsPerChannel = 8 * byteSize;
asbd.mBytesPerFrame = byteSize;
asbd.mBytesPerPacket = byteSize;
asbd.mChannelsPerFrame = 1;
asbd.mFormatFlags = kAudioFormatFlagIsPacked|kAudioFormatFlagIsFloat;
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mFramesPerPacket = 1;
asbd.mSampleRate = sampleRate;
return asbd;
}
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)monoCanonicalFormatWithSampleRate:(float)sampleRate
{
AudioStreamBasicDescription asbd;
UInt32 byteSize = sizeof(float);
asbd.mBitsPerChannel = 8 * byteSize;
asbd.mBytesPerFrame = byteSize;
asbd.mBytesPerPacket = byteSize;
asbd.mChannelsPerFrame = 1;
asbd.mFormatFlags = kAudioFormatFlagsNativeFloatPacked|kAudioFormatFlagIsNonInterleaved;
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mFramesPerPacket = 1;
asbd.mSampleRate = sampleRate;
return asbd;
}
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)stereoCanonicalNonInterleavedFormatWithSampleRate:(float)sampleRate
{
AudioStreamBasicDescription asbd;
UInt32 byteSize = sizeof(float);
asbd.mBitsPerChannel = 8 * byteSize;
asbd.mBytesPerFrame = byteSize;
asbd.mBytesPerPacket = byteSize;
asbd.mChannelsPerFrame = 2;
asbd.mFormatFlags = kAudioFormatFlagsNativeFloatPacked|kAudioFormatFlagIsNonInterleaved;
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mFramesPerPacket = 1;
asbd.mSampleRate = sampleRate;
return asbd;
}
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)stereoFloatInterleavedFormatWithSampleRate:(float)sampleRate
{
AudioStreamBasicDescription asbd;
UInt32 floatByteSize = sizeof(float);
asbd.mChannelsPerFrame = 2;
asbd.mBitsPerChannel = 8 * floatByteSize;
asbd.mBytesPerFrame = asbd.mChannelsPerFrame * floatByteSize;
asbd.mFramesPerPacket = 1;
asbd.mBytesPerPacket = asbd.mFramesPerPacket * asbd.mBytesPerFrame;
asbd.mFormatFlags = kAudioFormatFlagIsFloat;
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mSampleRate = sampleRate;
asbd.mReserved = 0;
return asbd;
}
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)stereoFloatNonInterleavedFormatWithSampleRate:(float)sampleRate
{
AudioStreamBasicDescription asbd;
UInt32 floatByteSize = sizeof(float);
asbd.mBitsPerChannel = 8 * floatByteSize;
asbd.mBytesPerFrame = floatByteSize;
asbd.mChannelsPerFrame = 2;
asbd.mFormatFlags = kAudioFormatFlagIsFloat|kAudioFormatFlagIsNonInterleaved;
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mFramesPerPacket = 1;
asbd.mBytesPerPacket = asbd.mFramesPerPacket * asbd.mBytesPerFrame;
asbd.mSampleRate = sampleRate;
return asbd;
}
//------------------------------------------------------------------------------
+ (BOOL)isFloatFormat:(AudioStreamBasicDescription)asbd
{
return asbd.mFormatFlags & kAudioFormatFlagIsFloat;
}
//------------------------------------------------------------------------------
+ (BOOL)isInterleaved:(AudioStreamBasicDescription)asbd
{
return !(asbd.mFormatFlags & kAudioFormatFlagIsNonInterleaved);
}
//------------------------------------------------------------------------------
+ (BOOL)isLinearPCM:(AudioStreamBasicDescription)asbd
{
return asbd.mFormatID == kAudioFormatLinearPCM;
}
//------------------------------------------------------------------------------
+ (void)printASBD:(AudioStreamBasicDescription)asbd
{
char formatIDString[5];
UInt32 formatID = CFSwapInt32HostToBig(asbd.mFormatID);
bcopy (&formatID, formatIDString, 4);
formatIDString[4] = '\0';
NSLog (@" Sample Rate: %10.0f", asbd.mSampleRate);
NSLog (@" Format ID: %10s", formatIDString);
NSLog (@" Format Flags: %10X", (unsigned int)asbd.mFormatFlags);
NSLog (@" Bytes per Packet: %10d", (unsigned int)asbd.mBytesPerPacket);
NSLog (@" Frames per Packet: %10d", (unsigned int)asbd.mFramesPerPacket);
NSLog (@" Bytes per Frame: %10d", (unsigned int)asbd.mBytesPerFrame);
NSLog (@" Channels per Frame: %10d", (unsigned int)asbd.mChannelsPerFrame);
NSLog (@" Bits per Channel: %10d", (unsigned int)asbd.mBitsPerChannel);
}
//------------------------------------------------------------------------------
+ (NSString *)displayTimeStringFromSeconds:(NSTimeInterval)seconds
{
int totalSeconds = (int)ceil(seconds);
int secondsComponent = totalSeconds % 60;
int minutesComponent = (totalSeconds / 60) % 60;
return [NSString stringWithFormat:@"%02d:%02d", minutesComponent, secondsComponent];
}
//------------------------------------------------------------------------------
+ (NSString *)stringForAudioStreamBasicDescription:(AudioStreamBasicDescription)asbd
{
char formatIDString[5];
UInt32 formatID = CFSwapInt32HostToBig(asbd.mFormatID);
bcopy (&formatID, formatIDString, 4);
formatIDString[4] = '\0';
return [NSString stringWithFormat:
@"\nSample Rate: %10.0f,\n"
@"Format ID: %10s,\n"
@"Format Flags: %10X,\n"
@"Bytes per Packet: %10d,\n"
@"Frames per Packet: %10d,\n"
@"Bytes per Frame: %10d,\n"
@"Channels per Frame: %10d,\n"
@"Bits per Channel: %10d,\n"
@"IsInterleaved: %i,\n"
@"IsFloat: %i,",
asbd.mSampleRate,
formatIDString,
(unsigned int)asbd.mFormatFlags,
(unsigned int)asbd.mBytesPerPacket,
(unsigned int)asbd.mFramesPerPacket,
(unsigned int)asbd.mBytesPerFrame,
(unsigned int)asbd.mChannelsPerFrame,
(unsigned int)asbd.mBitsPerChannel,
[self isInterleaved:asbd],
[self isFloatFormat:asbd]];
}
//------------------------------------------------------------------------------
+ (void)setCanonicalAudioStreamBasicDescription:(AudioStreamBasicDescription*)asbd
numberOfChannels:(UInt32)nChannels
interleaved:(BOOL)interleaved
{
asbd->mFormatID = kAudioFormatLinearPCM;
#if TARGET_OS_IPHONE
int sampleSize = sizeof(float);
asbd->mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
#elif TARGET_OS_MAC
int sampleSize = sizeof(Float32);
asbd->mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
#endif
asbd->mBitsPerChannel = 8 * sampleSize;
asbd->mChannelsPerFrame = nChannels;
asbd->mFramesPerPacket = 1;
if (interleaved)
asbd->mBytesPerPacket = asbd->mBytesPerFrame = nChannels * sampleSize;
else {
asbd->mBytesPerPacket = asbd->mBytesPerFrame = sampleSize;
asbd->mFormatFlags |= kAudioFormatFlagIsNonInterleaved;
}
}
//------------------------------------------------------------------------------
#pragma mark - Math Utilities
//------------------------------------------------------------------------------
+ (void)appendBufferAndShift:(float*)buffer
withBufferSize:(int)bufferLength
toScrollHistory:(float*)scrollHistory
withScrollHistorySize:(int)scrollHistoryLength
{
int shiftLength = scrollHistoryLength - bufferLength;
size_t floatByteSize = sizeof(float);
size_t shiftByteSize = shiftLength * floatByteSize;
size_t bufferByteSize = bufferLength * floatByteSize;
memmove(&scrollHistory[0],
&scrollHistory[bufferLength],
shiftByteSize);
memmove(&scrollHistory[shiftLength],
&buffer[0],
bufferByteSize);
}
//------------------------------------------------------------------------------
+ (void) appendValue:(float)value
toScrollHistory:(float*)scrollHistory
withScrollHistorySize:(int)scrollHistoryLength
{
float val[1]; val[0] = value;
[self appendBufferAndShift:val
withBufferSize:1
toScrollHistory:scrollHistory
withScrollHistorySize:scrollHistoryLength];
}
//------------------------------------------------------------------------------
+ (float)MAP:(float)value
leftMin:(float)leftMin
leftMax:(float)leftMax
rightMin:(float)rightMin
rightMax:(float)rightMax
{
float leftSpan = leftMax - leftMin;
float rightSpan = rightMax - rightMin;
float valueScaled = ( value - leftMin) / leftSpan;
return rightMin + (valueScaled * rightSpan);
}
//------------------------------------------------------------------------------
+ (float)RMS:(float *)buffer length:(int)bufferSize
{
float sum = 0.0;
for(int i = 0; i < bufferSize; i++)
sum += buffer[i] * buffer[i];
return sqrtf( sum / bufferSize);
}
//------------------------------------------------------------------------------
+ (float)SGN:(float)value
{
return value < 0 ? -1.0f : ( value > 0 ? 1.0f : 0.0f);
}
//------------------------------------------------------------------------------
#pragma mark - Music Utilities
//------------------------------------------------------------------------------
+ (NSString *)noteNameStringForFrequency:(float)frequency
includeOctave:(BOOL)includeOctave
{
NSMutableString *noteName = [NSMutableString string];
int halfStepsFromFixedNote = roundf(log(frequency / EZAudioUtilitiesFixedNoteA) / log(EZAudioUtilitiesEQFrequencyRatio));
int halfStepsModOctaves = halfStepsFromFixedNote % EZAudioUtilitiesNotesLength;
int indexOfNote = EZAudioUtilitiesFixedNoteAIndex + halfStepsModOctaves;
float octaves = halfStepsFromFixedNote / EZAudioUtilitiesNotesLength;
if (indexOfNote >= EZAudioUtilitiesNotesLength)
{
indexOfNote -= EZAudioUtilitiesNotesLength;
octaves += 1;
}
else if (indexOfNote < 0)
{
indexOfNote += EZAudioUtilitiesNotesLength;
octaves = -1;
}
[noteName appendString:EZAudioUtilitiesNotes[indexOfNote]];
if (includeOctave)
{
int noteOctave = EZAudioUtilitiesFixedNoteAOctave + octaves;
[noteName appendFormat:@"%i", noteOctave];
}
return noteName;
}
//------------------------------------------------------------------------------
#pragma mark - OSStatus Utility
//------------------------------------------------------------------------------
+ (void)checkResult:(OSStatus)result operation:(const char *)operation
{
if (result == noErr) return;
char errorString[20];
// see if it appears to be a 4-char-code
*(UInt32 *)(errorString + 1) = CFSwapInt32HostToBig(result);
if (isprint(errorString[1]) && isprint(errorString[2]) && isprint(errorString[3]) && isprint(errorString[4]))
{
errorString[0] = errorString[5] = '\'';
errorString[6] = '\0';
} else
// no, format it as an integer
sprintf(errorString, "%d", (int)result);
fprintf(stderr, "Error: %s (%s)\n", operation, errorString);
if (__shouldExitOnCheckResultFail)
{
exit(-1);
}
}
//------------------------------------------------------------------------------
+ (NSString *)stringFromUInt32Code:(UInt32)code
{
char errorString[20];
// see if it appears to be a 4-char-code
*(UInt32 *)(errorString + 1) = CFSwapInt32HostToBig(code);
if (isprint(errorString[1]) &&
isprint(errorString[2]) &&
isprint(errorString[3]) &&
isprint(errorString[4]))
{
errorString[0] = errorString[5] = '\'';
errorString[6] = '\0';
}
return [NSString stringWithUTF8String:errorString];
}
//------------------------------------------------------------------------------
#pragma mark - Plot Utility
//------------------------------------------------------------------------------
+ (void)updateScrollHistory:(float **)scrollHistory
withLength:(int)scrollHistoryLength
atIndex:(int *)index
withBuffer:(float *)buffer
withBufferSize:(int)bufferSize
isResolutionChanging:(BOOL *)isChanging
{
//
size_t floatByteSize = sizeof(float);
if(*scrollHistory == NULL)
{
// Create the history buffer
*scrollHistory = (float *)calloc(8192, floatByteSize);
}
//
if(!*isChanging)
{
float rms = [EZAudioUtilities RMS:buffer length:bufferSize];
if(*index < scrollHistoryLength)
{
float *hist = *scrollHistory;
hist[*index] = rms;
(*index)++;
}
else
{
[EZAudioUtilities appendValue:rms
toScrollHistory:*scrollHistory
withScrollHistorySize:scrollHistoryLength];
}
}
}
//------------------------------------------------------------------------------
#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
//------------------------------------------------------------------------------
+ (void)appendDataToCircularBuffer:(TPCircularBuffer *)circularBuffer
fromAudioBufferList:(AudioBufferList *)audioBufferList
{
TPCircularBufferProduceBytes(circularBuffer,
audioBufferList->mBuffers[0].mData,
audioBufferList->mBuffers[0].mDataByteSize);
}
//------------------------------------------------------------------------------
+ (void)circularBuffer:(TPCircularBuffer *)circularBuffer withSize:(int)size
{
TPCircularBufferInit(circularBuffer, size);
}
//------------------------------------------------------------------------------
+ (void)freeCircularBuffer:(TPCircularBuffer *)circularBuffer
{
TPCircularBufferClear(circularBuffer);
TPCircularBufferCleanup(circularBuffer);
}
//------------------------------------------------------------------------------
#pragma mark - EZPlotHistoryInfo Utility
//------------------------------------------------------------------------------
+ (void)appendBufferRMS:(float *)buffer
withBufferSize:(UInt32)bufferSize
toHistoryInfo:(EZPlotHistoryInfo *)historyInfo
{
//
// Calculate RMS and append to buffer
//
float rms = [EZAudioUtilities RMS:buffer length:bufferSize];
float src[1];
src[0] = isnan(rms) ? 0.0 : rms;
[self appendBuffer:src withBufferSize:1 toHistoryInfo:historyInfo];
}
//------------------------------------------------------------------------------
+ (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
//
TPCircularBufferProduceBytes(&historyInfo->circularBuffer, buffer, bufferSize * sizeof(float));
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
-35
View File
@@ -1,35 +0,0 @@
//
// EZAudioWaveformData.h
// EZAudioPlayFileExample
//
// Created by Syed Haris Ali on 2/14/15.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
#import <Foundation/Foundation.h>
//------------------------------------------------------------------------------
#pragma mark - EZAudioWaveformData
//------------------------------------------------------------------------------
@interface EZAudioWaveformData : 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
-74
View File
@@ -1,74 +0,0 @@
//
// EZAudioWaveformData.m
// EZAudioPlayFileExample
//
// Created by Syed Haris Ali on 2/14/15.
// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
//
#import "EZAudioWaveformData.h"
//------------------------------------------------------------------------------
#pragma mark - EZAudioWaveformData
//------------------------------------------------------------------------------
@interface EZAudioWaveformData ()
@property (nonatomic, assign, readwrite) int numberOfChannels;
@property (nonatomic, assign, readwrite) float **buffers;
@property (nonatomic, assign, readwrite) UInt32 bufferSize;
@end
//------------------------------------------------------------------------------
@implementation EZAudioWaveformData
//------------------------------------------------------------------------------
- (void)dealloc
{
for (int i = 0; i < self.numberOfChannels; i++)
{
free(self.buffers[i]);
}
free(self.buffers);
}
//------------------------------------------------------------------------------
+ (instancetype)dataWithNumberOfChannels:(int)numberOfChannels
buffers:(float **)buffers
bufferSize:(UInt32)bufferSize
{
id waveformData = [[self alloc] init];
size_t size = sizeof(float *) * numberOfChannels;
float **buffersCopy = (float **)malloc(size);
for (int i = 0; i < numberOfChannels; i++)
{
size = sizeof(float) * bufferSize;
buffersCopy[i] = (float *)malloc(size);
memcpy(buffersCopy[i], buffers[i], size);
}
((EZAudioWaveformData *)waveformData).buffers = buffersCopy;
((EZAudioWaveformData *)waveformData).bufferSize = bufferSize;
((EZAudioWaveformData *)waveformData).numberOfChannels = numberOfChannels;
return waveformData;
}
//------------------------------------------------------------------------------
- (float *)bufferForChannel:(int)channel
{
float *buffer = NULL;
if (channel < self.numberOfChannels)
{
buffer = self.buffers[channel];
}
return buffer;
}
//------------------------------------------------------------------------------
@end
+26
View File
@@ -0,0 +1,26 @@
//
// EZAudioiOS.m
// EZAudio
//
// Created by Tommaso Piazza on 30/09/15.
// Copyright © 2015 Andrew Breckenridge. 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 <EZAudioiOS/EZAudio.h>
+189 -50
View File
@@ -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
@@ -23,16 +23,20 @@
// 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 <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
#import "TargetConditionals.h"
#import "EZAudioDevice.h"
#import "EZOutput.h"
@class EZAudio;
@class EZMicrophone;
//------------------------------------------------------------------------------
#pragma mark - EZMicrophoneDelegate
//------------------------------------------------------------------------------
/**
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:
@@ -50,30 +54,50 @@
/// @name Audio Data Description
///-----------------------------------------------------------
/**
Called anytime the EZMicrophone starts or stops.
@param output The instance of the EZMicrophone that triggered the event.
@param isPlaying A BOOL indicating whether the EZMicrophone instance is playing or not.
*/
- (void)microphone:(EZMicrophone *)microphone changedPlayingState:(BOOL)isPlaying;
//------------------------------------------------------------------------------
/**
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;
- (void) microphone:(EZMicrophone *)microphone
hasAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription;
///-----------------------------------------------------------
/// @name Audio Data Callbacks
///-----------------------------------------------------------
/**
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).
@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;
- (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.
@@ -83,40 +107,69 @@
@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;
- (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
@interface EZMicrophone : NSObject <EZOutputDataSource>
//------------------------------------------------------------------------------
/**
The EZMicrophoneDelegate for which to handle the microphone callbacks
*/
@property (nonatomic,assign) id<EZMicrophoneDelegate> microphoneDelegate;
@property (nonatomic, weak) id<EZMicrophoneDelegate> delegate;
//------------------------------------------------------------------------------
/**
A bool describing whether the microphone is on and passing back audio data to its 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,assign) BOOL microphoneOn;
@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 microphoneDelegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
@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>)microphoneDelegate;
- (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.
@@ -124,49 +177,60 @@
@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>)microphoneDelegate
withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription;
-(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 microphoneDelegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
@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>)microphoneDelegate
startsImmediately:(BOOL)startsImmediately;
- (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 microphoneDelegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
@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>)microphoneDelegate
withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription
startsImmediately:(BOOL)startsImmediately;
- (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 microphoneDelegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
@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>)microphoneDelegate;
+ (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 microphoneDelegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
@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>)microphoneDelegate
withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription;
+ (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.
@@ -175,8 +239,10 @@
@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>)microphoneDelegate
startsImmediately:(BOOL)startsImmediately;
+ (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.
@@ -186,11 +252,14 @@
@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>)microphoneDelegate
withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription
startsImmediately:(BOOL)startsImmediately;
+ (EZMicrophone *)microphoneWithDelegate:(id<EZMicrophoneDelegate>)delegate
withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription
startsImmediately:(BOOL)startsImmediately;
//------------------------------------------------------------------------------
#pragma mark - Shared Instance
//------------------------------------------------------------------------------
#pragma mark - Singleton
///-----------------------------------------------------------
/// @name Shared Instance
///-----------------------------------------------------------
@@ -199,9 +268,12 @@
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;
+ (EZMicrophone *)sharedMicrophone;
//------------------------------------------------------------------------------
#pragma mark - Events
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Starting/Stopping The Microphone
///-----------------------------------------------------------
@@ -209,14 +281,19 @@
/**
Starts fetching audio from the default microphone. Will notify delegate with audioReceived callback.
*/
-(void)startFetchingAudio;
- (void)startFetchingAudio;
//------------------------------------------------------------------------------
/**
Stops fetching audio. Will stop notifying the delegate's audioReceived callback.
*/
-(void)stopFetchingAudio;
- (void)stopFetchingAudio;
//------------------------------------------------------------------------------
#pragma mark - Getters
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Getting The Microphone's Audio Format
///-----------------------------------------------------------
@@ -225,18 +302,80 @@
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;
- (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 Input Format
/// @name Customizing The Microphone Stream Format
///-----------------------------------------------------------
/**
Sets the AudioStreamBasicDescription on the microphone input.
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;
- (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
+583 -516
View File
File diff suppressed because it is too large Load Diff
+250 -75
View File
@@ -3,7 +3,7 @@
// EZAudio
//
// Created by Syed Haris Ali on 12/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
@@ -30,72 +30,102 @@
#import <AudioUnit/AudioUnit.h>
#endif
#import "TPCircularBuffer.h"
@class EZAudioDevice;
@class EZOutput;
//------------------------------------------------------------------------------
#pragma mark - Constants
//------------------------------------------------------------------------------
FOUNDATION_EXPORT UInt32 const EZOutputMaximumFramesPerSlice;
FOUNDATION_EXPORT Float64 const EZOutputDefaultSampleRate;
//------------------------------------------------------------------------------
#pragma mark - EZOutputDataSource
//------------------------------------------------------------------------------
/**
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:`
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 Pulling The Audio Data
/// @name Providing 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;
@required
/**
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.
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.
@return A pointer to the AudioBufferList structure holding the audio data. If nil or NULL, will output silence.
@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.
*/
-(void) output:(EZOutput *)output
shouldFillAudioBufferList:(AudioBufferList*)audioBufferList
withNumberOfFrames:(UInt32)frames;
- (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.
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 - Properties
/**
The EZOutputDataSource that provides the required AudioBufferList to the output callback function
*/
@property (nonatomic,assign) id<EZOutputDataSource>outputDataSource;
//------------------------------------------------------------------------------
#pragma mark - Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Initializers
///-----------------------------------------------------------
@@ -105,29 +135,38 @@ inNumberFrames:(UInt32)inNumberFrames
@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;
- (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 audioStreamBasicDescription The AudioStreamBasicDescription of the EZOutput.
@warning AudioStreamBasicDescriptions that are invalid will cause the EZOutput to fail to initialize
@param inputFormat The AudioStreamBasicDescription of the EZOutput.
@warning AudioStreamBasicDescription input formats must be linear PCM!
@return A newly created instance of the EZOutput class.
*/
-(id) initWithDataSource:(id<EZOutputDataSource>)dataSource
withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription;
- (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.
*/
+(EZOutput*)outputWithDataSource:(id<EZOutputDataSource>)dataSource;
+ (instancetype)outputWithDataSource:(id<EZOutputDataSource>)dataSource;
/**
Class method to create a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
@@ -136,10 +175,13 @@ inNumberFrames:(UInt32)inNumberFrames
@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;
+ (instancetype)outputWithDataSource:(id<EZOutputDataSource>)dataSource
inputFormat:(AudioStreamBasicDescription)inputFormat;
//------------------------------------------------------------------------------
#pragma mark - Singleton
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Shared Instance
///-----------------------------------------------------------
@@ -148,9 +190,123 @@ inNumberFrames:(UInt32)inNumberFrames
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;
+ (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
//------------------------------------------------------------------------------
#pragma mark - Events
///-----------------------------------------------------------
/// @name Starting/Stopping The Output
///-----------------------------------------------------------
@@ -158,44 +314,63 @@ inNumberFrames:(UInt32)inNumberFrames
/**
Starts pulling audio data from the EZOutputDataSource to the default device output.
*/
-(void)startPlayback;
- (void)startPlayback;
///-----------------------------------------------------------
/**
Stops pulling audio data from the EZOutputDataSource to the default device output.
*/
-(void)stopPlayback;
- (void)stopPlayback;
//------------------------------------------------------------------------------
#pragma mark - Subclass
//------------------------------------------------------------------------------
#pragma mark - Getters
///-----------------------------------------------------------
/// @name Getting The Output Audio Format
/// @name Subclass
///-----------------------------------------------------------
/**
Provides the AudioStreamBasicDescription structure containing the format of the microphone's audio.
@return An AudioStreamBasicDescription structure describing the format of the microphone's audio.
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`.
*/
-(AudioStreamBasicDescription)audioStreamBasicDescription;
- (OSStatus)connectOutputOfSourceNode:(AUNode)sourceNode
sourceNodeOutputBus:(UInt32)sourceNodeOutputBus
toDestinationNode:(AUNode)destinationNode
destinationNodeInputBus:(UInt32)destinationNodeInputBus
inGraph:(AUGraph)graph;
///-----------------------------------------------------------
/// @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
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.
*/
-(BOOL)isPlaying;
- (AudioStreamBasicDescription)defaultClientFormat;
#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.
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.
*/
-(void)setAudioStreamBasicDescription:(AudioStreamBasicDescription)asbd;
- (AudioStreamBasicDescription)defaultInputFormat;
@end
//------------------------------------------------------------------------------
/**
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
+686 -307
View File
File diff suppressed because it is too large Load Diff
+42 -18
View File
@@ -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
@@ -23,7 +23,13 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
#import "EZAudioUtilities.h"
//------------------------------------------------------------------------------
#pragma mark - Enumerations
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Plot Types
///-----------------------------------------------------------
@@ -31,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
};
/**
@@ -57,41 +65,55 @@ typedef NS_ENUM(NSInteger,EZPlotType){
@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) id backgroundColor;
#if TARGET_OS_IPHONE
@property (nonatomic, strong) IBInspectable UIColor *backgroundColor;
#elif TARGET_OS_MAC
@property (nonatomic, strong) IBInspectable NSColor *backgroundColor;
#endif
/**
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;
#if TARGET_OS_IPHONE
@property (nonatomic, strong) IBInspectable UIColor *color;
#elif TARGET_OS_MAC
@property (nonatomic, strong) IBInspectable NSColor *color;
#endif
/**
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;
@property (nonatomic, assign) IBInspectable 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;
@property (nonatomic, assign) IBInspectable 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;
@property (nonatomic, assign) IBInspectable 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;
@property (nonatomic, assign) IBInspectable BOOL shouldMirror;
//------------------------------------------------------------------------------
#pragma mark - Clearing
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Clearing The Plot
///-----------------------------------------------------------
@@ -101,7 +123,10 @@ typedef NS_ENUM(NSInteger,EZPlotType){
*/
-(void)clear;
//------------------------------------------------------------------------------
#pragma mark - Get Samples
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Updating The Plot
///-----------------------------------------------------------
@@ -112,7 +137,6 @@ typedef NS_ENUM(NSInteger,EZPlotType){
@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;
-(void)updateBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize;
@end
+1 -5
View File
@@ -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
@@ -25,10 +25,6 @@
#import "EZPlot.h"
@interface EZPlot ()
@end
@implementation EZPlot
#pragma mark - Clearing
+258 -17
View File
@@ -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
@@ -26,6 +26,12 @@
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>
@class EZRecorder;
//------------------------------------------------------------------------------
#pragma mark - Data Structures
//------------------------------------------------------------------------------
/**
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:
@@ -50,57 +56,290 @@ typedef NS_ENUM(NSInteger, EZRecorderFileType)
EZRecorderFileTypeWAV
};
//------------------------------------------------------------------------------
#pragma mark - EZRecorderDelegate
//------------------------------------------------------------------------------
/**
The EZRecorderDelegate for the EZRecorder provides a receiver for write events, `recorderUpdatedCurrentTime:`, and the close event, `recorderDidClose:`.
*/
@protocol EZRecorderDelegate <NSObject>
@optional
/**
Triggers when the EZRecorder is explicitly closed with the `closeAudioFile` method.
@param recorder The EZRecorder instance that triggered the action
*/
- (void)recorderDidClose:(EZRecorder *)recorder;
/**
Triggers after the EZRecorder has successfully written audio data from the `appendDataFromBufferList:withBufferSize:` method.
@param recorder The EZRecorder instance that triggered the action
*/
- (void)recorderUpdatedCurrentTime:(EZRecorder *)recorder;
@end
//------------------------------------------------------------------------------
#pragma mark - EZRecorder
//------------------------------------------------------------------------------
/**
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 - Properties
//------------------------------------------------------------------------------
/**
An EZRecorderDelegate to listen for the write and close events.
*/
@property (nonatomic, weak) id<EZRecorderDelegate> delegate;
//------------------------------------------------------------------------------
#pragma mark - Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Initializers
///-----------------------------------------------------------
/**
Creates an instance of the EZRecorder with a file path URL to write out the file to, a client format describing the in-application common format (see `clientFormat` for more info), and a file type (see `EZRecorderFileType`) that will automatically create an internal `fileFormat` and audio file type hint.
@param url An NSURL representing the file path the output file should be written
@param clientFormat An AudioStreamBasicDescription describing the in-applciation common format (always linear PCM)
@param fileType 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 A newly created EZRecorder instance.
*/
- (instancetype)initWithURL:(NSURL *)url
clientFormat:(AudioStreamBasicDescription)clientFormat
fileType:(EZRecorderFileType)fileType;
//------------------------------------------------------------------------------
/**
Creates an instance of the EZRecorder with a file path URL to write out the file to, a client format describing the in-application common format (see `clientFormat` for more info), and a file type (see `EZRecorderFileType`) that will automatically create an internal `fileFormat` and audio file type hint, as well as a delegate to respond to the recorder's write and close events.
@param url An NSURL representing the file path the output file should be written
@param clientFormat An AudioStreamBasicDescription describing the in-applciation common format (always linear PCM)
@param fileType 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.
@param delegate An EZRecorderDelegate to listen for the recorder's write and close events.
@return A newly created EZRecorder instance.
*/
- (instancetype)initWithURL:(NSURL *)url
clientFormat:(AudioStreamBasicDescription)clientFormat
fileType:(EZRecorderFileType)fileType
delegate:(id<EZRecorderDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Creates an instance of the EZRecorder with a file path URL to write out the file to, a client format describing the in-application common format (see `clientFormat` for more info), a file format describing the destination format on disk (see `fileFormat` for more info), and an audio file type (an AudioFileTypeID for Core Audio, not a EZRecorderFileType).
@param url An NSURL representing the file path the output file should be written
@param clientFormat An AudioStreamBasicDescription describing the in-applciation common format (always linear PCM)
@param fileFormat An AudioStreamBasicDescription describing the format of the audio being written to disk (MP3, AAC, WAV, etc)
@param audioFileTypeID An AudioFileTypeID that matches your fileFormat (i.e. kAudioFileM4AType for an M4A format)
@return A newly created EZRecorder instance.
*/
- (instancetype)initWithURL:(NSURL *)url
clientFormat:(AudioStreamBasicDescription)clientFormat
fileFormat:(AudioStreamBasicDescription)fileFormat
audioFileTypeID:(AudioFileTypeID)audioFileTypeID;
//------------------------------------------------------------------------------
/**
Creates an instance of the EZRecorder with a file path URL to write out the file to, a client format describing the in-application common format (see `clientFormat` for more info), a file format describing the destination format on disk (see `fileFormat` for more info), an audio file type (an AudioFileTypeID for Core Audio, not a EZRecorderFileType), and delegate to respond to the recorder's write and close events.
@param url An NSURL representing the file path the output file should be written
@param clientFormat An AudioStreamBasicDescription describing the in-applciation common format (always linear PCM)
@param fileFormat An AudioStreamBasicDescription describing the format of the audio being written to disk (MP3, AAC, WAV, etc)
@param audioFileTypeID An AudioFileTypeID that matches your fileFormat (i.e. kAudioFileM4AType for an M4A format)
@param delegate An EZRecorderDelegate to listen for the recorder's write and close events.
@return A newly created EZRecorder instance.
*/
- (instancetype)initWithURL:(NSURL *)url
clientFormat:(AudioStreamBasicDescription)clientFormat
fileFormat:(AudioStreamBasicDescription)fileFormat
audioFileTypeID:(AudioFileTypeID)audioFileTypeID
delegate:(id<EZRecorderDelegate>)delegate;
//------------------------------------------------------------------------------
/**
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.
@deprecated This property is deprecated starting in version 0.8.0.
@note Please use `initWithURL:clientFormat:fileType:` initializer instead.
@return The newly created EZRecorder instance.
*/
-(EZRecorder*)initWithDestinationURL:(NSURL*)url
- (instancetype)initWithDestinationURL:(NSURL*)url
sourceFormat:(AudioStreamBasicDescription)sourceFormat
destinationFileType:(EZRecorderFileType)destinationFileType;
destinationFileType:(EZRecorderFileType)destinationFileType __attribute__((deprecated));
//------------------------------------------------------------------------------
#pragma mark - Class Initializers
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Class Initializers
///-----------------------------------------------------------
/**
Class method to create an instance of the EZRecorder with a file path URL to write out the file to, a client format describing the in-application common format (see `clientFormat` for more info), and a file type (see `EZRecorderFileType`) that will automatically create an internal `fileFormat` and audio file type hint.
@param url An NSURL representing the file path the output file should be written
@param clientFormat An AudioStreamBasicDescription describing the in-applciation common format (always linear PCM)
@param fileType 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 A newly created EZRecorder instance.
*/
+ (instancetype)recorderWithURL:(NSURL *)url
clientFormat:(AudioStreamBasicDescription)clientFormat
fileType:(EZRecorderFileType)fileType;
//------------------------------------------------------------------------------
/**
Class method to create an instance of the EZRecorder with a file path URL to write out the file to, a client format describing the in-application common format (see `clientFormat` for more info), and a file type (see `EZRecorderFileType`) that will automatically create an internal `fileFormat` and audio file type hint, as well as a delegate to respond to the recorder's write and close events.
@param url An NSURL representing the file path the output file should be written
@param clientFormat An AudioStreamBasicDescription describing the in-applciation common format (always linear PCM)
@param fileType 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.
@param delegate An EZRecorderDelegate to listen for the recorder's write and close events.
@return A newly created EZRecorder instance.
*/
+ (instancetype)recorderWithURL:(NSURL *)url
clientFormat:(AudioStreamBasicDescription)clientFormat
fileType:(EZRecorderFileType)fileType
delegate:(id<EZRecorderDelegate>)delegate;
//------------------------------------------------------------------------------
/**
Class method to create an instance of the EZRecorder with a file path URL to write out the file to, a client format describing the in-application common format (see `clientFormat` for more info), a file format describing the destination format on disk (see `fileFormat` for more info), and an audio file type (an AudioFileTypeID for Core Audio, not a EZRecorderFileType).
@param url An NSURL representing the file path the output file should be written
@param clientFormat An AudioStreamBasicDescription describing the in-applciation common format (always linear PCM)
@param fileFormat An AudioStreamBasicDescription describing the format of the audio being written to disk (MP3, AAC, WAV, etc)
@param audioFileTypeID An AudioFileTypeID that matches your fileFormat (i.e. kAudioFileM4AType for an M4A format)
@return A newly created EZRecorder instance.
*/
+ (instancetype)recorderWithURL:(NSURL *)url
clientFormat:(AudioStreamBasicDescription)clientFormat
fileFormat:(AudioStreamBasicDescription)fileFormat
audioFileTypeID:(AudioFileTypeID)audioFileTypeID;
//------------------------------------------------------------------------------
/**
Class method to create an instance of the EZRecorder with a file path URL to write out the file to, a client format describing the in-application common format (see `clientFormat` for more info), a file format describing the destination format on disk (see `fileFormat` for more info), an audio file type (an AudioFileTypeID for Core Audio, not a EZRecorderFileType), and delegate to respond to the recorder's write and close events.
@param url An NSURL representing the file path the output file should be written
@param clientFormat An AudioStreamBasicDescription describing the in-applciation common format (always linear PCM)
@param fileFormat An AudioStreamBasicDescription describing the format of the audio being written to disk (MP3, AAC, WAV, etc)
@param audioFileTypeID An AudioFileTypeID that matches your fileFormat (i.e. kAudioFileM4AType for an M4A format)
@param delegate An EZRecorderDelegate to listen for the recorder's write and close events.
@return A newly created EZRecorder instance.
*/
+ (instancetype)recorderWithURL:(NSURL *)url
clientFormat:(AudioStreamBasicDescription)clientFormat
fileFormat:(AudioStreamBasicDescription)fileFormat
audioFileTypeID:(AudioFileTypeID)audioFileTypeID
delegate:(id<EZRecorderDelegate>)delegate;
//------------------------------------------------------------------------------
/**
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 sourceFormat The AudioStreamBasicDescription for the incoming audio that will be written to the file (also called the `clientFormat`).
@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;
+ (instancetype)recorderWithDestinationURL:(NSURL*)url
sourceFormat:(AudioStreamBasicDescription)sourceFormat
destinationFileType:(EZRecorderFileType)destinationFileType __attribute__((deprecated));
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
#pragma mark - Getters
///-----------------------------------------------------------
/// @name Getting The Recorder's Properties
///-----------------------------------------------------------
/**
Provides the common AudioStreamBasicDescription that will be used for in-app interaction. The recorder's format will be converted from this format to the `fileFormat`. 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 recorder to properly write samples from the graph out to the file in the desired destination format.
@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 write 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 (readonly) NSTimeInterval currentTime;
//------------------------------------------------------------------------------
/**
Provides the duration of the audio file in seconds.
*/
@property (readonly) NSTimeInterval duration;
//------------------------------------------------------------------------------
/**
Provides the AudioStreamBasicDescription structure containing the format of the recorder's audio 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 write 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 the total frame count of the recorder's audio file in the file format.
@return The total number of frames in the recorder in the AudioStreamBasicDescription representing the file format as a SInt64.
*/
@property (readonly) SInt64 totalFrames;
//------------------------------------------------------------------------------
/**
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.
@return The NSURL representing the file path of the recorder path being used for recording.
*/
-(NSURL*)url;
- (NSURL *)url;
//------------------------------------------------------------------------------
#pragma mark - Events
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Appending Data To The Audio File
/// @name Appending Data To The Recorder
///-----------------------------------------------------------
/**
@@ -108,16 +347,18 @@ typedef NS_ENUM(NSInteger, EZRecorderFileType)
@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;
- (void)appendDataFromBufferList:(AudioBufferList *)bufferList
withBufferSize:(UInt32)bufferSize;
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Closing The Audio File
/// @name Closing The Recorder
///-----------------------------------------------------------
/**
Finishes writes to the audio file and closes it.
Finishes writes to the recorder's audio file and closes it.
*/
-(void)closeAudioFile;
- (void)closeAudioFile;
@end
+348 -85
View File
@@ -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
@@ -24,86 +24,232 @@
// THE SOFTWARE.
#import "EZRecorder.h"
#import "EZAudioUtilities.h"
#import "EZAudio.h"
//------------------------------------------------------------------------------
#pragma mark - Data Structures
//------------------------------------------------------------------------------
@interface EZRecorder (){
ExtAudioFileRef _destinationFile;
AudioFileTypeID _destinationFileTypeID;
CFURLRef _destinationFileURL;
AudioStreamBasicDescription _destinationFormat;
AudioStreamBasicDescription _sourceFormat;
}
typedef struct
{
AudioFileTypeID audioFileTypeID;
ExtAudioFileRef extAudioFileRef;
AudioStreamBasicDescription clientFormat;
BOOL closed;
CFURLRef fileURL;
AudioStreamBasicDescription fileFormat;
} EZRecorderInfo;
//------------------------------------------------------------------------------
#pragma mark - EZRecorder (Interface Extension)
//------------------------------------------------------------------------------
@interface EZRecorder ()
@property (nonatomic, assign) EZRecorderInfo *info;
@end
//------------------------------------------------------------------------------
#pragma mark - EZRecorder (Implementation)
//------------------------------------------------------------------------------
@implementation EZRecorder
#pragma mark - Initializers
-(EZRecorder*)initWithDestinationURL:(NSURL*)url
sourceFormat:(AudioStreamBasicDescription)sourceFormat
destinationFileType:(EZRecorderFileType)destinationFileType
//------------------------------------------------------------------------------
#pragma mark - Dealloc
//------------------------------------------------------------------------------
- (void)dealloc
{
if (!self.info->closed)
{
[self closeAudioFile];
}
free(self.info);
}
//------------------------------------------------------------------------------
#pragma mark - Initializers
//------------------------------------------------------------------------------
- (instancetype)initWithURL:(NSURL *)url
clientFormat:(AudioStreamBasicDescription)clientFormat
fileType:(EZRecorderFileType)fileType
{
return [self initWithURL:url
clientFormat:clientFormat
fileType:fileType
delegate:nil];
}
//------------------------------------------------------------------------------
- (instancetype)initWithURL:(NSURL *)url
clientFormat:(AudioStreamBasicDescription)clientFormat
fileType:(EZRecorderFileType)fileType
delegate:(id<EZRecorderDelegate>)delegate
{
AudioStreamBasicDescription fileFormat = [EZRecorder formatForFileType:fileType
withSourceFormat:clientFormat];
AudioFileTypeID audioFileTypeID = [EZRecorder fileTypeIdForFileType:fileType
withSourceFormat:clientFormat];
return [self initWithURL:url
clientFormat:clientFormat
fileFormat:fileFormat
audioFileTypeID:audioFileTypeID
delegate:delegate];
}
//------------------------------------------------------------------------------
- (instancetype)initWithURL:(NSURL *)url
clientFormat:(AudioStreamBasicDescription)clientFormat
fileFormat:(AudioStreamBasicDescription)fileFormat
audioFileTypeID:(AudioFileTypeID)audioFileTypeID
{
return [self initWithURL:url
clientFormat:clientFormat
fileFormat:fileFormat
audioFileTypeID:audioFileTypeID
delegate:nil];
}
//------------------------------------------------------------------------------
- (instancetype)initWithURL:(NSURL *)url
clientFormat:(AudioStreamBasicDescription)clientFormat
fileFormat:(AudioStreamBasicDescription)fileFormat
audioFileTypeID:(AudioFileTypeID)audioFileTypeID
delegate:(id<EZRecorderDelegate>)delegate
{
self = [super init];
if( self )
if (self)
{
// Set defaults
_destinationFile = NULL;
_destinationFileURL = (__bridge CFURLRef)url;
_sourceFormat = sourceFormat;
_destinationFormat = [EZRecorder recorderFormatForFileType:destinationFileType
withSourceFormat:_sourceFormat];
_destinationFileTypeID = [EZRecorder recorderFileTypeIdForFileType:destinationFileType
withSourceFormat:_sourceFormat];
// Initializer the recorder instance
[self _initializeRecorder];
self.info = (EZRecorderInfo *)calloc(1, sizeof(EZRecorderInfo));
self.info->audioFileTypeID = audioFileTypeID;
self.info->fileURL = (__bridge CFURLRef)url;
self.info->clientFormat = clientFormat;
self.info->fileFormat = fileFormat;
self.delegate = delegate;
[self setup];
}
return self;
}
//------------------------------------------------------------------------------
- (instancetype)initWithDestinationURL:(NSURL*)url
sourceFormat:(AudioStreamBasicDescription)sourceFormat
destinationFileType:(EZRecorderFileType)destinationFileType
{
return [self initWithURL:url
clientFormat:sourceFormat
fileType:destinationFileType];
}
//------------------------------------------------------------------------------
#pragma mark - Class Initializers
+(EZRecorder*)recorderWithDestinationURL:(NSURL*)url
sourceFormat:(AudioStreamBasicDescription)sourceFormat
destinationFileType:(EZRecorderFileType)destinationFileType
//------------------------------------------------------------------------------
+ (instancetype)recorderWithURL:(NSURL *)url
clientFormat:(AudioStreamBasicDescription)clientFormat
fileType:(EZRecorderFileType)fileType
{
return [[self alloc] initWithURL:url
clientFormat:clientFormat
fileType:fileType];
}
//------------------------------------------------------------------------------
+ (instancetype)recorderWithURL:(NSURL *)url
clientFormat:(AudioStreamBasicDescription)clientFormat
fileType:(EZRecorderFileType)fileType
delegate:(id<EZRecorderDelegate>)delegate
{
return [[self alloc] initWithURL:url
clientFormat:clientFormat
fileType:fileType
delegate:delegate];
}
//------------------------------------------------------------------------------
+ (instancetype)recorderWithURL:(NSURL *)url
clientFormat:(AudioStreamBasicDescription)clientFormat
fileFormat:(AudioStreamBasicDescription)fileFormat
audioFileTypeID:(AudioFileTypeID)audioFileTypeID
{
return [[self alloc] initWithURL:url
clientFormat:clientFormat
fileFormat:fileFormat
audioFileTypeID:audioFileTypeID];
}
//------------------------------------------------------------------------------
+ (instancetype)recorderWithURL:(NSURL *)url
clientFormat:(AudioStreamBasicDescription)clientFormat
fileFormat:(AudioStreamBasicDescription)fileFormat
audioFileTypeID:(AudioFileTypeID)audioFileTypeID
delegate:(id<EZRecorderDelegate>)delegate
{
return [[self alloc] initWithURL:url
clientFormat:clientFormat
fileFormat:fileFormat
audioFileTypeID:audioFileTypeID
delegate:delegate];
}
//------------------------------------------------------------------------------
+ (instancetype)recorderWithDestinationURL:(NSURL*)url
sourceFormat:(AudioStreamBasicDescription)sourceFormat
destinationFileType:(EZRecorderFileType)destinationFileType
{
return [[EZRecorder alloc] initWithDestinationURL:url
sourceFormat:sourceFormat
destinationFileType:destinationFileType];
}
#pragma mark - Private Configuration
+(AudioStreamBasicDescription)recorderFormatForFileType:(EZRecorderFileType)fileType
withSourceFormat:(AudioStreamBasicDescription)sourceFormat
//------------------------------------------------------------------------------
#pragma mark - Class Methods
//------------------------------------------------------------------------------
+ (AudioStreamBasicDescription)formatForFileType:(EZRecorderFileType)fileType
withSourceFormat:(AudioStreamBasicDescription)sourceFormat
{
AudioStreamBasicDescription asbd;
switch ( fileType )
switch (fileType)
{
case EZRecorderFileTypeAIFF:
asbd = [EZAudio AIFFFormatWithNumberOfChannels:sourceFormat.mChannelsPerFrame
sampleRate:sourceFormat.mSampleRate];
asbd = [EZAudioUtilities AIFFFormatWithNumberOfChannels:sourceFormat.mChannelsPerFrame
sampleRate:sourceFormat.mSampleRate];
break;
case EZRecorderFileTypeM4A:
asbd = [EZAudio M4AFormatWithNumberOfChannels:sourceFormat.mChannelsPerFrame
sampleRate:sourceFormat.mSampleRate];
asbd = [EZAudioUtilities M4AFormatWithNumberOfChannels:sourceFormat.mChannelsPerFrame
sampleRate:sourceFormat.mSampleRate];
break;
case EZRecorderFileTypeWAV:
asbd = [EZAudio stereoFloatInterleavedFormatWithSampleRate:sourceFormat.mSampleRate];
asbd = [EZAudioUtilities stereoFloatInterleavedFormatWithSampleRate:sourceFormat.mSampleRate];
break;
default:
asbd = [EZAudio stereoCanonicalNonInterleavedFormatWithSampleRate:sourceFormat.mSampleRate];
asbd = [EZAudioUtilities stereoCanonicalNonInterleavedFormatWithSampleRate:sourceFormat.mSampleRate];
break;
}
return asbd;
}
+(AudioFileTypeID)recorderFileTypeIdForFileType:(EZRecorderFileType)fileType
withSourceFormat:(AudioStreamBasicDescription)sourceFormat
//------------------------------------------------------------------------------
+ (AudioFileTypeID)fileTypeIdForFileType:(EZRecorderFileType)fileType
withSourceFormat:(AudioStreamBasicDescription)sourceFormat
{
AudioFileTypeID audioFileTypeID;
switch ( fileType )
switch (fileType)
{
case EZRecorderFileTypeAIFF:
audioFileTypeID = kAudioFileAIFFType;
@@ -124,70 +270,187 @@
return audioFileTypeID;
}
-(void)_initializeRecorder
//------------------------------------------------------------------------------
- (void)setup
{
// Finish filling out the destination format description
UInt32 propSize = sizeof(_destinationFormat);
[EZAudio checkResult:AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
0,
NULL,
&propSize,
&_destinationFormat)
operation:"Failed to fill out rest of destination format"];
UInt32 propSize = sizeof(self.info->fileFormat);
[EZAudioUtilities checkResult:AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
0,
NULL,
&propSize,
&self.info->fileFormat)
operation:"Failed to fill out rest of destination format"];
//
// Create the audio file
[EZAudio checkResult:ExtAudioFileCreateWithURL(_destinationFileURL,
_destinationFileTypeID,
&_destinationFormat,
NULL,
kAudioFileFlags_EraseFile,
&_destinationFile)
operation:"Failed to create audio file"];
// Set the client format (which should be equal to the source format)
[EZAudio checkResult:ExtAudioFileSetProperty(_destinationFile,
kExtAudioFileProperty_ClientDataFormat,
sizeof(_sourceFormat),
&_sourceFormat)
operation:"Failed to set client format on recorded audio file"];
//
[EZAudioUtilities checkResult:ExtAudioFileCreateWithURL(self.info->fileURL,
self.info->audioFileTypeID,
&self.info->fileFormat,
NULL,
kAudioFileFlags_EraseFile,
&self.info->extAudioFileRef)
operation:"Failed to create audio file"];
//
// Set the client format
//
[self setClientFormat:self.info->clientFormat];
}
//------------------------------------------------------------------------------
#pragma mark - Events
-(void)appendDataFromBufferList:(AudioBufferList *)bufferList
withBufferSize:(UInt32)bufferSize
//------------------------------------------------------------------------------
- (void)appendDataFromBufferList:(AudioBufferList *)bufferList
withBufferSize:(UInt32)bufferSize
{
if( _destinationFile )
{
[EZAudio checkResult:ExtAudioFileWriteAsync(_destinationFile,
//
// Make sure the audio file is not closed
//
NSAssert(!self.info->closed, @"Cannot append data when EZRecorder has been closed. You must create a new instance.;");
//
// Perform the write
//
[EZAudioUtilities checkResult:ExtAudioFileWrite(self.info->extAudioFileRef,
bufferSize,
bufferList)
operation:"Failed to write audio data to recorded audio file"];
}
}
-(void)closeAudioFile
{
if( _destinationFile )
operation:"Failed to write audio data to recorded audio file"];
//
// Notify delegate
//
if ([self.delegate respondsToSelector:@selector(recorderUpdatedCurrentTime:)])
{
// Dispose of the audio file reference
[EZAudio checkResult:ExtAudioFileDispose(_destinationFile)
operation:"Failed to close audio file"];
// Null out the file reference
_destinationFile = NULL;
[self.delegate recorderUpdatedCurrentTime:self];
}
}
-(NSURL *)url
//------------------------------------------------------------------------------
- (void)closeAudioFile
{
return (__bridge NSURL*)_destinationFileURL;
if (!self.info->closed)
{
//
// Close, audio file can no longer be written to
//
[EZAudioUtilities checkResult:ExtAudioFileDispose(self.info->extAudioFileRef)
operation:"Failed to close audio file"];
self.info->closed = YES;
//
// Notify delegate
//
if ([self.delegate respondsToSelector:@selector(recorderDidClose:)])
{
[self.delegate recorderDidClose:self];
}
}
}
#pragma mark - Dealloc
-(void)dealloc
//------------------------------------------------------------------------------
#pragma mark - Getters
//------------------------------------------------------------------------------
- (AudioStreamBasicDescription)clientFormat
{
[self closeAudioFile];
return self.info->clientFormat;
}
//-----------------------------------------------------------------------------
- (NSTimeInterval)currentTime
{
NSTimeInterval currentTime = 0.0;
NSTimeInterval duration = [self duration];
if (duration != 0.0)
{
currentTime = (NSTimeInterval)[EZAudioUtilities MAP:(float)[self frameIndex]
leftMin:0.0f
leftMax:(float)[self totalFrames]
rightMin:0.0f
rightMax:duration];
}
return currentTime;
}
//------------------------------------------------------------------------------
- (NSTimeInterval)duration
{
NSTimeInterval frames = (NSTimeInterval)[self totalFrames];
return (NSTimeInterval) frames / self.info->fileFormat.mSampleRate;
}
//------------------------------------------------------------------------------
- (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;
}
//------------------------------------------------------------------------------
- (SInt64)totalFrames
{
SInt64 totalFrames;
UInt32 propSize = sizeof(SInt64);
[EZAudioUtilities checkResult:ExtAudioFileGetProperty(self.info->extAudioFileRef,
kExtAudioFileProperty_FileLengthFrames,
&propSize,
&totalFrames)
operation:"Recorder failed to get total frames."];
return totalFrames;
}
//------------------------------------------------------------------------------
- (NSURL *)url
{
return (__bridge NSURL*)self.info->fileURL;
}
//------------------------------------------------------------------------------
#pragma mark - Setters
//------------------------------------------------------------------------------
- (void)setClientFormat:(AudioStreamBasicDescription)clientFormat
{
[EZAudioUtilities checkResult:ExtAudioFileSetProperty(self.info->extAudioFileRef,
kExtAudioFileProperty_ClientDataFormat,
sizeof(clientFormat),
&clientFormat)
operation:"Failed to set client format on recorded audio file"];
self.info->clientFormat = clientFormat;
}
@end
@@ -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>$(PRODUCT_BUNDLE_IDENTIFIER)</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>
+15 -2
View File
@@ -30,6 +30,7 @@
#include "TPCircularBuffer.h"
#include <mach/mach.h>
#include <stdio.h>
#include <stdlib.h>
#define reportResult(result,operation) (_reportResult((result),(operation),strrchr(__FILE__, '/')+1,__LINE__))
static inline bool _reportResult(kern_return_t result, const char *operation, const char* file, int line) {
@@ -40,8 +41,15 @@ static inline bool _reportResult(kern_return_t result, const char *operation, co
return true;
}
bool TPCircularBufferInit(TPCircularBuffer *buffer, int length) {
bool _TPCircularBufferInit(TPCircularBuffer *buffer, int32_t length, size_t structSize) {
assert(length > 0);
if ( structSize != sizeof(TPCircularBuffer) ) {
fprintf(stderr, "TPCircularBuffer: Header version mismatch. Check for old versions of TPCircularBuffer in your project\n");
abort();
}
// Keep trying until we get our buffer, needed to handle race conditions
int retries = 3;
while ( true ) {
@@ -117,6 +125,7 @@ bool TPCircularBufferInit(TPCircularBuffer *buffer, int length) {
buffer->buffer = (void*)bufferAddress;
buffer->fillCount = 0;
buffer->head = buffer->tail = 0;
buffer->atomic = true;
return true;
}
@@ -134,3 +143,7 @@ void TPCircularBufferClear(TPCircularBuffer *buffer) {
TPCircularBufferConsume(buffer, fillCount);
}
}
void TPCircularBufferSetAtomic(TPCircularBuffer *buffer, bool atomic) {
buffer->atomic = atomic;
}
+52 -23
View File
@@ -56,6 +56,7 @@ typedef struct {
int32_t tail;
int32_t head;
volatile int32_t fillCount;
bool atomic;
} TPCircularBuffer;
/*!
@@ -68,7 +69,9 @@ typedef struct {
* @param buffer Circular buffer
* @param length Length of buffer
*/
bool TPCircularBufferInit(TPCircularBuffer *buffer, int32_t length);
#define TPCircularBufferInit(buffer, length) \
_TPCircularBufferInit(buffer, length, sizeof(*buffer))
bool _TPCircularBufferInit(TPCircularBuffer *buffer, int32_t length, size_t structSize);
/*!
* Cleanup buffer
@@ -86,6 +89,22 @@ void TPCircularBufferCleanup(TPCircularBuffer *buffer);
* buffer.
*/
void TPCircularBufferClear(TPCircularBuffer *buffer);
/*!
* Set the atomicity
*
* If you set the atomiticy to false using this method, the buffer will
* not use atomic operations. This can be used to give the compiler a little
* more optimisation opportunities when the buffer is only used on one thread.
*
* Important note: Only set this to false if you know what you're doing!
*
* The default value is true (the buffer will use atomic operations)
*
* @param buffer Circular buffer
* @param atomic Whether the buffer is atomic (default true)
*/
void TPCircularBufferSetAtomic(TPCircularBuffer *buffer, bool atomic);
// Reading (consuming)
@@ -115,16 +134,11 @@ static __inline__ __attribute__((always_inline)) void* TPCircularBufferTail(TPCi
*/
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;
if ( buffer->atomic ) {
OSAtomicAdd32Barrier(-amount, &buffer->fillCount);
} else {
buffer->fillCount -= amount;
}
assert(buffer->fillCount >= 0);
}
@@ -154,25 +168,20 @@ static __inline__ __attribute__((always_inline)) void* TPCircularBufferHead(TPCi
* @param buffer Circular buffer
* @param amount Number of bytes to produce
*/
static __inline__ __attribute__((always_inline)) void TPCircularBufferProduce(TPCircularBuffer *buffer, int amount) {
static __inline__ __attribute__((always_inline)) void TPCircularBufferProduce(TPCircularBuffer *buffer, int32_t 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;
if ( buffer->atomic ) {
OSAtomicAdd32Barrier(amount, &buffer->fillCount);
} else {
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.
* This copies the given bytes to the buffer, and marks them ready for reading.
*
* @param buffer Circular buffer
* @param src Source buffer
@@ -188,6 +197,26 @@ static __inline__ __attribute__((always_inline)) bool TPCircularBufferProduceByt
return true;
}
/*!
* Deprecated method
*/
static __inline__ __attribute__((always_inline)) __deprecated_msg("use TPCircularBufferSetAtomic(false) and TPCircularBufferConsume instead")
void TPCircularBufferConsumeNoBarrier(TPCircularBuffer *buffer, int32_t amount) {
buffer->tail = (buffer->tail + amount) % buffer->length;
buffer->fillCount -= amount;
assert(buffer->fillCount >= 0);
}
/*!
* Deprecated method
*/
static __inline__ __attribute__((always_inline)) __deprecated_msg("use TPCircularBufferSetAtomic(false) and TPCircularBufferProduce instead")
void TPCircularBufferProduceNoBarrier(TPCircularBuffer *buffer, int32_t amount) {
buffer->head = (buffer->head + amount) % buffer->length;
buffer->fillCount += amount;
assert(buffer->fillCount <= buffer->length);
}
#ifdef __cplusplus
}
#endif
-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
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
@@ -0,0 +1,356 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
666062361C5421A400FB99FA /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 666062351C5421A400FB99FA /* AppDelegate.m */; };
666062391C5421A400FB99FA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 666062381C5421A400FB99FA /* main.m */; };
6660623B1C5421A400FB99FA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6660623A1C5421A400FB99FA /* Assets.xcassets */; };
6660623E1C5421A400FB99FA /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6660623C1C5421A400FB99FA /* MainMenu.xib */; };
6660624B1C54242100FB99FA /* EZAudioOSX.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6660624A1C54242100FB99FA /* EZAudioOSX.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
66374DC41C54530A000B19D0 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 66374DBF1C54530A000B19D0 /* EZAudio.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 469F4CF31B749F7800666A46;
remoteInfo = EZAudioiOS;
};
66374DC61C54530A000B19D0 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 66374DBF1C54530A000B19D0 /* EZAudio.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 8A5A4B9C1BBBDCB200A8A048;
remoteInfo = EZAudioOSX;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
66374DBF1C54530A000B19D0 /* EZAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = EZAudio.xcodeproj; path = ../../../EZAudio.xcodeproj; sourceTree = "<group>"; };
666062311C5421A400FB99FA /* CoreGraphicsWaveform.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CoreGraphicsWaveform.app; sourceTree = BUILT_PRODUCTS_DIR; };
666062341C5421A400FB99FA /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
666062351C5421A400FB99FA /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
666062381C5421A400FB99FA /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
6660623A1C5421A400FB99FA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
6660623D1C5421A400FB99FA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
6660623F1C5421A400FB99FA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
6660624A1C54242100FB99FA /* EZAudioOSX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = EZAudioOSX.framework; path = ../../../build/Debug/EZAudioOSX.framework; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
6660622E1C5421A400FB99FA /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
6660624B1C54242100FB99FA /* EZAudioOSX.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
66374DC01C54530A000B19D0 /* Products */ = {
isa = PBXGroup;
children = (
66374DC51C54530A000B19D0 /* EZAudioiOS.framework */,
66374DC71C54530A000B19D0 /* EZAudioOSX.framework */,
);
name = Products;
sourceTree = "<group>";
};
666062281C5421A400FB99FA = {
isa = PBXGroup;
children = (
66374DBF1C54530A000B19D0 /* EZAudio.xcodeproj */,
666062331C5421A400FB99FA /* CoreGraphicsWaveform */,
6660624C1C54244900FB99FA /* Frameworks */,
666062321C5421A400FB99FA /* Products */,
);
sourceTree = "<group>";
};
666062321C5421A400FB99FA /* Products */ = {
isa = PBXGroup;
children = (
666062311C5421A400FB99FA /* CoreGraphicsWaveform.app */,
);
name = Products;
sourceTree = "<group>";
};
666062331C5421A400FB99FA /* CoreGraphicsWaveform */ = {
isa = PBXGroup;
children = (
666062341C5421A400FB99FA /* AppDelegate.h */,
666062351C5421A400FB99FA /* AppDelegate.m */,
6660623A1C5421A400FB99FA /* Assets.xcassets */,
6660623C1C5421A400FB99FA /* MainMenu.xib */,
6660623F1C5421A400FB99FA /* Info.plist */,
666062371C5421A400FB99FA /* Supporting Files */,
);
path = CoreGraphicsWaveform;
sourceTree = "<group>";
};
666062371C5421A400FB99FA /* Supporting Files */ = {
isa = PBXGroup;
children = (
666062381C5421A400FB99FA /* main.m */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
6660624C1C54244900FB99FA /* Frameworks */ = {
isa = PBXGroup;
children = (
6660624A1C54242100FB99FA /* EZAudioOSX.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
666062301C5421A400FB99FA /* CoreGraphicsWaveform */ = {
isa = PBXNativeTarget;
buildConfigurationList = 666062421C5421A400FB99FA /* Build configuration list for PBXNativeTarget "CoreGraphicsWaveform" */;
buildPhases = (
6660622D1C5421A400FB99FA /* Sources */,
6660622E1C5421A400FB99FA /* Frameworks */,
6660622F1C5421A400FB99FA /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = CoreGraphicsWaveform;
productName = CoreGraphicsWaveform;
productReference = 666062311C5421A400FB99FA /* CoreGraphicsWaveform.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
666062291C5421A400FB99FA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = "Syed Haris Ali";
TargetAttributes = {
666062301C5421A400FB99FA = {
CreatedOnToolsVersion = 7.2;
};
};
};
buildConfigurationList = 6660622C1C5421A400FB99FA /* Build configuration list for PBXProject "CoreGraphicsWaveform" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 666062281C5421A400FB99FA;
productRefGroup = 666062321C5421A400FB99FA /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 66374DC01C54530A000B19D0 /* Products */;
ProjectRef = 66374DBF1C54530A000B19D0 /* EZAudio.xcodeproj */;
},
);
projectRoot = "";
targets = (
666062301C5421A400FB99FA /* CoreGraphicsWaveform */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
66374DC51C54530A000B19D0 /* EZAudioiOS.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = EZAudioiOS.framework;
remoteRef = 66374DC41C54530A000B19D0 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
66374DC71C54530A000B19D0 /* EZAudioOSX.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = EZAudioOSX.framework;
remoteRef = 66374DC61C54530A000B19D0 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
6660622F1C5421A400FB99FA /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6660623B1C5421A400FB99FA /* Assets.xcassets in Resources */,
6660623E1C5421A400FB99FA /* MainMenu.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
6660622D1C5421A400FB99FA /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
666062391C5421A400FB99FA /* main.m in Sources */,
666062361C5421A400FB99FA /* AppDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
6660623C1C5421A400FB99FA /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
6660623D1C5421A400FB99FA /* Base */,
);
name = MainMenu.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
666062401C5421A400FB99FA /* 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 = "-";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = 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_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.11;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
666062411C5421A400FB99FA /* 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 = "-";
COPY_PHASE_STRIP = NO;
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.11;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
};
name = Release;
};
666062431C5421A400FB99FA /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COMBINE_HIDPI_IMAGES = YES;
HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
INFOPLIST_FILE = CoreGraphicsWaveform/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.8;
PRODUCT_BUNDLE_IDENTIFIER = com.sha.CoreGraphicsWaveform;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
666062441C5421A400FB99FA /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COMBINE_HIDPI_IMAGES = YES;
HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
INFOPLIST_FILE = CoreGraphicsWaveform/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.8;
PRODUCT_BUNDLE_IDENTIFIER = com.sha.CoreGraphicsWaveform;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
6660622C1C5421A400FB99FA /* Build configuration list for PBXProject "CoreGraphicsWaveform" */ = {
isa = XCConfigurationList;
buildConfigurations = (
666062401C5421A400FB99FA /* Debug */,
666062411C5421A400FB99FA /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
666062421C5421A400FB99FA /* Build configuration list for PBXNativeTarget "CoreGraphicsWaveform" */ = {
isa = XCConfigurationList;
buildConfigurations = (
666062431C5421A400FB99FA /* Debug */,
666062441C5421A400FB99FA /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 666062291C5421A400FB99FA /* Project object */;
}
@@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:EZAudioRecordExample.xcodeproj">
location = "self:">
</FileRef>
</Workspace>
@@ -0,0 +1,95 @@
//
// AppDelegate.h
// CoreGraphicsWaveform
//
// Created by Syed Haris Ali on 12/1/13.
// Updated by Syed Haris Ali on 1/23/16.
// 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 <Cocoa/Cocoa.h>
//
// First import the EZAudio header
//
#include <EZAudio/EZAudio.h>
//------------------------------------------------------------------------------
#pragma mark - AppDelegate
//------------------------------------------------------------------------------
@interface AppDelegate : NSObject <EZMicrophoneDelegate, NSApplicationDelegate>
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
@property (assign) IBOutlet NSWindow *window;
//------------------------------------------------------------------------------
#pragma mark - Properties
//------------------------------------------------------------------------------
//
// The CoreGraphics based audio plot
//
@property (nonatomic, weak) IBOutlet EZAudioPlot *audioPlot;
//
// The microphone
//
@property (nonatomic, strong) EZMicrophone *microphone;
//
// The microphone pop up button (contains the menu for choosing a microphone
// input)
//
@property (nonatomic, weak) IBOutlet NSPopUpButton *microphoneInputPopUpButton;
//
// The microphone input channel pop up button (contains the menu for choosing a
// microphone input channel)
//
@property (nonatomic, weak) IBOutlet NSPopUpButton *microphoneInputChannelPopUpButton;
//
// The checkbox button used to turn the microphone off/on
//
@property (nonatomic, weak) IBOutlet NSButton *microphoneSwitch;
//------------------------------------------------------------------------------
#pragma mark - Actions
//------------------------------------------------------------------------------
//
// Switches the plot drawing type between a buffer plot (visualizes the current
// stream of audio data from the update function) or a rolling plot (visualizes
// the audio data over time, this is the classic waveform look)
//
-(IBAction)changePlotType:(id)sender;
//
// Toggles the microphone on and off. When the microphone is on it will send its
// delegate (aka this view controller) the audio data in various ways (check out
// the EZMicrophoneDelegate documentation for more details)
//
-(IBAction)toggleMicrophone:(id)sender;
@end
@@ -0,0 +1,291 @@
//
// AppDelegate.m
// CoreGraphicsWaveform
//
// Created by Syed Haris Ali on 12/1/13.
// Updated by Syed Haris Ali on 1/23/16.
// 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 "AppDelegate.h"
@implementation AppDelegate
//------------------------------------------------------------------------------
#pragma mark - Customize The Plot's Appearance
//------------------------------------------------------------------------------
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
//
// Set plot's background color
//
self.audioPlot.backgroundColor = [NSColor colorWithCalibratedRed: 0.984 green: 0.471 blue: 0.525 alpha: 1];
//
// Set plot's waveform color
//
self.audioPlot.color = [NSColor colorWithCalibratedRed: 1.000 green: 1.000 blue: 1.000 alpha: 1];
//
// Plot type (buffer means real-time, rolling is over time)
//
self.audioPlot.plotType = EZPlotTypeBuffer;
//
// Create the microphone
//
self.microphone = [EZMicrophone microphoneWithDelegate:self];
//
// Start the microphone
//
[self.microphone startFetchingAudio];
}
//------------------------------------------------------------------------------
#pragma mark - Setup
//------------------------------------------------------------------------------
- (void) reloadMicrophoneInputPopUpButtonMenu
{
NSArray *inputDevices = [EZAudioDevice inputDevices];
NSMenu *menu = [[NSMenu alloc] init];
NSMenuItem *defaultInputMenuItem;
for (EZAudioDevice *device in inputDevices)
{
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:device.name
action:@selector(changedInput:)
keyEquivalent:@""];
item.representedObject = device;
item.target = self;
[menu addItem:item];
// If this device is the same one the microphone is using then
// we will use this menu item as the currently selected item
// in the microphone input popup button's list of items. For instance,
// if you are connected to an external display by default the external
// display's microphone might be used instead of the mac's built in
// mic.
if ([device isEqual:self.microphone.device])
{
defaultInputMenuItem = item;
}
}
self.microphoneInputPopUpButton.menu = menu;
//
// Set the selected device to the current selection on the
// microphone input popup button
//
[self.microphoneInputPopUpButton selectItem:defaultInputMenuItem];
}
//------------------------------------------------------------------------------
- (void) reloadMicrophoneInputChannelPopUpButtonMenu
{
NSMenu *menu = [[NSMenu alloc] init];
for (int i = 0; i < self.microphone.device.inputChannelCount; i++)
{
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:@(i).stringValue
action:nil
keyEquivalent:@""];
[menu addItem:item];
}
self.microphoneInputChannelPopUpButton.menu = menu;
[self.microphoneInputChannelPopUpButton selectItemAtIndex:0];
}
//------------------------------------------------------------------------------
#pragma mark - Actions
//------------------------------------------------------------------------------
- (void)changedInput:(id)sender
{
EZAudioDevice *device = [sender representedObject];
[self.microphone setDevice:device];
}
//------------------------------------------------------------------------------
- (void)changePlotType:(id)sender
{
NSInteger selectedSegment = [sender selectedSegment];
switch(selectedSegment)
{
case 0:
[self drawBufferPlot];
break;
case 1:
[self drawRollingPlot];
break;
default:
break;
}
}
//------------------------------------------------------------------------------
- (void)toggleMicrophone:(id)sender
{
switch([sender state])
{
case NSOffState:
[self.microphone stopFetchingAudio];
break;
case NSOnState:
[self.microphone startFetchingAudio];
break;
default:
break;
}
}
//------------------------------------------------------------------------------
#pragma mark - Action Extensions
//------------------------------------------------------------------------------
/*
Give the visualization of the current buffer (this is almost exactly the openFrameworks audio input eample)
*/
- (void)drawBufferPlot
{
self.audioPlot.plotType = EZPlotTypeBuffer;
self.audioPlot.shouldMirror = NO;
self.audioPlot.shouldFill = NO;
}
//------------------------------------------------------------------------------
/*
Give the classic mirrored, rolling waveform look
*/
- (void)drawRollingPlot
{
self.audioPlot.plotType = EZPlotTypeRolling;
self.audioPlot.shouldFill = YES;
self.audioPlot.shouldMirror = YES;
}
#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
{
//
// 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;
dispatch_async(dispatch_get_main_queue(),^{
//
// All the audio plot needs is the buffer data (float *) and the size.
// Internally the audio plot will handle all the drawing related code,
// history management, and freeing its own resources. Hence, one badass
// line of code gets you a pretty plot :)
//
NSInteger channel = [weakSelf.microphoneInputChannelPopUpButton indexOfSelectedItem];
[weakSelf.audioPlot updateBuffer:buffer[channel] withBufferSize:bufferSize];
});
}
//------------------------------------------------------------------------------
- (void)microphone:(EZMicrophone *)microphone hasAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription
{
// The AudioStreamBasicDescription of the microphone stream. This is useful
// when configuring the EZRecorder or telling another component what audio
// format type to expect.
//
// Here's a print function to allow you to inspect it a little easier.
//
[EZAudioUtilities printASBD:audioStreamBasicDescription];
}
//------------------------------------------------------------------------------
- (void)microphone:(EZMicrophone *)microphone
hasBufferList:(AudioBufferList *)bufferList
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels
{
//
// Getting audio data as a buffer list that can be directly fed into
// the EZRecorder or EZOutput. Say whattt...
//
}
//------------------------------------------------------------------------------
- (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
//
[weakSelf reloadMicrophoneInputPopUpButtonMenu];
//
// Set up the microphone input popup button's items to select
// between different microphone input channels
//
[weakSelf reloadMicrophoneInputChannelPopUpButtonMenu];
});
}
//------------------------------------------------------------------------------
- (void)microphone:(EZMicrophone *)microphone changedPlayingState:(BOOL)isPlaying
{
NSString *title = isPlaying ? @"Microphone On" : @"Microphone Off";
[self setTitle:title forButton:self.microphoneSwitch];
}
//------------------------------------------------------------------------------
#pragma mark - Utility
//------------------------------------------------------------------------------
- (void)setTitle:(NSString *)title forButton:(NSButton *)button
{
NSDictionary *attributes = @{ NSForegroundColorAttributeName : [NSColor whiteColor] };
NSAttributedString *attributedTitle = [[NSAttributedString alloc] initWithString:title
attributes:attributes];
button.attributedTitle = attributedTitle;
button.attributedAlternateTitle = attributedTitle;
}
//------------------------------------------------------------------------------
@end
@@ -1,53 +1,63 @@
{
"images" : [
{
"idiom" : "mac",
"size" : "16x16",
"idiom" : "mac",
"filename" : "icon_16x16.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "16x16",
"idiom" : "mac",
"filename" : "icon_16x16@2x.png",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "32x32",
"idiom" : "mac",
"filename" : "icon_32x32.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "32x32",
"idiom" : "mac",
"filename" : "icon_32x32@2x.png",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "128x128",
"idiom" : "mac",
"filename" : "icon_128x128.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "128x128",
"idiom" : "mac",
"filename" : "icon_128x128@2x.png",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "256x256",
"idiom" : "mac",
"filename" : "icon_256x256.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "256x256",
"idiom" : "mac",
"filename" : "icon_256x256@2x.png",
"scale" : "2x"
},
{
"idiom" : "mac",
"size" : "512x512",
"idiom" : "mac",
"filename" : "icon_512x512.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"size" : "512x512",
"idiom" : "mac",
"filename" : "icon_512x512@2x.png",
"scale" : "2x"
}
],
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,790 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
<connections>
<outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate">
<connections>
<outlet property="audioPlot" destination="UKU-Zt-VNI" id="VZE-Q5-pWX"/>
<outlet property="microphoneInputChannelPopUpButton" destination="eQn-G8-sEy" id="t6L-MA-Ir9"/>
<outlet property="microphoneInputPopUpButton" destination="iw4-UD-y2x" id="u5y-KI-fWu"/>
<outlet property="microphoneSwitch" destination="OcB-2r-09B" id="S6J-CM-twc"/>
<outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
</connections>
</customObject>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
<menuItem title="CoreGraphicsWaveform" id="1Xt-HY-uBw">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="CoreGraphicsWaveform" systemMenu="apple" id="uQy-DD-JDr">
<items>
<menuItem title="About CoreGraphicsWaveform" id="5kV-Vb-QxS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
<menuItem title="Services" id="NMo-om-nkz">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
<menuItem title="Hide CoreGraphicsWaveform" keyEquivalent="h" id="Olw-nP-bQN">
<connections>
<action selector="hide:" target="-1" id="PnN-Uc-m68"/>
</connections>
</menuItem>
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
</connections>
</menuItem>
<menuItem title="Show All" id="Kd2-mp-pUS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
<menuItem title="Quit CoreGraphicsWaveform" keyEquivalent="q" id="4sb-4s-VLi">
<connections>
<action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="File" id="dMs-cI-mzQ">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="File" id="bib-Uj-vzu">
<items>
<menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
<connections>
<action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
</connections>
</menuItem>
<menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
<connections>
<action selector="openDocument:" target="-1" id="bVn-NM-KNZ"/>
</connections>
</menuItem>
<menuItem title="Open Recent" id="tXI-mr-wws">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
<items>
<menuItem title="Clear Menu" id="vNY-rz-j42">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="clearRecentDocuments:" target="-1" id="Daa-9d-B3U"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
<menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
<connections>
<action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
</connections>
</menuItem>
<menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
<connections>
<action selector="saveDocument:" target="-1" id="teZ-XB-qJY"/>
</connections>
</menuItem>
<menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
<connections>
<action selector="saveDocumentAs:" target="-1" id="mDf-zr-I0C"/>
</connections>
</menuItem>
<menuItem title="Revert to Saved" id="KaW-ft-85H">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="revertDocumentToSaved:" target="-1" id="iJ3-Pv-kwq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
<menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
<connections>
<action selector="runPageLayout:" target="-1" id="Din-rz-gC5"/>
</connections>
</menuItem>
<menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
<connections>
<action selector="print:" target="-1" id="qaZ-4w-aoO"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Edit" id="5QF-Oa-p0T">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
<items>
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
<connections>
<action selector="undo:" target="-1" id="M6e-cu-g7V"/>
</connections>
</menuItem>
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
<connections>
<action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
<connections>
<action selector="cut:" target="-1" id="YJe-68-I9s"/>
</connections>
</menuItem>
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
<connections>
<action selector="copy:" target="-1" id="G1f-GL-Joy"/>
</connections>
</menuItem>
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
<connections>
<action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
</connections>
</menuItem>
<menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
</connections>
</menuItem>
<menuItem title="Delete" id="pa3-QI-u2k">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
</connections>
</menuItem>
<menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
<connections>
<action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
<menuItem title="Find" id="4EN-yA-p0u">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Find" id="1b7-l0-nxx">
<items>
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
<connections>
<action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
</connections>
</menuItem>
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
</connections>
</menuItem>
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
<connections>
<action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
</connections>
</menuItem>
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
<connections>
<action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
</connections>
</menuItem>
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
<connections>
<action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
</connections>
</menuItem>
<menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
<connections>
<action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
<items>
<menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
<connections>
<action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
</connections>
</menuItem>
<menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
<connections>
<action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
<menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
</connections>
</menuItem>
<menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
</connections>
</menuItem>
<menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Substitutions" id="9ic-FL-obx">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
<items>
<menuItem title="Show Substitutions" id="z6F-FW-3nz">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
<menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
</connections>
</menuItem>
<menuItem title="Smart Quotes" id="hQb-2v-fYv">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
</connections>
</menuItem>
<menuItem title="Smart Dashes" id="rgM-f4-ycn">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
</connections>
</menuItem>
<menuItem title="Smart Links" id="cwL-P1-jid">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
</connections>
</menuItem>
<menuItem title="Data Detectors" id="tRr-pd-1PS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
</connections>
</menuItem>
<menuItem title="Text Replacement" id="HFQ-gK-NFA">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Transformations" id="2oI-Rn-ZJC">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Transformations" id="c8a-y6-VQd">
<items>
<menuItem title="Make Upper Case" id="vmV-6d-7jI">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
</connections>
</menuItem>
<menuItem title="Make Lower Case" id="d9M-CD-aMd">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
</connections>
</menuItem>
<menuItem title="Capitalize" id="UEZ-Bs-lqG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Speech" id="xrE-MZ-jX0">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Speech" id="3rS-ZA-NoH">
<items>
<menuItem title="Start Speaking" id="Ynk-f8-cLZ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
</connections>
</menuItem>
<menuItem title="Stop Speaking" id="Oyz-dy-DGm">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Format" id="jxT-CU-nIS">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Format" id="GEO-Iw-cKr">
<items>
<menuItem title="Font" id="Gi5-1S-RQB">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
<items>
<menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
<connections>
<action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
</connections>
</menuItem>
<menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
<connections>
<action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
</connections>
</menuItem>
<menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
<connections>
<action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
</connections>
</menuItem>
<menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
<connections>
<action selector="underline:" target="-1" id="FYS-2b-JAY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
<menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
<connections>
<action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
</connections>
</menuItem>
<menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
<connections>
<action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
<menuItem title="Kern" id="jBQ-r6-VK2">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Kern" id="tlD-Oa-oAM">
<items>
<menuItem title="Use Default" id="GUa-eO-cwY">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
</connections>
</menuItem>
<menuItem title="Use None" id="cDB-IK-hbR">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
</connections>
</menuItem>
<menuItem title="Tighten" id="46P-cB-AYj">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
</connections>
</menuItem>
<menuItem title="Loosen" id="ogc-rX-tC1">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Ligatures" id="o6e-r0-MWq">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
<items>
<menuItem title="Use Default" id="agt-UL-0e3">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
</connections>
</menuItem>
<menuItem title="Use None" id="J7y-lM-qPV">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
</connections>
</menuItem>
<menuItem title="Use All" id="xQD-1f-W4t">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Baseline" id="OaQ-X3-Vso">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Baseline" id="ijk-EB-dga">
<items>
<menuItem title="Use Default" id="3Om-Ey-2VK">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
</connections>
</menuItem>
<menuItem title="Superscript" id="Rqc-34-cIF">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
</connections>
</menuItem>
<menuItem title="Subscript" id="I0S-gh-46l">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
</connections>
</menuItem>
<menuItem title="Raise" id="2h7-ER-AoG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
</connections>
</menuItem>
<menuItem title="Lower" id="1tx-W0-xDw">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
<menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
<connections>
<action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
<menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
</connections>
</menuItem>
<menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Text" id="Fal-I4-PZk">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Text" id="d9c-me-L2H">
<items>
<menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
<connections>
<action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
</connections>
</menuItem>
<menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
<connections>
<action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
</connections>
</menuItem>
<menuItem title="Justify" id="J5U-5w-g23">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
</connections>
</menuItem>
<menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
<connections>
<action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
<menuItem title="Writing Direction" id="H1b-Si-o9J">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
<items>
<menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="YGs-j5-SAR">
<string key="title"> Default</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
</connections>
</menuItem>
<menuItem id="Lbh-J2-qVU">
<string key="title"> Left to Right</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
</connections>
</menuItem>
<menuItem id="jFq-tB-4Kx">
<string key="title"> Right to Left</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
<menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="Nop-cj-93Q">
<string key="title"> Default</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
</connections>
</menuItem>
<menuItem id="BgM-ve-c93">
<string key="title"> Left to Right</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
</connections>
</menuItem>
<menuItem id="RB4-Sm-HuC">
<string key="title"> Right to Left</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
<menuItem title="Show Ruler" id="vLm-3I-IUL">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
</connections>
</menuItem>
<menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
</connections>
</menuItem>
<menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="View" id="H8h-7b-M4v">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="View" id="HyV-fh-RgO">
<items>
<menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
</connections>
</menuItem>
<menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Window" id="aUF-d1-5bR">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
<items>
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
<connections>
<action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
</connections>
</menuItem>
<menuItem title="Zoom" id="R4o-n2-Eq4">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Help" id="wpr-3q-Mcd">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
<items>
<menuItem title="CoreGraphicsWaveform Help" keyEquivalent="?" id="FKE-Sm-Kum">
<connections>
<action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
<window title="CoreGraphicsWaveform" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="335" y="390" width="480" height="272"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<view key="contentView" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="UKU-Zt-VNI" customClass="EZAudioPlot">
<rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
<subviews>
<button translatesAutoresizingMaskIntoConstraints="NO" id="OcB-2r-09B">
<rect key="frame" x="339" y="44" width="123" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="119" id="IYG-tU-wTC"/>
</constraints>
<buttonCell key="cell" type="check" title="Microphone On" bezelStyle="regularSquare" imagePosition="right" state="on" inset="2" id="nLI-9n-Lq4">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="toggleMicrophone:" target="Voe-Tx-rLC" id="owY-ee-pxT"/>
</connections>
</button>
<segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="vg4-nF-3aC">
<rect key="frame" x="336" y="15" width="126" height="24"/>
<segmentedCell key="cell" borderStyle="border" alignment="left" style="rounded" trackingMode="selectOne" id="izG-Ud-yhj">
<font key="font" metaFont="system"/>
<segments>
<segment label="Buffer" selected="YES"/>
<segment label="Rolling" tag="1"/>
</segments>
</segmentedCell>
<connections>
<action selector="changePlotType:" target="Voe-Tx-rLC" id="tpI-pn-CXh"/>
</connections>
</segmentedControl>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="iw4-UD-y2x" userLabel="microphoneInputPopUpButton">
<rect key="frame" x="18" y="14" width="180" height="26"/>
<constraints>
<constraint firstAttribute="width" constant="175" id="pXT-MN-bhv"/>
</constraints>
<popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="NAH-si-Cz7" id="iUB-oI-R1w">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="qYP-H1-Bk6">
<items>
<menuItem title="Item 1" state="on" id="NAH-si-Cz7"/>
<menuItem title="Item 2" id="BXf-ml-R0L"/>
<menuItem title="Item 3" id="K8l-2q-4fM"/>
</items>
</menu>
</popUpButtonCell>
</popUpButton>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eQn-G8-sEy" userLabel="microphoneInputChannelPopUpButton">
<rect key="frame" x="204" y="14" width="79" height="26"/>
<constraints>
<constraint firstAttribute="width" constant="74" id="YOF-2X-UV4"/>
</constraints>
<popUpButtonCell key="cell" type="push" title="1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="xFp-40-Dr9" id="BFV-5e-q9Y">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="iMm-fx-yJb">
<items>
<menuItem title="1" state="on" id="xFp-40-Dr9"/>
<menuItem title="Item 2" id="h5D-tQ-aWj"/>
<menuItem title="Item 3" id="KIX-gW-QNf"/>
</items>
</menu>
</popUpButtonCell>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hQY-oe-OzP">
<rect key="frame" x="18" y="43" width="35" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Input" id="bY0-Zl-AT5">
<font key="font" metaFont="system"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ve4-EX-2la">
<rect key="frame" x="204" y="43" width="54" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Channel" id="suO-Th-3jL">
<font key="font" metaFont="system"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="eQn-G8-sEy" secondAttribute="bottom" constant="17" id="3cy-PJ-m0Y"/>
<constraint firstItem="vg4-nF-3aC" firstAttribute="top" secondItem="OcB-2r-09B" secondAttribute="bottom" constant="8" id="9k9-TY-Bjf"/>
<constraint firstItem="vg4-nF-3aC" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="eQn-G8-sEy" secondAttribute="trailing" constant="11" id="M6I-rI-pcs"/>
<constraint firstAttribute="bottom" secondItem="iw4-UD-y2x" secondAttribute="bottom" constant="17" id="NZe-J3-FGY"/>
<constraint firstItem="eQn-G8-sEy" firstAttribute="leading" secondItem="ve4-EX-2la" secondAttribute="leading" id="URh-po-xQb"/>
<constraint firstItem="iw4-UD-y2x" firstAttribute="leading" secondItem="UKU-Zt-VNI" secondAttribute="leading" constant="20" id="YeT-tO-rG3"/>
<constraint firstAttribute="bottom" secondItem="vg4-nF-3aC" secondAttribute="bottom" constant="17" id="aid-He-3CY"/>
<constraint firstAttribute="trailing" secondItem="OcB-2r-09B" secondAttribute="trailing" constant="20" id="ceh-Ub-H3g"/>
<constraint firstItem="eQn-G8-sEy" firstAttribute="top" secondItem="ve4-EX-2la" secondAttribute="bottom" constant="5" id="enm-hh-fpR"/>
<constraint firstAttribute="trailing" secondItem="vg4-nF-3aC" secondAttribute="trailing" constant="20" id="kkp-oh-PX1"/>
<constraint firstItem="hQY-oe-OzP" firstAttribute="leading" secondItem="UKU-Zt-VNI" secondAttribute="leading" constant="20" id="ptg-v2-mao"/>
<constraint firstItem="eQn-G8-sEy" firstAttribute="leading" secondItem="iw4-UD-y2x" secondAttribute="trailing" constant="11" id="waP-mh-dlK"/>
<constraint firstItem="iw4-UD-y2x" firstAttribute="top" secondItem="hQY-oe-OzP" secondAttribute="bottom" constant="5" id="wzU-X6-aEB"/>
</constraints>
</customView>
</subviews>
<constraints>
<constraint firstItem="UKU-Zt-VNI" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" id="AgR-SX-Oic"/>
<constraint firstAttribute="bottom" secondItem="UKU-Zt-VNI" secondAttribute="bottom" id="XJr-UI-i7d"/>
<constraint firstItem="UKU-Zt-VNI" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="gOP-bJ-FcC"/>
<constraint firstAttribute="trailing" secondItem="UKU-Zt-VNI" secondAttribute="trailing" id="yV6-Vo-HHU"/>
</constraints>
</view>
<point key="canvasLocation" x="414" y="327"/>
</window>
</objects>
</document>
@@ -5,15 +5,15 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.sha.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
@@ -23,9 +23,9 @@
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2013 Syed Haris Ali. All rights reserved.</string>
<string>Copyright © 2016 Syed Haris Ali. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
@@ -0,0 +1,13 @@
//
// main.m
// CoreGraphicsWaveform
//
// Created by Syed Haris Ali on 1/23/16.
// Copyright © 2016 Syed Haris Ali. All rights reserved.
//
#import <Cocoa/Cocoa.h>
int main(int argc, const char * argv[]) {
return NSApplicationMain(argc, argv);
}
@@ -1,659 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXAggregateTarget section */
94F8DF4A18C84203005C4CBD /* Generate Documentation */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 94F8DF4D18C84204005C4CBD /* Build configuration list for PBXAggregateTarget "Generate Documentation" */;
buildPhases = (
94F8DF4E18C8420C005C4CBD /* ShellScript */,
);
dependencies = (
);
name = "Generate Documentation";
productName = "Generate Documentation";
};
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
94056D88185B97E300EB94BA /* CoreGraphicsWaveformViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 94056D86185B97E300EB94BA /* CoreGraphicsWaveformViewController.m */; };
94056D89185B97E300EB94BA /* CoreGraphicsWaveformViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 94056D87185B97E300EB94BA /* CoreGraphicsWaveformViewController.xib */; };
9417A6F01867DC8300D9D37B /* AEFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A6D81867DC8300D9D37B /* AEFloatConverter.m */; };
9417A6F11867DC8300D9D37B /* EZAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A6DA1867DC8300D9D37B /* EZAudio.m */; };
9417A6F21867DC8300D9D37B /* EZAudioFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A6DC1867DC8300D9D37B /* EZAudioFile.m */; };
9417A6F31867DC8300D9D37B /* EZAudioPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A6DE1867DC8300D9D37B /* EZAudioPlot.m */; };
9417A6F41867DC8300D9D37B /* EZAudioPlotGL.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A6E01867DC8300D9D37B /* EZAudioPlotGL.m */; };
9417A6F51867DC8300D9D37B /* EZAudioPlotGLKViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A6E21867DC8300D9D37B /* EZAudioPlotGLKViewController.m */; };
9417A6F61867DC8300D9D37B /* EZMicrophone.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A6E41867DC8300D9D37B /* EZMicrophone.m */; };
9417A6F71867DC8300D9D37B /* EZOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A6E61867DC8300D9D37B /* EZOutput.m */; };
9417A6F81867DC8300D9D37B /* EZPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A6E81867DC8300D9D37B /* EZPlot.m */; };
9417A6F91867DC8300D9D37B /* EZRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A6EA1867DC8300D9D37B /* EZRecorder.m */; };
9417A6FA1867DC8300D9D37B /* TPCircularBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 9417A6EB1867DC8300D9D37B /* TPCircularBuffer.c */; };
9417A6FB1867DC8300D9D37B /* CHANGELOG in Resources */ = {isa = PBXBuildFile; fileRef = 9417A6EE1867DC8300D9D37B /* CHANGELOG */; };
9417A6FC1867DC8300D9D37B /* VERSION in Resources */ = {isa = PBXBuildFile; fileRef = 9417A6EF1867DC8300D9D37B /* VERSION */; };
94373025185B931C00F315F0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94373024185B931C00F315F0 /* Cocoa.framework */; };
9437302F185B931C00F315F0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9437302D185B931C00F315F0 /* InfoPlist.strings */; };
94373031185B931C00F315F0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 94373030185B931C00F315F0 /* main.m */; };
94373035185B931C00F315F0 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 94373033185B931C00F315F0 /* Credits.rtf */; };
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 */; };
94373084185B936B00F315F0 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94373083185B936B00F315F0 /* GLKit.framework */; };
94373086185B937100F315F0 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94373085185B937100F315F0 /* OpenGL.framework */; };
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;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
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>"; };
9417A6D71867DC8300D9D37B /* AEFloatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AEFloatConverter.h; sourceTree = "<group>"; };
9417A6D81867DC8300D9D37B /* AEFloatConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AEFloatConverter.m; sourceTree = "<group>"; };
9417A6D91867DC8300D9D37B /* EZAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudio.h; sourceTree = "<group>"; };
9417A6DA1867DC8300D9D37B /* EZAudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudio.m; sourceTree = "<group>"; };
9417A6DB1867DC8300D9D37B /* EZAudioFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFile.h; sourceTree = "<group>"; };
9417A6DC1867DC8300D9D37B /* EZAudioFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFile.m; sourceTree = "<group>"; };
9417A6DD1867DC8300D9D37B /* EZAudioPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlot.h; sourceTree = "<group>"; };
9417A6DE1867DC8300D9D37B /* EZAudioPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlot.m; sourceTree = "<group>"; };
9417A6DF1867DC8300D9D37B /* EZAudioPlotGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGL.h; sourceTree = "<group>"; };
9417A6E01867DC8300D9D37B /* EZAudioPlotGL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGL.m; sourceTree = "<group>"; };
9417A6E11867DC8300D9D37B /* EZAudioPlotGLKViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGLKViewController.h; sourceTree = "<group>"; };
9417A6E21867DC8300D9D37B /* EZAudioPlotGLKViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGLKViewController.m; sourceTree = "<group>"; };
9417A6E31867DC8300D9D37B /* EZMicrophone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZMicrophone.h; sourceTree = "<group>"; };
9417A6E41867DC8300D9D37B /* EZMicrophone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZMicrophone.m; sourceTree = "<group>"; };
9417A6E51867DC8300D9D37B /* EZOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZOutput.h; sourceTree = "<group>"; };
9417A6E61867DC8300D9D37B /* EZOutput.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZOutput.m; sourceTree = "<group>"; };
9417A6E71867DC8300D9D37B /* EZPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZPlot.h; sourceTree = "<group>"; };
9417A6E81867DC8300D9D37B /* EZPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZPlot.m; sourceTree = "<group>"; };
9417A6E91867DC8300D9D37B /* EZRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZRecorder.h; sourceTree = "<group>"; };
9417A6EA1867DC8300D9D37B /* EZRecorder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZRecorder.m; sourceTree = "<group>"; };
9417A6EB1867DC8300D9D37B /* TPCircularBuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = TPCircularBuffer.c; sourceTree = "<group>"; };
9417A6EC1867DC8300D9D37B /* TPCircularBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPCircularBuffer.h; sourceTree = "<group>"; };
9417A6EE1867DC8300D9D37B /* CHANGELOG */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CHANGELOG; sourceTree = "<group>"; };
9417A6EF1867DC8300D9D37B /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = "<group>"; };
94373021185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EZAudioCoreGraphicsWaveformExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
94373024185B931C00F315F0 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
94373027185B931C00F315F0 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
94373028185B931C00F315F0 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
94373029185B931C00F315F0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
9437302C185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "EZAudioCoreGraphicsWaveformExample-Info.plist"; sourceTree = "<group>"; };
9437302E185B931C00F315F0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
94373030185B931C00F315F0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = main.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
94373032185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "EZAudioCoreGraphicsWaveformExample-Prefix.pch"; sourceTree = "<group>"; };
94373034185B931C00F315F0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = "<group>"; };
94373036185B931C00F315F0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = AppDelegate.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
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; };
94373083185B936B00F315F0 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; };
94373085185B937100F315F0 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
94373087185B937E00F315F0 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
9437301E185B931C00F315F0 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
94373088185B937E00F315F0 /* QuartzCore.framework in Frameworks */,
94373086185B937100F315F0 /* OpenGL.framework in Frameworks */,
94373084185B936B00F315F0 /* GLKit.framework in Frameworks */,
94373080185B934900F315F0 /* AudioToolbox.framework in Frameworks */,
94373081185B934900F315F0 /* AudioUnit.framework in Frameworks */,
94373082185B934900F315F0 /* CoreAudio.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 */
9417A6D61867DC8300D9D37B /* EZAudio */ = {
isa = PBXGroup;
children = (
9417A6D71867DC8300D9D37B /* AEFloatConverter.h */,
9417A6D81867DC8300D9D37B /* AEFloatConverter.m */,
9417A6D91867DC8300D9D37B /* EZAudio.h */,
9417A6DA1867DC8300D9D37B /* EZAudio.m */,
9417A6DB1867DC8300D9D37B /* EZAudioFile.h */,
9417A6DC1867DC8300D9D37B /* EZAudioFile.m */,
9417A6DD1867DC8300D9D37B /* EZAudioPlot.h */,
9417A6DE1867DC8300D9D37B /* EZAudioPlot.m */,
9417A6DF1867DC8300D9D37B /* EZAudioPlotGL.h */,
9417A6E01867DC8300D9D37B /* EZAudioPlotGL.m */,
9417A6E11867DC8300D9D37B /* EZAudioPlotGLKViewController.h */,
9417A6E21867DC8300D9D37B /* EZAudioPlotGLKViewController.m */,
9417A6E31867DC8300D9D37B /* EZMicrophone.h */,
9417A6E41867DC8300D9D37B /* EZMicrophone.m */,
9417A6E51867DC8300D9D37B /* EZOutput.h */,
9417A6E61867DC8300D9D37B /* EZOutput.m */,
9417A6E71867DC8300D9D37B /* EZPlot.h */,
9417A6E81867DC8300D9D37B /* EZPlot.m */,
9417A6E91867DC8300D9D37B /* EZRecorder.h */,
9417A6EA1867DC8300D9D37B /* EZRecorder.m */,
9417A6EB1867DC8300D9D37B /* TPCircularBuffer.c */,
9417A6EC1867DC8300D9D37B /* TPCircularBuffer.h */,
9417A6ED1867DC8300D9D37B /* VERSION */,
);
name = EZAudio;
path = ../../../../EZAudio;
sourceTree = "<group>";
};
9417A6ED1867DC8300D9D37B /* VERSION */ = {
isa = PBXGroup;
children = (
9417A6EE1867DC8300D9D37B /* CHANGELOG */,
9417A6EF1867DC8300D9D37B /* VERSION */,
);
path = VERSION;
sourceTree = "<group>";
};
94373018185B931C00F315F0 = {
isa = PBXGroup;
children = (
9437302A185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExample */,
94373048185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests */,
94373023185B931C00F315F0 /* Frameworks */,
94373022185B931C00F315F0 /* Products */,
);
sourceTree = "<group>";
};
94373022185B931C00F315F0 /* Products */ = {
isa = PBXGroup;
children = (
94373021185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExample.app */,
94373042185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
94373023185B931C00F315F0 /* Frameworks */ = {
isa = PBXGroup;
children = (
94373087185B937E00F315F0 /* QuartzCore.framework */,
94373085185B937100F315F0 /* OpenGL.framework */,
94373083185B936B00F315F0 /* GLKit.framework */,
9437307D185B934900F315F0 /* AudioToolbox.framework */,
9437307E185B934900F315F0 /* AudioUnit.framework */,
9437307F185B934900F315F0 /* CoreAudio.framework */,
94373024185B931C00F315F0 /* Cocoa.framework */,
94373043185B931C00F315F0 /* XCTest.framework */,
94373026185B931C00F315F0 /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
94373026185B931C00F315F0 /* Other Frameworks */ = {
isa = PBXGroup;
children = (
94373027185B931C00F315F0 /* AppKit.framework */,
94373028185B931C00F315F0 /* CoreData.framework */,
94373029185B931C00F315F0 /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
9437302A185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExample */ = {
isa = PBXGroup;
children = (
9417A6D61867DC8300D9D37B /* EZAudio */,
94373036185B931C00F315F0 /* AppDelegate.h */,
94373037185B931C00F315F0 /* AppDelegate.m */,
94056D85185B97E300EB94BA /* CoreGraphicsWaveformViewController.h */,
94056D86185B97E300EB94BA /* CoreGraphicsWaveformViewController.m */,
94056D87185B97E300EB94BA /* CoreGraphicsWaveformViewController.xib */,
94373039185B931C00F315F0 /* MainMenu.xib */,
9437303C185B931C00F315F0 /* Images.xcassets */,
9437302B185B931C00F315F0 /* Supporting Files */,
);
path = EZAudioCoreGraphicsWaveformExample;
sourceTree = "<group>";
};
9437302B185B931C00F315F0 /* Supporting Files */ = {
isa = PBXGroup;
children = (
9437302C185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExample-Info.plist */,
9437302D185B931C00F315F0 /* InfoPlist.strings */,
94373030185B931C00F315F0 /* main.m */,
94373032185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExample-Prefix.pch */,
94373033185B931C00F315F0 /* Credits.rtf */,
);
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 */
94373020185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExample */ = {
isa = PBXNativeTarget;
buildConfigurationList = 94373052185B931D00F315F0 /* Build configuration list for PBXNativeTarget "EZAudioCoreGraphicsWaveformExample" */;
buildPhases = (
9437301D185B931C00F315F0 /* Sources */,
9437301E185B931C00F315F0 /* Frameworks */,
9437301F185B931C00F315F0 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = EZAudioCoreGraphicsWaveformExample;
productName = EZAudioCoreGraphicsWaveformExample;
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 */
94373019185B931C00F315F0 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0500;
ORGANIZATIONNAME = "Syed Haris Ali";
TargetAttributes = {
94373041185B931C00F315F0 = {
TestTargetID = 94373020185B931C00F315F0;
};
};
};
buildConfigurationList = 9437301C185B931C00F315F0 /* Build configuration list for PBXProject "EZAudioCoreGraphicsWaveformExample" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 94373018185B931C00F315F0;
productRefGroup = 94373022185B931C00F315F0 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
94373020185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExample */,
94373041185B931C00F315F0 /* EZAudioCoreGraphicsWaveformExampleTests */,
94F8DF4A18C84203005C4CBD /* Generate Documentation */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
9437301F185B931C00F315F0 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9437302F185B931C00F315F0 /* InfoPlist.strings in Resources */,
9417A6FC1867DC8300D9D37B /* VERSION in Resources */,
9437303D185B931C00F315F0 /* Images.xcassets in Resources */,
94373035185B931C00F315F0 /* Credits.rtf in Resources */,
94056D89185B97E300EB94BA /* CoreGraphicsWaveformViewController.xib in Resources */,
9437303B185B931C00F315F0 /* MainMenu.xib in Resources */,
9417A6FB1867DC8300D9D37B /* CHANGELOG in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
94373040185B931C00F315F0 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9437304D185B931C00F315F0 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
94F8DF4E18C8420C005C4CBD /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/usr/local/bin/appledoc \\\n--project-name \"EZAudio\" \\\n--project-company \"Syed Haris Ali\" \\\n--company-id \"com.sha\" \\\n--output documentation \\\n--create-docset \\\n--install-docset \\\n--create-html \\\n--exit-threshold 2 \\\n--no-repeat-first-par \\\n/../EZAudio";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
9437301D185B931C00F315F0 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9417A6FA1867DC8300D9D37B /* TPCircularBuffer.c in Sources */,
9417A6F71867DC8300D9D37B /* EZOutput.m in Sources */,
9417A6F51867DC8300D9D37B /* EZAudioPlotGLKViewController.m in Sources */,
94056D88185B97E300EB94BA /* CoreGraphicsWaveformViewController.m in Sources */,
9417A6F01867DC8300D9D37B /* AEFloatConverter.m in Sources */,
94373038185B931C00F315F0 /* AppDelegate.m in Sources */,
9417A6F31867DC8300D9D37B /* EZAudioPlot.m in Sources */,
9417A6F21867DC8300D9D37B /* EZAudioFile.m in Sources */,
9417A6F41867DC8300D9D37B /* EZAudioPlotGL.m in Sources */,
94373031185B931C00F315F0 /* main.m in Sources */,
9417A6F81867DC8300D9D37B /* EZPlot.m in Sources */,
9417A6F61867DC8300D9D37B /* EZMicrophone.m in Sources */,
9417A6F91867DC8300D9D37B /* EZRecorder.m in Sources */,
9417A6F11867DC8300D9D37B /* EZAudio.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;
children = (
9437302E185B931C00F315F0 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
94373033185B931C00F315F0 /* Credits.rtf */ = {
isa = PBXVariantGroup;
children = (
94373034185B931C00F315F0 /* en */,
);
name = Credits.rtf;
sourceTree = "<group>";
};
94373039185B931C00F315F0 /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
9437303A185B931C00F315F0 /* Base */,
);
name = MainMenu.xib;
sourceTree = "<group>";
};
9437304B185B931C00F315F0 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
9437304C185B931C00F315F0 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
94373050185B931D00F315F0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
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__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = 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;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
94373051185B931D00F315F0 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
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__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = 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;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
SDKROOT = macosx;
};
name = Release;
};
94373053185B931D00F315F0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioCoreGraphicsWaveformExample/EZAudioCoreGraphicsWaveformExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioCoreGraphicsWaveformExample/EZAudioCoreGraphicsWaveformExample-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
94373054185B931D00F315F0 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioCoreGraphicsWaveformExample/EZAudioCoreGraphicsWaveformExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioCoreGraphicsWaveformExample/EZAudioCoreGraphicsWaveformExample-Info.plist";
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 = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
94F8DF4C18C84204005C4CBD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
9437301C185B931C00F315F0 /* Build configuration list for PBXProject "EZAudioCoreGraphicsWaveformExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
94373050185B931D00F315F0 /* Debug */,
94373051185B931D00F315F0 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
94373052185B931D00F315F0 /* Build configuration list for PBXNativeTarget "EZAudioCoreGraphicsWaveformExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
94373053185B931D00F315F0 /* Debug */,
94373054185B931D00F315F0 /* Release */,
);
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 = (
94F8DF4B18C84204005C4CBD /* Debug */,
94F8DF4C18C84204005C4CBD /* Release */,
);
defaultConfigurationIsVisible = 0;
};
/* End XCConfigurationList section */
};
rootObject = 94373019185B931C00F315F0 /* Project object */;
}
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:EZAudioCoreGraphicsWaveformExample.xcodeproj">
</FileRef>
</Workspace>
@@ -1,39 +0,0 @@
//
// AppDelegate.h
// EZAudioCoreGraphicsWaveformExample
//
// 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 <Cocoa/Cocoa.h>
#import "CoreGraphicsWaveformViewController.h"
@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
/**
Create our CoreGraphicsWaveformViewController
*/
@property (nonatomic,strong) CoreGraphicsWaveformViewController *coreGraphicsWaveformViewController;
@end
@@ -1,43 +0,0 @@
//
// AppDelegate.m
// EZAudioCoreGraphicsWaveformExample
//
// 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 "AppDelegate.h"
@implementation AppDelegate
@synthesize coreGraphicsWaveformViewController;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Swap in our view controller in the window's content view
self.coreGraphicsWaveformViewController = [[CoreGraphicsWaveformViewController alloc] init];
// Resize view controller to content view's current size
self.coreGraphicsWaveformViewController.view.frame = [self.window.contentView frame];
// Add resizing flags to make the view controller resize with the window
self.coreGraphicsWaveformViewController.view.autoresizingMask = (NSViewWidthSizable|NSViewHeightSizable);
// Add in the core graphics view controller as subview
[self.window.contentView addSubview:self.coreGraphicsWaveformViewController.view];
}
@end
@@ -1,36 +0,0 @@
//
// CoreGraphicsWaveformViewController.h
// EZAudioCoreGraphicsWaveformExample
//
// Created by Syed Haris Ali on 12/13/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
#import <Cocoa/Cocoa.h>
// Import EZAudio header
#import "EZAudio.h"
/**
We will allow this view controller to act as an EZMicrophoneDelegate. This is how we listen for the microphone callback.
*/
@interface CoreGraphicsWaveformViewController : NSViewController <EZMicrophoneDelegate>
#pragma mark - Components
/**
The CoreGraphics based audio plot
*/
@property (nonatomic,weak) IBOutlet EZAudioPlot *audioPlot;
/**
The microphone component
*/
@property (nonatomic,strong) EZMicrophone *microphone;
#pragma mark - Actions
/**
Toggles the microphone on and off. When the microphone is on it will send its delegate (aka this view controller) the audio data in various ways (check out the EZMicrophoneDelegate documentation for more details);
*/
-(IBAction)toggleMicrophone:(id)sender;
@end
@@ -1,53 +0,0 @@
//
// CoreGraphicsWaveformViewController.m
// EZAudioCoreGraphicsWaveformExample
//
// Created by Syed Haris Ali on 12/13/13.
// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
//
#import "CoreGraphicsWaveformViewController.h"
@interface CoreGraphicsWaveformViewController ()
@end
@implementation CoreGraphicsWaveformViewController
#pragma mark - Initialization
-(id)init {
self = [super initWithNibName:NSStringFromClass(self.class) bundle:nibBundleOrNil];
if(self){
[self initializeViewController];
}
return self;
}
-(id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithNibName:NSStringFromClass(self.class) bundle:nibBundleOrNil];
if(self){
[self initializeViewController];
}
return self;
}
-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:NSStringFromClass(self.class) bundle:nibBundleOrNil];
if(self){
[self initializeViewController];
}
return self;
}
#pragma mark - Initialize View Controller
-(void)initializeViewController {
// Create an instance of the microphone
self.microphone = [EZMicrophone microphoneWithDelegate:self];
}
#pragma mark - Actions
#pragma mark - EZMicrophoneDelegate
@end
@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment version="1070" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="CoreGraphicsWaveformViewController">
<connections>
<outlet property="view" destination="1" id="2"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<customView id="1">
<rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="BYN-Cr-ONS">
<rect key="frame" x="199" y="119" width="82" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="kX8-uO-Adi">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
</subviews>
</customView>
</objects>
</document>
@@ -1,467 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4439" systemVersion="13A451" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4439"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
<connections>
<action selector="orderFrontStandardAboutPanel:" destination="58" id="142"/>
<outlet property="delegate" destination="494" id="495"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder">
<connections>
<action selector="alignCenter:" destination="499" id="518"/>
<action selector="alignJustified:" destination="500" id="523"/>
<action selector="alignLeft:" destination="498" id="524"/>
<action selector="alignRight:" destination="501" id="521"/>
<action selector="arrangeInFront:" destination="5" id="39"/>
<action selector="capitalizeWord:" destination="466" id="467"/>
<action selector="centerSelectionInVisibleArea:" destination="210" id="245"/>
<action selector="checkSpelling:" destination="201" id="225"/>
<action selector="clearRecentDocuments:" destination="126" id="127"/>
<action selector="copy:" destination="197" id="224"/>
<action selector="copyFont:" destination="403" id="428"/>
<action selector="copyRuler:" destination="506" id="522"/>
<action selector="cut:" destination="199" id="228"/>
<action selector="delete:" destination="202" id="235"/>
<action selector="hide:" destination="134" id="367"/>
<action selector="hideOtherApplications:" destination="145" id="368"/>
<action selector="loosenKerning:" destination="419" id="435"/>
<action selector="lowerBaseline:" destination="410" id="427"/>
<action selector="lowercaseWord:" destination="465" id="468"/>
<action selector="makeBaseWritingDirectionLeftToRight:" destination="511" id="526"/>
<action selector="makeBaseWritingDirectionNatural:" destination="510" id="525"/>
<action selector="makeBaseWritingDirectionRightToLeft:" destination="512" id="527"/>
<action selector="makeTextWritingDirectionLeftToRight:" destination="516" id="529"/>
<action selector="makeTextWritingDirectionNatural:" destination="515" id="528"/>
<action selector="makeTextWritingDirectionRightToLeft:" destination="517" id="530"/>
<action selector="newDocument:" destination="82" id="373"/>
<action selector="openDocument:" destination="72" id="374"/>
<action selector="orderFrontColorPanel:" destination="401" id="433"/>
<action selector="orderFrontSubstitutionsPanel:" destination="457" id="458"/>
<action selector="paste:" destination="203" id="226"/>
<action selector="pasteAsPlainText:" destination="485" id="486"/>
<action selector="pasteFont:" destination="404" id="436"/>
<action selector="pasteRuler:" destination="507" id="519"/>
<action selector="performClose:" destination="73" id="193"/>
<action selector="performFindPanelAction:" destination="209" id="241"/>
<action selector="performFindPanelAction:" destination="208" id="487"/>
<action selector="performFindPanelAction:" destination="213" id="488"/>
<action selector="performFindPanelAction:" destination="221" id="489"/>
<action selector="performFindPanelAction:" destination="534" id="535"/>
<action selector="performMiniaturize:" destination="23" id="37"/>
<action selector="performZoom:" destination="239" id="240"/>
<action selector="print:" destination="78" id="86"/>
<action selector="raiseBaseline:" destination="409" id="426"/>
<action selector="redo:" destination="215" id="231"/>
<action selector="revertDocumentToSaved:" destination="112" id="364"/>
<action selector="runPageLayout:" destination="77" id="87"/>
<action selector="runToolbarCustomizationPalette:" destination="298" id="365"/>
<action selector="saveDocument:" destination="75" id="362"/>
<action selector="selectAll:" destination="198" id="232"/>
<action selector="showGuessPanel:" destination="204" id="230"/>
<action selector="showHelp:" destination="492" id="493"/>
<action selector="startSpeaking:" destination="196" id="233"/>
<action selector="stopSpeaking:" destination="195" id="227"/>
<action selector="subscript:" destination="408" id="429"/>
<action selector="superscript:" destination="407" id="430"/>
<action selector="tightenKerning:" destination="418" id="431"/>
<action selector="toggleAutomaticDashSubstitution:" destination="460" id="461"/>
<action selector="toggleAutomaticLinkDetection:" destination="354" id="357"/>
<action selector="toggleAutomaticQuoteSubstitution:" destination="351" id="356"/>
<action selector="toggleAutomaticSpellingCorrection:" destination="454" id="456"/>
<action selector="toggleAutomaticTextReplacement:" destination="462" id="463"/>
<action selector="toggleContinuousSpellChecking:" destination="219" id="222"/>
<action selector="toggleGrammarChecking:" destination="346" id="347"/>
<action selector="toggleRuler:" destination="505" id="520"/>
<action selector="toggleSmartInsertDelete:" destination="350" id="355"/>
<action selector="toggleToolbarShown:" destination="297" id="366"/>
<action selector="turnOffKerning:" destination="417" id="441"/>
<action selector="turnOffLigatures:" destination="413" id="440"/>
<action selector="underline:" destination="392" id="432"/>
<action selector="undo:" destination="207" id="223"/>
<action selector="unhideAllApplications:" destination="150" id="370"/>
<action selector="unscript:" destination="406" id="437"/>
<action selector="uppercaseWord:" destination="452" id="464"/>
<action selector="useAllLigatures:" destination="414" id="434"/>
<action selector="useStandardKerning:" destination="416" id="438"/>
<action selector="useStandardLigatures:" destination="412" id="439"/>
</connections>
</customObject>
<customObject id="-3" userLabel="Application">
<connections>
<action selector="terminate:" destination="136" id="449"/>
</connections>
</customObject>
<menu title="AMainMenu" systemMenu="main" id="29">
<items>
<menuItem title="EZAudioCoreGraphicsWaveformExample" id="56">
<menu key="submenu" title="EZAudioCoreGraphicsWaveformExample" systemMenu="apple" id="57">
<items>
<menuItem title="About EZAudioCoreGraphicsWaveformExample" id="58">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="236">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Preferences…" keyEquivalent="," id="129"/>
<menuItem isSeparatorItem="YES" id="143">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Services" id="131">
<menu key="submenu" title="Services" systemMenu="services" id="130"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="144">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Hide EZAudioCoreGraphicsWaveformExample" keyEquivalent="h" id="134"/>
<menuItem title="Hide Others" keyEquivalent="h" id="145">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
</menuItem>
<menuItem title="Show All" id="150"/>
<menuItem isSeparatorItem="YES" id="149">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Quit EZAudioCoreGraphicsWaveformExample" keyEquivalent="q" id="136"/>
</items>
</menu>
</menuItem>
<menuItem title="File" id="83">
<menu key="submenu" title="File" id="81">
<items>
<menuItem title="New" keyEquivalent="n" id="82"/>
<menuItem title="Open…" keyEquivalent="o" id="72"/>
<menuItem title="Open Recent" id="124">
<menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="125">
<items>
<menuItem title="Clear Menu" id="126"/>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="79">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Close" keyEquivalent="w" id="73"/>
<menuItem title="Save…" keyEquivalent="s" id="75"/>
<menuItem title="Revert to Saved" id="112">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="74">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Page Setup..." keyEquivalent="P" id="77">
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
</menuItem>
<menuItem title="Print…" keyEquivalent="p" id="78"/>
</items>
</menu>
</menuItem>
<menuItem title="Edit" id="217">
<menu key="submenu" title="Edit" id="205">
<items>
<menuItem title="Undo" keyEquivalent="z" id="207"/>
<menuItem title="Redo" keyEquivalent="Z" id="215">
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="206">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Cut" keyEquivalent="x" id="199"/>
<menuItem title="Copy" keyEquivalent="c" id="197"/>
<menuItem title="Paste" keyEquivalent="v" id="203"/>
<menuItem title="Paste and Match Style" keyEquivalent="V" id="485">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
</menuItem>
<menuItem title="Delete" id="202"/>
<menuItem title="Select All" keyEquivalent="a" id="198"/>
<menuItem isSeparatorItem="YES" id="214">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Find" id="218">
<menu key="submenu" title="Find" id="220">
<items>
<menuItem title="Find…" tag="1" keyEquivalent="f" id="209"/>
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="534">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
</menuItem>
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="208"/>
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="213">
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
</menuItem>
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="221"/>
<menuItem title="Jump to Selection" keyEquivalent="j" id="210"/>
</items>
</menu>
</menuItem>
<menuItem title="Spelling and Grammar" id="216">
<menu key="submenu" title="Spelling and Grammar" id="200">
<items>
<menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="204"/>
<menuItem title="Check Document Now" keyEquivalent=";" id="201"/>
<menuItem isSeparatorItem="YES" id="453"/>
<menuItem title="Check Spelling While Typing" id="219"/>
<menuItem title="Check Grammar With Spelling" id="346"/>
<menuItem title="Correct Spelling Automatically" id="454">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Substitutions" id="348">
<menu key="submenu" title="Substitutions" id="349">
<items>
<menuItem title="Show Substitutions" id="457">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="459"/>
<menuItem title="Smart Copy/Paste" tag="1" keyEquivalent="f" id="350"/>
<menuItem title="Smart Quotes" tag="2" keyEquivalent="g" id="351"/>
<menuItem title="Smart Dashes" id="460">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Smart Links" tag="3" keyEquivalent="G" id="354">
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
</menuItem>
<menuItem title="Text Replacement" id="462">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Transformations" id="450">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Transformations" id="451">
<items>
<menuItem title="Make Upper Case" id="452">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Make Lower Case" id="465">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Capitalize" id="466">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Speech" id="211">
<menu key="submenu" title="Speech" id="212">
<items>
<menuItem title="Start Speaking" id="196"/>
<menuItem title="Stop Speaking" id="195"/>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Format" id="375">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Format" id="376">
<items>
<menuItem title="Font" id="377">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Font" systemMenu="font" id="388">
<items>
<menuItem title="Show Fonts" keyEquivalent="t" id="389"/>
<menuItem title="Bold" tag="2" keyEquivalent="b" id="390"/>
<menuItem title="Italic" tag="1" keyEquivalent="i" id="391"/>
<menuItem title="Underline" keyEquivalent="u" id="392"/>
<menuItem isSeparatorItem="YES" id="393"/>
<menuItem title="Bigger" tag="3" keyEquivalent="+" id="394"/>
<menuItem title="Smaller" tag="4" keyEquivalent="-" id="395"/>
<menuItem isSeparatorItem="YES" id="396"/>
<menuItem title="Kern" id="397">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Kern" id="415">
<items>
<menuItem title="Use Default" id="416">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Use None" id="417">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Tighten" id="418">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Loosen" id="419">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Ligatures" id="398">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Ligatures" id="411">
<items>
<menuItem title="Use Default" id="412">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Use None" id="413">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Use All" id="414">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Baseline" id="399">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Baseline" id="405">
<items>
<menuItem title="Use Default" id="406">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Superscript" id="407">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Subscript" id="408">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Raise" id="409">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Lower" id="410">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="400"/>
<menuItem title="Show Colors" keyEquivalent="C" id="401"/>
<menuItem isSeparatorItem="YES" id="402"/>
<menuItem title="Copy Style" keyEquivalent="c" id="403">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
</menuItem>
<menuItem title="Paste Style" keyEquivalent="v" id="404">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Text" id="496">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Text" id="497">
<items>
<menuItem title="Align Left" keyEquivalent="{" id="498"/>
<menuItem title="Center" keyEquivalent="|" id="499"/>
<menuItem title="Justify" id="500">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Align Right" keyEquivalent="}" id="501"/>
<menuItem isSeparatorItem="YES" id="502"/>
<menuItem title="Writing Direction" id="503">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Writing Direction" id="508">
<items>
<menuItem title="Paragraph" enabled="NO" id="509">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="510">
<string key="title"> Default</string>
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="511">
<string key="title"> Left to Right</string>
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="512">
<string key="title"> Right to Left</string>
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="513"/>
<menuItem title="Selection" enabled="NO" id="514">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="515">
<string key="title"> Default</string>
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="516">
<string key="title"> Left to Right</string>
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="517">
<string key="title"> Right to Left</string>
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="504"/>
<menuItem title="Show Ruler" id="505">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Copy Ruler" keyEquivalent="c" id="506">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
</menuItem>
<menuItem title="Paste Ruler" keyEquivalent="v" id="507">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="View" id="295">
<menu key="submenu" title="View" id="296">
<items>
<menuItem title="Show Toolbar" keyEquivalent="t" id="297">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
</menuItem>
<menuItem title="Customize Toolbar…" id="298"/>
</items>
</menu>
</menuItem>
<menuItem title="Window" id="19">
<menu key="submenu" title="Window" systemMenu="window" id="24">
<items>
<menuItem title="Minimize" keyEquivalent="m" id="23"/>
<menuItem title="Zoom" id="239"/>
<menuItem isSeparatorItem="YES" id="92">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Bring All to Front" id="5"/>
</items>
</menu>
</menuItem>
<menuItem title="Help" id="490">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" systemMenu="help" id="491">
<items>
<menuItem title="EZAudioCoreGraphicsWaveformExample Help" keyEquivalent="?" id="492"/>
</items>
</menu>
</menuItem>
</items>
</menu>
<window title="EZAudioCoreGraphicsWaveformExample" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="371">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="335" y="390" width="480" height="360"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/>
<view key="contentView" id="372">
<rect key="frame" x="0.0" y="0.0" width="480" height="360"/>
<autoresizingMask key="autoresizingMask"/>
</view>
</window>
<customObject id="494" customClass="AppDelegate">
<connections>
<outlet property="window" destination="371" id="532"/>
</connections>
</customObject>
<customObject id="420" customClass="NSFontManager">
<connections>
<action selector="addFontTrait:" destination="390" id="421"/>
<action selector="addFontTrait:" destination="391" id="422"/>
<action selector="modifyFont:" destination="395" id="423"/>
<action selector="modifyFont:" destination="394" id="425"/>
<action selector="orderFrontFontPanel:" destination="389" id="424"/>
</connections>
</customObject>
</objects>
</document>
@@ -1,58 +0,0 @@
//
// CoreGraphicsWaveformViewController.h
// EZAudioCoreGraphicsWaveformExample
//
// 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 <Cocoa/Cocoa.h>
// Import EZAudio header
#import "EZAudio.h"
/**
We will allow this view controller to act as an EZMicrophoneDelegate. This is how we listen for the microphone callback.
*/
@interface CoreGraphicsWaveformViewController : NSViewController <EZMicrophoneDelegate>
#pragma mark - Components
/**
The CoreGraphics based audio plot
*/
@property (nonatomic,weak) IBOutlet EZAudioPlot *audioPlot;
/**
The microphone component
*/
@property (nonatomic,strong) EZMicrophone *microphone;
#pragma mark - Actions
/**
Switches the plot drawing type between a buffer plot (visualizes the current stream of audio data from the update function) or a rolling plot (visualizes the audio data over time, this is the classic waveform look)
*/
-(IBAction)changePlotType:(id)sender;
/**
Toggles the microphone on and off. When the microphone is on it will send its delegate (aka this view controller) the audio data in various ways (check out the EZMicrophoneDelegate documentation for more details);
*/
-(IBAction)toggleMicrophone:(id)sender;
@end
@@ -1,164 +0,0 @@
//
// CoreGraphicsWaveformViewController.m
// EZAudioCoreGraphicsWaveformExample
//
// 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 "CoreGraphicsWaveformViewController.h"
@interface CoreGraphicsWaveformViewController ()
@end
@implementation CoreGraphicsWaveformViewController
#pragma mark - Initialization
-(id)init {
self = [super initWithNibName:NSStringFromClass(self.class) bundle:nil];
if(self){
[self initializeViewController];
}
return self;
}
-(id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithNibName:NSStringFromClass(self.class) bundle:nil];
if(self){
[self initializeViewController];
}
return self;
}
-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:NSStringFromClass(self.class) bundle:nil];
if(self){
[self initializeViewController];
}
return self;
}
#pragma mark - Initialize View Controller
-(void)initializeViewController {
// Create an instance of the microphone and tell it to use this view controller instance as the delegate
self.microphone = [EZMicrophone microphoneWithDelegate:self];
}
#pragma mark - Customize the Audio Plot
-(void)awakeFromNib {
/*
Customizing the audio plot's look
*/
// Background color
self.audioPlot.backgroundColor = [NSColor colorWithCalibratedRed: 0.984 green: 0.471 blue: 0.525 alpha: 1];
// Waveform color
self.audioPlot.color = [NSColor colorWithCalibratedRed: 1.000 green: 1.000 blue: 1.000 alpha: 1];
// Plot type
self.audioPlot.plotType = EZPlotTypeBuffer;
/*
Start the microphone
*/
[self.microphone startFetchingAudio];
}
#pragma mark - Actions
-(void)changePlotType:(id)sender {
NSInteger selectedSegment = [sender selectedSegment];
switch(selectedSegment){
case 0:
[self drawBufferPlot];
break;
case 1:
[self drawRollingPlot];
break;
default:
break;
}
}
-(void)toggleMicrophone:(id)sender {
switch([sender state]){
case NSOffState:
[self.microphone stopFetchingAudio];
break;
case NSOnState:
[self.microphone startFetchingAudio];
break;
default:
break;
}
}
#pragma mark - Action Extensions
/*
Give the visualization of the current buffer (this is almost exactly the openFrameworks audio input eample)
*/
-(void)drawBufferPlot {
// Change the plot type to the buffer plot
self.audioPlot.plotType = EZPlotTypeBuffer;
// Don't mirror over the x-axis
self.audioPlot.shouldMirror = NO;
// Don't fill
self.audioPlot.shouldFill = NO;
}
/*
Give the classic mirrored, rolling waveform look
*/
-(void)drawRollingPlot {
self.audioPlot.plotType = EZPlotTypeRolling;
self.audioPlot.shouldFill = YES;
self.audioPlot.shouldMirror = YES;
}
#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 {
// Getting audio data as an array of float buffer arrays. What does that mean? Because the audio is coming in as a stereo signal the data is split into a left and right channel. So buffer[0] corresponds to the float* data for the left channel while buffer[1] corresponds to the float* data for the right channel.
// 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.
dispatch_async(dispatch_get_main_queue(),^{
// All the audio plot needs is the buffer data (float*) and the size. Internally the audio plot will handle all the drawing related code, history management, and freeing its own resources. Hence, one badass line of code gets you a pretty plot :)
[self.audioPlot updateBuffer:buffer[0] withBufferSize:bufferSize];
});
}
-(void)microphone:(EZMicrophone *)microphone hasAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription {
// The AudioStreamBasicDescription of the microphone stream. This is useful when configuring the EZRecorder or telling another component what audio format type to expect.
// Here's a print function to allow you to inspect it a little easier
[EZAudio printASBD:audioStreamBasicDescription];
}
-(void)microphone:(EZMicrophone *)microphone
hasBufferList:(AudioBufferList *)bufferList
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels {
// Getting audio data as a buffer list that can be directly fed into the EZRecorder or EZOutput. Say whattt...
}
@end
@@ -1,66 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment version="1070" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="CoreGraphicsWaveformViewController">
<connections>
<outlet property="audioPlot" destination="1uw-Yi-HM2" id="64z-gn-hPW"/>
<outlet property="view" destination="1" id="2"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<customView id="1">
<rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="1uw-Yi-HM2" customClass="EZAudioPlot">
<rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button translatesAutoresizingMaskIntoConstraints="NO" id="bst-4p-f4H">
<rect key="frame" x="18" y="18" width="119" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Microphone On" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="X83-kX-Oau">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="toggleMicrophone:" target="-2" id="WUF-aw-GV2"/>
</connections>
</button>
<segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xVu-eW-fRp">
<rect key="frame" x="333" y="15" width="129" height="24"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<segmentedCell key="cell" alignment="left" style="rounded" trackingMode="selectOne" id="mpa-RS-2hy">
<font key="font" metaFont="system"/>
<segments>
<segment label="Buffer" selected="YES"/>
<segment label="Rolling" tag="1"/>
</segments>
</segmentedCell>
<connections>
<action selector="changePlotType:" target="-2" id="IsT-Sq-sKO"/>
</connections>
</segmentedControl>
</subviews>
<constraints>
<constraint firstItem="bst-4p-f4H" firstAttribute="leading" secondItem="1uw-Yi-HM2" secondAttribute="leading" constant="20" id="OEK-K5-KgC"/>
<constraint firstAttribute="bottom" secondItem="bst-4p-f4H" secondAttribute="bottom" constant="20" id="Xb8-Oc-8K5"/>
<constraint firstAttribute="bottom" secondItem="xVu-eW-fRp" secondAttribute="bottom" constant="17" id="gPn-xu-hrZ"/>
<constraint firstAttribute="trailing" secondItem="xVu-eW-fRp" secondAttribute="trailing" constant="20" id="tHh-2L-ypE"/>
</constraints>
</customView>
</subviews>
<constraints>
<constraint firstItem="1uw-Yi-HM2" firstAttribute="leading" secondItem="1" secondAttribute="leading" id="Fcx-zY-IPv"/>
<constraint firstItem="1uw-Yi-HM2" firstAttribute="top" secondItem="1" secondAttribute="top" id="Sfu-lR-KCJ"/>
<constraint firstAttribute="trailing" secondItem="1uw-Yi-HM2" secondAttribute="trailing" id="bjW-C2-2Mw"/>
<constraint firstAttribute="bottom" secondItem="1uw-Yi-HM2" secondAttribute="bottom" id="f1L-xR-BaI"/>
</constraints>
</customView>
</objects>
</document>
@@ -1,9 +0,0 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif
@@ -1,29 +0,0 @@
{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
{\colortbl;\red255\green255\blue255;}
\paperw9840\paperh8400
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
\f0\b\fs24 \cf0 Engineering:
\b0 \
Some people\
\
\b Human Interface Design:
\b0 \
Some other people\
\
\b Testing:
\b0 \
Hopefully not nobody\
\
\b Documentation:
\b0 \
Whoever\
\
\b With special thanks to:
\b0 \
Mom\
}
@@ -1,2 +0,0 @@
/* Localized versions of Info.plist keys */
@@ -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 @@
//
// 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 */
@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:EZAudioCoreGraphicsWaveformExample/EZAudioCoreGraphicsWaveformExample.xcodeproj">
</FileRef>
<FileRef
location = "group:EZAudioOpenGLWaveformExample/EZAudioOpenGLWaveformExample.xcodeproj">
</FileRef>
<FileRef
location = "group:EZAudioPlayFileExample/EZAudioPlayFileExample.xcodeproj">
</FileRef>
<FileRef
location = "group:EZAudioRecordExample/EZAudioRecordExample.xcodeproj">
</FileRef>
<FileRef
location = "group:EZAudioWaveformFromFileExample/EZAudioWaveformFromFileExample.xcodeproj">
</FileRef>
<FileRef
location = "group:EZAudioPassThroughExample/EZAudioPassThroughExample.xcodeproj">
</FileRef>
<FileRef
location = "group:EZAudioFFTExample/EZAudioFFTExample.xcodeproj">
</FileRef>
</Workspace>
@@ -1,41 +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>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>C3083F0E-46EF-4F95-B26F-149C34EA858B</string>
<key>IDESourceControlProjectName</key>
<string>EZAudioExamplesOSX</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>9D6FF97A89F512CD81EAE1A971A1D2EB03E03F7C</key>
<string>https://github.com/syedhali/EZAudio.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>EZAudioExamples/OSX/EZAudioExamplesOSX.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>9D6FF97A89F512CD81EAE1A971A1D2EB03E03F7C</key>
<string>../../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/syedhali/EZAudio.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>111</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>9D6FF97A89F512CD81EAE1A971A1D2EB03E03F7C</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>9D6FF97A89F512CD81EAE1A971A1D2EB03E03F7C</string>
<key>IDESourceControlWCCName</key>
<string>EZAudio</string>
</dict>
</array>
</dict>
</plist>
@@ -1,610 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
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 */; };
9417A9071871492100D9D37B /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 9417A9051871492100D9D37B /* Credits.rtf */; };
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 */; };
9417A9441871493900D9D37B /* AEFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A92C1871493900D9D37B /* AEFloatConverter.m */; };
9417A9451871493900D9D37B /* EZAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A92E1871493900D9D37B /* EZAudio.m */; };
9417A9461871493900D9D37B /* EZAudioFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A9301871493900D9D37B /* EZAudioFile.m */; };
9417A9471871493900D9D37B /* EZAudioPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A9321871493900D9D37B /* EZAudioPlot.m */; };
9417A9481871493900D9D37B /* EZAudioPlotGL.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A9341871493900D9D37B /* EZAudioPlotGL.m */; };
9417A9491871493900D9D37B /* EZAudioPlotGLKViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A9361871493900D9D37B /* EZAudioPlotGLKViewController.m */; };
9417A94A1871493900D9D37B /* EZMicrophone.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A9381871493900D9D37B /* EZMicrophone.m */; };
9417A94B1871493900D9D37B /* EZOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A93A1871493900D9D37B /* EZOutput.m */; };
9417A94C1871493900D9D37B /* EZPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A93C1871493900D9D37B /* EZPlot.m */; };
9417A94D1871493900D9D37B /* EZRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A93E1871493900D9D37B /* EZRecorder.m */; };
9417A94E1871493900D9D37B /* TPCircularBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 9417A93F1871493900D9D37B /* TPCircularBuffer.c */; };
9417A94F1871493900D9D37B /* CHANGELOG in Resources */ = {isa = PBXBuildFile; fileRef = 9417A9421871493900D9D37B /* CHANGELOG */; };
9417A9501871493900D9D37B /* VERSION in Resources */ = {isa = PBXBuildFile; fileRef = 9417A9431871493900D9D37B /* VERSION */; };
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 */; };
9417A959187149F000D9D37B /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9417A957187149F000D9D37B /* GLKit.framework */; };
9417A95A187149F000D9D37B /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9417A958187149F000D9D37B /* OpenGL.framework */; };
9417A95C18714A1000D9D37B /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9417A95B18714A1000D9D37B /* QuartzCore.framework */; };
9417A95E18714A2A00D9D37B /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9417A95D18714A2A00D9D37B /* Accelerate.framework */; };
9417A9D61872130200D9D37B /* FFTViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9417A9D41872130200D9D37B /* FFTViewController.m */; };
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 */
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; };
9417A8FA1871492000D9D37B /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
9417A8FB1871492000D9D37B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
9417A8FE1871492000D9D37B /* EZAudioFFTExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "EZAudioFFTExample-Info.plist"; sourceTree = "<group>"; };
9417A9001871492000D9D37B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
9417A9021871492000D9D37B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
9417A9041871492000D9D37B /* EZAudioFFTExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "EZAudioFFTExample-Prefix.pch"; sourceTree = "<group>"; };
9417A9061871492100D9D37B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = "<group>"; };
9417A9081871492100D9D37B /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
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>"; };
9417A92B1871493900D9D37B /* AEFloatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AEFloatConverter.h; sourceTree = "<group>"; };
9417A92C1871493900D9D37B /* AEFloatConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AEFloatConverter.m; sourceTree = "<group>"; };
9417A92D1871493900D9D37B /* EZAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudio.h; sourceTree = "<group>"; };
9417A92E1871493900D9D37B /* EZAudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudio.m; sourceTree = "<group>"; };
9417A92F1871493900D9D37B /* EZAudioFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFile.h; sourceTree = "<group>"; };
9417A9301871493900D9D37B /* EZAudioFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFile.m; sourceTree = "<group>"; };
9417A9311871493900D9D37B /* EZAudioPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlot.h; sourceTree = "<group>"; };
9417A9321871493900D9D37B /* EZAudioPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlot.m; sourceTree = "<group>"; };
9417A9331871493900D9D37B /* EZAudioPlotGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGL.h; sourceTree = "<group>"; };
9417A9341871493900D9D37B /* EZAudioPlotGL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGL.m; sourceTree = "<group>"; };
9417A9351871493900D9D37B /* EZAudioPlotGLKViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGLKViewController.h; sourceTree = "<group>"; };
9417A9361871493900D9D37B /* EZAudioPlotGLKViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGLKViewController.m; sourceTree = "<group>"; };
9417A9371871493900D9D37B /* EZMicrophone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZMicrophone.h; sourceTree = "<group>"; };
9417A9381871493900D9D37B /* EZMicrophone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZMicrophone.m; sourceTree = "<group>"; };
9417A9391871493900D9D37B /* EZOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZOutput.h; sourceTree = "<group>"; };
9417A93A1871493900D9D37B /* EZOutput.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZOutput.m; sourceTree = "<group>"; };
9417A93B1871493900D9D37B /* EZPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZPlot.h; sourceTree = "<group>"; };
9417A93C1871493900D9D37B /* EZPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZPlot.m; sourceTree = "<group>"; };
9417A93D1871493900D9D37B /* EZRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZRecorder.h; sourceTree = "<group>"; };
9417A93E1871493900D9D37B /* EZRecorder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZRecorder.m; sourceTree = "<group>"; };
9417A93F1871493900D9D37B /* TPCircularBuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = TPCircularBuffer.c; sourceTree = "<group>"; };
9417A9401871493900D9D37B /* TPCircularBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPCircularBuffer.h; sourceTree = "<group>"; };
9417A9421871493900D9D37B /* CHANGELOG */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CHANGELOG; sourceTree = "<group>"; };
9417A9431871493900D9D37B /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; 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; };
9417A957187149F000D9D37B /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; };
9417A958187149F000D9D37B /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
9417A95B18714A1000D9D37B /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
9417A95D18714A2A00D9D37B /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; };
9417A9D31872130200D9D37B /* FFTViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FFTViewController.h; sourceTree = "<group>"; };
9417A9D41872130200D9D37B /* FFTViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FFTViewController.m; sourceTree = "<group>"; };
9417A9D51872130200D9D37B /* FFTViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FFTViewController.xib; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
9417A8F01871492000D9D37B /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9417A95E18714A2A00D9D37B /* Accelerate.framework in Frameworks */,
9417A95C18714A1000D9D37B /* QuartzCore.framework in Frameworks */,
9417A959187149F000D9D37B /* GLKit.framework in Frameworks */,
9417A95A187149F000D9D37B /* OpenGL.framework in Frameworks */,
9417A954187149EA00D9D37B /* AudioToolbox.framework in Frameworks */,
9417A955187149EA00D9D37B /* AudioUnit.framework in Frameworks */,
9417A956187149EA00D9D37B /* CoreAudio.framework in Frameworks */,
9417A8F71871492000D9D37B /* Cocoa.framework in Frameworks */,
);
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 */
9417A8EA1871492000D9D37B = {
isa = PBXGroup;
children = (
9417A8FC1871492000D9D37B /* EZAudioFFTExample */,
9417A91A1871492100D9D37B /* EZAudioFFTExampleTests */,
9417A8F51871492000D9D37B /* Frameworks */,
9417A8F41871492000D9D37B /* Products */,
);
sourceTree = "<group>";
};
9417A8F41871492000D9D37B /* Products */ = {
isa = PBXGroup;
children = (
9417A8F31871492000D9D37B /* EZAudioFFTExample.app */,
9417A9141871492100D9D37B /* EZAudioFFTExampleTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
9417A8F51871492000D9D37B /* Frameworks */ = {
isa = PBXGroup;
children = (
9417A95D18714A2A00D9D37B /* Accelerate.framework */,
9417A95B18714A1000D9D37B /* QuartzCore.framework */,
9417A957187149F000D9D37B /* GLKit.framework */,
9417A958187149F000D9D37B /* OpenGL.framework */,
9417A951187149EA00D9D37B /* AudioToolbox.framework */,
9417A952187149EA00D9D37B /* AudioUnit.framework */,
9417A953187149EA00D9D37B /* CoreAudio.framework */,
9417A8F61871492000D9D37B /* Cocoa.framework */,
9417A9151871492100D9D37B /* XCTest.framework */,
9417A8F81871492000D9D37B /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
9417A8F81871492000D9D37B /* Other Frameworks */ = {
isa = PBXGroup;
children = (
9417A8F91871492000D9D37B /* AppKit.framework */,
9417A8FA1871492000D9D37B /* CoreData.framework */,
9417A8FB1871492000D9D37B /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
9417A8FC1871492000D9D37B /* EZAudioFFTExample */ = {
isa = PBXGroup;
children = (
9417A92A1871493900D9D37B /* EZAudio */,
9417A9081871492100D9D37B /* AppDelegate.h */,
9417A9091871492100D9D37B /* AppDelegate.m */,
9417A9D31872130200D9D37B /* FFTViewController.h */,
9417A9D41872130200D9D37B /* FFTViewController.m */,
9417A9D51872130200D9D37B /* FFTViewController.xib */,
9417A90B1871492100D9D37B /* MainMenu.xib */,
9417A90E1871492100D9D37B /* Images.xcassets */,
9417A8FD1871492000D9D37B /* Supporting Files */,
);
path = EZAudioFFTExample;
sourceTree = "<group>";
};
9417A8FD1871492000D9D37B /* Supporting Files */ = {
isa = PBXGroup;
children = (
9417A8FE1871492000D9D37B /* EZAudioFFTExample-Info.plist */,
9417A8FF1871492000D9D37B /* InfoPlist.strings */,
9417A9021871492000D9D37B /* main.m */,
9417A9041871492000D9D37B /* EZAudioFFTExample-Prefix.pch */,
9417A9051871492100D9D37B /* Credits.rtf */,
);
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>";
};
9417A92A1871493900D9D37B /* EZAudio */ = {
isa = PBXGroup;
children = (
9417A92B1871493900D9D37B /* AEFloatConverter.h */,
9417A92C1871493900D9D37B /* AEFloatConverter.m */,
9417A92D1871493900D9D37B /* EZAudio.h */,
9417A92E1871493900D9D37B /* EZAudio.m */,
9417A92F1871493900D9D37B /* EZAudioFile.h */,
9417A9301871493900D9D37B /* EZAudioFile.m */,
9417A9311871493900D9D37B /* EZAudioPlot.h */,
9417A9321871493900D9D37B /* EZAudioPlot.m */,
9417A9331871493900D9D37B /* EZAudioPlotGL.h */,
9417A9341871493900D9D37B /* EZAudioPlotGL.m */,
9417A9351871493900D9D37B /* EZAudioPlotGLKViewController.h */,
9417A9361871493900D9D37B /* EZAudioPlotGLKViewController.m */,
9417A9371871493900D9D37B /* EZMicrophone.h */,
9417A9381871493900D9D37B /* EZMicrophone.m */,
9417A9391871493900D9D37B /* EZOutput.h */,
9417A93A1871493900D9D37B /* EZOutput.m */,
9417A93B1871493900D9D37B /* EZPlot.h */,
9417A93C1871493900D9D37B /* EZPlot.m */,
9417A93D1871493900D9D37B /* EZRecorder.h */,
9417A93E1871493900D9D37B /* EZRecorder.m */,
9417A93F1871493900D9D37B /* TPCircularBuffer.c */,
9417A9401871493900D9D37B /* TPCircularBuffer.h */,
9417A9411871493900D9D37B /* VERSION */,
);
name = EZAudio;
path = ../../../../EZAudio;
sourceTree = "<group>";
};
9417A9411871493900D9D37B /* VERSION */ = {
isa = PBXGroup;
children = (
9417A9421871493900D9D37B /* CHANGELOG */,
9417A9431871493900D9D37B /* VERSION */,
);
path = VERSION;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
9417A8F21871492000D9D37B /* EZAudioFFTExample */ = {
isa = PBXNativeTarget;
buildConfigurationList = 9417A9241871492100D9D37B /* Build configuration list for PBXNativeTarget "EZAudioFFTExample" */;
buildPhases = (
9417A8EF1871492000D9D37B /* Sources */,
9417A8F01871492000D9D37B /* Frameworks */,
9417A8F11871492000D9D37B /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = EZAudioFFTExample;
productName = EZAudioFFTExample;
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 */
9417A8EB1871492000D9D37B /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0500;
ORGANIZATIONNAME = "Syed Haris Ali";
TargetAttributes = {
9417A9131871492100D9D37B = {
TestTargetID = 9417A8F21871492000D9D37B;
};
};
};
buildConfigurationList = 9417A8EE1871492000D9D37B /* Build configuration list for PBXProject "EZAudioFFTExample" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 9417A8EA1871492000D9D37B;
productRefGroup = 9417A8F41871492000D9D37B /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
9417A8F21871492000D9D37B /* EZAudioFFTExample */,
9417A9131871492100D9D37B /* EZAudioFFTExampleTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
9417A8F11871492000D9D37B /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9417A9011871492000D9D37B /* InfoPlist.strings in Resources */,
9417A9D71872130200D9D37B /* FFTViewController.xib in Resources */,
9417A90F1871492100D9D37B /* Images.xcassets in Resources */,
9417A9071871492100D9D37B /* Credits.rtf in Resources */,
9417A9501871493900D9D37B /* VERSION in Resources */,
9417A90D1871492100D9D37B /* MainMenu.xib in Resources */,
9417A94F1871493900D9D37B /* CHANGELOG in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
9417A9121871492100D9D37B /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9417A91F1871492100D9D37B /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
9417A8EF1871492000D9D37B /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9417A94D1871493900D9D37B /* EZRecorder.m in Sources */,
9417A9471871493900D9D37B /* EZAudioPlot.m in Sources */,
9417A94C1871493900D9D37B /* EZPlot.m in Sources */,
9417A9D61872130200D9D37B /* FFTViewController.m in Sources */,
9417A9441871493900D9D37B /* AEFloatConverter.m in Sources */,
9417A94A1871493900D9D37B /* EZMicrophone.m in Sources */,
9417A94B1871493900D9D37B /* EZOutput.m in Sources */,
9417A9451871493900D9D37B /* EZAudio.m in Sources */,
9417A94E1871493900D9D37B /* TPCircularBuffer.c in Sources */,
9417A9481871493900D9D37B /* EZAudioPlotGL.m in Sources */,
9417A9461871493900D9D37B /* EZAudioFile.m in Sources */,
9417A90A1871492100D9D37B /* AppDelegate.m in Sources */,
9417A9491871493900D9D37B /* EZAudioPlotGLKViewController.m in Sources */,
9417A9031871492000D9D37B /* main.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;
children = (
9417A9001871492000D9D37B /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
9417A9051871492100D9D37B /* Credits.rtf */ = {
isa = PBXVariantGroup;
children = (
9417A9061871492100D9D37B /* en */,
);
name = Credits.rtf;
sourceTree = "<group>";
};
9417A90B1871492100D9D37B /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
9417A90C1871492100D9D37B /* Base */,
);
name = MainMenu.xib;
sourceTree = "<group>";
};
9417A91D1871492100D9D37B /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
9417A91E1871492100D9D37B /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
9417A9221871492100D9D37B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
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__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = 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;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
9417A9231871492100D9D37B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
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__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = 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;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
SDKROOT = macosx;
};
name = Release;
};
9417A9251871492100D9D37B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioFFTExample/EZAudioFFTExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioFFTExample/EZAudioFFTExample-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
9417A9261871492100D9D37B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EZAudioFFTExample/EZAudioFFTExample-Prefix.pch";
INFOPLIST_FILE = "EZAudioFFTExample/EZAudioFFTExample-Info.plist";
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 */
9417A8EE1871492000D9D37B /* Build configuration list for PBXProject "EZAudioFFTExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
9417A9221871492100D9D37B /* Debug */,
9417A9231871492100D9D37B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
9417A9241871492100D9D37B /* Build configuration list for PBXNativeTarget "EZAudioFFTExample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
9417A9251871492100D9D37B /* Debug */,
9417A9261871492100D9D37B /* Release */,
);
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 */;
}
@@ -1,39 +0,0 @@
//
// AppDelegate.h
// EZAudioFFTExample
//
// Created by Syed Haris Ali on 12/30/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 <Cocoa/Cocoa.h>
#import "FFTViewController.h"
@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
/**
The FFTViewController
*/
@property (nonatomic,strong) FFTViewController *fftViewController;
@end
@@ -1,43 +0,0 @@
//
// AppDelegate.m
// EZAudioFFTExample
//
// Created by Syed Haris Ali on 12/30/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 "AppDelegate.h"
@implementation AppDelegate
@synthesize fftViewController;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Swap in our view controller in the window's content view
self.fftViewController = [[FFTViewController alloc] init];
// Resize view controller to content view's current size
self.fftViewController.view.frame = [self.window.contentView frame];
// Add resizing flags to make the view controller resize with the window
self.fftViewController.view.autoresizingMask = (NSViewWidthSizable|NSViewHeightSizable);
// Add in the core graphics view controller as subview
[self.window.contentView addSubview:self.fftViewController.view];
}
@end
@@ -1,9 +0,0 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif
@@ -1,59 +0,0 @@
//
// FFTViewController.h
// EZAudioFFTExample
//
// Created by Syed Haris Ali on 12/30/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 <Cocoa/Cocoa.h>
/**
EZAudio
*/
#import "EZAudio.h"
/**
Accelerate
*/
#import <Accelerate/Accelerate.h>
/**
The FFTViewController demonstrates how to use the Accelerate framework to calculate the real-time FFT of audio data provided by an EZAudioMicrophone.
*/
@interface FFTViewController : NSViewController <EZMicrophoneDelegate>
#pragma mark - Components
/**
EZAudioPlot for frequency plot
*/
@property (nonatomic,weak) IBOutlet EZAudioPlot *audioPlotFreq;
/**
EZAudioPlot for time plot
*/
@property (nonatomic,weak) IBOutlet EZAudioPlotGL *audioPlotTime;
/**
Microphone
*/
@property (nonatomic,strong) EZMicrophone *microphone;
@end
@@ -1,176 +0,0 @@
//
// FFTViewController.m
// EZAudioFFTExample
//
// Created by Syed Haris Ali on 12/30/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 "FFTViewController.h"
@interface FFTViewController (){
COMPLEX_SPLIT _A;
FFTSetup _FFTSetup;
BOOL _isFFTSetup;
vDSP_Length _log2n;
}
@end
@implementation FFTViewController
@synthesize audioPlotFreq;
@synthesize audioPlotTime;
@synthesize microphone;
#pragma mark - Initialization
-(id)init {
self = [super initWithNibName:NSStringFromClass(self.class) bundle:nil];
if(self){
[self initializeViewController];
}
return self;
}
-(id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithNibName:NSStringFromClass(self.class) bundle:nil];
if(self){
[self initializeViewController];
}
return self;
}
-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:NSStringFromClass(self.class) bundle:nil];
if(self){
[self initializeViewController];
}
return self;
}
#pragma mark - Initialize View Controller
-(void)initializeViewController {
// Create an instance of the microphone and tell it to use this view controller instance as the delegate
self.microphone = [EZMicrophone microphoneWithDelegate:self
startsImmediately:YES];
}
#pragma mark - Customize the Audio Plot
-(void)awakeFromNib {
// Setup time domain audio plot
self.audioPlotTime.backgroundColor = [NSColor colorWithCalibratedRed: 0.569 green: 0.82 blue: 0.478 alpha: 1];
self.audioPlotTime.color = [NSColor colorWithCalibratedRed:1.0 green:1.0 blue:1.0 alpha:1.0];
self.audioPlotTime.shouldFill = YES;
self.audioPlotTime.shouldMirror = YES;
self.audioPlotTime.plotType = EZPlotTypeRolling;
// 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;
}
#pragma mark - FFT
/**
Adapted from http://batmobile.blogs.ilrt.org/fourier-transforms-on-an-iphone/
*/
-(void)createFFTWithBufferSize:(float)bufferSize withAudioData:(float*)data {
// Setup the length
_log2n = log2f(bufferSize);
// Calculate the weights array. This is a one-off operation.
_FFTSetup = vDSP_create_fftsetup(_log2n, FFT_RADIX2);
// For an FFT, numSamples must be a power of 2, i.e. is always even
int nOver2 = bufferSize/2;
// Populate *window with the values for a hamming window function
float *window = (float *)malloc(sizeof(float)*bufferSize);
vDSP_hamm_window(window, bufferSize, 0);
// Window the samples
vDSP_vmul(data, 1, window, 1, data, 1, bufferSize);
// Define complex buffer
_A.realp = (float *) malloc(nOver2*sizeof(float));
_A.imagp = (float *) malloc(nOver2*sizeof(float));
}
-(void)updateFFTWithBufferSize:(float)bufferSize withAudioData:(float*)data {
// For an FFT, numSamples must be a power of 2, i.e. is always even
int nOver2 = bufferSize/2;
// Pack samples:
// C(re) -> A[n], C(im) -> A[n+1]
vDSP_ctoz((COMPLEX*)data, 2, &_A, 1, nOver2);
// Perform a forward FFT using fftSetup and A
// Results are returned in A
vDSP_fft_zrip(_FFTSetup, &_A, 1, _log2n, FFT_FORWARD);
// Convert COMPLEX_SPLIT A result to magnitudes
float amp[nOver2];
float maxMag = 0;
for(int i=0; i<nOver2; i++) {
// Calculate the magnitude
float mag = _A.realp[i]*_A.realp[i]+_A.imagp[i]*_A.imagp[i];
maxMag = mag > maxMag ? mag : maxMag;
}
for(int i=0; i<nOver2; i++) {
// Calculate the magnitude
float mag = _A.realp[i]*_A.realp[i]+_A.imagp[i]*_A.imagp[i];
// Bind the value to be less than 1.0 to fit in the graph
amp[i] = [EZAudio MAP:mag leftMin:0.0 leftMax:maxMag rightMin:0.0 rightMax:1.0];
}
// Update the frequency domain plot
[self.audioPlotFreq updateBuffer:amp
withBufferSize:nOver2];
}
#pragma mark - EZMicrophoneDelegate
-(void) microphone:(EZMicrophone *)microphone
hasAudioReceived:(float **)buffer
withBufferSize:(UInt32)bufferSize
withNumberOfChannels:(UInt32)numberOfChannels {
dispatch_async(dispatch_get_main_queue(), ^{
// Update time domain plot
[self.audioPlotTime updateBuffer:buffer[0]
withBufferSize:bufferSize];
// Setup the FFT if it's not already setup
if( !_isFFTSetup ){
[self createFFTWithBufferSize:bufferSize withAudioData:buffer[0]];
_isFFTSetup = YES;
}
// Get the FFT data
[self updateFFTWithBufferSize:bufferSize withAudioData:buffer[0]];
});
}
@end
@@ -1,48 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13A603" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment version="1070" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="FFTViewController">
<connections>
<outlet property="audioPlotFreq" destination="4V2-1I-w64" id="SkA-7R-4V8"/>
<outlet property="audioPlotTime" destination="Zcc-CT-67u" id="lE0-d7-KUs"/>
<outlet property="view" destination="1" id="2"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<customView id="1">
<rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<splitView dividerStyle="thin" translatesAutoresizingMaskIntoConstraints="NO" id="78b-rz-Bpl">
<rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<customView fixedFrame="YES" id="Zcc-CT-67u" customClass="EZAudioPlotGL">
<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="EZAudioPlot">
<rect key="frame" x="0.0" y="133" width="480" height="139"/>
<autoresizingMask key="autoresizingMask"/>
</customView>
</subviews>
<holdingPriorities>
<real value="250"/>
<real value="250"/>
</holdingPriorities>
</splitView>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="78b-rz-Bpl" secondAttribute="bottom" id="CZL-aU-xpy"/>
<constraint firstAttribute="trailing" secondItem="78b-rz-Bpl" secondAttribute="trailing" id="eXt-EL-upz"/>
<constraint firstItem="78b-rz-Bpl" firstAttribute="top" secondItem="1" secondAttribute="top" id="lFP-vc-nHC"/>
<constraint firstItem="78b-rz-Bpl" firstAttribute="leading" secondItem="1" secondAttribute="leading" id="lWl-1T-nHB"/>
</constraints>
</customView>
</objects>
</document>
@@ -1,29 +0,0 @@
{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
{\colortbl;\red255\green255\blue255;}
\paperw9840\paperh8400
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
\f0\b\fs24 \cf0 Engineering:
\b0 \
Some people\
\
\b Human Interface Design:
\b0 \
Some other people\
\
\b Testing:
\b0 \
Hopefully not nobody\
\
\b Documentation:
\b0 \
Whoever\
\
\b With special thanks to:
\b0 \
Mom\
}
@@ -1,2 +0,0 @@
/* Localized versions of Info.plist keys */

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