mamburu: Logging improved, no more excessive logging in release builds

CQTexperiment
Chris Moeller 2013-10-11 05:03:55 -07:00
parent 602aaa6938
commit e5a648578b
80 changed files with 445 additions and 275 deletions

View File

@ -14,6 +14,8 @@
#import "PathNode.h" #import "PathNode.h"
#import <CogAudio/Status.h> #import <CogAudio/Status.h>
#import "Logging.h"
@implementation AppController @implementation AppController
+ (void)initialize + (void)initialize
@ -298,13 +300,13 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
expandedNodes = [[NSMutableSet alloc] init]; expandedNodes = [[NSMutableSet alloc] init];
} }
NSLog(@"Nodes to expand: %@", [expandedNodes description]); DLog(@"Nodes to expand: %@", [expandedNodes description]);
NSLog(@"Num of rows: %ld", [outlineView numberOfRows]); DLog(@"Num of rows: %ld", [outlineView numberOfRows]);
if (!outlineView) if (!outlineView)
{ {
NSLog(@"outlineView is NULL!"); DLog(@"outlineView is NULL!");
} }
[outlineView reloadData]; [outlineView reloadData];
@ -376,7 +378,7 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
NSError *error; NSError *error;
[[NSFileManager defaultManager] removeItemAtPath:[folder stringByAppendingPathComponent:fileName] error:&error]; [[NSFileManager defaultManager] removeItemAtPath:[folder stringByAppendingPathComponent:fileName] error:&error];
NSLog(@"Saving expanded nodes: %@", [expandedNodes description]); DLog(@"Saving expanded nodes: %@", [expandedNodes description]);
[[NSUserDefaults standardUserDefaults] setValue:[expandedNodes allObjects] forKey:@"fileTreeViewExpandedNodes"]; [[NSUserDefaults standardUserDefaults] setValue:[expandedNodes allObjects] forKey:@"fileTreeViewExpandedNodes"];
} }
@ -583,7 +585,7 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
- (void)windowDidEnterFullScreen:(NSNotification *)notification - (void)windowDidEnterFullScreen:(NSNotification *)notification
{ {
NSLog(@"Entering fullscreen"); DLog(@"Entering fullscreen");
if (nil == nowPlaying) if (nil == nowPlaying)
{ {
nowPlaying = [[NowPlayingBarController alloc] init]; nowPlaying = [[NowPlayingBarController alloc] init];
@ -610,7 +612,7 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
- (void)windowDidExitFullScreen:(NSNotification *)notification - (void)windowDidExitFullScreen:(NSNotification *)notification
{ {
NSLog(@"Exiting fullscreen"); DLog(@"Exiting fullscreen");
if (nowPlaying) if (nowPlaying)
{ {
NSRect nowPlayingFrame = [[nowPlaying view] frame]; NSRect nowPlayingFrame = [[nowPlaying view] frame];

View File

@ -8,6 +8,8 @@
#import "PlaylistEntry.h" #import "PlaylistEntry.h"
#import "playlistLoader.h" #import "playlistLoader.h"
#import "Logging.h"
@implementation PlaybackController @implementation PlaybackController
#define DEFAULT_SEEK 5 #define DEFAULT_SEEK 5
@ -139,7 +141,7 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe)
if (playbackStatus != kCogStatusStopped) if (playbackStatus != kCogStatusStopped)
[self stop:self]; [self stop:self];
NSLog(@"PLAYLIST CONTROLLER: %@", [playlistController class]); DLog(@"PLAYLIST CONTROLLER: %@", [playlistController class]);
[playlistController setCurrentEntry:pe]; [playlistController setCurrentEntry:pe];
[self setPosition:0.0]; [self setPosition:0.0];
@ -242,7 +244,7 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe)
if (img == nil) if (img == nil)
{ {
NSLog(@"Error loading image!"); DLog(@"Error loading image!");
} }
[playbackButtons setImage:img forSegment:1]; [playbackButtons setImage:img forSegment:1];
@ -250,7 +252,7 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe)
*/ */
- (IBAction)changeVolume:(id)sender - (IBAction)changeVolume:(id)sender
{ {
NSLog(@"VOLUME: %lf, %lf", [sender doubleValue], linearToLogarithmic([sender doubleValue])); DLog(@"VOLUME: %lf, %lf", [sender doubleValue], linearToLogarithmic([sender doubleValue]));
[audioPlayer setVolume:linearToLogarithmic([sender doubleValue])]; [audioPlayer setVolume:linearToLogarithmic([sender doubleValue])];
@ -266,7 +268,7 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe)
double originalVolume = [[audioTimer userInfo] doubleValue]; double originalVolume = [[audioTimer userInfo] doubleValue];
double down = originalVolume/10; double down = originalVolume/10;
NSLog(@"VOLUME IS %lf", volume); DLog(@"VOLUME IS %lf", volume);
if (volume > 0.0001) //YAY! Roundoff error! if (volume > 0.0001) //YAY! Roundoff error!
{ {
@ -290,7 +292,7 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe)
double originalVolume = [[audioTimer userInfo] doubleValue]; double originalVolume = [[audioTimer userInfo] doubleValue];
double up = originalVolume/10; double up = originalVolume/10;
NSLog(@"VOLUME IS %lf", volume); DLog(@"VOLUME IS %lf", volume);
if (volume < originalVolume) if (volume < originalVolume)
{ {
@ -517,12 +519,12 @@ NSDictionary * makeRGInfo(PlaylistEntry *pe)
} }
if (status == kCogStatusStopped) { if (status == kCogStatusStopped) {
NSLog(@"DONE!"); DLog(@"DONE!");
[playlistController setCurrentEntry:nil]; [playlistController setCurrentEntry:nil];
[self setSeekable:NO]; // the player stopped, disable the slider [self setSeekable:NO]; // the player stopped, disable the slider
} }
else { else {
NSLog(@"PLAYING!"); DLog(@"PLAYING!");
[self setSeekable:YES]; [self setSeekable:YES];
} }

View File

@ -14,6 +14,8 @@
#import "PluginController.h" #import "PluginController.h"
#import "Logging.h"
@implementation AudioPlayer @implementation AudioPlayer
- (id)init - (id)init
@ -259,7 +261,7 @@
[newChain setUserInfo:nextStreamUserInfo]; [newChain setUserInfo:nextStreamUserInfo];
[self addChainToQueue:newChain]; [self addChainToQueue:newChain];
NSLog(@"TRACK SET!!! %@", newChain); DLog(@"TRACK SET!!! %@", newChain);
//Keep on-playin //Keep on-playin
[newChain release]; [newChain release];
@ -310,7 +312,7 @@
bufferChain = [chainQueue objectAtIndex:0]; bufferChain = [chainQueue objectAtIndex:0];
[bufferChain retain]; [bufferChain retain];
NSLog(@"New!!! %@ %@", bufferChain, [[bufferChain inputNode] decoder]); DLog(@"New!!! %@ %@", bufferChain, [[bufferChain inputNode] decoder]);
[chainQueue removeObjectAtIndex:0]; [chainQueue removeObjectAtIndex:0];
} }

View File

@ -11,6 +11,8 @@
#import "AudioSource.h" #import "AudioSource.h"
#import "CoreAudioUtils.h" #import "CoreAudioUtils.h"
#import "Logging.h"
@implementation BufferChain @implementation BufferChain
- (id)initWithController:(id)c - (id)initWithController:(id)c
@ -48,10 +50,10 @@
[self buildChain]; [self buildChain];
id<CogSource> source = [AudioSource audioSourceForURL:url]; id<CogSource> source = [AudioSource audioSourceForURL:url];
NSLog(@"Opening: %@", url); DLog(@"Opening: %@", url);
if (![source open:url]) if (![source open:url])
{ {
NSLog(@"Couldn't open source..."); DLog(@"Couldn't open source...");
return NO; return NO;
} }
@ -68,24 +70,26 @@
return YES; return YES;
} }
- (BOOL)openWithInput:(InputNode *)i withOutputFormat:(AudioStreamBasicDescription)outputFormat - (BOOL)openWithInput:(InputNode *)i withOutputFormat:(AudioStreamBasicDescription)outputFormat withRGInfo:(NSDictionary *)rgi
{ {
NSLog(@"New buffer chain!"); DLog(@"New buffer chain!");
[self buildChain]; [self buildChain];
if (![inputNode openWithDecoder:[i decoder]]) if (![inputNode openWithDecoder:[i decoder]])
return NO; return NO;
NSLog(@"Input Properties: %@", [inputNode properties]); DLog(@"Input Properties: %@", [inputNode properties]);
if (![converterNode setupWithInputFormat:propertiesToASBD([inputNode properties]) outputFormat:outputFormat]) if (![converterNode setupWithInputFormat:propertiesToASBD([inputNode properties]) outputFormat:outputFormat])
return NO; return NO;
[self setRGInfo:rgi];
return YES; return YES;
} }
- (void)launchThreads - (void)launchThreads
{ {
NSLog(@"Properties: %@", [inputNode properties]); DLog(@"Properties: %@", [inputNode properties]);
[inputNode launchThread]; [inputNode launchThread];
[converterNode launchThread]; [converterNode launchThread];
@ -125,7 +129,7 @@
[inputNode release]; [inputNode release];
[converterNode release]; [converterNode release];
NSLog(@"Bufferchain dealloc"); DLog(@"Bufferchain dealloc");
[super dealloc]; [super dealloc];
} }
@ -149,13 +153,13 @@
- (void)initialBufferFilled:(id)sender - (void)initialBufferFilled:(id)sender
{ {
NSLog(@"INITIAL BUFFER FILLED"); DLog(@"INITIAL BUFFER FILLED");
[controller launchOutputThread]; [controller launchOutputThread];
} }
- (void)inputFormatDidChange:(AudioStreamBasicDescription)format - (void)inputFormatDidChange:(AudioStreamBasicDescription)format
{ {
NSLog(@"FORMAT DID CHANGE!"); DLog(@"FORMAT DID CHANGE!");
} }

View File

@ -8,22 +8,24 @@
#import "ConverterNode.h" #import "ConverterNode.h"
#import "Logging.h"
void PrintStreamDesc (AudioStreamBasicDescription *inDesc) void PrintStreamDesc (AudioStreamBasicDescription *inDesc)
{ {
if (!inDesc) { if (!inDesc) {
printf ("Can't print a NULL desc!\n"); DLog (@"Can't print a NULL desc!\n");
return; return;
} }
printf ("- - - - - - - - - - - - - - - - - - - -\n"); DLog (@"- - - - - - - - - - - - - - - - - - - -\n");
printf (" Sample Rate:%f\n", inDesc->mSampleRate); DLog (@" Sample Rate:%f\n", inDesc->mSampleRate);
printf (" Format ID:%s\n", (char*)&inDesc->mFormatID); DLog (@" Format ID:%s\n", (char*)&inDesc->mFormatID);
printf (" Format Flags:%X\n", inDesc->mFormatFlags); DLog (@" Format Flags:%X\n", inDesc->mFormatFlags);
printf (" Bytes per Packet:%d\n", inDesc->mBytesPerPacket); DLog (@" Bytes per Packet:%d\n", inDesc->mBytesPerPacket);
printf (" Frames per Packet:%d\n", inDesc->mFramesPerPacket); DLog (@" Frames per Packet:%d\n", inDesc->mFramesPerPacket);
printf (" Bytes per Frame:%d\n", inDesc->mBytesPerFrame); DLog (@" Bytes per Frame:%d\n", inDesc->mBytesPerFrame);
printf (" Channels per Frame:%d\n", inDesc->mChannelsPerFrame); DLog (@" Channels per Frame:%d\n", inDesc->mChannelsPerFrame);
printf (" Bits per Channel:%d\n", inDesc->mBitsPerChannel); DLog (@" Bits per Channel:%d\n", inDesc->mBitsPerChannel);
printf ("- - - - - - - - - - - - - - - - - - - -\n"); DLog (@"- - - - - - - - - - - - - - - - - - - -\n");
} }
@implementation ConverterNode @implementation ConverterNode
@ -195,7 +197,7 @@ static OSStatus ACFloatProc(AudioConverterRef inAudioConverter, UInt32* ioNumber
amountRead += ioData.mBuffers[0].mDataByteSize; amountRead += ioData.mBuffers[0].mDataByteSize;
if (err == 100) if (err == 100)
{ {
NSLog(@"INSIZE: %i", amountRead); DLog(@"INSIZE: %i", amountRead);
ioData.mBuffers[0].mData = floatBuffer + amountRead; ioData.mBuffers[0].mData = floatBuffer + amountRead;
ioNumberFrames = ( amount / outputFormat.mBytesPerFrame ) - ( amountRead / floatFormat.mBytesPerFrame ); ioNumberFrames = ( amount / outputFormat.mBytesPerFrame ) - ( amountRead / floatFormat.mBytesPerFrame );
ioData.mBuffers[0].mDataByteSize = ioNumberFrames * floatFormat.mBytesPerFrame; ioData.mBuffers[0].mDataByteSize = ioNumberFrames * floatFormat.mBytesPerFrame;
@ -203,7 +205,7 @@ static OSStatus ACFloatProc(AudioConverterRef inAudioConverter, UInt32* ioNumber
} }
else if (err != noErr && err != kAudioConverterErr_InvalidInputSize) else if (err != noErr && err != kAudioConverterErr_InvalidInputSize)
{ {
NSLog(@"Error: %i", err); DLog(@"Error: %i", err);
return amountRead; return amountRead;
} }
@ -229,7 +231,7 @@ tryagain2:
amountRead += ioData.mBuffers[0].mDataByteSize; amountRead += ioData.mBuffers[0].mDataByteSize;
if (err == 100) if (err == 100)
{ {
NSLog(@"INSIZE: %i", amountRead); DLog(@"INSIZE: %i", amountRead);
ioData.mBuffers[0].mData = dest + amountRead; ioData.mBuffers[0].mData = dest + amountRead;
ioNumberFrames = ( amount - amountRead ) / outputFormat.mBytesPerFrame; ioNumberFrames = ( amount - amountRead ) / outputFormat.mBytesPerFrame;
ioData.mBuffers[0].mDataByteSize = ioNumberFrames * outputFormat.mBytesPerFrame; ioData.mBuffers[0].mDataByteSize = ioNumberFrames * outputFormat.mBytesPerFrame;
@ -237,7 +239,7 @@ tryagain2:
} }
else if (err != noErr && err != kAudioConverterErr_InvalidInputSize) else if (err != noErr && err != kAudioConverterErr_InvalidInputSize)
{ {
NSLog(@"Error: %i", err); DLog(@"Error: %i", err);
} }
return amountRead; return amountRead;
@ -248,7 +250,7 @@ tryagain2:
change:(NSDictionary *)change change:(NSDictionary *)change
context:(void *)context context:(void *)context
{ {
NSLog(@"SOMETHING CHANGED!"); DLog(@"SOMETHING CHANGED!");
if ([keyPath isEqual:@"values.volumeScaling"]) { if ([keyPath isEqual:@"values.volumeScaling"]) {
//User reset the volume scaling option //User reset the volume scaling option
[self refreshVolumeScaling]; [self refreshVolumeScaling];
@ -321,14 +323,14 @@ static float db_to_scale(float db)
stat = AudioConverterNew( &inputFormat, &floatFormat, &converterFloat ); stat = AudioConverterNew( &inputFormat, &floatFormat, &converterFloat );
if (stat != noErr) if (stat != noErr)
{ {
NSLog(@"Error creating converter %i", stat); ALog(@"Error creating converter %i", stat);
return NO; return NO;
} }
stat = AudioConverterNew ( &floatFormat, &outputFormat, &converter ); stat = AudioConverterNew ( &floatFormat, &outputFormat, &converter );
if (stat != noErr) if (stat != noErr)
{ {
NSLog(@"Error creating converter %i", stat); ALog(@"Error creating converter %i", stat);
return NO; return NO;
} }
@ -339,7 +341,7 @@ static float db_to_scale(float db)
stat = AudioConverterSetProperty(converter,kAudioConverterChannelMap,sizeof(channelMap),channelMap); stat = AudioConverterSetProperty(converter,kAudioConverterChannelMap,sizeof(channelMap),channelMap);
if (stat != noErr) if (stat != noErr)
{ {
NSLog(@"Error mapping channels %i", stat); ALog(@"Error mapping channels %i", stat);
return NO; return NO;
} }
} }
@ -350,7 +352,7 @@ static float db_to_scale(float db)
stat = AudioConverterSetProperty(converter,kAudioConverterChannelMap,sizeof(channelMap),channelMap); stat = AudioConverterSetProperty(converter,kAudioConverterChannelMap,sizeof(channelMap),channelMap);
if (stat != noErr) if (stat != noErr)
{ {
NSLog(@"Error mapping channels %i", stat); ALog(@"Error mapping channels %i", stat);
return NO; return NO;
} }
} }
@ -365,7 +367,7 @@ static float db_to_scale(float db)
- (void)dealloc - (void)dealloc
{ {
NSLog(@"Decoder dealloc"); DLog(@"Decoder dealloc");
[[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self forKeyPath:@"values.volumeScaling"]; [[NSUserDefaultsController sharedUserDefaultsController] removeObserver:self forKeyPath:@"values.volumeScaling"];
@ -376,20 +378,20 @@ static float db_to_scale(float db)
- (void)setOutputFormat:(AudioStreamBasicDescription)format - (void)setOutputFormat:(AudioStreamBasicDescription)format
{ {
NSLog(@"SETTING OUTPUT FORMAT!"); DLog(@"SETTING OUTPUT FORMAT!");
outputFormat = format; outputFormat = format;
} }
- (void)inputFormatDidChange:(AudioStreamBasicDescription)format - (void)inputFormatDidChange:(AudioStreamBasicDescription)format
{ {
NSLog(@"FORMAT CHANGED"); DLog(@"FORMAT CHANGED");
[self cleanUp]; [self cleanUp];
[self setupWithInputFormat:format outputFormat:outputFormat]; [self setupWithInputFormat:format outputFormat:outputFormat];
} }
- (void)setRGInfo:(NSDictionary *)rgi - (void)setRGInfo:(NSDictionary *)rgi
{ {
NSLog(@"Setting ReplayGain info"); DLog(@"Setting ReplayGain info");
[rgInfo release]; [rgInfo release];
[rgi retain]; [rgi retain];
rgInfo = rgi; rgInfo = rgi;

View File

@ -12,6 +12,8 @@
#import "CoreAudioUtils.h" #import "CoreAudioUtils.h"
#import "Logging.h"
@implementation InputNode @implementation InputNode
- (BOOL)openWithSource:(id<CogSource>)source - (BOOL)openWithSource:(id<CogSource>)source
@ -26,7 +28,7 @@
if (![decoder open:source]) if (![decoder open:source])
{ {
NSLog(@"Couldn't open decoder..."); ALog(@"Couldn't open decoder...");
return NO; return NO;
} }
@ -44,7 +46,7 @@
- (BOOL)openWithDecoder:(id<CogDecoder>) d - (BOOL)openWithDecoder:(id<CogDecoder>) d
{ {
NSLog(@"Opening with old decoder: %@", d); DLog(@"Opening with old decoder: %@", d);
decoder = d; decoder = d;
[decoder retain]; [decoder retain];
@ -59,14 +61,14 @@
shouldContinue = YES; shouldContinue = YES;
shouldSeek = NO; shouldSeek = NO;
NSLog(@"DONES: %@", decoder); DLog(@"DONES: %@", decoder);
return YES; return YES;
} }
- (void)registerObservers - (void)registerObservers
{ {
NSLog(@"REGISTERING OBSERVERS"); DLog(@"REGISTERING OBSERVERS");
[decoder addObserver:self [decoder addObserver:self
forKeyPath:@"properties" forKeyPath:@"properties"
options:(NSKeyValueObservingOptionNew) options:(NSKeyValueObservingOptionNew)
@ -83,7 +85,7 @@
change:(NSDictionary *)change change:(NSDictionary *)change
context:(void *)context context:(void *)context
{ {
NSLog(@"SOMETHING CHANGED!"); DLog(@"SOMETHING CHANGED!");
if ([keyPath isEqual:@"properties"]) { if ([keyPath isEqual:@"properties"]) {
//Setup converter! //Setup converter!
//Inform something of properties change //Inform something of properties change
@ -106,14 +108,14 @@
{ {
if (shouldSeek == YES) if (shouldSeek == YES)
{ {
NSLog(@"SEEKING!"); DLog(@"SEEKING!");
[decoder seek:seekFrame]; [decoder seek:seekFrame];
shouldSeek = NO; shouldSeek = NO;
NSLog(@"Seeked! Resetting Buffer"); DLog(@"Seeked! Resetting Buffer");
[self resetBuffer]; [self resetBuffer];
NSLog(@"Reset buffer!"); DLog(@"Reset buffer!");
initialBufferFilled = NO; initialBufferFilled = NO;
} }
@ -128,10 +130,10 @@
[controller initialBufferFilled:self]; [controller initialBufferFilled:self];
} }
NSLog(@"End of stream? %@", [self properties]); DLog(@"End of stream? %@", [self properties]);
endOfStream = YES; endOfStream = YES;
shouldClose = [controller endOfInputReached]; //Lets us know if we should keep going or not (occassionally, for track changes within a file) shouldClose = [controller endOfInputReached]; //Lets us know if we should keep going or not (occassionally, for track changes within a file)
NSLog(@"closing? is %i", shouldClose); DLog(@"closing? is %i", shouldClose);
break; break;
} }
@ -149,14 +151,14 @@
{ {
seekFrame = frame; seekFrame = frame;
shouldSeek = YES; shouldSeek = YES;
NSLog(@"Should seek!"); DLog(@"Should seek!");
[semaphore signal]; [semaphore signal];
} }
- (BOOL)setTrack:(NSURL *)track - (BOOL)setTrack:(NSURL *)track
{ {
if ([decoder respondsToSelector:@selector(setTrack:)] && [decoder setTrack:track]) { if ([decoder respondsToSelector:@selector(setTrack:)] && [decoder setTrack:track]) {
NSLog(@"SET TRACK!"); DLog(@"SET TRACK!");
return YES; return YES;
} }
@ -166,7 +168,7 @@
- (void)dealloc - (void)dealloc
{ {
NSLog(@"Input Node dealloc"); DLog(@"Input Node dealloc");
[decoder removeObserver:self forKeyPath:@"properties"]; [decoder removeObserver:self forKeyPath:@"properties"];
[decoder removeObserver:self forKeyPath:@"metadata"]; [decoder removeObserver:self forKeyPath:@"metadata"];

View File

@ -8,6 +8,8 @@
#import "Node.h" #import "Node.h"
#import "Logging.h"
@implementation Node @implementation Node
- (id)initWithController:(id)c previous:(id)p - (id)initWithController:(id)c previous:(id)p
@ -111,10 +113,10 @@
endOfStream = YES; endOfStream = YES;
} }
/* if (availInput <= 0) { /* if (availInput <= 0) {
NSLog(@"BUFFER RAN DRY!"); DLog(@"BUFFER RAN DRY!");
} }
else if (availInput < amount) { else if (availInput < amount) {
NSLog(@"BUFFER IN DANGER"); DLog(@"BUFFER IN DANGER");
} }
*/ */

View File

@ -11,6 +11,8 @@
#import "AudioPlayer.h" #import "AudioPlayer.h"
#import "BufferChain.h" #import "BufferChain.h"
#import "Logging.h"
@implementation OutputNode @implementation OutputNode
- (void)setup - (void)setup
@ -59,7 +61,7 @@
} }
/* if (n == 0) { /* if (n == 0) {
NSLog(@"Output Buffer dry!"); DLog(@"Output Buffer dry!");
} }
*/ */
amountPlayed += n; amountPlayed += n;

View File

@ -43,6 +43,7 @@
17F94DD50B8D0F7000A34E87 /* PluginController.h in Headers */ = {isa = PBXBuildFile; fileRef = 17F94DD30B8D0F7000A34E87 /* PluginController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 17F94DD50B8D0F7000A34E87 /* PluginController.h in Headers */ = {isa = PBXBuildFile; fileRef = 17F94DD30B8D0F7000A34E87 /* PluginController.h */; settings = {ATTRIBUTES = (Public, ); }; };
17F94DD60B8D0F7000A34E87 /* PluginController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17F94DD40B8D0F7000A34E87 /* PluginController.m */; }; 17F94DD60B8D0F7000A34E87 /* PluginController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17F94DD40B8D0F7000A34E87 /* PluginController.m */; };
17F94DDD0B8D101100A34E87 /* Plugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 17F94DDC0B8D101100A34E87 /* Plugin.h */; settings = {ATTRIBUTES = (Public, ); }; }; 17F94DDD0B8D101100A34E87 /* Plugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 17F94DDC0B8D101100A34E87 /* Plugin.h */; settings = {ATTRIBUTES = (Public, ); }; };
8384912718080FF100E7332D /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 8384912618080FF100E7332D /* Logging.h */; };
8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; }; 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
8E8D3D2F0CBAEE6E00135C1B /* AudioContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E8D3D2D0CBAEE6E00135C1B /* AudioContainer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 8E8D3D2F0CBAEE6E00135C1B /* AudioContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E8D3D2D0CBAEE6E00135C1B /* AudioContainer.h */; settings = {ATTRIBUTES = (Public, ); }; };
8E8D3D300CBAEE6E00135C1B /* AudioContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E8D3D2E0CBAEE6E00135C1B /* AudioContainer.m */; }; 8E8D3D300CBAEE6E00135C1B /* AudioContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E8D3D2E0CBAEE6E00135C1B /* AudioContainer.m */; };
@ -105,6 +106,7 @@
17F94DD40B8D0F7000A34E87 /* PluginController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PluginController.m; sourceTree = "<group>"; }; 17F94DD40B8D0F7000A34E87 /* PluginController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PluginController.m; sourceTree = "<group>"; };
17F94DDC0B8D101100A34E87 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Plugin.h; sourceTree = "<group>"; }; 17F94DDC0B8D101100A34E87 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Plugin.h; sourceTree = "<group>"; };
32DBCF5E0370ADEE00C91783 /* CogAudio_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CogAudio_Prefix.pch; sourceTree = "<group>"; }; 32DBCF5E0370ADEE00C91783 /* CogAudio_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CogAudio_Prefix.pch; sourceTree = "<group>"; };
8384912618080FF100E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* CogAudio.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CogAudio.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8DC2EF5B0486A6940098B216 /* CogAudio.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CogAudio.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8E8D3D2D0CBAEE6E00135C1B /* AudioContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioContainer.h; sourceTree = "<group>"; }; 8E8D3D2D0CBAEE6E00135C1B /* AudioContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioContainer.h; sourceTree = "<group>"; };
@ -269,6 +271,7 @@
17D21CDC0B8BE5B400D1EBDE /* Utils */ = { 17D21CDC0B8BE5B400D1EBDE /* Utils */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8384912618080FF100E7332D /* Logging.h */,
17D21CF10B8BE5EF00D1EBDE /* Semaphore.h */, 17D21CF10B8BE5EF00D1EBDE /* Semaphore.h */,
17D21CF20B8BE5EF00D1EBDE /* Semaphore.m */, 17D21CF20B8BE5EF00D1EBDE /* Semaphore.m */,
); );
@ -316,6 +319,7 @@
17B619300B909BC300BC003F /* AudioPropertiesReader.h in Headers */, 17B619300B909BC300BC003F /* AudioPropertiesReader.h in Headers */,
17ADB13C0B97926D00257CA2 /* AudioSource.h in Headers */, 17ADB13C0B97926D00257CA2 /* AudioSource.h in Headers */,
8EC1225F0B993BD500C5B3AD /* ConverterNode.h in Headers */, 8EC1225F0B993BD500C5B3AD /* ConverterNode.h in Headers */,
8384912718080FF100E7332D /* Logging.h in Headers */,
8E8D3D2F0CBAEE6E00135C1B /* AudioContainer.h in Headers */, 8E8D3D2F0CBAEE6E00135C1B /* AudioContainer.h in Headers */,
B0575F2D0D687A0800411D77 /* Helper.h in Headers */, B0575F2D0D687A0800411D77 /* Helper.h in Headers */,
07DB5F3E0ED353A900C2E3EF /* AudioMetadataWriter.h in Headers */, 07DB5F3E0ED353A900C2E3EF /* AudioMetadataWriter.h in Headers */,

View File

@ -9,6 +9,8 @@
#import "OutputCoreAudio.h" #import "OutputCoreAudio.h"
#import "OutputNode.h" #import "OutputNode.h"
#import "Logging.h"
@implementation OutputCoreAudio @implementation OutputCoreAudio
- (id)initWithController:(OutputNode *)c - (id)initWithController:(OutputNode *)c
@ -79,7 +81,7 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
OSStatus err; OSStatus err;
if (outputDevice == -1) { if (outputDevice == -1) {
NSLog(@"DEVICE IS -1"); DLog(@"DEVICE IS -1");
UInt32 size = sizeof(AudioDeviceID); UInt32 size = sizeof(AudioDeviceID);
AudioObjectPropertyAddress theAddress = { AudioObjectPropertyAddress theAddress = {
.mSelector = kAudioHardwarePropertyDefaultOutputDevice, .mSelector = kAudioHardwarePropertyDefaultOutputDevice,
@ -89,7 +91,7 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &theAddress, 0, NULL, &size, &deviceID); err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &theAddress, 0, NULL, &size, &deviceID);
if (err != noErr) { if (err != noErr) {
NSLog(@"THERES NO DEFAULT OUTPUT DEVICE"); ALog(@"THERES NO DEFAULT OUTPUT DEVICE");
return NO; return NO;
} }
@ -106,7 +108,7 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
sizeof(AudioDeviceID)); sizeof(AudioDeviceID));
if (err != noErr) { if (err != noErr) {
NSLog(@"THERES NO OUTPUT DEVICE!!!!!! %i", err); ALog(@"No output device could be found, your random error code is %i. Have a nice day!", err);
return NO; return NO;
} }

View File

@ -1,6 +1,8 @@
#import "PluginController.h" #import "PluginController.h"
#import "Plugin.h" #import "Plugin.h"
#import "Logging.h"
@implementation PluginController @implementation PluginController
@synthesize sources; @synthesize sources;
@ -66,7 +68,7 @@ static PluginController *sharedPluginController = nil;
NSArray *classNames = [[notification userInfo] objectForKey:@"NSLoadedClasses"]; NSArray *classNames = [[notification userInfo] objectForKey:@"NSLoadedClasses"];
for (NSString *className in classNames) for (NSString *className in classNames)
{ {
NSLog(@"Class loaded: %@", className); DLog(@"Class loaded: %@", className);
Class bundleClass = NSClassFromString(className); Class bundleClass = NSClassFromString(className);
if ([bundleClass conformsToProtocol:@protocol(CogContainer)]) { if ([bundleClass conformsToProtocol:@protocol(CogContainer)]) {
[self setupContainer:className]; [self setupContainer:className];
@ -181,15 +183,15 @@ static PluginController *sharedPluginController = nil;
- (void)printPluginInfo - (void)printPluginInfo
{ {
NSLog(@"Sources: %@", self.sources); ALog(@"Sources: %@", self.sources);
NSLog(@"Containers: %@", self.containers); ALog(@"Containers: %@", self.containers);
NSLog(@"Metadata Readers: %@", self.metadataReaders); ALog(@"Metadata Readers: %@", self.metadataReaders);
NSLog(@"Properties Readers By Extension: %@", self.propertiesReadersByExtension); ALog(@"Properties Readers By Extension: %@", self.propertiesReadersByExtension);
NSLog(@"Properties Readers By Mime Type: %@", self.propertiesReadersByMimeType); ALog(@"Properties Readers By Mime Type: %@", self.propertiesReadersByMimeType);
NSLog(@"Decoders by Extension: %@", self.decodersByExtension); ALog(@"Decoders by Extension: %@", self.decodersByExtension);
NSLog(@"Decoders by Mime Type: %@", self.decodersByMimeType); ALog(@"Decoders by Mime Type: %@", self.decodersByMimeType);
} }
- (id<CogSource>) audioSourceForURL:(NSURL *)url - (id<CogSource>) audioSourceForURL:(NSURL *)url

View File

@ -20,6 +20,7 @@
#include <mach/mach.h> #include <mach/mach.h>
#include <mach/mach_error.h> #include <mach/mach_error.h>
#import "Logging.h"
@implementation VirtualRingBuffer @implementation VirtualRingBuffer
@ -235,9 +236,7 @@ void *allocateVirtualBuffer(UInt32 bufferLength)
return NULL; return NULL;
} }
if (realAddress != originalAddress) { if (realAddress != originalAddress) {
#if DEBUG DLog(@"allocateVirtualBuffer: vm_allocate 2nd time didn't return same address (%p vs %p)", (void *) originalAddress, (void *) realAddress);
NSLog(@"allocateVirtualBuffer: vm_allocate 2nd time didn't return same address (%p vs %p)", originalAddress, realAddress);
#endif
goto errorReturn; goto errorReturn;
} }
@ -251,15 +250,11 @@ void *allocateVirtualBuffer(UInt32 bufferLength)
goto errorReturn; goto errorReturn;
} }
if (!memoryEntry) { if (!memoryEntry) {
#if DEBUG DLog(@"mach_make_memory_entry: returned memoryEntry of NULL");
NSLog(@"mach_make_memory_entry: returned memoryEntry of NULL");
#endif
goto errorReturn; goto errorReturn;
} }
if (memoryEntryLength != bufferLength) { if (memoryEntryLength != bufferLength) {
#if DEBUG DLog(@"mach_make_memory_entry: size changed (from %0x to %0lx)", bufferLength, memoryEntryLength);
NSLog(@"mach_make_memory_entry: size changed (from %0x to %0x)", bufferLength, memoryEntryLength);
#endif
goto errorReturn; goto errorReturn;
} }
@ -276,9 +271,7 @@ void *allocateVirtualBuffer(UInt32 bufferLength)
goto errorReturn; goto errorReturn;
} }
if (virtualAddress != realAddress + bufferLength) { if (virtualAddress != realAddress + bufferLength) {
#if DEBUG DLog(@"vm_map: didn't return correct address (%p vs %p)", (void *) realAddress + bufferLength, (void *) virtualAddress);
NSLog(@"vm_map: didn't return correct address (%p vs %p)", realAddress + bufferLength, virtualAddress);
#endif
goto errorReturn; goto errorReturn;
} }

View File

@ -23,6 +23,8 @@
#import "AudioScrobblerClient.h" #import "AudioScrobblerClient.h"
#import "PlaylistEntry.h" #import "PlaylistEntry.h"
#import "Logging.h"
// ======================================== // ========================================
// Symbolic Constants // Symbolic Constants
// ======================================== // ========================================
@ -79,7 +81,7 @@ escapeForLastFM(NSString *string)
kern_return_t result = semaphore_create(mach_task_self(), &_semaphore, SYNC_POLICY_FIFO, 0); kern_return_t result = semaphore_create(mach_task_self(), &_semaphore, SYNC_POLICY_FIFO, 0);
if(KERN_SUCCESS != result) { if(KERN_SUCCESS != result) {
NSLog(@"Couldn't create semaphore (%s).", mach_error_type(result)); ALog(@"Couldn't create semaphore (%s).", mach_error_type(result));
[self release]; [self release];
return nil; return nil;
@ -219,7 +221,7 @@ escapeForLastFM(NSString *string)
response = [client receive]; response = [client receive];
if(2 > [response length] || NSOrderedSame != [response compare:@"OK" options:NSLiteralSearch range:NSMakeRange(0,2)]) if(2 > [response length] || NSOrderedSame != [response compare:@"OK" options:NSLiteralSearch range:NSMakeRange(0,2)])
NSLog(@"AudioScrobbler error: %@", response); ALog(@"AudioScrobbler error: %@", response);
[client shutdown]; [client shutdown];
} }
@ -227,7 +229,7 @@ escapeForLastFM(NSString *string)
@catch(NSException *exception) { @catch(NSException *exception) {
[client shutdown]; [client shutdown];
// NSLog(@"Exception: %@",exception); // ALog(@"Exception: %@",exception);
[pool release]; [pool release];
continue; continue;
} }
@ -244,7 +246,7 @@ escapeForLastFM(NSString *string)
response = [client receive]; response = [client receive];
if(2 > [response length] || NSOrderedSame != [response compare:@"OK" options:NSLiteralSearch range:NSMakeRange(0,2)]) if(2 > [response length] || NSOrderedSame != [response compare:@"OK" options:NSLiteralSearch range:NSMakeRange(0,2)])
NSLog(@"AudioScrobbler error: %@", response); ALog(@"AudioScrobbler error: %@", response);
[client shutdown]; [client shutdown];
} }

View File

@ -27,6 +27,8 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#import "Logging.h"
#define kBufferSize 1024 #define kBufferSize 1024
#define kPortsToStep 5 #define kPortsToStep 5
@ -43,7 +45,7 @@ addressForHost(NSString *hostname)
if(INADDR_NONE == address) { if(INADDR_NONE == address) {
hostinfo = gethostbyname([hostname cStringUsingEncoding:NSASCIIStringEncoding]); hostinfo = gethostbyname([hostname cStringUsingEncoding:NSASCIIStringEncoding]);
if(NULL == hostinfo) { if(NULL == hostinfo) {
NSLog(@"AudioScrobblerClient error: Unable to resolve address for \"%@\".", hostname); ALog(@"AudioScrobblerClient error: Unable to resolve address for \"%@\".", hostname);
return INADDR_NONE; return INADDR_NONE;
} }
@ -99,7 +101,7 @@ addressForHost(NSString *hostname)
ssize_t bytesSent = 0; ssize_t bytesSent = 0;
if(NO == [self isConnected]) { if(NO == [self isConnected]) {
NSLog(@"AudioScrobblerClient error: Can't send data, client not connected"); ALog(@"AudioScrobblerClient error: Can't send data, client not connected");
return; return;
} }
@ -107,7 +109,7 @@ addressForHost(NSString *hostname)
bytesSent = send(_socket, utf8data + totalBytesSent, bytesToSend - totalBytesSent, 0); bytesSent = send(_socket, utf8data + totalBytesSent, bytesToSend - totalBytesSent, 0);
if(-1 == bytesSent || 0 == bytesSent) if(-1 == bytesSent || 0 == bytesSent)
NSLog(@"AudioScrobblerClient error: Unable to send data through socket: %s", strerror(errno)); ALog(@"AudioScrobblerClient error: Unable to send data through socket: %s", strerror(errno));
totalBytesSent += bytesSent; totalBytesSent += bytesSent;
} }
@ -122,14 +124,14 @@ addressForHost(NSString *hostname)
NSString *result = nil; NSString *result = nil;
if(NO == [self isConnected]) { if(NO == [self isConnected]) {
NSLog(@"AudioScrobblerClient error: Can't receive data, client not connected"); ALog(@"AudioScrobblerClient error: Can't receive data, client not connected");
return nil; return nil;
} }
do { do {
bytesRead = recv(_socket, buffer, readSize, 0); bytesRead = recv(_socket, buffer, readSize, 0);
if(-1 == bytesRead || 0 == bytesRead) { if(-1 == bytesRead || 0 == bytesRead) {
NSLog(@"AudioScrobblerClient error: Unable to receive data through socket: %s", strerror(errno)); ALog(@"AudioScrobblerClient error: Unable to receive data through socket: %s", strerror(errno));
break; break;
} }
@ -158,16 +160,16 @@ addressForHost(NSString *hostname)
result = shutdown(_socket, SHUT_WR); result = shutdown(_socket, SHUT_WR);
if(-1 == result) if(-1 == result)
NSLog(@"AudioScrobblerClient error: Socket shutdown failed: %s", strerror(errno)); ALog(@"AudioScrobblerClient error: Socket shutdown failed: %s", strerror(errno));
for(;;) { for(;;) {
bytesRead = recv(_socket, buffer, kBufferSize, 0); bytesRead = recv(_socket, buffer, kBufferSize, 0);
if(-1 == bytesRead) if(-1 == bytesRead)
NSLog(@"AudioScrobblerClient error: Waiting for shutdown confirmation failed: %s", strerror(errno)); ALog(@"AudioScrobblerClient error: Waiting for shutdown confirmation failed: %s", strerror(errno));
if(0 != bytesRead) { if(0 != bytesRead) {
NSString *received = [[NSString alloc] initWithBytes:buffer length:bytesRead encoding:NSUTF8StringEncoding]; NSString *received = [[NSString alloc] initWithBytes:buffer length:bytesRead encoding:NSUTF8StringEncoding];
NSLog(@"Received unexpected bytes during shutdown: %@", received); ALog(@"Received unexpected bytes during shutdown: %@", received);
[received release]; [received release];
} }
else else
@ -176,7 +178,7 @@ addressForHost(NSString *hostname)
result = close(_socket); result = close(_socket);
if(-1 == result) if(-1 == result)
NSLog(@"Couldn't close socket (%s)", strerror(errno)); ALog(@"Couldn't close socket (%s)", strerror(errno));
_socket = -1; _socket = -1;
_port = 0; _port = 0;
@ -198,7 +200,7 @@ addressForHost(NSString *hostname)
_socket = socket(AF_INET, SOCK_STREAM, 0); _socket = socket(AF_INET, SOCK_STREAM, 0);
if(-1 == _socket) { if(-1 == _socket) {
NSLog(@"Unable to create socket (%s)", strerror(errno)); ALog(@"Unable to create socket (%s)", strerror(errno));
return NO; return NO;
} }

View File

@ -745,6 +745,7 @@
8384911F1807F38A00E7332D /* NowPlayingBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NowPlayingBarController.m; path = Window/NowPlayingBarController.m; sourceTree = "<group>"; }; 8384911F1807F38A00E7332D /* NowPlayingBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NowPlayingBarController.m; path = Window/NowPlayingBarController.m; sourceTree = "<group>"; };
838491201807F38A00E7332D /* NowPlayingBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NowPlayingBarController.h; path = Window/NowPlayingBarController.h; sourceTree = "<group>"; }; 838491201807F38A00E7332D /* NowPlayingBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NowPlayingBarController.h; path = Window/NowPlayingBarController.h; sourceTree = "<group>"; };
838491241807F75D00E7332D /* NowPlayingBarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NowPlayingBarView.h; path = Window/NowPlayingBarView.h; sourceTree = "<group>"; }; 838491241807F75D00E7332D /* NowPlayingBarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NowPlayingBarView.h; path = Window/NowPlayingBarView.h; sourceTree = "<group>"; };
8384912518080F2D00E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Logging.h; sourceTree = "<group>"; };
8399D4E01805A55000B503B1 /* XmlContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XmlContainer.m; sourceTree = "<group>"; }; 8399D4E01805A55000B503B1 /* XmlContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XmlContainer.m; sourceTree = "<group>"; };
8399D4E11805A55000B503B1 /* XmlContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlContainer.h; sourceTree = "<group>"; }; 8399D4E11805A55000B503B1 /* XmlContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlContainer.h; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
@ -937,6 +938,7 @@
177EC0110B8BC2CF0000BC8C /* Utils */ = { 177EC0110B8BC2CF0000BC8C /* Utils */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8384912518080F2D00E7332D /* Logging.h */,
177EC01A0B8BC2CF0000BC8C /* TrackingCell.h */, 177EC01A0B8BC2CF0000BC8C /* TrackingCell.h */,
177EC01B0B8BC2CF0000BC8C /* TrackingCell.m */, 177EC01B0B8BC2CF0000BC8C /* TrackingCell.m */,
177EC01C0B8BC2CF0000BC8C /* TrackingSlider.h */, 177EC01C0B8BC2CF0000BC8C /* TrackingSlider.h */,

View File

@ -8,6 +8,7 @@
#import "FeedbackController.h" #import "FeedbackController.h"
#import "Logging.h"
@implementation FeedbackController @implementation FeedbackController
@ -35,7 +36,7 @@
- (void)feedbackDidNotSend:(FeedbackSocket *)feedback - (void)feedbackDidNotSend:(FeedbackSocket *)feedback
{ {
NSLog(@"Error sending feedback"); ALog(@"Error sending feedback");
[sendingIndicator stopAnimation:self]; [sendingIndicator stopAnimation:self];

View File

@ -8,6 +8,8 @@
#import "FeedbackSocket.h" #import "FeedbackSocket.h"
#import "Logging.h"
@implementation FeedbackSocket @implementation FeedbackSocket
NSString *encodeForURL(NSString *s) NSString *encodeForURL(NSString *s)
@ -39,7 +41,7 @@ NSString *encodeForURL(NSString *s)
NSURLResponse* response; NSURLResponse* response;
NSData* resultData = [NSURLConnection sendSynchronousRequest:post returningResponse:&response error:&error]; NSData* resultData = [NSURLConnection sendSynchronousRequest:post returningResponse:&response error:&error];
NSString *resultString = [[[NSString alloc] initWithData:resultData encoding:NSASCIIStringEncoding] autorelease]; NSString *resultString = [[[NSString alloc] initWithData:resultData encoding:NSASCIIStringEncoding] autorelease];
//NSLog(@"RESULT: %@", resultString); //DLog(@"RESULT: %@", resultString);
if ([resultString caseInsensitiveCompare:@"SUCCESS"] == NSOrderedSame) if ([resultString caseInsensitiveCompare:@"SUCCESS"] == NSOrderedSame)
{ {
[self performSelectorOnMainThread:@selector(returnSuccess:) withObject:nil waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(returnSuccess:) withObject:nil waitUntilDone:NO];

View File

@ -11,6 +11,8 @@
#import "ContainedNode.h" #import "ContainedNode.h"
#import "Logging.h"
@implementation ContainerNode @implementation ContainerNode
- (BOOL)isLeaf - (BOOL)isLeaf
@ -26,7 +28,7 @@
for (NSURL *u in urls) for (NSURL *u in urls)
{ {
ContainedNode *node = [[ContainedNode alloc] initWithDataSource:dataSource url:u]; ContainedNode *node = [[ContainedNode alloc] initWithDataSource:dataSource url:u];
NSLog(@"Node: %@", u); DLog(@"Node: %@", u);
[paths addObject:node]; [paths addObject:node];
[node release]; [node release];
} }

View File

@ -13,6 +13,8 @@
#import "DirectoryNode.h" #import "DirectoryNode.h"
#import "PathWatcher.h" #import "PathWatcher.h"
#import "Logging.h"
@implementation FileTreeDataSource @implementation FileTreeDataSource
+ (void)initialize + (void)initialize
@ -39,7 +41,7 @@
change:(NSDictionary *)change change:(NSDictionary *)change
context:(void *)context context:(void *)context
{ {
NSLog(@"File tree root URL: %@\n", [[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"fileTreeRootURL"]); DLog(@"File tree root URL: %@\n", [[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"fileTreeRootURL"]);
if ([keyPath isEqualToString:@"values.fileTreeRootURL"]) { if ([keyPath isEqualToString:@"values.fileTreeRootURL"]) {
[self setRootURL:[NSURL URLWithString:[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"fileTreeRootURL"]]]; [self setRootURL:[NSURL URLWithString:[[[NSUserDefaultsController sharedUserDefaultsController] defaults] objectForKey:@"fileTreeRootURL"]]];
} }
@ -84,10 +86,10 @@
range:NSMakeRange(0, [path length]) range:NSMakeRange(0, [path length])
] stringByStandardizingPath]; ] stringByStandardizingPath];
PathNode *node = rootNode; PathNode *node = rootNode;
NSLog(@"Root | Relative | Path: %@ | %@ | %@",[[self rootURL] path], relativePath, path); DLog(@"Root | Relative | Path: %@ | %@ | %@",[[self rootURL] path], relativePath, path);
for (NSString *c in [relativePath pathComponents]) for (NSString *c in [relativePath pathComponents])
{ {
NSLog(@"COMPONENT: %@", c); DLog(@"COMPONENT: %@", c);
BOOL found = NO; BOOL found = NO;
for (PathNode *subnode in [node subpaths]) { for (PathNode *subnode in [node subpaths]) {
if ([[[[subnode URL] path] lastPathComponent] isEqualToString:c]) { if ([[[[subnode URL] path] lastPathComponent] isEqualToString:c]) {
@ -98,7 +100,7 @@
if (!found) if (!found)
{ {
NSLog(@"Not found!"); DLog(@"Not found!");
return nil; return nil;
} }
} }
@ -108,10 +110,10 @@
- (void)pathDidChange:(NSString *)path - (void)pathDidChange:(NSString *)path
{ {
NSLog(@"PATH DID CHANGE: %@", path); DLog(@"PATH DID CHANGE: %@", path);
//Need to find the corresponding node...and call [node reloadPath], then [self reloadPathNode:node] //Need to find the corresponding node...and call [node reloadPath], then [self reloadPathNode:node]
PathNode *node = [self nodeForPath:path]; PathNode *node = [self nodeForPath:path];
NSLog(@"NODE IS: %@", node); DLog(@"NODE IS: %@", node);
[node updatePath]; [node updatePath];
[self reloadPathNode:node]; [self reloadPathNode:node];
} }
@ -155,7 +157,7 @@
[urls addObject:[p URL]]; [urls addObject:[p URL]];
[paths addObject:[[p URL] path]]; [paths addObject:[[p URL] path]];
} }
NSLog(@"Paths: %@", paths); DLog(@"Paths: %@", paths);
[pboard declareTypes:[NSArray arrayWithObjects:CogUrlsPboardType,nil] owner:nil]; //add it to pboard [pboard declareTypes:[NSArray arrayWithObjects:CogUrlsPboardType,nil] owner:nil]; //add it to pboard
[pboard setData:[NSArchiver archivedDataWithRootObject:urls] forType:CogUrlsPboardType]; [pboard setData:[NSArchiver archivedDataWithRootObject:urls] forType:CogUrlsPboardType];
[pboard addTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:self]; [pboard addTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:self];

View File

@ -17,6 +17,8 @@
#import "SmartFolderNode.h" #import "SmartFolderNode.h"
#import "ContainerNode.h" #import "ContainerNode.h"
#import "Logging.h"
@implementation PathNode @implementation PathNode
//From http://developer.apple.com/documentation/Cocoa/Conceptual/LowLevelFileMgmt/Tasks/ResolvingAliases.html //From http://developer.apple.com/documentation/Cocoa/Conceptual/LowLevelFileMgmt/Tasks/ResolvingAliases.html
@ -33,13 +35,13 @@ NSURL *resolveAliases(NSURL *url)
if (resolvedUrl != NULL) if (resolvedUrl != NULL)
{ {
//NSLog(@"Resolved..."); //DLog(@"Resolved...");
return [(NSURL *)resolvedUrl autorelease]; return [(NSURL *)resolvedUrl autorelease];
} }
} }
} }
//NSLog(@"Not resolved"); //DLog(@"Not resolved");
return url; return url;
} }
@ -101,15 +103,15 @@ NSURL *resolveAliases(NSURL *url)
PathNode *newNode; PathNode *newNode;
//NSLog(@"Before: %@", u); //DLog(@"Before: %@", u);
u = resolveAliases(u); u = resolveAliases(u);
//NSLog(@"After: %@", u); //DLog(@"After: %@", u);
BOOL isDir; BOOL isDir;
if ([[s pathExtension] caseInsensitiveCompare:@"savedSearch"] == NSOrderedSame) if ([[s pathExtension] caseInsensitiveCompare:@"savedSearch"] == NSOrderedSame)
{ {
NSLog(@"Smart folder!"); DLog(@"Smart folder!");
newNode = [[SmartFolderNode alloc] initWithDataSource:dataSource url:u]; newNode = [[SmartFolderNode alloc] initWithDataSource:dataSource url:u];
isDir = NO; isDir = NO;
} }

View File

@ -11,6 +11,8 @@
#import "FileNode.h" #import "FileNode.h"
#import "FileTreeDataSource.h" #import "FileTreeDataSource.h"
#import "Logging.h"
@implementation SmartFolderNode @implementation SmartFolderNode
- (BOOL)isLeaf - (BOOL)isLeaf
@ -32,7 +34,7 @@
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(queryFinished:) name:(NSString*)kMDQueryDidFinishNotification object:(id)query]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(queryFinished:) name:(NSString*)kMDQueryDidFinishNotification object:(id)query];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(queryUpdate:) name:(NSString*)kMDQueryDidUpdateNotification object:(id)query]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(queryUpdate:) name:(NSString*)kMDQueryDidUpdateNotification object:(id)query];
NSLog(@"Making query!"); DLog(@"Making query!");
MDQueryExecute(query, kMDQueryWantsUpdates); MDQueryExecute(query, kMDQueryWantsUpdates);
//Note: This is asynchronous! //Note: This is asynchronous!
@ -57,7 +59,7 @@
- (void)queryFinished:(NSNotification *)notification - (void)queryFinished:(NSNotification *)notification
{ {
NSLog(@"Query finished!"); DLog(@"Query finished!");
MDQueryRef query = (MDQueryRef)[notification object]; MDQueryRef query = (MDQueryRef)[notification object];
NSMutableArray *results = [NSMutableArray array]; NSMutableArray *results = [NSMutableArray array];
@ -79,7 +81,7 @@
MDQueryEnableUpdates(query); MDQueryEnableUpdates(query);
NSLog(@"Query update!"); DLog(@"Query update!");
[self processPaths:[results sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]]; [self processPaths:[results sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]];
@ -88,7 +90,7 @@
- (void)queryUpdate:(NSNotification *)notification - (void)queryUpdate:(NSNotification *)notification
{ {
NSLog(@"Query update!"); DLog(@"Query update!");
[self queryFinished: notification]; [self queryFinished: notification];
} }

View File

@ -1,6 +1,8 @@
#import "DNDArrayController.h" #import "DNDArrayController.h"
#import "Logging.h"
@implementation DNDArrayController @implementation DNDArrayController
NSString *MovedRowsType = @"MOVED_ROWS_TYPE"; NSString *MovedRowsType = @"MOVED_ROWS_TYPE";
@ -18,7 +20,7 @@ NSString *iTunesDropType = @"CorePasteboardFlavorType 0x6974756E";
- (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard - (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard
{ {
NSLog(@"INDEX SET ON DRAG: %@", rowIndexes); DLog(@"INDEX SET ON DRAG: %@", rowIndexes);
NSData *data = [NSArchiver archivedDataWithRootObject:rowIndexes]; NSData *data = [NSArchiver archivedDataWithRootObject:rowIndexes];
@ -39,7 +41,7 @@ NSString *iTunesDropType = @"CorePasteboardFlavorType 0x6974756E";
if ([info draggingSource] == tv) if ([info draggingSource] == tv)
dragOp = NSDragOperationMove; dragOp = NSDragOperationMove;
NSLog(@"VALIDATING DROP!"); DLog(@"VALIDATING DROP!");
// we want to put the object at, not over, // we want to put the object at, not over,
// the current row (contrast NSTableViewDropOn) // the current row (contrast NSTableViewDropOn)
[tv setDropRow:row dropOperation:NSTableViewDropAbove]; [tv setDropRow:row dropOperation:NSTableViewDropAbove];
@ -64,17 +66,17 @@ NSString *iTunesDropType = @"CorePasteboardFlavorType 0x6974756E";
NSIndexSet *indexSet = [NSUnarchiver unarchiveObjectWithData:[[info draggingPasteboard] dataForType:MovedRowsType]]; NSIndexSet *indexSet = [NSUnarchiver unarchiveObjectWithData:[[info draggingPasteboard] dataForType:MovedRowsType]];
if (indexSet) if (indexSet)
{ {
NSLog(@"INDEX SET ON DROP: %@", indexSet); DLog(@"INDEX SET ON DROP: %@", indexSet);
NSArray *selected = [[self arrangedObjects] objectsAtIndexes:indexSet]; NSArray *selected = [[self arrangedObjects] objectsAtIndexes:indexSet];
[self moveObjectsInArrangedObjectsFromIndexes:indexSet toIndex:row]; [self moveObjectsInArrangedObjectsFromIndexes:indexSet toIndex:row];
[self setSelectedObjects:selected]; [self setSelectedObjects:selected];
NSLog(@"ACCEPTING DROP!"); DLog(@"ACCEPTING DROP!");
return YES; return YES;
} }
} }
NSLog(@"REJECTING DROP!"); DLog(@"REJECTING DROP!");
return NO; return NO;
} }

View File

@ -21,6 +21,8 @@
#import "CogAudio/AudioPlayer.h" #import "CogAudio/AudioPlayer.h"
#import "Logging.h"
@implementation PlaylistController @implementation PlaylistController
@synthesize currentEntry; @synthesize currentEntry;
@ -163,7 +165,7 @@
- (NSString *)tableView:(NSTableView *)tv toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tc row:(int)row mouseLocation:(NSPoint)mouseLocation - (NSString *)tableView:(NSTableView *)tv toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tc row:(int)row mouseLocation:(NSPoint)mouseLocation
{ {
NSLog(@"GETTING STATUS FOR ROW: %i: %@!", row, [[[self arrangedObjects] objectAtIndex:row] statusMessage]); DLog(@"GETTING STATUS FOR ROW: %i: %@!", row, [[[self arrangedObjects] objectAtIndex:row] statusMessage]);
return [[[self arrangedObjects] objectAtIndex:row] statusMessage]; return [[[self arrangedObjects] objectAtIndex:row] statusMessage];
} }
@ -228,7 +230,7 @@
// Get files from an file drawer drop // Get files from an file drawer drop
if ([bestType isEqualToString:CogUrlsPboardType]) { if ([bestType isEqualToString:CogUrlsPboardType]) {
NSArray *urls = [NSUnarchiver unarchiveObjectWithData:[[info draggingPasteboard] dataForType:CogUrlsPboardType]]; NSArray *urls = [NSUnarchiver unarchiveObjectWithData:[[info draggingPasteboard] dataForType:CogUrlsPboardType]];
NSLog(@"URLS: %@", urls); DLog(@"URLS: %@", urls);
//[playlistLoader insertURLs: urls atIndex:row sort:YES]; //[playlistLoader insertURLs: urls atIndex:row sort:YES];
[acceptedURLs addObjectsFromArray:urls]; [acceptedURLs addObjectsFromArray:urls];
} }
@ -299,24 +301,24 @@
- (void)removeObjectsAtArrangedObjectIndexes:(NSIndexSet *)indexes - (void)removeObjectsAtArrangedObjectIndexes:(NSIndexSet *)indexes
{ {
NSLog(@"Removing indexes: %@", indexes); DLog(@"Removing indexes: %@", indexes);
NSLog(@"Current index: %i", currentEntry.index); DLog(@"Current index: %i", currentEntry.index);
if (currentEntry.index >= 0 && [indexes containsIndex:currentEntry.index]) if (currentEntry.index >= 0 && [indexes containsIndex:currentEntry.index])
{ {
currentEntry.index = -currentEntry.index - 1; currentEntry.index = -currentEntry.index - 1;
NSLog(@"Current removed: %i", currentEntry.index); DLog(@"Current removed: %i", currentEntry.index);
} }
if (currentEntry.index < 0) //Need to update the negative index if (currentEntry.index < 0) //Need to update the negative index
{ {
int i = -currentEntry.index - 1; int i = -currentEntry.index - 1;
NSLog(@"I is %i", i); DLog(@"I is %i", i);
int j; int j;
for (j = i - 1; j >= 0; j--) for (j = i - 1; j >= 0; j--)
{ {
if ([indexes containsIndex:j]) { if ([indexes containsIndex:j]) {
NSLog(@"Removing 1"); DLog(@"Removing 1");
i--; i--;
} }
} }
@ -334,7 +336,7 @@
- (void)setSortDescriptors:(NSArray *)sortDescriptors - (void)setSortDescriptors:(NSArray *)sortDescriptors
{ {
NSLog(@"Current: %@, setting: %@", [self sortDescriptors], sortDescriptors); DLog(@"Current: %@, setting: %@", [self sortDescriptors], sortDescriptors);
//Cheap hack so the index column isn't sorted //Cheap hack so the index column isn't sorted
if (([sortDescriptors count] != 0) && [[[sortDescriptors objectAtIndex:0] key] caseInsensitiveCompare:@"index"] == NSOrderedSame) if (([sortDescriptors count] != 0) && [[[sortDescriptors objectAtIndex:0] key] caseInsensitiveCompare:@"index"] == NSOrderedSame)
@ -758,7 +760,7 @@
[queueList addObject:queueItem]; [queueList addObject:queueItem];
} }
NSLog(@"TOGGLE QUEUED: %i", queueItem.queued); DLog(@"TOGGLE QUEUED: %i", queueItem.queued);
} }
int i = 0; int i = 0;

View File

@ -25,6 +25,8 @@
#import "NSData+MD5.h" #import "NSData+MD5.h"
#import "Logging.h"
@implementation PlaylistLoader @implementation PlaylistLoader
- (id)init - (id)init
@ -115,7 +117,7 @@
{ {
NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:filename createFile:YES]; NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:filename createFile:YES];
if (!fileHandle) { if (!fileHandle) {
NSLog(@"Error saving m3u!"); ALog(@"Error saving m3u!");
return NO; return NO;
} }
[fileHandle truncateFileAtOffset:0]; [fileHandle truncateFileAtOffset:0];
@ -318,7 +320,7 @@ NSMutableDictionary * dictionaryWithPropertiesOfObject(id obj, NSArray * filterL
} }
} }
NSLog(@"Expanded urls: %@", expandedURLs); DLog(@"Expanded urls: %@", expandedURLs);
NSArray *sortedURLs; NSArray *sortedURLs;
if (sort == YES) if (sort == YES)
@ -350,9 +352,9 @@ NSMutableDictionary * dictionaryWithPropertiesOfObject(id obj, NSArray * filterL
} }
} }
NSLog(@"File urls: %@", fileURLs); DLog(@"File urls: %@", fileURLs);
NSLog(@"Contained urls: %@", containedURLs); DLog(@"Contained urls: %@", containedURLs);
for (url in fileURLs) for (url in fileURLs)
{ {
@ -371,7 +373,7 @@ NSMutableDictionary * dictionaryWithPropertiesOfObject(id obj, NSArray * filterL
} }
} }
NSLog(@"Valid urls: %@", validURLs); DLog(@"Valid urls: %@", validURLs);
for (url in containedURLs) for (url in containedURLs)
{ {

View File

@ -8,6 +8,7 @@
#import "ToggleQueueTitleTransformer.h" #import "ToggleQueueTitleTransformer.h"
#import "Logging.h"
@implementation ToggleQueueTitleTransformer @implementation ToggleQueueTitleTransformer
@ -17,7 +18,7 @@
// Convert from NSNumber to NSString // Convert from NSNumber to NSString
- (id)transformedValue:(id)value { - (id)transformedValue:(id)value {
NSLog(@"VALUE: %@", value); DLog(@"VALUE: %@", value);
if (value == nil) return nil; if (value == nil) return nil;
BOOL queued = [value boolValue]; BOOL queued = [value boolValue];

View File

@ -10,6 +10,8 @@
#import <PlaylistEntry.h> #import <PlaylistEntry.h>
#import "Logging.h"
@implementation XmlContainer @implementation XmlContainer
+ (NSURL *)urlForPath:(NSString *)path relativeTo:(NSString *)baseFilename + (NSURL *)urlForPath:(NSString *)path relativeTo:(NSString *)baseFilename
@ -37,7 +39,7 @@
break; break;
} }
} }
NSLog(@"Fragment: %@", fragment); DLog(@"Fragment: %@", fragment);
if (![unixPath hasPrefix:@"/"]) { if (![unixPath hasPrefix:@"/"]) {
//Only relative paths would have windows backslashes. //Only relative paths would have windows backslashes.
@ -72,7 +74,7 @@
NSPropertyListFormat format; NSPropertyListFormat format;
id plist = [NSPropertyListSerialization propertyListFromData:plistData mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&error]; id plist = [NSPropertyListSerialization propertyListFromData:plistData mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&error];
if(!plist){ if(!plist){
NSLog(@"Error: %@",error); ALog(@"Error: %@",error);
[error release]; [error release];
return nil; return nil;
} }

View File

@ -17,6 +17,7 @@
089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
32DBCF630370AF2F00C91783 /* APL_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APL_Prefix.pch; sourceTree = "<group>"; }; 32DBCF630370AF2F00C91783 /* APL_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APL_Prefix.pch; sourceTree = "<group>"; };
838491281808135500E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8E8D42350CBB0F9800135C1B /* APLDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APLDecoder.h; sourceTree = "<group>"; }; 8E8D42350CBB0F9800135C1B /* APLDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APLDecoder.h; sourceTree = "<group>"; };
8E8D42360CBB0F9800135C1B /* APLDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APLDecoder.m; sourceTree = "<group>"; }; 8E8D42360CBB0F9800135C1B /* APLDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APLDecoder.m; sourceTree = "<group>"; };
@ -71,6 +72,7 @@
08FB77AFFE84173DC02AAC07 /* Classes */ = { 08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
838491281808135500E7332D /* Logging.h */,
8E8D423C0CBB0FF600135C1B /* Plugin.h */, 8E8D423C0CBB0FF600135C1B /* Plugin.h */,
8E8D42350CBB0F9800135C1B /* APLDecoder.h */, 8E8D42350CBB0F9800135C1B /* APLDecoder.h */,
8E8D42360CBB0F9800135C1B /* APLDecoder.m */, 8E8D42360CBB0F9800135C1B /* APLDecoder.m */,

View File

@ -1,6 +1,8 @@
#import "APLDecoder.h" #import "APLDecoder.h"
#import "APLFile.h" #import "APLFile.h"
#import "Logging.h"
@implementation APLDecoder @implementation APLDecoder
+ (NSArray *)fileTypes { + (NSArray *)fileTypes {
@ -21,7 +23,7 @@
- (BOOL)open:(id<CogSource>)s - (BOOL)open:(id<CogSource>)s
{ {
//NSLog(@"Loading apl..."); //DLog(@"Loading apl...");
if (![[s url] isFileURL]) if (![[s url] isFileURL])
return NO; return NO;
@ -36,14 +38,14 @@
[source retain]; [source retain];
if (![source open:[apl file]]) { if (![source open:[apl file]]) {
NSLog(@"Could not open source for file '%@' referenced in apl", [apl file]); ALog(@"Could not open source for file '%@' referenced in apl", [apl file]);
return NO; return NO;
} }
decoder = [NSClassFromString(@"AudioDecoder") audioDecoderForSource:source]; decoder = [NSClassFromString(@"AudioDecoder") audioDecoderForSource:source];
[decoder retain]; [decoder retain];
if (![decoder open:source]) { if (![decoder open:source]) {
NSLog(@"Could not open decoder for source for apl"); ALog(@"Could not open decoder for source for apl");
return NO; return NO;
} }
@ -109,7 +111,7 @@
frames = trackEnd - framePosition; frames = trackEnd - framePosition;
if (!frames) { if (!frames) {
NSLog(@"APL readAudio Returning 0"); DLog(@"APL readAudio Returning 0");
return 0; return 0;
} }

View File

@ -2,6 +2,8 @@
#import "APLFile.h" #import "APLFile.h"
#import "Logging.h"
@implementation APLFile @implementation APLFile
+createWithFile:(NSString*)f { return [[APLFile alloc] initWithFile:f]; } +createWithFile:(NSString*)f { return [[APLFile alloc] initWithFile:f]; }
@ -48,18 +50,18 @@
//startBlock must be always >= 0 //startBlock must be always >= 0
NSFileHandle* f = (NSFileHandle*)[NSFileHandle fileHandleForReadingAtPath:filename]; NSFileHandle* f = (NSFileHandle*)[NSFileHandle fileHandleForReadingAtPath:filename];
if(!f){ if(!f){
NSLog(@"Failed to open apl file '%@' for reading", f); ALog(@"Failed to open apl file '%@' for reading", f);
return nil; return nil;
} }
NSString* header = @"[Monkey's Audio Image Link File]\r\n"; NSString* header = @"[Monkey's Audio Image Link File]\r\n";
NSData* da = [f readDataOfLength:[header length]]; NSData* da = [f readDataOfLength:[header length]];
if (!da) { if (!da) {
NSLog(@"Cannot read header"); ALog(@"Cannot read header");
return nil; return nil;
} }
NSString* str = [[[NSString alloc] autorelease] initWithData:da encoding: NSASCIIStringEncoding]; NSString* str = [[[NSString alloc] autorelease] initWithData:da encoding: NSASCIIStringEncoding];
if([str compare:header options:NSCaseInsensitiveSearch]) { if([str compare:header options:NSCaseInsensitiveSearch]) {
NSLog(@"APL header mismatch"); ALog(@"APL header mismatch");
return nil; return nil;
} }
//now read by lines, skip empty, up to line <tagline> (or any starting with '-' - may be other tags can be present) //now read by lines, skip empty, up to line <tagline> (or any starting with '-' - may be other tags can be present)
@ -79,19 +81,19 @@
{ {
[file release]; [file release];
file = [self urlForPath:value relativeTo:filename]; file = [self urlForPath:value relativeTo:filename];
NSLog(@"APL refers to file '%@' read '%@'", file, value); DLog(@"APL refers to file '%@' read '%@'", file, value);
continue; continue;
} }
if (![field compare:@"Start Block" options:NSCaseInsensitiveSearch]) if (![field compare:@"Start Block" options:NSCaseInsensitiveSearch])
{ {
startBlock = [value intValue]; //!!! bugs with files over 2GB startBlock = [value intValue]; //!!! bugs with files over 2GB
//NSLog(@"APL start block %d (%@)", startBlock, value); //DLog(@"APL start block %d (%@)", startBlock, value);
continue; continue;
} }
if (![field compare:@"Finish Block" options:NSCaseInsensitiveSearch]) if (![field compare:@"Finish Block" options:NSCaseInsensitiveSearch])
{ {
endBlock = [value intValue]; //!!! bugs with files over 2GB endBlock = [value intValue]; //!!! bugs with files over 2GB
//NSLog(@"APL start block %d (%@)", endBlock, value); //DLog(@"APL start block %d (%@)", endBlock, value);
continue; continue;
} }
} }

View File

@ -60,6 +60,7 @@
8359FF2417FEF35C0060F3ED /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; 8359FF2417FEF35C0060F3ED /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
8359FF2617FEF35C0060F3ED /* ArchiveSource-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ArchiveSource-Prefix.pch"; sourceTree = "<group>"; }; 8359FF2617FEF35C0060F3ED /* ArchiveSource-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ArchiveSource-Prefix.pch"; sourceTree = "<group>"; };
8359FF6A17FEF39F0060F3ED /* File_Extractor.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = File_Extractor.xcodeproj; path = ../../Frameworks/File_Extractor/File_Extractor.xcodeproj; sourceTree = "<group>"; }; 8359FF6A17FEF39F0060F3ED /* File_Extractor.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = File_Extractor.xcodeproj; path = ../../Frameworks/File_Extractor/File_Extractor.xcodeproj; sourceTree = "<group>"; };
8384913518081BA000E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../../Utils/Logging.h; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@ -115,6 +116,7 @@
8359FF2017FEF35C0060F3ED /* ArchiveSource */ = { 8359FF2017FEF35C0060F3ED /* ArchiveSource */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8384913518081BA000E7332D /* Logging.h */,
835900A017FF079C0060F3ED /* Plugin.h */, 835900A017FF079C0060F3ED /* Plugin.h */,
8359009A17FEFDA80060F3ED /* ArchiveContainer.h */, 8359009A17FEFDA80060F3ED /* ArchiveContainer.h */,
8359009B17FEFDA80060F3ED /* ArchiveContainer.m */, 8359009B17FEFDA80060F3ED /* ArchiveContainer.m */,

View File

@ -10,6 +10,8 @@
#import <File_Extractor/fex.h> #import <File_Extractor/fex.h>
#import "Logging.h"
static NSString * path_pack_string(NSString * src) static NSString * path_pack_string(NSString * src)
{ {
return [NSString stringWithFormat:@"|%lu|%@|", [src length], src]; return [NSString stringWithFormat:@"|%lu|%@|", [src length], src];
@ -46,7 +48,7 @@ static NSString * g_make_unpack_path(NSString * archive, NSString * file, NSStri
fex_t * fex; fex_t * fex;
fex_err_t error = fex_open( &fex, [[url path] UTF8String] ); fex_err_t error = fex_open( &fex, [[url path] UTF8String] );
if ( error ) { if ( error ) {
NSLog(@"Archive error: %s", error); ALog(@"Archive error: %s", error);
return [NSArray array]; return [NSArray array];
} }

View File

@ -8,6 +8,7 @@
#import "ArchiveSource.h" #import "ArchiveSource.h"
#import "Logging.h"
static NSString * path_unpack_string(NSString * src, NSRange * remainder) static NSString * path_unpack_string(NSString * src, NSRange * remainder)
{ {
@ -88,7 +89,7 @@ static BOOL g_parse_unpack_path(NSString * src, NSString ** archive, NSString **
error = fex_open( &fex, [archive UTF8String] ); error = fex_open( &fex, [archive UTF8String] );
if ( error ) { if ( error ) {
NSLog(@"Error opening archive: %s", error); ALog(@"Error opening archive: %s", error);
return NO; return NO;
} }
@ -103,7 +104,7 @@ static BOOL g_parse_unpack_path(NSString * src, NSString ** archive, NSString **
error = fex_data( fex, &data ); error = fex_data( fex, &data );
if ( error ) { if ( error ) {
NSLog(@"Error unpacking file from archive: %s", error); ALog(@"Error unpacking file from archive: %s", error);
return NO; return NO;
} }

View File

@ -23,6 +23,7 @@
17C93EAB0B8FF3CE008627D6 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = "<absolute>"; }; 17C93EAB0B8FF3CE008627D6 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = "<absolute>"; };
17C93EB20B8FF3E1008627D6 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = "<absolute>"; }; 17C93EB20B8FF3E1008627D6 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = "<absolute>"; };
32DBCF630370AF2F00C91783 /* CoreAudio_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreAudio_Prefix.pch; sourceTree = "<group>"; }; 32DBCF630370AF2F00C91783 /* CoreAudio_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreAudio_Prefix.pch; sourceTree = "<group>"; };
83849129180813E800E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* CoreAudio.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CoreAudio.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B6048680CD000E48DA /* CoreAudio.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CoreAudio.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; }; D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
@ -74,6 +75,7 @@
08FB77AFFE84173DC02AAC07 /* Classes */ = { 08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
83849129180813E800E7332D /* Logging.h */,
177FCFCA0B90C9A10011C3B5 /* Plugin.h */, 177FCFCA0B90C9A10011C3B5 /* Plugin.h */,
17C93E720B8FF192008627D6 /* CoreAudioDecoder.h */, 17C93E720B8FF192008627D6 /* CoreAudioDecoder.h */,
17C93E730B8FF192008627D6 /* CoreAudioDecoder.m */, 17C93E730B8FF192008627D6 /* CoreAudioDecoder.m */,

View File

@ -22,6 +22,8 @@
#import "CoreAudioDecoder.h" #import "CoreAudioDecoder.h"
#import "Logging.h"
@interface CoreAudioDecoder (Private) @interface CoreAudioDecoder (Private)
- (BOOL) readInfoFromExtAudioFileRef; - (BOOL) readInfoFromExtAudioFileRef;
@end @end
@ -34,7 +36,7 @@
err = ExtAudioFileDispose(_in); err = ExtAudioFileDispose(_in);
if(noErr != err) { if(noErr != err) {
NSLog(@"Error closing ExtAudioFile"); DLog(@"Error closing ExtAudioFile");
} }
} }
@ -47,7 +49,7 @@
err = ExtAudioFileOpenURL((CFURLRef)url, &_in); err = ExtAudioFileOpenURL((CFURLRef)url, &_in);
if(noErr != err) { if(noErr != err) {
NSLog(@"Error opening file: %d", err); ALog(@"Error opening file: %d", err);
return NO; return NO;
} }

View File

@ -11,6 +11,8 @@
#import "Plugin.h" #import "Plugin.h"
#import "Logging.h"
@implementation CueSheet @implementation CueSheet
+ (id)cueSheetWithFile:(NSString *)filename + (id)cueSheetWithFile:(NSString *)filename
@ -80,7 +82,7 @@
contents = [NSString stringWithContentsOfFile:filename encoding:NSISOLatin1StringEncoding error:&error]; contents = [NSString stringWithContentsOfFile:filename encoding:NSISOLatin1StringEncoding error:&error];
} }
if (error || !contents) { if (error || !contents) {
NSLog(@"Could not open file...%@ %@ %@", filename, contents, error); ALog(@"Could not open file...%@ %@ %@", filename, contents, error);
return; return;
} }
@ -219,16 +221,16 @@
if ([type isEqualToString:@"GENRE"]) if ([type isEqualToString:@"GENRE"])
{ {
//NSLog(@"GENRE!"); //DLog(@"GENRE!");
if ([scanner scanString:@"\"" intoString:nil]) { if ([scanner scanString:@"\"" intoString:nil]) {
//NSLog(@"QUOTED"); //DLog(@"QUOTED");
if (![scanner scanUpToString:@"\"" intoString:&genre]) { if (![scanner scanUpToString:@"\"" intoString:&genre]) {
NSLog(@"FAILED TO SCAN"); DLog(@"FAILED TO SCAN");
continue; continue;
} }
} }
else { else {
//NSLog(@"UNQUOTED"); //DLog(@"UNQUOTED");
if ( ![scanner scanUpToCharactersFromSet:whitespace intoString:&genre]) { if ( ![scanner scanUpToCharactersFromSet:whitespace intoString:&genre]) {
continue; continue;
} }
@ -236,7 +238,7 @@
} }
else if ([type isEqualToString:@"DATE"]) else if ([type isEqualToString:@"DATE"])
{ {
//NSLog(@"DATE!"); //DLog(@"DATE!");
if ( ![scanner scanUpToCharactersFromSet:whitespace intoString:&year]) { if ( ![scanner scanUpToCharactersFromSet:whitespace intoString:&year]) {
continue; continue;
} }

View File

@ -24,6 +24,7 @@
17DA346C0CC04FCD0003F6B2 /* CueSheetMetadataReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CueSheetMetadataReader.h; sourceTree = "<group>"; }; 17DA346C0CC04FCD0003F6B2 /* CueSheetMetadataReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CueSheetMetadataReader.h; sourceTree = "<group>"; };
17DA346D0CC04FCD0003F6B2 /* CueSheetMetadataReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CueSheetMetadataReader.m; sourceTree = "<group>"; }; 17DA346D0CC04FCD0003F6B2 /* CueSheetMetadataReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CueSheetMetadataReader.m; sourceTree = "<group>"; };
32DBCF630370AF2F00C91783 /* CueSheet_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CueSheet_Prefix.pch; sourceTree = "<group>"; }; 32DBCF630370AF2F00C91783 /* CueSheet_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CueSheet_Prefix.pch; sourceTree = "<group>"; };
8384912A180814D900E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* CueSheet.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CueSheet.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B6048680CD000E48DA /* CueSheet.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CueSheet.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8E8D42240CBB0F5800135C1B /* CueSheetContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CueSheetContainer.h; sourceTree = "<group>"; }; 8E8D42240CBB0F5800135C1B /* CueSheetContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CueSheetContainer.h; sourceTree = "<group>"; };
@ -83,6 +84,7 @@
08FB77AFFE84173DC02AAC07 /* Classes */ = { 08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8384912A180814D900E7332D /* Logging.h */,
8E8D423C0CBB0FF600135C1B /* Plugin.h */, 8E8D423C0CBB0FF600135C1B /* Plugin.h */,
8E8D42240CBB0F5800135C1B /* CueSheetContainer.h */, 8E8D42240CBB0F5800135C1B /* CueSheetContainer.h */,
8E8D42250CBB0F5800135C1B /* CueSheetContainer.m */, 8E8D42250CBB0F5800135C1B /* CueSheetContainer.m */,

View File

@ -12,6 +12,8 @@
#import "CueSheetTrack.h" #import "CueSheetTrack.h"
#import "CueSheetContainer.h" #import "CueSheetContainer.h"
#import "Logging.h"
@implementation CueSheetDecoder @implementation CueSheetDecoder
+ (NSArray *)fileTypes + (NSArray *)fileTypes
@ -59,7 +61,7 @@
[source retain]; [source retain];
if (![source open:[track url]]) { if (![source open:[track url]]) {
NSLog(@"Could not open cuesheet source"); ALog(@"Could not open cuesheet source");
return NO; return NO;
} }
@ -67,7 +69,7 @@
[decoder retain]; [decoder retain];
if (![decoder open:source]) { if (![decoder open:source]) {
NSLog(@"Could not open cuesheet decoder"); ALog(@"Could not open cuesheet decoder");
return NO; return NO;
} }
@ -155,7 +157,7 @@
trackEnd = [[[decoder properties] objectForKey:@"totalFrames"] longValue]; trackEnd = [[[decoder properties] objectForKey:@"totalFrames"] longValue];
} }
NSLog(@"CHANGING TRACK!"); DLog(@"CHANGING TRACK!");
return YES; return YES;
} }
} }
@ -186,7 +188,7 @@
if (!frames) if (!frames)
{ {
NSLog(@"Returning 0"); DLog(@"Returning 0");
return 0; return 0;
} }

View File

@ -78,6 +78,7 @@
8337AAEF17FFA2D30081AFF8 /* j2b.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = j2b.c; sourceTree = "<group>"; }; 8337AAEF17FFA2D30081AFF8 /* j2b.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = j2b.c; sourceTree = "<group>"; };
8337AAF017FFA2D30081AFF8 /* j2b.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = j2b.h; sourceTree = "<group>"; }; 8337AAF017FFA2D30081AFF8 /* j2b.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = j2b.h; sourceTree = "<group>"; };
8337AAF217FFA7640081AFF8 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 8337AAF217FFA7640081AFF8 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
8384912B1808155E00E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* Dumb.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Dumb.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B6048680CD000E48DA /* Dumb.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Dumb.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; }; D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
@ -132,6 +133,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8337AAE317FFA0000081AFF8 /* archive */, 8337AAE317FFA0000081AFF8 /* archive */,
8384912B1808155E00E7332D /* Logging.h */,
8335FF6517FF6FD9002D8DD2 /* DumbContainer.h */, 8335FF6517FF6FD9002D8DD2 /* DumbContainer.h */,
8335FF6617FF6FD9002D8DD2 /* DumbContainer.m */, 8335FF6617FF6FD9002D8DD2 /* DumbContainer.m */,
17C8F70C0CBEEC87008D969D /* Plugin.h */, 17C8F70C0CBEEC87008D969D /* Plugin.h */,

View File

@ -11,6 +11,8 @@
#import "DumbContainer.h" #import "DumbContainer.h"
#import "DumbDecoder.h" #import "DumbDecoder.h"
#import "Logging.h"
@implementation DumbContainer @implementation DumbContainer
+ (NSArray *)fileTypes + (NSArray *)fileTypes
@ -59,7 +61,7 @@ int scanCallback(void *data, int startOrder, long length)
DUMBFILE * df = dumbfile_open_memory_and_free( data, size ); DUMBFILE * df = dumbfile_open_memory_and_free( data, size );
if (!df) if (!df)
{ {
NSLog(@"EX Failed"); ALog(@"Open failed for file: %@", [url absoluteString]);
return NO; return NO;
} }

View File

@ -11,6 +11,8 @@
#import "umx.h" #import "umx.h"
#import "j2b.h" #import "j2b.h"
#import "Logging.h"
@implementation DumbDecoder @implementation DumbDecoder
struct MEMANDFREEFILE struct MEMANDFREEFILE
@ -135,7 +137,7 @@ int callbackLoop(void *data)
DUMBFILE * df = dumbfile_open_memory_and_free( data, size ); DUMBFILE * df = dumbfile_open_memory_and_free( data, size );
if (!df) if (!df)
{ {
NSLog(@"EX Failed"); ALog(@"Open failed for file: %@", [[s url] absoluteString]);
return NO; return NO;
} }
@ -160,7 +162,7 @@ int callbackLoop(void *data)
duh = dumb_read_any(df, [ext isEqualToString:@"mod"] ? 0 : 1, subsong); duh = dumb_read_any(df, [ext isEqualToString:@"mod"] ? 0 : 1, subsong);
if (!duh) if (!duh)
{ {
NSLog(@"Failed to create duh"); ALog(@"Failed to create duh");
dumbfile_close(df); dumbfile_close(df);
return NO; return NO;
} }
@ -171,7 +173,7 @@ int callbackLoop(void *data)
dsr = duh_start_sigrenderer(duh, 0, 2 /* stereo */, startOrder); dsr = duh_start_sigrenderer(duh, 0, 2 /* stereo */, startOrder);
if (!dsr) if (!dsr)
{ {
NSLog(@"Failed to create dsr"); ALog(@"Failed to create dsr");
return NO; return NO;
} }

View File

@ -11,6 +11,8 @@
#import <Dumb/dumb.h> #import <Dumb/dumb.h>
#import "Logging.H"
@implementation DumbMetadataReader @implementation DumbMetadataReader
+ (NSArray *)fileTypes + (NSArray *)fileTypes
@ -44,7 +46,7 @@
DUMBFILE * df = dumbfile_open_memory_and_free( data, size ); DUMBFILE * df = dumbfile_open_memory_and_free( data, size );
if (!df) if (!df)
{ {
NSLog(@"EX Failed"); ALog(@"Open failed for file: %@", [url absoluteString]);
return NO; return NO;
} }
@ -56,7 +58,7 @@
if (!duh) if (!duh)
{ {
NSLog(@"Failed to create duh"); ALog(@"Failed to create duh");
return nil; return nil;
} }

View File

@ -53,6 +53,7 @@
32DBCF630370AF2F00C91783 /* FFMPEG_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FFMPEG_Prefix.pch; sourceTree = "<group>"; }; 32DBCF630370AF2F00C91783 /* FFMPEG_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FFMPEG_Prefix.pch; sourceTree = "<group>"; };
834225D117FFBD2200DD3E2F /* FFMPEGFileProtocols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FFMPEGFileProtocols.h; sourceTree = "<group>"; }; 834225D117FFBD2200DD3E2F /* FFMPEGFileProtocols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FFMPEGFileProtocols.h; sourceTree = "<group>"; };
834225D217FFBD2200DD3E2F /* FFMPEGFileProtocols.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FFMPEGFileProtocols.m; sourceTree = "<group>"; }; 834225D217FFBD2200DD3E2F /* FFMPEGFileProtocols.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FFMPEGFileProtocols.m; sourceTree = "<group>"; };
8384913818081F6C00E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* FFMPEG.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FFMPEG.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B6048680CD000E48DA /* FFMPEG.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FFMPEG.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
B09E942D0D747F410064F138 /* FFMPEGDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FFMPEGDecoder.h; sourceTree = "<group>"; }; B09E942D0D747F410064F138 /* FFMPEGDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FFMPEGDecoder.h; sourceTree = "<group>"; };
@ -109,6 +110,7 @@
08FB77AFFE84173DC02AAC07 /* Classes */ = { 08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8384913818081F6C00E7332D /* Logging.h */,
834225D117FFBD2200DD3E2F /* FFMPEGFileProtocols.h */, 834225D117FFBD2200DD3E2F /* FFMPEGFileProtocols.h */,
834225D217FFBD2200DD3E2F /* FFMPEGFileProtocols.m */, 834225D217FFBD2200DD3E2F /* FFMPEGFileProtocols.m */,
B09E94370D747FAD0064F138 /* Plugin.h */, B09E94370D747FAD0064F138 /* Plugin.h */,

View File

@ -12,6 +12,8 @@
#include <pthread.h> #include <pthread.h>
#import "Logging.h"
#define ST_BUFF 2048 #define ST_BUFF 2048
@implementation FFMPEGDecoder @implementation FFMPEGDecoder
@ -70,13 +72,13 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
{ {
char errDescr[4096]; char errDescr[4096];
av_strerror(errcode, errDescr, 4096); av_strerror(errcode, errDescr, 4096);
NSLog(@"ERROR OPENING FILE, errcode = %d, error = %s", errcode, errDescr); ALog(@"ERROR OPENING FILE, errcode = %d, error = %s", errcode, errDescr);
return NO; return NO;
} }
if(avformat_find_stream_info(formatCtx, NULL) < 0) if(avformat_find_stream_info(formatCtx, NULL) < 0)
{ {
NSLog(@"CAN'T FIND STREAM INFO!"); ALog(@"CAN'T FIND STREAM INFO!");
return NO; return NO;
} }
@ -85,25 +87,25 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
codecCtx = formatCtx->streams[i]->codec; codecCtx = formatCtx->streams[i]->codec;
if(codecCtx->codec_type == AVMEDIA_TYPE_AUDIO) if(codecCtx->codec_type == AVMEDIA_TYPE_AUDIO)
{ {
NSLog(@"audio codec found"); DLog(@"audio codec found");
streamIndex = i; streamIndex = i;
break; break;
} }
} }
if ( streamIndex < 0 ) { if ( streamIndex < 0 ) {
NSLog(@"no audio codec found"); ALog(@"no audio codec found");
return NO; return NO;
} }
AVCodec * codec = avcodec_find_decoder(codecCtx->codec_id); AVCodec * codec = avcodec_find_decoder(codecCtx->codec_id);
if (!codec) { if (!codec) {
NSLog(@"codec not found"); ALog(@"codec not found");
return NO; return NO;
} }
if (avcodec_open2(codecCtx, codec, NULL) < 0) { if (avcodec_open2(codecCtx, codec, NULL) < 0) {
NSLog(@"could not open codec"); ALog(@"could not open codec");
return NO; return NO;
} }
@ -184,26 +186,14 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
int bytesToRead = frames * frameSize; int bytesToRead = frames * frameSize;
int bytesRead = 0; int bytesRead = 0;
BOOL endOfStream = NO;
int8_t* targetBuf = (int8_t*) buf; int8_t* targetBuf = (int8_t*) buf;
memset(buf, 0, bytesToRead); memset(buf, 0, bytesToRead);
while (bytesRead < bytesToRead) while (bytesRead < bytesToRead)
{ {
if(readNextPacket)
{
// consume next chunk of encoded data from input stream
av_free_packet(lastReadPacket);
if(av_read_frame(formatCtx, lastReadPacket) < 0)
{
NSLog(@"End of stream");
break; // end of stream;
}
readNextPacket = NO; // we probably won't need to consume another chunk
bytesReadFromPacket = 0; // until this one is fully decoded
}
// buffer size needed to hold decoded samples, in bytes // buffer size needed to hold decoded samples, in bytes
int planeSize; int planeSize;
int planar = av_sample_fmt_is_planar(codecCtx->sample_fmt); int planar = av_sample_fmt_is_planar(codecCtx->sample_fmt);
@ -211,8 +201,27 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
lastDecodedFrame->nb_samples, lastDecodedFrame->nb_samples,
codecCtx->sample_fmt, 1); codecCtx->sample_fmt, 1);
if(readNextPacket && !endOfStream)
{
// consume next chunk of encoded data from input stream
av_free_packet(lastReadPacket);
if(av_read_frame(formatCtx, lastReadPacket) < 0)
{
DLog(@"End of stream");
endOfStream = YES;
if (dataSize <= bytesConsumedFromDecodedFrame)
break; // end of stream;
}
readNextPacket = NO; // we probably won't need to consume another chunk
bytesReadFromPacket = 0; // until this one is fully decoded
}
if (dataSize <= bytesConsumedFromDecodedFrame) if (dataSize <= bytesConsumedFromDecodedFrame)
{ {
if (endOfStream)
break;
// consumed all decoded samples - decode more // consumed all decoded samples - decode more
avcodec_get_frame_defaults(lastDecodedFrame); avcodec_get_frame_defaults(lastDecodedFrame);
bytesConsumedFromDecodedFrame = 0; bytesConsumedFromDecodedFrame = 0;
@ -221,7 +230,7 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
{ {
char errbuf[4096]; char errbuf[4096];
av_strerror(len, errbuf, 4096); av_strerror(len, errbuf, 4096);
NSLog(@"Error decoding: len = %d, gotFrame = %d, strerr = %s", len, gotFrame, errbuf); ALog(@"Error decoding: len = %d, gotFrame = %d, strerr = %s", len, gotFrame, errbuf);
dataSize = 0; dataSize = 0;
readNextPacket = YES; readNextPacket = YES;

View File

@ -54,6 +54,7 @@
17C93F040B8FF67A008627D6 /* FlacDecoder.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = FlacDecoder.m; sourceTree = "<group>"; }; 17C93F040B8FF67A008627D6 /* FlacDecoder.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = FlacDecoder.m; sourceTree = "<group>"; };
17F5641A0C3BDC460019975C /* flac.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = flac.xcodeproj; path = ../../Frameworks/FLAC/flac.xcodeproj; sourceTree = SOURCE_ROOT; }; 17F5641A0C3BDC460019975C /* flac.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = flac.xcodeproj; path = ../../Frameworks/FLAC/flac.xcodeproj; sourceTree = SOURCE_ROOT; };
32DBCF630370AF2F00C91783 /* Flac_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Flac_Prefix.pch; sourceTree = "<group>"; }; 32DBCF630370AF2F00C91783 /* Flac_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Flac_Prefix.pch; sourceTree = "<group>"; };
8384912D180816C900E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* Flac.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Flac.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B6048680CD000E48DA /* Flac.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Flac.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; }; D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
@ -104,6 +105,7 @@
08FB77AFFE84173DC02AAC07 /* Classes */ = { 08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8384912D180816C900E7332D /* Logging.h */,
177FCFC10B90C9960011C3B5 /* Plugin.h */, 177FCFC10B90C9960011C3B5 /* Plugin.h */,
17C93F030B8FF67A008627D6 /* FlacDecoder.h */, 17C93F030B8FF67A008627D6 /* FlacDecoder.h */,
17C93F040B8FF67A008627D6 /* FlacDecoder.m */, 17C93F040B8FF67A008627D6 /* FlacDecoder.m */,

View File

@ -8,23 +8,26 @@
#import "FlacDecoder.h" #import "FlacDecoder.h"
#import "Logging.h"
@implementation FlacDecoder @implementation FlacDecoder
FLAC__StreamDecoderReadStatus ReadCallback(const FLAC__StreamDecoder *decoder, FLAC__byte blockBuffer[], size_t *bytes, void *client_data) FLAC__StreamDecoderReadStatus ReadCallback(const FLAC__StreamDecoder *decoder, FLAC__byte blockBuffer[], size_t *bytes, void *client_data)
{ {
FlacDecoder *flacDecoder = (FlacDecoder *)client_data; FlacDecoder *flacDecoder = (FlacDecoder *)client_data;
long ret = [[flacDecoder source] read:blockBuffer amount:*bytes]; long bytesRead = [[flacDecoder source] read:blockBuffer amount:*bytes];
*bytes = ret;
if(ret < 0) { if(bytesRead < 0) {
*bytes = 0;
return FLAC__STREAM_DECODER_READ_STATUS_ABORT; return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
} }
else if(ret == 0) { else if(bytesRead == 0) {
*bytes = 0;
[flacDecoder setEndOfStream:YES]; [flacDecoder setEndOfStream:YES];
return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
} }
else { else {
*bytes = bytesRead;
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
} }
} }
@ -137,7 +140,7 @@ FLAC__StreamDecoderWriteStatus WriteCallback(const FLAC__StreamDecoder *decoder,
} }
} }
default: default:
NSLog(@"Error, unsupported sample size."); ALog(@"Error, unsupported sample size.");
} }
[flacDecoder setBlockBufferFrames:frame->header.blocksize]; [flacDecoder setBlockBufferFrames:frame->header.blocksize];

View File

@ -68,6 +68,7 @@
17DA34B80CC052030003F6B2 /* GameMetadataReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameMetadataReader.h; sourceTree = "<group>"; }; 17DA34B80CC052030003F6B2 /* GameMetadataReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameMetadataReader.h; sourceTree = "<group>"; };
17DA34B90CC052030003F6B2 /* GameMetadataReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameMetadataReader.m; sourceTree = "<group>"; }; 17DA34B90CC052030003F6B2 /* GameMetadataReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameMetadataReader.m; sourceTree = "<group>"; };
32DBCF630370AF2F00C91783 /* GME_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GME_Prefix.pch; sourceTree = "<group>"; }; 32DBCF630370AF2F00C91783 /* GME_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GME_Prefix.pch; sourceTree = "<group>"; };
8384912E1808175400E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* GME.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GME.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B6048680CD000E48DA /* GME.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GME.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; }; D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
@ -119,6 +120,7 @@
08FB77AFFE84173DC02AAC07 /* Classes */ = { 08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8384912E1808175400E7332D /* Logging.h */,
17C8F3470CBED3C7008D969D /* Plugin.h */, 17C8F3470CBED3C7008D969D /* Plugin.h */,
17C8F33B0CBED3BE008D969D /* GameContainer.h */, 17C8F33B0CBED3BE008D969D /* GameContainer.h */,
17C8F33C0CBED3BE008D969D /* GameContainer.m */, 17C8F33C0CBED3BE008D969D /* GameContainer.m */,

View File

@ -11,6 +11,8 @@
#import "GameContainer.h" #import "GameContainer.h"
#import "GameDecoder.h" #import "GameDecoder.h"
#import "Logging.h"
@implementation GameContainer @implementation GameContainer
+ (NSArray *)fileTypes + (NSArray *)fileTypes
@ -48,7 +50,7 @@
free(data); free(data);
if (NULL != error) { if (NULL != error) {
NSLog(@"GME: Error loading file: %@ %s", [url path], error); ALog(@"GME: Error loading file: %@ %s", [url path], error);
return [NSArray arrayWithObject:url]; return [NSArray arrayWithObject:url];
} }
int track_count = gme_track_count(emu); int track_count = gme_track_count(emu);

View File

@ -8,17 +8,19 @@
#import "GameDecoder.h" #import "GameDecoder.h"
#import "Logging.h"
@implementation GameDecoder @implementation GameDecoder
gme_err_t readCallback( void* data, void* out, long count ) gme_err_t readCallback( void* data, void* out, long count )
{ {
id source = (id)data; id source = (id)data;
NSLog(@"Amount: %li", count); DLog(@"Amount: %li", count);
int n = [source read:out amount:count]; int n = [source read:out amount:count];
NSLog(@"Read: %i", n); DLog(@"Read: %i", n);
if (n <= 0) { if (n <= 0) {
NSLog(@"ERROR!"); DLog(@"ERROR!");
return (gme_err_t)1; //Return non-zero for error return (gme_err_t)1; //Return non-zero for error
} }
@ -41,14 +43,14 @@ gme_err_t readCallback( void* data, void* out, long count )
gme_type_t type = gme_identify_extension([ext UTF8String]); gme_type_t type = gme_identify_extension([ext UTF8String]);
if (!type) if (!type)
{ {
NSLog(@"No type!"); ALog(@"GME: No type!");
return NO; return NO;
} }
emu = gme_new_emu(type, 44100); emu = gme_new_emu(type, 44100);
if (!emu) if (!emu)
{ {
NSLog(@"No new emu!"); ALog(@"GME: No new emu!");
return NO; return NO;
} }
@ -56,12 +58,12 @@ gme_err_t readCallback( void* data, void* out, long count )
long size = [source tell]; long size = [source tell];
[source seek:0 whence:SEEK_SET]; [source seek:0 whence:SEEK_SET];
NSLog(@"Size: %li", size); DLog(@"Size: %li", size);
error = gme_load_custom(emu, readCallback, size, s); error = gme_load_custom(emu, readCallback, size, s);
if (error) if (error)
{ {
NSLog(@"ERROR Loding custom!"); ALog(@"GME: ERROR Loding custom!");
return NO; return NO;
} }
@ -71,32 +73,33 @@ gme_err_t readCallback( void* data, void* out, long count )
error = gme_track_info( emu, &info, track_num ); error = gme_track_info( emu, &info, track_num );
if (error) if (error)
{ {
NSLog(@"Unable to get track info"); ALog(@"Unable to get track info");
return NO;
} }
//As recommended //As recommended
if (info->length > 0) { if (info->length > 0) {
NSLog(@"Using length: %i", info->length); DLog(@"Using length: %i", info->length);
length = info->length; length = info->length;
} }
else if (info->loop_length > 0) { else if (info->loop_length > 0) {
NSLog(@"Using loop length: %i", info->loop_length); DLog(@"Using loop length: %i", info->loop_length);
length = info->intro_length + 2*info->loop_length; length = info->intro_length + 2*info->loop_length;
} }
else { else {
length = 150000; length = 150000;
NSLog(@"Setting default: %li", length); DLog(@"Setting default: %li", length);
} }
gme_free_info( info ); gme_free_info( info );
NSLog(@"Length: %li", length); DLog(@"Length: %li", length);
NSLog(@"Track num: %i", track_num); DLog(@"Track num: %i", track_num);
error = gme_start_track(emu, track_num); error = gme_start_track(emu, track_num);
if (error) if (error)
{ {
NSLog(@"Error starting track"); ALog(@"GME: Error starting track");
return NO; return NO;
} }

View File

@ -12,6 +12,8 @@
#import <GME/gme.h> #import <GME/gme.h>
#import "Logging.h"
@implementation GameMetadataReader @implementation GameMetadataReader
+ (NSArray *)fileTypes + (NSArray *)fileTypes
@ -40,7 +42,7 @@
gme_type_t type = gme_identify_extension([ext UTF8String]); gme_type_t type = gme_identify_extension([ext UTF8String]);
if (!type) if (!type)
{ {
NSLog(@"No type!"); ALog(@"GME: No type!");
return NO; return NO;
} }
@ -48,7 +50,7 @@
emu = gme_new_emu(type, gme_info_only); emu = gme_new_emu(type, gme_info_only);
if (!emu) if (!emu)
{ {
NSLog(@"No new emu!"); ALog(@"GME: No new emu!");
return NO; return NO;
} }
@ -60,7 +62,7 @@
error = gme_load_custom(emu, readCallback, size, source); error = gme_load_custom(emu, readCallback, size, source);
if (error) if (error)
{ {
NSLog(@"ERROR Loding file!"); ALog(@"GME: ERROR Loding file!");
return NO; return NO;
} }
@ -74,7 +76,7 @@
error = gme_track_info( emu, &info, track_num ); error = gme_track_info( emu, &info, track_num );
if (error) if (error)
{ {
NSLog(@"Unable to get track info"); ALog(@"GME: Unable to get track info");
} }
gme_delete(emu); gme_delete(emu);

View File

@ -9,6 +9,8 @@
#import "HTTPSource.h" #import "HTTPSource.h"
#import "HTTPConnection.h" #import "HTTPConnection.h"
#import "Logging.h"
@implementation HTTPSource @implementation HTTPSource
- (BOOL)open:(NSURL *)url - (BOOL)open:(NSURL *)url
@ -33,7 +35,7 @@
- (NSString *)mimeType - (NSString *)mimeType
{ {
NSLog(@"Returning mimetype! %@", _mimeType); DLog(@"Returning mimetype! %@", _mimeType);
return _mimeType; return _mimeType;
} }

View File

@ -37,6 +37,7 @@
17ADB60C0B97A74800257CA2 /* HTTPSource.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTTPSource.h; sourceTree = "<group>"; }; 17ADB60C0B97A74800257CA2 /* HTTPSource.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTTPSource.h; sourceTree = "<group>"; };
17ADB6340B97A8B400257CA2 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../Audio/Plugin.h; sourceTree = SOURCE_ROOT; }; 17ADB6340B97A8B400257CA2 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../Audio/Plugin.h; sourceTree = SOURCE_ROOT; };
32DBCF630370AF2F00C91783 /* HTTPSource_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPSource_Prefix.pch; sourceTree = "<group>"; }; 32DBCF630370AF2F00C91783 /* HTTPSource_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPSource_Prefix.pch; sourceTree = "<group>"; };
8384912F1808180000E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* HTTPSource.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HTTPSource.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B6048680CD000E48DA /* HTTPSource.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HTTPSource.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; }; D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
@ -87,6 +88,7 @@
08FB77AFFE84173DC02AAC07 /* Classes */ = { 08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8384912F1808180000E7332D /* Logging.h */,
17ADB6340B97A8B400257CA2 /* Plugin.h */, 17ADB6340B97A8B400257CA2 /* Plugin.h */,
17ADB60C0B97A74800257CA2 /* HTTPSource.h */, 17ADB60C0B97A74800257CA2 /* HTTPSource.h */,
171609390F627F02008FA424 /* HTTPSource.m */, 171609390F627F02008FA424 /* HTTPSource.m */,

View File

@ -10,6 +10,7 @@
#include <netdb.h> #include <netdb.h>
#import "Logging.h"
@implementation HTTPConnection @implementation HTTPConnection
@ -89,7 +90,7 @@
// We are using ASCII encoding here because some Icecast servers will insert a random 0xaa or two into the headers // We are using ASCII encoding here because some Icecast servers will insert a random 0xaa or two into the headers
// Or I'm an idiot who doesn't know how to count (fixed now), but I don't remember what site I was seeing this on, so I can't really check. // Or I'm an idiot who doesn't know how to count (fixed now), but I don't remember what site I was seeing this on, so I can't really check.
NSString *line = [[NSString alloc] initWithBytes:_buffer length:lineLength encoding:NSASCIIStringEncoding]; NSString *line = [[NSString alloc] initWithBytes:_buffer length:lineLength encoding:NSASCIIStringEncoding];
NSLog(@"Received line: \"%@\"", line); DLog(@"Received line: \"%@\"", line);
memmove(_buffer, _buffer + lineLength + 2, _bufferSize - lineLength); // + 2 to skip the newline! memmove(_buffer, _buffer + lineLength + 2, _bufferSize - lineLength); // + 2 to skip the newline!
@ -132,7 +133,7 @@
NSString *line = [self _receiveLine]; NSString *line = [self _receiveLine];
if (nil == line) { if (nil == line) {
// Error receiving data. Let's get out of here! // Error receiving data. Let's get out of here!
NSLog(@"Headers ended prematurely"); DLog(@"Headers ended prematurely");
break; break;
} }
@ -151,7 +152,7 @@
[scanner release]; [scanner release];
if (NO == success) { if (NO == success) {
NSLog(@"Could not scan header: %@", line); DLog(@"Could not scan header: %@", line);
continue; continue;
} }
@ -168,7 +169,7 @@
return [self connect]; return [self connect];
} }
NSLog(@"Returned status: %li", (long)statusCode); DLog(@"Returned status: %li", (long)statusCode);
return NO; return NO;
} }
@ -212,7 +213,7 @@
[requestString release]; [requestString release];
return NO; return NO;
} }
NSLog(@"Sent:\n%@\n", requestString); DLog(@"Sent:\n%@\n", requestString);
[requestString release]; [requestString release];
return YES; return YES;

View File

@ -9,6 +9,8 @@
#import "Socket.h" #import "Socket.h"
#import <netdb.h> #import <netdb.h>
#import "Logging.h"
@implementation Socket @implementation Socket
+ (id)socketWithHost:(NSString *)host port:(int)port + (id)socketWithHost:(NSString *)host port:(int)port
@ -34,14 +36,14 @@
he = gethostbyname([host UTF8String]); he = gethostbyname([host UTF8String]);
if (!he) { if (!he) {
NSLog(@"Socket error."); ALog(@"Socket error: %s\n", strerror(errno));
close(_socket); close(_socket);
return nil; return nil;
} }
memcpy(&sin.sin_addr, he->h_addr, 4); memcpy(&sin.sin_addr, he->h_addr, 4);
if (connect(_socket, (struct sockaddr *)&sin, sizeof(sin)) < 0) { if (connect(_socket, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
NSLog(@"Error: %s\n", strerror(errno)); ALog(@"Error: %s\n", strerror(errno));
close(_socket); close(_socket);
return nil; return nil;
} }

View File

@ -18,6 +18,7 @@
089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
32DBCF630370AF2F00C91783 /* M3u_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = M3u_Prefix.pch; sourceTree = "<group>"; }; 32DBCF630370AF2F00C91783 /* M3u_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = M3u_Prefix.pch; sourceTree = "<group>"; };
83849130180818B100E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* M3u.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = M3u.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B6048680CD000E48DA /* M3u.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = M3u.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8E8D401B0CBAFEF200135C1B /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../Audio/Plugin.h; sourceTree = SOURCE_ROOT; }; 8E8D401B0CBAFEF200135C1B /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../Audio/Plugin.h; sourceTree = SOURCE_ROOT; };
@ -71,6 +72,7 @@
08FB77AFFE84173DC02AAC07 /* Classes */ = { 08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
83849130180818B100E7332D /* Logging.h */,
8E8D401B0CBAFEF200135C1B /* Plugin.h */, 8E8D401B0CBAFEF200135C1B /* Plugin.h */,
8E8D40270CBAFF4300135C1B /* M3uContainer.h */, 8E8D40270CBAFF4300135C1B /* M3uContainer.h */,
8E8D40280CBAFF4300135C1B /* M3uContainer.m */, 8E8D40280CBAFF4300135C1B /* M3uContainer.m */,

View File

@ -8,6 +8,7 @@
#import "M3uContainer.h" #import "M3uContainer.h"
#import "Logging.h"
@implementation M3uContainer @implementation M3uContainer
@ -46,7 +47,7 @@
break; break;
} }
} }
NSLog(@"Fragment: %@", fragment); DLog(@"Fragment: %@", fragment);
if (![unixPath hasPrefix:@"/"]) { if (![unixPath hasPrefix:@"/"]) {
//Only relative paths would have windows backslashes. //Only relative paths would have windows backslashes.
@ -74,22 +75,22 @@
NSError *error = nil; NSError *error = nil;
NSString *contents = [NSString stringWithContentsOfFile:filename usedEncoding:&encoding error:&error]; NSString *contents = [NSString stringWithContentsOfFile:filename usedEncoding:&encoding error:&error];
if (error) { if (error) {
NSLog(@"Trying UTF8"); DLog(@"Trying UTF8");
error = nil; error = nil;
contents = [NSString stringWithContentsOfFile:filename encoding:NSUTF8StringEncoding error:&error]; contents = [NSString stringWithContentsOfFile:filename encoding:NSUTF8StringEncoding error:&error];
} }
if (error) { if (error) {
NSLog(@"Trying windows CP1251"); DLog(@"Trying windows CP1251");
error = nil; error = nil;
contents = [NSString stringWithContentsOfFile:filename encoding:NSWindowsCP1251StringEncoding error:&error]; contents = [NSString stringWithContentsOfFile:filename encoding:NSWindowsCP1251StringEncoding error:&error];
} }
if (error) { if (error) {
NSLog(@"Trying latin1"); DLog(@"Trying latin1");
error = nil; error = nil;
contents = [NSString stringWithContentsOfFile:filename encoding:NSISOLatin1StringEncoding error:&error]; contents = [NSString stringWithContentsOfFile:filename encoding:NSISOLatin1StringEncoding error:&error];
} }
if (error || !contents) { if (error || !contents) {
NSLog(@"Could not open file...%@ %@ %@", filename, contents, error); ALog(@"Could not open file...%@ %@ %@", filename, contents, error);
return nil; return nil;
} }

View File

@ -53,6 +53,7 @@
1703330A0B8FB64500327265 /* MusepackDecoder.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MusepackDecoder.m; sourceTree = "<group>"; }; 1703330A0B8FB64500327265 /* MusepackDecoder.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MusepackDecoder.m; sourceTree = "<group>"; };
17F562570C3BD97B0019975C /* MPCDec.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MPCDec.xcodeproj; path = ../../Frameworks/MPCDec/MPCDec.xcodeproj; sourceTree = SOURCE_ROOT; }; 17F562570C3BD97B0019975C /* MPCDec.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MPCDec.xcodeproj; path = ../../Frameworks/MPCDec/MPCDec.xcodeproj; sourceTree = SOURCE_ROOT; };
32DBCF630370AF2F00C91783 /* Musepack_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Musepack_Prefix.pch; sourceTree = "<group>"; }; 32DBCF630370AF2F00C91783 /* Musepack_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Musepack_Prefix.pch; sourceTree = "<group>"; };
838491311808190400E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* Musepack.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Musepack.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B6048680CD000E48DA /* Musepack.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Musepack.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8E2B8B4A0B9B48D000F2D9E8 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../Audio/Plugin.h; sourceTree = SOURCE_ROOT; }; 8E2B8B4A0B9B48D000F2D9E8 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../Audio/Plugin.h; sourceTree = SOURCE_ROOT; };
@ -104,6 +105,7 @@
08FB77AFFE84173DC02AAC07 /* Classes */ = { 08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
838491311808190400E7332D /* Logging.h */,
8E2B8B4A0B9B48D000F2D9E8 /* Plugin.h */, 8E2B8B4A0B9B48D000F2D9E8 /* Plugin.h */,
170333090B8FB64500327265 /* MusepackDecoder.h */, 170333090B8FB64500327265 /* MusepackDecoder.h */,
1703330A0B8FB64500327265 /* MusepackDecoder.m */, 1703330A0B8FB64500327265 /* MusepackDecoder.m */,

View File

@ -8,6 +8,8 @@
#import "MusepackDecoder.h" #import "MusepackDecoder.h"
#import "Logging.h"
@implementation MusepackDecoder @implementation MusepackDecoder
mpc_int32_t ReadProc(void *data, void *ptr, mpc_int32_t size) mpc_int32_t ReadProc(void *data, void *ptr, mpc_int32_t size)
@ -71,7 +73,7 @@ mpc_bool_t CanSeekProc(void *data)
mpc_streaminfo_init(&info); mpc_streaminfo_init(&info);
if (mpc_streaminfo_read(&info, &reader) != ERROR_CODE_OK) if (mpc_streaminfo_read(&info, &reader) != ERROR_CODE_OK)
{ {
NSLog(@"Not a valid musepack file."); DLog(@"Not a valid musepack file.");
return NO; return NO;
} }
@ -79,7 +81,7 @@ mpc_bool_t CanSeekProc(void *data)
mpc_decoder_setup(&decoder, &reader); mpc_decoder_setup(&decoder, &reader);
if (!mpc_decoder_initialize(&decoder, &info)) if (!mpc_decoder_initialize(&decoder, &info))
{ {
NSLog(@"Error initializing decoder."); DLog(@"Error initializing decoder.");
return NO; return NO;
} }
@ -138,7 +140,7 @@ mpc_bool_t CanSeekProc(void *data)
if (status == (unsigned)( -1)) if (status == (unsigned)( -1))
{ {
//decode error //decode error
NSLog(@"Decode error"); DLog(@"Decode error");
return 0; return 0;
} }
else if (status == 0) //EOF else if (status == 0) //EOF

View File

@ -57,6 +57,7 @@
8375B36A17FFF1CB0092A79F /* OpusDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpusDecoder.h; sourceTree = "<group>"; }; 8375B36A17FFF1CB0092A79F /* OpusDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpusDecoder.h; sourceTree = "<group>"; };
8375B36B17FFF1CB0092A79F /* OpusDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OpusDecoder.m; sourceTree = "<group>"; }; 8375B36B17FFF1CB0092A79F /* OpusDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OpusDecoder.m; sourceTree = "<group>"; };
8375B36D17FFF1FE0092A79F /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../../Audio/Plugin.h; sourceTree = "<group>"; }; 8375B36D17FFF1FE0092A79F /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../../Audio/Plugin.h; sourceTree = "<group>"; };
8384913718081F2700E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../../Utils/Logging.h; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@ -112,6 +113,7 @@
8375B04517FFEA400092A79F /* Opus */ = { 8375B04517FFEA400092A79F /* Opus */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8384913718081F2700E7332D /* Logging.h */,
8375B36D17FFF1FE0092A79F /* Plugin.h */, 8375B36D17FFF1FE0092A79F /* Plugin.h */,
8375B36A17FFF1CB0092A79F /* OpusDecoder.h */, 8375B36A17FFF1CB0092A79F /* OpusDecoder.h */,
8375B36B17FFF1CB0092A79F /* OpusDecoder.m */, 8375B36B17FFF1CB0092A79F /* OpusDecoder.m */,

View File

@ -10,6 +10,7 @@
#import "OpusDecoder.h" #import "OpusDecoder.h"
#import "Logging.h"
@implementation OpusFile @implementation OpusFile
@ -17,7 +18,7 @@ int sourceRead(void *_stream, unsigned char *_ptr, int _nbytes)
{ {
id source = (id)_stream; id source = (id)_stream;
return [source read:_ptr amount:_nbytes]; return (int) [source read:_ptr amount:_nbytes];
} }
int sourceSeek(void *_stream, opus_int64 _offset, int _whence) int sourceSeek(void *_stream, opus_int64 _offset, int _whence)
@ -67,7 +68,7 @@ opus_int64 sourceTell(void *_stream)
if (!opusRef) if (!opusRef)
{ {
NSLog(@"FAILED TO OPEN VORBIS FILE"); DLog(@"FAILED TO OPEN OPUS FILE");
return NO; return NO;
} }

View File

@ -18,6 +18,7 @@
089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
32DBCF630370AF2F00C91783 /* Pls_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pls_Prefix.pch; sourceTree = "<group>"; }; 32DBCF630370AF2F00C91783 /* Pls_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pls_Prefix.pch; sourceTree = "<group>"; };
838491321808193F00E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* Pls.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Pls.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B6048680CD000E48DA /* Pls.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Pls.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8E8D419F0CBB0CA700135C1B /* PlsContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlsContainer.h; sourceTree = "<group>"; }; 8E8D419F0CBB0CA700135C1B /* PlsContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlsContainer.h; sourceTree = "<group>"; };
@ -71,6 +72,7 @@
08FB77AFFE84173DC02AAC07 /* Classes */ = { 08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
838491321808193F00E7332D /* Logging.h */,
8E8D41A50CBB0CBE00135C1B /* Plugin.h */, 8E8D41A50CBB0CBE00135C1B /* Plugin.h */,
8E8D419F0CBB0CA700135C1B /* PlsContainer.h */, 8E8D419F0CBB0CA700135C1B /* PlsContainer.h */,
8E8D41A00CBB0CA700135C1B /* PlsContainer.m */, 8E8D41A00CBB0CA700135C1B /* PlsContainer.m */,

View File

@ -8,6 +8,7 @@
#import "PlsContainer.h" #import "PlsContainer.h"
#import "Logging.h"
@implementation PlsContainer @implementation PlsContainer
@ -46,7 +47,7 @@
break; break;
} }
} }
NSLog(@"Fragment: %@", fragment); DLog(@"Fragment: %@", fragment);
if (![unixPath hasPrefix:@"/"]) { if (![unixPath hasPrefix:@"/"]) {
//Only relative paths would have windows backslashes. //Only relative paths would have windows backslashes.
@ -76,27 +77,25 @@
NSError *error; NSError *error;
NSString *contents = [NSString stringWithContentsOfFile:filename usedEncoding:&encoding error:&error]; NSString *contents = [NSString stringWithContentsOfFile:filename usedEncoding:&encoding error:&error];
if (error) { if (error) {
NSLog(@"Trying UTF8"); DLog(@"Trying UTF8");
error = nil; error = nil;
contents = [NSString stringWithContentsOfFile:filename encoding:NSUTF8StringEncoding error:&error]; contents = [NSString stringWithContentsOfFile:filename encoding:NSUTF8StringEncoding error:&error];
} }
if (error) { if (error) {
NSLog(@"Trying windows CP1251"); DLog(@"Trying windows CP1251");
error = nil; error = nil;
contents = [NSString stringWithContentsOfFile:filename encoding:NSWindowsCP1251StringEncoding error:&error]; contents = [NSString stringWithContentsOfFile:filename encoding:NSWindowsCP1251StringEncoding error:&error];
} }
if (error) { if (error) {
NSLog(@"Trying latin1"); DLog(@"Trying latin1");
error = nil; error = nil;
contents = [NSString stringWithContentsOfFile:filename encoding:NSISOLatin1StringEncoding error:&error]; contents = [NSString stringWithContentsOfFile:filename encoding:NSISOLatin1StringEncoding error:&error];
} }
if (error || !contents) { if (error || !contents) {
NSLog(@"Could not open file...%@ %@ %@", filename, contents, error); ALog(@"Could not open file...%@ %@ %@", filename, contents, error);
return nil; return nil;
} }
NSString *entry;
NSEnumerator *e = [[contents componentsSeparatedByString:@"\n"] objectEnumerator];
NSMutableArray *entries = [NSMutableArray array]; NSMutableArray *entries = [NSMutableArray array];
for (NSString *entry in [contents componentsSeparatedByString:@"\n"]) for (NSString *entry in [contents componentsSeparatedByString:@"\n"])

View File

@ -12,6 +12,7 @@
17C93FC30B90056C008627D6 /* TagLibMetadataReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 17C93FC20B90056C008627D6 /* TagLibMetadataReader.m */; }; 17C93FC30B90056C008627D6 /* TagLibMetadataReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 17C93FC20B90056C008627D6 /* TagLibMetadataReader.m */; };
17F563B40C3BDBB30019975C /* TagLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17F563A60C3BDB8F0019975C /* TagLib.framework */; }; 17F563B40C3BDBB30019975C /* TagLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17F563A60C3BDB8F0019975C /* TagLib.framework */; };
17F563B60C3BDBB50019975C /* TagLib.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17F563A60C3BDB8F0019975C /* TagLib.framework */; }; 17F563B60C3BDBB50019975C /* TagLib.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17F563A60C3BDB8F0019975C /* TagLib.framework */; };
8384913A18081FFC00E7332D /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 8384913918081FFC00E7332D /* Logging.h */; };
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
@ -57,6 +58,7 @@
17C93FC20B90056C008627D6 /* TagLibMetadataReader.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = TagLibMetadataReader.m; sourceTree = "<group>"; }; 17C93FC20B90056C008627D6 /* TagLibMetadataReader.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = TagLibMetadataReader.m; sourceTree = "<group>"; };
17F563A00C3BDB8F0019975C /* TagLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = TagLib.xcodeproj; path = ../../Frameworks/TagLib/TagLib.xcodeproj; sourceTree = SOURCE_ROOT; }; 17F563A00C3BDB8F0019975C /* TagLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = TagLib.xcodeproj; path = ../../Frameworks/TagLib/TagLib.xcodeproj; sourceTree = SOURCE_ROOT; };
32DBCF630370AF2F00C91783 /* TagLib_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagLib_Prefix.pch; sourceTree = "<group>"; }; 32DBCF630370AF2F00C91783 /* TagLib_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagLib_Prefix.pch; sourceTree = "<group>"; };
8384913918081FFC00E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* TagLib.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TagLib.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B6048680CD000E48DA /* TagLib.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TagLib.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; }; D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
@ -107,6 +109,7 @@
08FB77AFFE84173DC02AAC07 /* Classes */ = { 08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8384913918081FFC00E7332D /* Logging.h */,
07CACE890ED1AD1000C0F1E8 /* TagLibMetadataWriter.h */, 07CACE890ED1AD1000C0F1E8 /* TagLibMetadataWriter.h */,
07CACE8A0ED1AD1000C0F1E8 /* TagLibMetadataWriter.m */, 07CACE8A0ED1AD1000C0F1E8 /* TagLibMetadataWriter.m */,
177FCFA40B90C9600011C3B5 /* Plugin.h */, 177FCFA40B90C9600011C3B5 /* Plugin.h */,
@ -166,6 +169,7 @@
isa = PBXHeadersBuildPhase; isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
8384913A18081FFC00E7332D /* Logging.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -11,6 +11,8 @@
#import <TagLib/fileref.h> #import <TagLib/fileref.h>
#import <TagLib/tag.h> #import <TagLib/tag.h>
#import "Logging.h"
@implementation TagLibMetadataWriter @implementation TagLibMetadataWriter
+ (int)putMetadataInURL:(NSURL *)url tagData:(NSDictionary *)tagData + (int)putMetadataInURL:(NSURL *)url tagData:(NSDictionary *)tagData
@ -46,7 +48,7 @@
for (id key in dictionary) for (id key in dictionary)
{ {
NSLog(@"key: %@, value: %@", key, [dictionary objectForKey:key]); DLog(@"key: %@, value: %@", key, [dictionary objectForKey:key]);
} }
pArtist = tag->artist(); pArtist = tag->artist();

View File

@ -54,6 +54,7 @@
17C93D340B8FDA66008627D6 /* VorbisDecoder.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = VorbisDecoder.m; sourceTree = "<group>"; }; 17C93D340B8FDA66008627D6 /* VorbisDecoder.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = VorbisDecoder.m; sourceTree = "<group>"; };
17F562EF0C3BDAAC0019975C /* Vorbis.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Vorbis.xcodeproj; path = ../../Frameworks/Vorbis/Vorbis.xcodeproj; sourceTree = SOURCE_ROOT; }; 17F562EF0C3BDAAC0019975C /* Vorbis.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Vorbis.xcodeproj; path = ../../Frameworks/Vorbis/Vorbis.xcodeproj; sourceTree = SOURCE_ROOT; };
32DBCF630370AF2F00C91783 /* Vorbis_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Vorbis_Prefix.pch; sourceTree = "<group>"; }; 32DBCF630370AF2F00C91783 /* Vorbis_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Vorbis_Prefix.pch; sourceTree = "<group>"; };
8384913418081A3900E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* Vorbis.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Vorbis.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B6048680CD000E48DA /* Vorbis.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Vorbis.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; }; D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
@ -104,6 +105,7 @@
08FB77AFFE84173DC02AAC07 /* Classes */ = { 08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8384913418081A3900E7332D /* Logging.h */,
177FCF9D0B90C9530011C3B5 /* Plugin.h */, 177FCF9D0B90C9530011C3B5 /* Plugin.h */,
17C93D330B8FDA66008627D6 /* VorbisDecoder.h */, 17C93D330B8FDA66008627D6 /* VorbisDecoder.h */,
17C93D340B8FDA66008627D6 /* VorbisDecoder.m */, 17C93D340B8FDA66008627D6 /* VorbisDecoder.m */,

View File

@ -8,6 +8,7 @@
#import "VorbisDecoder.h" #import "VorbisDecoder.h"
#import "Logging.h"
@implementation VorbisDecoder @implementation VorbisDecoder
@ -52,7 +53,7 @@ long sourceTell(void *datasource)
if (ov_open_callbacks(source, &vorbisRef, NULL, 0, callbacks) != 0) if (ov_open_callbacks(source, &vorbisRef, NULL, 0, callbacks) != 0)
{ {
NSLog(@"FAILED TO OPEN VORBIS FILE"); DLog(@"FAILED TO OPEN VORBIS FILE");
return NO; return NO;
} }

View File

@ -52,6 +52,7 @@
177FCF940B90C9450011C3B5 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../Audio/Plugin.h; sourceTree = SOURCE_ROOT; }; 177FCF940B90C9450011C3B5 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../Audio/Plugin.h; sourceTree = SOURCE_ROOT; };
17F562C20C3BDA5A0019975C /* WavPack.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = WavPack.xcodeproj; path = ../../Frameworks/WavPack/WavPack.xcodeproj; sourceTree = SOURCE_ROOT; }; 17F562C20C3BDA5A0019975C /* WavPack.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = WavPack.xcodeproj; path = ../../Frameworks/WavPack/WavPack.xcodeproj; sourceTree = SOURCE_ROOT; };
32DBCF630370AF2F00C91783 /* WavPack_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WavPack_Prefix.pch; sourceTree = "<group>"; }; 32DBCF630370AF2F00C91783 /* WavPack_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WavPack_Prefix.pch; sourceTree = "<group>"; };
83849133180819EB00E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* WavPack.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WavPack.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B6048680CD000E48DA /* WavPack.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WavPack.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; }; D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
@ -102,6 +103,7 @@
08FB77AFFE84173DC02AAC07 /* Classes */ = { 08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
83849133180819EB00E7332D /* Logging.h */,
177FCF940B90C9450011C3B5 /* Plugin.h */, 177FCF940B90C9450011C3B5 /* Plugin.h */,
1745C4D50B90C42500A6768C /* WavPackDecoder.h */, 1745C4D50B90C42500A6768C /* WavPackDecoder.h */,
1745C4D60B90C42500A6768C /* WavPackDecoder.m */, 1745C4D60B90C42500A6768C /* WavPackDecoder.m */,

View File

@ -8,6 +8,7 @@
#import "WavPackDecoder.h" #import "WavPackDecoder.h"
#import "Logging.h"
@implementation WavPackDecoder @implementation WavPackDecoder
@ -104,7 +105,7 @@ int32_t WriteBytesProc(void *ds, void *data, int32_t bcount)
//No corrections file (WVC) support at the moment. //No corrections file (WVC) support at the moment.
wpc = WavpackOpenFileInputEx(&reader, self, NULL, error, open_flags, 0); wpc = WavpackOpenFileInputEx(&reader, self, NULL, error, open_flags, 0);
if (!wpc) { if (!wpc) {
NSLog(@"Unable to open file.."); DLog(@"Unable to open file..");
return NO; return NO;
} }
@ -207,7 +208,7 @@ int32_t WriteBytesProc(void *ds, void *data, int32_t bcount)
} }
break; break;
default: default:
NSLog(@"Unsupported sample size.."); ALog(@"Unsupported sample size: %d", bitsPerSample);
} }
free(inputBuffer); free(inputBuffer);

View File

@ -54,6 +54,7 @@
17E78A7D0D68BE3C005C5A59 /* file_tree.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = file_tree.png; path = Icons/file_tree.png; sourceTree = "<group>"; }; 17E78A7D0D68BE3C005C5A59 /* file_tree.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = file_tree.png; path = Icons/file_tree.png; sourceTree = "<group>"; };
17E78B690D68C1E3005C5A59 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Preferences.xib; sourceTree = "<group>"; }; 17E78B690D68C1E3005C5A59 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Preferences.xib; sourceTree = "<group>"; };
32DBCF630370AF2F00C91783 /* General_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = General_Prefix.pch; sourceTree = "<group>"; }; 32DBCF630370AF2F00C91783 /* General_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = General_Prefix.pch; sourceTree = "<group>"; };
8384913618081ECB00E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
83EF495D17FBC96A00642E3C /* VolumeBehaviorArrayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VolumeBehaviorArrayController.h; sourceTree = "<group>"; }; 83EF495D17FBC96A00642E3C /* VolumeBehaviorArrayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VolumeBehaviorArrayController.h; sourceTree = "<group>"; };
83EF495E17FBC96A00642E3C /* VolumeBehaviorArrayController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VolumeBehaviorArrayController.m; sourceTree = "<group>"; }; 83EF495E17FBC96A00642E3C /* VolumeBehaviorArrayController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VolumeBehaviorArrayController.m; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* General.preferencePane */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = General.preferencePane; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B6048680CD000E48DA /* General.preferencePane */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = General.preferencePane; sourceTree = BUILT_PRODUCTS_DIR; };
@ -127,6 +128,7 @@
08FB77AFFE84173DC02AAC07 /* Classes */ = { 08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8384913618081ECB00E7332D /* Logging.h */,
17D503410ABDB1660022D1E8 /* Custom */, 17D503410ABDB1660022D1E8 /* Custom */,
17D5033F0ABDB1570022D1E8 /* Panes */, 17D5033F0ABDB1570022D1E8 /* Panes */,
17D1B3F60F6349CE00694C57 /* PreferencePanePlugin.h */, 17D1B3F60F6349CE00694C57 /* PreferencePanePlugin.h */,

View File

@ -10,6 +10,8 @@
#import <objc/runtime.h> #import <objc/runtime.h>
#import "Logging.h"
@interface NDHotKeyEvent (Private) @interface NDHotKeyEvent (Private)
+ (NSMapTable *)allHotKeyEvents; + (NSMapTable *)allHotKeyEvents;
- (BOOL)addHotKey; - (BOOL)addHotKey;
@ -92,7 +94,7 @@ struct HotKeyMappingEntry
} }
else else
{ {
NSLog(@"Could not install Event handler"); DLog(@"Could not install Event handler");
} }
} }
NDHotKeyEventUnlock; NDHotKeyEventUnlock;
@ -409,7 +411,7 @@ struct HotKeyMappingEntry
- (void)dealloc - (void)dealloc
{ {
if( UnregisterEventHotKey( reference ) != noErr ) // in lock from release if( UnregisterEventHotKey( reference ) != noErr ) // in lock from release
NSLog( @"Failed to unregister hot key %@", self ); DLog( @"Failed to unregister hot key %@", self );
[super dealloc]; [super dealloc];
} }
@ -439,7 +441,7 @@ struct HotKeyMappingEntry
if( theResult ) if( theResult )
isEnabled.individual = aFlag; isEnabled.individual = aFlag;
else else
NSLog(@"%s failed ", aFlag ? "enable" : "disable" ); DLog(@"%s failed ", aFlag ? "enable" : "disable" );
} }
else else
theResult = NO; theResult = NO;
@ -838,7 +840,7 @@ void hashKeyReleaseFunction( NSMapTable * aTable, void * aNumber )
if( theResult ) if( theResult )
isEnabled.collective = aFlag; isEnabled.collective = aFlag;
else else
NSLog(@"%s failed", aFlag ? "enable" : "disable" ); DLog(@"%s failed", aFlag ? "enable" : "disable" );
} }
else else
theResult = NO; theResult = NO;

View File

@ -9,6 +9,8 @@
#import "PreferencesWindow.h" #import "PreferencesWindow.h"
#import "PreferencePanePlugin.h" #import "PreferencePanePlugin.h"
#import "Logging.h"
@interface PreferencesWindow() @interface PreferencesWindow()
- (NSString *)lastPaneDefaultsKey; - (NSString *)lastPaneDefaultsKey;
@ -150,7 +152,7 @@
NSString *lastPane = [[NSUserDefaults standardUserDefaults] objectForKey:[self lastPaneDefaultsKey]]; NSString *lastPane = [[NSUserDefaults standardUserDefaults] objectForKey:[self lastPaneDefaultsKey]];
if (nil == lastPane) { if (nil == lastPane) {
if (0 >= [preferencePaneOrder count]) { if (0 >= [preferencePaneOrder count]) {
NSLog(@"Error: Preference panes not found!"); ALog(@"Error: Preference panes not found!");
} }
lastPane = [preferencePaneOrder objectAtIndex:0]; lastPane = [preferencePaneOrder objectAtIndex:0];

View File

@ -15,6 +15,8 @@
#import "NSNumber+CogSort.h" #import "NSNumber+CogSort.h"
#import "SpotlightTransformers.h" #import "SpotlightTransformers.h"
#import "Logging.h"
// Minimum length of a search string (searching for very small strings gets ugly) // Minimum length of a search string (searching for very small strings gets ugly)
#define MINIMUM_SEARCH_STRING_LENGTH 3 #define MINIMUM_SEARCH_STRING_LENGTH 3
@ -129,7 +131,7 @@ static NSPredicate * musicOnlyPredicate = nil;
// Set scope to contents of pathControl // Set scope to contents of pathControl
self.query.searchScopes = [NSArray arrayWithObjects:pathControl.URL, nil]; self.query.searchScopes = [NSArray arrayWithObjects:pathControl.URL, nil];
[self.query startQuery]; [self.query startQuery];
NSLog(@"Started query: %@", [self.query.predicate description]); DLog(@"Started query: %@", [self.query.predicate description]);
} }
} }
} }

View File

@ -53,6 +53,8 @@
#import "AppleRemote.h" #import "AppleRemote.h"
#import "Logging.h"
const char* AppleRemoteDeviceName = "AppleIRController"; const char* AppleRemoteDeviceName = "AppleIRController";
const int REMOTE_SWITCH_COOKIE=19; const int REMOTE_SWITCH_COOKIE=19;
const NSTimeInterval DEFAULT_MAXIMUM_CLICK_TIME_DIFFERENCE=0.35; const NSTimeInterval DEFAULT_MAXIMUM_CLICK_TIME_DIFFERENCE=0.35;
@ -447,7 +449,7 @@ static AppleRemote* sharedInstance=nil;
/* /*
if (previousRemainingCookieString) { if (previousRemainingCookieString) {
cookieString = [previousRemainingCookieString stringByAppendingString: cookieString]; cookieString = [previousRemainingCookieString stringByAppendingString: cookieString];
NSLog(@"New cookie string is %@", cookieString); DLog(@"New cookie string is %@", cookieString);
[previousRemainingCookieString release], previousRemainingCookieString=nil; [previousRemainingCookieString release], previousRemainingCookieString=nil;
}*/ }*/
if (cookieString == nil || [cookieString length] == 0) return; if (cookieString == nil || [cookieString length] == 0) return;
@ -468,11 +470,11 @@ static AppleRemote* sharedInstance=nil;
// process the last event of the backlog and assume that the button is not pressed down any longer. // process the last event of the backlog and assume that the button is not pressed down any longer.
// The events in the backlog do not seem to be in order and therefore (in rare cases) the last event might be // The events in the backlog do not seem to be in order and therefore (in rare cases) the last event might be
// a button pressed down event while in reality the user has released it. // a button pressed down event while in reality the user has released it.
// NSLog(@"processing last event of backlog"); // DLog(@"processing last event of backlog");
[self handleEventWithCookieString: lastSubCookieString sumOfValues:0]; [self handleEventWithCookieString: lastSubCookieString sumOfValues:0];
} }
if ([cookieString length] > 0) { if ([cookieString length] > 0) {
NSLog(@"Unknown button for cookiestring %@", cookieString); ALog(@"Unknown button for cookiestring %@", cookieString);
} }
} }
} }
@ -520,7 +522,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
ioReturnValue = IOObjectGetClass(hidDevice, className); ioReturnValue = IOObjectGetClass(hidDevice, className);
if (ioReturnValue != kIOReturnSuccess) { if (ioReturnValue != kIOReturnSuccess) {
NSLog(@"Error: Failed to get class name."); ALog(@"Error: Failed to get class name.");
return NULL; return NULL;
} }
@ -535,7 +537,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
plugInResult = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (LPVOID) &hidDeviceInterface); plugInResult = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (LPVOID) &hidDeviceInterface);
if (plugInResult != S_OK) { if (plugInResult != S_OK) {
NSLog(@"Error: Couldn't create HID class device interface"); ALog(@"Error: Couldn't create HID class device interface");
} }
// Release // Release
if (plugInInterface) (*plugInInterface)->Release(plugInInterface); if (plugInInterface) (*plugInInterface)->Release(plugInInterface);
@ -650,13 +652,13 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
(*queue)->start(queue); (*queue)->start(queue);
return YES; return YES;
} else { } else {
NSLog(@"Error when setting event callout"); ALog(@"Error when setting event callout");
} }
} else { } else {
NSLog(@"Error when creating async event source"); ALog(@"Error when creating async event source");
} }
} else { } else {
NSLog(@"Error when opening device"); ALog(@"Error when opening device");
} }
} }
return NO; return NO;

View File

@ -14,6 +14,8 @@
#import "GCOneShotEffectTimer.h" #import "GCOneShotEffectTimer.h"
#import "Logging.h"
@interface GCOneShotEffectTimer (Private) @interface GCOneShotEffectTimer (Private)
- (id) initWithTimeInterval:(NSTimeInterval) t forDelegate:(id) del; - (id) initWithTimeInterval:(NSTimeInterval) t forDelegate:(id) del;
@ -80,7 +82,7 @@
NSTimeInterval elapsed = [NSDate timeIntervalSinceReferenceDate] - _start; NSTimeInterval elapsed = [NSDate timeIntervalSinceReferenceDate] - _start;
float val = elapsed / _total; float val = elapsed / _total;
//NSLog(@"t = %f", val ); //DLog(@"t = %f", val );
if ( elapsed > _total ) if ( elapsed > _total )
{ {

View File

@ -15,6 +15,8 @@
#import "GCWindowMenu.h" #import "GCWindowMenu.h"
#import "GCOneShotEffectTimer.h" #import "GCOneShotEffectTimer.h"
#import "Logging.h"
@interface GCWindowMenu (Private) @interface GCWindowMenu (Private)
+ (void) popUpWindowMenu:(GCWindowMenu*) menu withEvent:(NSEvent*) event; + (void) popUpWindowMenu:(GCWindowMenu*) menu withEvent:(NSEvent*) event;
@ -256,7 +258,7 @@
{ {
// tracks the "menu" by keeping control until a mouse up (or down, if menu 'clicked' into being) // tracks the "menu" by keeping control until a mouse up (or down, if menu 'clicked' into being)
NSLog(@"starting tracking; initial event = %@", event); DLog(@"starting tracking; initial event = %@", event);
// [NSEvent startPeriodicEventsAfterDelay:1.0 withPeriod:0.1]; // [NSEvent startPeriodicEventsAfterDelay:1.0 withPeriod:0.1];
@ -356,7 +358,7 @@
[self discardEventsMatchingMask:NSAnyEventMask beforeEvent:theEvent]; [self discardEventsMatchingMask:NSAnyEventMask beforeEvent:theEvent];
//[NSEvent stopPeriodicEvents]; //[NSEvent stopPeriodicEvents];
NSLog(@"tracking ended"); DLog(@"tracking ended");
} }

View File

@ -10,6 +10,8 @@
#import <objc/runtime.h> #import <objc/runtime.h>
#import "Logging.h"
@interface NDHotKeyEvent (Private) @interface NDHotKeyEvent (Private)
+ (NSMapTable *)allHotKeyEvents; + (NSMapTable *)allHotKeyEvents;
- (BOOL)addHotKey; - (BOOL)addHotKey;
@ -92,7 +94,7 @@ struct HotKeyMappingEntry
} }
else else
{ {
NSLog(@"Could not install Event handler"); DLog(@"Could not install Event handler");
} }
} }
NDHotKeyEventUnlock; NDHotKeyEventUnlock;
@ -409,7 +411,7 @@ struct HotKeyMappingEntry
- (void)dealloc - (void)dealloc
{ {
if( UnregisterEventHotKey( reference ) != noErr ) // in lock from release if( UnregisterEventHotKey( reference ) != noErr ) // in lock from release
NSLog( @"Failed to unregister hot key %@", self ); DLog( @"Failed to unregister hot key %@", self );
[super dealloc]; [super dealloc];
} }
@ -439,7 +441,7 @@ struct HotKeyMappingEntry
if( theResult ) if( theResult )
isEnabled.individual = aFlag; isEnabled.individual = aFlag;
else else
NSLog(@"%s failed ", aFlag ? "enable" : "disable" ); DLog(@"%s failed ", aFlag ? "enable" : "disable" );
} }
else else
theResult = NO; theResult = NO;
@ -838,7 +840,7 @@ void hashKeyReleaseFunction( NSMapTable * aTable, void * aNumber )
if( theResult ) if( theResult )
isEnabled.collective = aFlag; isEnabled.collective = aFlag;
else else
NSLog(@"%s failed", aFlag ? "enable" : "disable" ); DLog(@"%s failed", aFlag ? "enable" : "disable" );
} }
else else
theResult = NO; theResult = NO;

16
Utils/Logging.h Normal file
View File

@ -0,0 +1,16 @@
//
// Logging.h
// Cog
//
// Shamelessly stolen from stackoverflow by Dmitry Promsky on 3/7/12.
// Copyright 2012 dmitry.promsky@gmail.com. All rights reserved.
//
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s (line %d) " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DLog(...)
#endif
#define ALog(fmt, ...) NSLog((@"%s (line %d) " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);

View File

@ -8,6 +8,8 @@
#import "SideViewController.h" #import "SideViewController.h"
#import "Logging.h"
@implementation SideViewController @implementation SideViewController
- (NSString *)showSideViewDefaultsKey - (NSString *)showSideViewDefaultsKey
@ -133,7 +135,7 @@
if (![self sideViewIsHidden]) if (![self sideViewIsHidden])
{ {
[[NSUserDefaults standardUserDefaults] setFloat:[self dividerPosition] forKey:[self sideViewDividerPositionDefaultsKey]]; [[NSUserDefaults standardUserDefaults] setFloat:[self dividerPosition] forKey:[self sideViewDividerPositionDefaultsKey]];
NSLog(@"DIVIDER POSITION: %f", [self dividerPosition]); DLog(@"DIVIDER POSITION: %f", [self dividerPosition]);
} }
} }

View File

@ -11,6 +11,8 @@
#import <CogAudio/Status.h> #import <CogAudio/Status.h>
#import "Logging.h"
@implementation PlaybackButtons @implementation PlaybackButtons
static NSString *PlaybackButtonsPlaybackStatusObservationContext = @"PlaybackButtonsPlaybackStatusObservationContext"; static NSString *PlaybackButtonsPlaybackStatusObservationContext = @"PlaybackButtonsPlaybackStatusObservationContext";
@ -62,7 +64,7 @@ static NSString *PlaybackButtonsPlaybackStatusObservationContext = @"PlaybackBut
- (BOOL)sendAction:(SEL)theAction to:(id)theTarget - (BOOL)sendAction:(SEL)theAction to:(id)theTarget
{ {
NSLog(@"Mouse down!"); DLog(@"Mouse down!");
int clickedSegment = [self selectedSegment]; int clickedSegment = [self selectedSegment];
if (clickedSegment == 0) //Previous if (clickedSegment == 0) //Previous

View File

@ -9,6 +9,8 @@
#import "RepeatTransformers.h" #import "RepeatTransformers.h"
#import "PlaylistController.h" #import "PlaylistController.h"
#import "Logging.h"
@implementation RepeatModeTransformer @implementation RepeatModeTransformer
+ (Class)transformedValueClass { return [NSNumber class]; } + (Class)transformedValueClass { return [NSNumber class]; }
@ -27,7 +29,7 @@
// Convert from RepeatMode to BOOL // Convert from RepeatMode to BOOL
- (id)transformedValue:(id)value { - (id)transformedValue:(id)value {
NSLog(@"Transforming value: %@", value); DLog(@"Transforming value: %@", value);
if (value == nil) return nil; if (value == nil) return nil;
@ -65,7 +67,7 @@
// Convert from string to RepeatMode // Convert from string to RepeatMode
- (id)transformedValue:(id)value { - (id)transformedValue:(id)value {
NSLog(@"Transforming value: %@", value); DLog(@"Transforming value: %@", value);
if (value == nil) return nil; if (value == nil) return nil;

View File

@ -7,6 +7,9 @@
// //
#import "ShuffleTransformers.h" #import "ShuffleTransformers.h"
#import "Logging.h"
@implementation ShuffleImageTransformer @implementation ShuffleImageTransformer
+ (Class)transformedValueClass { return [NSImage class]; } + (Class)transformedValueClass { return [NSImage class]; }
@ -14,7 +17,7 @@
// Convert from string to RepeatMode // Convert from string to RepeatMode
- (id)transformedValue:(id)value { - (id)transformedValue:(id)value {
NSLog(@"Transforming value: %@", value); DLog(@"Transforming value: %@", value);
if (value == nil) return nil; if (value == nil) return nil;
@ -54,7 +57,7 @@
// Convert from RepeatMode to BOOL // Convert from RepeatMode to BOOL
- (id)transformedValue:(id)value { - (id)transformedValue:(id)value {
NSLog(@"Transforming value: %@", value); DLog(@"Transforming value: %@", value);
if (value == nil) return nil; if (value == nil) return nil;