mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 00:19: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:
parent
240402e56f
commit
ccc49f8ccf
@ -586,7 +586,7 @@ public:
|
|||||||
* Does quite a bit of housekeeping, including switching off monitoring,
|
* Does quite a bit of housekeeping, including switching off monitoring,
|
||||||
* flushing recording buffers out to wave tracks, and applies latency
|
* flushing recording buffers out to wave tracks, and applies latency
|
||||||
* correction to recorded tracks if necessary */
|
* correction to recorded tracks if necessary */
|
||||||
void StopStream();
|
void StopStream() override;
|
||||||
/** \brief Move the playback / recording position of the current stream
|
/** \brief Move the playback / recording position of the current stream
|
||||||
* by the specified amount from where it is now */
|
* by the specified amount from where it is now */
|
||||||
void SeekStream(double seconds) { mSeek = seconds; }
|
void SeekStream(double seconds) { mSeek = seconds; }
|
||||||
|
@ -96,6 +96,8 @@ AudioIOBase *AudioIOBase::Get()
|
|||||||
return ugAudioIO.get();
|
return ugAudioIO.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AudioIOBase::~AudioIOBase() = default;
|
||||||
|
|
||||||
void AudioIOBase::SetMixer(int inputSource)
|
void AudioIOBase::SetMixer(int inputSource)
|
||||||
{
|
{
|
||||||
#if defined(USE_PORTMIXER)
|
#if defined(USE_PORTMIXER)
|
||||||
|
@ -111,6 +111,8 @@ class AudioIOBase /* not final */
|
|||||||
public:
|
public:
|
||||||
static AudioIOBase *Get();
|
static AudioIOBase *Get();
|
||||||
|
|
||||||
|
virtual ~AudioIOBase();
|
||||||
|
|
||||||
void SetCaptureMeter(AudacityProject *project, MeterPanelBase *meter);
|
void SetCaptureMeter(AudacityProject *project, MeterPanelBase *meter);
|
||||||
void SetPlaybackMeter(AudacityProject *project, MeterPanelBase *meter);
|
void SetPlaybackMeter(AudacityProject *project, MeterPanelBase *meter);
|
||||||
|
|
||||||
@ -211,6 +213,8 @@ public:
|
|||||||
/** \brief Find out if playback / recording is currently paused */
|
/** \brief Find out if playback / recording is currently paused */
|
||||||
bool IsPaused() const;
|
bool IsPaused() const;
|
||||||
|
|
||||||
|
virtual void StopStream() = 0;
|
||||||
|
|
||||||
/** \brief Returns true if audio i/o is busy starting, stopping, playing,
|
/** \brief Returns true if audio i/o is busy starting, stopping, playing,
|
||||||
* or recording.
|
* or recording.
|
||||||
*
|
*
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include "Project.h"
|
#include "Project.h"
|
||||||
|
|
||||||
#include "AudioIO.h"
|
#include "AudioIOBase.h"
|
||||||
|
|
||||||
#include "DeviceChange.h" // for HAVE_DEVICE_CHANGE
|
#include "DeviceChange.h" // for HAVE_DEVICE_CHANGE
|
||||||
#include "toolbars/DeviceToolBar.h"
|
#include "toolbars/DeviceToolBar.h"
|
||||||
@ -259,7 +259,7 @@ void DeviceManager::Rescan()
|
|||||||
if (m_inited) {
|
if (m_inited) {
|
||||||
// check to see if there is a stream open - can happen if monitoring,
|
// check to see if there is a stream open - can happen if monitoring,
|
||||||
// but otherwise Rescan() should not be available to the user.
|
// but otherwise Rescan() should not be available to the user.
|
||||||
auto gAudioIO = AudioIO::Get();
|
auto gAudioIO = AudioIOBase::Get();
|
||||||
if (gAudioIO) {
|
if (gAudioIO) {
|
||||||
if (gAudioIO->IsMonitoring())
|
if (gAudioIO->IsMonitoring())
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include <wx/treebook.h>
|
#include <wx/treebook.h>
|
||||||
|
|
||||||
#include "../AudioIO.h"
|
#include "../AudioIOBase.h"
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
|
|
||||||
@ -814,7 +814,7 @@ void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event))
|
|||||||
SavePreferredPage();
|
SavePreferredPage();
|
||||||
|
|
||||||
#if USE_PORTMIXER
|
#if USE_PORTMIXER
|
||||||
auto gAudioIO = AudioIO::Get();
|
auto gAudioIO = AudioIOBase::Get();
|
||||||
if (gAudioIO) {
|
if (gAudioIO) {
|
||||||
// We cannot have opened this dialog if gAudioIO->IsAudioTokenActive(),
|
// We cannot have opened this dialog if gAudioIO->IsAudioTokenActive(),
|
||||||
// per the setting of AudioIONotBusyFlag and AudioIOBusyFlag in
|
// per the setting of AudioIONotBusyFlag and AudioIOBusyFlag in
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#include "../AColor.h"
|
#include "../AColor.h"
|
||||||
#include "../AllThemeResources.h"
|
#include "../AllThemeResources.h"
|
||||||
#include "../AudioIO.h"
|
#include "../AudioIOBase.h"
|
||||||
#include "../ImageManipulation.h"
|
#include "../ImageManipulation.h"
|
||||||
#include "../KeyboardCapture.h"
|
#include "../KeyboardCapture.h"
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
@ -341,7 +341,7 @@ void DeviceToolBar::UpdateSelectedPrefs( int id )
|
|||||||
|
|
||||||
void DeviceToolBar::EnableDisableButtons()
|
void DeviceToolBar::EnableDisableButtons()
|
||||||
{
|
{
|
||||||
auto gAudioIO = AudioIO::Get();
|
auto gAudioIO = AudioIOBase::Get();
|
||||||
if (gAudioIO) {
|
if (gAudioIO) {
|
||||||
// we allow changes when monitoring, but not when recording
|
// we allow changes when monitoring, but not when recording
|
||||||
bool audioStreamActive = gAudioIO->IsStreamActive() && !gAudioIO->IsMonitoring();
|
bool audioStreamActive = gAudioIO->IsStreamActive() && !gAudioIO->IsMonitoring();
|
||||||
@ -776,7 +776,7 @@ void DeviceToolBar::OnChoice(wxCommandEvent &event)
|
|||||||
ChangeDevice(false);
|
ChangeDevice(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto gAudioIO = AudioIO::Get();
|
auto gAudioIO = AudioIOBase::Get();
|
||||||
if (gAudioIO) {
|
if (gAudioIO) {
|
||||||
// We cannot have gotten here if gAudioIO->IsAudioTokenActive(),
|
// We cannot have gotten here if gAudioIO->IsAudioTokenActive(),
|
||||||
// per the setting of AudioIONotBusyFlag and AudioIOBusyFlag in
|
// per the setting of AudioIONotBusyFlag and AudioIOBusyFlag in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user