Compare commits

..

1 Commits

Author SHA1 Message Date
Syed Haris Ali b3c6a8611f Update README.md 2022-03-22 14:06:28 -05:00
6 changed files with 83 additions and 29 deletions
+26
View File
@@ -0,0 +1,26 @@
//
// EZAudioOSX.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 <EZAudioOSX/EZAudio.h>
+4 -2
View File
@@ -136,11 +136,13 @@ BOOL __shouldExitOnCheckResultFail = YES;
+ (void)freeFloatBuffers:(float **)buffers numberOfChannels:(UInt32)channels
{
if (!buffers || !*buffers) {
if (!buffers || !*buffers)
{
return;
}
for (int i = 0; i < channels; i++) {
for (int i = 0; i < channels; i++)
{
free(buffers[i]);
}
free(buffers);
+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>
+1 -5
View File
@@ -218,10 +218,6 @@ FOUNDATION_EXPORT Float64 const EZOutputDefaultSampleRate;
//------------------------------------------------------------------------------
@property (nonatomic, readonly) UInt32 maximumFramesPerSlice;
//------------------------------------------------------------------------------
///-----------------------------------------------------------
/// @name Setting/Getting The Data Source and Delegate
///-----------------------------------------------------------
@@ -377,4 +373,4 @@ FOUNDATION_EXPORT Float64 const EZOutputDefaultSampleRate;
*/
- (OSType)outputAudioUnitSubType;
@end
@end
+21 -22
View File
@@ -82,6 +82,7 @@ OSStatus EZOutputGraphRenderCallback(void *inRefCon,
//------------------------------------------------------------------------------
@interface EZOutput ()
@property (nonatomic, strong) EZAudioFloatConverter *floatConverter;
@property (nonatomic, assign) EZOutputInfo *info;
@end
@@ -97,8 +98,12 @@ OSStatus EZOutputGraphRenderCallback(void *inRefCon,
- (void)dealloc
{
[EZAudioUtilities freeFloatBuffers:self.info->floatData
numberOfChannels:self.info->clientFormat.mChannelsPerFrame];
if (self.floatConverter)
{
self.floatConverter = nil;
[EZAudioUtilities freeFloatBuffers:self.info->floatData
numberOfChannels:self.info->clientFormat.mChannelsPerFrame];
}
[EZAudioUtilities checkResult:AUGraphStop(self.info->graph)
operation:"Failed to stop graph"];
[EZAudioUtilities checkResult:AUGraphClose(self.info->graph)
@@ -449,22 +454,18 @@ OSStatus EZOutputGraphRenderCallback(void *inRefCon,
return volume;
}
- (UInt32)maximumFramesPerSlice {
return EZOutputMaximumFramesPerSlice;
}
//------------------------------------------------------------------------------
#pragma mark - Setters
//------------------------------------------------------------------------------
- (void)setClientFormat:(AudioStreamBasicDescription)clientFormat
{
// if (self.floatConverter)
// {
// self.floatConverter = nil;
// [EZAudioUtilities freeFloatBuffers:self.info->floatData
// numberOfChannels:self.clientFormat.mChannelsPerFrame];
// }
if (self.floatConverter)
{
self.floatConverter = nil;
[EZAudioUtilities freeFloatBuffers:self.info->floatData
numberOfChannels:self.clientFormat.mChannelsPerFrame];
}
self.info->clientFormat = clientFormat;
[EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->converterNodeInfo.audioUnit,
@@ -489,7 +490,7 @@ OSStatus EZOutputGraphRenderCallback(void *inRefCon,
sizeof(self.info->clientFormat))
operation:"Failed to set output client format on mixer audio unit"];
// self.floatConverter = [[EZAudioFloatConverter alloc] initWithInputFormat:clientFormat];
self.floatConverter = [[EZAudioFloatConverter alloc] initWithInputFormat:clientFormat];
self.info->floatData = [EZAudioUtilities floatBuffersWithNumberOfFrames:EZOutputMaximumFramesPerSlice
numberOfChannels:clientFormat.mChannelsPerFrame];
}
@@ -738,17 +739,15 @@ OSStatus EZOutputGraphRenderCallback(void *inRefCon,
{
if ([output.delegate respondsToSelector:@selector(output:playedAudio:withBufferSize:withNumberOfChannels:)])
{
UInt32 channels = output.info->clientFormat.mChannelsPerFrame;
UInt32 frames = ioData->mBuffers[0].mDataByteSize / output.info->clientFormat.mBytesPerFrame;
float **data = output.info->floatData;
for (int i = 0; i < ioData->mNumberBuffers; i++) {
memcpy(data[i], ioData->mBuffers[i].mData, ioData->mBuffers[i].mDataByteSize);
}
[output.floatConverter convertDataFromAudioBufferList:ioData
withNumberOfFrames:frames
toFloatBuffers:output.info->floatData];
[output.delegate output:output
playedAudio:data
withBufferSize:frames
withNumberOfChannels:channels];
playedAudio:output.info->floatData
withBufferSize:inNumberFrames
withNumberOfChannels:output.info->clientFormat.mChannelsPerFrame];
}
}
return noErr;
}
}
+5
View File
@@ -11,6 +11,11 @@ I'd really like to start creating a list of projects made using EZAudio. If you'
To start it off:
- [Detour](https://www.detour.com/) - Gorgeous location-aware audio walks
- [Jumpshare](https://jumpshare.com/) - Incredibly fast, real-time file sharing
- Piano Tuner (Home Edition)
- Piano Tuner (Pro Edition)
- Music Pitch Detector
- Piano Prober
- Multi Tuner
## Features