11#ifndef __AUDACITY_AUDIO_IO_BASE__
12#define __AUDACITY_AUDIO_IO_BASE__
38#define BAD_STREAM_TIME (-DBL_MAX)
47 const std::shared_ptr<AudacityProject> &
pProject = {},
48 double rate_ = 44100.0
101 :
public NonInterferingBase
112 void SetCaptureMeter(
113 const std::shared_ptr<AudacityProject> &project,
const std::weak_ptr<Meter> &meter);
114 void SetPlaybackMeter(
115 const std::shared_ptr<AudacityProject> &project,
const std::weak_ptr<Meter> &meter);
125 void HandleDeviceChange();
139 static std::vector<long> GetSupportedPlaybackRates(
int DevIndex = -1,
154 static std::vector<long> GetSupportedCaptureRates(
int devIndex = -1,
171 static std::vector<long> GetSupportedSampleRates(
int playDevice = -1,
183 static int GetOptimalSupportedSampleRate();
189 static const int StandardRates[];
196 wxString GetDeviceInfo()
const;
199 std::vector<AudioIODiagnostics> GetAllDeviceInfo();
202 bool IsPaused()
const;
218 bool IsStreamActive()
const;
219 bool IsStreamActive(
int token)
const;
226 bool IsAudioTokenActive(
int token)
const;
230 bool IsMonitoring()
const;
238 void SetMixer(
int inputSource);
242 static wxString DeviceName(
const PaDeviceInfo* info);
243 static wxString HostName(
const PaDeviceInfo* info);
248 std::atomic<bool> mPaused{
false };
251 int mStreamToken{ 0 };
259 std::weak_ptr<Meter> mInputMeter{};
260 std::weak_ptr<Meter> mOutputMeter{};
264 float mPreviousHWPlaythrough;
292 static int getRecordDevIndex(
const wxString &devName = {});
299 static int getRecordSourceIndex(PxMixer *portMixer);
309 static int getPlayDevIndex(
const wxString &devName = {});
315 static const int RatesToTry[];
AUDIO_DEVICES_API IntSetting AudioIORecordChannels
AUDIO_DEVICES_API DoubleSetting AudioIOLatencyCorrection
AUDIO_DEVICES_API StringSetting AudioIOHost
AUDIO_DEVICES_API StringSetting AudioIORecordingSource
AUDIO_DEVICES_API StringSetting AudioIOPlaybackSource
AUDIO_DEVICES_API DoubleSetting AudioIOLatencyDuration
AUDIO_DEVICES_API StringSetting AudioIOPlaybackDevice
AUDIO_DEVICES_API DoubleSetting AudioIOPlaybackVolume
AUDIO_DEVICES_API StringSetting AudioIORecordingDevice
std::vector< std::vector< float > > PRCrossfadeData
AUDIO_DEVICES_API IntSetting AudioIORecordingSourceIndex
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
A singleton object supporting queries of the state of any active audio streams, and audio device capa...
PaStream * mPortStreamV19
static std::vector< long > mCachedSampleRates
double mRate
Audio playback rate in samples per second.
static int mCachedCaptureIndex
AudioIOBase & operator=(const AudioIOBase &)=delete
static std::unique_ptr< AudioIOBase > ugAudioIO
std::vector< std::unique_ptr< AudioIOExtBase > > mAudioIOExt
static double mCachedBestRateIn
virtual void StopStream()=0
AudioIOBase(const AudioIOBase &)=delete
static std::vector< long > mCachedCaptureRates
std::weak_ptr< AudacityProject > mOwningProject
bool mInputMixerWorks
Can we control the hardware input level?
static const int NumRatesToTry
How many sample rates to try.
static const int NumStandardRates
How many standard sample rates there are.
static std::vector< long > mCachedPlaybackRates
static int mCachedPlaybackIndex
Abstract interface to alternative, concurrent playback with the main audio (such as MIDI events)
virtual bool IsOtherStreamActive() const =0
virtual AudioIODiagnostics Dump() const =0
Get diagnostic information for audio devices and also for extensions.
virtual ~AudioIOExtBase()
Monitors record play start/stop and new sample blocks. Has callbacks for these events.
Specialization of Setting for double.
Specialization of Setting for int.
AudioIO uses this to send sample buffers for real-time display updates.
Directs which parts of tracks to fetch for playback.
Specialization of Setting for strings.
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
struct holding stream options, including a pointer to the time warp info and AudioIOListener and whet...
std::function< std::chrono::milliseconds() > playbackStreamPrimer
PolicyFactory policyFactory
std::shared_ptr< AudacityProject > pProject
std::weak_ptr< Meter > captureMeter
std::weak_ptr< Meter > playbackMeter
AudioIOStartStreamOptions(const std::shared_ptr< AudacityProject > &pProject={}, double rate_=44100.0)
PRCrossfadeData * pCrossfadeData
const BoundedEnvelope * envelope
std::function< std::unique_ptr< PlaybackPolicy >(const AudioIOStartStreamOptions &) > PolicyFactory
std::optional< double > pStartTime
std::shared_ptr< AudioIOListener > listener