Fixed fadeout code so it sounds a bit better (timer fires faster, steady drop in volume rather than incremental)

CQTexperiment
areff 2008-02-16 15:28:39 +00:00
parent a5986373bd
commit 5228709d0f
3 changed files with 2 additions and 5 deletions

View File

@ -292,7 +292,6 @@ double linearToLogarithmic(double linear)
containing the current volume before we start fading. */
- (void)audioFader:(NSTimer *)audioTimer
{
static int incrementalFader = 10;
double volume = [audioPlayer volume];
double originalVolume = [[audioTimer userInfo] doubleValue];
@ -300,14 +299,13 @@ double linearToLogarithmic(double linear)
if (volume > 0.0001) //YAY! Roundoff error!
{
[self volumeDown:incrementalFader++];
[self volumeDown:5];
}
else // volume is at 0 or below, we are ready to release the timer and move on
{
[audioPlayer pause];
[audioPlayer setVolume:originalVolume];
[volumeSlider setDoubleValue: logarithmicToLinear(originalVolume)];
incrementalFader = 10;
[audioTimer invalidate];
}

View File

@ -44,7 +44,6 @@
[self play:url withUserInfo:nil];
}
- (void)play:(NSURL *)url withUserInfo:(id)userInfo
{
if (output)

View File

@ -211,7 +211,7 @@
// shift+command+p - fade to pause
else if (modifiers == (NSCommandKeyMask | NSShiftKeyMask) && c == 0x70)
{
[playbackController fadeOut:self withTime:0.3];
[playbackController fadeOut:self withTime:0.1];
}
else
{