Bug fixes from 0.07 branch.

CQTexperiment
vspader 2007-10-19 02:23:10 +00:00
parent e54c72aae0
commit d82fdcbf62
9 changed files with 55 additions and 74 deletions

View File

@ -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];

View File

@ -1,21 +0,0 @@
/*
* NSDebug.h
* Cog
*
* Created by Vincent Spader on 5/30/05.
* Copyright 2005 Vincent Spader All rights reserved.
*
*/
#include <Cocoa/Cocoa.h>
#ifdef __cplusplus
extern "C"
{
#endif
void DBLog(NSString *format, ...);
#ifdef __cplusplus
};
#endif

View File

@ -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
}

View File

@ -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 */

View File

@ -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;

View File

@ -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;

View File

@ -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]]];

View File

@ -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];
}

View File

@ -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])