1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-03 22:19:07 +02:00

Split ProjectAudioManager from ProjectManager

This commit is contained in:
Paul Licameli 2019-06-09 11:32:49 -04:00
commit 7857d59f57
18 changed files with 327 additions and 203 deletions

View File

@ -160,6 +160,8 @@ src/Project.cpp
src/Project.h src/Project.h
src/ProjectAudioIO.cpp src/ProjectAudioIO.cpp
src/ProjectAudioIO.h src/ProjectAudioIO.h
src/ProjectAudioManager.cpp
src/ProjectAudioManager.h
src/ProjectFileIO.cpp src/ProjectFileIO.cpp
src/ProjectFileIO.h src/ProjectFileIO.h
src/ProjectFileIORegistry.cpp src/ProjectFileIORegistry.cpp

View File

@ -1216,6 +1216,7 @@
5E135A3C229EDF2E0076E983 /* ProjectManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E135A3A229EDF2E0076E983 /* ProjectManager.cpp */; }; 5E135A3C229EDF2E0076E983 /* ProjectManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E135A3A229EDF2E0076E983 /* ProjectManager.cpp */; };
5E135A45229EE4DE0076E983 /* ProjectFileIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E135A43229EE4DE0076E983 /* ProjectFileIO.cpp */; }; 5E135A45229EE4DE0076E983 /* ProjectFileIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E135A43229EE4DE0076E983 /* ProjectFileIO.cpp */; };
5E135A48229EE5530076E983 /* ProjectWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E135A46229EE5530076E983 /* ProjectWindow.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 */; }; 5E15123D1DB000C000702E29 /* UIHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E15123B1DB000C000702E29 /* UIHandle.cpp */; };
5E15125A1DB000DC00702E29 /* LabelTrackControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E1512401DB000DC00702E29 /* LabelTrackControls.cpp */; }; 5E15125A1DB000DC00702E29 /* LabelTrackControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E1512401DB000DC00702E29 /* LabelTrackControls.cpp */; };
5E15125B1DB000DC00702E29 /* LabelTrackUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E1512421DB000DC00702E29 /* LabelTrackUI.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 */; }; 5E15126F1DB0010C00702E29 /* TrackUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E15126A1DB0010C00702E29 /* TrackUI.cpp */; };
5E1512701DB0010C00702E29 /* TrackVRulerControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E15126B1DB0010C00702E29 /* TrackVRulerControls.cpp */; }; 5E1512701DB0010C00702E29 /* TrackVRulerControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E15126B1DB0010C00702E29 /* TrackVRulerControls.cpp */; };
5E16FF4D1FF9CE0B0085E1B8 /* LanguageNames.txt in Resources */ = {isa = PBXBuildFile; fileRef = 5E16FF4C1FF9CE0B0085E1B8 /* LanguageNames.txt */; }; 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 */; }; 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 */; }; 5E19D655217D51190024D0B1 /* PluginMenus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E19D64C217D51190024D0B1 /* PluginMenus.cpp */; };
5E2A19941EED688500217B58 /* SelectionState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E2A19921EED688500217B58 /* SelectionState.cpp */; }; 5E2A19941EED688500217B58 /* SelectionState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E2A19921EED688500217B58 /* SelectionState.cpp */; };
5E36A0A8217FA2430068E082 /* EditMenus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E36A09F217FA2430068E082 /* EditMenus.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 = "<group>"; }; 5E135A44229EE4DE0076E983 /* ProjectFileIO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectFileIO.h; sourceTree = "<group>"; };
5E135A46229EE5530076E983 /* ProjectWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProjectWindow.cpp; sourceTree = "<group>"; }; 5E135A46229EE5530076E983 /* ProjectWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProjectWindow.cpp; sourceTree = "<group>"; };
5E135A47229EE5530076E983 /* ProjectWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectWindow.h; sourceTree = "<group>"; }; 5E135A47229EE5530076E983 /* ProjectWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectWindow.h; sourceTree = "<group>"; };
5E135A4F22A93DC60076E983 /* ProjectAudioManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProjectAudioManager.cpp; sourceTree = "<group>"; };
5E135A5022A93DC60076E983 /* ProjectAudioManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectAudioManager.h; sourceTree = "<group>"; };
5E1512381DB000C000702E29 /* HitTestResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HitTestResult.h; sourceTree = "<group>"; }; 5E1512381DB000C000702E29 /* HitTestResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HitTestResult.h; sourceTree = "<group>"; };
5E1512391DB000C000702E29 /* RefreshCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefreshCode.h; sourceTree = "<group>"; }; 5E1512391DB000C000702E29 /* RefreshCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefreshCode.h; sourceTree = "<group>"; };
5E15123A1DB000C000702E29 /* TrackPanelMouseEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackPanelMouseEvent.h; sourceTree = "<group>"; }; 5E15123A1DB000C000702E29 /* TrackPanelMouseEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackPanelMouseEvent.h; sourceTree = "<group>"; };
@ -3213,10 +3216,10 @@
5E15126B1DB0010C00702E29 /* TrackVRulerControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TrackVRulerControls.cpp; sourceTree = "<group>"; }; 5E15126B1DB0010C00702E29 /* TrackVRulerControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TrackVRulerControls.cpp; sourceTree = "<group>"; };
5E15126C1DB0010C00702E29 /* TrackVRulerControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackVRulerControls.h; sourceTree = "<group>"; }; 5E15126C1DB0010C00702E29 /* TrackVRulerControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackVRulerControls.h; sourceTree = "<group>"; };
5E16FF4C1FF9CE0B0085E1B8 /* LanguageNames.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LanguageNames.txt; path = ../locale/LanguageNames.txt; sourceTree = "<group>"; }; 5E16FF4C1FF9CE0B0085E1B8 /* LanguageNames.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LanguageNames.txt; path = ../locale/LanguageNames.txt; sourceTree = "<group>"; };
5E18CFF122931CA900E75250 /* AudacityMessageBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudacityMessageBox.h; sourceTree = "<group>"; };
5E18CFF222931D3D00E75250 /* AudacityMessageBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudacityMessageBox.cpp; sourceTree = "<group>"; };
5E18CFEE2291C31000E75250 /* ProjectFileIORegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProjectFileIORegistry.cpp; sourceTree = "<group>"; }; 5E18CFEE2291C31000E75250 /* ProjectFileIORegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProjectFileIORegistry.cpp; sourceTree = "<group>"; };
5E18CFEF2291C31000E75250 /* ProjectFileIORegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectFileIORegistry.h; sourceTree = "<group>"; }; 5E18CFEF2291C31000E75250 /* ProjectFileIORegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProjectFileIORegistry.h; sourceTree = "<group>"; };
5E18CFF122931CA900E75250 /* AudacityMessageBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudacityMessageBox.h; sourceTree = "<group>"; };
5E18CFF222931D3D00E75250 /* AudacityMessageBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudacityMessageBox.cpp; sourceTree = "<group>"; };
5E19D64C217D51190024D0B1 /* PluginMenus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginMenus.cpp; path = menus/PluginMenus.cpp; sourceTree = "<group>"; }; 5E19D64C217D51190024D0B1 /* PluginMenus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginMenus.cpp; path = menus/PluginMenus.cpp; sourceTree = "<group>"; };
5E2A19921EED688500217B58 /* SelectionState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectionState.cpp; sourceTree = "<group>"; }; 5E2A19921EED688500217B58 /* SelectionState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectionState.cpp; sourceTree = "<group>"; };
5E2A19931EED688500217B58 /* SelectionState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionState.h; sourceTree = "<group>"; }; 5E2A19931EED688500217B58 /* SelectionState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionState.h; sourceTree = "<group>"; };
@ -4374,6 +4377,7 @@
186CCEA30E523C8E00659159 /* Profiler.cpp */, 186CCEA30E523C8E00659159 /* Profiler.cpp */,
1790B0D009883BFD008A330A /* Project.cpp */, 1790B0D009883BFD008A330A /* Project.cpp */,
5E135A37229EDEBA0076E983 /* ProjectAudioIO.cpp */, 5E135A37229EDEBA0076E983 /* ProjectAudioIO.cpp */,
5E135A4F22A93DC60076E983 /* ProjectAudioManager.cpp */,
5E135A43229EE4DE0076E983 /* ProjectFileIO.cpp */, 5E135A43229EE4DE0076E983 /* ProjectFileIO.cpp */,
5E18CFEE2291C31000E75250 /* ProjectFileIORegistry.cpp */, 5E18CFEE2291C31000E75250 /* ProjectFileIORegistry.cpp */,
5ECF728C228B307E007F2A35 /* ProjectFSCK.cpp */, 5ECF728C228B307E007F2A35 /* ProjectFSCK.cpp */,
@ -4494,6 +4498,7 @@
186CCEA20E523C8D00659159 /* Profiler.h */, 186CCEA20E523C8D00659159 /* Profiler.h */,
1790B0D109883BFD008A330A /* Project.h */, 1790B0D109883BFD008A330A /* Project.h */,
5E135A38229EDEBA0076E983 /* ProjectAudioIO.h */, 5E135A38229EDEBA0076E983 /* ProjectAudioIO.h */,
5E135A5022A93DC60076E983 /* ProjectAudioManager.h */,
5E135A44229EE4DE0076E983 /* ProjectFileIO.h */, 5E135A44229EE4DE0076E983 /* ProjectFileIO.h */,
5E18CFEF2291C31000E75250 /* ProjectFileIORegistry.h */, 5E18CFEF2291C31000E75250 /* ProjectFileIORegistry.h */,
5ECF728B228B307E007F2A35 /* ProjectFSCK.h */, 5ECF728B228B307E007F2A35 /* ProjectFSCK.h */,
@ -8651,6 +8656,7 @@
2888496E131B6CF600B59735 /* tg.po in Sources */, 2888496E131B6CF600B59735 /* tg.po in Sources */,
5E7396441DAFD8C600BA0A4D /* TimeShiftHandle.cpp in Sources */, 5E7396441DAFD8C600BA0A4D /* TimeShiftHandle.cpp in Sources */,
5E73966A1DAFDB5600BA0A4D /* LabelGlyphHandle.cpp in Sources */, 5E73966A1DAFDB5600BA0A4D /* LabelGlyphHandle.cpp in Sources */,
5E135A5122A93DC60076E983 /* ProjectAudioManager.cpp in Sources */,
2888496F131B6CF600B59735 /* tr.po in Sources */, 2888496F131B6CF600B59735 /* tr.po in Sources */,
28884970131B6CF600B59735 /* uk.po in Sources */, 28884970131B6CF600B59735 /* uk.po in Sources */,
28884971131B6CF600B59735 /* vi.po in Sources */, 28884971131B6CF600B59735 /* vi.po in Sources */,

View File

@ -33,7 +33,7 @@
#include "Prefs.h" #include "Prefs.h"
#include "Project.h" #include "Project.h"
#include "ProjectAudioIO.h" #include "ProjectAudioIO.h"
#include "ProjectManager.h" #include "ProjectAudioManager.h"
#include "ProjectWindow.h" #include "ProjectWindow.h"
#include "RefreshCode.h" #include "RefreshCode.h"
#include "Snap.h" #include "Snap.h"

View File

@ -13,6 +13,8 @@
#ifndef __AUDACITY_AUDIO_IO_LISTENER__ #ifndef __AUDACITY_AUDIO_IO_LISTENER__
#define __AUDACITY_AUDIO_IO_LISTENER__ #define __AUDACITY_AUDIO_IO_LISTENER__
#include "Audacity.h"
class AutoSaveFile; class AutoSaveFile;
class AUDACITY_DLL_API AudioIOListener /* not final */ { class AUDACITY_DLL_API AudioIOListener /* not final */ {

View File

@ -211,6 +211,8 @@ audacity_SOURCES = \
Project.h \ Project.h \
ProjectAudioIO.cpp \ ProjectAudioIO.cpp \
ProjectAudioIO.h \ ProjectAudioIO.h \
ProjectAudioManager.cpp \
ProjectAudioManager.h \
ProjectFileIO.cpp \ ProjectFileIO.cpp \
ProjectFileIO.h \ ProjectFileIO.h \
ProjectFileIORegistry.cpp \ ProjectFileIORegistry.cpp \

View File

@ -320,18 +320,19 @@ am__audacity_SOURCES_DIST = BlockFile.cpp BlockFile.h DirManager.cpp \
PlatformCompatibility.cpp PlatformCompatibility.h \ PlatformCompatibility.cpp PlatformCompatibility.h \
PluginManager.cpp PluginManager.h Printing.cpp Printing.h \ PluginManager.cpp PluginManager.h Printing.cpp Printing.h \
Profiler.cpp Profiler.h Project.cpp Project.h \ Profiler.cpp Profiler.h Project.cpp Project.h \
ProjectAudioIO.cpp ProjectAudioIO.h ProjectFileIO.cpp \ ProjectAudioIO.cpp ProjectAudioIO.h ProjectAudioManager.cpp \
ProjectFileIO.h ProjectFileIORegistry.cpp \ ProjectAudioManager.h ProjectFileIO.cpp ProjectFileIO.h \
ProjectFileIORegistry.h ProjectFSCK.cpp ProjectFSCK.h \ ProjectFileIORegistry.cpp ProjectFileIORegistry.h \
ProjectManager.cpp ProjectManager.h ProjectSettings.cpp \ ProjectFSCK.cpp ProjectFSCK.h ProjectManager.cpp \
ProjectSettings.h ProjectWindow.cpp ProjectWindow.h \ ProjectManager.h ProjectSettings.cpp ProjectSettings.h \
RealFFTf.cpp RealFFTf.h RealFFTf48x.cpp RealFFTf48x.h \ ProjectWindow.cpp ProjectWindow.h RealFFTf.cpp RealFFTf.h \
RefreshCode.h Resample.cpp Resample.h RevisionIdent.h \ RealFFTf48x.cpp RealFFTf48x.h RefreshCode.h Resample.cpp \
RingBuffer.cpp RingBuffer.h Screenshot.cpp Screenshot.h \ Resample.h RevisionIdent.h RingBuffer.cpp RingBuffer.h \
SelectedRegion.cpp SelectedRegion.h SelectionState.cpp \ Screenshot.cpp Screenshot.h SelectedRegion.cpp \
SelectionState.h Shuttle.cpp Shuttle.h \ SelectedRegion.h SelectionState.cpp SelectionState.h \
ShuttleGetDefinition.cpp ShuttleGetDefinition.h ShuttleGui.cpp \ Shuttle.cpp Shuttle.h ShuttleGetDefinition.cpp \
ShuttleGui.h ShuttlePrefs.cpp ShuttlePrefs.h Snap.cpp Snap.h \ ShuttleGetDefinition.h ShuttleGui.cpp ShuttleGui.h \
ShuttlePrefs.cpp ShuttlePrefs.h Snap.cpp Snap.h \
SoundActivatedRecord.cpp SoundActivatedRecord.h Spectrum.cpp \ SoundActivatedRecord.cpp SoundActivatedRecord.h Spectrum.cpp \
Spectrum.h SplashDialog.cpp SplashDialog.h SseMathFuncs.cpp \ Spectrum.h SplashDialog.cpp SplashDialog.h SseMathFuncs.cpp \
SseMathFuncs.h Tags.cpp Tags.h Theme.cpp Theme.h \ 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-PluginManager.$(OBJEXT) audacity-Printing.$(OBJEXT) \
audacity-Profiler.$(OBJEXT) audacity-Project.$(OBJEXT) \ audacity-Profiler.$(OBJEXT) audacity-Project.$(OBJEXT) \
audacity-ProjectAudioIO.$(OBJEXT) \ audacity-ProjectAudioIO.$(OBJEXT) \
audacity-ProjectAudioManager.$(OBJEXT) \
audacity-ProjectFileIO.$(OBJEXT) \ audacity-ProjectFileIO.$(OBJEXT) \
audacity-ProjectFileIORegistry.$(OBJEXT) \ audacity-ProjectFileIORegistry.$(OBJEXT) \
audacity-ProjectFSCK.$(OBJEXT) \ audacity-ProjectFSCK.$(OBJEXT) \
@ -1390,18 +1392,19 @@ audacity_SOURCES = $(libaudacity_la_SOURCES) AboutDialog.cpp \
PlatformCompatibility.cpp PlatformCompatibility.h \ PlatformCompatibility.cpp PlatformCompatibility.h \
PluginManager.cpp PluginManager.h Printing.cpp Printing.h \ PluginManager.cpp PluginManager.h Printing.cpp Printing.h \
Profiler.cpp Profiler.h Project.cpp Project.h \ Profiler.cpp Profiler.h Project.cpp Project.h \
ProjectAudioIO.cpp ProjectAudioIO.h ProjectFileIO.cpp \ ProjectAudioIO.cpp ProjectAudioIO.h ProjectAudioManager.cpp \
ProjectFileIO.h ProjectFileIORegistry.cpp \ ProjectAudioManager.h ProjectFileIO.cpp ProjectFileIO.h \
ProjectFileIORegistry.h ProjectFSCK.cpp ProjectFSCK.h \ ProjectFileIORegistry.cpp ProjectFileIORegistry.h \
ProjectManager.cpp ProjectManager.h ProjectSettings.cpp \ ProjectFSCK.cpp ProjectFSCK.h ProjectManager.cpp \
ProjectSettings.h ProjectWindow.cpp ProjectWindow.h \ ProjectManager.h ProjectSettings.cpp ProjectSettings.h \
RealFFTf.cpp RealFFTf.h RealFFTf48x.cpp RealFFTf48x.h \ ProjectWindow.cpp ProjectWindow.h RealFFTf.cpp RealFFTf.h \
RefreshCode.h Resample.cpp Resample.h RevisionIdent.h \ RealFFTf48x.cpp RealFFTf48x.h RefreshCode.h Resample.cpp \
RingBuffer.cpp RingBuffer.h Screenshot.cpp Screenshot.h \ Resample.h RevisionIdent.h RingBuffer.cpp RingBuffer.h \
SelectedRegion.cpp SelectedRegion.h SelectionState.cpp \ Screenshot.cpp Screenshot.h SelectedRegion.cpp \
SelectionState.h Shuttle.cpp Shuttle.h \ SelectedRegion.h SelectionState.cpp SelectionState.h \
ShuttleGetDefinition.cpp ShuttleGetDefinition.h ShuttleGui.cpp \ Shuttle.cpp Shuttle.h ShuttleGetDefinition.cpp \
ShuttleGui.h ShuttlePrefs.cpp ShuttlePrefs.h Snap.cpp Snap.h \ ShuttleGetDefinition.h ShuttleGui.cpp ShuttleGui.h \
ShuttlePrefs.cpp ShuttlePrefs.h Snap.cpp Snap.h \
SoundActivatedRecord.cpp SoundActivatedRecord.h Spectrum.cpp \ SoundActivatedRecord.cpp SoundActivatedRecord.h Spectrum.cpp \
Spectrum.h SplashDialog.cpp SplashDialog.h SseMathFuncs.cpp \ Spectrum.h SplashDialog.cpp SplashDialog.h SseMathFuncs.cpp \
SseMathFuncs.h Tags.cpp Tags.h Theme.cpp Theme.h \ 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-Profiler.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-Project.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-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-ProjectFSCK.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-ProjectFileIO.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@ @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@ @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` @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 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_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 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audacity-ProjectFileIO.Tpo $(DEPDIR)/audacity-ProjectFileIO.Po

197
src/ProjectAudioManager.cpp Normal file
View File

@ -0,0 +1,197 @@
/**********************************************************************
Audacity: A Digital Audio Editor
ProjectAudioManager.cpp
Paul Licameli split from ProjectManager.cpp
**********************************************************************/
#include "ProjectAudioManager.h"
#include <wx/frame.h>
#include <wx/statusbr.h>
#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;
}

53
src/ProjectAudioManager.h Normal file
View File

@ -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

View File

@ -19,7 +19,6 @@ Paul Licameli split from AudacityProject.cpp
#include "Clipboard.h" #include "Clipboard.h"
#include "DirManager.h" #include "DirManager.h"
#include "FileNames.h" #include "FileNames.h"
#include "LabelTrack.h"
#include "Legacy.h" #include "Legacy.h"
#include "Menus.h" #include "Menus.h"
#include "MissingAliasFileDialog.h" #include "MissingAliasFileDialog.h"
@ -27,6 +26,7 @@ Paul Licameli split from AudacityProject.cpp
#include "PlatformCompatibility.h" #include "PlatformCompatibility.h"
#include "Project.h" #include "Project.h"
#include "ProjectAudioIO.h" #include "ProjectAudioIO.h"
#include "ProjectAudioManager.h"
#include "ProjectFileIO.h" #include "ProjectFileIO.h"
#include "ProjectFileIORegistry.h" #include "ProjectFileIORegistry.h"
#include "ProjectFSCK.h" #include "ProjectFSCK.h"
@ -55,7 +55,6 @@ Paul Licameli split from AudacityProject.cpp
#include "widgets/AudacityMessageBox.h" #include "widgets/AudacityMessageBox.h"
#include "widgets/FileHistory.h" #include "widgets/FileHistory.h"
#include "widgets/ErrorDialog.h" #include "widgets/ErrorDialog.h"
#include "widgets/Warning.h"
#include <wx/dataobj.h> #include <wx/dataobj.h>
#include <wx/dnd.h> #include <wx/dnd.h>
@ -391,7 +390,7 @@ AudacityProject *ProjectManager::New()
} }
//Initialise the Listeners //Initialise the Listeners
gAudioIO->SetListener( &projectManager ); gAudioIO->SetListener( &ProjectAudioManager::Get( project ) );
SelectionBar::Get( project ).SetListener( &projectManager ); SelectionBar::Get( project ).SetListener( &projectManager );
#ifdef EXPERIMENTAL_SPECTRAL_EDITING #ifdef EXPERIMENTAL_SPECTRAL_EDITING
SpectralSelectionBar::Get( project ).SetListener( &projectManager ); SpectralSelectionBar::Get( project ).SetListener( &projectManager );
@ -420,36 +419,6 @@ AudacityProject *ProjectManager::New()
return p; 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() bool ProjectManager::SnapSelection()
{ {
auto &project = mProject; 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 // Since we're going to be destroyed, make sure we're not to
// receive audio notifications anymore. // receive audio notifications anymore.
if (gAudioIO->GetListener() == this) { if ( gAudioIO->GetListener() == &ProjectAudioManager::Get( project ) ) {
auto active = GetActiveProject(); auto active = GetActiveProject();
gAudioIO->SetListener( gAudioIO->SetListener(
active ? &ProjectManager::Get( *active ) : nullptr active ? &ProjectAudioManager::Get( *active ) : nullptr
); );
} }
@ -1987,122 +1956,6 @@ void ProjectManager::OnStatusChange( wxCommandEvent & )
RestartTimer(); 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 ProjectManager::GetHoursMinsString(int iMinutes)
{ {
wxString sFormatted; wxString sFormatted;

View File

@ -16,7 +16,6 @@ Paul Licameli split from AudacityProject.h
#include <wx/event.h> // to inherit #include <wx/event.h> // to inherit
#include "ClientData.h" // to inherit #include "ClientData.h" // to inherit
#include "AudioIOListener.h" // to inherit
#include "toolbars/SelectionBarListener.h" // to inherit #include "toolbars/SelectionBarListener.h" // to inherit
#include "toolbars/SpectralSelectionBarListener.h" // to inherit #include "toolbars/SpectralSelectionBarListener.h" // to inherit
#include "import/ImportRaw.h" // defines TrackHolders #include "import/ImportRaw.h" // defines TrackHolders
@ -43,7 +42,6 @@ using WaveTrackArray = std::vector < std::shared_ptr < WaveTrack > >;
class ProjectManager final class ProjectManager final
: public wxEvtHandler : public wxEvtHandler
, public ClientData::Base , public ClientData::Base
, public AudioIOListener
, private SelectionBarListener , private SelectionBarListener
, private SpectralSelectionBarListener , private SpectralSelectionBarListener
{ {
@ -135,10 +133,6 @@ public:
// projects // projects
void PopState(const UndoState &state); void PopState(const UndoState &state);
bool IsTimerRecordCancelled() { return mTimerRecordCanceled; }
void SetTimerRecordCancelled() { mTimerRecordCanceled = true; }
void ResetTimerRecordCancelled() { mTimerRecordCanceled = false; }
void SetMenuClose(bool value) { mMenuClose = value; } void SetMenuClose(bool value) { mMenuClose = value; }
// SelectionBarListener callback methods // SelectionBarListener callback methods
@ -169,12 +163,6 @@ private:
bool SnapSelection(); 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 InitialState();
void RestartTimer(); void RestartTimer();
@ -203,15 +191,9 @@ private:
// Are we currently closing as the result of a menu command? // Are we currently closing as the result of a menu command?
bool mMenuClose{ false }; bool mMenuClose{ false };
//flag for cancellation of timer record.
bool mTimerRecordCanceled{ false };
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
static bool sbWindowRectAlreadySaved; static bool sbWindowRectAlreadySaved;
}; };
AudioIOStartStreamOptions DefaultPlayOptions( AudacityProject &project );
AudioIOStartStreamOptions DefaultSpeedPlayOptions( AudacityProject &project );
#endif #endif

View File

@ -55,7 +55,7 @@ greater use in future.
#include "../PluginManager.h" #include "../PluginManager.h"
#include "../Prefs.h" #include "../Prefs.h"
#include "../Project.h" #include "../Project.h"
#include "../ProjectManager.h" #include "../ProjectAudioManager.h"
#include "../ProjectSettings.h" #include "../ProjectSettings.h"
#include "../PluginManager.h" #include "../PluginManager.h"
#include "../ShuttleGui.h" #include "../ShuttleGui.h"

View File

@ -9,6 +9,7 @@
#include "../Prefs.h" #include "../Prefs.h"
#include "../Project.h" #include "../Project.h"
#include "../ProjectAudioIO.h" #include "../ProjectAudioIO.h"
#include "../ProjectAudioManager.h"
#include "../ProjectFileIO.h" #include "../ProjectFileIO.h"
#include "../ProjectManager.h" #include "../ProjectManager.h"
#include "../ProjectSettings.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(), // However, we can't undo it here because the PushState() is called in TrackPanel::OnTimer(),
// which is blocked by this function. // which is blocked by this function.
// so instead we mark a flag to undo it there. // so instead we mark a flag to undo it there.
ProjectManager::Get( project ).SetTimerRecordCancelled(); ProjectAudioManager::Get( project ).SetTimerRecordCancelled();
break; break;
case POST_TIMER_RECORD_NOTHING: case POST_TIMER_RECORD_NOTHING:
// No action required // No action required

View File

@ -67,7 +67,7 @@
#include "../Prefs.h" #include "../Prefs.h"
#include "../Project.h" #include "../Project.h"
#include "../ProjectAudioIO.h" #include "../ProjectAudioIO.h"
#include "../ProjectManager.h" #include "../ProjectAudioManager.h"
#include "../ProjectSettings.h" #include "../ProjectSettings.h"
#include "../ProjectWindow.h" #include "../ProjectWindow.h"
#include "../ViewInfo.h" #include "../ViewInfo.h"

View File

@ -39,7 +39,7 @@
#include "../ImageManipulation.h" #include "../ImageManipulation.h"
#include "../KeyboardCapture.h" #include "../KeyboardCapture.h"
#include "../Project.h" #include "../Project.h"
#include "../ProjectManager.h" #include "../ProjectAudioManager.h"
#include "../TimeTrack.h" #include "../TimeTrack.h"
#include "../ViewInfo.h" #include "../ViewInfo.h"
#include "../WaveTrack.h" #include "../WaveTrack.h"

View File

@ -20,7 +20,7 @@ Paul Licameli split from TrackPanel.cpp
#include "../../Menus.h" #include "../../Menus.h"
#include "../../Project.h" #include "../../Project.h"
#include "../../ProjectAudioIO.h" #include "../../ProjectAudioIO.h"
#include "../../ProjectManager.h" #include "../../ProjectAudioManager.h"
#include "../../TrackPanel.h" #include "../../TrackPanel.h"
#include "../../ViewInfo.h" #include "../../ViewInfo.h"
#include "../../prefs/PlaybackPrefs.h" #include "../../prefs/PlaybackPrefs.h"

View File

@ -68,7 +68,7 @@
#include "../ImageManipulation.h" #include "../ImageManipulation.h"
#include "../prefs/GUISettings.h" #include "../prefs/GUISettings.h"
#include "../Project.h" #include "../Project.h"
#include "../ProjectManager.h" #include "../ProjectAudioManager.h"
#include "../Prefs.h" #include "../Prefs.h"
#include "../ShuttleGui.h" #include "../ShuttleGui.h"

View File

@ -222,6 +222,7 @@
<ClCompile Include="..\..\..\src\Profiler.cpp" /> <ClCompile Include="..\..\..\src\Profiler.cpp" />
<ClCompile Include="..\..\..\src\Project.cpp" /> <ClCompile Include="..\..\..\src\Project.cpp" />
<ClCompile Include="..\..\..\src\ProjectAudioIO.cpp" /> <ClCompile Include="..\..\..\src\ProjectAudioIO.cpp" />
<ClCompile Include="..\..\..\src\ProjectAudioManager.cpp" />
<ClCompile Include="..\..\..\src\ProjectFileIO.cpp" /> <ClCompile Include="..\..\..\src\ProjectFileIO.cpp" />
<ClCompile Include="..\..\..\src\ProjectFileIORegistry.cpp" /> <ClCompile Include="..\..\..\src\ProjectFileIORegistry.cpp" />
<ClCompile Include="..\..\..\src\ProjectFSCK.cpp" /> <ClCompile Include="..\..\..\src\ProjectFSCK.cpp" />
@ -654,6 +655,7 @@
<ClInclude Include="..\..\..\src\Profiler.h" /> <ClInclude Include="..\..\..\src\Profiler.h" />
<ClInclude Include="..\..\..\src\Project.h" /> <ClInclude Include="..\..\..\src\Project.h" />
<ClInclude Include="..\..\..\src\ProjectAudioIO.h" /> <ClInclude Include="..\..\..\src\ProjectAudioIO.h" />
<ClInclude Include="..\..\..\src\ProjectAudioManager.h" />
<ClInclude Include="..\..\..\src\ProjectFileIO.h" /> <ClInclude Include="..\..\..\src\ProjectFileIO.h" />
<ClInclude Include="..\..\..\src\ProjectFileIORegistry.h" /> <ClInclude Include="..\..\..\src\ProjectFileIORegistry.h" />
<ClInclude Include="..\..\..\src\ProjectFSCK.h" /> <ClInclude Include="..\..\..\src\ProjectFSCK.h" />

View File

@ -263,6 +263,9 @@
<ClCompile Include="..\..\..\src\ProjectAudioIO.cpp"> <ClCompile Include="..\..\..\src\ProjectAudioIO.cpp">
<Filter>src</Filter> <Filter>src</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\..\src\ProjectAudioManager.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\ProjectFileIO.cpp"> <ClCompile Include="..\..\..\src\ProjectFileIO.cpp">
<Filter>src</Filter> <Filter>src</Filter>
</ClCompile> </ClCompile>
@ -1336,6 +1339,9 @@
<ClInclude Include="..\..\..\src\ProjectAudioIO.h"> <ClInclude Include="..\..\..\src\ProjectAudioIO.h">
<Filter>src</Filter> <Filter>src</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\..\src\ProjectAudioManager.h">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="..\..\..\src\ProjectFileIO.h"> <ClInclude Include="..\..\..\src\ProjectFileIO.h">
<Filter>src</Filter> <Filter>src</Filter>
</ClInclude> </ClInclude>