Fixed up timers so they are still in effect while in the tracking runloop mode.
parent
f9c9bfad18
commit
f24afa4c86
|
@ -325,20 +325,23 @@
|
||||||
NSNumber *originalVolume = [NSNumber numberWithDouble: [audioPlayer volume]];
|
NSNumber *originalVolume = [NSNumber numberWithDouble: [audioPlayer volume]];
|
||||||
NSTimer *fadeTimer;
|
NSTimer *fadeTimer;
|
||||||
|
|
||||||
if (playbackStatus == kCogStatusPlaying)
|
if (playbackStatus == kCogStatusPlaying) {
|
||||||
fadeTimer = [NSTimer scheduledTimerWithTimeInterval:time
|
fadeTimer = [NSTimer timerWithTimeInterval:time
|
||||||
target:self
|
target:self
|
||||||
selector:@selector(audioFadeDown:)
|
selector:@selector(audioFadeDown:)
|
||||||
userInfo:originalVolume
|
userInfo:originalVolume
|
||||||
repeats:YES];
|
repeats:YES];
|
||||||
|
[[NSRunLoop currentRunLoop] addTimer:fadeTimer forMode:NSRunLoopCommonModes];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[audioPlayer setVolume:0];
|
[audioPlayer setVolume:0];
|
||||||
fadeTimer = [NSTimer scheduledTimerWithTimeInterval:time
|
fadeTimer = [NSTimer timerWithTimeInterval:time
|
||||||
target:self
|
target:self
|
||||||
selector:@selector(audioFadeUp:)
|
selector:@selector(audioFadeUp:)
|
||||||
userInfo:originalVolume
|
userInfo:originalVolume
|
||||||
repeats:YES];
|
repeats:YES];
|
||||||
|
[[NSRunLoop currentRunLoop] addTimer:fadeTimer forMode:NSRunLoopCommonModes];
|
||||||
[self pauseResume:self];
|
[self pauseResume:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,8 +555,10 @@
|
||||||
}
|
}
|
||||||
else if (status == kCogStatusPlaying)
|
else if (status == kCogStatusPlaying)
|
||||||
{
|
{
|
||||||
if (!positionTimer)
|
if (!positionTimer) {
|
||||||
positionTimer = [NSTimer scheduledTimerWithTimeInterval:1.00 target:self selector:@selector(updatePosition:) userInfo:nil repeats:YES];
|
positionTimer = [NSTimer timerWithTimeInterval:1.00 target:self selector:@selector(updatePosition:) userInfo:nil repeats:YES];
|
||||||
|
[[NSRunLoop currentRunLoop] addTimer:positionTimer forMode:NSRunLoopCommonModes];
|
||||||
|
}
|
||||||
|
|
||||||
//Show pause
|
//Show pause
|
||||||
[self changePlayButtonImage:@"pause"];
|
[self changePlayButtonImage:@"pause"];
|
||||||
|
|
|
@ -284,12 +284,12 @@
|
||||||
mask = NSLeftMouseUpMask | NSLeftMouseDraggedMask |
|
mask = NSLeftMouseUpMask | NSLeftMouseDraggedMask |
|
||||||
NSRightMouseUpMask | NSRightMouseDraggedMask |
|
NSRightMouseUpMask | NSRightMouseDraggedMask |
|
||||||
NSAppKitDefinedMask | NSFlagsChangedMask |
|
NSAppKitDefinedMask | NSFlagsChangedMask |
|
||||||
NSScrollWheelMask;
|
NSScrollWheelMask | NSPeriodicMask;
|
||||||
|
|
||||||
while (keepOn)
|
while (keepOn)
|
||||||
{
|
{
|
||||||
theEvent = [self transmogrify:[self nextEventMatchingMask:mask]];
|
theEvent = [self transmogrify:[self nextEventMatchingMask:mask]];
|
||||||
|
NSLog(@"Event: %@", theEvent);
|
||||||
switch ([theEvent type])
|
switch ([theEvent type])
|
||||||
{
|
{
|
||||||
case NSMouseMoved:
|
case NSMouseMoved:
|
||||||
|
|
|
@ -103,7 +103,8 @@
|
||||||
|
|
||||||
if (closeTimer) { [closeTimer invalidate]; [closeTimer release]; }
|
if (closeTimer) { [closeTimer invalidate]; [closeTimer release]; }
|
||||||
|
|
||||||
closeTimer = [[NSTimer scheduledTimerWithTimeInterval:duration target:self selector:@selector(close) userInfo:nil repeats:NO] retain];
|
closeTimer = [[NSTimer timerWithTimeInterval:duration target:self selector:@selector(close) userInfo:nil repeats:NO] retain];
|
||||||
|
[[NSRunLoop currentRunLoop] addTimer:closeTimer forMode:NSRunLoopCommonModes];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)orderFront
|
- (void)orderFront
|
||||||
|
|
Loading…
Reference in New Issue