Audacity 3.2.0
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Scrubber Class Referencefinal

#include <Scrubbing.h>

Inheritance diagram for Scrubber:
[legend]
Collaboration diagram for Scrubber:
[legend]

Classes

class  ScrubPoller
 

Public Member Functions

 Scrubber (AudacityProject *project)
 
 Scrubber (const Scrubber &) PROHIBITED
 
Scrubberoperator= (const Scrubber &) PROHIBITED
 
 ~Scrubber ()
 
void MarkScrubStart (wxCoord xx, bool smoothScrolling, bool seek)
 
bool MaybeStartScrubbing (wxCoord xx)
 
bool StartKeyboardScrubbing (double time0, bool backwards)
 
double GetKeyboardScrubbingSpeed ()
 
void ContinueScrubbingUI ()
 
void ContinueScrubbingPoll ()
 
void StopScrubbing ()
 
wxCoord GetScrubStartPosition () const
 
bool WasSpeedPlaying () const
 
bool IsSpeedPlaying () const
 
bool WasKeyboardScrubbing () const
 
bool IsKeyboardScrubbing () const
 
void SetBackwards (bool backwards)
 
bool IsBackwards () const
 
bool HasMark () const
 
bool IsScrubbing () const
 
bool IsScrollScrubbing () const
 
void SetScrollScrubbing (bool value)
 
bool ChoseSeeking () const
 
void SetMayDragToSeek (bool value)
 
bool MayDragToSeek () const
 
bool TemporarilySeeks () const
 
bool Seeks () const
 
bool Scrubs () const
 
bool ShowsBar () const
 
void Cancel ()
 
bool ShouldDrawScrubSpeed ()
 
double FindScrubSpeed (bool seeking, double time) const
 
double GetMaxScrubSpeed () const
 
void HandleScrollWheel (int steps)
 
bool CanScrub () const
 
void PopulatePopupMenu (wxMenu &menu)
 
void OnScrubOrSeek (bool seek)
 
void OnScrub (const CommandContext &)
 
void OnSeek (const CommandContext &)
 
void OnToggleScrubRuler (const CommandContext &)
 
void OnKeyboardScrubBackwards (const CommandContext &)
 
void OnKeyboardScrubForwards (const CommandContext &)
 
void DoKeyboardScrub (bool backwards, bool keyUp)
 
template<void(Scrubber::*)(const CommandContext &) pfn>
void Thunk (wxCommandEvent &)
 
const TranslatableStringGetUntranslatedStateString () const
 
wxString StatusMessageForWave () const
 
void Pause (bool paused)
 
bool IsPaused () const
 
void CheckMenuItems ()
 
bool IsTransportingPinned () const
 
void SetSeekPress (bool value)
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Static Public Member Functions

static ScrubberGet (AudacityProject &project)
 
static const ScrubberGet (const AudacityProject &project)
 
static bool ShouldScrubPinned ()
 

Private Member Functions

void UpdatePrefs () override
 
void StartPolling ()
 
void StopPolling ()
 
void DoScrub (bool seek)
 
void OnActivateOrDeactivateApp (wxActivateEvent &event)
 
void ScrubPollerThread ()
 
void JoinThread ()
 
- Private Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 
virtual void UpdateSelectedPrefs (int id)
 

Private Attributes

int mScrubToken
 
int mScrubSpeedDisplayCountdown
 
wxCoord mScrubStartPosition
 
wxCoord mLastScrubPosition {}
 
bool mScrubSeekPress {}
 
bool mSmoothScrollingScrub
 
bool mPaused {}
 
bool mSeeking {}
 
bool mSpeedPlaying {true}
 
bool mKeyboardScrubbing {}
 
bool mBackwards {}
 
bool mDragging {}
 
bool mCancelled {}
 
AudacityProjectmProject
 
std::unique_ptr< ScrubPollermPoller
 
ScrubbingOptions mOptions
 
double mMaxSpeed { 1.0 }
 
bool mShowScrubbing { false }
 
bool mMayDragToSeek { false }
 

Additional Inherited Members

- Static Private Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 

Detailed Description

Definition at line 39 of file Scrubbing.h.

Constructor & Destructor Documentation

◆ Scrubber() [1/2]

Scrubber::Scrubber ( AudacityProject project)
explicit

Definition at line 197 of file Scrubbing.cpp.

198 : mScrubToken(-1)
201 , mSmoothScrollingScrub(false)
202 , mPaused(true)
203#ifdef EXPERIMENTAL_SCRUBBING_SCROLL_WHEEL
204 , mLogMaxScrubSpeed(0)
205#endif
206
207 , mProject(project)
208 , mPoller { std::make_unique<ScrubPoller>(*this) }
209 , mOptions {}
210
211{
212 if (wxTheApp)
213 wxTheApp->Bind
214 (wxEVT_ACTIVATE_APP,
216
217 UpdatePrefs();
218}
int mScrubToken
Definition: Scrubbing.h:161
wxCoord mScrubStartPosition
Definition: Scrubbing.h:163
bool mSmoothScrollingScrub
Definition: Scrubbing.h:166
std::unique_ptr< ScrubPoller > mPoller
Definition: Scrubbing.h:194
void OnActivateOrDeactivateApp(wxActivateEvent &event)
int mScrubSpeedDisplayCountdown
Definition: Scrubbing.h:162
AudacityProject * mProject
Definition: Scrubbing.h:181
void UpdatePrefs() override
ScrubbingOptions mOptions
Definition: Scrubbing.h:197
bool mPaused
Definition: Scrubbing.h:168

References OnActivateOrDeactivateApp(), and UpdatePrefs().

Here is the call graph for this function:

◆ Scrubber() [2/2]

Scrubber::Scrubber ( const Scrubber )

◆ ~Scrubber()

Scrubber::~Scrubber ( )

Definition at line 230 of file Scrubbing.cpp.

231{
232 JoinThread();
233}
void JoinThread()
Definition: Scrubbing.cpp:220

References JoinThread().

Here is the call graph for this function:

Member Function Documentation

◆ Cancel()

void Scrubber::Cancel ( )
inline

Definition at line 106 of file Scrubbing.h.

107 { mCancelled = true; }
bool mCancelled
Definition: Scrubbing.h:175

◆ CanScrub()

bool Scrubber::CanScrub ( ) const

◆ CheckMenuItems()

void Scrubber::CheckMenuItems ( )

Referenced by MarkScrubStart().

Here is the caller graph for this function:

◆ ChoseSeeking()

bool Scrubber::ChoseSeeking ( ) const

◆ ContinueScrubbingPoll()

void Scrubber::ContinueScrubbingPoll ( )

Referenced by Scrubber::ScrubPoller::Notify().

Here is the caller graph for this function:

◆ ContinueScrubbingUI()

void Scrubber::ContinueScrubbingUI ( )

Referenced by Scrubber::ScrubPoller::Notify().

Here is the caller graph for this function:

◆ DoKeyboardScrub()

void Scrubber::DoKeyboardScrub ( bool  backwards,
bool  keyUp 
)

◆ DoScrub()

void Scrubber::DoScrub ( bool  seek)
private

◆ FindScrubSpeed()

double Scrubber::FindScrubSpeed ( bool  seeking,
double  time 
) const

Referenced by ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ Get() [1/2]

Scrubber & Scrubber::Get ( AudacityProject project)
static

◆ Get() [2/2]

const Scrubber & Scrubber::Get ( const AudacityProject project)
static

Definition at line 192 of file Scrubbing.cpp.

193{
194 return Get( const_cast< AudacityProject & >( project ) );
195}
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
static Scrubber & Get(AudacityProject &project)
Definition: Scrubbing.cpp:187

References Get().

Here is the call graph for this function:

◆ GetKeyboardScrubbingSpeed()

double Scrubber::GetKeyboardScrubbingSpeed ( )

◆ GetMaxScrubSpeed()

double Scrubber::GetMaxScrubSpeed ( ) const
inline

Definition at line 111 of file Scrubbing.h.

111{ return mOptions.maxSpeed; }

Referenced by ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ GetScrubStartPosition()

wxCoord Scrubber::GetScrubStartPosition ( ) const
inline

Definition at line 72 of file Scrubbing.h.

73 { return mScrubStartPosition; }

◆ GetUntranslatedStateString()

const TranslatableString & Scrubber::GetUntranslatedStateString ( ) const

Referenced by ControlToolBar::StateForStatusBar().

Here is the caller graph for this function:

◆ HandleScrollWheel()

void Scrubber::HandleScrollWheel ( int  steps)

◆ HasMark()

bool Scrubber::HasMark ( ) const
inline

Definition at line 89 of file Scrubbing.h.

90 { return GetScrubStartPosition() >= 0; }
wxCoord GetScrubStartPosition() const
Definition: Scrubbing.h:72

Referenced by ScrubbingOverlay::OnTimer(), and anonymous_namespace{AdornedRulerPanel.cpp}::ScrubbingMessage().

Here is the caller graph for this function:

◆ IsBackwards()

bool Scrubber::IsBackwards ( ) const
inline

Definition at line 85 of file Scrubbing.h.

86 { return mBackwards;}
bool mBackwards
Definition: Scrubbing.h:172

◆ IsKeyboardScrubbing()

bool Scrubber::IsKeyboardScrubbing ( ) const
inline

Definition at line 81 of file Scrubbing.h.

82 { return IsScrubbing() && mKeyboardScrubbing; }
bool IsScrubbing() const
bool mKeyboardScrubbing
Definition: Scrubbing.h:171

Referenced by ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ IsPaused()

bool Scrubber::IsPaused ( ) const

◆ IsScrollScrubbing()

bool Scrubber::IsScrollScrubbing ( ) const
inline

Definition at line 93 of file Scrubbing.h.

94 { return mSmoothScrollingScrub; }

Referenced by ScrubbingOverlay::Draw(), and ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ IsScrubbing()

bool Scrubber::IsScrubbing ( ) const

Referenced by anonymous_namespace{AdornedRulerPanel.cpp}::ContinueScrubbingMessage(), and ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ IsSpeedPlaying()

bool Scrubber::IsSpeedPlaying ( ) const
inline

Definition at line 77 of file Scrubbing.h.

78 { return IsScrubbing() && mSpeedPlaying; }
bool mSpeedPlaying
Definition: Scrubbing.h:170

Referenced by ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ IsTransportingPinned()

bool Scrubber::IsTransportingPinned ( ) const

Referenced by anonymous_namespace{PlayIndicatorOverlay.cpp}::GetIndicatorBitmap().

Here is the caller graph for this function:

◆ JoinThread()

void Scrubber::JoinThread ( )
private

Definition at line 220 of file Scrubbing.cpp.

221{
222#ifdef USE_SCRUB_THREAD
223 if (mThread.joinable()) {
224 mFinishThread.store(true, std::memory_order_release);
225 mThread.join();
226 }
227#endif
228}

Referenced by ~Scrubber().

Here is the caller graph for this function:

◆ MarkScrubStart()

void Scrubber::MarkScrubStart ( wxCoord  xx,
bool  smoothScrolling,
bool  seek 
)

Definition at line 306 of file Scrubbing.cpp.

310{
311 // Don't actually start scrubbing, but collect some information
312 // needed for the decision to start scrubbing later when handling
313 // drag events.
314 mSmoothScrollingScrub = smoothScrolling;
315
316 auto &projectAudioManager = ProjectAudioManager::Get( *mProject );
317
318 // Stop any play in progress
319 // Bug 1492: mCancelled to stop us collapsing the selected region.
320 mCancelled = true;
321 projectAudioManager.Stop();
322 mCancelled = false;
323
324 // Usually the timer handler of TrackPanel does this, but we do this now,
325 // so that same timer does not StopPlaying() again after this function and destroy
326 // scrubber state
327 ProjectAudioIO::Get( *mProject ).SetAudioIOToken(0);
328
329 mSeeking = seek;
331
332 // Commented out for Bug 1421
333 // mSeeking
334 // ? ControlToolBar::PlayAppearance::Seek
335 // : ControlToolBar::PlayAppearance::Scrub);
336
338 mCancelled = false;
339}
void SetAudioIOToken(int token)
static ProjectAudioIO & Get(AudacityProject &project)
static ProjectAudioManager & Get(AudacityProject &project)
void CheckMenuItems()
bool mSeeking
Definition: Scrubbing.h:169

References CheckMenuItems(), ProjectAudioIO::Get(), ProjectAudioManager::Get(), mCancelled, mProject, mScrubStartPosition, mSeeking, mSmoothScrollingScrub, and ProjectAudioIO::SetAudioIOToken().

Here is the call graph for this function:

◆ MaybeStartScrubbing()

bool Scrubber::MaybeStartScrubbing ( wxCoord  xx)

Referenced by ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ MayDragToSeek()

bool Scrubber::MayDragToSeek ( ) const
inline

Definition at line 100 of file Scrubbing.h.

100{ return mMayDragToSeek; }
bool mMayDragToSeek
Definition: Scrubbing.h:201

◆ OnActivateOrDeactivateApp()

void Scrubber::OnActivateOrDeactivateApp ( wxActivateEvent &  event)
private

Referenced by Scrubber().

Here is the caller graph for this function:

◆ OnKeyboardScrubBackwards()

void Scrubber::OnKeyboardScrubBackwards ( const CommandContext )

◆ OnKeyboardScrubForwards()

void Scrubber::OnKeyboardScrubForwards ( const CommandContext )

◆ OnScrub()

void Scrubber::OnScrub ( const CommandContext )

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

Here is the caller graph for this function:

◆ OnScrubOrSeek()

void Scrubber::OnScrubOrSeek ( bool  seek)

◆ OnSeek()

void Scrubber::OnSeek ( const CommandContext )

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

Here is the caller graph for this function:

◆ OnToggleScrubRuler()

void Scrubber::OnToggleScrubRuler ( const CommandContext )

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

Here is the caller graph for this function:

◆ operator=()

Scrubber & Scrubber::operator= ( const Scrubber )

◆ Pause()

void Scrubber::Pause ( bool  paused)

◆ PopulatePopupMenu()

void Scrubber::PopulatePopupMenu ( wxMenu &  menu)

◆ ScrubPollerThread()

void Scrubber::ScrubPollerThread ( )
private

◆ Scrubs()

bool Scrubber::Scrubs ( ) const

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

Here is the caller graph for this function:

◆ Seeks()

bool Scrubber::Seeks ( ) const

Referenced by anonymous_namespace{AdornedRulerPanel.cpp}::ContinueScrubbingMessage(), anonymous_namespace{Scrubbing.cpp}::menuItems(), and ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ SetBackwards()

void Scrubber::SetBackwards ( bool  backwards)
inline

Definition at line 83 of file Scrubbing.h.

84 { mBackwards = backwards;}

◆ SetMayDragToSeek()

void Scrubber::SetMayDragToSeek ( bool  value)
inline

Definition at line 99 of file Scrubbing.h.

99{ mMayDragToSeek = value; }

◆ SetScrollScrubbing()

void Scrubber::SetScrollScrubbing ( bool  value)
inline

Definition at line 95 of file Scrubbing.h.

96 { mSmoothScrollingScrub = value; }

◆ SetSeekPress()

void Scrubber::SetSeekPress ( bool  value)
inline

Definition at line 146 of file Scrubbing.h.

146{ mScrubSeekPress = value; }
bool mScrubSeekPress
Definition: Scrubbing.h:165

◆ ShouldDrawScrubSpeed()

bool Scrubber::ShouldDrawScrubSpeed ( )

Referenced by ScrubbingOverlay::DoGetRectangle(), ScrubbingOverlay::Draw(), and ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ ShouldScrubPinned()

bool Scrubber::ShouldScrubPinned ( )
static

Definition at line 150 of file Scrubbing.cpp.

151{
154}
static bool GetUnpinnedScrubbingPreference()
static bool GetPinnedHeadPreference()

References TracksPrefs::GetPinnedHeadPreference(), and PlaybackPrefs::GetUnpinnedScrubbingPreference().

Referenced by AdornedRulerPanel::ScrubbingHandle::Click().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowsBar()

bool Scrubber::ShowsBar ( ) const

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

Here is the caller graph for this function:

◆ StartKeyboardScrubbing()

bool Scrubber::StartKeyboardScrubbing ( double  time0,
bool  backwards 
)

◆ StartPolling()

void Scrubber::StartPolling ( )
private
Precondition
!mThread.joinable() (when defined(USE_SCRUB_THREAD))

◆ StatusMessageForWave()

wxString Scrubber::StatusMessageForWave ( ) const

◆ StopPolling()

void Scrubber::StopPolling ( )
private

◆ StopScrubbing()

void Scrubber::StopScrubbing ( )

◆ TemporarilySeeks()

bool Scrubber::TemporarilySeeks ( ) const

Referenced by ScrubbingOverlay::OnTimer().

Here is the caller graph for this function:

◆ Thunk()

template<void(Scrubber::*)(const CommandContext &) pfn>
void Scrubber::Thunk ( wxCommandEvent &  )
inline

Definition at line 132 of file Scrubbing.h.

133 { (this->*pfn)(*mProject); }

◆ UpdatePrefs()

void Scrubber::UpdatePrefs ( )
overrideprivatevirtual

Implements PrefsListener.

Referenced by Scrubber().

Here is the caller graph for this function:

◆ WasKeyboardScrubbing()

bool Scrubber::WasKeyboardScrubbing ( ) const
inline

Definition at line 79 of file Scrubbing.h.

80 { return mKeyboardScrubbing; }

◆ WasSpeedPlaying()

bool Scrubber::WasSpeedPlaying ( ) const
inline

Definition at line 75 of file Scrubbing.h.

76 { return mSpeedPlaying;}

Member Data Documentation

◆ mBackwards

bool Scrubber::mBackwards {}
private

Definition at line 172 of file Scrubbing.h.

◆ mCancelled

bool Scrubber::mCancelled {}
private

Definition at line 175 of file Scrubbing.h.

Referenced by MarkScrubStart().

◆ mDragging

bool Scrubber::mDragging {}
private

Definition at line 173 of file Scrubbing.h.

◆ mKeyboardScrubbing

bool Scrubber::mKeyboardScrubbing {}
private

Definition at line 171 of file Scrubbing.h.

◆ mLastScrubPosition

wxCoord Scrubber::mLastScrubPosition {}
private

Definition at line 164 of file Scrubbing.h.

◆ mMaxSpeed

double Scrubber::mMaxSpeed { 1.0 }
private

Definition at line 198 of file Scrubbing.h.

◆ mMayDragToSeek

bool Scrubber::mMayDragToSeek { false }
private

Definition at line 201 of file Scrubbing.h.

◆ mOptions

ScrubbingOptions Scrubber::mOptions
private

Definition at line 197 of file Scrubbing.h.

◆ mPaused

bool Scrubber::mPaused {}
private

Definition at line 168 of file Scrubbing.h.

◆ mPoller

std::unique_ptr<ScrubPoller> Scrubber::mPoller
private

Definition at line 195 of file Scrubbing.h.

◆ mProject

AudacityProject* Scrubber::mProject
private

Definition at line 181 of file Scrubbing.h.

Referenced by MarkScrubStart().

◆ mScrubSeekPress

bool Scrubber::mScrubSeekPress {}
private

Definition at line 165 of file Scrubbing.h.

◆ mScrubSpeedDisplayCountdown

int Scrubber::mScrubSpeedDisplayCountdown
private

Definition at line 162 of file Scrubbing.h.

◆ mScrubStartPosition

wxCoord Scrubber::mScrubStartPosition
private

Definition at line 163 of file Scrubbing.h.

Referenced by MarkScrubStart().

◆ mScrubToken

int Scrubber::mScrubToken
private

Definition at line 161 of file Scrubbing.h.

◆ mSeeking

bool Scrubber::mSeeking {}
private

Definition at line 169 of file Scrubbing.h.

Referenced by MarkScrubStart().

◆ mShowScrubbing

bool Scrubber::mShowScrubbing { false }
private

Definition at line 200 of file Scrubbing.h.

◆ mSmoothScrollingScrub

bool Scrubber::mSmoothScrollingScrub
private

Definition at line 166 of file Scrubbing.h.

Referenced by MarkScrubStart().

◆ mSpeedPlaying

bool Scrubber::mSpeedPlaying {true}
private

Definition at line 170 of file Scrubbing.h.


The documentation for this class was generated from the following files: