Prepare to split AudioIOBase from AudioIO...
... New files, but (almost) empty; don't use the global variable gAudioIO, but use one of two accessor function names (which are the same function for now). AudioIOBase will have fewer dependencies than AudioIO -- in particular, no dependency on tracks. It won't include StartStream. It will contain functions to query the present state of streams, and device capabilities.
This commit is contained in:
parent
46bf5a82fc
commit
42a4f55ffe
|
@ -23,7 +23,7 @@
|
|||
#include <wx/textctrl.h>
|
||||
#include <wx/toolbar.h>
|
||||
|
||||
#include "AudioIO.h"
|
||||
#include "AudioIOBase.h"
|
||||
#include "LabelTrack.h"
|
||||
#include "Menus.h"
|
||||
#include "ModuleManager.h"
|
||||
|
@ -1590,6 +1590,7 @@ void NyqBench::OnRunUpdate(wxUpdateUIEvent & e)
|
|||
wxToolBar *tbar = GetToolBar();
|
||||
wxMenuBar *mbar = GetMenuBar();
|
||||
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (p && gAudioIO->IsBusy()) {
|
||||
mbar->Enable(ID_GO, false);
|
||||
mbar->Enable(ID_STOP, false);
|
||||
|
|
|
@ -41,6 +41,8 @@ src/AudacityLogger.cpp
|
|||
src/AudacityLogger.h
|
||||
src/AudioIO.cpp
|
||||
src/AudioIO.h
|
||||
src/AudioIOBase.cpp
|
||||
src/AudioIOBase.h
|
||||
src/AudioIOListener.h
|
||||
src/AutoRecovery.cpp
|
||||
src/AutoRecovery.h
|
||||
|
|
|
@ -1217,6 +1217,7 @@
|
|||
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 */; };
|
||||
5E135A4B22A5F7560076E983 /* AudioIOBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5E135A4922A5F7560076E983 /* AudioIOBase.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 */; };
|
||||
|
@ -3191,6 +3192,8 @@
|
|||
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>"; };
|
||||
5E135A4922A5F7560076E983 /* AudioIOBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioIOBase.cpp; sourceTree = "<group>"; };
|
||||
5E135A4A22A5F7560076E983 /* AudioIOBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioIOBase.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>"; };
|
||||
5E15123A1DB000C000702E29 /* TrackPanelMouseEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackPanelMouseEvent.h; sourceTree = "<group>"; };
|
||||
|
@ -4331,6 +4334,7 @@
|
|||
5E78388D1DE4995E003270C0 /* AudacityException.cpp */,
|
||||
28C3946B1818356800FDDAC9 /* AudacityLogger.cpp */,
|
||||
1790AFD209883BFD008A330A /* AudioIO.cpp */,
|
||||
5E135A4922A5F7560076E983 /* AudioIOBase.cpp */,
|
||||
28560C8F0A75E40F00A3429E /* AutoRecovery.cpp */,
|
||||
5E19F59722A9665500E3F88E /* AutoRecoveryDialog.cpp */,
|
||||
1790AFD409883BFD008A330A /* BatchCommandDialog.cpp */,
|
||||
|
@ -4443,6 +4447,7 @@
|
|||
1790AFD009883BFD008A330A /* AudacityHeaders.h */,
|
||||
28C3946C1818356800FDDAC9 /* AudacityLogger.h */,
|
||||
1790AFD309883BFD008A330A /* AudioIO.h */,
|
||||
5E135A4A22A5F7560076E983 /* AudioIOBase.h */,
|
||||
28F996D91A2A9261008FEEF3 /* AudioIOListener.h */,
|
||||
28560C900A75E40F00A3429E /* AutoRecovery.h */,
|
||||
5E19F59822A9665500E3F88E /* AutoRecoveryDialog.h */,
|
||||
|
@ -8710,6 +8715,7 @@
|
|||
28001B3E1A0F0E5D007DD161 /* NumericTextCtrl.cpp in Sources */,
|
||||
28001B4B1A0F0EB6007DD161 /* SpectralSelectionBar.cpp in Sources */,
|
||||
28BB98051A15BE6800D1CC80 /* NoiseReduction.cpp in Sources */,
|
||||
5E135A4B22A5F7560076E983 /* AudioIOBase.cpp in Sources */,
|
||||
5E74D2E41CC4429700D88B0B /* PlayIndicatorOverlay.cpp in Sources */,
|
||||
5E73965C1DAFDAA400BA0A4D /* BackgroundCell.cpp in Sources */,
|
||||
28D000A51A32920C00367B21 /* DeviceChange.cpp in Sources */,
|
||||
|
|
|
@ -1695,6 +1695,7 @@ void AdornedRulerPanel::UpdateButtonStates()
|
|||
pinButton->PopUp();
|
||||
else
|
||||
pinButton->PushDown();
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
pinButton->SetAlternateIdx(
|
||||
(gAudioIO->IsCapturing() ? 2 : 0) + (state ? 0 : 1));
|
||||
// Bug 1584: Toltip now shows what clicking will do.
|
||||
|
|
|
@ -1619,6 +1619,7 @@ void AudacityApp::OnKeyDown(wxKeyEvent &event)
|
|||
auto scrubbing = scrubber.HasMark();
|
||||
if (scrubbing)
|
||||
scrubber.Cancel();
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
if((token > 0 &&
|
||||
gAudioIO->IsAudioTokenActive(token) &&
|
||||
gAudioIO->GetNumCaptureChannels() == 0) ||
|
||||
|
|
|
@ -1155,6 +1155,11 @@ AudioIO::~AudioIO()
|
|||
gAudioIO = nullptr;
|
||||
}
|
||||
|
||||
AudioIO *AudioIO::Get()
|
||||
{
|
||||
return gAudioIO;
|
||||
}
|
||||
|
||||
void AudioIO::SetMixer(int inputSource)
|
||||
{
|
||||
#if defined(USE_PORTMIXER)
|
||||
|
|
|
@ -800,6 +800,8 @@ class AUDACITY_DLL_API AudioIO final : public AudioIoCallback {
|
|||
AudioIO();
|
||||
~AudioIO();
|
||||
|
||||
// This might return null during application startup or shutdown
|
||||
static AudioIO *Get();
|
||||
|
||||
public:
|
||||
|
||||
|
@ -1189,4 +1191,6 @@ private:
|
|||
void StartStreamCleanup(bool bOnlyBuffers = false);
|
||||
};
|
||||
|
||||
using AudioIOBase = AudioIO;
|
||||
|
||||
#endif
|
||||
|
|
0
src/AudioIOBase.cpp
Normal file
0
src/AudioIOBase.cpp
Normal file
16
src/AudioIOBase.h
Normal file
16
src/AudioIOBase.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
AudioIOBase.h
|
||||
|
||||
Paul Licameli split from AudioIO.h
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_AUDIO_IO_BASE__
|
||||
#define __AUDACITY_AUDIO_IO_BASE__
|
||||
|
||||
#include "AudioIO.h"
|
||||
|
||||
#endif
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "wxFileNameWrapper.h"
|
||||
#include "AudacityLogger.h"
|
||||
#include "AudioIO.h"
|
||||
#include "AudioIOBase.h"
|
||||
#include "FileNames.h"
|
||||
#include "Internat.h"
|
||||
#include "prefs/GUIPrefs.h"
|
||||
|
@ -38,6 +38,7 @@ void Generate(wxDebugReport::Context ctx)
|
|||
GUIPrefs::InitLang( wxT("en") );
|
||||
auto cleanup = finally( [&]{ GUIPrefs::InitLang( saveLang ); } );
|
||||
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
rpt.AddText(wxT("audiodev.txt"), gAudioIO->GetDeviceInfo(), wxT("Audio Device Info"));
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
rpt.AddText(wxT("mididev.txt"), gAudioIO->GetMidiDeviceInfo(), wxT("MIDI Device Info"));
|
||||
|
|
|
@ -259,6 +259,7 @@ void DeviceManager::Rescan()
|
|||
if (m_inited) {
|
||||
// check to see if there is a stream open - can happen if monitoring,
|
||||
// but otherwise Rescan() should not be available to the user.
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
if (gAudioIO) {
|
||||
if (gAudioIO->IsMonitoring())
|
||||
{
|
||||
|
|
|
@ -1770,6 +1770,7 @@ bool LabelTrack::DoCaptureKey(wxKeyEvent & event)
|
|||
// If we're playing, don't capture if the selection is the same as the
|
||||
// playback region (this helps prevent label track creation from
|
||||
// stealing unmodified kbd. shortcuts)
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (pProj->GetAudioIOToken() > 0 &&
|
||||
gAudioIO->IsStreamActive(pProj->GetAudioIOToken()))
|
||||
{
|
||||
|
|
|
@ -480,6 +480,7 @@ void LyricsPanel::UpdateLyrics(wxEvent &e)
|
|||
e.Skip();
|
||||
|
||||
// It's crucial to not do that repopulating during playback.
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO->IsStreamActive()) {
|
||||
mDelayedUpdate = true;
|
||||
return;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include "LyricsWindow.h"
|
||||
#include "Lyrics.h"
|
||||
#include "AudioIO.h"
|
||||
#include "AudioIOBase.h"
|
||||
#include "Prefs.h" // for RTL_WORKAROUND
|
||||
#include "Project.h"
|
||||
#include "ProjectAudioIO.h"
|
||||
|
@ -155,6 +155,7 @@ void LyricsWindow::OnTimer(wxCommandEvent &event)
|
|||
{
|
||||
if (ProjectAudioIO::Get( *mProject ).IsAudioActive())
|
||||
{
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
GetLyricsPanel()->Update(gAudioIO->GetStreamTime());
|
||||
}
|
||||
else
|
||||
|
|
|
@ -112,6 +112,8 @@ audacity_SOURCES = \
|
|||
AudacityLogger.h \
|
||||
AudioIO.cpp \
|
||||
AudioIO.h \
|
||||
AudioIOBase.cpp \
|
||||
AudioIOBase.h \
|
||||
AudioIOListener.h \
|
||||
AutoRecovery.cpp \
|
||||
AutoRecovery.h \
|
||||
|
|
|
@ -290,8 +290,9 @@ am__audacity_SOURCES_DIST = BlockFile.cpp BlockFile.h DirManager.cpp \
|
|||
AdornedRulerPanel.h AllThemeResources.h Audacity.h \
|
||||
AudacityApp.cpp AudacityApp.h AudacityException.cpp \
|
||||
AudacityException.h AudacityLogger.cpp AudacityLogger.h \
|
||||
AudioIO.cpp AudioIO.h AudioIOListener.h AutoRecovery.cpp \
|
||||
AutoRecovery.h AutoRecoveryDialog.cpp AutoRecoveryDialog.h \
|
||||
AudioIO.cpp AudioIO.h AudioIOBase.cpp AudioIOBase.h \
|
||||
AudioIOListener.h AutoRecovery.cpp AutoRecovery.h \
|
||||
AutoRecoveryDialog.cpp AutoRecoveryDialog.h \
|
||||
BatchCommandDialog.cpp BatchCommandDialog.h BatchCommands.cpp \
|
||||
BatchCommands.h BatchProcessDialog.cpp BatchProcessDialog.h \
|
||||
Benchmark.cpp Benchmark.h CellularPanel.cpp CellularPanel.h \
|
||||
|
@ -636,7 +637,7 @@ am_audacity_OBJECTS = $(am__objects_1) audacity-AboutDialog.$(OBJEXT) \
|
|||
audacity-AudacityApp.$(OBJEXT) \
|
||||
audacity-AudacityException.$(OBJEXT) \
|
||||
audacity-AudacityLogger.$(OBJEXT) audacity-AudioIO.$(OBJEXT) \
|
||||
audacity-AutoRecovery.$(OBJEXT) \
|
||||
audacity-AudioIOBase.$(OBJEXT) audacity-AutoRecovery.$(OBJEXT) \
|
||||
audacity-AutoRecoveryDialog.$(OBJEXT) \
|
||||
audacity-BatchCommandDialog.$(OBJEXT) \
|
||||
audacity-BatchCommands.$(OBJEXT) \
|
||||
|
@ -1366,8 +1367,9 @@ audacity_SOURCES = $(libaudacity_la_SOURCES) AboutDialog.cpp \
|
|||
AdornedRulerPanel.h AllThemeResources.h Audacity.h \
|
||||
AudacityApp.cpp AudacityApp.h AudacityException.cpp \
|
||||
AudacityException.h AudacityLogger.cpp AudacityLogger.h \
|
||||
AudioIO.cpp AudioIO.h AudioIOListener.h AutoRecovery.cpp \
|
||||
AutoRecovery.h AutoRecoveryDialog.cpp AutoRecoveryDialog.h \
|
||||
AudioIO.cpp AudioIO.h AudioIOBase.cpp AudioIOBase.h \
|
||||
AudioIOListener.h AutoRecovery.cpp AutoRecovery.h \
|
||||
AutoRecoveryDialog.cpp AutoRecoveryDialog.h \
|
||||
BatchCommandDialog.cpp BatchCommandDialog.h BatchCommands.cpp \
|
||||
BatchCommands.h BatchProcessDialog.cpp BatchProcessDialog.h \
|
||||
Benchmark.cpp Benchmark.h CellularPanel.cpp CellularPanel.h \
|
||||
|
@ -2522,6 +2524,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-AudacityException.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-AudacityLogger.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-AudioIO.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-AudioIOBase.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-AutoRecovery.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-AutoRecoveryDialog.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audacity-BatchCommandDialog.Po@am__quote@
|
||||
|
@ -3371,6 +3374,20 @@ audacity-AudioIO.obj: AudioIO.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-AudioIO.obj `if test -f 'AudioIO.cpp'; then $(CYGPATH_W) 'AudioIO.cpp'; else $(CYGPATH_W) '$(srcdir)/AudioIO.cpp'; fi`
|
||||
|
||||
audacity-AudioIOBase.o: AudioIOBase.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT audacity-AudioIOBase.o -MD -MP -MF $(DEPDIR)/audacity-AudioIOBase.Tpo -c -o audacity-AudioIOBase.o `test -f 'AudioIOBase.cpp' || echo '$(srcdir)/'`AudioIOBase.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audacity-AudioIOBase.Tpo $(DEPDIR)/audacity-AudioIOBase.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='AudioIOBase.cpp' object='audacity-AudioIOBase.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-AudioIOBase.o `test -f 'AudioIOBase.cpp' || echo '$(srcdir)/'`AudioIOBase.cpp
|
||||
|
||||
audacity-AudioIOBase.obj: AudioIOBase.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT audacity-AudioIOBase.obj -MD -MP -MF $(DEPDIR)/audacity-AudioIOBase.Tpo -c -o audacity-AudioIOBase.obj `if test -f 'AudioIOBase.cpp'; then $(CYGPATH_W) 'AudioIOBase.cpp'; else $(CYGPATH_W) '$(srcdir)/AudioIOBase.cpp'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audacity-AudioIOBase.Tpo $(DEPDIR)/audacity-AudioIOBase.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='AudioIOBase.cpp' object='audacity-AudioIOBase.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-AudioIOBase.obj `if test -f 'AudioIOBase.cpp'; then $(CYGPATH_W) 'AudioIOBase.cpp'; else $(CYGPATH_W) '$(srcdir)/AudioIOBase.cpp'; fi`
|
||||
|
||||
audacity-AutoRecovery.o: AutoRecovery.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT audacity-AutoRecovery.o -MD -MP -MF $(DEPDIR)/audacity-AutoRecovery.Tpo -c -o audacity-AutoRecovery.o `test -f 'AutoRecovery.cpp' || echo '$(srcdir)/'`AutoRecovery.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/audacity-AutoRecovery.Tpo $(DEPDIR)/audacity-AutoRecovery.Po
|
||||
|
|
|
@ -429,6 +429,7 @@ CommandFlag MenuManager::GetUpdateFlags
|
|||
}
|
||||
|
||||
// These flags are cheap to calculate.
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
if (!gAudioIO->IsAudioTokenActive(ProjectAudioIO::Get( project )
|
||||
.GetAudioIOToken()))
|
||||
flags |= AudioIONotBusyFlag;
|
||||
|
|
|
@ -1350,6 +1350,7 @@ void MixerBoard::OnTimer(wxCommandEvent &event)
|
|||
// audacityAudioCallback where it calls gAudioIO->mOutputMeter->UpdateDisplay().
|
||||
if (ProjectAudioIO::Get( *mProject ).IsAudioActive())
|
||||
{
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
UpdateMeters(
|
||||
gAudioIO->GetStreamTime(),
|
||||
(ControlToolBar::Get( *mProject ).GetLastPlayMode()
|
||||
|
|
|
@ -10,7 +10,7 @@ Paul Licameli split from AudacityProject.cpp
|
|||
|
||||
#include "ProjectAudioIO.h"
|
||||
|
||||
#include "AudioIO.h"
|
||||
#include "AudioIOBase.h"
|
||||
#include "Project.h"
|
||||
|
||||
static const AudacityProject::AttachedObjects::RegisteredFactory sAudioIOKey{
|
||||
|
@ -50,6 +50,7 @@ void ProjectAudioIO::SetAudioIOToken(int token)
|
|||
|
||||
bool ProjectAudioIO::IsAudioActive() const
|
||||
{
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
return GetAudioIOToken() > 0 &&
|
||||
gAudioIO->IsStreamActive(GetAudioIOToken());
|
||||
}
|
||||
|
@ -63,6 +64,7 @@ void ProjectAudioIO::SetPlaybackMeter(MeterPanel *playback)
|
|||
{
|
||||
auto &project = mProject;
|
||||
mPlaybackMeter = playback;
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO)
|
||||
{
|
||||
gAudioIO->SetPlaybackMeter( &project , mPlaybackMeter );
|
||||
|
@ -79,6 +81,7 @@ void ProjectAudioIO::SetCaptureMeter(MeterPanel *capture)
|
|||
auto &project = mProject;
|
||||
mCaptureMeter = capture;
|
||||
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO)
|
||||
{
|
||||
gAudioIO->SetCaptureMeter( &project, mCaptureMeter );
|
||||
|
|
|
@ -96,6 +96,7 @@ void ProjectAudioManager::OnAudioIOStopRecording()
|
|||
if (projectAudioIO.GetAudioIOToken() > 0)
|
||||
{
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
auto &intervals = gAudioIO->LostCaptureIntervals();
|
||||
if (intervals.size()) {
|
||||
// Make a track with labels for recording errors
|
||||
|
@ -185,6 +186,7 @@ AudioIOStartStreamOptions
|
|||
DefaultSpeedPlayOptions( AudacityProject &project )
|
||||
{
|
||||
auto &projectAudioIO = ProjectAudioIO::Get( project );
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
auto PlayAtSpeedRate = gAudioIO->GetBestRate(
|
||||
false, //not capturing
|
||||
true, //is playing
|
||||
|
|
|
@ -382,6 +382,7 @@ AudacityProject *ProjectManager::New()
|
|||
}
|
||||
|
||||
//Initialise the Listeners
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
gAudioIO->SetListener( &ProjectAudioManager::Get( project ) );
|
||||
auto &projectSelectionManager = ProjectSelectionManager::Get( project );
|
||||
SelectionBar::Get( project ).SetListener( &projectSelectionManager );
|
||||
|
@ -425,6 +426,7 @@ void ProjectManager::OnCloseWindow(wxCloseEvent & event)
|
|||
auto &projectAudioIO = ProjectAudioIO::Get( project );
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &window = ProjectWindow::Get( project );
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
|
||||
// We are called for the wxEVT_CLOSE_WINDOW, wxEVT_END_SESSION, and
|
||||
// wxEVT_QUERY_END_SESSION, so we have to protect against multiple
|
||||
|
@ -760,6 +762,7 @@ void ProjectManager::OnTimer(wxTimerEvent& WXUNUSED(event))
|
|||
|
||||
auto &statusBar = *window.GetStatusBar();
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
// gAudioIO->GetNumCaptureChannels() should only be positive
|
||||
// when we are recording.
|
||||
if (projectAudioIO.GetAudioIOToken() > 0 && gAudioIO->GetNumCaptureChannels() > 0) {
|
||||
|
|
|
@ -12,7 +12,7 @@ Paul Licameli split from AudacityProject.cpp
|
|||
|
||||
#include "Experimental.h"
|
||||
|
||||
#include "AudioIO.h"
|
||||
#include "AudioIOBase.h"
|
||||
#include "Project.h"
|
||||
#include "Snap.h"
|
||||
#include "prefs/QualityPrefs.h"
|
||||
|
@ -65,7 +65,7 @@ ProjectSettings::ProjectSettings( AudacityProject &project )
|
|||
, mSnapTo( gPrefs->Read(wxT("/SnapTo"), SNAP_OFF) )
|
||||
{
|
||||
if (!gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"), &mRate,
|
||||
AudioIO::GetOptimalSupportedSampleRate())) {
|
||||
AudioIOBase::GetOptimalSupportedSampleRate())) {
|
||||
// The default given above can vary with host/devices. So unless there is
|
||||
// an entry for the default sample rate in audacity.cfg, Audacity can open
|
||||
// with a rate which is different from the rate with which it closed.
|
||||
|
@ -101,7 +101,7 @@ void ProjectSettings::UpdatePrefs()
|
|||
// Do not change this project's rate, unless there are no tracks.
|
||||
if( TrackList::Get( *this ).size() == 0){
|
||||
gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"), &mRate,
|
||||
AudioIO::GetOptimalSupportedSampleRate());
|
||||
AudioIOBase::GetOptimalSupportedSampleRate());
|
||||
// If necessary, we change this rate in the selection toolbar too.
|
||||
auto bar = SelectionBar::Get( *this );
|
||||
bar.SetRate( mRate );
|
||||
|
|
|
@ -14,7 +14,7 @@ Paul Licameli split from AudacityProject.cpp
|
|||
|
||||
#include "AdornedRulerPanel.h"
|
||||
#include "AllThemeResources.h"
|
||||
#include "AudioIO.h"
|
||||
#include "AudioIOBase.h"
|
||||
#include "Menus.h"
|
||||
#include "Project.h"
|
||||
#include "ProjectAudioIO.h"
|
||||
|
@ -1555,6 +1555,7 @@ void ProjectWindow::TP_DisplaySelection()
|
|||
double audioTime;
|
||||
auto &playRegion = ViewInfo::Get( project ).playRegion;
|
||||
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (!gAudioIO->IsBusy() && !playRegion.Locked())
|
||||
ruler.SetPlayRegion( selectedRegion.t0(), selectedRegion.t1() );
|
||||
else
|
||||
|
@ -1664,6 +1665,7 @@ void ProjectWindow::ZoomInByFactor( double ZoomFactor )
|
|||
auto &trackPanel = TrackPanel::Get( project );
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
// LLL: Handling positioning differently when audio is
|
||||
// actively playing. Don't do this if paused.
|
||||
if (gAudioIO->IsStreamActive(
|
||||
|
|
|
@ -471,6 +471,7 @@ void TrackPanel::OnTimer(wxTimerEvent& )
|
|||
auto &window = ProjectWindow::Get( *p );
|
||||
|
||||
auto &projectAudioIO = ProjectAudioIO::Get( *p );
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
|
||||
// Check whether we were playing or recording, but the stream has stopped.
|
||||
if (projectAudioIO.GetAudioIOToken()>0 && !IsAudioActive())
|
||||
|
|
|
@ -14,7 +14,7 @@ Paul Licameli
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include "AudioIO.h"
|
||||
#include "AudioIOBase.h"
|
||||
#include "prefs/GUISettings.h"
|
||||
#include "Prefs.h"
|
||||
#include "Project.h"
|
||||
|
@ -245,6 +245,7 @@ bool ViewInfo::ReadXMLAttribute(const wxChar *attr, const wxChar *value)
|
|||
|
||||
void ViewInfo::OnTimer(wxCommandEvent &event)
|
||||
{
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
mRecentStreamTime = gAudioIO->GetStreamTime();
|
||||
event.Skip();
|
||||
// Propagate the message to other listeners bound to this
|
||||
|
|
|
@ -2494,6 +2494,7 @@ void Effect::Preview(bool dryOnly)
|
|||
return;
|
||||
}
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
if (gAudioIO->IsBusy()) {
|
||||
return;
|
||||
}
|
||||
|
@ -2994,6 +2995,7 @@ bool EffectUIHost::Initialize()
|
|||
w->SetMinSize(wxSize(wxMax(600, mParent->GetSize().GetWidth() * 2 / 3),
|
||||
mParent->GetSize().GetHeight() / 2));
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
mDisableTransport = !gAudioIO->IsAvailable(mProject);
|
||||
mPlaying = gAudioIO->IsStreamActive(); // not exactly right, but will suffice
|
||||
mCapturing = gAudioIO->IsStreamActive() && gAudioIO->GetNumCaptureChannels() > 0;
|
||||
|
@ -3504,6 +3506,7 @@ void EffectUIHost::OnPlay(wxCommandEvent & WXUNUSED(evt))
|
|||
|
||||
if (mPlaying)
|
||||
{
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
mPlayPos = gAudioIO->GetStreamTime();
|
||||
auto &bar = ControlToolBar::Get( *mProject );
|
||||
bar.StopPlaying();
|
||||
|
@ -3542,6 +3545,7 @@ void EffectUIHost::OnRewind(wxCommandEvent & WXUNUSED(evt))
|
|||
{
|
||||
if (mPlaying)
|
||||
{
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
double seek;
|
||||
gPrefs->Read(wxT("/AudioIO/SeekShortPeriod"), &seek, 1.0);
|
||||
|
||||
|
@ -3566,6 +3570,7 @@ void EffectUIHost::OnFFwd(wxCommandEvent & WXUNUSED(evt))
|
|||
double seek;
|
||||
gPrefs->Read(wxT("/AudioIO/SeekShortPeriod"), &seek, 1.0);
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
double pos = gAudioIO->GetStreamTime();
|
||||
if (mRegion.t0() < mRegion.t1() && pos + seek > mRegion.t1())
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "../AboutDialog.h"
|
||||
#include "../AllThemeResources.h"
|
||||
#include "../AudacityLogger.h"
|
||||
#include "../AudioIO.h"
|
||||
#include "../AudioIOBase.h"
|
||||
#include "../CrashReport.h"
|
||||
#include "../Dependencies.h"
|
||||
#include "../FileNames.h"
|
||||
|
@ -316,6 +316,7 @@ void OnManual(const CommandContext &context)
|
|||
void OnAudioDeviceInfo(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
wxString info = gAudioIO->GetDeviceInfo();
|
||||
ShowDiagnostics( project, info,
|
||||
_("Audio Device Info"), wxT("deviceinfo.txt") );
|
||||
|
@ -325,6 +326,7 @@ void OnAudioDeviceInfo(const CommandContext &context)
|
|||
void OnMidiDeviceInfo(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
wxString info = gAudioIO->GetMidiDeviceInfo();
|
||||
ShowDiagnostics( project, info,
|
||||
_("MIDI Device Info"), wxT("midideviceinfo.txt") );
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "../AudioIO.h"
|
||||
#include "../AudioIOBase.h"
|
||||
#include "../Clipboard.h"
|
||||
#include "../LabelTrack.h"
|
||||
#include "../Menus.h"
|
||||
|
@ -271,6 +271,7 @@ void OnAddLabelPlaying(const CommandContext &context)
|
|||
auto &project = context.project;
|
||||
auto token = ProjectAudioIO::Get( project ).GetAudioIOToken();
|
||||
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (token > 0 &&
|
||||
gAudioIO->IsStreamActive(token)) {
|
||||
double indicator = gAudioIO->GetStreamTime();
|
||||
|
|
|
@ -695,6 +695,7 @@ void OnSimulateRecordingErrors(const CommandContext &context)
|
|||
auto &project = context.project;
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
bool &setting = gAudioIO->mSimulateRecordingErrors;
|
||||
commandManager.Check(wxT("SimulateRecordingErrors"), !setting);
|
||||
setting = !setting;
|
||||
|
@ -705,6 +706,7 @@ void OnDetectUpstreamDropouts(const CommandContext &context)
|
|||
auto &project = context.project;
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
bool &setting = gAudioIO->mDetectUpstreamDropouts;
|
||||
commandManager.Check(wxT("DetectUpstreamDropouts"), !setting);
|
||||
setting = !setting;
|
||||
|
@ -991,6 +993,7 @@ MenuTable::BaseItemPtr ToolsMenu( AudacityProject & )
|
|||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
|
||||
return Menu( _("T&ools"),
|
||||
|
||||
|
|
|
@ -211,6 +211,7 @@ struct SeekInfo
|
|||
|
||||
void SeekWhenAudioActive(double seekStep, wxLongLong &lastSelectionAdjustment)
|
||||
{
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
#ifdef EXPERIMENTAL_IMPROVED_SEEKING
|
||||
if (gAudioIO->GetLastPlaybackTime() < lastSelectionAdjustment) {
|
||||
// Allow time for the last seek to output a buffer before
|
||||
|
@ -451,6 +452,7 @@ void DoBoundaryMove(AudacityProject &project, int step, SeekInfo &info)
|
|||
|
||||
if( ProjectAudioIO::Get( project ).IsAudioActive() )
|
||||
{
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
double indicator = gAudioIO->GetStreamTime();
|
||||
if( bMoveT0 )
|
||||
viewInfo.selectedRegion.setT0(indicator, false);
|
||||
|
@ -627,6 +629,7 @@ void OnSetLeftSelection(const CommandContext &context)
|
|||
auto &window = GetProjectFrame( project );
|
||||
|
||||
bool bSelChanged = false;
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if ((token > 0) && gAudioIO->IsStreamActive(token))
|
||||
{
|
||||
double indicator = gAudioIO->GetStreamTime();
|
||||
|
@ -667,6 +670,7 @@ void OnSetRightSelection(const CommandContext &context)
|
|||
auto &window = GetProjectFrame( project );
|
||||
|
||||
bool bSelChanged = false;
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if ((token > 0) && gAudioIO->IsStreamActive(token))
|
||||
{
|
||||
double indicator = gAudioIO->GetStreamTime();
|
||||
|
@ -853,6 +857,7 @@ void OnSelectCursorStoredCursor(const CommandContext &context)
|
|||
auto isAudioActive = ProjectAudioIO::Get( project ).IsAudioActive();
|
||||
|
||||
if (mCursorPositionHasBeenStored) {
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
double cursorPositionCurrent = isAudioActive
|
||||
? gAudioIO->GetStreamTime()
|
||||
: selectedRegion.t0();
|
||||
|
@ -871,6 +876,7 @@ void OnCursorPositionStore(const CommandContext &context)
|
|||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
auto isAudioActive = ProjectAudioIO::Get( project ).IsAudioActive();
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
mCursorPositionStored =
|
||||
isAudioActive ? gAudioIO->GetStreamTime() : selectedRegion.t0();
|
||||
mCursorPositionHasBeenStored = true;
|
||||
|
|
|
@ -47,6 +47,7 @@ bool MakeReadyToPlay(AudacityProject &project,
|
|||
wxCommandEvent evt;
|
||||
|
||||
// If this project is playing, stop playing
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO->IsStreamActive(
|
||||
ProjectAudioIO::Get( project ).GetAudioIOToken()
|
||||
)) {
|
||||
|
@ -92,6 +93,7 @@ void DoPlayStop(const CommandContext &context)
|
|||
auto token = ProjectAudioIO::Get( project ).GetAudioIOToken();
|
||||
|
||||
//If this project is playing, stop playing, make sure everything is unpaused.
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO->IsStreamActive(token)) {
|
||||
toolbar.SetPlay(false); //Pops
|
||||
toolbar.SetStop(true); //Pushes stop down
|
||||
|
@ -104,7 +106,7 @@ void DoPlayStop(const CommandContext &context)
|
|||
//find out which project we need;
|
||||
auto start = AllProjects{}.begin(), finish = AllProjects{}.end(),
|
||||
iter = std::find_if( start, finish,
|
||||
[]( const AllProjects::value_type &ptr ){
|
||||
[&]( const AllProjects::value_type &ptr ){
|
||||
return gAudioIO->IsStreamActive(
|
||||
ProjectAudioIO::Get( *ptr ).GetAudioIOToken()); } );
|
||||
|
||||
|
@ -219,6 +221,7 @@ bool DoPlayStopSelect
|
|||
auto token = ProjectAudioIO::Get( project ).GetAudioIOToken();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
auto &selection = viewInfo.selectedRegion;
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
|
||||
//If busy, stop playing, make sure everything is unpaused.
|
||||
if (scrubber.HasMark() ||
|
||||
|
@ -274,6 +277,7 @@ void DoPlayStopSelect(AudacityProject &project)
|
|||
{
|
||||
auto &toolbar = ControlToolBar::Get( project );
|
||||
wxCommandEvent evt;
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
if (DoPlayStopSelect(project, false, false))
|
||||
toolbar.OnStop(evt);
|
||||
else if (!gAudioIO->IsBusy()) {
|
||||
|
@ -511,6 +515,7 @@ void OnPunchAndRoll(const CommandContext &context)
|
|||
static const auto url =
|
||||
wxT("Punch_and_Roll_Record#Using_Punch_and_Roll_Record");
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
if (gAudioIO->IsBusy())
|
||||
return;
|
||||
|
||||
|
@ -1034,6 +1039,7 @@ void OnStopSelect(const CommandContext &context)
|
|||
auto &selectedRegion = viewInfo.selectedRegion;
|
||||
wxCommandEvent evt;
|
||||
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO->IsStreamActive()) {
|
||||
auto &controlToolbar = ControlToolBar::Get( project );
|
||||
selectedRegion.setT0(gAudioIO->GetStreamTime(), false);
|
||||
|
|
|
@ -814,6 +814,7 @@ void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event))
|
|||
SavePreferredPage();
|
||||
|
||||
#if USE_PORTMIXER
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
if (gAudioIO) {
|
||||
// We cannot have opened this dialog if gAudioIO->IsAudioTokenActive(),
|
||||
// per the setting of AudioIONotBusyFlag and AudioIOBusyFlag in
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <wx/defs.h>
|
||||
#include <wx/textctrl.h>
|
||||
|
||||
#include "../AudioIO.h"
|
||||
#include "../AudioIOBase.h"
|
||||
#include "../Dither.h"
|
||||
#include "../Prefs.h"
|
||||
#include "../Resample.h"
|
||||
|
@ -92,7 +92,7 @@ void QualityPrefs::Populate()
|
|||
GetNamesAndLabels();
|
||||
gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"),
|
||||
&mOtherSampleRateValue,
|
||||
AudioIO::GetOptimalSupportedSampleRate());
|
||||
AudioIOBase::GetOptimalSupportedSampleRate());
|
||||
|
||||
//------------------------- Main section --------------------
|
||||
// Now construct the GUI itself.
|
||||
|
@ -126,8 +126,8 @@ void QualityPrefs::GetNamesAndLabels()
|
|||
//
|
||||
// GetSupportedSampleRates() allows passing in device names, but
|
||||
// how do you get at them as they are on the Audio I/O page????
|
||||
for (int i = 0; i < AudioIO::NumStandardRates; i++) {
|
||||
int iRate = AudioIO::StandardRates[i];
|
||||
for (int i = 0; i < AudioIOBase::NumStandardRates; i++) {
|
||||
int iRate = AudioIOBase::StandardRates[i];
|
||||
mSampleRateLabels.push_back(iRate);
|
||||
mSampleRateNames.push_back(wxString::Format(wxT("%i Hz"), iRate));
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ void QualityPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||
// We make sure we have a pointer to it, so that we can drive it.
|
||||
mSampleRates = S.TieNumberAsChoice( {},
|
||||
wxT("/SamplingRate/DefaultProjectSampleRate"),
|
||||
AudioIO::GetOptimalSupportedSampleRate(),
|
||||
AudioIOBase::GetOptimalSupportedSampleRate(),
|
||||
mSampleRateNames,
|
||||
mSampleRateLabels);
|
||||
|
||||
|
|
|
@ -481,6 +481,7 @@ void ControlToolBar::EnableDisableButtons()
|
|||
bool paused = mPause->IsDown();
|
||||
bool playing = mPlay->IsDown();
|
||||
bool recording = mRecord->IsDown();
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
bool busy = gAudioIO->IsBusy();
|
||||
|
||||
// Only interested in audio type tracks
|
||||
|
@ -609,6 +610,7 @@ int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion,
|
|||
}
|
||||
} );
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
if (gAudioIO->IsBusy())
|
||||
return -1;
|
||||
|
||||
|
@ -787,6 +789,8 @@ void ControlToolBar::OnKeyEvent(wxKeyEvent & event)
|
|||
return;
|
||||
}
|
||||
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
|
||||
// Does not appear to be needed on Linux. Perhaps on some other platform?
|
||||
// If so, "!CanStopAudioStream()" should probably apply.
|
||||
if (event.GetKeyCode() == WXK_SPACE) {
|
||||
|
@ -833,6 +837,7 @@ void ControlToolBar::OnStop(wxCommandEvent & WXUNUSED(evt))
|
|||
|
||||
bool ControlToolBar::CanStopAudioStream()
|
||||
{
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
return (!gAudioIO->IsStreamActive() ||
|
||||
gAudioIO->IsMonitoring() ||
|
||||
gAudioIO->GetOwningProject() == GetActiveProject());
|
||||
|
@ -864,6 +869,8 @@ void ControlToolBar::StopPlaying(bool stopStream /* = true*/)
|
|||
|
||||
mStop->PushDown();
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
|
||||
SetStop(false);
|
||||
if(stopStream)
|
||||
gAudioIO->StopStream();
|
||||
|
@ -903,8 +910,10 @@ void ControlToolBar::StopPlaying(bool stopStream /* = true*/)
|
|||
|
||||
void ControlToolBar::Pause()
|
||||
{
|
||||
if (!CanStopAudioStream())
|
||||
if (!CanStopAudioStream()) {
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
gAudioIO->SetPaused(!gAudioIO->IsPaused());
|
||||
}
|
||||
else {
|
||||
wxCommandEvent dummy;
|
||||
OnPause(dummy);
|
||||
|
@ -1095,6 +1104,7 @@ bool ControlToolBar::DoRecord(AudacityProject &project,
|
|||
return false;
|
||||
// ...end of code from CommandHandler.
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
if (gAudioIO->IsBusy()) {
|
||||
if (!CanStopAudioStream() || 0 == gAudioIO->GetNumCaptureChannels())
|
||||
mRecord->PopUp();
|
||||
|
@ -1301,6 +1311,8 @@ void ControlToolBar::OnPause(wxCommandEvent & WXUNUSED(evt))
|
|||
mPaused=true;
|
||||
}
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
|
||||
#ifdef EXPERIMENTAL_SCRUBBING_SUPPORT
|
||||
|
||||
auto project = GetActiveProject();
|
||||
|
@ -1480,6 +1492,7 @@ void ControlToolBar::StartScrolling()
|
|||
using Mode = ProjectWindow::PlaybackScroller::Mode;
|
||||
const auto project = GetActiveProject();
|
||||
if (project) {
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
auto mode = Mode::Pinned;
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -341,6 +341,7 @@ void DeviceToolBar::UpdateSelectedPrefs( int id )
|
|||
|
||||
void DeviceToolBar::EnableDisableButtons()
|
||||
{
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
if (gAudioIO) {
|
||||
// we allow changes when monitoring, but not when recording
|
||||
bool audioStreamActive = gAudioIO->IsStreamActive() && !gAudioIO->IsMonitoring();
|
||||
|
@ -775,6 +776,7 @@ void DeviceToolBar::OnChoice(wxCommandEvent &event)
|
|||
ChangeDevice(false);
|
||||
}
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
if (gAudioIO) {
|
||||
// We cannot have gotten here if gAudioIO->IsAudioTokenActive(),
|
||||
// per the setting of AudioIONotBusyFlag and AudioIOBusyFlag in
|
||||
|
|
|
@ -120,6 +120,7 @@ void MixerToolBar::Populate()
|
|||
&MixerToolBar::OnFocus,
|
||||
this);
|
||||
// Show or hide the input slider based on whether it works
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
mInputSlider->Enable(gAudioIO->InputMixerWorks());
|
||||
|
||||
UpdateControls();
|
||||
|
@ -164,6 +165,7 @@ void MixerToolBar::UpdatePrefs()
|
|||
int inputSource;
|
||||
|
||||
// Reset the selected source
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
gAudioIO->GetMixer(&inputSource, &inputVolume, &playbackVolume);
|
||||
|
||||
// Show or hide the input slider based on whether it works
|
||||
|
@ -210,6 +212,7 @@ void MixerToolBar::UpdateControls()
|
|||
int inputSource;
|
||||
|
||||
// Show or hide the input slider based on whether it works
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
mInputSlider->Enable(gAudioIO->InputMixerWorks());
|
||||
|
||||
gAudioIO->GetMixer(&inputSource, &inputVolume, &playbackVolume);
|
||||
|
@ -236,6 +239,7 @@ void MixerToolBar::SetMixer(wxCommandEvent & WXUNUSED(event))
|
|||
float oldIn, oldOut;
|
||||
int inputSource;
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
gAudioIO->GetMixer(&inputSource, &oldIn, &oldOut);
|
||||
gAudioIO->SetMixer(inputSource, inputVolume, outputVolume);
|
||||
mOutputSliderVolume = outputVolume;
|
||||
|
@ -297,6 +301,7 @@ void MixerToolBar::SetToolTips()
|
|||
|
||||
if (mOutputSlider->IsEnabled()) {
|
||||
wxString format;
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
if (gAudioIO->OutputMixerEmulated())
|
||||
format = _("Playback Volume: %s (emulated)");
|
||||
else
|
||||
|
|
|
@ -52,7 +52,7 @@ with changes in the SelectionBar.
|
|||
|
||||
|
||||
#include "../widgets/AButton.h"
|
||||
#include "../AudioIO.h"
|
||||
#include "../AudioIOBase.h"
|
||||
#include "../AColor.h"
|
||||
#include "../KeyboardCapture.h"
|
||||
#include "../Prefs.h"
|
||||
|
@ -120,7 +120,7 @@ SelectionBar::SelectionBar()
|
|||
// Audacity to fail.
|
||||
// We expect mRate to be set from the project later.
|
||||
mRate = (double) gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"),
|
||||
AudioIO::GetOptimalSupportedSampleRate());
|
||||
AudioIOBase::GetOptimalSupportedSampleRate());
|
||||
|
||||
// Selection mode of 0 means showing 'start' and 'end' only.
|
||||
mSelectionMode = gPrefs->ReadLong(wxT("/SelectionToolbarMode"), 0);
|
||||
|
@ -711,8 +711,9 @@ void SelectionBar::UpdateRates()
|
|||
{
|
||||
wxString oldValue = mRateBox->GetValue();
|
||||
mRateBox->Clear();
|
||||
for (int i = 0; i < AudioIO::NumStandardRates; i++) {
|
||||
mRateBox->Append(wxString::Format(wxT("%d"), AudioIO::StandardRates[i]));
|
||||
for (int i = 0; i < AudioIOBase::NumStandardRates; i++) {
|
||||
mRateBox->Append(
|
||||
wxString::Format(wxT("%d"), AudioIOBase::StandardRates[i]));
|
||||
}
|
||||
mRateBox->SetValue(oldValue);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include "ControlToolBar.h"
|
||||
#include "../AllThemeResources.h"
|
||||
#include "../AudioIO.h"
|
||||
#include "../AudioIOBase.h"
|
||||
#include "../ImageManipulation.h"
|
||||
#include "../KeyboardCapture.h"
|
||||
#include "../Project.h"
|
||||
|
@ -381,6 +381,7 @@ void TranscriptionToolBar::OnKeyEvent(wxKeyEvent & event)
|
|||
}
|
||||
|
||||
if (event.GetKeyCode() == WXK_SPACE) {
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO->IsBusy()) {
|
||||
/*Do Stuff Here*/
|
||||
}
|
||||
|
@ -485,6 +486,7 @@ void TranscriptionToolBar::PlayAtSpeed(bool looped, bool cutPreview)
|
|||
SetButton(false, mButtons[TTB_PlaySpeed]);
|
||||
|
||||
// If IO is busy, abort immediately
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO->IsBusy()) {
|
||||
auto &bar = ControlToolBar::Get( *p );
|
||||
bar.StopPlaying();
|
||||
|
@ -541,6 +543,7 @@ void TranscriptionToolBar::OnSpeedSlider(wxCommandEvent& WXUNUSED(event))
|
|||
// If IO is busy, abort immediately
|
||||
// AWD: This is disabled to work around a hang on Linux when PulseAudio is
|
||||
// used. If we figure that one out we can re-enable this code.
|
||||
// auto gAudioIO = AudioIOBase::Get();
|
||||
//if (gAudioIO->IsBusy()) {
|
||||
// OnPlaySpeed(event);
|
||||
//}
|
||||
|
@ -550,6 +553,7 @@ void TranscriptionToolBar::OnSpeedSlider(wxCommandEvent& WXUNUSED(event))
|
|||
void TranscriptionToolBar::OnStartOn(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
//If IO is busy, abort immediately
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO->IsBusy()){
|
||||
SetButton(false,mButtons[TTB_StartOn]);
|
||||
return;
|
||||
|
@ -582,6 +586,7 @@ void TranscriptionToolBar::OnStartOn(wxCommandEvent & WXUNUSED(event))
|
|||
void TranscriptionToolBar::OnStartOff(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
//If IO is busy, abort immediately
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO->IsBusy()){
|
||||
SetButton(false,mButtons[TTB_StartOff]);
|
||||
return;
|
||||
|
@ -615,6 +620,7 @@ void TranscriptionToolBar::OnEndOn(wxCommandEvent & WXUNUSED(event))
|
|||
{
|
||||
|
||||
//If IO is busy, abort immediately
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO->IsBusy()){
|
||||
SetButton(false,mButtons[TTB_EndOn]);
|
||||
return;
|
||||
|
@ -650,6 +656,7 @@ void TranscriptionToolBar::OnEndOff(wxCommandEvent & WXUNUSED(event))
|
|||
{
|
||||
|
||||
//If IO is busy, abort immediately
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO->IsBusy()){
|
||||
SetButton(false,mButtons[TTB_EndOff]);
|
||||
return;
|
||||
|
@ -684,6 +691,7 @@ void TranscriptionToolBar::OnSelectSound(wxCommandEvent & WXUNUSED(event))
|
|||
{
|
||||
|
||||
//If IO is busy, abort immediately
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO->IsBusy()){
|
||||
SetButton(false,mButtons[TTB_SelectSound]);
|
||||
return;
|
||||
|
@ -723,6 +731,7 @@ void TranscriptionToolBar::OnSelectSilence(wxCommandEvent & WXUNUSED(event))
|
|||
{
|
||||
|
||||
//If IO is busy, abort immediately
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO->IsBusy()){
|
||||
SetButton(false,mButtons[TTB_SelectSilence]);
|
||||
return;
|
||||
|
@ -761,6 +770,7 @@ void TranscriptionToolBar::OnSelectSilence(wxCommandEvent & WXUNUSED(event))
|
|||
void TranscriptionToolBar::OnCalibrate(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
//If IO is busy, abort immediately
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO->IsBusy()){
|
||||
SetButton(false,mButtons[TTB_Calibrate]);
|
||||
return;
|
||||
|
@ -808,6 +818,7 @@ void TranscriptionToolBar::OnAutomateSelection(wxCommandEvent & WXUNUSED(event))
|
|||
|
||||
|
||||
//If IO is busy, abort immediately
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO->IsBusy())
|
||||
{
|
||||
SetButton(false,mButtons[TTB_EndOff]);
|
||||
|
|
|
@ -16,7 +16,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../ui/PlayableTrackButtonHandles.h"
|
||||
#include "WaveTrackSliderHandles.h"
|
||||
|
||||
#include "../../../../AudioIO.h"
|
||||
#include "../../../../AudioIOBase.h"
|
||||
#include "../../../../Menus.h"
|
||||
#include "../../../../Project.h"
|
||||
#include "../../../../ProjectAudioIO.h"
|
||||
|
@ -604,6 +604,7 @@ void WaveTrackMenuTable::InitMenu(Menu *pMenu, void *pUserData)
|
|||
|
||||
// Bug 1253. Shouldn't open preferences if audio is busy.
|
||||
// We can't change them on the fly yet anyway.
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
const bool bAudioBusy = gAudioIO->IsBusy();
|
||||
pMenu->Enable(OnSpectrogramSettingsID,
|
||||
(display == WaveTrack::Spectrum) && !bAudioBusy);
|
||||
|
@ -776,6 +777,7 @@ void WaveTrackMenuTable::OnSpectrogramSettings(wxCommandEvent &)
|
|||
const int mPage;
|
||||
};
|
||||
|
||||
auto gAudioIO = AudioIOBase::Get();
|
||||
if (gAudioIO->IsBusy()){
|
||||
AudacityMessageBox(_("To change Spectrogram Settings, stop any\n"
|
||||
"playing or recording first."),
|
||||
|
|
|
@ -69,6 +69,7 @@ std::pair<wxRect, bool> PlayIndicatorOverlayBase::DoGetRectangle(wxSize size)
|
|||
void PlayIndicatorOverlayBase::Draw(OverlayPanel &panel, wxDC &dc)
|
||||
{
|
||||
// Set play/record color
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
bool rec = gAudioIO->IsCapturing();
|
||||
AColor::IndicatorColor(&dc, !rec);
|
||||
|
||||
|
@ -186,6 +187,8 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
|
|||
// This displays the audio time, too...
|
||||
window.TP_DisplaySelection();
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
|
||||
// BG: Scroll screen if option is set
|
||||
if( viewInfo.bUpdateTrackIndicator &&
|
||||
playPos >= 0 && !onScreen ) {
|
||||
|
|
|
@ -344,6 +344,7 @@ bool Scrubber::MaybeStartScrubbing(wxCoord xx)
|
|||
const auto state = ::wxGetMouseState();
|
||||
mDragging = state.LeftIsDown();
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
const bool busy = gAudioIO->IsBusy();
|
||||
if (busy && gAudioIO->GetNumCaptureChannels() > 0) {
|
||||
// Do not stop recording, and don't try to start scrubbing after
|
||||
|
@ -468,6 +469,7 @@ bool Scrubber::StartSpeedPlay(double speed, double time0, double time1)
|
|||
if (IsScrubbing())
|
||||
return false;
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
const bool busy = gAudioIO->IsBusy();
|
||||
if (busy && gAudioIO->GetNumCaptureChannels() > 0) {
|
||||
// Do not stop recording, and don't try to start scrubbing after
|
||||
|
@ -545,6 +547,7 @@ void Scrubber::ContinueScrubbingPoll()
|
|||
// timer callback, to a left click event detected elsewhere.)
|
||||
const bool seek = TemporarilySeeks() || Seeks();
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
if (mPaused) {
|
||||
// When paused, make silent scrubs.
|
||||
mOptions.minSpeed = 0.0;
|
||||
|
@ -691,6 +694,7 @@ void Scrubber::StopPolling()
|
|||
|
||||
void Scrubber::StopScrubbing()
|
||||
{
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
gAudioIO->StopScrub();
|
||||
StopPolling();
|
||||
|
||||
|
|
|
@ -1066,6 +1066,8 @@ void MeterPanel::OnMeterUpdate(wxTimerEvent & WXUNUSED(event))
|
|||
return;
|
||||
}
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
|
||||
// There may have been several update messages since the last
|
||||
// time we got to this function. Catch up to real-time by
|
||||
// popping them off until there are none left. It is necessary
|
||||
|
@ -1866,6 +1868,7 @@ void MeterPanel::StartMonitoring()
|
|||
{
|
||||
bool start = !mMonitoring;
|
||||
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
if (gAudioIO->IsMonitoring()){
|
||||
gAudioIO->StopStream();
|
||||
}
|
||||
|
@ -1884,6 +1887,7 @@ void MeterPanel::StartMonitoring()
|
|||
|
||||
void MeterPanel::StopMonitoring(){
|
||||
mMonitoring = false;
|
||||
auto gAudioIO = AudioIO::Get();
|
||||
if (gAudioIO->IsMonitoring()){
|
||||
gAudioIO->StopStream();
|
||||
}
|
||||
|
|
|
@ -129,6 +129,7 @@
|
|||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\AudacityLogger.cpp" />
|
||||
<ClCompile Include="..\..\..\src\AudioIO.cpp" />
|
||||
<ClCompile Include="..\..\..\src\AudioIOBase.cpp" />
|
||||
<ClCompile Include="..\..\..\src\AutoRecovery.cpp" />
|
||||
<ClCompile Include="..\..\..\src\AutoRecoveryDialog.cpp" />
|
||||
<ClCompile Include="..\..\..\src\BatchCommandDialog.cpp" />
|
||||
|
@ -506,6 +507,7 @@
|
|||
<ClInclude Include="..\..\..\src\AudacityHeaders.h" />
|
||||
<ClInclude Include="..\..\..\src\AudacityLogger.h" />
|
||||
<ClInclude Include="..\..\..\src\AudioIO.h" />
|
||||
<ClInclude Include="..\..\..\src\AudioIOBase.h" />
|
||||
<ClInclude Include="..\..\..\src\AudioIOListener.h" />
|
||||
<ClInclude Include="..\..\..\src\AutoRecovery.h" />
|
||||
<ClInclude Include="..\..\..\src\AutoRecoveryDialog.h" />
|
||||
|
|
|
@ -128,6 +128,9 @@
|
|||
<ClCompile Include="..\..\..\src\AudioIO.cpp">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\AudioIOBase.cpp">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\AutoRecovery.cpp">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
|
@ -1213,6 +1216,9 @@
|
|||
<ClInclude Include="..\..\..\src\AudioIO.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\AudioIOBase.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\AutoRecovery.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
|
|
Loading…
Reference in New Issue
Block a user