diff --git a/Audio/AudioPlayer.m b/Audio/AudioPlayer.m index 717debdfc..46d34e320 100644 --- a/Audio/AudioPlayer.m +++ b/Audio/AudioPlayer.m @@ -218,9 +218,9 @@ && [[nextStream host] isEqualToString:[[lastChain streamURL] host]] && [[nextStream path] isEqualToString:[[lastChain streamURL] path]]) { - if ([lastChain setTrack:nextStream]) { - [newChain openWithInput:[lastChain inputNode] withOutputFormat:[output format]]; - + if ([lastChain setTrack:nextStream] + && [newChain openWithInput:[lastChain inputNode] withOutputFormat:[output format]]) + { [newChain setStreamURL:nextStream]; [newChain setUserInfo:nextStreamUserInfo]; diff --git a/Audio/Utils/DBLog.h b/Audio/Utils/DBLog.h deleted file mode 100644 index 8c3fb0825..000000000 --- a/Audio/Utils/DBLog.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * NSDebug.h - * Cog - * - * Created by Vincent Spader on 5/30/05. - * Copyright 2005 Vincent Spader All rights reserved. - * - */ - -#include - -#ifdef __cplusplus -extern "C" -{ -#endif - - void DBLog(NSString *format, ...); - -#ifdef __cplusplus -}; -#endif diff --git a/Audio/Utils/DBLog.m b/Audio/Utils/DBLog.m deleted file mode 100644 index db96956ab..000000000 --- a/Audio/Utils/DBLog.m +++ /dev/null @@ -1,25 +0,0 @@ -/* - * NSDebug.c - * Cog - * - * Created by Vincent Spader on 5/30/05. - * Copyright 2005 Vincent Spader All rights reserved. - * - */ - -#include "DBLog.h" - - -void DBLog(NSString *format, ...) -{ -#ifdef DEBUG - - va_list ap; - - va_start(ap, format); - - NSLogv(format, ap); - - va_end(ap); -#endif -} diff --git a/Frameworks/MAD/Files/config.h b/Frameworks/MAD/Files/config.h index e88ae685a..09dd5049d 100644 --- a/Frameworks/MAD/Files/config.h +++ b/Frameworks/MAD/Files/config.h @@ -71,10 +71,10 @@ #define HAVE_WAITPID 1 /* Define to disable debugging assertions. */ -/* #undef NDEBUG */ +#define NDEBUG /* Define to optimize for accuracy over speed. */ -/* #undef OPT_ACCURACY */ +#define OPT_ACCURACY 1 /* Define to optimize for speed over accuracy. */ /* #undef OPT_SPEED */ diff --git a/Playlist/PlaylistLoader.m b/Playlist/PlaylistLoader.m index 0fd9323c1..de742b431 100755 --- a/Playlist/PlaylistLoader.m +++ b/Playlist/PlaylistLoader.m @@ -147,7 +147,8 @@ NSMutableSet *uniqueURLs = [NSMutableSet set]; NSMutableArray *expandedURLs = [NSMutableArray array]; - NSMutableArray *allURLs = [NSMutableArray array]; + NSMutableArray *containedURLs = [NSMutableArray array]; + NSMutableArray *fileURLs = [NSMutableArray array]; NSMutableArray *validURLs = [NSMutableArray array]; if (!urls) @@ -181,6 +182,8 @@ [expandedURLs addObject:url]; } } + + NSLog(@"Expanded urls: %@", expandedURLs); NSArray *sortedURLs; if (sort == YES) @@ -202,19 +205,23 @@ //File url if ([[self acceptableContainerTypes] containsObject:[[[url path] pathExtension] lowercaseString]] && ([url fragment] == nil)) { if ([url isFileURL] ) { - [allURLs addObjectsFromArray:[AudioContainer urlsForContainerURL:url]]; + [containedURLs addObjectsFromArray:[AudioContainer urlsForContainerURL:url]]; //Make sure the container isn't added twice. - [uniqueURLs addObject:url]; + [uniqueURLs addObjectsFromArray:containedURLs]; } } else { - [allURLs addObject:url]; + [fileURLs addObject:url]; } } - urlEnumerator = [allURLs objectEnumerator]; + NSLog(@"File urls: %@", fileURLs); + + NSLog(@"Contained urls: %@", containedURLs); + + urlEnumerator = [fileURLs objectEnumerator]; while (url = [urlEnumerator nextObject]) { if (![[AudioPlayer schemes] containsObject:[url scheme]]) @@ -231,6 +238,22 @@ [uniqueURLs addObject:url]; } } + + NSLog(@"Valid urls: %@", validURLs); + + urlEnumerator = [containedURLs objectEnumerator]; + while (url = [urlEnumerator nextObject]) + { + if (![[AudioPlayer schemes] containsObject:[url scheme]]) + continue; + + //Need a better way to determine acceptable file types than basing it on extensions. + if (![[AudioPlayer fileTypes] containsObject:[[[url path] pathExtension] lowercaseString]]) + continue; + + [validURLs addObject:url]; + } + //Create actual entries int i; diff --git a/Plugins/CueSheet/CueSheet.m b/Plugins/CueSheet/CueSheet.m index 332d8afea..5e36b3f6d 100644 --- a/Plugins/CueSheet/CueSheet.m +++ b/Plugins/CueSheet/CueSheet.m @@ -27,11 +27,9 @@ NSMutableString *unixPath = [path mutableCopy]; NSString *fragment = @""; - NSRange fragmentRange = [path rangeOfString:@"#"]; + NSRange fragmentRange = [path rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"#0123456789"] options:(NSAnchoredSearch | NSBackwardsSearch)]; if (fragmentRange.location != NSNotFound) { - fragmentRange = NSMakeRange(fragmentRange.location, [unixPath length] - fragmentRange.location); - fragment = [unixPath substringWithRange:fragmentRange]; [unixPath deleteCharactersInRange:fragmentRange]; } @@ -49,6 +47,8 @@ return [NSURL URLWithString:[[[NSURL fileURLWithPath:unixPath] absoluteString] stringByAppendingString: fragment]]; } + + - (void)parseFile:(NSString *)filename { NSError *error = nil; diff --git a/Plugins/GME/GameContainer.m b/Plugins/GME/GameContainer.m index e8deee209..680559118 100755 --- a/Plugins/GME/GameContainer.m +++ b/Plugins/GME/GameContainer.m @@ -18,13 +18,13 @@ NSMutableArray *types = [NSMutableArray array]; gme_type_t const* type = gme_type_list(); while(*type) - { - //We're digging a little deep here, but there seems to be no other choice. - [types addObject:[NSString stringWithCString:(*type)->extension_ encoding: NSASCIIStringEncoding]]; - - type++; - } - + { + //We're digging a little deep here, but there seems to be no other choice. + [types addObject:[NSString stringWithCString:(*type)->extension_ encoding: NSASCIIStringEncoding]]; + + type++; + } + return [[types copy] autorelease]; } @@ -44,9 +44,15 @@ Music_Emu *emu; error = gme_open_file([[url path] UTF8String], &emu, 44100); int track_count = gme_track_count(emu); - + + //If there is only one track, we shouldn't append the # + if (track_count == 1) { + NSLog(@"Track count is 1...%@", url); + return [NSArray arrayWithObject:url]; + } + NSMutableArray *tracks = [NSMutableArray array]; - + int i; for (i = 0; i < track_count; i++) { [tracks addObject:[NSURL URLWithString:[[url absoluteString] stringByAppendingFormat:@"#%i", i]]]; diff --git a/Plugins/M3u/M3uContainer.m b/Plugins/M3u/M3uContainer.m index 012f47e61..58dbc6ee3 100644 --- a/Plugins/M3u/M3uContainer.m +++ b/Plugins/M3u/M3uContainer.m @@ -32,11 +32,9 @@ NSMutableString *unixPath = [path mutableCopy]; NSString *fragment = @""; - NSRange fragmentRange = [path rangeOfString:@"#"]; + NSRange fragmentRange = [path rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"#0123456789"] options:(NSAnchoredSearch | NSBackwardsSearch)]; if (fragmentRange.location != NSNotFound) { - fragmentRange = NSMakeRange(fragmentRange.location, [unixPath length] - fragmentRange.location); - fragment = [unixPath substringWithRange:fragmentRange]; [unixPath deleteCharactersInRange:fragmentRange]; } diff --git a/Plugins/Pls/PlsContainer.m b/Plugins/Pls/PlsContainer.m index db1553e53..e64545870 100644 --- a/Plugins/Pls/PlsContainer.m +++ b/Plugins/Pls/PlsContainer.m @@ -32,11 +32,9 @@ NSMutableString *unixPath = [path mutableCopy]; NSString *fragment = @""; - NSRange fragmentRange = [path rangeOfString:@"#"]; + NSRange fragmentRange = [path rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"#0123456789"] options:(NSAnchoredSearch | NSBackwardsSearch)]; if (fragmentRange.location != NSNotFound) { - fragmentRange = NSMakeRange(fragmentRange.location, [unixPath length] - fragmentRange.location); - fragment = [unixPath substringWithRange:fragmentRange]; [unixPath deleteCharactersInRange:fragmentRange]; } @@ -54,6 +52,8 @@ return [NSURL URLWithString:[[[NSURL fileURLWithPath:unixPath] absoluteString] stringByAppendingString: fragment]]; } + + + (NSArray *)urlsForContainerURL:(NSURL *)url { if (![url isFileURL])