Fixed bug when dragging folders to the dock in 10.3

CQTexperiment
vspader 2005-06-30 16:13:22 +00:00
parent c3bbc461e6
commit 7987b3dcf7
16 changed files with 41 additions and 60 deletions

View File

@ -133,6 +133,7 @@
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{ {
DBLog(@"Adding path: %@", filename);
if ([playlistController addPaths:[NSArray arrayWithObject:filename] sort:NO] != 1) if ([playlistController addPaths:[NSArray arrayWithObject:filename] sort:NO] != 1)
return NO; return NO;
@ -141,6 +142,8 @@
- (void)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames - (void)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames
{ {
DBLog(@"Adding paths: %@", filenames);
[playlistController addPaths:filenames sort:YES]; [playlistController addPaths:filenames sort:YES];
[theApplication replyToOpenOrPrint:NSApplicationDelegateReplySuccess]; [theApplication replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
} }

View File

@ -1,10 +1,6 @@
0.04.c 0.05
---- ----
Fixed autopositioning of the volume slider. Dragging to the dock icon now works in 10.3.
0.04.b
----
Fixed crash when dragging/dropping files to the playlist.
0.04 0.04
---- ----
@ -14,6 +10,8 @@ Fixed version number, so autoupdate should work.
Compiled with GCC3.3, which should hopefully fix issues with 10.3. (If it doesn't, contact me please) Compiled with GCC3.3, which should hopefully fix issues with 10.3. (If it doesn't, contact me please)
Now ignores case when dealing with file extensions. Now ignores case when dealing with file extensions.
Added volume slider. Added volume slider.
Fixed autopositioning of the volume slider.
Fixed crash when dragging/dropping files to the playlist.
0.0.3 0.0.3
----- -----

View File

@ -3,13 +3,15 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>IBDocumentLocation</key> <key>IBDocumentLocation</key>
<string>288 118 356 240 0 0 1024 746 </string> <string>69 104 356 240 0 0 1024 746 </string>
<key>IBEditorPositions</key> <key>IBEditorPositions</key>
<dict> <dict>
<key>29</key> <key>29</key>
<string>243 676 346 44 0 0 1024 746 </string> <string>243 676 346 44 0 0 1024 746 </string>
<key>463</key> <key>463</key>
<string>356 394 312 249 0 0 1024 746 </string> <string>356 394 312 249 0 0 1024 746 </string>
<key>513</key>
<string>475 157 180 156 0 0 1024 746 </string>
</dict> </dict>
<key>IBFramework Version</key> <key>IBFramework Version</key>
<string>439.0</string> <string>439.0</string>
@ -20,7 +22,7 @@
<key>IBOpenObjects</key> <key>IBOpenObjects</key>
<array> <array>
<integer>21</integer> <integer>21</integer>
<integer>29</integer> <integer>513</integer>
<integer>463</integer> <integer>463</integer>
</array> </array>
<key>IBSystem Version</key> <key>IBSystem Version</key>

Binary file not shown.

View File

@ -23,7 +23,6 @@
- (void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo - (void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo
{ {
DBLog(@"CONTEXT: %i", contextInfo);
if (contextInfo == YES) if (contextInfo == YES)
{ {
[feedbackWindow close]; [feedbackWindow close];

View File

@ -11,14 +11,14 @@
<array> <array>
<string>*</string> <string>*</string>
</array> </array>
<key>CFBundleTypeName</key> <key>CFBundleTypeOSTypes</key>
<string>Folder</string> <array>
<string>****</string>
<string>fold</string>
<string>disk</string>
</array>
<key>CFBundleTypeRole</key> <key>CFBundleTypeRole</key>
<string>Editor</string> <string>None</string>
<key>LSTypeIsPackage</key>
<true/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict> </dict>
<dict> <dict>
<key>CFBundleTypeExtensions</key> <key>CFBundleTypeExtensions</key>
@ -29,6 +29,8 @@
</array> </array>
<key>CFBundleTypeName</key> <key>CFBundleTypeName</key>
<string>AIFF Audio File</string> <string>AIFF Audio File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict> </dict>
<dict> <dict>
<key>CFBundleTypeExtensions</key> <key>CFBundleTypeExtensions</key>
@ -93,7 +95,7 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>0.04.1</string> <string>0.05</string>
<key>NSAppleScriptEnabled</key> <key>NSAppleScriptEnabled</key>
<string>YES</string> <string>YES</string>
<key>NSMainNibFile</key> <key>NSMainNibFile</key>

View File

@ -60,14 +60,17 @@
manager = [NSFileManager defaultManager]; manager = [NSFileManager defaultManager];
DBLog(@"Checking if path is a directory: %@", path);
if ([manager fileExistsAtPath:path isDirectory:&isDir] && isDir == YES) if ([manager fileExistsAtPath:path isDirectory:&isDir] && isDir == YES)
{ {
DBLog(@"path is directory");
int count; int count;
int j; int j;
NSArray *subpaths; NSArray *subpaths;
count = 0; count = 0;
subpaths = [manager subpathsAtPath:path]; subpaths = [manager subpathsAtPath:path];
DBLog(@"Subpaths: %@", subpaths);
for (j = 0; j < [subpaths count]; j++) for (j = 0; j < [subpaths count]; j++)
{ {
NSString *filepath; NSString *filepath;
@ -82,6 +85,7 @@
else else
{ {
// DBLog(@"Adding fiiiiile: %@", path); // DBLog(@"Adding fiiiiile: %@", path);
DBLog(@"path is a file");
return [self insertFile:path atIndex:index]; return [self insertFile:path atIndex:index];
} }
} }
@ -100,6 +104,7 @@
count = 0; count = 0;
DBLog(@"Sorting paths");
if (sort == YES) if (sort == YES)
{ {
sortedFiles = [paths sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; sortedFiles = [paths sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
@ -109,13 +114,14 @@
sortedFiles = paths; sortedFiles = paths;
} }
DBLog(@"Paths sorted: %@", sortedFiles);
for(i=0; i < [sortedFiles count]; i++) for(i=0; i < [sortedFiles count]; i++)
{ {
int j; int j;
NSString *f; NSString *f;
f = [sortedFiles objectAtIndex:i]; f = [sortedFiles objectAtIndex:i];
// DBLog(@"Adding file to index: %i", index+count); DBLog(@"Inserting path");
j = [self insertPath:f atIndex:(index+count)]; j = [self insertPath:f atIndex:(index+count)];
// DBLog(@"Number added: %i", j); // DBLog(@"Number added: %i", j);
count+=j; count+=j;
@ -181,15 +187,11 @@
NSArray *files = [[info draggingPasteboard] propertyListForType:NSFilenamesPboardType]; NSArray *files = [[info draggingPasteboard] propertyListForType:NSFilenamesPboardType];
[self insertPaths:files atIndex:row sort:YES]; [self insertPaths:files atIndex:row sort:YES];
DBLog(@"FILES ADDED");
[self updateIndexesFromRow:row]; [self updateIndexesFromRow:row];
DBLog(@"UPDATED THINGS");
if (shuffle == YES) if (shuffle == YES)
[self generateShuffleList]; [self generateShuffleList];
DBLog(@"ALL DONE");
return YES; return YES;
} }

View File

@ -225,8 +225,6 @@
if (tag) if (tag)
{ {
DBLog(@"TAG: %i", tag);
char *pArtist, *pTitle, *pAlbum, *pGenre, *pComment; char *pArtist, *pTitle, *pAlbum, *pGenre, *pComment;
pArtist = taglib_tag_artist(tag); pArtist = taglib_tag_artist(tag);

25
Sound.m
View File

@ -59,8 +59,8 @@ static OSStatus Sound_ACInputProc(AudioConverterRef inAudioConverter, UInt32* io
Sound *sound = (Sound *)inUserData; Sound *sound = (Sound *)inUserData;
OSStatus err = noErr; OSStatus err = noErr;
DBLog(@"Convert input proc"); // DBLog(@"Convert input proc");
DBLog(@"Numpackets: %i %i", *ioNumberDataPackets, ioData->mNumberBuffers); // DBLog(@"Numpackets: %i %i", *ioNumberDataPackets, ioData->mNumberBuffers);
int amountToWrite; int amountToWrite;
int amountWritten; int amountWritten;
@ -70,7 +70,7 @@ static OSStatus Sound_ACInputProc(AudioConverterRef inAudioConverter, UInt32* io
sourceBuf = malloc(amountToWrite); sourceBuf = malloc(amountToWrite);
sound->conversionBuffer = sourceBuf; sound->conversionBuffer = sourceBuf;
DBLog(@"Requesting: %i", amountToWrite); // DBLog(@"Requesting: %i", amountToWrite);
amountWritten = [sound->soundFile fillBuffer:sourceBuf ofSize:amountToWrite]; amountWritten = [sound->soundFile fillBuffer:sourceBuf ofSize:amountToWrite];
// DBLog(@"PACKET NUMBER RECEIVED: %i", *ioNumberDataPackets); // DBLog(@"PACKET NUMBER RECEIVED: %i", *ioNumberDataPackets);
@ -79,7 +79,7 @@ static OSStatus Sound_ACInputProc(AudioConverterRef inAudioConverter, UInt32* io
ioData->mBuffers[0].mNumberChannels = sound->sourceStreamFormat.mChannelsPerFrame; ioData->mBuffers[0].mNumberChannels = sound->sourceStreamFormat.mChannelsPerFrame;
ioData->mNumberBuffers = 1; ioData->mNumberBuffers = 1;
DBLog(@"Input complete"); // DBLog(@"Input complete");
return err; return err;
} }
@ -144,7 +144,6 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
- (id)init - (id)init
{ {
DBLog(@"HEllo");
self = [super init]; self = [super init];
if (self) if (self)
{ {
@ -233,8 +232,6 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
[portMessage setMsgid:msgid]; [portMessage setMsgid:msgid];
DBLog(@"Sending message (nodata): %i", msgid);
[portMessage sendBeforeDate:date]; [portMessage sendBeforeDate:date];
[date release]; [date release];
@ -257,7 +254,6 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
NSDate *date = [[NSDate alloc] initWithTimeIntervalSinceNow:20.0];//give shit a little time to send, just in case...may come back to bite me NSDate *date = [[NSDate alloc] initWithTimeIntervalSinceNow:20.0];//give shit a little time to send, just in case...may come back to bite me
[portMessage setMsgid:msgid]; [portMessage setMsgid:msgid];
DBLog(@"Sending message: %i", msgid);
NS_DURING NS_DURING
[portMessage sendBeforeDate:date]; [portMessage sendBeforeDate:date];
@ -335,7 +331,6 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
newTime = [soundFile seekToTime:time]; newTime = [soundFile seekToTime:time];
if (newTime >= 0.0) if (newTime >= 0.0)
{ {
DBLog(@"RESETTING");
[self resetBuffer]; [self resetBuffer];
pos = [self calculatePos:newTime]; pos = [self calculatePos:newTime];
@ -637,9 +632,8 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
- (void)setPlaybackStatus:(int)s - (void)setPlaybackStatus:(int)s
{ {
playbackStatus = s; playbackStatus = s;
DBLog(@"SENDING MESSAGE");
[self sendPortMessage:kCogStatusUpdateMessage withData:&s ofSize:(sizeof(int))]; [self sendPortMessage:kCogStatusUpdateMessage withData:&s ofSize:(sizeof(int))];
DBLog(@"MESSAGE SENT");
} }
- (void)pause - (void)pause
@ -663,7 +657,6 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
- (void)stop - (void)stop
{ {
DBLog(@"STOPPING 2");
[self stopAudioOutput]; [self stopAudioOutput];
DBLog(@"Audio output stopped"); DBLog(@"Audio output stopped");
[self resetBuffer]; [self resetBuffer];
@ -673,16 +666,12 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
// DBLog(@"HERE? PORT CONFLICT...FUCK"); // DBLog(@"HERE? PORT CONFLICT...FUCK");
unsigned long pos = 0; unsigned long pos = 0;
DBLog(@"STOPPED 0");
[self sendPortMessage:kCogPositionUpdateMessage withData:&pos ofSize:(sizeof(unsigned long))]; [self sendPortMessage:kCogPositionUpdateMessage withData:&pos ofSize:(sizeof(unsigned long))];
// DBLog(@"THIS IS UBER SHITE: %@", positionTimer); // DBLog(@"THIS IS UBER SHITE: %@", positionTimer);
DBLog(@"STOPPED 1");
[self stopPositionTimer]; [self stopPositionTimer];
// DBLog(@"INVALIDATED"); // DBLog(@"INVALIDATED");
DBLog(@"STOPPED 2");
} }
- (void)playFile:(NSString *)filename - (void)playFile:(NSString *)filename
@ -767,7 +756,7 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
- (void)setVolume:(float)v - (void)setVolume:(float)v
{ {
DBLog(@"Setting volume to: %f", v); // DBLog(@"Setting volume to: %f", v);
//Get the current stream format of the output //Get the current stream format of the output
OSStatus err = AudioUnitSetParameter (outputUnit, OSStatus err = AudioUnitSetParameter (outputUnit,
kHALOutputParam_Volume, kHALOutputParam_Volume,
@ -775,8 +764,6 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
0, 0,
v * 0.01f, v * 0.01f,
0); 0);
DBLog(@"Error: %lu", err);
} }

View File

@ -203,8 +203,6 @@
DBLog(@"NIL ALT"); DBLog(@"NIL ALT");
} }
DBLog(@"Setting button: %@", name);
[playButton setImage:img]; [playButton setImage:img];
[playButton setAlternateImage:alt]; [playButton setAlternateImage:alt];
} }
@ -238,7 +236,6 @@
{ {
unsigned int message = [portMessage msgid]; unsigned int message = [portMessage msgid];
DBLog(@"GOT SOME KINDA WONDERFUL: %i %i", message, kCogStatusUpdateMessage);
if (message == kCogCheckinMessage) if (message == kCogCheckinMessage)
{ {
@ -329,7 +326,6 @@
} }
else if (message == kCogStatusUpdateMessage) else if (message == kCogStatusUpdateMessage)
{ {
DBLog(@"MESSAGE?");
NSArray* components = [portMessage components]; NSArray* components = [portMessage components];
NSData *data = [components objectAtIndex:0]; NSData *data = [components objectAtIndex:0];
@ -343,13 +339,11 @@
{ {
//Show play image //Show play image
[self changePlayButtonImage:@"play"]; [self changePlayButtonImage:@"play"];
DBLog(@"PLAY PIC");
} }
else if (s == kCogStatusPlaying) else if (s == kCogStatusPlaying)
{ {
//Show pause //Show pause
[self changePlayButtonImage:@"pause"]; [self changePlayButtonImage:@"pause"];
DBLog(@"PAUSE PIC");
} }
} }
} }

View File

@ -34,10 +34,7 @@
NeAACDecSetConfiguration(hAac, conf); NeAACDecSetConfiguration(hAac, conf);
get_AAC_format(inFd, &info, &seekTable, &seekTableLength, 1); get_AAC_format(inFd, &info, &seekTable, &seekTableLength, 1);
DBLog(@"INFO TIME");
DBLog(@"---------");
DBLog(@"%i %i %i %i %i", info.bitrate, info.channels, info.length, info.sampling_rate, info.version);
DBLog(@"");
fseek(inFd, 0, SEEK_SET); fseek(inFd, 0, SEEK_SET);
inputAmount = fread(inputBuffer, 1, INPUT_BUFFER_SIZE, inFd); inputAmount = fread(inputBuffer, 1, INPUT_BUFFER_SIZE, inFd);
@ -158,7 +155,7 @@
second = (int)(milliseconds/1000.0); second = (int)(milliseconds/1000.0);
i = (int)(((float)second/length)*seekTableLength); i = (int)(((float)second/length)*seekTableLength);
DBLog(@"SEEKING TO: %i %i", seekTable, seekTableLength);
pos = seekTable[i]; pos = seekTable[i];
fseek(inFd, pos, SEEK_SET); fseek(inFd, pos, SEEK_SET);

View File

@ -28,7 +28,7 @@
channels = decompress->GetInfo(APE_INFO_CHANNELS); channels = decompress->GetInfo(APE_INFO_CHANNELS);
totalSize = decompress->GetInfo(APE_INFO_TOTAL_BLOCKS)*bitsPerSample/8*channels; totalSize = decompress->GetInfo(APE_INFO_TOTAL_BLOCKS)*bitsPerSample/8*channels;
DBLog(@"APE OPENED: %i %i %i %i", frequency, bitsPerSample, channels, totalSize);
return YES; return YES;
} }

View File

@ -50,7 +50,6 @@
totalSize = (((double)(length)*frequency)/1000.0) * channels * (bitsPerSample/8); totalSize = (((double)(length)*frequency)/1000.0) * channels * (bitsPerSample/8);
bitRate = (int)((double)totalSize/((double)length/1000.0)); bitRate = (int)((double)totalSize/((double)length/1000.0));
DBLog(@"Bitrate; %i", bitRate);
return YES; return YES;
} }

View File

@ -66,8 +66,6 @@
{ {
SoundFile *soundFile; SoundFile *soundFile;
DBLog(@"FILENAME: %@", [filename pathExtension]);
if (([[filename pathExtension] caseInsensitiveCompare:@"wav"] == NSOrderedSame) || ([[filename pathExtension] caseInsensitiveCompare:@"aiff"] == NSOrderedSame) || ([[filename pathExtension] caseInsensitiveCompare:@"aif"] == NSOrderedSame)) if (([[filename pathExtension] caseInsensitiveCompare:@"wav"] == NSOrderedSame) || ([[filename pathExtension] caseInsensitiveCompare:@"aiff"] == NSOrderedSame) || ([[filename pathExtension] caseInsensitiveCompare:@"aif"] == NSOrderedSame))
{ {
soundFile = [[WaveFile alloc] init]; soundFile = [[WaveFile alloc] init];

View File

@ -69,7 +69,7 @@
{ {
int sample; int sample;
sample = (frequency/2)*(milliseconds/1000.0); sample = (frequency/2)*(milliseconds/1000.0);
DBLog(@"%lf %i", milliseconds, sample);
WavpackSeekSample(wpc, sample); WavpackSeekSample(wpc, sample);
return milliseconds; return milliseconds;

2
main.m
View File

@ -10,5 +10,7 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
srandom(time(NULL));
return NSApplicationMain(argc, (const char **) argv); return NSApplicationMain(argc, (const char **) argv);
} }