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

View File

@ -1,10 +1,6 @@
0.04.c
0.05
----
Fixed autopositioning of the volume slider.
0.04.b
----
Fixed crash when dragging/dropping files to the playlist.
Dragging to the dock icon now works in 10.3.
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)
Now ignores case when dealing with file extensions.
Added volume slider.
Fixed autopositioning of the volume slider.
Fixed crash when dragging/dropping files to the playlist.
0.0.3
-----

View File

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

Binary file not shown.

View File

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

View File

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

View File

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

View File

@ -225,8 +225,6 @@
if (tag)
{
DBLog(@"TAG: %i", tag);
char *pArtist, *pTitle, *pAlbum, *pGenre, *pComment;
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;
OSStatus err = noErr;
DBLog(@"Convert input proc");
DBLog(@"Numpackets: %i %i", *ioNumberDataPackets, ioData->mNumberBuffers);
// DBLog(@"Convert input proc");
// DBLog(@"Numpackets: %i %i", *ioNumberDataPackets, ioData->mNumberBuffers);
int amountToWrite;
int amountWritten;
@ -70,7 +70,7 @@ static OSStatus Sound_ACInputProc(AudioConverterRef inAudioConverter, UInt32* io
sourceBuf = malloc(amountToWrite);
sound->conversionBuffer = sourceBuf;
DBLog(@"Requesting: %i", amountToWrite);
// DBLog(@"Requesting: %i", amountToWrite);
amountWritten = [sound->soundFile fillBuffer:sourceBuf ofSize:amountToWrite];
// 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->mNumberBuffers = 1;
DBLog(@"Input complete");
// DBLog(@"Input complete");
return err;
}
@ -144,7 +144,6 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
- (id)init
{
DBLog(@"HEllo");
self = [super init];
if (self)
{
@ -233,8 +232,6 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
[portMessage setMsgid:msgid];
DBLog(@"Sending message (nodata): %i", msgid);
[portMessage sendBeforeDate:date];
[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
[portMessage setMsgid:msgid];
DBLog(@"Sending message: %i", msgid);
NS_DURING
[portMessage sendBeforeDate:date];
@ -335,7 +331,6 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
newTime = [soundFile seekToTime:time];
if (newTime >= 0.0)
{
DBLog(@"RESETTING");
[self resetBuffer];
pos = [self calculatePos:newTime];
@ -637,9 +632,8 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
- (void)setPlaybackStatus:(int)s
{
playbackStatus = s;
DBLog(@"SENDING MESSAGE");
[self sendPortMessage:kCogStatusUpdateMessage withData:&s ofSize:(sizeof(int))];
DBLog(@"MESSAGE SENT");
}
- (void)pause
@ -663,7 +657,6 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
- (void)stop
{
DBLog(@"STOPPING 2");
[self stopAudioOutput];
DBLog(@"Audio output stopped");
[self resetBuffer];
@ -673,16 +666,12 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
// DBLog(@"HERE? PORT CONFLICT...FUCK");
unsigned long pos = 0;
DBLog(@"STOPPED 0");
[self sendPortMessage:kCogPositionUpdateMessage withData:&pos ofSize:(sizeof(unsigned long))];
// DBLog(@"THIS IS UBER SHITE: %@", positionTimer);
DBLog(@"STOPPED 1");
[self stopPositionTimer];
// DBLog(@"INVALIDATED");
DBLog(@"STOPPED 2");
}
- (void)playFile:(NSString *)filename
@ -767,7 +756,7 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
- (void)setVolume:(float)v
{
DBLog(@"Setting volume to: %f", v);
// DBLog(@"Setting volume to: %f", v);
//Get the current stream format of the output
OSStatus err = AudioUnitSetParameter (outputUnit,
kHALOutputParam_Volume,
@ -775,8 +764,6 @@ static OSStatus Sound_Renderer(void *inRefCon, AudioUnitRenderActionFlags *ioAc
0,
v * 0.01f,
0);
DBLog(@"Error: %lu", err);
}

View File

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

View File

@ -34,10 +34,7 @@
NeAACDecSetConfiguration(hAac, conf);
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);
inputAmount = fread(inputBuffer, 1, INPUT_BUFFER_SIZE, inFd);
@ -158,7 +155,7 @@
second = (int)(milliseconds/1000.0);
i = (int)(((float)second/length)*seekTableLength);
DBLog(@"SEEKING TO: %i %i", seekTable, seekTableLength);
pos = seekTable[i];
fseek(inFd, pos, SEEK_SET);

View File

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

View File

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

View File

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

View File

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

2
main.m
View File

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