Hopefully fix the last of the Automatic Reference Counting issues that remained.

CQTexperiment
Chris Moeller 2016-06-19 12:57:18 -07:00
parent 0213dd9741
commit 03b825ced3
51 changed files with 244 additions and 83 deletions

View File

@ -12,6 +12,7 @@
- (long)tell;
- (long)read:(void *)buffer amount:(long)amount; //reads UP TO amount, returns amount read.
- (void)close;
- (void)dealloc;
@end
@protocol CogContainer <NSObject>
@ -39,6 +40,8 @@
- (void)close;
@optional
- (void)dealloc;
- (BOOL)setTrack:(NSURL *)track;
//These are in NSObject, so as long as you are a subclass of that, you are ok.

View File

@ -242,7 +242,7 @@ static PluginController *sharedPluginController = nil;
- (NSArray *) urlsForContainerURL:(NSURL *)url
{
NSString *ext = [[url path] pathExtension];
NSString *ext = [url pathExtension];
NSArray *containerSet = [containers objectForKey:[ext lowercaseString]];
NSString *classString;
if (containerSet) {
@ -265,7 +265,7 @@ static PluginController *sharedPluginController = nil;
//Note: Source is assumed to already be opened.
- (id<CogDecoder>) audioDecoderForSource:(id <CogSource>)source
{
NSString *ext = [[[source url] path] pathExtension];
NSString *ext = [[source url] pathExtension];
NSArray *decoders = [decodersByExtension objectForKey:[ext lowercaseString]];
NSString *classString;
if (decoders) {
@ -287,7 +287,7 @@ static PluginController *sharedPluginController = nil;
- (NSDictionary *)metadataForURL:(NSURL *)url
{
NSString *ext = [[url path] pathExtension];
NSString *ext = [url pathExtension];
NSArray *readers = [metadataReaders objectForKey:[ext lowercaseString]];
NSString *classString;
if (readers) {
@ -311,7 +311,7 @@ static PluginController *sharedPluginController = nil;
//If no properties reader is defined, use the decoder's properties.
- (NSDictionary *)propertiesForURL:(NSURL *)url
{
NSString *ext = [[url path] pathExtension];
NSString *ext = [url pathExtension];
id<CogSource> source = [self audioSourceForURL:url];
if (![source open:url])

View File

@ -62,11 +62,6 @@
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
<AdditionalOption
key = "NSZombieEnabled"
value = "YES"
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
</LaunchAction>
<ProfileAction

View File

@ -111,7 +111,7 @@ NSURL *resolveAliases(NSURL *url)
{
[[NSFileManager defaultManager] fileExistsAtPath:[u path] isDirectory:&isDir];
if (!isDir && ![[AudioPlayer fileTypes] containsObject:[[[u path] pathExtension] lowercaseString]])
if (!isDir && ![[AudioPlayer fileTypes] containsObject:[[u pathExtension] lowercaseString]])
{
continue;
}
@ -120,7 +120,7 @@ NSURL *resolveAliases(NSURL *url)
{
newNode = [[DirectoryNode alloc] initWithDataSource:dataSource url:u];
}
else if ([[AudioPlayer containerTypes] containsObject:[[[u path] pathExtension] lowercaseString]])
else if ([[AudioPlayer containerTypes] containsObject:[[u pathExtension] lowercaseString]])
{
newNode = [[ContainerNode alloc] initWithDataSource:dataSource url:u];
}

View File

@ -682,6 +682,7 @@
1DEB91B208733DA50010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
ENABLE_TESTABILITY = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
@ -702,6 +703,7 @@
1DEB91B308733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "Developer ID Application";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_PREPROCESSOR_DEFINITIONS = (

View File

@ -1541,6 +1541,7 @@
1DEB91B208733DA50010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
ENABLE_TESTABILITY = YES;
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
@ -1557,6 +1558,7 @@
1DEB91B308733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;

View File

@ -308,7 +308,6 @@
8360EF3917F92C91005208A4 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = NO;
COMBINE_HIDPI_IMAGES = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@ -333,7 +332,6 @@
8360EF3A17F92C91005208A4 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = NO;
COMBINE_HIDPI_IMAGES = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;

View File

@ -211,7 +211,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = NO;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
@ -252,7 +252,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = NO;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;

View File

@ -256,7 +256,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = NO;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
@ -299,7 +299,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = NO;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;

View File

@ -297,6 +297,7 @@
730F235909181A3A00AB638C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
ENABLE_TESTABILITY = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = __MACOSX__;
@ -308,6 +309,7 @@
730F235A09181A3A00AB638C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_PREPROCESSOR_DEFINITIONS = __MACOSX__;
OTHER_CFLAGS = (

View File

@ -311,7 +311,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = NO;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
@ -349,7 +349,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = NO;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;

View File

@ -1087,6 +1087,7 @@
1DEB91B208733DA50010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_TESTABILITY = YES;
@ -1104,6 +1105,7 @@
1DEB91B308733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "Developer ID Application";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_WARN_ABOUT_RETURN_TYPE = YES;

View File

@ -804,6 +804,7 @@
730F23F4091827B200AB638C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
ENABLE_TESTABILITY = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = __MACOSX__;
@ -815,6 +816,7 @@
730F23F5091827B200AB638C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_PREPROCESSOR_DEFINITIONS = __MACOSX__;
OTHER_CFLAGS = (

View File

@ -349,6 +349,7 @@
1DEB91B208733DA50010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
ENABLE_TESTABILITY = YES;
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
@ -364,6 +365,7 @@
1DEB91B308733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "Developer ID Application";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_WARN_ABOUT_RETURN_TYPE = YES;

View File

@ -262,7 +262,6 @@
8343784517F93CB500584396 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = NO;
COMBINE_HIDPI_IMAGES = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@ -282,7 +281,6 @@
8343784617F93CB500584396 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = NO;
COMBINE_HIDPI_IMAGES = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;

View File

@ -328,13 +328,13 @@ NSMutableDictionary * dictionaryWithPropertiesOfObject(id obj, NSArray * filterL
for (url in sortedURLs)
{
//Container vs non-container url
if ([[self acceptableContainerTypes] containsObject:[[[url path] pathExtension] lowercaseString]]) {
if ([[self acceptableContainerTypes] containsObject:[[url pathExtension] lowercaseString]]) {
[containedURLs addObjectsFromArray:[AudioContainer urlsForContainerURL:url]];
//Make sure the container isn't added twice.
[uniqueURLs addObjectsFromArray:containedURLs];
[uniqueURLs addObject:url];
}
else if ([[[[url path] pathExtension] lowercaseString] isEqualToString:@"xml"])
else if ([[[url pathExtension] lowercaseString] isEqualToString:@"xml"])
{
xmlData = [XmlContainer entriesForContainerURL:url];
}
@ -352,9 +352,11 @@ NSMutableDictionary * dictionaryWithPropertiesOfObject(id obj, NSArray * filterL
{
if (![[AudioPlayer schemes] containsObject:[url scheme]])
continue;
NSString *ext = [[url pathExtension] lowercaseString];
//Need a better way to determine acceptable file types than basing it on extensions.
if ([url isFileURL] && ![[AudioPlayer fileTypes] containsObject:[[[url path] pathExtension] lowercaseString]])
if ([url isFileURL] && ![[AudioPlayer fileTypes] containsObject:ext])
continue;
if (![uniqueURLs containsObject:url])
@ -373,7 +375,7 @@ NSMutableDictionary * dictionaryWithPropertiesOfObject(id obj, NSArray * filterL
continue;
//Need a better way to determine acceptable file types than basing it on extensions.
if ([url isFileURL] && ![[AudioPlayer fileTypes] containsObject:[[[url path] pathExtension] lowercaseString]])
if ([url isFileURL] && ![[AudioPlayer fileTypes] containsObject:[[url pathExtension] lowercaseString]])
continue;
[validURLs addObject:url];

View File

@ -84,6 +84,10 @@
apl = nil;
}
- (void)dealloc {
[self close];
}
- (long)seek:(long)frame
{

View File

@ -326,7 +326,6 @@
8359FF2A17FEF35C0060F3ED /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = NO;
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ArchiveSource/ArchiveSource-Prefix.pch";
@ -343,7 +342,6 @@
8359FF2B17FEF35C0060F3ED /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = NO;
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ArchiveSource/ArchiveSource-Prefix.pch";

View File

@ -173,8 +173,6 @@ static BOOL g_parse_unpack_path(NSString * src, NSString ** archive, NSString **
- (void)setURL:(NSURL *)url
{
[url retain];
[_url release];
_url = url;
}
@ -187,8 +185,6 @@ static BOOL g_parse_unpack_path(NSString * src, NSString ** archive, NSString **
- (void)dealloc {
[self close];
[self setURL:nil];
[super dealloc];
}
@end

View File

@ -306,7 +306,6 @@
839BCFE51965133E00947767 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = NO;
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "BASSMODS/BASSMODS-Prefix.pch";
@ -327,7 +326,6 @@
839BCFE61965133E00947767 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = NO;
CODE_SIGN_IDENTITY = "Developer ID Application";
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;

View File

@ -235,10 +235,13 @@ static void SyncProc( HSYNC handle, DWORD channel, DWORD data, void *user )
}
}
- (void)dealloc
{
[self close];
}
- (void)setSource:(id<CogSource>)s
{
[s retain];
[source release];
source = s;
}

View File

@ -40,6 +40,11 @@
}
}
- (void) dealloc
{
[self close];
}
- (BOOL)open:(id<CogSource>)source;
{
OSStatus err;

View File

@ -119,6 +119,10 @@
track = nil;
}
- (void)dealloc {
[self close];
}
- (BOOL)setTrack:(NSURL *)url
{
//Same file, just next track...this may be unnecessary since frame-based decoding is done now...

View File

@ -94,7 +94,7 @@ int scanCallback(void *data, int startOrder, long length)
dumbfile_seek( df, 0, SEEK_SET );
DUH *duh;
NSString *ext = [[[url path] pathExtension] lowercaseString];
NSString *ext = [[url pathExtension] lowercaseString];
duh = dumb_read_any_quick(df, [ext isEqualToString:@"mod"] ? 0 : 1, 0);
dumbfile_close(df);

View File

@ -134,6 +134,17 @@ DUMBFILE *dumbfile_open_memory_and_free(char *data, long size)
}
}
- (id)init
{
self = [super init];
if (self) {
sampptr = NULL;
dsr = NULL;
duh = NULL;
}
return self;
}
int callbackLoop(void *data)
{
long * loops = (long *) data;
@ -176,7 +187,7 @@ int callbackLoop(void *data)
dumbfile_seek( df, 0, SEEK_SET );
NSString *ext = [[[[s url] path] pathExtension] lowercaseString];
NSString *ext = [[[s url] pathExtension] lowercaseString];
duh = dumb_read_any(df, [ext isEqualToString:@"mod"] ? 0 : 1, subsong);
if (!duh)
{
@ -339,6 +350,11 @@ int callbackLoop(void *data)
}
}
- (void)dealloc
{
[self close];
}
- (void)setSource:(id<CogSource>)s
{
source = s;

View File

@ -56,7 +56,7 @@
}
DUH *duh;
NSString *ext = [[[url path] pathExtension] lowercaseString];
NSString *ext = [[url pathExtension] lowercaseString];
duh = dumb_read_any_quick(df, [ext isEqualToString:@"mod"] ? 0 : 1, 0);
dumbfile_close(df);

View File

@ -57,6 +57,18 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
}
}
- (id)init
{
self = [super init];
if (self) {
lastReadPacket = NULL;
lastDecodedFrame = NULL;
codecCtx = NULL;
formatCtx = NULL;
}
return self;
}
- (BOOL)open:(id<CogSource>)s
{
int errcode, i;
@ -181,6 +193,11 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
if (formatCtx) { avformat_close_input(&(formatCtx)); formatCtx = NULL; }
}
- (void)dealloc
{
[self close];
}
- (int)readAudio:(void *)buf frames:(UInt32)frames
{
if ( totalFrames && framesRead >= totalFrames )

View File

@ -146,8 +146,6 @@
- (void)setURL:(NSURL *)url
{
[url retain];
[_url release];
_url = url;
}
@ -160,8 +158,6 @@
- (void)dealloc {
[self close];
[self setURL:nil];
[super dealloc];
}
@end

View File

@ -287,6 +287,7 @@
1DEB913F08733D840010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
ENABLE_TESTABILITY = YES;
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
@ -302,6 +303,7 @@
1DEB914008733D840010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_IDENTITY = "Developer ID Application";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_WARN_ABOUT_RETURN_TYPE = YES;

View File

@ -260,6 +260,11 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS
blockBuffer = NULL;
}
- (void)dealloc
{
[self close];
}
- (long)seek:(long)sample
{
if (!FLAC__stream_decoder_seek_absolute(decoder, sample))

View File

@ -29,6 +29,15 @@ gme_err_t readCallback( void* data, void* out, long count )
return 0; //Return 0 for no error
}
- (id)init
{
self = [super init];
if (self) {
emu = NULL;
}
return self;
}
- (BOOL)open:(id<CogSource>)s
{
[self setSource:s];
@ -40,7 +49,7 @@ gme_err_t readCallback( void* data, void* out, long count )
gme_err_t error;
NSString *ext = [[[[source url] path] pathExtension] lowercaseString];
NSString *ext = [[[source url] pathExtension] lowercaseString];
gme_type_t type = gme_identify_extension([ext UTF8String]);
if (!type)
@ -170,6 +179,11 @@ gme_err_t readCallback( void* data, void* out, long count )
}
}
- (void)dealloc
{
[self close];
}
+ (NSArray *)fileTypes
{
return [NSArray arrayWithObjects:@"ay", @"gbs", @"hes", @"kss", @"nsf", @"nsfe", @"sap", @"sfm", @"sgc", @"spc", @"vgm", @"vgz", nil];

View File

@ -42,7 +42,7 @@
if (![source seekable])
return 0;
NSString *ext = [[[url path] pathExtension] lowercaseString];
NSString *ext = [[url pathExtension] lowercaseString];
gme_type_t type = gme_identify_extension([ext UTF8String]);
if (!type)

View File

@ -179,6 +179,17 @@ static psf_file_callbacks source_callbacks =
}
}
- (id)init
{
self = [super init];
if (self) {
type = 0;
emulatorCore = NULL;
emulatorExtra = NULL;
}
return self;
}
- (NSDictionary *)metadata
{
return metadataList;
@ -1471,6 +1482,11 @@ static int usf_info(void * context, const char * name, const char * value)
currentUrl = nil;
}
- (void)dealloc
{
[self close];
}
- (long)seek:(long)frame
{
if (frame < framesRead || emulatorCore == NULL) {

View File

@ -184,6 +184,11 @@ void oneTimeInit()
}
}
- (void)dealloc
{
[self close];
}
+ (NSArray *)fileTypes
{
return [NSArray arrayWithObjects:@"hvl", @"ahx", nil];

View File

@ -50,7 +50,7 @@
midi_container midi_file;
if ( !midi_processor::process_file( data, [[[url absoluteString] pathExtension] UTF8String], midi_file) )
if ( !midi_processor::process_file( data, [[url pathExtension] UTF8String], midi_file) )
return 0;
int track_num;

View File

@ -175,6 +175,12 @@ mpc_bool_t CanSeekProc(mpc_reader *p_reader)
demux = NULL;
}
[source close];
source = nil;
}
- (void)dealloc
{
[self close];
}
- (long)seek:(long)sample

View File

@ -323,7 +323,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
CLANG_ENABLE_OBJC_ARC = NO;
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Opus/Opus-Prefix.pch";
@ -346,7 +345,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
CLANG_ENABLE_OBJC_ARC = NO;
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Opus/Opus-Prefix.pch";

View File

@ -16,20 +16,20 @@
int sourceRead(void *_stream, unsigned char *_ptr, int _nbytes)
{
id source = (id)_stream;
id source = (__bridge id)_stream;
return (int) [source read:_ptr amount:_nbytes];
}
int sourceSeek(void *_stream, opus_int64 _offset, int _whence)
{
id source = (id)_stream;
id source = (__bridge id)_stream;
return ([source seek:_offset whence:_whence] ? 0 : -1);
}
int sourceClose(void *_stream)
{
id source = (id)_stream;
id source = (__bridge id)_stream;
[source close];
return 0;
@ -37,7 +37,7 @@ int sourceClose(void *_stream)
opus_int64 sourceTell(void *_stream)
{
id source = (id)_stream;
id source = (__bridge id)_stream;
return [source tell];
}
@ -54,7 +54,7 @@ opus_int64 sourceTell(void *_stream)
- (BOOL)open:(id<CogSource>)s
{
source = [s retain];
source = s;
OpusFileCallbacks callbacks = {
.read = sourceRead,
@ -64,7 +64,7 @@ opus_int64 sourceTell(void *_stream)
};
int error;
opusRef = op_open_callbacks(source, &callbacks, NULL, 0, &error);
opusRef = op_open_callbacks((__bridge void *)source, &callbacks, NULL, 0, &error);
if (!opusRef)
{
@ -125,7 +125,12 @@ opus_int64 sourceTell(void *_stream)
opusRef = NULL;
[source close];
[source release];
source = nil;
}
- (void)dealloc
{
[self close];
}
- (long)seek:(long)frame

View File

@ -81,6 +81,11 @@
shn_unload(handle);*/
}
- (void)dealloc
{
[self close];
}
- (NSDictionary *)properties
{
return [NSDictionary dictionaryWithObjectsAndKeys:

View File

@ -225,7 +225,6 @@
83F9D7EF1A884B44007ABEC2 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = NO;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = SilenceDecoder/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
@ -240,7 +239,6 @@
83F9D7F01A884B44007ABEC2 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = NO;
CODE_SIGN_IDENTITY = "Developer ID Application";
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = SilenceDecoder/Info.plist;

View File

@ -79,8 +79,6 @@ enum { channels = 2 };
- (void)setSource:(id<CogSource>)s
{
[s retain];
[source release];
source = s;
}

View File

@ -55,8 +55,6 @@
- (void)setURL:(NSURL *)url
{
[url retain];
[_url release];
_url = url;
}
@ -69,8 +67,6 @@
- (void)dealloc {
[self close];
[self setURL:nil];
[super dealloc];
}
@end

View File

@ -58,6 +58,16 @@ BOOL probe_length( Song * synSong, unsigned long * intro_length, unsigned long *
return YES;
}
- (id)init
{
self = [super init];
if (self) {
synSong = NULL;
synPlayer = NULL;
}
return self;
}
- (BOOL)open:(id<CogSource>)s
{
[s seek:0 whence:SEEK_END];
@ -221,6 +231,11 @@ BOOL probe_length( Song * synSong, unsigned long * intro_length, unsigned long *
}
}
- (void)dealloc
{
[self close];
}
+ (NSArray *)fileTypes
{
return [NSArray arrayWithObjects:@"jxs", nil];

View File

@ -122,6 +122,11 @@ long sourceTell(void *datasource)
source = nil;
}
- (void)dealloc
{
[self close];
}
- (long)seek:(long)frame
{
ov_pcm_seek(&vorbisRef, frame);

View File

@ -85,6 +85,15 @@ int32_t WriteBytesProc(void *ds, void *data, int32_t bcount)
return -1;
}
- (id)init
{
self = [super init];
if (self)
{
wpc = NULL;
}
return self;
}
- (BOOL)open:(id<CogSource>)s
{
@ -225,10 +234,18 @@ int32_t WriteBytesProc(void *ds, void *data, int32_t bcount)
- (void)close
{
WavpackCloseFile(wpc);
if (wpc) {
WavpackCloseFile(wpc);
wpc = NULL;
}
source = nil;
}
- (void)dealloc
{
[self close];
}
- (void)setSource:(id<CogSource>)s
{
source = s;

View File

@ -116,6 +116,16 @@ BOOL xm_probe_length( unsigned long * intro_length, unsigned long * loop_length,
return YES;
}
- (id)init
{
self = [super init];
if (self) {
player = NULL;
data = NULL;
}
return self;
}
- (BOOL)open:(id<CogSource>)s
{
[s seek:0 whence:SEEK_END];
@ -343,6 +353,11 @@ BOOL xm_probe_length( unsigned long * intro_length, unsigned long * loop_length,
}
}
- (void)dealloc
{
[self close];
}
+ (NSArray *)fileTypes
{
return [NSArray arrayWithObjects:@"s3m", @"s3z", @"xm", @"xmz", @"mo3", @"umx", nil];

View File

@ -248,6 +248,11 @@ BOOL probe_length( void * ptmod, unsigned long * intro_length, unsigned long * l
}
}
- (void)dealloc
{
[self close];
}
+ (NSArray *)fileTypes
{
return [NSArray arrayWithObjects:@"mod", @"mdz", @"stk", @"m15", @"fst", nil];

View File

@ -43,7 +43,7 @@
const SidTuneInfo * info = tune->getInfo();
n_channels = info->isStereo() ? 2 : 1;
n_channels = info->sidChips();
length = 3 * 60 * 44100;
@ -74,9 +74,9 @@
SidConfig conf = engine->config();
conf.frequency = 44100;
conf.playback = info->isStereo() ? SidConfig::STEREO : SidConfig::MONO;
conf.playback = (info->sidChips() > 1) ? SidConfig::STEREO : SidConfig::MONO;
conf.sidEmulation = builder;
if (engine->config(conf) < 0)
if (!engine->config(conf))
return NO;
renderedTotal = 0;
@ -222,10 +222,13 @@
}
}
- (void)dealloc
{
[self close];
}
- (void)setSource:(id<CogSource>)s
{
[s retain];
[source release];
source = s;
}

View File

@ -314,7 +314,6 @@
8314D6391A354DFE00EEE8E6 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = NO;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = sidplay/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
@ -329,7 +328,6 @@
8314D63A1A354DFE00EEE8E6 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = NO;
CODE_SIGN_IDENTITY = "Developer ID Application";
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = sidplay/Info.plist;

View File

@ -315,7 +315,6 @@
836F6B2318BDB80D0095E648 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = NO;
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "vgmstream/vgmstream-Prefix.pch";
@ -338,7 +337,6 @@
836F6B2418BDB80D0095E648 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = NO;
CODE_SIGN_IDENTITY = "Developer ID Application";
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;

View File

@ -12,23 +12,27 @@
typedef struct _COGSTREAMFILE {
STREAMFILE sf;
id file;
void *file;
off_t offset;
char name[PATH_LIMIT];
} COGSTREAMFILE;
static void cogsf_seek(COGSTREAMFILE *this, off_t offset) {
if ([this->file seek:offset whence:SEEK_SET] != 0)
NSObject* _file = (__bridge NSObject *)(this->file);
id<CogSource> __unsafe_unretained file = (id) _file;
if ([file seek:offset whence:SEEK_SET] != 0)
this->offset = offset;
else
this->offset = [this->file tell];
this->offset = [file tell];
}
static off_t cogsf_get_size(COGSTREAMFILE *this) {
off_t offset = [this->file tell];
[this->file seek:0 whence:SEEK_END];
off_t size = [this->file tell];
[this->file seek:offset whence:SEEK_SET];
NSObject* _file = (__bridge NSObject *)(this->file);
id<CogSource> __unsafe_unretained file = (id) _file;
off_t offset = [file tell];
[file seek:0 whence:SEEK_END];
off_t size = [file tell];
[file seek:offset whence:SEEK_SET];
return size;
}
@ -42,17 +46,19 @@ static void cogsf_get_name(COGSTREAMFILE *this, char *buffer, size_t length) {
}
static size_t cogsf_read(COGSTREAMFILE *this, uint8_t *dest, off_t offset, size_t length) {
NSObject* _file = (__bridge NSObject *)(this->file);
id<CogSource> __unsafe_unretained file = (id) _file;
size_t read;
if (this->offset != offset)
cogsf_seek(this, offset);
read = [this->file read:dest amount:length];
read = [file read:dest amount:length];
if (read > 0)
this->offset += read;
return read;
}
static void cogsf_close(COGSTREAMFILE *this) {
[this->file release];
CFBridgingRelease(this->file);
free(this);
}
@ -75,7 +81,7 @@ static STREAMFILE *cogsf_create(id file, const char *path) {
streamfile->sf.get_realname = (void*)cogsf_get_name;
streamfile->sf.open = (void*)cogsf_open;
streamfile->sf.close = (void*)cogsf_close;
streamfile->file = [file retain];
streamfile->file = (void*)CFBridgingRetain(file);
streamfile->offset = 0;
strncpy(streamfile->name, path, sizeof(streamfile->name));
@ -210,6 +216,12 @@ err1:
- (void)close
{
close_vgmstream( stream );
stream = NULL;
}
- (void)dealloc
{
[self close];
}
+ (NSArray *)fileTypes