diff --git a/locale/POTFILES.in b/locale/POTFILES.in index a48a98fcb..d88d7c4c8 100644 --- a/locale/POTFILES.in +++ b/locale/POTFILES.in @@ -160,6 +160,8 @@ src/Project.cpp src/Project.h src/ProjectAudioIO.cpp src/ProjectAudioIO.h +src/ProjectAudioManager.cpp +src/ProjectAudioManager.h src/ProjectFileIO.cpp src/ProjectFileIO.h src/ProjectFileIORegistry.cpp diff --git a/mac/Audacity.xcodeproj/project.pbxproj b/mac/Audacity.xcodeproj/project.pbxproj index 32b3ec7ec..7b1a068cf 100644 --- a/mac/Audacity.xcodeproj/project.pbxproj +++ b/mac/Audacity.xcodeproj/project.pbxproj @@ -1216,6 +1216,7 @@ 5E135A3C229EDF2E0076E983 /* ProjectManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E135A3A229EDF2E0076E983 /* ProjectManager.cpp */; }; 5E135A45229EE4DE0076E983 /* ProjectFileIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E135A43229EE4DE0076E983 /* ProjectFileIO.cpp */; }; 5E135A48229EE5530076E983 /* ProjectWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E135A46229EE5530076E983 /* ProjectWindow.cpp */; }; + 5E135A5122A93DC60076E983 /* ProjectAudioManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E135A4F22A93DC60076E983 /* ProjectAudioManager.cpp */; }; 5E15123D1DB000C000702E29 /* UIHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E15123B1DB000C000702E29 /* UIHandle.cpp */; }; 5E15125A1DB000DC00702E29 /* LabelTrackControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E1512401DB000DC00702E29 /* LabelTrackControls.cpp */; }; 5E15125B1DB000DC00702E29 /* LabelTrackUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E1512421DB000DC00702E29 /* LabelTrackUI.cpp */; }; @@ -1228,8 +1229,8 @@ 5E15126F1DB0010C00702E29 /* TrackUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E15126A1DB0010C00702E29 /* TrackUI.cpp */; }; 5E1512701DB0010C00702E29 /* TrackVRulerControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E15126B1DB0010C00702E29 /* TrackVRulerControls.cpp */; }; 5E16FF4D1FF9CE0B0085E1B8 /* LanguageNames.txt in Resources */ = {isa = PBXBuildFile; fileRef = 5E16FF4C1FF9CE0B0085E1B8 /* LanguageNames.txt */; }; - 5E18CFF322931D3D00E75250 /* AudacityMessageBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E18CFF222931D3D00E75250 /* AudacityMessageBox.cpp */; }; 5E18CFF02291C31000E75250 /* ProjectFileIORegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E18CFEE2291C31000E75250 /* ProjectFileIORegistry.cpp */; }; + 5E18CFF322931D3D00E75250 /* AudacityMessageBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E18CFF222931D3D00E75250 /* AudacityMessageBox.cpp */; }; 5E19D655217D51190024D0B1 /* PluginMenus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E19D64C217D51190024D0B1 /* PluginMenus.cpp */; }; 5E2A19941EED688500217B58 /* SelectionState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E2A19921EED688500217B58 /* SelectionState.cpp */; }; 5E36A0A8217FA2430068E082 /* EditMenus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E36A09F217FA2430068E082 /* EditMenus.cpp */; }; @@ -3190,6 +3191,8 @@ 5E135A44229EE4DE0076E983 /* ProjectFileIO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectFileIO.h; sourceTree = ""; }; 5E135A46229EE5530076E983 /* ProjectWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProjectWindow.cpp; sourceTree = ""; }; 5E135A47229EE5530076E983 /* ProjectWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectWindow.h; sourceTree = ""; }; + 5E135A4F22A93DC60076E983 /* ProjectAudioManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProjectAudioManager.cpp; sourceTree = ""; }; + 5E135A5022A93DC60076E983 /* ProjectAudioManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectAudioManager.h; sourceTree = ""; }; 5E1512381DB000C000702E29 /* HitTestResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HitTestResult.h; sourceTree = ""; }; 5E1512391DB000C000702E29 /* RefreshCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefreshCode.h; sourceTree = ""; }; 5E15123A1DB000C000702E29 /* TrackPanelMouseEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackPanelMouseEvent.h; sourceTree = ""; }; @@ -3213,10 +3216,10 @@ 5E15126B1DB0010C00702E29 /* TrackVRulerControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TrackVRulerControls.cpp; sourceTree = ""; }; 5E15126C1DB0010C00702E29 /* TrackVRulerControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackVRulerControls.h; sourceTree = ""; }; 5E16FF4C1FF9CE0B0085E1B8 /* LanguageNames.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LanguageNames.txt; path = ../locale/LanguageNames.txt; sourceTree = ""; }; - 5E18CFF122931CA900E75250 /* AudacityMessageBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudacityMessageBox.h; sourceTree = ""; }; - 5E18CFF222931D3D00E75250 /* AudacityMessageBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudacityMessageBox.cpp; sourceTree = ""; }; 5E18CFEE2291C31000E75250 /* ProjectFileIORegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProjectFileIORegistry.cpp; sourceTree = ""; }; 5E18CFEF2291C31000E75250 /* ProjectFileIORegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectFileIORegistry.h; sourceTree = ""; }; + 5E18CFF122931CA900E75250 /* AudacityMessageBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudacityMessageBox.h; sourceTree = ""; }; + 5E18CFF222931D3D00E75250 /* AudacityMessageBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudacityMessageBox.cpp; sourceTree = ""; }; 5E19D64C217D51190024D0B1 /* PluginMenus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginMenus.cpp; path = menus/PluginMenus.cpp; sourceTree = ""; }; 5E2A19921EED688500217B58 /* SelectionState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectionState.cpp; sourceTree = ""; }; 5E2A19931EED688500217B58 /* SelectionState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionState.h; sourceTree = ""; }; @@ -4374,6 +4377,7 @@ 186CCEA30E523C8E00659159 /* Profiler.cpp */, 1790B0D009883BFD008A330A /* Project.cpp */, 5E135A37229EDEBA0076E983 /* ProjectAudioIO.cpp */, + 5E135A4F22A93DC60076E983 /* ProjectAudioManager.cpp */, 5E135A43229EE4DE0076E983 /* ProjectFileIO.cpp */, 5E18CFEE2291C31000E75250 /* ProjectFileIORegistry.cpp */, 5ECF728C228B307E007F2A35 /* ProjectFSCK.cpp */, @@ -4494,6 +4498,7 @@ 186CCEA20E523C8D00659159 /* Profiler.h */, 1790B0D109883BFD008A330A /* Project.h */, 5E135A38229EDEBA0076E983 /* ProjectAudioIO.h */, + 5E135A5022A93DC60076E983 /* ProjectAudioManager.h */, 5E135A44229EE4DE0076E983 /* ProjectFileIO.h */, 5E18CFEF2291C31000E75250 /* ProjectFileIORegistry.h */, 5ECF728B228B307E007F2A35 /* ProjectFSCK.h */, @@ -8651,6 +8656,7 @@ 2888496E131B6CF600B59735 /* tg.po in Sources */, 5E7396441DAFD8C600BA0A4D /* TimeShiftHandle.cpp in Sources */, 5E73966A1DAFDB5600BA0A4D /* LabelGlyphHandle.cpp in Sources */, + 5E135A5122A93DC60076E983 /* ProjectAudioManager.cpp in Sources */, 2888496F131B6CF600B59735 /* tr.po in Sources */, 28884970131B6CF600B59735 /* uk.po in Sources */, 28884971131B6CF600B59735 /* vi.po in Sources */, diff --git a/src/AdornedRulerPanel.cpp b/src/AdornedRulerPanel.cpp index 4d6c8caff..657e9f2e3 100644 --- a/src/AdornedRulerPanel.cpp +++ b/src/AdornedRulerPanel.cpp @@ -33,7 +33,7 @@ #include "Prefs.h" #include "Project.h" #include "ProjectAudioIO.h" -#include "ProjectManager.h" +#include "ProjectAudioManager.h" #include "ProjectWindow.h" #include "RefreshCode.h" #include "Snap.h" diff --git a/src/AudioIOListener.h b/src/AudioIOListener.h index 68ee17897..e23e6b580 100644 --- a/src/AudioIOListener.h +++ b/src/AudioIOListener.h @@ -13,6 +13,8 @@ #ifndef __AUDACITY_AUDIO_IO_LISTENER__ #define __AUDACITY_AUDIO_IO_LISTENER__ +#include "Audacity.h" + class AutoSaveFile; class AUDACITY_DLL_API AudioIOListener /* not final */ { diff --git a/src/Makefile.am b/src/Makefile.am index 11774f9d1..682d8a240 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -211,6 +211,8 @@ audacity_SOURCES = \ Project.h \ ProjectAudioIO.cpp \ ProjectAudioIO.h \ + ProjectAudioManager.cpp \ + ProjectAudioManager.h \ ProjectFileIO.cpp \ ProjectFileIO.h \ ProjectFileIORegistry.cpp \ diff --git a/src/Makefile.in b/src/Makefile.in index 05dbffd01..8349504d9 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -320,18 +320,19 @@ am__audacity_SOURCES_DIST = BlockFile.cpp BlockFile.h DirManager.cpp \ PlatformCompatibility.cpp PlatformCompatibility.h \ PluginManager.cpp PluginManager.h Printing.cpp Printing.h \ Profiler.cpp Profiler.h Project.cpp Project.h \ - ProjectAudioIO.cpp ProjectAudioIO.h ProjectFileIO.cpp \ - ProjectFileIO.h ProjectFileIORegistry.cpp \ - ProjectFileIORegistry.h ProjectFSCK.cpp ProjectFSCK.h \ - ProjectManager.cpp ProjectManager.h ProjectSettings.cpp \ - ProjectSettings.h ProjectWindow.cpp ProjectWindow.h \ - RealFFTf.cpp RealFFTf.h RealFFTf48x.cpp RealFFTf48x.h \ - RefreshCode.h Resample.cpp Resample.h RevisionIdent.h \ - RingBuffer.cpp RingBuffer.h Screenshot.cpp Screenshot.h \ - SelectedRegion.cpp SelectedRegion.h SelectionState.cpp \ - SelectionState.h Shuttle.cpp Shuttle.h \ - ShuttleGetDefinition.cpp ShuttleGetDefinition.h ShuttleGui.cpp \ - ShuttleGui.h ShuttlePrefs.cpp ShuttlePrefs.h Snap.cpp Snap.h \ + ProjectAudioIO.cpp ProjectAudioIO.h ProjectAudioManager.cpp \ + ProjectAudioManager.h ProjectFileIO.cpp ProjectFileIO.h \ + ProjectFileIORegistry.cpp ProjectFileIORegistry.h \ + ProjectFSCK.cpp ProjectFSCK.h ProjectManager.cpp \ + ProjectManager.h ProjectSettings.cpp ProjectSettings.h \ + ProjectWindow.cpp ProjectWindow.h RealFFTf.cpp RealFFTf.h \ + RealFFTf48x.cpp RealFFTf48x.h RefreshCode.h Resample.cpp \ + Resample.h RevisionIdent.h RingBuffer.cpp RingBuffer.h \ + Screenshot.cpp Screenshot.h SelectedRegion.cpp \ + SelectedRegion.h SelectionState.cpp SelectionState.h \ + Shuttle.cpp Shuttle.h ShuttleGetDefinition.cpp \ + ShuttleGetDefinition.h ShuttleGui.cpp ShuttleGui.h \ + ShuttlePrefs.cpp ShuttlePrefs.h Snap.cpp Snap.h \ SoundActivatedRecord.cpp SoundActivatedRecord.h Spectrum.cpp \ Spectrum.h SplashDialog.cpp SplashDialog.h SseMathFuncs.cpp \ SseMathFuncs.h Tags.cpp Tags.h Theme.cpp Theme.h \ @@ -668,6 +669,7 @@ am_audacity_OBJECTS = $(am__objects_1) audacity-AboutDialog.$(OBJEXT) \ audacity-PluginManager.$(OBJEXT) audacity-Printing.$(OBJEXT) \ audacity-Profiler.$(OBJEXT) audacity-Project.$(OBJEXT) \ audacity-ProjectAudioIO.$(OBJEXT) \ + audacity-ProjectAudioManager.$(OBJEXT) \ audacity-ProjectFileIO.$(OBJEXT) \ audacity-ProjectFileIORegistry.$(OBJEXT) \ audacity-ProjectFSCK.$(OBJEXT) \ @@ -1390,18 +1392,19 @@ audacity_SOURCES = $(libaudacity_la_SOURCES) AboutDialog.cpp \ PlatformCompatibility.cpp PlatformCompatibility.h \ PluginManager.cpp PluginManager.h Printing.cpp Printing.h \ Profiler.cpp Profiler.h Project.cpp Project.h \ - ProjectAudioIO.cpp ProjectAudioIO.h ProjectFileIO.cpp \ - ProjectFileIO.h ProjectFileIORegistry.cpp \ - ProjectFileIORegistry.h ProjectFSCK.cpp ProjectFSCK.h \ - ProjectManager.cpp ProjectManager.h ProjectSettings.cpp \ - ProjectSettings.h ProjectWindow.cpp ProjectWindow.h \ - RealFFTf.cpp RealFFTf.h RealFFTf48x.cpp RealFFTf48x.h \ - RefreshCode.h Resample.cpp Resample.h RevisionIdent.h \ - RingBuffer.cpp RingBuffer.h Screenshot.cpp Screenshot.h \ - SelectedRegion.cpp SelectedRegion.h SelectionState.cpp \ - SelectionState.h Shuttle.cpp Shuttle.h \ - ShuttleGetDefinition.cpp ShuttleGetDefinition.h ShuttleGui.cpp \ - ShuttleGui.h ShuttlePrefs.cpp ShuttlePrefs.h Snap.cpp Snap.h \ + ProjectAudioIO.cpp ProjectAudioIO.h ProjectAudioManager.cpp \ + ProjectAudioManager.h ProjectFileIO.cpp ProjectFileIO.h \ + ProjectFileIORegistry.cpp ProjectFileIORegistry.h \ + ProjectFSCK.cpp ProjectFSCK.h ProjectManager.cpp \ + ProjectManager.h ProjectSettings.cpp ProjectSettings.h \ + ProjectWindow.cpp ProjectWindow.h RealFFTf.cpp RealFFTf.h \ + RealFFTf48x.cpp RealFFTf48x.h RefreshCode.h Resample.cpp \ + Resample.h RevisionIdent.h RingBuffer.cpp RingBuffer.h \ + Screenshot.cpp Screenshot.h SelectedRegion.cpp \ + SelectedRegion.h SelectionState.cpp SelectionState.h \ + Shuttle.cpp Shuttle.h ShuttleGetDefinition.cpp \ + ShuttleGetDefinition.h ShuttleGui.cpp ShuttleGui.h \ + ShuttlePrefs.cpp ShuttlePrefs.h Snap.cpp Snap.h \ SoundActivatedRecord.cpp SoundActivatedRecord.h Spectrum.cpp \ Spectrum.h SplashDialog.cpp SplashDialog.h SseMathFuncs.cpp \ SseMathFuncs.h Tags.cpp Tags.h Theme.cpp Theme.h \ @@ -2569,6 +2572,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-Profiler.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-Project.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-ProjectAudioIO.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-ProjectAudioManager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-ProjectFSCK.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-ProjectFileIO.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-ProjectFileIORegistry.Po@am__quote@ @@ -3990,6 +3994,20 @@ audacity-ProjectAudioIO.obj: ProjectAudioIO.cpp @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o audacity-ProjectAudioIO.obj `if test -f 'ProjectAudioIO.cpp'; then $(CYGPATH_W) 'ProjectAudioIO.cpp'; else $(CYGPATH_W) '$(srcdir)/ProjectAudioIO.cpp'; fi` +audacity-ProjectAudioManager.o: ProjectAudioManager.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT audacity-ProjectAudioManager.o -MD -MP -MF $(DEPDIR)/audacity-ProjectAudioManager.Tpo -c -o audacity-ProjectAudioManager.o `test -f 'ProjectAudioManager.cpp' || echo '$(srcdir)/'`ProjectAudioManager.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audacity-ProjectAudioManager.Tpo $(DEPDIR)/audacity-ProjectAudioManager.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ProjectAudioManager.cpp' object='audacity-ProjectAudioManager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o audacity-ProjectAudioManager.o `test -f 'ProjectAudioManager.cpp' || echo '$(srcdir)/'`ProjectAudioManager.cpp + +audacity-ProjectAudioManager.obj: ProjectAudioManager.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT audacity-ProjectAudioManager.obj -MD -MP -MF $(DEPDIR)/audacity-ProjectAudioManager.Tpo -c -o audacity-ProjectAudioManager.obj `if test -f 'ProjectAudioManager.cpp'; then $(CYGPATH_W) 'ProjectAudioManager.cpp'; else $(CYGPATH_W) '$(srcdir)/ProjectAudioManager.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audacity-ProjectAudioManager.Tpo $(DEPDIR)/audacity-ProjectAudioManager.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ProjectAudioManager.cpp' object='audacity-ProjectAudioManager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o audacity-ProjectAudioManager.obj `if test -f 'ProjectAudioManager.cpp'; then $(CYGPATH_W) 'ProjectAudioManager.cpp'; else $(CYGPATH_W) '$(srcdir)/ProjectAudioManager.cpp'; fi` + audacity-ProjectFileIO.o: ProjectFileIO.cpp @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT audacity-ProjectFileIO.o -MD -MP -MF $(DEPDIR)/audacity-ProjectFileIO.Tpo -c -o audacity-ProjectFileIO.o `test -f 'ProjectFileIO.cpp' || echo '$(srcdir)/'`ProjectFileIO.cpp @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audacity-ProjectFileIO.Tpo $(DEPDIR)/audacity-ProjectFileIO.Po diff --git a/src/ProjectAudioManager.cpp b/src/ProjectAudioManager.cpp new file mode 100644 index 000000000..5c06d5b13 --- /dev/null +++ b/src/ProjectAudioManager.cpp @@ -0,0 +1,197 @@ +/********************************************************************** + +Audacity: A Digital Audio Editor + +ProjectAudioManager.cpp + +Paul Licameli split from ProjectManager.cpp + +**********************************************************************/ + +#include "ProjectAudioManager.h" + +#include +#include + +#include "AudioIO.h" +#include "AutoRecovery.h" +#include "DirManager.h" +#include "LabelTrack.h" +#include "Menus.h" +#include "Project.h" +#include "ProjectAudioIO.h" +#include "ProjectFileIO.h" +#include "ProjectManager.h" +#include "ProjectSettings.h" +#include "ProjectWindow.h" +#include "toolbars/ControlToolBar.h" +#include "widgets/ErrorDialog.h" +#include "widgets/Warning.h" + +static AudacityProject::AttachedObjects::RegisteredFactory +sProjectAudioManagerKey { + []( AudacityProject &project ) { + return std::make_shared< ProjectAudioManager >( project ); + } +}; + +ProjectAudioManager &ProjectAudioManager::Get( AudacityProject &project ) +{ + return project.AttachedObjects::Get< ProjectAudioManager >( + sProjectAudioManagerKey ); +} + +const ProjectAudioManager &ProjectAudioManager::Get( + const AudacityProject &project ) +{ + return Get( const_cast< AudacityProject & >( project ) ); +} + +ProjectAudioManager::~ProjectAudioManager() = default; + +void ProjectAudioManager::OnAudioIORate(int rate) +{ + auto &project = mProject; + auto &window = GetProjectFrame( project ); + wxString display; + if (rate > 0) { + display = wxString::Format(_("Actual Rate: %d"), rate); + } + else + // clear the status field + ; + + int x, y; + auto statusBar = window.GetStatusBar(); + statusBar->GetTextExtent(display, &x, &y); + int widths[] = { + 0, + ControlToolBar::Get( project ).WidthForStatusBar(statusBar), + -1, + x+50 + }; + statusBar->SetStatusWidths(4, widths); + statusBar->SetStatusText(display, rateStatusBarField); +} + +void ProjectAudioManager::OnAudioIOStartRecording() +{ + auto &projectFileIO = ProjectFileIO::Get( mProject ); + // Before recording is started, auto-save the file. The file will have + // empty tracks at the bottom where the recording will be put into + projectFileIO.AutoSave(); +} + +// This is called after recording has stopped and all tracks have flushed. +void ProjectAudioManager::OnAudioIOStopRecording() +{ + auto &project = mProject; + auto &dirManager = DirManager::Get( project ); + auto &projectAudioIO = ProjectAudioIO::Get( project ); + auto &projectFileIO = ProjectFileIO::Get( project ); + auto &window = ProjectWindow::Get( project ); + + // Only push state if we were capturing and not monitoring + if (projectAudioIO.GetAudioIOToken() > 0) + { + auto &tracks = TrackList::Get( project ); + auto &intervals = gAudioIO->LostCaptureIntervals(); + if (intervals.size()) { + // Make a track with labels for recording errors + auto uTrack = TrackFactory::Get( project ).NewLabelTrack(); + auto pTrack = uTrack.get(); + tracks.Add( uTrack ); + /* i18n-hint: A name given to a track, appearing as its menu button. + The translation should be short or else it will not display well. + At most, about 11 Latin characters. + Dropout is a loss of a short sequence of audio sample data from the + recording */ + pTrack->SetName(_("Dropouts")); + long counter = 1; + for (auto &interval : intervals) + pTrack->AddLabel( + SelectedRegion{ interval.first, + interval.first + interval.second }, + wxString::Format(wxT("%ld"), counter++), + -2 ); + ShowWarningDialog(&window, wxT("DropoutDetected"), _("\ +Recorded audio was lost at the labeled locations. Possible causes:\n\ +\n\ +Other applications are competing with Audacity for processor time\n\ +\n\ +You are saving directly to a slow external storage device\n\ +" + ), + false, + _("Turn off dropout detection")); + } + + // Add to history + auto &history = ProjectManager::Get( project ); + history.PushState(_("Recorded Audio"), _("Record")); + + // Reset timer record + if (IsTimerRecordCancelled()) + { + EditActions::DoUndo( project ); + ResetTimerRecordCancelled(); + } + + // Refresh the project window + window.FixScrollbars(); + window.RedrawProject(); + } + + // Write all cached files to disk, if any + dirManager.WriteCacheToDisk(); + + // Now we auto-save again to get the project to a "normal" state again. + projectFileIO.AutoSave(); +} + +void ProjectAudioManager::OnAudioIONewBlockFiles( + const AutoSaveFile & blockFileLog) +{ + auto &project = mProject; + auto &projectFileIO = ProjectFileIO::Get( project ); + // New blockfiles have been created, so add them to the auto-save file + const auto &autoSaveFileName = projectFileIO.GetAutoSaveFileName(); + if ( !autoSaveFileName.empty() ) + { + wxFFile f{ autoSaveFileName, wxT("ab") }; + if (!f.IsOpened()) + return; // Keep recording going, there's not much we can do here + blockFileLog.Append(f); + f.Close(); + } +} + +AudioIOStartStreamOptions +DefaultPlayOptions( AudacityProject &project ) +{ + auto &projectAudioIO = ProjectAudioIO::Get( project ); + AudioIOStartStreamOptions options { &project, + ProjectSettings::Get( project ).GetRate() }; + options.captureMeter = projectAudioIO.GetCaptureMeter(); + options.playbackMeter = projectAudioIO.GetPlaybackMeter(); + options.timeTrack = TrackList::Get( project ).GetTimeTrack(); + options.listener = &ProjectAudioManager::Get( project ); + return options; +} + +AudioIOStartStreamOptions +DefaultSpeedPlayOptions( AudacityProject &project ) +{ + auto &projectAudioIO = ProjectAudioIO::Get( project ); + auto PlayAtSpeedRate = gAudioIO->GetBestRate( + false, //not capturing + true, //is playing + ProjectSettings::Get( project ).GetRate() //suggested rate + ); + AudioIOStartStreamOptions options{ &project, PlayAtSpeedRate }; + options.captureMeter = projectAudioIO.GetCaptureMeter(); + options.playbackMeter = projectAudioIO.GetPlaybackMeter(); + options.timeTrack = TrackList::Get( project ).GetTimeTrack(); + options.listener = &ProjectAudioManager::Get( project ); + return options; +} diff --git a/src/ProjectAudioManager.h b/src/ProjectAudioManager.h new file mode 100644 index 000000000..c56026b42 --- /dev/null +++ b/src/ProjectAudioManager.h @@ -0,0 +1,53 @@ +/********************************************************************** + +Audacity: A Digital Audio Editor + +ProjectAudioManager.h + +Paul Licameli split from ProjectManager.h + +**********************************************************************/ + +#ifndef __AUDACITY_PROJECT_AUDIO_MANAGER__ +#define __AUDACITY_PROJECT_AUDIO_MANAGER__ + +#include "AudioIOListener.h" // to inherit +#include "ClientData.h" // to inherit + +class AudacityProject; +struct AudioIOStartStreamOptions; + +class ProjectAudioManager final + : public ClientData::Base + , public AudioIOListener +{ +public: + static ProjectAudioManager &Get( AudacityProject &project ); + static const ProjectAudioManager &Get( const AudacityProject &project ); + + explicit ProjectAudioManager( AudacityProject &project ) + : mProject{ project } + {} + ~ProjectAudioManager() override; + + bool IsTimerRecordCancelled() { return mTimerRecordCanceled; } + void SetTimerRecordCancelled() { mTimerRecordCanceled = true; } + void ResetTimerRecordCancelled() { mTimerRecordCanceled = false; } + +private: + // Audio IO callback methods + void OnAudioIORate(int rate) override; + void OnAudioIOStartRecording() override; + void OnAudioIOStopRecording() override; + void OnAudioIONewBlockFiles(const AutoSaveFile & blockFileLog) override; + + AudacityProject &mProject; + + //flag for cancellation of timer record. + bool mTimerRecordCanceled{ false }; +}; + +AudioIOStartStreamOptions DefaultPlayOptions( AudacityProject &project ); +AudioIOStartStreamOptions DefaultSpeedPlayOptions( AudacityProject &project ); + +#endif diff --git a/src/ProjectManager.cpp b/src/ProjectManager.cpp index 4f253cf96..d375cb49c 100644 --- a/src/ProjectManager.cpp +++ b/src/ProjectManager.cpp @@ -19,7 +19,6 @@ Paul Licameli split from AudacityProject.cpp #include "Clipboard.h" #include "DirManager.h" #include "FileNames.h" -#include "LabelTrack.h" #include "Legacy.h" #include "Menus.h" #include "MissingAliasFileDialog.h" @@ -27,6 +26,7 @@ Paul Licameli split from AudacityProject.cpp #include "PlatformCompatibility.h" #include "Project.h" #include "ProjectAudioIO.h" +#include "ProjectAudioManager.h" #include "ProjectFileIO.h" #include "ProjectFileIORegistry.h" #include "ProjectFSCK.h" @@ -55,7 +55,6 @@ Paul Licameli split from AudacityProject.cpp #include "widgets/AudacityMessageBox.h" #include "widgets/FileHistory.h" #include "widgets/ErrorDialog.h" -#include "widgets/Warning.h" #include #include @@ -391,7 +390,7 @@ AudacityProject *ProjectManager::New() } //Initialise the Listeners - gAudioIO->SetListener( &projectManager ); + gAudioIO->SetListener( &ProjectAudioManager::Get( project ) ); SelectionBar::Get( project ).SetListener( &projectManager ); #ifdef EXPERIMENTAL_SPECTRAL_EDITING SpectralSelectionBar::Get( project ).SetListener( &projectManager ); @@ -420,36 +419,6 @@ AudacityProject *ProjectManager::New() return p; } -AudioIOStartStreamOptions -DefaultPlayOptions( AudacityProject &project ) -{ - auto &projectAudioIO = ProjectAudioIO::Get( project ); - AudioIOStartStreamOptions options { &project, - ProjectSettings::Get( project ).GetRate() }; - options.captureMeter = projectAudioIO.GetCaptureMeter(); - options.playbackMeter = projectAudioIO.GetPlaybackMeter(); - options.timeTrack = TrackList::Get( project ).GetTimeTrack(); - options.listener = &ProjectManager::Get( project ); - return options; -} - -AudioIOStartStreamOptions -DefaultSpeedPlayOptions( AudacityProject &project ) -{ - auto &projectAudioIO = ProjectAudioIO::Get( project ); - auto PlayAtSpeedRate = gAudioIO->GetBestRate( - false, //not capturing - true, //is playing - ProjectSettings::Get( project ).GetRate() //suggested rate - ); - AudioIOStartStreamOptions options{ &project, PlayAtSpeedRate }; - options.captureMeter = projectAudioIO.GetCaptureMeter(); - options.playbackMeter = projectAudioIO.GetPlaybackMeter(); - options.timeTrack = TrackList::Get( project ).GetTimeTrack(); - options.listener = &ProjectManager::Get( project ); - return options; -} - bool ProjectManager::SnapSelection() { auto &project = mProject; @@ -827,10 +796,10 @@ void ProjectManager::OnCloseWindow(wxCloseEvent & event) // Since we're going to be destroyed, make sure we're not to // receive audio notifications anymore. - if (gAudioIO->GetListener() == this) { + if ( gAudioIO->GetListener() == &ProjectAudioManager::Get( project ) ) { auto active = GetActiveProject(); gAudioIO->SetListener( - active ? &ProjectManager::Get( *active ) : nullptr + active ? &ProjectAudioManager::Get( *active ) : nullptr ); } @@ -1987,122 +1956,6 @@ void ProjectManager::OnStatusChange( wxCommandEvent & ) RestartTimer(); } -void ProjectManager::OnAudioIORate(int rate) -{ - auto &project = mProject; - auto &window = GetProjectFrame( project ); - wxString display; - if (rate > 0) { - display = wxString::Format(_("Actual Rate: %d"), rate); - } - else - // clear the status field - ; - - int x, y; - auto statusBar = window.GetStatusBar(); - statusBar->GetTextExtent(display, &x, &y); - int widths[] = { - 0, - ControlToolBar::Get( project ).WidthForStatusBar(statusBar), - -1, - x+50 - }; - statusBar->SetStatusWidths(4, widths); - statusBar->SetStatusText(display, rateStatusBarField); -} - -void ProjectManager::OnAudioIOStartRecording() -{ - auto &projectFileIO = ProjectFileIO::Get( mProject ); - // Before recording is started, auto-save the file. The file will have - // empty tracks at the bottom where the recording will be put into - projectFileIO.AutoSave(); -} - -// This is called after recording has stopped and all tracks have flushed. -void ProjectManager::OnAudioIOStopRecording() -{ - auto &project = mProject; - auto &dirManager = DirManager::Get( project ); - auto &projectAudioIO = ProjectAudioIO::Get( project ); - auto &projectFileIO = ProjectFileIO::Get( project ); - auto &window = ProjectWindow::Get( project ); - - // Only push state if we were capturing and not monitoring - if (projectAudioIO.GetAudioIOToken() > 0) - { - auto &tracks = TrackList::Get( project ); - auto &intervals = gAudioIO->LostCaptureIntervals(); - if (intervals.size()) { - // Make a track with labels for recording errors - auto uTrack = TrackFactory::Get( project ).NewLabelTrack(); - auto pTrack = uTrack.get(); - tracks.Add( uTrack ); - /* i18n-hint: A name given to a track, appearing as its menu button. - The translation should be short or else it will not display well. - At most, about 11 Latin characters. - Dropout is a loss of a short sequence of audio sample data from the - recording */ - pTrack->SetName(_("Dropouts")); - long counter = 1; - for (auto &interval : intervals) - pTrack->AddLabel( - SelectedRegion{ interval.first, - interval.first + interval.second }, - wxString::Format(wxT("%ld"), counter++), - -2 ); - ShowWarningDialog(&window, wxT("DropoutDetected"), _("\ -Recorded audio was lost at the labeled locations. Possible causes:\n\ -\n\ -Other applications are competing with Audacity for processor time\n\ -\n\ -You are saving directly to a slow external storage device\n\ -" - ), - false, - _("Turn off dropout detection")); - } - - // Add to history - PushState(_("Recorded Audio"), _("Record")); - - // Reset timer record - if (IsTimerRecordCancelled()) - { - EditActions::DoUndo( project ); - ResetTimerRecordCancelled(); - } - - // Refresh the project window - window.FixScrollbars(); - window.RedrawProject(); - } - - // Write all cached files to disk, if any - dirManager.WriteCacheToDisk(); - - // Now we auto-save again to get the project to a "normal" state again. - projectFileIO.AutoSave(); -} - -void ProjectManager::OnAudioIONewBlockFiles( - const AutoSaveFile & blockFileLog) -{ - auto &project = mProject; - auto &projectFileIO = ProjectFileIO::Get( project ); - // New blockfiles have been created, so add them to the auto-save file - const auto &autoSaveFileName = projectFileIO.GetAutoSaveFileName(); - if ( !autoSaveFileName.empty() ) - { - wxFFile f{ autoSaveFileName, wxT("ab") }; - if (!f.IsOpened()) - return; // Keep recording going, there's not much we can do here - blockFileLog.Append(f); - f.Close(); - } -} - wxString ProjectManager::GetHoursMinsString(int iMinutes) { wxString sFormatted; diff --git a/src/ProjectManager.h b/src/ProjectManager.h index 00b8481e1..1ffba8bb7 100644 --- a/src/ProjectManager.h +++ b/src/ProjectManager.h @@ -16,7 +16,6 @@ Paul Licameli split from AudacityProject.h #include // to inherit #include "ClientData.h" // to inherit -#include "AudioIOListener.h" // to inherit #include "toolbars/SelectionBarListener.h" // to inherit #include "toolbars/SpectralSelectionBarListener.h" // to inherit #include "import/ImportRaw.h" // defines TrackHolders @@ -43,7 +42,6 @@ using WaveTrackArray = std::vector < std::shared_ptr < WaveTrack > >; class ProjectManager final : public wxEvtHandler , public ClientData::Base - , public AudioIOListener , private SelectionBarListener , private SpectralSelectionBarListener { @@ -135,10 +133,6 @@ public: // projects void PopState(const UndoState &state); - bool IsTimerRecordCancelled() { return mTimerRecordCanceled; } - void SetTimerRecordCancelled() { mTimerRecordCanceled = true; } - void ResetTimerRecordCancelled() { mTimerRecordCanceled = false; } - void SetMenuClose(bool value) { mMenuClose = value; } // SelectionBarListener callback methods @@ -169,12 +163,6 @@ private: bool SnapSelection(); - // Audio IO callback methods - void OnAudioIORate(int rate) override; - void OnAudioIOStartRecording() override; - void OnAudioIOStopRecording() override; - void OnAudioIONewBlockFiles(const AutoSaveFile & blockFileLog) override; - void InitialState(); void RestartTimer(); @@ -203,15 +191,9 @@ private: // Are we currently closing as the result of a menu command? bool mMenuClose{ false }; - //flag for cancellation of timer record. - bool mTimerRecordCanceled{ false }; - DECLARE_EVENT_TABLE() static bool sbWindowRectAlreadySaved; }; -AudioIOStartStreamOptions DefaultPlayOptions( AudacityProject &project ); -AudioIOStartStreamOptions DefaultSpeedPlayOptions( AudacityProject &project ); - #endif diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 12d99c124..fe97e6052 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -55,7 +55,7 @@ greater use in future. #include "../PluginManager.h" #include "../Prefs.h" #include "../Project.h" -#include "../ProjectManager.h" +#include "../ProjectAudioManager.h" #include "../ProjectSettings.h" #include "../PluginManager.h" #include "../ShuttleGui.h" diff --git a/src/menus/TransportMenus.cpp b/src/menus/TransportMenus.cpp index 4d86fe896..57aef1787 100644 --- a/src/menus/TransportMenus.cpp +++ b/src/menus/TransportMenus.cpp @@ -9,6 +9,7 @@ #include "../Prefs.h" #include "../Project.h" #include "../ProjectAudioIO.h" +#include "../ProjectAudioManager.h" #include "../ProjectFileIO.h" #include "../ProjectManager.h" #include "../ProjectSettings.h" @@ -472,7 +473,7 @@ void OnTimerRecord(const CommandContext &context) // However, we can't undo it here because the PushState() is called in TrackPanel::OnTimer(), // which is blocked by this function. // so instead we mark a flag to undo it there. - ProjectManager::Get( project ).SetTimerRecordCancelled(); + ProjectAudioManager::Get( project ).SetTimerRecordCancelled(); break; case POST_TIMER_RECORD_NOTHING: // No action required diff --git a/src/toolbars/ControlToolBar.cpp b/src/toolbars/ControlToolBar.cpp index 3114f78c7..93aa061c9 100644 --- a/src/toolbars/ControlToolBar.cpp +++ b/src/toolbars/ControlToolBar.cpp @@ -67,7 +67,7 @@ #include "../Prefs.h" #include "../Project.h" #include "../ProjectAudioIO.h" -#include "../ProjectManager.h" +#include "../ProjectAudioManager.h" #include "../ProjectSettings.h" #include "../ProjectWindow.h" #include "../ViewInfo.h" diff --git a/src/toolbars/TranscriptionToolBar.cpp b/src/toolbars/TranscriptionToolBar.cpp index 245f3558d..dabaa9d36 100644 --- a/src/toolbars/TranscriptionToolBar.cpp +++ b/src/toolbars/TranscriptionToolBar.cpp @@ -39,7 +39,7 @@ #include "../ImageManipulation.h" #include "../KeyboardCapture.h" #include "../Project.h" -#include "../ProjectManager.h" +#include "../ProjectAudioManager.h" #include "../TimeTrack.h" #include "../ViewInfo.h" #include "../WaveTrack.h" diff --git a/src/tracks/ui/Scrubbing.cpp b/src/tracks/ui/Scrubbing.cpp index 691c7b695..fcf00657e 100644 --- a/src/tracks/ui/Scrubbing.cpp +++ b/src/tracks/ui/Scrubbing.cpp @@ -20,7 +20,7 @@ Paul Licameli split from TrackPanel.cpp #include "../../Menus.h" #include "../../Project.h" #include "../../ProjectAudioIO.h" -#include "../../ProjectManager.h" +#include "../../ProjectAudioManager.h" #include "../../TrackPanel.h" #include "../../ViewInfo.h" #include "../../prefs/PlaybackPrefs.h" diff --git a/src/widgets/Meter.cpp b/src/widgets/Meter.cpp index 09b20fb95..e69046835 100644 --- a/src/widgets/Meter.cpp +++ b/src/widgets/Meter.cpp @@ -68,7 +68,7 @@ #include "../ImageManipulation.h" #include "../prefs/GUISettings.h" #include "../Project.h" -#include "../ProjectManager.h" +#include "../ProjectAudioManager.h" #include "../Prefs.h" #include "../ShuttleGui.h" diff --git a/win/Projects/Audacity/Audacity.vcxproj b/win/Projects/Audacity/Audacity.vcxproj index 362e1200b..b9ebf6576 100755 --- a/win/Projects/Audacity/Audacity.vcxproj +++ b/win/Projects/Audacity/Audacity.vcxproj @@ -222,6 +222,7 @@ + @@ -654,6 +655,7 @@ + diff --git a/win/Projects/Audacity/Audacity.vcxproj.filters b/win/Projects/Audacity/Audacity.vcxproj.filters index ed41af231..102aa74ea 100755 --- a/win/Projects/Audacity/Audacity.vcxproj.filters +++ b/win/Projects/Audacity/Audacity.vcxproj.filters @@ -263,6 +263,9 @@ src + + src + src @@ -1336,6 +1339,9 @@ src + + src + src