Fixed fadeout code so it sounds a bit better (timer fires faster, steady drop in volume rather than incremental)
parent
a5986373bd
commit
5228709d0f
|
@ -292,7 +292,6 @@ double linearToLogarithmic(double linear)
|
||||||
containing the current volume before we start fading. */
|
containing the current volume before we start fading. */
|
||||||
- (void)audioFader:(NSTimer *)audioTimer
|
- (void)audioFader:(NSTimer *)audioTimer
|
||||||
{
|
{
|
||||||
static int incrementalFader = 10;
|
|
||||||
double volume = [audioPlayer volume];
|
double volume = [audioPlayer volume];
|
||||||
double originalVolume = [[audioTimer userInfo] doubleValue];
|
double originalVolume = [[audioTimer userInfo] doubleValue];
|
||||||
|
|
||||||
|
@ -300,14 +299,13 @@ double linearToLogarithmic(double linear)
|
||||||
|
|
||||||
if (volume > 0.0001) //YAY! Roundoff error!
|
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
|
else // volume is at 0 or below, we are ready to release the timer and move on
|
||||||
{
|
{
|
||||||
[audioPlayer pause];
|
[audioPlayer pause];
|
||||||
[audioPlayer setVolume:originalVolume];
|
[audioPlayer setVolume:originalVolume];
|
||||||
[volumeSlider setDoubleValue: logarithmicToLinear(originalVolume)];
|
[volumeSlider setDoubleValue: logarithmicToLinear(originalVolume)];
|
||||||
incrementalFader = 10;
|
|
||||||
[audioTimer invalidate];
|
[audioTimer invalidate];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,6 @@
|
||||||
[self play:url withUserInfo:nil];
|
[self play:url withUserInfo:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)play:(NSURL *)url withUserInfo:(id)userInfo
|
- (void)play:(NSURL *)url withUserInfo:(id)userInfo
|
||||||
{
|
{
|
||||||
if (output)
|
if (output)
|
||||||
|
|
|
@ -211,7 +211,7 @@
|
||||||
// shift+command+p - fade to pause
|
// shift+command+p - fade to pause
|
||||||
else if (modifiers == (NSCommandKeyMask | NSShiftKeyMask) && c == 0x70)
|
else if (modifiers == (NSCommandKeyMask | NSShiftKeyMask) && c == 0x70)
|
||||||
{
|
{
|
||||||
[playbackController fadeOut:self withTime:0.3];
|
[playbackController fadeOut:self withTime:0.1];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue