Audacity  2.2.0
Project.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  Project.h
6 
7  Dominic Mazzoni
8 
9  In Audacity, the main window you work in is called a project.
10  Projects can contain an arbitrary number of tracks of many
11  different types, but if a project contains just one or two
12  tracks then it can be saved in standard formats like WAV or AIFF.
13  This window is the one that contains the menu bar (except on
14  the Mac).
15 
16 **********************************************************************/
17 
18 #ifndef __AUDACITY_PROJECT__
19 #define __AUDACITY_PROJECT__
20 
21 #include "Audacity.h"
22 #include "Experimental.h"
23 
24 #include "widgets/OverlayPanel.h"
25 
26 #include "DirManager.h"
27 #include "SelectionState.h"
28 #include "ViewInfo.h"
29 #include "TrackPanelListener.h"
30 #include "AudioIOListener.h"
33 #include "xml/XMLTagHandler.h"
36 
37 #include "MemoryX.h"
38 #include <wx/defs.h>
39 #include <wx/event.h>
40 #include <wx/log.h>
41 #include <wx/dragimag.h>
42 #include <wx/generic/dragimgg.h>
43 #include <wx/frame.h>
44 #include <wx/intl.h>
45 #include <wx/dcclient.h>
46 
47 #include "import/ImportRaw.h" // defines TrackHolders
48 
49 const int AudacityProjectTimerID = 5200;
50 
51 class wxWindow;
52 class wxDialog;
53 class wxBoxSizer;
54 class wxScrollEvent;
55 class wxScrollBar;
56 class wxPanel;
57 class wxTimerEvent;
58 
59 class AudacityProject;
60 class AutoSaveFile;
61 class Importer;
62 class ODLock;
64 class TrackList;
65 class Tags;
66 class EffectPlugs;
67 
68 class TrackPanel;
69 class FreqWindow;
70 class ContrastDialog;
71 class Meter;
72 
73 // toolbar classes
74 class ControlToolBar;
76 class EditToolBar;
77 class MeterToolBar;
78 class MixerToolBar;
79 class Scrubber;
80 class ScrubbingToolBar;
81 class SelectionBar;
83 class ToolManager;
84 class ToolsToolBar;
86 
87 // windows and frames
88 class AdornedRulerPanel;
89 class HistoryWindow;
90 class LyricsWindow;
91 class MixerBoard;
92 class MixerBoardFrame;
93 
95 struct UndoState;
96 
97 class Regions;
98 
99 class LWSlider;
101 enum class UndoPush : unsigned char;
102 
103 class Track;
104 class WaveClip;
105 class BackgroundCell;
106 
108 AUDACITY_DLL_API AudacityProject *GetActiveProject();
109 void RedrawAllProjects();
111 AUDACITY_DLL_API void CloseAllProjects();
112 
113 void GetDefaultWindowRect(wxRect *defRect);
114 void GetNextWindowPlacement(wxRect *nextRect, bool *pMaximized, bool *pIconized);
115 bool IsWindowAccessible(wxRect *requestedRect);
116 
117 // Use shared_ptr to projects, because elsewhere we need weak_ptr
118 using AProjectHolder = std::shared_ptr< AudacityProject >;
119 using AProjectArray = std::vector< AProjectHolder >;
120 
122 
123 
124 WX_DEFINE_ARRAY(wxMenu *, MenuArray);
125 
126 enum class PlayMode : int {
127  normalPlay,
128  oneSecondPlay, // Disables auto-scrolling
129  loopedPlay // Disables auto-scrolling
130 };
131 
136 };
137 
141 DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_CAPTURE_KEY, -1);
142 
143 // XML handler for <import> tag
144 class ImportXMLTagHandler final : public XMLTagHandler
145 {
146  public:
147  ImportXMLTagHandler(AudacityProject* pProject) { mProject = pProject; }
148 
149  bool HandleXMLTag(const wxChar *tag, const wxChar **attrs) override;
150  XMLTagHandler *HandleXMLChild(const wxChar * WXUNUSED(tag)) override
151  { return NULL; }
152 
153  // Don't want a WriteXML method because ImportXMLTagHandler is not a WaveTrack.
154  // <import> tags are instead written by AudacityProject::WriteXML.
155  // void WriteXML(XMLWriter &xmlFile) /* not override */ { wxASSERT(false); }
156 
157  private:
159 };
160 
161 class AUDACITY_DLL_API AudacityProject final : public wxFrame,
162  public TrackPanelListener,
163  public SelectionBarListener,
165  public XMLTagHandler,
166  public AudioIOListener
167 {
168  public:
169  AudacityProject(wxWindow * parent, wxWindowID id,
170  const wxPoint & pos, const wxSize & size);
171  virtual ~AudacityProject();
173  virtual void ApplyUpdatedTheme();
174 
175  AudioIOStartStreamOptions GetDefaultPlayOptions();
176 
177  TrackList *GetTracks() { return mTracks.get(); }
178  const TrackList *GetTracks() const { return mTracks.get(); }
179  UndoManager *GetUndoManager() { return mUndoManager.get(); }
180 
181  sampleFormat GetDefaultFormat() { return mDefaultFormat; }
182 
183  double GetRate() const { return mRate; }
184  bool ZoomInAvailable() const { return mViewInfo.ZoomInAvailable(); }
185  bool ZoomOutAvailable() const { return mViewInfo.ZoomOutAvailable(); }
186  const SelectedRegion &GetSelection() const { return mViewInfo.selectedRegion; }
187  SelectedRegion &GetSelection() { return mViewInfo.selectedRegion; }
188  double GetSel0() const { return mViewInfo.selectedRegion.t0(); }
189  double GetSel1() const { return mViewInfo.selectedRegion.t1(); }
190  const ZoomInfo &GetZoomInfo() const { return mViewInfo; }
191  const ViewInfo &GetViewInfo() const { return mViewInfo; }
192  ViewInfo &GetViewInfo() { return mViewInfo; }
193 
194  std::shared_ptr<Track> GetFirstVisible();
195 
196  void GetPlayRegion(double* playRegionStart, double *playRegionEnd);
197  bool IsPlayRegionLocked() { return mLockPlayRegion; }
198 
199  void SetSel0(double); //Added by STM
200  void SetSel1(double); //Added by STM
201 
202  bool Clipboard() { return (msClipT1 - msClipT0) > 0.0; }
203 
204  wxString GetName();
205  const std::shared_ptr<DirManager> &GetDirManager();
206  TrackFactory *GetTrackFactory();
207  AdornedRulerPanel *GetRulerPanel();
208  const Tags *GetTags();
209  int GetAudioIOToken() const;
210  bool IsAudioActive() const;
211  void SetAudioIOToken(int token);
213  bool IsActive();
214 
215  // File I/O
216 
244  static wxArrayString ShowOpenDialog(const wxString &extraformat = wxEmptyString,
245  const wxString &extrafilter = wxEmptyString);
246  static bool IsAlreadyOpen(const wxString & projPathName);
247  static void OpenFiles(AudacityProject *proj);
248 
249  // Return the given project if that is not NULL, else create a project.
250  // Then open the given project path.
251  // But if an exception escapes this function, create no NEW project.
252  static AudacityProject *OpenProject(
253  AudacityProject *pProject,
254  const wxString &fileNameArg, bool addtohistory = true);
255 
256  void OpenFile(const wxString &fileName, bool addtohistory = true);
257 
258 private:
259  void EnqueueODTasks();
260 
261 public:
262  bool WarnOfLegacyFile( );
263 
264  // If pNewTrackList is passed in non-NULL, it gets filled with the pointers to NEW tracks.
265  bool Import(const wxString &fileName, WaveTrackArray *pTrackArray = NULL);
266 
267  void ZoomAfterImport(Track *pTrack);
268 
269  void AddImportedTracks(const wxString &fileName,
270  TrackHolders &&newTracks);
271 
272  bool Save(bool overwrite = true, bool fromSaveAs = false, bool bWantSaveCompressed = false);
273  bool SaveAs(bool bWantSaveCompressed = false);
274  bool SaveAs(const wxString & newFileName, bool bWantSaveCompressed = false, bool addToHistory = true);
275  #ifdef USE_LIBVORBIS
276  bool SaveCompressedWaveTracks(const wxString & strProjectPathName); // full path for aup except extension
277  #endif
278  void Clear();
279 
280  const wxString &GetFileName() { return mFileName; }
281  bool GetDirty() { return mDirty; }
282  void SetProjectTitle( int number =-1);
283 
284  wxPanel *GetTopPanel() { return mTopPanel; }
285  TrackPanel * GetTrackPanel() {return mTrackPanel;}
286  const TrackPanel * GetTrackPanel() const {return mTrackPanel;}
287  SelectionState &GetSelectionState() { return mSelectionState; }
288 
289  bool GetIsEmpty();
290 
291  bool GetTracksFitVerticallyZoomed() { return mTracksFitVerticallyZoomed; } //lda
292  void SetTracksFitVerticallyZoomed(bool flag) { mTracksFitVerticallyZoomed = flag; } //lda
293 
294  bool GetShowId3Dialog() { return mShowId3Dialog; } //lda
295  void SetShowId3Dialog(bool flag) { mShowId3Dialog = flag; } //lda
296 
297  bool GetNormalizeOnLoad() { return mNormalizeOnLoad; } //lda
298  void SetNormalizeOnLoad(bool flag) { mNormalizeOnLoad = flag; } //lda
303  void SetMissingAliasFileDialog(wxDialog *dialog);
304 
307  wxDialog *GetMissingAliasFileDialog();
308 
309  // Timer Record Auto Save/Export Routines
310  bool SaveFromTimerRecording(wxFileName fnFile);
311  bool ExportFromTimerRecording(wxFileName fnFile, int iFormat, int iSubFormat, int iFilterIndex);
312  int GetOpenProjectCount();
313  bool IsProjectSaved();
315  bool ProjectHasTracks();
317  // Routine to estimate how many minutes of recording time are left on disk
318  int GetEstimatedRecordingMinsLeftOnDisk(long lCaptureChannels = 0);
319  // Converts number of minutes to human readable format
320  wxString GetHoursMinsString(int iMinutes);
321 
322 #include "Menus.h"
323 
324  CommandManager *GetCommandManager() { return &mCommandManager; }
325  const CommandManager *GetCommandManager() const { return &mCommandManager; }
326 
327  // Keyboard capture
328  static bool HasKeyboardCapture(const wxWindow *handler);
329  static wxWindow *GetKeyboardCaptureHandler();
330  static void CaptureKeyboard(wxWindow *handler);
331  static void ReleaseKeyboard(wxWindow *handler);
332 
333  void RebuildMenuBar();
334  void RebuildOtherMenus();
335  void MayStartMonitoring();
336 
337 
338  // Message Handlers
339 
340  void OnMenu(wxCommandEvent & event);
341  void OnUpdateUI(wxUpdateUIEvent & event);
342 
343  void MacShowUndockedToolbars(bool show);
344  void OnActivate(wxActivateEvent & event);
345 
346  void OnMouseEvent(wxMouseEvent & event);
347  void OnIconize(wxIconizeEvent &event);
348  void OnSize(wxSizeEvent & event);
349  void OnShow(wxShowEvent & event);
350  void OnMove(wxMoveEvent & event);
351  void DoScroll();
352  void OnScroll(wxScrollEvent & event);
353  void OnCloseWindow(wxCloseEvent & event);
354  void OnTimer(wxTimerEvent & event);
355  void OnToolBarUpdate(wxCommandEvent & event);
356  void OnOpenAudioFile(wxCommandEvent & event);
357  void OnODTaskUpdate(wxCommandEvent & event);
358  void OnODTaskComplete(wxCommandEvent & event);
359 
360  void HandleResize();
361  void UpdateLayout();
362  double GetScreenEndTime() const;
363  void ZoomInByFactor( double ZoomFactor );
364  void ZoomOutByFactor( double ZoomFactor );
365 
366  // Other commands
367  static TrackList *GetClipboardTracks();
368  static void ClearClipboard();
369  static void DeleteClipboard();
370 
371  int GetProjectNumber(){ return mProjectNo;};
372  static int CountUnnamed();
373  static void RefreshAllTitles(bool bShowProjectNumbers );
374  // checkActive is a temporary hack that should be removed as soon as we
375  // get multiple effect preview working
376  void UpdateMenus(bool checkActive = true);
377  void UpdatePrefs();
378  void UpdatePrefsVariables();
379  void RedrawProject(const bool bForceWaveTracks = false);
380  void RefreshCursor();
381  void SelectNone();
382  void SelectAllIfNone();
383  void StopIfPaused();
384  void Zoom(double level);
385  void ZoomBy(double multiplier);
386  void Rewind(bool shift);
387  void SkipEnd(bool shift);
388 
389 
390  typedef void (WaveTrack::* EditFunction)(double, double);
391  typedef std::unique_ptr<Track> (WaveTrack::* EditDestFunction)(double, double);
392 
393  void EditByLabel(EditFunction action, bool bSyncLockedTracks);
394  void EditClipboardByLabel(EditDestFunction action );
395 
396  bool IsSyncLocked();
397  void SetSyncLock(bool flag);
398 
399  void DoTrackMute(Track *pTrack, bool exclusive);
400  void DoTrackSolo(Track *pTrack, bool exclusive);
401  void SetTrackGain(WaveTrack * track, LWSlider * slider);
402  void SetTrackPan(WaveTrack * track, LWSlider * slider);
403 
404  void RemoveTrack(Track * toRemove);
405 
406  // "exclusive" mute means mute the chosen track and unmute all others.
407  void HandleTrackMute(Track *t, const bool exclusive);
408 
409  // Type of solo (standard or simple) follows the set preference, unless
410  // alternate == true, which causes the opposite behavior.
411  void HandleTrackSolo(Track *t, const bool alternate);
412 
413  // Snap To
415  void SetSnapTo(int snap);
416  int GetSnapTo() const;
417 
418  // Selection Format
419 
420  void SetSelectionFormat(const wxString & format);
421  const wxString & GetSelectionFormat() const;
422 
423  // Spectral Selection Formats
424 
425  void SetFrequencySelectionFormatName(const wxString & format);
426  const wxString & GetFrequencySelectionFormatName() const;
428  void SetBandwidthSelectionFormatName(const wxString & format);
429  const wxString & GetBandwidthSelectionFormatName() const;
431  // Scrollbars
433  void OnScrollLeft();
434  void OnScrollRight();
435 
436  void OnScrollLeftButton(wxScrollEvent & event);
437  void OnScrollRightButton(wxScrollEvent & event);
438 
439  void FinishAutoScroll();
440  void FixScrollbars();
441 
442  void SafeDisplayStatusMessage(const wxChar *msg);
443 
444  bool MayScrollBeyondZero() const;
445  double ScrollingLowerBoundTime() const;
446  // How many pixels are covered by the period from lowermost scrollable time, to the given time:
447  // PRL: Bug1197: we seem to need to compute all in double, to avoid differing results on Mac
448  double PixelWidthBeforeTime(double scrollto) const;
449  void SetHorizontalThumb(double scrollto);
451  // PRL: old and incorrect comment below, these functions are used elsewhere than TrackPanel
452  // TrackPanel access
453  wxSize GetTPTracksUsableArea() /* not override */;
454  void RefreshTPTrack(Track* pTrk, bool refreshbacking = true) /* not override */;
455 
456  // TrackPanel callback methods, overrides of TrackPanelListener
457  void TP_DisplaySelection() override;
458  void TP_DisplayStatusMessage(const wxString &msg) override;
459 
460  ToolsToolBar * TP_GetToolsToolBar() override;
461 
462  void TP_PushState(const wxString &longDesc, const wxString &shortDesc,
463  UndoPush flags) override;
464  void TP_ModifyState(bool bWantsAutoSave) override; // if true, writes auto-save file. Should set only if you really want the state change restored after
465  // a crash, as it can take many seconds for large (eg. 10 track-hours) projects
466  void TP_RedrawScrollbars() override;
467  void TP_ScrollLeft() override;
468  void TP_ScrollRight() override;
469  void TP_ScrollWindow(double scrollto) override;
470  bool TP_ScrollUpDown(int delta) override;
471  void TP_HandleResize() override;
472 
473  // ToolBar
474 
475  // In the GUI, ControlToolBar appears as the "Transport Toolbar". "Control Toolbar" is historic.
476  ControlToolBar *GetControlToolBar();
478  DeviceToolBar *GetDeviceToolBar();
479  EditToolBar *GetEditToolBar();
480  MixerToolBar *GetMixerToolBar();
481  ScrubbingToolBar *GetScrubbingToolBar();
482  SelectionBar *GetSelectionBar();
483 #ifdef EXPERIMENTAL_SPECTRAL_EDITING
484  SpectralSelectionBar *GetSpectralSelectionBar();
485 #endif
486  ToolsToolBar *GetToolsToolBar();
487  const ToolsToolBar *GetToolsToolBar() const;
488  TranscriptionToolBar *GetTranscriptionToolBar();
489 
490  Meter *GetPlaybackMeter();
491  void SetPlaybackMeter(Meter *playback);
492  Meter *GetCaptureMeter();
493  void SetCaptureMeter(Meter *capture);
494 
495  LyricsWindow* GetLyricsWindow() { return mLyricsWindow; }
496  MixerBoard* GetMixerBoard() { return mMixerBoard; }
497 
498  wxStatusBar* GetStatusBar() { return mStatusBar; }
499 
500 private:
501  bool SnapSelection();
502 
503 public:
504  // SelectionBarListener callback methods
505 
506  double AS_GetRate() override;
507  void AS_SetRate(double rate) override;
508  int AS_GetSnapTo() override;
509  void AS_SetSnapTo(int snap) override;
510  const wxString & AS_GetSelectionFormat() override;
511  void AS_SetSelectionFormat(const wxString & format) override;
512  void AS_ModifySelection(double &start, double &end, bool done) override;
513 
514  // SpectralSelectionBarListener callback methods
515 
516  double SSBL_GetRate() const override;
517 
518  const wxString & SSBL_GetFrequencySelectionFormatName() override;
519  void SSBL_SetFrequencySelectionFormatName(const wxString & formatName) override;
520 
521  const wxString & SSBL_GetBandwidthSelectionFormatName() override;
522  void SSBL_SetBandwidthSelectionFormatName(const wxString & formatName) override;
523 
524  void SSBL_ModifySpectralSelection(double &bottom, double &top, bool done) override;
525 
526  void SetStateTo(unsigned int n);
527 
528  // XMLTagHandler callback methods
529 
530  bool HandleXMLTag(const wxChar *tag, const wxChar **attrs) override;
531  XMLTagHandler *HandleXMLChild(const wxChar *tag) override;
532  void WriteXML(
533  XMLWriter &xmlFile, bool bWantSaveCompressed) /* not override */;
534 
535  void WriteXMLHeader(XMLWriter &xmlFile) const;
536 
537  PlayMode mLastPlayMode{ PlayMode::normalPlay };
539 
540  // Audio IO callback methods
541  void OnAudioIORate(int rate) override;
542  void OnAudioIOStartRecording() override;
543  void OnAudioIOStopRecording() override;
544  void OnAudioIONewBlockFiles(const AutoSaveFile & blockFileLog) override;
545 
546  // Command Handling
547  bool ReportIfActionNotAllowed
548  ( const wxString & Name, CommandFlag & flags, CommandFlag flagsRqd, CommandFlag mask );
549  bool TryToMakeActionAllowed
550  ( CommandFlag & flags, CommandFlag flagsRqd, CommandFlag mask );
551 
552  void PushState(const wxString &desc, const wxString &shortDesc); // use UndoPush::AUTOSAVE
553  void PushState(const wxString &desc, const wxString &shortDesc, UndoPush flags);
554  void RollbackState();
555 
556 
557  private:
558 
559  void OnCapture(wxCommandEvent & evt);
560  void InitialState();
561 
562  public:
563  void ModifyState(bool bWantsAutoSave); // if true, writes auto-save file. Should set only if you really want the state change restored after
564  // a crash, as it can take many seconds for large (eg. 10 track-hours) projects
565  void RecreateMixerBoard();
566 
567  private:
568  void PopState(const UndoState &state);
569 
570  void UpdateLyrics();
571  void UpdateMixerBoard();
572 
573  void GetRegionsByLabel( Regions &regions );
574 
575  void AutoSave();
576  void DeleteCurrentAutoSaveFile();
577 
578  public:
579  bool IsSoloSimple() const { return mSoloPref == wxT("Simple"); }
580  bool IsSoloNone() const { return mSoloPref == wxT("None"); }
581 
582  private:
583 
584  // The project's name and file info
585  wxString mFileName;
587  std::shared_ptr<DirManager> mDirManager; // MM: DirManager now created dynamically
588 
589  static int mProjectCounter;// global counter.
590  int mProjectNo; // count when this project was created.
591 
592  double mRate;
593  sampleFormat mDefaultFormat;
594 
595  // Recent files
597 
598  // Tags (artist name, song properties, MP3 ID3 info, etc.)
599  // The structure may be shared with undo history entries
600  // To keep undo working correctly, always replace this with a NEW duplicate
601  // BEFORE doing any editing of it!
602  std::shared_ptr<Tags> mTags;
603 
604  // List of tracks and display info
605  std::shared_ptr<TrackList> mTracks;
606 
607  int mSnapTo;
611 
612  std::shared_ptr<TrackList> mLastSavedTracks;
613 
614  // Clipboard (static because it is shared by all projects)
615  static std::shared_ptr<TrackList> msClipboard;
617  static double msClipT0;
618  static double msClipT1;
619 
620 public:
622  //shared by all projects
623  static ODLock &AllProjectDeleteMutex();
624 
625 private:
626  // History/Undo manager
627  std::unique_ptr<UndoManager> mUndoManager;
628  bool mDirty{ false };
629 
630  // Commands
631 
633 
635 
636  // Window elements
637 
638  std::unique_ptr<wxTimer> mTimer;
640 
641  wxStatusBar *mStatusBar;
642 
643  AdornedRulerPanel *mRuler{};
644  wxPanel *mTopPanel{};
645  TrackPanel *mTrackPanel{};
646  SelectionState mSelectionState{};
647  bool mCircularTrackNavigation{};
648  std::unique_ptr<TrackFactory> mTrackFactory{};
649  wxPanel * mMainPanel;
650  wxScrollBar *mHsbar;
651  wxScrollBar *mVsbar;
652  bool mAutoScrolling{ false };
653  bool mActive{ true };
654  bool mIconized;
655 
656  HistoryWindow *mHistoryWindow{};
657  LyricsWindow* mLyricsWindow{};
658  MixerBoardFrame* mMixerBoardFrame{};
659  MixerBoard* mMixerBoard{};
660 
663 
664  // dialog for missing alias warnings
665  wxDialog *mAliasMissingWarningDialog{};
666 
667  bool mShownOnce{ false };
668 
669  // Project owned meters
670  Meter *mPlaybackMeter{};
671  Meter *mCaptureMeter{};
672 
673  std::unique_ptr<ToolManager> mToolManager;
674 
675  public:
676  ToolManager *GetToolManager() { return mToolManager.get(); }
678  wxString mHelpPref;
679  wxString mSoloPref;
680  bool mbBusyImporting{ false }; // used to fix bug 584
681 
682  void SetNormalizedWindowState(wxRect pSizeAndLocation) { mNormalizedWindowState = pSizeAndLocation; }
683  wxRect GetNormalizedWindowState() const { return mNormalizedWindowState; }
684 
685  bool IsTimerRecordCancelled(){return mTimerRecordCanceled;}
686  void ResetTimerRecordFlag(){mTimerRecordCanceled=false;}
687  private:
688  //sort method used by OnSortName and OnSortTime
689  //currently only supported flags are kAudacitySortByName and kAudacitySortByName
690  //in the future we might have 0x01 as sort ascending and we can bit or it
691 #define kAudacitySortByTime (1 << 1)
692 #define kAudacitySortByName (1 << 2)
693  void SortTracks(int flags);
694 
695  int mAudioIOToken{ -1 };
696 
697  bool mIsDeleting{ false };
698  bool mTracksFitVerticallyZoomed{ false }; //lda
699  bool mNormalizeOnLoad; //lda
700  bool mShowId3Dialog{ true }; //lda
702 
703  // 0 is grey out, 1 is Autoselect, 2 is Give warnings.
706 
708 
710 
711  std::unique_ptr<ImportXMLTagHandler> mImportXMLTagHandler;
712 
713  // Last auto-save file name and path (empty if none)
715 
716  // Are we currently auto-saving or not?
717  bool mAutoSaving{ false };
718 
719  // Has this project been recovered from an auto-saved version
720  bool mIsRecovered{ false };
721 
722  // The auto-save data dir the project has been recovered from
724 
725  // The handler that handles recovery of <recordingrecovery> tags
726  std::unique_ptr<RecordingRecoveryHandler> mRecordingRecoveryHandler;
727 
728  // Dependencies have been imported and a warning should be shown on save
729  bool mImportedDependencies{ false };
730 
731  wxArrayString mStrOtherNamesArray; // used to make sure compressed file names are unique
732 
733  // Last effect applied to this project
734  PluginID mLastEffect{};
735 
737 
738  //flag for cancellation of timer record.
739  bool mTimerRecordCanceled{ false };
740 
741  // Are we currently closing as the result of a menu command?
742  bool mMenuClose{ false };
743 
744  bool mbInitializingScrollbar{ false };
745 
746  // Flag that we're recoding.
747  bool mIsCapturing{ false };
748 
749  // Keyboard capture
750  wxWindow *mKeyboardCaptureHandler{};
751 
752  double mSeekShort;
753  double mSeekLong;
754 
756 
757  // See explanation in OnCloseWindow
758  bool mIsBeingDeleted{ false };
759 
760  // CommandManager needs to use private methods
761  friend class CommandManager;
762 
763  // TrackPanelOverlay objects
764  std::unique_ptr<Overlay>
765  mIndicatorOverlay, mCursorOverlay;
766 
767  std::shared_ptr<BackgroundCell> mBackgroundCell;
768 
769 #ifdef EXPERIMENTAL_SCRUBBING_BASIC
770  std::unique_ptr<Overlay> mScrubOverlay;
771  std::unique_ptr<Scrubber> mScrubber;
772 public:
773  Scrubber &GetScrubber() { return *mScrubber; }
774  const Scrubber &GetScrubber() const { return *mScrubber; }
775 #endif
776 
777  class PlaybackScroller final : public wxEvtHandler
778  {
779  public:
780  explicit PlaybackScroller(AudacityProject *project);
781  ~PlaybackScroller();
782 
783  enum class Mode {
784  Off,
785  Refresh,
786  Centered,
787  Right,
788  };
789 
790  Mode GetMode() const { return mMode; }
791  void Activate(Mode mode)
792  {
793  mMode = mode;
794  }
795 
796  private:
797  void OnTimer(wxCommandEvent &event);
798 
800  Mode mMode { Mode::Off };
801  };
802  std::unique_ptr<PlaybackScroller> mPlaybackScroller;
803 
804 public:
805  PlaybackScroller &GetPlaybackScroller() { return *mPlaybackScroller; }
806  std::shared_ptr<BackgroundCell> GetBackgroundCell() const
807  { return mBackgroundCell; }
808 
809  DECLARE_EVENT_TABLE()
810 };
811 
812 #endif
813 
virtual void OnAudioIOStartRecording()=0
virtual void AS_SetSnapTo(int snap)=0
virtual const wxString & AS_GetSelectionFormat()=0
Definition: Project.h:134
std::unique_ptr< Overlay > mIndicatorOverlay
Definition: Project.h:765
A ToolBar that has the main Transport buttons.
Definition: ControlToolBar.h:42
std::unique_ptr< ImportXMLTagHandler > mImportXMLTagHandler
Definition: Project.h:711
A ToolBar that holds the VU Meter.
Definition: MeterToolBar.h:32
A list of TrackListNode items.
Definition: Track.h:532
bool mbLoadedFromAup
Definition: Project.h:586
virtual void SSBL_SetBandwidthSelectionFormatName(const wxString &formatName)=0
Class which actulaly imports the auido, using functions defined in ImportPCM.cpp, ImportMP3...
Definition: Import.h:89
wxMenu * mRecentFilesMenu
Definition: Project.h:596
virtual double SSBL_GetRate() const =0
std::unique_ptr< PlaybackScroller > mPlaybackScroller
Definition: Project.h:802
ViewInfo is used mainly to hold the zooming, selection and scroll information. It also has some statu...
Definition: ViewInfo.h:138
Definition: Contrast.h:29
Works with UndoManager to allow user to see descriptions of and undo previous commands. Also allows you to selectively clear the undo memory so as to free up space.
Definition: HistoryWindow.h:27
double GetSel0() const
Definition: Project.h:188
virtual void SSBL_ModifySpectralSelection(double &bottom, double &top, bool done)=0
bool GetDirty()
Definition: Project.h:281
bool ZoomInAvailable() const
Definition: Project.h:184
Scrubber & GetScrubber()
Definition: Project.h:773
wxString mRecoveryAutoSaveDataDir
Definition: Project.h:723
A now badly named class which is used to give access to a subset of the TrackPanel methods from all o...
Definition: TrackPanelListener.h:18
Definition: ScrubbingToolBar.h:39
Definition: Project.h:144
bool mIsSyncLocked
Definition: Project.h:707
Definition: SelectionState.h:20
virtual int AS_GetSnapTo()=0
void RedrawAllProjects()
Definition: Project.cpp:590
bool mIconized
Definition: Project.h:654
std::unique_ptr< wxTimer > mTimer
Definition: Project.h:638
wxString mBandwidthSelectionFormatName
Definition: Project.h:610
AudacityProject * CreateNewAudacityProject()
Definition: Project.cpp:542
(not quite a Toolbar) at foot of screen for setting and viewing the selection range.
Definition: SelectionBar.h:61
long mLastStatusUpdateTime
Definition: Project.h:639
wxString PluginID
Definition: CommandFunctors.h:16
virtual void TP_PushState(const wxString &shortDesc, const wxString &longDesc, UndoPush flags)=0
const wxChar * desc
Definition: ExportPCM.cpp:58
bool IsTimerRecordCancelled()
Definition: Project.h:685
virtual void TP_ModifyState(bool bWantsAutoSave)=0
void GetNextWindowPlacement(wxRect *nextRect, bool *pMaximized, bool *pIconized)
Definition: Project.cpp:711
wxScrollBar * mVsbar
Definition: Project.h:651
AudacityProject * mProject
Definition: Project.h:158
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:303
A parent class of SelectionBar, used to forward events to do with changes in the SelectionBar.
Definition: SelectionBarListener.h:16
virtual void AS_SetRate(double rate)=0
AProjectArray gAudacityProjects
Definition: Project.cpp:298
virtual XMLTagHandler * HandleXMLChild(const wxChar *tag)=0
bool mLockPlayRegion
Definition: Project.h:709
virtual void TP_HandleResize()=0
VU Meter, for displaying recording/playback level.
Definition: Meter.h:88
virtual void AS_SetSelectionFormat(const wxString &format)=0
virtual const wxString & SSBL_GetFrequencySelectionFormatName()=0
double mSeekShort
Definition: Project.h:752
A ToolBar that has the edit buttons on it.
Definition: EditToolBar.h:72
wxString mSoloPref
Definition: Project.h:679
std::unique_ptr< Scrubber > mScrubber
Definition: Project.h:771
bool mShowSplashScreen
Definition: Project.h:677
const CommandManager * GetCommandManager() const
Definition: Project.h:325
Definition: MixerBoard.h:286
PlayMode
Definition: Project.h:126
sampleFormat mDefaultFormat
Definition: Project.h:593
Definition: Scrubbing.h:68
const Scrubber & GetScrubber() const
Definition: Project.h:774
void SetShowId3Dialog(bool flag)
Definition: Project.h:295
std::shared_ptr< DirManager > mDirManager
Definition: Project.h:587
void SetNormalizeOnLoad(bool flag)
Definition: Project.h:298
bool mEmptyCanBeDirty
Definition: Project.h:701
bool IsWindowAccessible(wxRect *requestedRect)
Definition: Project.cpp:660
bool GetNormalizeOnLoad()
Definition: Project.h:297
CommandManager mCommandManager
Definition: Project.h:632
virtual void TP_ScrollWindow(double scrollto)=0
CommandManager * GetCommandManager()
Definition: Project.h:324
virtual void OnAudioIOStopRecording()=0
int mProjectNo
Definition: Project.h:590
wxString mFileName
Definition: Project.h:585
const TrackPanel * GetTrackPanel() const
Definition: Project.h:286
std::shared_ptr< AudacityProject > AProjectHolder
Definition: Project.h:118
int mSnapTo
Definition: Project.h:607
MixerBoard * GetMixerBoard()
Definition: Project.h:496
StatusBarField
Definition: Project.h:132
wxString mFrequencySelectionFormatName
Definition: Project.h:609
virtual const wxString & SSBL_GetBandwidthSelectionFormatName()=0
Definition: ViewInfo.h:31
bool HandleXMLTag(const wxChar *tag, const wxChar **attrs) override
Definition: Project.cpp:483
void ResetTimerRecordFlag()
Definition: Project.h:686
Used to create a WaveTrack, or a LabelTrack.. Implementation of the functions of this class are dispe...
Definition: Track.h:676
std::unique_ptr< RecordingRecoveryHandler > mRecordingRecoveryHandler
Definition: Project.h:726
std::shared_ptr< Tags > mTags
Definition: Project.h:602
Definition: AutoRecovery.h:44
Definition: WaveTrack.h:72
DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_CAPTURE_KEY,-1)
Custom events.
XMLTagHandler * HandleXMLChild(const wxChar *WXUNUSED(tag)) override
Definition: Project.h:150
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:161
Definition: UndoManager.h:63
Definition: Project.h:135
int format
Definition: ExportPCM.cpp:56
std::shared_ptr< TrackList > mLastSavedTracks
Definition: Project.h:612
void GetDefaultWindowRect(wxRect *defRect)
Definition: Project.cpp:616
wxRect mNormalizedWindowState
Definition: Project.h:736
std::shared_ptr< BackgroundCell > mBackgroundCell
Definition: Project.h:767
Defines a selected portion of a project.
Definition: SelectedRegion.h:37
double mRate
Definition: Project.h:592
The TrackPanel class coordinates updates and operations on the main part of the screen which contains...
Definition: TrackPanel.h:257
ViewInfo & GetViewInfo()
Definition: Project.h:192
Lightweight version of ASlider. In other words it does not have a window permanently associated with ...
Definition: ASlider.h:72
Definition: AudioIO.h:109
This allows multiple clips to be a part of one WaveTrack.
Definition: WaveClip.h:177
UndoPush
Definition: UndoManager.h:82
(not quite a Toolbar) at foot of screen for setting and viewing the frequency selection range...
Definition: SpectralSelectionBar.h:30
double mSeekLong
Definition: Project.h:753
A toobar to allow easier changing of input and output devices .
Definition: DeviceToolBar.h:25
const SelectedRegion & GetSelection() const
Definition: Project.h:186
virtual void TP_DisplayStatusMessage(const wxString &msg)=0
static double msClipT0
Definition: Project.h:617
static double msClipT1
Definition: Project.h:618
CommandFlag mLastFlags
Definition: Project.h:634
virtual bool HandleXMLTag(const wxChar *tag, const wxChar **attrs)=0
bool GetShowId3Dialog()
Definition: Project.h:294
const TrackList * GetTracks() const
Definition: Project.h:178
A Track that contains audio waveform data.
Definition: WaveTrack.h:76
ToolManager * GetToolManager()
Definition: Project.h:676
virtual void TP_ScrollLeft()=0
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:85
std::unique_ptr< UndoManager > mUndoManager
Definition: Project.h:627
CommandManager implements a system for organizing all user-callable commands.
Definition: CommandManager.h:94
This class is an interface which should be implemented by classes which wish to be able to load and s...
Definition: XMLTagHandler.h:69
AudacityProject * mProject
Definition: Project.h:799
AUDACITY_DLL_API void CloseAllProjects()
Definition: Project.cpp:604
ViewInfo mViewInfo
Definition: Project.h:538
const int AudacityProjectTimerID
Definition: Project.h:49
std::unique_ptr< Track >(WaveTrack::* EditDestFunction)(double, double)
Definition: Project.h:391
Mode GetMode() const
Definition: Project.h:790
wxArrayString mStrOtherNamesArray
Definition: Project.h:731
sampleFormat GetDefaultFormat()
Definition: Project.h:181
SelectionState & GetSelectionState()
Definition: Project.h:287
virtual double AS_GetRate()=0
virtual void TP_RedrawScrollbars()=0
bool Clipboard()
Definition: Project.h:202
std::shared_ptr< BackgroundCell > GetBackgroundCell() const
Definition: Project.h:806
std::unique_ptr< Overlay > mScrubOverlay
Definition: Project.h:770
std::vector< WaveTrack * > WaveTrackArray
Definition: AudioIO.h:63
bool ZoomOutAvailable() const
Definition: Project.h:185
ImportXMLTagHandler(AudacityProject *pProject)
Definition: Project.h:147
virtual void TP_ScrollRight()=0
Definition: MixerBoard.h:204
wxString mAutoSaveFileName
Definition: Project.h:714
bool mNormalizeOnLoad
Definition: Project.h:699
ID3 Tags (for MP3)
Definition: Tags.h:76
int mWhatIfNoSelection
Definition: Project.h:704
bool IsSoloNone() const
Definition: Project.h:580
bool IsSoloSimple() const
Definition: Project.h:579
Definition: RefreshCode.h:26
std::vector< AProjectHolder > AProjectArray
Definition: Project.h:119
virtual void OnAudioIONewBlockFiles(const AutoSaveFile &blockFileLog)=0
Destroy_ptr< ContrastDialog > mContrastDialog
Definition: Project.h:662
Definition: AudioIOListener.h:20
wxStatusBar * GetStatusBar()
Definition: Project.h:498
wxStatusBar * mStatusBar
Definition: Project.h:641
CommandFlag
Definition: CommandFlag.h:16
bool mStopIfWasPaused
Definition: Project.h:705
Definition: ODTaskThread.h:150
Definition: Project.h:133
UndoManager * GetUndoManager()
Definition: Project.h:179
PlaybackScroller & GetPlaybackScroller()
Definition: Project.h:805
wxString mHelpPref
Definition: Project.h:678
wxScrollBar * mHsbar
Definition: Project.h:650
std::unique_ptr< ToolManager > mToolManager
Definition: Project.h:673
void Activate(Mode mode)
Definition: Project.h:791
wxPanel * GetTopPanel()
Definition: Project.h:284
LyricsWindow * GetLyricsWindow()
Definition: Project.h:495
Definition: LyricsWindow.h:22
Displays a spectrum plot of the waveform. Has options for selecting parameters of the plot...
Definition: FreqWindow.h:125
A kind of ToolBar with Tools on it.
Definition: ToolsToolBar.h:47
int GetProjectNumber()
Definition: Project.h:371
virtual void SSBL_SetFrequencySelectionFormatName(const wxString &formatName)=0
bool GetTracksFitVerticallyZoomed()
Definition: Project.h:291
Works with HistoryWindow to provide the Undo functionality.
Definition: UndoManager.h:93
static int mProjectCounter
Definition: Project.h:589
virtual void OnAudioIORate(int rate)=0
wxString mSelectionFormat
Definition: Project.h:608
TrackPanel * GetTrackPanel()
Definition: Project.h:285
virtual bool TP_ScrollUpDown(int delta)=0
void RefreshCursorForAllProjects()
Definition: Project.cpp:597
wxRect GetNormalizedWindowState() const
Definition: Project.h:683
std::unique_ptr< T, Destroyer< T >> Destroy_ptr
Definition: MemoryX.h:784
Definition: Ruler.h:284
A class used to forward events to do with changes in the SpectralSelectionBar.
Definition: SpectralSelectionBarListener.h:18
double GetRate() const
Definition: Project.h:183
Definition: Project.h:777
double GetSel1() const
Definition: Project.h:189
static std::shared_ptr< TrackList > msClipboard
Definition: Project.h:615
void SetNormalizedWindowState(wxRect pSizeAndLocation)
Definition: Project.h:682
TrackList * GetTracks()
Definition: Project.h:177
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
Definition: XMLWriter.h:22
std::vector< std::unique_ptr< WaveTrack >> TrackHolders
Definition: ImportRaw.h:42
const ViewInfo & GetViewInfo() const
Definition: Project.h:191
static AudacityProject * msClipProject
Definition: Project.h:616
Definition: BackgroundCell.h:22
class ToolManager
Definition: ToolManager.h:45
const wxString & GetFileName()
Definition: Project.h:280
A kind of ToolBar used to help with analysing voice recordings.
Definition: TranscriptionToolBar.h:68
void SetTracksFitVerticallyZoomed(bool flag)
Definition: Project.h:292
Mode
Definition: Project.h:783
virtual void TP_DisplaySelection()=0
std::shared_ptr< TrackList > mTracks
Definition: Project.h:605
A ToolBar that provides the record and playback volume settings.
Definition: MixerToolBar.h:25
wxLongLong mLastSelectionAdjustment
Definition: Project.h:755
virtual ToolsToolBar * TP_GetToolsToolBar()=0
virtual void AS_ModifySelection(double &start, double &end, bool done)=0
wxPanel * mMainPanel
Definition: Project.h:649
WX_DEFINE_ARRAY(wxMenu *, MenuArray)
Definition: AutoRecovery.h:76
Destroy_ptr< FreqWindow > mFreqWindow
Definition: Project.h:661