Audacity 3.2.0
Classes | Namespaces | Typedefs | Enumerations | Functions
AudioIO.h File Reference
#include "AudioIOBase.h"
#include "PlaybackSchedule.h"
#include <functional>
#include <memory>
#include <mutex>
#include <thread>
#include <utility>
#include <wx/atomic.h>
#include "PluginProvider.h"
#include "Observer.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  AudioIOEvent
 
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...
 

Namespaces

namespace  RealtimeEffects
 

Typedefs

using PlayableTrackConstArray = std::vector< std::shared_ptr< const PlayableTrack > >
 
using SampleTrackArray = std::vector< std::shared_ptr< SampleTrack > >
 
using SampleTrackConstArray = std::vector< std::shared_ptr< const SampleTrack > >
 
using WritableSampleTrackArray = std::vector< std::shared_ptr< WritableSampleTrack > >
 
typedef unsigned long PaStreamCallbackFlags
 
typedef int PaError
 

Enumerations

enum class  Acknowledge { eNone = 0 , eStart , eStop }
 

Functions

bool ValidateDeviceNames ()
 
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 56 of file AudioIO.h.

◆ PaStreamCallbackFlags

typedef unsigned long PaStreamCallbackFlags

Definition at line 55 of file AudioIO.h.

◆ PlayableTrackConstArray

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

Definition at line 42 of file AudioIO.h.

◆ SampleTrackArray

using SampleTrackArray = std::vector < std::shared_ptr < SampleTrack > >

Definition at line 47 of file AudioIO.h.

◆ SampleTrackConstArray

using SampleTrackConstArray = std::vector < std::shared_ptr < const SampleTrack > >

Definition at line 48 of file AudioIO.h.

◆ WritableSampleTrackArray

using WritableSampleTrackArray = std::vector < std::shared_ptr < WritableSampleTrack > >

Definition at line 51 of file AudioIO.h.

Enumeration Type Documentation

◆ Acknowledge

enum class Acknowledge
strong
Enumerator
eNone 
eStart 
eStop 

Definition at line 64 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 2423 of file AudioIO.cpp.

2427{
2428 auto gAudioIO = AudioIO::Get();
2429 return gAudioIO->AudioCallback(
2430 static_cast<constSamplePtr>(inputBuffer),
2431 static_cast<float*>(outputBuffer), framesPerBuffer,
2432 timeInfo, statusFlags, userData);
2433}
const char * constSamplePtr
Definition: SampleFormat.h:56
static AudioIO * Get()
Definition: AudioIO.cpp:147

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 ( )