mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-04 17:49:45 +02:00
Move some static functions into ScrubbingOptions
This commit is contained in:
parent
8ed93b8147
commit
671f60492d
@ -571,7 +571,7 @@ private:
|
||||
maxed = true;
|
||||
}
|
||||
|
||||
if (speed < GetMinScrubSpeed())
|
||||
if (speed < ScrubbingOptions::MinAllowedScrubSpeed())
|
||||
// Mixers were set up to go only so slowly, not slower.
|
||||
// This will put a request for some silence in the work queue.
|
||||
speed = 0.0;
|
||||
@ -1604,7 +1604,8 @@ int AudioIO::StartStream(const WaveTrackArray &playbackTracks,
|
||||
if (mCaptureTracks->size() > 0 ||
|
||||
mPlayMode == PLAY_LOOPED ||
|
||||
mTimeTrack != NULL ||
|
||||
options.maxScrubSpeed < GetMinScrubSpeed())
|
||||
options.maxScrubSpeed <
|
||||
ScrubbingOptions::MinAllowedScrubSpeed())
|
||||
{
|
||||
wxASSERT(false);
|
||||
scrubbing = false;
|
||||
@ -1750,9 +1751,13 @@ int AudioIO::StartStream(const WaveTrackArray &playbackTracks,
|
||||
|
||||
const Mixer::WarpOptions &warpOptions =
|
||||
#ifdef EXPERIMENTAL_SCRUBBING_SUPPORT
|
||||
scrubbing ? Mixer::WarpOptions(GetMinScrubSpeed(), GetMaxScrubSpeed()) :
|
||||
scrubbing
|
||||
? Mixer::WarpOptions
|
||||
(ScrubbingOptions::MinAllowedScrubSpeed(),
|
||||
ScrubbingOptions::MaxAllowedScrubSpeed())
|
||||
:
|
||||
#endif
|
||||
Mixer::WarpOptions(mTimeTrack);
|
||||
Mixer::WarpOptions(mTimeTrack);
|
||||
|
||||
for (unsigned int i = 0; i < mPlaybackTracks->size(); i++)
|
||||
{
|
||||
|
@ -186,8 +186,6 @@ class AUDACITY_DLL_API AudioIO final {
|
||||
#ifdef EXPERIMENTAL_SCRUBBING_SUPPORT
|
||||
bool IsScrubbing() { return IsBusy() && mScrubQueue != 0; }
|
||||
|
||||
static double GetMaxScrubSpeed() { return 32.0; } // Is five octaves enough for your amusement?
|
||||
static double GetMinScrubSpeed() { return 0.01; }
|
||||
/** \brief enqueue a NEW scrub play interval, using the last end as the new start,
|
||||
* to be played over the same duration, as between this and the last
|
||||
* enqueuing (or the starting of the stream). Except, we do not exceed maximum
|
||||
|
@ -314,7 +314,7 @@ bool Scrubber::MaybeStartScrubbing(wxCoord xx)
|
||||
// That idea seems unpopular... just make it one for move-scrub,
|
||||
// but big for drag-scrub
|
||||
mMaxScrubSpeed = options.maxScrubSpeed =
|
||||
mDragging ? AudioIO::GetMaxScrubSpeed() : 1.0;
|
||||
mDragging ? ScrubbingOptions::MaxAllowedScrubSpeed() : 1.0;
|
||||
#endif
|
||||
options.maxScrubTime = mProject->GetTracks()->GetEndTime();
|
||||
ControlToolBar::PlayAppearance appearance =
|
||||
@ -502,8 +502,8 @@ void Scrubber::HandleScrollWheel(int steps)
|
||||
static const double maxScrubSpeedBase =
|
||||
pow(2.0, 1.0 / ScrubSpeedStepsPerOctave);
|
||||
double newSpeed = pow(maxScrubSpeedBase, newLogMaxScrubSpeed);
|
||||
if (newSpeed >= AudioIO::GetMinScrubSpeed() &&
|
||||
newSpeed <= AudioIO::GetMaxScrubSpeed()) {
|
||||
if (newSpeed >= ScrubbingOptions::MinAllowedScrubSpeed() &&
|
||||
newSpeed <= ScrubbingOptions::MaxAllowedScrubSpeed()) {
|
||||
mLogMaxScrubSpeed = newLogMaxScrubSpeed;
|
||||
mMaxScrubSpeed = newSpeed;
|
||||
if (!mSmoothScrollingScrub)
|
||||
|
@ -28,6 +28,11 @@ struct ScrubbingOptions {
|
||||
bool adjustStart {};
|
||||
|
||||
bool enqueueBySpeed {};
|
||||
|
||||
static double MaxAllowedScrubSpeed()
|
||||
{ return 32.0; } // Is five octaves enough for your amusement?
|
||||
static double MinAllowedScrubSpeed()
|
||||
{ return 0.01; } // Mixer needs a lower bound speed. Scrub no slower than this.
|
||||
};
|
||||
|
||||
// Scrub state object
|
||||
|
Loading…
x
Reference in New Issue
Block a user