Audacity 3.2.0
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
Scrubbing.cpp File Reference
#include "Scrubbing.h"
#include <functional>
#include "AudioIO.h"
#include "CommandManager.h"
#include "../../CommonCommandFlags.h"
#include "Project.h"
#include "ProjectAudioIO.h"
#include "../../ProjectAudioManager.h"
#include "ProjectHistory.h"
#include "../../ProjectWindows.h"
#include "ProjectStatus.h"
#include "../../ScrubState.h"
#include "Track.h"
#include "ViewInfo.h"
#include "WaveTrack.h"
#include "../../prefs/PlaybackPrefs.h"
#include "../../prefs/TracksPrefs.h"
#include <algorithm>
#include <wx/app.h>
#include <wx/menu.h>
#include <wx/timer.h>
Include dependency graph for Scrubbing.cpp:

Go to the source code of this file.

Classes

class  Scrubber::ScrubPoller
 
struct  anonymous_namespace{Scrubbing.cpp}::MenuItem
 

Namespaces

namespace  anonymous_namespace{Scrubbing.cpp}
 

Macros

#define THUNK(Name)   Scrubber::Thunk<&Scrubber::Name>
 

Typedefs

using anonymous_namespace{Scrubbing.cpp}::MenuItems = std::vector< MenuItem >
 

Enumerations

enum  { SCRUBBING_PIXEL_TOLERANCE = 10 , ScrubSpeedStepsPerOctave = 4 , kOneSecondCountdown }
 
enum  { CMD_ID = 8000 }
 

Functions

double anonymous_namespace{Scrubbing.cpp}::FindScrubbingSpeed (const ViewInfo &viewInfo, double maxScrubSpeed, double screen, double timeAtMouse)
 
double anonymous_namespace{Scrubbing.cpp}::FindSeekSpeed (const ViewInfo &viewInfo, double maxScrubSpeed, double screen, double timeAtMouse)
 
static const ReservedCommandFlagHasWaveDataFlag ()
 
const MenuItemsanonymous_namespace{Scrubbing.cpp}::menuItems ()
 
const MenuItemanonymous_namespace{Scrubbing.cpp}::FindMenuItem (bool seek)
 
static AudioIOStartStreamOptions::PolicyFactory ScrubbingPlaybackPolicyFactory (const ScrubbingOptions &options)
 
bool anonymous_namespace{Scrubbing.cpp}::ReadScrubEnabledPref ()
 
void anonymous_namespace{Scrubbing.cpp}::WriteScrubEnabledPref (bool value)
 
auto anonymous_namespace{Scrubbing.cpp}::ToolbarMenu ()
 
auto anonymous_namespace{Scrubbing.cpp}::KeyboardScrubbingItems ()
 

Variables

static constexpr PlaybackPolicy::Duration MinStutter {0.2}
 
static const AudacityProject::AttachedObjects::RegisteredFactory key
 
static const auto HasWaveDataPred
 
static const wxChar * anonymous_namespace{Scrubbing.cpp}::scrubEnabledPrefName = wxT("/QuickPlay/ScrubbingEnabled")
 
static auto sPlayAtSpeedStatus = XO("Playing at Speed")
 
static auto sKeyboardScrubbingStatus = XO("Scrubbing")
 
static ProjectStatus::RegisteredStatusWidthFunction registeredStatusWidthFunction
 
static const auto anonymous_namespace{Scrubbing.cpp}::finder
 
AttachedItem anonymous_namespace{Scrubbing.cpp}::sAttachment { Indirect(ToolbarMenu()), wxT("Transport/Basic") }
 
AttachedItem anonymous_namespace{Scrubbing.cpp}::sAttachment2
 

Macro Definition Documentation

◆ THUNK

#define THUNK (   Name)    Scrubber::Thunk<&Scrubber::Name>

Definition at line 972 of file Scrubbing.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SCRUBBING_PIXEL_TOLERANCE 
ScrubSpeedStepsPerOctave 
kOneSecondCountdown 

Definition at line 45 of file Scrubbing.cpp.

45 {
46 // PRL:
47 // Mouse must move at least this far to distinguish ctrl-drag to scrub
48 // from ctrl+click for playback.
50
52
54 1000 / std::chrono::milliseconds{ScrubPollInterval}.count(),
55};
static constexpr auto ScrubPollInterval
Definition: ScrubState.h:109
@ SCRUBBING_PIXEL_TOLERANCE
Definition: Scrubbing.cpp:49
@ ScrubSpeedStepsPerOctave
Definition: Scrubbing.cpp:51
@ kOneSecondCountdown
Definition: Scrubbing.cpp:53

◆ anonymous enum

anonymous enum
Enumerator
CMD_ID 

Definition at line 970 of file Scrubbing.cpp.

970{ CMD_ID = 8000 };
@ CMD_ID
Definition: Scrubbing.cpp:970

Function Documentation

◆ HasWaveDataFlag()

static const ReservedCommandFlag & HasWaveDataFlag ( )
static

Definition at line 242 of file Scrubbing.cpp.

242 { static ReservedCommandFlag flag{
244}; return flag; } // jkc
static const auto HasWaveDataPred
Definition: Scrubbing.cpp:232
static std::once_flag flag

References flag, and HasWaveDataPred.

Referenced by anonymous_namespace{Scrubbing.cpp}::menuItems().

Here is the caller graph for this function:

◆ ScrubbingPlaybackPolicyFactory()

static AudioIOStartStreamOptions::PolicyFactory ScrubbingPlaybackPolicyFactory ( const ScrubbingOptions options)
static

Definition at line 339 of file Scrubbing.cpp.

340{
341 return [options](auto&) -> std::unique_ptr<PlaybackPolicy>
342 {
343 return std::make_unique<ScrubbingPlaybackPolicy>(options);
344 };
345}

Referenced by Scrubber::MaybeStartScrubbing(), and Scrubber::StartKeyboardScrubbing().

Here is the caller graph for this function:

Variable Documentation

◆ HasWaveDataPred

const auto HasWaveDataPred
static
Initial value:
=
auto range = TrackList::Get(project).Any<const WaveTrack>()
+ [](const WaveTrack *pTrack){
return pTrack->GetEndTime() > pTrack->GetStartTime();
};
return !range.empty();
}
const auto project
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:950
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
double GetStartTime() const override
Implement WideSampleSequence.
Definition: WaveTrack.cpp:2603
double GetEndTime() const override
Implement WideSampleSequence.
Definition: WaveTrack.cpp:2613

Definition at line 232 of file Scrubbing.cpp.

Referenced by Scrubber::CanScrub(), and HasWaveDataFlag().

◆ key

Initial value:
{
[]( AudacityProject &parent ){
return std::make_shared< Scrubber >( &parent ); }
}

Definition at line 181 of file Scrubbing.cpp.

Referenced by Scrubber::Get().

◆ MinStutter

constexpr PlaybackPolicy::Duration MinStutter {0.2}
staticconstexpr

Definition at line 57 of file Scrubbing.cpp.

Referenced by Scrubber::MaybeStartScrubbing().

◆ registeredStatusWidthFunction

ProjectStatus::RegisteredStatusWidthFunction registeredStatusWidthFunction
static
Initial value:
{
{
if ( field == StateStatusBarField() ) {
for (const auto &item : menuItems())
strings.push_back( item.GetStatus() );
strings.push_back(
XO("%s Paused.").Format( sPlayAtSpeedStatus )
);
return { std::move( strings ), 30 };
}
return {};
}
}
XO("Cut/Copy/Paste")
#define field(n, t)
Definition: ImportAUP.cpp:165
StatusBarField StateStatusBarField()
ID of the first field in the status bar. This filed is used to display playback state.
static auto sPlayAtSpeedStatus
Definition: Scrubbing.cpp:982
std::vector< TranslatableString > TranslatableStrings
An explicitly nonlocalized string, not meant for the user to see.
Definition: Identifier.h:22
std::pair< std::vector< TranslatableString >, unsigned > StatusWidthResult

Definition at line 1019 of file Scrubbing.cpp.

◆ sKeyboardScrubbingStatus

auto sKeyboardScrubbingStatus = XO("Scrubbing")
static

Definition at line 984 of file Scrubbing.cpp.

Referenced by Scrubber::GetUntranslatedStateString().

◆ sPlayAtSpeedStatus

auto sPlayAtSpeedStatus = XO("Playing at Speed")
static

Definition at line 982 of file Scrubbing.cpp.

Referenced by Scrubber::GetUntranslatedStateString().