Audacity  3.0.3
Classes | Typedefs | Functions
AudioIO.h File Reference
#include "AudioIOBase.h"
#include "PlaybackSchedule.h"
#include <functional>
#include <memory>
#include <mutex>
#include <utility>
#include <wx/atomic.h>
#include <wx/event.h>
#include "SampleCount.h"
#include "SampleFormat.h"
Include dependency graph for AudioIO.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TransportTracks
 
class  AudioIoCallback
 AudioIoCallback is a class that implements the callback required by PortAudio. The callback needs to be responsive, has no GUI, and copies data into and out of the sound card buffers. It also sends data to the meters. More...
 
class  AudioIoCallback::AudioIOExtIterator
 
struct  AudioIoCallback::AudioIOExtRange
 
class  AudioIO
 AudioIO uses the PortAudio library to play and record sound. More...
 

Typedefs

using PlayableTrackConstArray = std::vector< std::shared_ptr< const PlayableTrack > >
 
using WaveTrackArray = std::vector< std::shared_ptr< WaveTrack > >
 
using WaveTrackConstArray = std::vector< std::shared_ptr< const WaveTrack > >
 
typedef unsigned long PaStreamCallbackFlags
 
typedef int PaError
 

Functions

bool ValidateDeviceNames ()
 
 wxDECLARE_EXPORTED_EVENT (AUDACITY_DLL_API, EVT_AUDIOIO_PLAYBACK, wxCommandEvent)
 
 wxDECLARE_EXPORTED_EVENT (AUDACITY_DLL_API, EVT_AUDIOIO_CAPTURE, wxCommandEvent)
 
 wxDECLARE_EXPORTED_EVENT (AUDACITY_DLL_API, EVT_AUDIOIO_MONITOR, wxCommandEvent)
 
int audacityAudioCallback (const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
 

Typedef Documentation

◆ PaError

typedef int PaError

Definition at line 53 of file AudioIO.h.

◆ PaStreamCallbackFlags

typedef unsigned long PaStreamCallbackFlags

Definition at line 52 of file AudioIO.h.

◆ PlayableTrackConstArray

using PlayableTrackConstArray = std::vector < std::shared_ptr < const PlayableTrack > >

Definition at line 44 of file AudioIO.h.

◆ WaveTrackArray

using WaveTrackArray = std::vector < std::shared_ptr < WaveTrack > >

Definition at line 48 of file AudioIO.h.

◆ WaveTrackConstArray

using WaveTrackConstArray = std::vector < std::shared_ptr < const WaveTrack > >

Definition at line 49 of file AudioIO.h.

Function Documentation

◆ audacityAudioCallback()

int audacityAudioCallback ( const void *  inputBuffer,
void *  outputBuffer,
unsigned long  framesPerBuffer,
const PaStreamCallbackTimeInfo *  timeInfo,
PaStreamCallbackFlags  statusFlags,
void *  userData 
)

brief The function which is called from PortAudio's callback thread context to collect and deliver audio for / from the sound device.

This covers recording, playback, and doing both simultaneously. It is also invoked to do monitoring and software playthrough. Note that dealing with the two buffers needs some care to ensure that the right things happen for all possible cases.

Parameters
inputBufferBuffer of length framesPerBuffer containing samples from the sound card, or null if not capturing audio. Note that the data type will depend on the format of audio data that was chosen when the stream was created (so could be floats or various integers)
outputBufferUninitialised buffer of length framesPerBuffer which will be sent to the sound card after the callback, or null if not playing audio back.
framesPerBufferThe length of the playback and recording buffers
PaStreamCallbackTimeInfoPointer to PortAudio time information structure, which tells us how long we have been playing / recording
statusFlagsPortAudio stream status flags
userDatapointer to user-defined data structure. Provided for flexibility by PortAudio, but not used by Audacity - the data is stored in the AudioIO class instead.

Definition at line 2277 of file AudioIO.cpp.

2281 {
2282  auto gAudioIO = AudioIO::Get();
2283  return gAudioIO->AudioCallback(
2284  static_cast<constSamplePtr>(inputBuffer),
2285  static_cast<float*>(outputBuffer), framesPerBuffer,
2286  timeInfo, statusFlags, userData);
2287 }

References AudioIO::Get().

Referenced by AudioIO::StartPortAudioStream().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ValidateDeviceNames()

bool ValidateDeviceNames ( )

◆ wxDECLARE_EXPORTED_EVENT() [1/3]

wxDECLARE_EXPORTED_EVENT ( AUDACITY_DLL_API  ,
EVT_AUDIOIO_CAPTURE  ,
wxCommandEvent   
)

◆ wxDECLARE_EXPORTED_EVENT() [2/3]

wxDECLARE_EXPORTED_EVENT ( AUDACITY_DLL_API  ,
EVT_AUDIOIO_MONITOR  ,
wxCommandEvent   
)

◆ wxDECLARE_EXPORTED_EVENT() [3/3]

wxDECLARE_EXPORTED_EVENT ( AUDACITY_DLL_API  ,
EVT_AUDIOIO_PLAYBACK  ,
wxCommandEvent   
)
constSamplePtr
const char * constSamplePtr
Definition: SampleFormat.h:50
AudioIO::Get
static AudioIO * Get()
Definition: AudioIO.cpp:141