1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-31 07:59:27 +02:00

Abstract virtual AudioIOBase::StopStream...

... so that DeviceManager, DeviceToolbar, and PrefsDialog do not depend directly
on AudioIO.

But no function in the base class for starting streams, which would require
mention of Track types, which we want to avoid.
This commit is contained in:
Paul Licameli 2019-06-10 17:36:54 -04:00
parent 240402e56f
commit ccc49f8ccf
6 changed files with 14 additions and 8 deletions

View File

@ -586,7 +586,7 @@ public:
* Does quite a bit of housekeeping, including switching off monitoring,
* flushing recording buffers out to wave tracks, and applies latency
* correction to recorded tracks if necessary */
void StopStream();
void StopStream() override;
/** \brief Move the playback / recording position of the current stream
* by the specified amount from where it is now */
void SeekStream(double seconds) { mSeek = seconds; }

View File

@ -96,6 +96,8 @@ AudioIOBase *AudioIOBase::Get()
return ugAudioIO.get();
}
AudioIOBase::~AudioIOBase() = default;
void AudioIOBase::SetMixer(int inputSource)
{
#if defined(USE_PORTMIXER)

View File

@ -111,6 +111,8 @@ class AudioIOBase /* not final */
public:
static AudioIOBase *Get();
virtual ~AudioIOBase();
void SetCaptureMeter(AudacityProject *project, MeterPanelBase *meter);
void SetPlaybackMeter(AudacityProject *project, MeterPanelBase *meter);
@ -211,6 +213,8 @@ public:
/** \brief Find out if playback / recording is currently paused */
bool IsPaused() const;
virtual void StopStream() = 0;
/** \brief Returns true if audio i/o is busy starting, stopping, playing,
* or recording.
*

View File

@ -35,7 +35,7 @@
#include "Project.h"
#include "AudioIO.h"
#include "AudioIOBase.h"
#include "DeviceChange.h" // for HAVE_DEVICE_CHANGE
#include "toolbars/DeviceToolBar.h"
@ -259,7 +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();
auto gAudioIO = AudioIOBase::Get();
if (gAudioIO) {
if (gAudioIO->IsMonitoring())
{

View File

@ -34,7 +34,7 @@
#include <wx/treebook.h>
#include "../AudioIO.h"
#include "../AudioIOBase.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
@ -814,7 +814,7 @@ void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event))
SavePreferredPage();
#if USE_PORTMIXER
auto gAudioIO = AudioIO::Get();
auto gAudioIO = AudioIOBase::Get();
if (gAudioIO) {
// We cannot have opened this dialog if gAudioIO->IsAudioTokenActive(),
// per the setting of AudioIONotBusyFlag and AudioIOBusyFlag in

View File

@ -39,7 +39,7 @@
#include "../AColor.h"
#include "../AllThemeResources.h"
#include "../AudioIO.h"
#include "../AudioIOBase.h"
#include "../ImageManipulation.h"
#include "../KeyboardCapture.h"
#include "../Prefs.h"
@ -341,7 +341,7 @@ void DeviceToolBar::UpdateSelectedPrefs( int id )
void DeviceToolBar::EnableDisableButtons()
{
auto gAudioIO = AudioIO::Get();
auto gAudioIO = AudioIOBase::Get();
if (gAudioIO) {
// we allow changes when monitoring, but not when recording
bool audioStreamActive = gAudioIO->IsStreamActive() && !gAudioIO->IsMonitoring();
@ -776,7 +776,7 @@ void DeviceToolBar::OnChoice(wxCommandEvent &event)
ChangeDevice(false);
}
auto gAudioIO = AudioIO::Get();
auto gAudioIO = AudioIOBase::Get();
if (gAudioIO) {
// We cannot have gotten here if gAudioIO->IsAudioTokenActive(),
// per the setting of AudioIONotBusyFlag and AudioIOBusyFlag in