diff --git a/Cog.xcodeproj/project.pbxproj b/Cog.xcodeproj/project.pbxproj index 1a8a1d6b4..6157075a7 100644 --- a/Cog.xcodeproj/project.pbxproj +++ b/Cog.xcodeproj/project.pbxproj @@ -123,7 +123,6 @@ 8EE90D3908830662002238C8 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8EE90D3708830662002238C8 /* Localizable.strings */; }; 8EEBB7130977DF6800D5D854 /* PlaybackController.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8EEBB7110977DF6800D5D854 /* PlaybackController.h */; }; 8EEBB7140977DF6800D5D854 /* PlaybackController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EEBB7120977DF6800D5D854 /* PlaybackController.m */; }; - 8EECB4510979945E005080E6 /* Status.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8EECB4500979945E005080E6 /* Status.h */; }; 8EF7BCF10874708F0012C2F4 /* volume_high.png in Resources */ = {isa = PBXBuildFile; fileRef = 8EF7BCEF0874708F0012C2F4 /* volume_high.png */; }; 8EF7BCF20874708F0012C2F4 /* volume_low.png in Resources */ = {isa = PBXBuildFile; fileRef = 8EF7BCF00874708F0012C2F4 /* volume_low.png */; }; /* End PBXBuildFile section */ @@ -220,7 +219,6 @@ 8EB090C70976955800DB1521 /* WavPackFile.h in CopyFiles */, 8EEBB7130977DF6800D5D854 /* PlaybackController.h in CopyFiles */, 8E888D5809795247007E984F /* Shuffle.h in CopyFiles */, - 8EECB4510979945E005080E6 /* Status.h in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -353,7 +351,6 @@ 8EE90D3808830662002238C8 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = ""; }; 8EEBB7110977DF6800D5D854 /* PlaybackController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PlaybackController.h; sourceTree = ""; }; 8EEBB7120977DF6800D5D854 /* PlaybackController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PlaybackController.m; sourceTree = ""; }; - 8EECB4500979945E005080E6 /* Status.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Status.h; sourceTree = ""; }; 8EF7BCEF0874708F0012C2F4 /* volume_high.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = volume_high.png; path = Icons/volume_high.png; sourceTree = ""; }; 8EF7BCF00874708F0012C2F4 /* volume_low.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = volume_low.png; path = Icons/volume_low.png; sourceTree = ""; }; /* End PBXFileReference section */ @@ -602,7 +599,6 @@ 8EB090750976953C00DB1521 /* Semaphore.m */, 8EB090760976953C00DB1521 /* VirtualRingBuffer.h */, 8EB090770976953C00DB1521 /* VirtualRingBuffer.m */, - 8EECB4500979945E005080E6 /* Status.h */, ); name = Utils; sourceTree = ""; diff --git a/Libraries/DecMPA/DecMPA.xcodeproj/project.pbxproj b/Libraries/DecMPA/DecMPA.xcodeproj/project.pbxproj index 65989fe0c..b4b715ecb 100644 --- a/Libraries/DecMPA/DecMPA.xcodeproj/project.pbxproj +++ b/Libraries/DecMPA/DecMPA.xcodeproj/project.pbxproj @@ -426,6 +426,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; PRODUCT_NAME = DecMPA; WRAPPER_EXTENSION = framework; ZERO_LINK = YES; @@ -446,6 +447,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; PRODUCT_NAME = DecMPA; WRAPPER_EXTENSION = framework; ZERO_LINK = NO; @@ -464,6 +466,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; PRODUCT_NAME = DecMPA; WRAPPER_EXTENSION = framework; }; diff --git a/Libraries/FAAD2/FAAD2.xcodeproj/project.pbxproj b/Libraries/FAAD2/FAAD2.xcodeproj/project.pbxproj index 0bc00de56..015d368ed 100644 --- a/Libraries/FAAD2/FAAD2.xcodeproj/project.pbxproj +++ b/Libraries/FAAD2/FAAD2.xcodeproj/project.pbxproj @@ -754,6 +754,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = "-DHAVE_CONFIG_H"; PRODUCT_NAME = FAAD2; WRAPPER_EXTENSION = framework; @@ -780,6 +781,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = "-DHAVE_CONFIG_H"; PRODUCT_NAME = FAAD2; WRAPPER_EXTENSION = framework; @@ -804,6 +806,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = "-DHAVE_CONFIG_H"; PRODUCT_NAME = FAAD2; WRAPPER_EXTENSION = framework; diff --git a/Libraries/FLAC/FLAC.xcodeproj/project.pbxproj b/Libraries/FLAC/FLAC.xcodeproj/project.pbxproj index d4d7dd54d..b760a3246 100644 --- a/Libraries/FLAC/FLAC.xcodeproj/project.pbxproj +++ b/Libraries/FLAC/FLAC.xcodeproj/project.pbxproj @@ -479,6 +479,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = ( "-DHAVE_INTTYPES_H", "-DFLAC__ALIGN_MALLOC_DATA", @@ -510,6 +511,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = ( "-DHAVE_INTTYPES_H", "-DFLAC__ALIGN_MALLOC_DATA", @@ -539,6 +541,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = ( "-DVERSION=1.1.2", "-DHAVE_INTTYPES_H", diff --git a/Libraries/MAC/MAC.xcodeproj/project.pbxproj b/Libraries/MAC/MAC.xcodeproj/project.pbxproj index fc7704443..807ca661b 100644 --- a/Libraries/MAC/MAC.xcodeproj/project.pbxproj +++ b/Libraries/MAC/MAC.xcodeproj/project.pbxproj @@ -505,6 +505,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = ( "-maltivec", "-faltivec", @@ -535,6 +536,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = ( "-maltivec", "-faltivec", @@ -562,6 +564,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = ( "-maltivec", "-faltivec", diff --git a/Libraries/MPCDec/MPCDec.xcodeproj/project.pbxproj b/Libraries/MPCDec/MPCDec.xcodeproj/project.pbxproj index 37f09fe19..6bef1060e 100644 --- a/Libraries/MPCDec/MPCDec.xcodeproj/project.pbxproj +++ b/Libraries/MPCDec/MPCDec.xcodeproj/project.pbxproj @@ -326,6 +326,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; PRODUCT_NAME = MPCDec; WRAPPER_EXTENSION = framework; ZERO_LINK = YES; @@ -348,6 +349,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; PRODUCT_NAME = MPCDec; WRAPPER_EXTENSION = framework; ZERO_LINK = NO; @@ -368,6 +370,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; PRODUCT_NAME = MPCDec; WRAPPER_EXTENSION = framework; }; diff --git a/Libraries/Ogg/Ogg.xcodeproj/project.pbxproj b/Libraries/Ogg/Ogg.xcodeproj/project.pbxproj index 6d5bcaa53..d2e87464c 100644 --- a/Libraries/Ogg/Ogg.xcodeproj/project.pbxproj +++ b/Libraries/Ogg/Ogg.xcodeproj/project.pbxproj @@ -270,6 +270,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = "-D__MACOSX__"; PRODUCT_NAME = Ogg; WRAPPER_EXTENSION = framework; @@ -291,6 +292,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = "-D__MACOSX__"; PRODUCT_NAME = Ogg; WRAPPER_EXTENSION = framework; @@ -310,6 +312,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = "-D__MACOSX__"; PRODUCT_NAME = Ogg; WRAPPER_EXTENSION = framework; diff --git a/Libraries/Shorten/Shorten.xcodeproj/project.pbxproj b/Libraries/Shorten/Shorten.xcodeproj/project.pbxproj index 81850adb4..608638873 100644 --- a/Libraries/Shorten/Shorten.xcodeproj/project.pbxproj +++ b/Libraries/Shorten/Shorten.xcodeproj/project.pbxproj @@ -320,6 +320,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = "-DHAVE_CONFIG_H"; PRODUCT_NAME = Shorten; WRAPPER_EXTENSION = framework; @@ -342,6 +343,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = "-DHAVE_CONFIG_H"; PRODUCT_NAME = Shorten; WRAPPER_EXTENSION = framework; @@ -362,6 +364,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = "-DHAVE_CONFIG_H"; PRODUCT_NAME = Shorten; WRAPPER_EXTENSION = framework; diff --git a/Libraries/SndFile/SndFile.xcodeproj/project.pbxproj b/Libraries/SndFile/SndFile.xcodeproj/project.pbxproj index d611fc59a..ff92453e5 100644 --- a/Libraries/SndFile/SndFile.xcodeproj/project.pbxproj +++ b/Libraries/SndFile/SndFile.xcodeproj/project.pbxproj @@ -565,6 +565,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; PRODUCT_NAME = SndFile; WRAPPER_EXTENSION = framework; ZERO_LINK = YES; @@ -585,6 +586,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; PRODUCT_NAME = SndFile; WRAPPER_EXTENSION = framework; ZERO_LINK = NO; @@ -603,6 +605,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; PRODUCT_NAME = SndFile; WRAPPER_EXTENSION = framework; }; diff --git a/Libraries/TagLib/TagLib.xcodeproj/project.pbxproj b/Libraries/TagLib/TagLib.xcodeproj/project.pbxproj index 95662a0f5..12a5305b6 100644 --- a/Libraries/TagLib/TagLib.xcodeproj/project.pbxproj +++ b/Libraries/TagLib/TagLib.xcodeproj/project.pbxproj @@ -728,6 +728,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; PRODUCT_NAME = TagLib; WRAPPER_EXTENSION = framework; ZERO_LINK = YES; @@ -748,6 +749,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; PRODUCT_NAME = TagLib; WRAPPER_EXTENSION = framework; ZERO_LINK = NO; @@ -766,6 +768,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; PRODUCT_NAME = TagLib; WRAPPER_EXTENSION = framework; }; diff --git a/Libraries/Vorbis/Vorbis.xcodeproj/project.pbxproj b/Libraries/Vorbis/Vorbis.xcodeproj/project.pbxproj index af7030731..d75b4a75a 100644 --- a/Libraries/Vorbis/Vorbis.xcodeproj/project.pbxproj +++ b/Libraries/Vorbis/Vorbis.xcodeproj/project.pbxproj @@ -576,6 +576,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = "-D__MACOSX__"; PRODUCT_NAME = Vorbis; WRAPPER_EXTENSION = framework; @@ -603,6 +604,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = "-D__MACOSX__"; PRODUCT_NAME = Vorbis; WRAPPER_EXTENSION = framework; @@ -628,6 +630,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = "-D__MACOSX__"; PRODUCT_NAME = Vorbis; WRAPPER_EXTENSION = framework; diff --git a/Libraries/WavPack/WavPack.xcodeproj/project.pbxproj b/Libraries/WavPack/WavPack.xcodeproj/project.pbxproj index c84984267..7e3fa56ed 100644 --- a/Libraries/WavPack/WavPack.xcodeproj/project.pbxproj +++ b/Libraries/WavPack/WavPack.xcodeproj/project.pbxproj @@ -335,6 +335,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = ( "-DPACK", "-DUNPACK", @@ -369,6 +370,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = ( "-DPACK", "-DUNPACK", @@ -401,6 +403,7 @@ INFOPLIST_FILE = Info.plist; INSTALL_PATH = "@executable_path/../Frameworks"; LIBRARY_STYLE = DYNAMIC; + MACH_O_TYPE = mh_dylib; OTHER_CFLAGS = ( "-DPACK", "-DUNPACK", diff --git a/PlaybackController.h b/PlaybackController.h new file mode 100644 index 000000000..dcac5c3c0 --- /dev/null +++ b/PlaybackController.h @@ -0,0 +1,60 @@ +/* SoundController */ + +#import + +#import "SoundController.h" +#import "PlaylistController.h" +#import "TrackingSlider.h" + +@class PlaylistView; + +@interface PlaybackController : NSObject +{ + IBOutlet PlaylistController *playlistController; + IBOutlet PlaylistView *playlistView; + + IBOutlet TrackingSlider *positionSlider; + IBOutlet NSTextField *timeField; + IBOutlet NSTextField *lengthField; + IBOutlet NSTextField *bitrateField; + + IBOutlet NSButton *playButton; + + BOOL waitingForPlay; //No sneaky changing on us + SoundController *soundController; + + int playbackStatus; + + BOOL showTimeRemaining; + } + +- (IBAction)toggleShowTimeRemaining:(id)sender; +- (IBAction)changeVolume:(id)sender; + +- (IBAction)playPauseResume:(id)sender; +- (IBAction)pauseResume:(id)sender; + +- (IBAction)play:(id)sender; +- (IBAction)pause:(id)sender; +- (IBAction)resume:(id)sender; +- (IBAction)stop:(id)sender; + +- (IBAction)next:(id)sender; +- (IBAction)prev:(id)sender; +- (IBAction)seek:(id)sender; + + +- (void)updateTimeField:(double)pos; + +- (void)playEntryAtIndex:(int)i; +- (void)playEntry:(PlaylistEntry *)pe; + + +//Methods since this is SoundController's delegate +- (void)delegateNotifyStatusUpdate:(int)status; +- (void)delegateNotifyPositionUpdate:(double)pos; +- (void)delegateNotifyBitrateUpdate:(float)bitrate; +- (void)delegateNotifySongChanged:(double)length; +- (void)delegateRequestNextSong:(int)queueSize; + +@end diff --git a/PlaybackController.m b/PlaybackController.m new file mode 100644 index 000000000..ccc71eaf2 --- /dev/null +++ b/PlaybackController.m @@ -0,0 +1,223 @@ +#import "PlaybackController.h" +#import "PlaylistView.h" + +#import "DBLog.h" +#import "Status.h" + +@implementation PlaybackController + +- (id)init +{ + self = [super init]; + if (self) + { + soundController = [[SoundController alloc] initWithDelegate:self]; + playbackStatus = kCogStatusStopped; + + showTimeRemaining = NO; + } + + return self; +} + +- (void)awakeFromNib +{ + +} + + +- (IBAction)playPauseResume:(id)sender +{ + NSLog(@"PLAYING"); + if (playbackStatus == kCogStatusStopped) + [self play:self]; + else + [self pauseResume:self]; +} + +- (IBAction)pauseResume:(id)sender +{ +// DBLog(@"Pause/Resume Sent!"); + if (playbackStatus == kCogStatusPaused) + [self resume:self]; + else + [self pause:self]; +} + +- (IBAction)pause:(id)sender +{ +// DBLog(@"Pause Sent!"); + [soundController pause]; +} + +- (IBAction)resume:(id)sender +{ +// DBLog(@"Resume Sent!"); + [soundController resume]; +} + +- (IBAction)stop:(id)sender +{ +// DBLog(@"Stop Sent!"); + + [soundController stop]; +} + +//called by double-clicking on table +- (void)playEntryAtIndex:(int)i +{ + PlaylistEntry *pe = [[playlistController arrangedObjects] objectAtIndex:i]; + + [playlistController setCurrentEntry:pe]; + + [self playEntry:pe]; +} + +- (IBAction)play:(id)sender +{ + if ([playlistView selectedRow] == -1) + [playlistView selectRow:0 byExtendingSelection:NO]; + + [self playEntryAtIndex:[playlistView selectedRow]]; +} + +- (void)playEntry:(PlaylistEntry *)pe; +{ +// DBLog(@"PlayEntry: %@ Sent!", [pe filename]); + + [soundController play:[pe filename]]; +} + +- (IBAction)next:(id)sender +{ + if ([playlistController next] == nil) + return; + + [self playEntry:[playlistController currentEntry]]; +} + +- (IBAction)prev:(id)sender +{ + if ([playlistController prev] == nil) + return; + + [self playEntry:[playlistController currentEntry]]; +} + +- (IBAction)seek:(id)sender +{ +// DBLog(@"SEEKING?"); + double time; + time = [positionSlider doubleValue]; + + if ([sender tracking] == NO) // check if user stopped sliding before playing audio + [soundController seekToTime:time]; + + [self updateTimeField:time]; +} + +- (void)changePlayButtonImage:(NSString *)name +{ + NSImage *img = [NSImage imageNamed:[name stringByAppendingString:@"_gray"]]; + NSImage *alt = [NSImage imageNamed:[name stringByAppendingString:@"_blue"]]; + [img retain]; + [alt retain]; + if (img == nil) + { + DBLog(@"NIL IMAGE!!!"); + } + if (alt == nil) + { + DBLog(@"NIL ALT"); + } + + [playButton setImage:img]; + [playButton setAlternateImage:alt]; +} + +- (IBAction)changeVolume:(id)sender +{ + float v = (float)[sender doubleValue]; + [soundController setVolume:v]; +} + + +- (void)updateTimeField:(double)pos +{ + NSString *text; + if (showTimeRemaining == NO) + { + int sec = (int)(pos/1000.0); + text = [NSString stringWithFormat:NSLocalizedString(@"TimeElapsed", @""), sec/60, sec%60]; + } + else + { + int sec = (int)(([positionSlider maxValue] - pos)/1000.0); + text = [NSString stringWithFormat:NSLocalizedString(@"TimeRemaining", @""), sec/60, sec%60]; + } + [timeField setStringValue:text]; +} + +- (IBAction)toggleShowTimeRemaining:(id)sender +{ + showTimeRemaining = !showTimeRemaining; + + [self updateTimeField:[positionSlider doubleValue]]; +} + +- (void)delegateRequestNextSong:(int)queueSize +{ + PlaylistEntry *pe; + + pe = [playlistController entryAtOffset:(queueSize+1)]; + + if (pe == nil) + [soundController setNextSong:nil]; + else + [soundController setNextSong:[pe filename]]; +} + +- (void)delegateNotifySongChanged:(double)length +{ + [playlistController next]; + +// [positionSlider setMaxValue:length]; +// [positionSlider setDoubleValue:0]; + +// [self updateTimeField:0.0f]; + +} + +- (void)delegateNotifyBitrateUpdate:(float)bitrate +{ + // [bitrateField setIntValue:bitrate]; +} + +- (void)delegateNotifyPositionUpdate:(double)pos +{ + if ([positionSlider tracking] == NO) + { + // DBLog(@"Received pos update: %f", pos); + [positionSlider setDoubleValue:pos]; + [self updateTimeField:pos]; + } + +} + +- (void)delegateNotifyStatusUpdate:(int)status +{ + if (status == kCogStatusStopped || status == kCogStatusPaused) + { + //Show play image + [self changePlayButtonImage:@"play"]; + } + else if (status == kCogStatusPlaying) + { + //Show pause + [self changePlayButtonImage:@"pause"]; + } + + playbackStatus = status; +} + +@end