Audacity 3.2.0
Classes | Typedefs | Enumerations | Functions | Variables
ProjectAudioManager.h File Reference
#include <memory>
#include <vector>
#include "AudioIOListener.h"
#include "ClientData.h"
#include "Observer.h"
#include <atomic>
#include "commands/CommandFlag.h"
Include dependency graph for ProjectAudioManager.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  RecordingDropoutEvent
 Notification, after recording has stopped, when dropouts have been detected. More...
 
class  ProjectAudioManager
 
struct  PropertiesOfSelected
 

Typedefs

using WritableSampleTrackArray = std::vector< std::shared_ptr< WritableSampleTrack > >
 

Enumerations

enum class  PlayMode : int { normalPlay , oneSecondPlay , loopedPlay , cutPreviewPlay }
 

Functions

AudioIOStartStreamOptions DefaultSpeedPlayOptions (AudacityProject &project)
 
AUDACITY_DLL_API PropertiesOfSelected GetPropertiesOfSelected (const AudacityProject &proj)
 
AUDACITY_DLL_API const ReservedCommandFlagCanStopAudioStreamFlag ()
 

Variables

constexpr int RATE_NOT_SELECTED { -1 }
 

Typedef Documentation

◆ WritableSampleTrackArray

using WritableSampleTrackArray = std::vector< std::shared_ptr< WritableSampleTrack > >

Definition at line 31 of file ProjectAudioManager.h.

Enumeration Type Documentation

◆ PlayMode

enum class PlayMode : int
strong
Enumerator
normalPlay 
oneSecondPlay 
loopedPlay 
cutPreviewPlay 

Definition at line 34 of file ProjectAudioManager.h.

34 : int {
36 oneSecondPlay, // Disables auto-scrolling
37 loopedPlay, // Possibly looped play (not always); disables auto-scrolling
39};
@ cutPreviewPlay

Function Documentation

◆ CanStopAudioStreamFlag()

AUDACITY_DLL_API const ReservedCommandFlag & CanStopAudioStreamFlag ( )

Definition at line 1150 of file ProjectAudioManager.cpp.

1150 { static ReservedCommandFlag flag{
1151 [](const AudacityProject &project){
1152 auto &projectAudioManager = ProjectAudioManager::Get( project );
1153 bool canStop = projectAudioManager.CanStopAudioStream();
1154 return canStop;
1155 }
1156 }; return flag; }
static std::once_flag flag
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
static ProjectAudioManager & Get(AudacityProject &project)

References flag, and ProjectAudioManager::Get().

Referenced by anonymous_namespace{SelectMenus.cpp}::CursorMenu(), ProjectAudioManager::DoRecord(), anonymous_namespace{TransportMenus.cpp}::ExtraTransportMenu(), and anonymous_namespace{TransportMenus.cpp}::TransportMenu().

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

◆ DefaultSpeedPlayOptions()

AudioIOStartStreamOptions DefaultSpeedPlayOptions ( AudacityProject project)

Definition at line 1190 of file ProjectAudioManager.cpp.

1191{
1192 auto result = ProjectAudioIO::GetDefaultOptions( project );
1193 auto gAudioIO = AudioIO::Get();
1194 auto PlayAtSpeedRate = gAudioIO->GetBestRate(
1195 false, //not capturing
1196 true, //is playing
1197 ProjectRate::Get( project ).GetRate() //suggested rate
1198 );
1199 result.rate = PlayAtSpeedRate;
1200 return result;
1201}
static AudioIO * Get()
Definition: AudioIO.cpp:147
static AudioIOStartStreamOptions GetDefaultOptions(AudacityProject &project, bool newDefaults=false)
Invoke the global hook, supplying a default argument.
static ProjectRate & Get(AudacityProject &project)
Definition: ProjectRate.cpp:28

References AudioIO::Get(), ProjectRate::Get(), ProjectAudioIO::GetDefaultOptions(), and anonymous_namespace{TimeTrack.cpp}::GetRate().

Here is the call graph for this function:

◆ GetPropertiesOfSelected()

AUDACITY_DLL_API PropertiesOfSelected GetPropertiesOfSelected ( const AudacityProject proj)

Definition at line 1293 of file ProjectAudioManager.cpp.

1294{
1295 double rateOfSelection{ RATE_NOT_SELECTED };
1296
1297 PropertiesOfSelected result;
1298 result.allSameRate = true;
1299
1300 const auto selectedTracks{
1301 TrackList::Get(proj).Selected< const WaveTrack >() };
1302
1303 for (const auto & track : selectedTracks)
1304 {
1305 if (rateOfSelection != RATE_NOT_SELECTED &&
1306 track->GetRate() != rateOfSelection)
1307 result.allSameRate = false;
1308 else if (rateOfSelection == RATE_NOT_SELECTED)
1309 rateOfSelection = track->GetRate();
1310 }
1311
1312 result.numberOfSelected = selectedTracks.size();
1313 result.rateOfSelected = rateOfSelection;
1314
1315 return result;
1316}
constexpr int RATE_NOT_SELECTED
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:486
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:1454
A Track that contains audio waveform data.
Definition: WaveTrack.h:57

References PropertiesOfSelected::allSameRate, TrackList::Get(), PropertiesOfSelected::numberOfSelected, RATE_NOT_SELECTED, PropertiesOfSelected::rateOfSelected, and TrackList::Selected().

Referenced by ProjectAudioManager::OnRecord(), and anonymous_namespace{TimerRecordDialog.cpp}::OnTimerRecord().

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

Variable Documentation

◆ RATE_NOT_SELECTED

constexpr int RATE_NOT_SELECTED { -1 }
constexpr