1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-24 16:01:16 +02:00

Make microfades into a preference.

This commit is contained in:
James Crook 2018-11-02 21:36:05 +00:00
parent b07097df3a
commit 7f8bfa0ac2
3 changed files with 12 additions and 10 deletions

View File

@ -1758,6 +1758,7 @@ int AudioIO::StartStream(const TransportTracks &tracks,
gPrefs->Read(wxT("/AudioIO/SWPlaythrough"), &mSoftwarePlaythrough, false);
gPrefs->Read(wxT("/AudioIO/SoundActivatedRecord"), &mPauseRec, false);
gPrefs->Read(wxT("/AudioIO/Microfades"), &mbMicroFades, false);
int silenceLevelDB;
gPrefs->Read(wxT("/AudioIO/SilenceLevel"), &silenceLevelDB, -50);
int dBRange;
@ -2435,7 +2436,7 @@ void AudioIO::StopStream()
// If we can gracefully fade out in 200ms, with the faded-out play buffers making it through
// the sound card, then do so. If we can't, don't wait around. Just stop quickly and accept
// there will be a click.
if( latency < 150 )
if( mbMicroFades && (latency < 150 ))
wxMilliSleep( latency + 50);
}
@ -4842,6 +4843,9 @@ void AudioIoCallback::AddToOutputChannel( unsigned int chan,
float oldGain = vt->GetOldChannelGain(chan);
if( gain != oldGain )
vt->SetOldChannelGain(chan, gain);
// if no microfades, jump in volume.
if( !mbMicroFades )
oldGain =gain;
wxASSERT(len > 0);
// Linear interpolate.
@ -4958,7 +4962,8 @@ bool AudioIoCallback::FillOutputBuffers(
dropQuickly = drop;
}
dropQuickly = dropQuickly && TrackHasBeenFadedOut( *vt );
if( mbMicroFades )
dropQuickly = dropQuickly && TrackHasBeenFadedOut( *vt );
decltype(framesPerBuffer) len = 0;
@ -5483,7 +5488,7 @@ int AudioIoCallback::AudioCallback(const void *inputBuffer, void *outputBuffer,
outputMeterFloats);
// Test for no track audio to play (because we are paused and have faded out)
if( mPaused && AllTracksAlreadySilent() )
if( mPaused && (( !mbMicroFades ) || AllTracksAlreadySilent() ))
return mCallbackReturn;
// To add track output to output (to play sound on speaker)

View File

@ -505,6 +505,7 @@ public:
/// Audio playback rate in samples per second
double mRate;
unsigned long mMaxFramesOutput; // The actual number of frames output.
bool mbMicroFades;
double mSeek;
double mPlaybackRingBufferSecs;

View File

@ -130,19 +130,15 @@ void PlaybackPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartStatic(_("Options"));
{
S.StartTwoColumn();
S.StartVerticalLay();
{
S.TieCheckBox(_("&Vari-Speed Play"), "/AudioIO/VariSpeedPlay", true);
}
S.EndTwoColumn();
S.StartTwoColumn();
{
S.TieCheckBox(_("&Micro-fades"), "/AudioIO/Microfades", false);
S.TieCheckBox(_("Always scrub un&pinned"),
UnpinnedScrubbingPreferenceKey(),
UnpinnedScrubbingPreferenceDefault());
}
S.EndTwoColumn();
S.EndVerticalLay();
}
S.EndStatic();