Audacity 3.2.0
|
#include <ProjectAudioManager.h>
Public Member Functions | |
ProjectAudioManager (AudacityProject &project) | |
ProjectAudioManager (const ProjectAudioManager &)=delete | |
ProjectAudioManager & | operator= (const ProjectAudioManager &)=delete |
~ProjectAudioManager () override | |
bool | IsTimerRecordCancelled () |
void | SetTimerRecordCancelled () |
void | ResetTimerRecordCancelled () |
bool | Paused () const |
bool | Playing () const |
bool | Recording () const |
bool | Stopping () const |
bool | Appending () const |
bool | Looping () const |
bool | Cutting () const |
bool | CanStopAudioStream () const |
void | OnRecord (bool altAppearance) |
bool | DoRecord (AudacityProject &project, const TransportSequences &transportSequences, double t0, double t1, bool altAppearance, const AudioIOStartStreamOptions &options) |
int | PlayPlayRegion (const SelectedRegion &selectedRegion, const AudioIOStartStreamOptions &options, PlayMode playMode, bool backwards=false) |
void | PlayCurrentRegion (bool newDefault=false, bool cutpreview=false) |
void | OnPause () |
void | Stop (bool stopStream=true) |
void | StopIfPaused () |
bool | DoPlayStopSelect (bool click, bool shift) |
void | DoPlayStopSelect () |
PlayMode | GetLastPlayMode () const |
Public Member Functions inherited from ClientData::Base | |
virtual | ~Base () |
Public Member Functions inherited from AudioIOListener | |
AudioIOListener () | |
virtual | ~AudioIOListener () |
virtual void | OnAudioIORate (int rate)=0 |
virtual void | OnAudioIOStartRecording ()=0 |
virtual void | OnAudioIOStopRecording ()=0 |
virtual void | OnAudioIONewBlocks ()=0 |
virtual void | OnCommitRecording ()=0 |
virtual void | OnSoundActivationThreshold ()=0 |
Public Member Functions inherited from Observer::Publisher< RecordingDropoutEvent > | |
Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={}) | |
Constructor supporting type-erased custom allocation/deletion. More... | |
Publisher (Publisher &&)=default | |
Publisher & | operator= (Publisher &&)=default |
Subscription | Subscribe (Callback callback) |
Connect a callback to the Publisher; later-connected are called earlier. More... | |
Subscription | Subscribe (Object &obj, Return(Object::*callback)(Args...)) |
Overload of Subscribe takes an object and pointer-to-member-function. More... | |
Static Public Member Functions | |
static ProjectAudioManager & | Get (AudacityProject &project) |
static const ProjectAudioManager & | Get (const AudacityProject &project) |
static WritableSampleTrackArray | ChooseExistingRecordingTracks (AudacityProject &proj, bool selectedOnly, double targetRate=RATE_NOT_SELECTED) |
Find suitable tracks to record into, or return an empty array. More... | |
static bool | UseDuplex () |
Private Member Functions | |
void | TogglePaused () |
void | SetPausedOff () |
void | SetAppending (bool value) |
void | SetLooping (bool value) |
void | SetCutting (bool value) |
void | SetStopping (bool value) |
void | CancelRecording () |
void | OnAudioIORate (int rate) override |
void | OnAudioIOStartRecording () override |
void | OnAudioIOStopRecording () override |
void | OnAudioIONewBlocks () override |
void | OnCommitRecording () override |
void | OnSoundActivationThreshold () override |
void | OnCheckpointFailure (ProjectFileIOMessage) |
Static Private Member Functions | |
static std::pair< TranslatableStrings, unsigned > | StatusWidthFunction (const AudacityProject &project, StatusBarField field) |
Private Attributes | |
Observer::Subscription | mCheckpointFailureSubscription |
AudacityProject & | mProject |
PlayMode | mLastPlayMode { PlayMode::normalPlay } |
bool | mTimerRecordCanceled { false } |
std::atomic< int > | mPaused { 0 } |
bool | mAppending { false } |
bool | mLooping { false } |
bool | mCutting { false } |
bool | mStopping { false } |
int | mDisplayedRate { 0 } |
Additional Inherited Members | |
Public Types inherited from Observer::Publisher< RecordingDropoutEvent > | |
using | message_type = RecordingDropoutEvent |
using | CallbackReturn = std::conditional_t< true, void, bool > |
using | Callback = std::function< CallbackReturn(const RecordingDropoutEvent &) > |
Type of functions that can be connected to the Publisher. More... | |
Static Public Attributes inherited from Observer::Publisher< RecordingDropoutEvent > | |
static constexpr bool | notifies_all |
Protected Member Functions inherited from Observer::Publisher< RecordingDropoutEvent > | |
CallbackReturn | Publish (const RecordingDropoutEvent &message) |
Send a message to connected callbacks. More... | |
Definition at line 60 of file ProjectAudioManager.h.
|
explicit |
Definition at line 69 of file ProjectAudioManager.cpp.
References ProjectFileIO::Get(), mCheckpointFailureSubscription, OnCheckpointFailure(), project, StatusWidthFunction(), and Observer::Publisher< Message, NotifyAll >::Subscribe().
|
delete |
|
overridedefault |
|
inline |
Definition at line 97 of file ProjectAudioManager.h.
|
private |
Definition at line 1065 of file ProjectAudioManager.cpp.
References PendingTracks::ClearPendingTracks(), PendingTracks::Get(), and project.
bool ProjectAudioManager::CanStopAudioStream | ( | ) | const |
Definition at line 1186 of file ProjectAudioManager.cpp.
References AudioIO::Get().
|
static |
Find suitable tracks to record into, or return an empty array.
Definition at line 561 of file ProjectAudioManager.cpp.
References AudioIORecordChannels, TrackList::Get(), Track::IsSelected(), WaveTrack::NChannels(), RATE_NOT_SELECTED, and Setting< T >::Read().
Referenced by anonymous_namespace{TransportMenus.cpp}::OnPunchAndRoll(), and anonymous_namespace{TimerRecordDialog.cpp}::OnTimerRecord().
|
inline |
Definition at line 100 of file ProjectAudioManager.h.
void ProjectAudioManager::DoPlayStopSelect | ( | ) |
Definition at line 1311 of file ProjectAudioManager.cpp.
References AudioIO::Get().
bool ProjectAudioManager::DoPlayStopSelect | ( | bool | click, |
bool | shift | ||
) |
Definition at line 1255 of file ProjectAudioManager.cpp.
References AudioIO::Get(), ProjectAudioIO::Get(), ProjectHistory::Get(), ViewInfo::Get(), Scrubber::Get(), ProjectAudioIO::GetAudioIOToken(), ProjectHistory::ModifyState(), and project.
Referenced by anonymous_namespace{TransportMenus.cpp}::OnPlayStopSelect().
bool ProjectAudioManager::DoRecord | ( | AudacityProject & | project, |
const TransportSequences & | transportSequences, | ||
double | t0, | ||
double | t1, | ||
bool | altAppearance, | ||
const AudioIOStartStreamOptions & | options | ||
) |
transportSequences | If captureSequences is empty, then tracks are created |
Definition at line 757 of file ProjectAudioManager.cpp.
References AlwaysEnabledFlag, Track::Any(), AudioIONotBusyFlag(), AudioIORecordChannels, BasicUI::CallAfter(), CanStopAudioStreamFlag(), TransportSequences::captureSequences, WaveTrack::CreateClip(), WaveTrackFactory::CreateMany(), AudioIO::Get(), TrackFocus::Get(), ProjectAudioIO::Get(), CommandManager::Get(), PendingTracks::Get(), TrackList::Get(), WaveTrackFactory::Get(), ChannelView::Get(), WaveTrack::GetDefaultAudioTrackNamePreference(), Track::GetName(), gPrefs, WaveTrack::HasClipNamed(), WaveTrack::Init(), WaveTrack::InsertInterval(), name, ChannelGroup::NChannels(), project, ProjectFramePlacement(), audacity::BasicSettings::Read(), Setting< T >::Read(), fast_float::round(), ProjectAudioIO::SetAudioIOToken(), ChannelView::SetMinimized(), BasicUI::ShowErrorDialog(), size, TracksPrefs::TracksFitVerticallyZoomed, CommandManager::TryToMakeActionAllowed(), updater, wxT(), XC, and XO().
Referenced by anonymous_namespace{TransportMenus.cpp}::OnPunchAndRoll().
|
static |
Definition at line 57 of file ProjectAudioManager.cpp.
References project, and sProjectAudioManagerKey.
Referenced by AdornedRulerPanel::ScrubbingHandle::Cancel(), CanStopAudioStreamFlag(), AdornedRulerPanel::ClearPlayRegion(), CloseButtonHandle::CommitChanges(), Scrubber::ContinueScrubbingUI(), CommandDispatch::DoAudacityCommand(), Scrubber::DoKeyboardScrub(), anonymous_namespace{TransportMenus.cpp}::DoMoveToLabel(), Scrubber::DoScrub(), TransportUtilities::DoStopPlaying(), anonymous_namespace{DropoutDetector.cpp}::DropoutSubscription::DropoutSubscription(), ControlToolBar::EnableDisableButtons(), Get(), Scrubber::MarkScrubStart(), Scrubber::MaybeStartScrubbing(), ProjectManager::New(), Scrubber::OnActivateOrDeactivateApp(), ProjectManager::OnCloseWindow(), ControlToolBar::OnFF(), ControlToolBar::OnIdle(), AudacityApp::OnKeyDown(), ControlToolBar::OnKeyEvent(), anonymous_namespace{TransportMenus.cpp}::OnPause(), ControlToolBar::OnPause(), ControlToolBar::OnPlay(), anonymous_namespace{TransportMenus.cpp}::OnPlayStopSelect(), anonymous_namespace{TransportMenus.cpp}::OnPunchAndRoll(), ControlToolBar::OnRecord(), ControlToolBar::OnRewind(), anonymous_namespace{TransportMenus.cpp}::OnStop(), ControlToolBar::OnStop(), MixerBoard::OnTimer(), PlayIndicatorOverlay::OnTimer(), TrackPanel::OnTimer(), anonymous_namespace{TimerRecordDialog.cpp}::OnTimerRecord(), TranscriptionToolBar::PlayAtSpeed(), TransportUtilities::PlayCurrentRegionAndWait(), ControlToolBar::PlayDefault(), TransportUtilities::PlayPlayRegionAndWait(), TransportUtilities::RecordAndWait(), TimerRecordDialog::RunWaitDialog(), Scrubber::StartKeyboardScrubbing(), AdornedRulerPanel::StartQPPlay(), ControlToolBar::StateForStatusBar(), StatusWidthFunction(), anonymous_namespace{DoEffect.cpp}::StopPlaybackCb(), and Scrubber::StopScrubbing().
|
static |
Definition at line 63 of file ProjectAudioManager.cpp.
References Get(), and project.
|
inline |
Definition at line 136 of file ProjectAudioManager.h.
Referenced by MixerBoard::OnTimer(), and PlayIndicatorOverlay::OnTimer().
|
inline |
Definition at line 82 of file ProjectAudioManager.h.
|
inline |
Definition at line 99 of file ProjectAudioManager.h.
|
overrideprivatevirtual |
Implements AudioIOListener.
Definition at line 1126 of file ProjectAudioManager.cpp.
References ProjectFileIO::Get(), and project.
|
overrideprivatevirtual |
Implements AudioIOListener.
Definition at line 1071 of file ProjectAudioManager.cpp.
References FormatRate(), ProjectStatus::Get(), project, RateStatusBarField(), and ProjectStatus::Set().
|
overrideprivatevirtual |
Implements AudioIOListener.
Definition at line 1082 of file ProjectAudioManager.cpp.
|
overrideprivatevirtual |
Implements AudioIOListener.
Definition at line 1089 of file ProjectAudioManager.cpp.
References AudioIO::Get(), ProjectAudioIO::Get(), ProjectFileIO::Get(), ProjectHistory::Get(), AudioIoCallback::HasRecordingException(), NOAUTOSAVE, NONE, project, and XO().
|
private |
Definition at line 1159 of file ProjectAudioManager.cpp.
References CheckpointFailure.
Referenced by ProjectAudioManager().
|
overrideprivatevirtual |
Implements AudioIOListener.
Definition at line 1134 of file ProjectAudioManager.cpp.
References PendingTracks::ApplyPendingTracks(), PendingTracks::Get(), and project.
void ProjectAudioManager::OnPause | ( | ) |
Definition at line 1010 of file ProjectAudioManager.cpp.
References AudioIO::Get(), Scrubber::Get(), ScrubState::IsScrubbing(), and project.
Referenced by anonymous_namespace{TransportMenus.cpp}::OnPause(), and ControlToolBar::OnPause().
void ProjectAudioManager::OnRecord | ( | bool | altAppearance | ) |
Definition at line 636 of file ProjectAudioManager.cpp.
References AudacityMessageBox(), TransportSequences::captureSequences, staffpad::vo::copy(), details::end(), ViewInfo::Get(), TrackList::Get(), ProjectAudioIO::GetDefaultOptions(), ChannelGroup::GetEndTime(), GetPropertiesOfSelected(), gPrefs, MakeTransportTracks(), TransportSequences::playbackSequences, PropertiesOfSelected::rateOfSelected, audacity::BasicSettings::Read(), TrackList::Selected(), ViewInfo::selectedRegion, NotifyingSelectedRegion::t0(), and XO().
Referenced by ControlToolBar::OnRecord(), and TimerRecordDialog::RunWaitDialog().
|
overrideprivatevirtual |
Implements AudioIOListener.
Definition at line 1140 of file ProjectAudioManager.cpp.
References AudioIO::Get(), and project.
|
delete |
bool ProjectAudioManager::Paused | ( | ) | const |
Definition at line 1059 of file ProjectAudioManager.cpp.
Referenced by Scrubber::OnActivateOrDeactivateApp().
void ProjectAudioManager::PlayCurrentRegion | ( | bool | newDefault = false , |
bool | cutpreview = false |
||
) |
newDefault | See ProjectAudioIO::GetDefaultOptions |
Definition at line 471 of file ProjectAudioManager.cpp.
References cutPreviewPlay, ViewInfo::Get(), ProjectAudioIO::GetDefaultOptions(), loopedPlay, normalPlay, and ViewInfo::playRegion.
Referenced by ControlToolBar::PlayDefault().
bool ProjectAudioManager::Playing | ( | ) | const |
Definition at line 1165 of file ProjectAudioManager.cpp.
References AudioIO::Get().
int ProjectAudioManager::PlayPlayRegion | ( | const SelectedRegion & | selectedRegion, |
const AudioIOStartStreamOptions & | options, | ||
PlayMode | playMode, | ||
bool | backwards = false |
||
) |
Definition at line 293 of file ProjectAudioManager.cpp.
References cutPreviewPlay, AudioIO::Get(), ProjectAudioIO::Get(), ViewInfo::Get(), TrackList::Get(), GetProjectFrame(), gPrefs, loopedPlay, MakeTransportTracks(), min(), AudioIOStartStreamOptions::playNonWaveTracks, AudioIOStartStreamOptions::policyFactory, ProjectFramePlacement(), AudioIOStartStreamOptions::pStartTime, audacity::BasicSettings::Read(), ViewInfo::selectedRegion, ProjectAudioIO::SetAudioIOToken(), BasicUI::ShowErrorDialog(), anonymous_namespace{NoteTrack.cpp}::swap(), SelectedRegion::t0(), SelectedRegion::t1(), tracks, wxT(), and XO().
Referenced by Scrubber::StartKeyboardScrubbing().
bool ProjectAudioManager::Recording | ( | ) | const |
Definition at line 1177 of file ProjectAudioManager.cpp.
References AudioIO::Get().
|
inline |
Definition at line 84 of file ProjectAudioManager.h.
|
inlineprivate |
Definition at line 143 of file ProjectAudioManager.h.
|
inlineprivate |
Definition at line 145 of file ProjectAudioManager.h.
|
inlineprivate |
Definition at line 144 of file ProjectAudioManager.h.
|
private |
Definition at line 1054 of file ProjectAudioManager.cpp.
|
inlineprivate |
Definition at line 146 of file ProjectAudioManager.h.
|
inline |
Definition at line 83 of file ProjectAudioManager.h.
Referenced by anonymous_namespace{TimerRecordDialog.cpp}::OnTimerRecord().
|
staticprivate |
Definition at line 90 of file ProjectAudioManager.cpp.
References field, FormatRate(), Get(), project, and RateStatusBarField().
Referenced by ProjectAudioManager().
void ProjectAudioManager::Stop | ( | bool | stopStream = true | ) |
Definition at line 501 of file ProjectAudioManager.cpp.
References AudioIO::Get(), ProjectAudioIO::Get(), Scrubber::Get(), and project.
Referenced by AdornedRulerPanel::ScrubbingHandle::Cancel(), AdornedRulerPanel::ClearPlayRegion(), CommandDispatch::DoAudacityCommand(), Scrubber::DoKeyboardScrub(), Scrubber::OnActivateOrDeactivateApp(), ProjectManager::OnCloseWindow(), AudacityApp::OnKeyDown(), anonymous_namespace{TransportMenus.cpp}::OnStop(), TimerRecordDialog::RunWaitDialog(), and anonymous_namespace{DoEffect.cpp}::StopPlaybackCb().
void ProjectAudioManager::StopIfPaused | ( | ) |
Definition at line 1249 of file ProjectAudioManager.cpp.
References AudioIOBase::Get().
Referenced by CloseButtonHandle::CommitChanges(), ControlToolBar::OnFF(), and ControlToolBar::OnRewind().
|
inline |
Definition at line 94 of file ProjectAudioManager.h.
|
private |
Definition at line 1049 of file ProjectAudioManager.cpp.
|
static |
Definition at line 750 of file ProjectAudioManager.cpp.
References gPrefs, audacity::BasicSettings::Read(), and wxT().
Referenced by anonymous_namespace{TransportMenus.cpp}::OnPunchAndRoll().
|
private |
Definition at line 173 of file ProjectAudioManager.h.
|
private |
Definition at line 161 of file ProjectAudioManager.h.
Referenced by ProjectAudioManager().
|
private |
Definition at line 175 of file ProjectAudioManager.h.
|
private |
Definition at line 178 of file ProjectAudioManager.h.
|
private |
Definition at line 164 of file ProjectAudioManager.h.
|
private |
Definition at line 174 of file ProjectAudioManager.h.
|
private |
Definition at line 171 of file ProjectAudioManager.h.
|
private |
Definition at line 162 of file ProjectAudioManager.h.
|
private |
Definition at line 176 of file ProjectAudioManager.h.
|
private |
Definition at line 167 of file ProjectAudioManager.h.