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

#include <ProjectAudioIO.h>

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

Public Member Functions

 ProjectAudioIO (AudacityProject &project)
 
 ProjectAudioIO (const ProjectAudioIO &) PROHIBITED
 
ProjectAudioIOoperator= (const ProjectAudioIO &) PROHIBITED
 
 ~ProjectAudioIO ()
 
int GetAudioIOToken () const
 
bool IsAudioActive () const
 
void SetAudioIOToken (int token)
 
const std::shared_ptr< Meter > & GetPlaybackMeter () const
 
void SetPlaybackMeter (const std::shared_ptr< Meter > &playback)
 
const std::shared_ptr< Meter > & GetCaptureMeter () const
 
void SetCaptureMeter (const std::shared_ptr< Meter > &capture)
 
double GetPlaySpeed () const
 
void SetPlaySpeed (double value)
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Static Public Member Functions

static ProjectAudioIOGet (AudacityProject &project)
 
static const ProjectAudioIOGet (const AudacityProject &project)
 

Private Attributes

AudacityProjectmProject
 
std::shared_ptr< MetermPlaybackMeter
 
std::shared_ptr< MetermCaptureMeter
 
std::atomic< double > mPlaySpeed {}
 
int mAudioIOToken { -1 }
 

Detailed Description

\ brief Holds per-project state needed for interaction with AudioIO, including the audio stream token and pointers to meters

Definition at line 29 of file ProjectAudioIO.h.

Constructor & Destructor Documentation

◆ ProjectAudioIO() [1/2]

ProjectAudioIO::ProjectAudioIO ( AudacityProject project)
explicit

Definition at line 34 of file ProjectAudioIO.cpp.

35: mProject{ project }
36{
37}
AudacityProject & mProject

◆ ProjectAudioIO() [2/2]

ProjectAudioIO::ProjectAudioIO ( const ProjectAudioIO )

◆ ~ProjectAudioIO()

ProjectAudioIO::~ProjectAudioIO ( )

Definition at line 39 of file ProjectAudioIO.cpp.

40{
41}

Member Function Documentation

◆ Get() [1/2]

ProjectAudioIO & ProjectAudioIO::Get ( AudacityProject project)
static

Definition at line 24 of file ProjectAudioIO.cpp.

25{
26 return project.AttachedObjects::Get< ProjectAudioIO >( sAudioIOKey );
27}
static const AudacityProject::AttachedObjects::RegisteredFactory sAudioIOKey

References sAudioIOKey.

Referenced by AudioIOBusyPred(), StretchHandle::Click(), CutlineHandle::Click(), SampleHandle::Click(), WaveClipTrimHandle::Click(), EnvelopeHandle::Click(), SelectHandle::Click(), TimeShiftHandle::Click(), TrackSelectHandle::Click(), SelectButtonHandle::CommitChanges(), CloseButtonHandle::CommitChanges(), DefaultPlayOptions(), anonymous_namespace{SelectMenus.cpp}::DoBoundaryMove(), anonymous_namespace{SelectMenus.cpp}::DoCursorMove(), anonymous_namespace{TransportMenus.cpp}::DoMoveToLabel(), ProjectAudioManager::DoPlayStopSelect(), ProjectAudioManager::DoRecord(), TransportUtilities::DoStopPlaying(), StretchHandle::Drag(), SampleHandle::Drag(), EnvelopeHandle::Drag(), TimeShiftHandle::Drag(), TrackSelectHandle::Drag(), MeterToolBar::Expose(), Get(), NewDefaultPlaybackPolicy::GetPlaySpeed(), LabelGlyphHandle::HandleGlyphDragRelease(), anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::HitTest(), anonymous_namespace{WaveTrackControls.cpp}::initFn(), TrackPanel::IsAudioActive(), anonymous_namespace{TransportMenus.cpp}::MakeReadyToPlay(), Scrubber::MarkScrubStart(), ProjectWindow::MayScrollBeyondZero(), LabelEditActions::Handler::OnAddLabelPlaying(), ProjectAudioManager::OnAudioIOStopRecording(), ProjectManager::OnCloseWindow(), SelectActions::Handler::OnCursorPositionStore(), SelectionBar::OnIdle(), TimeToolBar::OnIdle(), AudacityApp::OnKeyDown(), anonymous_namespace{SelectMenus.cpp}::OnlyHandleKeyUp(), SelectActions::Handler::OnSelectCursorStoredCursor(), SelectUtilities::OnSetRegion(), ProjectWindow::PlaybackScroller::OnTimer(), LyricsWindow::OnTimer(), MixerBoard::OnTimer(), PlayIndicatorOverlay::OnTimer(), ProjectManager::OnTimer(), TrackPanel::OnTimer(), TrackActions::Handler::OnTrackClose(), ProjectAudioManager::PlayPlayRegion(), WaveClipTrimHandle::Preview(), AffordanceHandle::Preview(), StretchHandle::Preview(), CutlineHandle::Preview(), SampleHandle::Preview(), EnvelopeHandle::Preview(), TimeShiftHandle::Preview(), TrackSelectHandle::Preview(), MeterToolBar::ReCreateButtons(), StretchHandle::Release(), SampleHandle::Release(), EnvelopeHandle::Release(), TimeShiftHandle::Release(), anonymous_namespace{SelectMenus.cpp}::SeekLeftOrRight(), TranscriptionToolBar::SetPlaySpeed(), ProjectAudioManager::Stop(), AdornedRulerPanel::ScrubbingRulerOverlay::Update(), and ProjectWindow::ZoomInByFactor().

◆ Get() [2/2]

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

Definition at line 29 of file ProjectAudioIO.cpp.

30{
31 return Get( const_cast<AudacityProject &>(project) );
32}
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 ProjectAudioIO & Get(AudacityProject &project)

References Get().

Here is the call graph for this function:

◆ GetAudioIOToken()

int ProjectAudioIO::GetAudioIOToken ( ) const

Definition at line 43 of file ProjectAudioIO.cpp.

44{
45 return mAudioIOToken;
46}

References mAudioIOToken.

Referenced by ProjectAudioManager::DoPlayStopSelect(), TransportUtilities::DoStopPlaying(), IsAudioActive(), anonymous_namespace{TransportMenus.cpp}::MakeReadyToPlay(), LabelEditActions::Handler::OnAddLabelPlaying(), AudacityApp::OnKeyDown(), SelectUtilities::OnSetRegion(), and ProjectWindow::ZoomInByFactor().

Here is the caller graph for this function:

◆ GetCaptureMeter()

const std::shared_ptr< Meter > & ProjectAudioIO::GetCaptureMeter ( ) const

Definition at line 77 of file ProjectAudioIO.cpp.

78{
79 return mCaptureMeter;
80}
std::shared_ptr< Meter > mCaptureMeter

References mCaptureMeter.

◆ GetPlaybackMeter()

const std::shared_ptr< Meter > & ProjectAudioIO::GetPlaybackMeter ( ) const

Definition at line 60 of file ProjectAudioIO.cpp.

61{
62 return mPlaybackMeter;
63}
std::shared_ptr< Meter > mPlaybackMeter

References mPlaybackMeter.

◆ GetPlaySpeed()

double ProjectAudioIO::GetPlaySpeed ( ) const
inline

Definition at line 53 of file ProjectAudioIO.h.

53 {
54 return mPlaySpeed.load( std::memory_order_relaxed ); }
std::atomic< double > mPlaySpeed

Referenced by NewDefaultPlaybackPolicy::GetPlaySpeed(), and SetPlaySpeed().

Here is the caller graph for this function:

◆ IsAudioActive()

bool ProjectAudioIO::IsAudioActive ( ) const

Definition at line 53 of file ProjectAudioIO.cpp.

54{
55 auto gAudioIO = AudioIOBase::Get();
56 return GetAudioIOToken() > 0 &&
57 gAudioIO->IsStreamActive(GetAudioIOToken());
58}
static AudioIOBase * Get()
Definition: AudioIOBase.cpp:91
int GetAudioIOToken() const

References AudioIOBase::Get(), and GetAudioIOToken().

Referenced by StretchHandle::Click(), CutlineHandle::Click(), SampleHandle::Click(), WaveClipTrimHandle::Click(), EnvelopeHandle::Click(), SelectHandle::Click(), TimeShiftHandle::Click(), TrackSelectHandle::Click(), SelectButtonHandle::CommitChanges(), CloseButtonHandle::CommitChanges(), anonymous_namespace{SelectMenus.cpp}::DoBoundaryMove(), StretchHandle::Drag(), SampleHandle::Drag(), EnvelopeHandle::Drag(), TimeShiftHandle::Drag(), TrackSelectHandle::Drag(), LabelGlyphHandle::HandleGlyphDragRelease(), anonymous_namespace{AdornedRulerPanel.cpp}::PlayheadHandle::HitTest(), anonymous_namespace{WaveTrackControls.cpp}::initFn(), TrackPanel::IsAudioActive(), ProjectWindow::MayScrollBeyondZero(), SelectActions::Handler::OnCursorPositionStore(), anonymous_namespace{SelectMenus.cpp}::OnlyHandleKeyUp(), SelectActions::Handler::OnSelectCursorStoredCursor(), ProjectWindow::PlaybackScroller::OnTimer(), LyricsWindow::OnTimer(), MixerBoard::OnTimer(), PlayIndicatorOverlay::OnTimer(), TrackActions::Handler::OnTrackClose(), WaveClipTrimHandle::Preview(), AffordanceHandle::Preview(), StretchHandle::Preview(), CutlineHandle::Preview(), SampleHandle::Preview(), EnvelopeHandle::Preview(), TimeShiftHandle::Preview(), TrackSelectHandle::Preview(), StretchHandle::Release(), SampleHandle::Release(), EnvelopeHandle::Release(), TimeShiftHandle::Release(), and AdornedRulerPanel::ScrubbingRulerOverlay::Update().

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

◆ operator=()

ProjectAudioIO & ProjectAudioIO::operator= ( const ProjectAudioIO )

◆ SetAudioIOToken()

void ProjectAudioIO::SetAudioIOToken ( int  token)

Definition at line 48 of file ProjectAudioIO.cpp.

49{
50 mAudioIOToken = token;
51}

References mAudioIOToken.

Referenced by ProjectAudioManager::DoRecord(), Scrubber::MarkScrubStart(), and ProjectAudioManager::PlayPlayRegion().

Here is the caller graph for this function:

◆ SetCaptureMeter()

void ProjectAudioIO::SetCaptureMeter ( const std::shared_ptr< Meter > &  capture)

Definition at line 82 of file ProjectAudioIO.cpp.

84{
85 auto &project = mProject;
86 mCaptureMeter = capture;
87
88 auto gAudioIO = AudioIOBase::Get();
89 if (gAudioIO)
90 {
91 gAudioIO->SetCaptureMeter( project.shared_from_this(), mCaptureMeter );
92 }
93}

References AudioIOBase::Get(), mCaptureMeter, and mProject.

Here is the call graph for this function:

◆ SetPlaybackMeter()

void ProjectAudioIO::SetPlaybackMeter ( const std::shared_ptr< Meter > &  playback)

Definition at line 65 of file ProjectAudioIO.cpp.

67{
68 auto &project = mProject;
69 mPlaybackMeter = playback;
70 auto gAudioIO = AudioIOBase::Get();
71 if (gAudioIO)
72 {
73 gAudioIO->SetPlaybackMeter( project.shared_from_this() , mPlaybackMeter );
74 }
75}

References AudioIOBase::Get(), mPlaybackMeter, and mProject.

Here is the call graph for this function:

◆ SetPlaySpeed()

void ProjectAudioIO::SetPlaySpeed ( double  value)

Definition at line 95 of file ProjectAudioIO.cpp.

96{
97 if (auto oldValue = GetPlaySpeed(); value != oldValue) {
98 mPlaySpeed.store( value, std::memory_order_relaxed );
99 wxCommandEvent evt{ EVT_PLAY_SPEED_CHANGE };
100 mProject.ProcessEvent(evt);
101 }
102}
double GetPlaySpeed() const

References GetPlaySpeed(), mPlaySpeed, and mProject.

Referenced by TranscriptionToolBar::SetPlaySpeed().

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

Member Data Documentation

◆ mAudioIOToken

int ProjectAudioIO::mAudioIOToken { -1 }
private

Definition at line 68 of file ProjectAudioIO.h.

Referenced by GetAudioIOToken(), and SetAudioIOToken().

◆ mCaptureMeter

std::shared_ptr<Meter> ProjectAudioIO::mCaptureMeter
private

Definition at line 62 of file ProjectAudioIO.h.

Referenced by GetCaptureMeter(), and SetCaptureMeter().

◆ mPlaybackMeter

std::shared_ptr<Meter> ProjectAudioIO::mPlaybackMeter
private

Definition at line 61 of file ProjectAudioIO.h.

Referenced by GetPlaybackMeter(), and SetPlaybackMeter().

◆ mPlaySpeed

std::atomic<double> ProjectAudioIO::mPlaySpeed {}
private

Definition at line 66 of file ProjectAudioIO.h.

Referenced by SetPlaySpeed().

◆ mProject

AudacityProject& ProjectAudioIO::mProject
private

Definition at line 58 of file ProjectAudioIO.h.

Referenced by SetCaptureMeter(), SetPlaybackMeter(), and SetPlaySpeed().


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