Skip to content
This repository has been archived by the owner on Aug 7, 2019. It is now read-only.

Add ARC to project #82

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions OrigamiEngine.podspec
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Pod::Spec.new do |s|
s.name = "OrigamiEngine"
s.version = "1.0.14"
s.version = "1.0.15"
s.summary = "Lightweight iOS/OSX audio engine with flac, cue, mp3, m4a, m3u support."
s.homepage = "https://github.com/ap4y/OrigamiEngine.git"
s.license = 'MIT'
s.author = { "ap4y" => "[email protected]" }
s.source = { :git => "https://github.com/ap4y/OrigamiEngine.git", :tag => "1.0.14", :submodules => true }
s.source = { :git => "https://github.com/ap4y/OrigamiEngine.git", :tag => "1.0.15", :submodules => true }
s.default_subspec = 'Core'
s.requires_arc = false
s.requires_arc = true
s.ios.deployment_target = '5.0'
s.osx.deployment_target = '10.7'

Expand Down
38 changes: 31 additions & 7 deletions OrigamiEngine.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@
959B580015CEE13C00D44955 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0460;
LastUpgradeCheck = 0820;
};
buildConfigurationList = 959B580315CEE13C00D44955 /* Build configuration list for PBXProject "OrigamiEngine" */;
compatibilityVersion = "Xcode 3.2";
Expand Down Expand Up @@ -664,7 +664,6 @@
9502C29F16C591C00054F4E3 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
Expand Down Expand Up @@ -696,7 +695,6 @@
9502C2A016C591C00054F4E3 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
Expand Down Expand Up @@ -729,26 +727,39 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
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_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
Expand All @@ -757,19 +768,30 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
Expand Down Expand Up @@ -834,6 +856,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "OrigamiEngine/OrigamiEngine-Prefix.pch";
INFOPLIST_FILE = "OrigamiEngineTests/OrigamiEngineTests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "origami.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = octest;
};
Expand All @@ -850,6 +873,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "OrigamiEngine/OrigamiEngine-Prefix.pch";
INFOPLIST_FILE = "OrigamiEngineTests/OrigamiEngineTests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "origami.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = octest;
};
Expand Down
13 changes: 6 additions & 7 deletions OrigamiEngine/ORGMConverter.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ @interface ORGMConverter () {
void *writeBuf;
}

@property (retain, nonatomic) ORGMInputUnit *inputUnit;
@property (unsafe_unretained, nonatomic) ORGMOutputUnit *outputUnit;
@property (retain, nonatomic) NSMutableData *convertedData;
@property (strong, nonatomic) ORGMInputUnit *inputUnit;
@property (weak, nonatomic) ORGMOutputUnit *outputUnit;
@property (strong, nonatomic) NSMutableData *convertedData;
@end

@implementation ORGMConverter
Expand All @@ -58,9 +58,8 @@ - (id)initWithInputUnit:(ORGMInputUnit *)inputUnit {
- (void)dealloc {
free(callbackBuffer);
free(writeBuf);
[_convertedData release];

_inputUnit = nil;
[super dealloc];
}

#pragma mark - public
Expand Down Expand Up @@ -158,7 +157,7 @@ - (int)convert:(void *)dest amount:(int)amount {
ioData.mBuffers[0].mNumberChannels = _outputFormat.mChannelsPerFrame;
ioData.mNumberBuffers = 1;

err = AudioConverterFillComplexBuffer(_converter, ACInputProc, self, &ioNumberFrames, &ioData, NULL);
err = AudioConverterFillComplexBuffer(_converter, ACInputProc, (__bridge void * _Nullable)(self), &ioNumberFrames, &ioData, NULL);
int amountRead = ioData.mBuffers[0].mDataByteSize;
if (err == kAudioConverterErr_InvalidInputSize) {
amountRead += [self convert:dest + amountRead amount:amount - amountRead];
Expand All @@ -171,7 +170,7 @@ static OSStatus ACInputProc(AudioConverterRef inAudioConverter,
UInt32* ioNumberDataPackets, AudioBufferList* ioData,
AudioStreamPacketDescription** outDataPacketDescription,
void* inUserData) {
ORGMConverter *converter = (ORGMConverter *)inUserData;
ORGMConverter *converter = (__bridge ORGMConverter *)inUserData;
OSStatus err = noErr;
int amountToWrite;

Expand Down
4 changes: 2 additions & 2 deletions OrigamiEngine/ORGMEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ typedef enum : NSInteger {

@discussion Value will be provided only for the `ORGMEngineStateError`, with other states this propertie will return `nil`.
*/
@property (retain, nonatomic, readonly) NSError *currentError;
@property (strong, nonatomic, readonly) NSError *currentError;

/**
The object that conforms ORGMEngineDelegate protocol and acts as the delegate.
*/
@property (unsafe_unretained, nonatomic) id<ORGMEngineDelegate> delegate;
@property (weak, nonatomic) id<ORGMEngineDelegate> delegate;

/**
Starts new playback process from corresponding source with provided output type of output unit.
Expand Down
15 changes: 4 additions & 11 deletions OrigamiEngine/ORGMEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
#import "ORGMCommonProtocols.h"

@interface ORGMEngine ()
@property (retain, nonatomic) ORGMInputUnit *input;
@property (retain, nonatomic) ORGMOutputUnit *output;
@property (retain, nonatomic) ORGMConverter *converter;
@property (strong, nonatomic) ORGMInputUnit *input;
@property (strong, nonatomic) ORGMOutputUnit *output;
@property (strong, nonatomic) ORGMConverter *converter;
@property (assign, nonatomic) ORGMEngineState currentState;
@property (retain, nonatomic) NSError *currentError;
@property (strong, nonatomic) NSError *currentError;
@end

@implementation ORGMEngine
Expand All @@ -53,10 +53,6 @@ - (id)init {

- (void)dealloc {
[self removeObserver:self forKeyPath:@"currentState"];
[_input release];
[_output release];
[_converter release];
[super dealloc];
}

#pragma mark - public
Expand All @@ -75,7 +71,6 @@ - (void)playUrl:(NSURL *)url withOutputUnitClass:(Class)outputUnitClass {

ORGMInputUnit *input = [[ORGMInputUnit alloc] init];
self.input = input;
[input release];

if (![_input openWithUrl:url]) {
self.currentState = ORGMEngineStateError;
Expand All @@ -91,13 +86,11 @@ - (void)playUrl:(NSURL *)url withOutputUnitClass:(Class)outputUnitClass {

ORGMConverter *converter = [[ORGMConverter alloc] initWithInputUnit:_input];
self.converter = converter;
[converter release];

ORGMOutputUnit *output = [[outputUnitClass alloc] initWithConverter:_converter];
output.outputFormat = _outputFormat;
self.output = output;
[_output setVolume:_volume];
[output release];

if (![_converter setupWithOutputUnit:_output]) {
self.currentState = ORGMEngineStateError;
Expand Down
4 changes: 0 additions & 4 deletions OrigamiEngine/ORGMInputUnit.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ - (id)init {
- (void)dealloc {
[self close];
free(inputBuffer);
[_decoder release];
[_source release];
[_data release];
[super dealloc];
}

#pragma mark - public
Expand Down
7 changes: 3 additions & 4 deletions OrigamiEngine/ORGMOutputUnit.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ @interface ORGMOutputUnit () {
AudioStreamBasicDescription _format;
unsigned long long _amountPlayed;
}
@property (retain, nonatomic) ORGMConverter *converter;
@property (strong, nonatomic) ORGMConverter *converter;

- (int)readData:(void *)ptr amount:(int)amount;
@end
Expand All @@ -53,7 +53,6 @@ - (id)initWithConverter:(ORGMConverter *)converter {

- (void)dealloc {
[self stop];
[super dealloc];
}

#pragma mark - public
Expand Down Expand Up @@ -130,7 +129,7 @@ static OSStatus Sound_Renderer(void *inRefCon,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData) {
ORGMOutputUnit *output = (ORGMOutputUnit *)inRefCon;
ORGMOutputUnit *output = (__bridge ORGMOutputUnit *)inRefCon;
OSStatus err = noErr;
void *readPointer = ioData->mBuffers[0].mData;

Expand Down Expand Up @@ -229,7 +228,7 @@ - (BOOL)setup {
size);

renderCallback.inputProc = Sound_Renderer;
renderCallback.inputProcRefCon = self;
renderCallback.inputProcRefCon = (__bridge void * _Nullable)(self);

AudioUnitSetProperty(outputUnit, kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input, 0, &renderCallback,
Expand Down
4 changes: 2 additions & 2 deletions OrigamiEngine/ORGMPluginManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/**
Custom plugin resolver that is used during plugin resolution process. Plugin manager fallbacks to the default implementation if `resolver` is empty or it returned `nil` value.
*/
@property (nonatomic, unsafe_unretained) id<ORGMPluginResoler> resolver;
@property (nonatomic, weak) id<ORGMPluginResoler> resolver;

+ (ORGMPluginManager *)sharedManager;

Expand Down Expand Up @@ -82,4 +82,4 @@
- (id<ORGMSource>)sourceForURL:(NSURL *)url error:(NSError **)error;
- (id<ORGMDecoder>)decoderForSource:(id<ORGMSource>)source error:(NSError **)error;
- (NSArray *)urlsForContainerURL:(NSURL *)url error:(NSError **)error;
@end
@end
11 changes: 2 additions & 9 deletions OrigamiEngine/ORGMPluginManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,6 @@ - (id)init {
return self;
}

- (void)dealloc {
[_sources release];
[_decoders release];
[_containers release];
[super dealloc];
}

- (id<ORGMSource>)sourceForURL:(NSURL *)url error:(NSError **)error {
id<ORGMSource> result;
if (_resolver && (result = [_resolver sourceForURL:url error:error])) {
Expand All @@ -115,7 +108,7 @@ - (void)dealloc {
}
return nil;
}
return [[[source alloc] init] autorelease];
return [[source alloc] init];
}

- (id<ORGMDecoder>)decoderForSource:(id<ORGMSource>)source error:(NSError **)error {
Expand All @@ -142,7 +135,7 @@ - (void)dealloc {
return nil;
}

return [[[decoder alloc] init] autorelease];
return [[decoder alloc] init] ;
}

- (NSArray *)urlsForContainerURL:(NSURL *)url error:(NSError **)error {
Expand Down
Loading