mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-20 17:41:13 +02:00
Move members from ControlToolBar into class ProjectAudioManager...
... and ControlToolBar is included in fewer places
This commit is contained in:
@@ -11,11 +11,28 @@ Paul Licameli split from ProjectManager.h
|
||||
#ifndef __AUDACITY_PROJECT_AUDIO_MANAGER__
|
||||
#define __AUDACITY_PROJECT_AUDIO_MANAGER__
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "AudioIOListener.h" // to inherit
|
||||
#include "ClientData.h" // to inherit
|
||||
|
||||
class AudacityProject;
|
||||
struct AudioIOStartStreamOptions;
|
||||
class TrackList;
|
||||
class SelectedRegion;
|
||||
|
||||
class WaveTrack;
|
||||
using WaveTrackArray = std::vector < std::shared_ptr < WaveTrack > >;
|
||||
|
||||
enum class PlayMode : int {
|
||||
normalPlay,
|
||||
oneSecondPlay, // Disables auto-scrolling
|
||||
loopedPlay, // Disables auto-scrolling
|
||||
cutPreviewPlay
|
||||
};
|
||||
|
||||
struct TransportTracks;
|
||||
|
||||
enum StatusBarField : int;
|
||||
|
||||
@@ -28,6 +45,15 @@ public:
|
||||
static ProjectAudioManager &Get( AudacityProject &project );
|
||||
static const ProjectAudioManager &Get( const AudacityProject &project );
|
||||
|
||||
// Find suitable tracks to record into, or return an empty array.
|
||||
static WaveTrackArray ChooseExistingRecordingTracks(
|
||||
AudacityProject &proj, bool selectedOnly);
|
||||
|
||||
static bool UseDuplex();
|
||||
|
||||
static TransportTracks GetAllPlaybackTracks(
|
||||
TrackList &trackList, bool selectedOnly, bool useMidi = false);
|
||||
|
||||
explicit ProjectAudioManager( AudacityProject &project );
|
||||
ProjectAudioManager( const ProjectAudioManager & ) PROHIBITED;
|
||||
ProjectAudioManager &operator=( const ProjectAudioManager & ) PROHIBITED;
|
||||
@@ -52,16 +78,52 @@ public:
|
||||
bool Looping() const { return mLooping; }
|
||||
bool Cutting() const { return mCutting; }
|
||||
|
||||
// A project is only allowed to stop an audio stream that it owns.
|
||||
bool CanStopAudioStream () const;
|
||||
|
||||
void OnRecord(bool altAppearance);
|
||||
|
||||
bool DoRecord(AudacityProject &project,
|
||||
const TransportTracks &transportTracks, // If captureTracks is empty, then tracks are created
|
||||
double t0, double t1,
|
||||
bool altAppearance,
|
||||
const AudioIOStartStreamOptions &options);
|
||||
|
||||
int PlayPlayRegion(const SelectedRegion &selectedRegion,
|
||||
const AudioIOStartStreamOptions &options,
|
||||
PlayMode playMode,
|
||||
bool backwards = false,
|
||||
// Allow t0 and t1 to be beyond end of tracks
|
||||
bool playWhiteSpace = false);
|
||||
|
||||
// Play currently selected region, or if nothing selected,
|
||||
// play from current cursor.
|
||||
void PlayCurrentRegion(bool looped = false, bool cutpreview = false);
|
||||
|
||||
void OnPause();
|
||||
|
||||
// Pause - used by AudioIO to pause sound activate recording
|
||||
void Pause();
|
||||
|
||||
// Stop playing or recording
|
||||
void Stop(bool stopStream = true);
|
||||
|
||||
PlayMode GetLastPlayMode() const { return mLastPlayMode; }
|
||||
|
||||
private:
|
||||
void SetPaused( bool value ) { mPaused = value; }
|
||||
void SetAppending( bool value ) { mAppending = value; }
|
||||
void SetLooping( bool value ) { mLooping = value; }
|
||||
void SetCutting( bool value ) { mCutting = value; }
|
||||
void SetStopping( bool value ) { mStopping = value; }
|
||||
|
||||
// A project is only allowed to stop an audio stream that it owns.
|
||||
bool CanStopAudioStream () const;
|
||||
void SetupCutPreviewTracks(double playStart, double cutStart,
|
||||
double cutEnd, double playEnd);
|
||||
void ClearCutPreviewTracks();
|
||||
|
||||
// Cancel the addition of temporary recording tracks into the project
|
||||
void CancelRecording();
|
||||
|
||||
private:
|
||||
// Audio IO callback methods
|
||||
void OnAudioIORate(int rate) override;
|
||||
void OnAudioIOStartRecording() override;
|
||||
@@ -72,6 +134,10 @@ private:
|
||||
|
||||
AudacityProject &mProject;
|
||||
|
||||
std::shared_ptr<TrackList> mCutPreviewTracks;
|
||||
|
||||
PlayMode mLastPlayMode{ PlayMode::normalPlay };
|
||||
|
||||
//flag for cancellation of timer record.
|
||||
bool mTimerRecordCanceled{ false };
|
||||
|
||||
|
Reference in New Issue
Block a user