Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8ec70571d5 | |||
| 551026d315 |
@@ -1,26 +0,0 @@
|
||||
//
|
||||
// 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>
|
||||
@@ -136,13 +136,11 @@ 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);
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
//
|
||||
// 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>
|
||||
+5
-1
@@ -218,6 +218,10 @@ FOUNDATION_EXPORT Float64 const EZOutputDefaultSampleRate;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@property (nonatomic, readonly) UInt32 maximumFramesPerSlice;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
///-----------------------------------------------------------
|
||||
/// @name Setting/Getting The Data Source and Delegate
|
||||
///-----------------------------------------------------------
|
||||
@@ -373,4 +377,4 @@ FOUNDATION_EXPORT Float64 const EZOutputDefaultSampleRate;
|
||||
*/
|
||||
- (OSType)outputAudioUnitSubType;
|
||||
|
||||
@end
|
||||
@end
|
||||
|
||||
+22
-21
@@ -82,7 +82,6 @@ OSStatus EZOutputGraphRenderCallback(void *inRefCon,
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@interface EZOutput ()
|
||||
@property (nonatomic, strong) EZAudioFloatConverter *floatConverter;
|
||||
@property (nonatomic, assign) EZOutputInfo *info;
|
||||
@end
|
||||
|
||||
@@ -98,12 +97,8 @@ OSStatus EZOutputGraphRenderCallback(void *inRefCon,
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if (self.floatConverter)
|
||||
{
|
||||
self.floatConverter = nil;
|
||||
[EZAudioUtilities freeFloatBuffers:self.info->floatData
|
||||
numberOfChannels:self.info->clientFormat.mChannelsPerFrame];
|
||||
}
|
||||
[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)
|
||||
@@ -454,18 +449,22 @@ 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,
|
||||
@@ -490,7 +489,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];
|
||||
}
|
||||
@@ -739,15 +738,17 @@ 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;
|
||||
[output.floatConverter convertDataFromAudioBufferList:ioData
|
||||
withNumberOfFrames:frames
|
||||
toFloatBuffers:output.info->floatData];
|
||||
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.delegate output:output
|
||||
playedAudio:output.info->floatData
|
||||
withBufferSize:inNumberFrames
|
||||
withNumberOfChannels:output.info->clientFormat.mChannelsPerFrame];
|
||||
playedAudio:data
|
||||
withBufferSize:frames
|
||||
withNumberOfChannels:channels];
|
||||
}
|
||||
}
|
||||
return noErr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,11 +11,6 @@ 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user