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 "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 > >
 
using StatusBarField = Identifier
 

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

◆ StatusBarField

Definition at line 43 of file ProjectAudioManager.h.

◆ 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 1195 of file ProjectAudioManager.cpp.

1195 { static ReservedCommandFlag flag{
1196 [](const AudacityProject &project){
1197 auto &projectAudioManager = ProjectAudioManager::Get( project );
1198 bool canStop = projectAudioManager.CanStopAudioStream();
1199 return canStop;
1200 }
1201 }; return flag; }
const auto project
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, ProjectAudioManager::Get(), and project.

Referenced by anonymous_namespace{SelectMenus.cpp}::CursorMenu(), ProjectAudioManager::DoRecord(), anonymous_namespace{TransportMenus.cpp}::ExtraTransportMenu(), anonymous_namespace{Scrubbing.cpp}::KeyboardScrubbingItems(), 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 1235 of file ProjectAudioManager.cpp.

1236{
1238 auto gAudioIO = AudioIO::Get();
1239 auto PlayAtSpeedRate = gAudioIO->GetBestRate(
1240 false, //not capturing
1241 true, //is playing
1242 ProjectRate::Get( project ).GetRate() //suggested rate
1243 );
1244 result.rate = PlayAtSpeedRate;
1245 return result;
1246}
static AudioIO * Get()
Definition: AudioIO.cpp:126
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
double GetRate(const Track &track)
Definition: TimeTrack.cpp:182

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

Referenced by Scrubber::StartKeyboardScrubbing().

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

◆ GetPropertiesOfSelected()

AUDACITY_DLL_API PropertiesOfSelected GetPropertiesOfSelected ( const AudacityProject proj)

Definition at line 1338 of file ProjectAudioManager.cpp.

1339{
1340 double rateOfSelection{ RATE_NOT_SELECTED };
1341
1342 PropertiesOfSelected result;
1343 result.allSameRate = true;
1344
1345 const auto selectedTracks{
1346 TrackList::Get(proj).Selected<const WaveTrack>() };
1347
1348 for (const auto & track : selectedTracks) {
1349 if (rateOfSelection != RATE_NOT_SELECTED &&
1350 track->GetRate() != rateOfSelection)
1351 result.allSameRate = false;
1352 else if (rateOfSelection == RATE_NOT_SELECTED)
1353 rateOfSelection = track->GetRate();
1354 }
1355
1356 result.anySelected = !selectedTracks.empty();
1357 result.rateOfSelected = rateOfSelection;
1358
1359 return result;
1360}
constexpr int RATE_NOT_SELECTED
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:967
A Track that contains audio waveform data.
Definition: WaveTrack.h:203

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

Referenced by anonymous_namespace{TransportMenus.cpp}::OnPunchAndRoll(), 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