Changeset 569 for trunk/Cocoa/Pester
- Timestamp:
- 07/20/09 06:03:15 (15 years ago)
- Location:
- trunk/Cocoa/Pester
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/Pester/Source/PSMovieAlertController.h
r554 r569 17 17 PSMovieAlert *alert; 18 18 IBOutlet QTMovieView *movieView; 19 void *theMovie; /* Movie */20 19 unsigned short repetitions; 21 20 unsigned short repetitionsRemaining; -
trunk/Cocoa/Pester/Source/PSMovieAlertController.m
r554 r569 12 12 #import "QTMovie-NJRExtensions.h" 13 13 #import "NJRSoundManager.h" 14 #import <QuickTime/Movies.h>15 14 16 15 @implementation PSMovieAlertController … … 28 27 } 29 28 29 - (void)_movieRateDidChange:(NSNotification *)notification; 30 { 31 float newRate = [[[notification userInfo] objectForKey: QTMovieRateDidChangeNotificationParameter] 32 floatValue]; 33 if (newRate != 0) 34 return; 35 36 if (repetitions == 0 || repetitionsRemaining == 0) { 37 [[NSNotificationCenter defaultCenter] removeObserver: self 38 name: QTMovieRateDidChangeNotification 39 object: [movieView movie]]; 40 41 [self close]; 42 return; 43 } 44 repetitionsRemaining--; 45 [movieView gotoBeginning: self]; 46 [movieView play: self]; 47 } 48 30 49 - (void)play; 31 50 { 32 NSTimeInterval delay; 33 if (repetitions == 0) return; 34 if (IsMovieDone((Movie)theMovie) || repetitionsRemaining == repetitions) { 35 if (repetitionsRemaining == 0) { 36 [self close]; 37 return; 38 } 39 repetitionsRemaining--; 40 [movieView gotoBeginning: self]; 41 [movieView play: self]; 42 } 43 delay = (GetMovieDuration((Movie)theMovie) - GetMovieTime((Movie)theMovie, NULL)) / (double)GetMovieTimeScale((Movie)theMovie); 44 // XXX should use a timebase callback for this instead (see NJRQTMediaPopUpButton); also, use QuickTimeÕs built-in loop functionality instead of rolling our own? 45 [self performSelector: @selector(play) withObject: nil afterDelay: delay inModes: [NSArray arrayWithObject: NSDefaultRunLoopMode]]; 51 repetitionsRemaining = repetitions - 1; 52 53 [[NSNotificationCenter defaultCenter] addObserver: self 54 selector: @selector(_movieRateDidChange:) 55 name: QTMovieRateDidChangeNotification 56 object: [movieView movie]]; 57 [movieView play: self]; 46 58 } 47 59 … … 53 65 alarm = anAlarm; 54 66 alert = anAlert; 55 theMovie = [movie quickTimeMovie];56 67 [movieView setMovie: movie]; 57 68 if ([alert hasVideo]) { … … 89 100 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(close) name: PSAlarmAlertStopNotification object: nil]; 90 101 repetitions = [alert repetitions]; 91 repetitionsRemaining = repetitions;92 102 if ([movie NJR_hasAudio] && [NJRSoundManager volumeIsNotMutedOrInvalid: [alert outputVolume]] && [NJRSoundManager saveDefaultOutputVolume]) { 93 103 [NJRSoundManager setDefaultOutputVolume: [alert outputVolume]]; -
trunk/Cocoa/Pester/Source/Pester.xcodeproj/project.pbxproj
r553 r569 105 105 E1B11F7F0CF5F30F004975AA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; 106 106 E1B11F800CF5F30F004975AA /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5F240D0036A87E301FE7503 /* Carbon.framework */; }; 107 E1B11F820CF5F30F004975AA /* QuickTime.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F59E4BEA036B33EC016B311C /* QuickTime.framework */; };108 107 E1B11F830CF5F30F004975AA /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E14DB31203B8038300000028 /* IOKit.framework */; }; 109 108 E1B11F840CF5F30F004975AA /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E18DAAEE0442D02500050002 /* CoreAudio.framework */; }; … … 302 301 F59E4BE6036B2E5E016B311C /* PSScriptAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PSScriptAlert.m; sourceTree = "<group>"; }; 303 302 F59E4BE7036B2E5E016B311C /* PSScriptAlert.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PSScriptAlert.h; sourceTree = "<group>"; }; 304 F59E4BEA036B33EC016B311C /* QuickTime.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickTime.framework; path = /System/Library/Frameworks/QuickTime.framework; sourceTree = "<absolute>"; };305 303 F59E4C0D036B43D2016B311C /* QTMovie-NJRExtensions.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = "QTMovie-NJRExtensions.m"; sourceTree = "<group>"; }; 306 304 F59E4C0E036B43D2016B311C /* QTMovie-NJRExtensions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = "QTMovie-NJRExtensions.h"; sourceTree = "<group>"; }; … … 353 351 E1B11F7F0CF5F30F004975AA /* Cocoa.framework in Frameworks */, 354 352 E1B11F800CF5F30F004975AA /* Carbon.framework in Frameworks */, 355 E1B11F820CF5F30F004975AA /* QuickTime.framework in Frameworks */,356 353 E1B11F830CF5F30F004975AA /* IOKit.framework in Frameworks */, 357 354 E1B11F840CF5F30F004975AA /* CoreAudio.framework in Frameworks */, … … 387 384 E18DAAEE0442D02500050002 /* CoreAudio.framework */, 388 385 E1B121B30CF639A1004975AA /* QTKit.framework */, 389 F59E4BEA036B33EC016B311C /* QuickTime.framework */,390 386 E14DB31203B8038300000028 /* IOKit.framework */, 391 387 );
Note:
See TracChangeset
for help on using the changeset viewer.