1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-07 12:12:23 +01:00

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:
Paul Licameli
2019-06-10 14:25:50 -04:00
parent 46bf5a82fc
commit 42a4f55ffe
44 changed files with 180 additions and 29 deletions

View File

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