LogoSearch packages:      

Sourcecode: audacity version File versions

AudioIO Class Reference

List of all members.


Detailed Description

AudioIO uses the PortAudio library to play and record sound.

Great care and attention to detail are necessary for understanding and modifying this system. The code in this file is run from three different thread contexts: the UI thread, the disk thread (which this file creates and maintains) and the PortAudio callback thread. To highlight this deliniation, the file is divided into three parts based on what thread context each function is intended to run in.

Todo:
run through all functions called from audio and portaudio threads to verify they are thread-safe.

Definition at line 62 of file AudioIO.h.


Public Member Functions

sampleFormat GetCaptureFormat ()
wxString GetDeviceInfo ()
 Get diagnostic information on all the available audio I/O devices.
wxArrayString GetInputSourceNames ()
 Get the list of inputs to the current mixer device.
void GetMixer (int *inputSource, float *inputVolume, float *playbackVolume)
int GetNumCaptureChannels ()
double GetStreamTime ()
 The time the stream has been playing for.
void HandleDeviceChange ()
bool IsAudioTokenActive (int token)
 Returns true if the stream is active, or even if audio I/O is busy cleaning up its data or writing to disk.
bool IsBusy ()
 Returns true if audio i/o is busy starting, stopping, playing, or recording.
bool IsMonitoring ()
 Returns true if we're monitoring input (but not recording or playing actual audio).
bool IsPaused ()
 Find out if playback / recording is currently paused.
bool IsStreamActive (int token)
bool IsStreamActive ()
 Returns true if the audio i/o is running at all, but not during cleanup.
void SeekStream (double seconds)
 Move the playback / recording position of the current stream by the specified amount from where it is now.
void SetMeters (Meter *inputMeter, Meter *outputMeter)
 Set the current VU meters - this should be done once after each call to StartStream currently.
void SetMixer (int inputSource, float inputVolume, float playbackVolume)
void SetPaused (bool state)
 Pause and un-pause playback and recording.
void StartMonitoring (double sampleRate)
 Start up Portaudio for capture and recording as needed for input monitoring and software playthrough only.
int StartStream (WaveTrackArray playbackTracks, WaveTrackArray captureTracks, TimeTrack *timeTrack, double sampleRate, double t0, double t1, AudioIOListener *listener, bool playLooped=false, double cutPreviewGapStart=0.0, double cutPreviewGapLen=0.0)
 Start recording or playing back audio.
void StopStream ()
 Stop recording, playback or input monitoring.

Static Public Member Functions

static int GetOptimalSupportedSampleRate ()
 Get a supported sample rate which can be used a an optimal default.
static wxArrayLong GetSupportedCaptureRates (int devIndex=-1, double rate=0.0)
 Get a list of sample rates the input (recording) device supports.
static wxArrayLong GetSupportedPlaybackRates (int DevIndex=-1, double rate=0.0)
 Get a list of sample rates the output (playback) device supports.
static wxArrayLong GetSupportedSampleRates (int playDevice=-1, int recDevice=-1, double rate=0.0)
 Get a list of sample rates the current input/output device combination supports.

Static Public Attributes

static const int NumStandardRates
 How many standard sample rates there are.
static const int StandardRates []
 Array of common audio sample rates.

Private Member Functions

void FillBuffers ()
double GetBestRate (bool capturing, bool playing, double sampleRate)
 Return a valid sample rate that is supported by the current I/O device(s).
int GetCommonlyAvailCapture ()
 Get the number of audio samples ready in all of the recording buffers.
int GetCommonlyAvailPlayback ()
 Get the number of audio samples free in all of the playback buffers.
double NormalizeStreamTime (double absoluteTime) const
bool StartPortAudioStream (double sampleRate, unsigned int numPlaybackChannels, unsigned int numCaptureChannels, sampleFormat captureFormat)
 Opens the portaudio stream(s) used to do playback or recording (or both) through.

Static Private Member Functions

static int getPlayDevIndex (wxString devName=wxT(""))
 get the index of the supplied (named) playback device, or the device selected in the preferences if none given.
static int getRecordDevIndex (wxString devName=wxT(""))
 get the index of the supplied (named) recording device, or the device selected in the preferences if none given.

Private Attributes

volatile bool mAudioThreadFillBuffersLoopActive
volatile bool mAudioThreadFillBuffersLoopRunning
volatile bool mAudioThreadShouldCallFillBuffersOnce
RingBuffer ** mCaptureBuffers
sampleFormat mCaptureFormat
double mCaptureRingBufferSecs
WaveTrackArray mCaptureTracks
double mCutPreviewGapLen
double mCutPreviewGapStart
bool mEmulateMixerInputVol
bool mEmulateMixerOutputVol
double mFactor
volatile bool mInCallbackFinishedState
MetermInputMeter
PaError mLastPaError
volatile double mLastRecordingOffset
AudioIOListener * mListener
int mLostSamples
double mMaxPlaybackSecsToCopy
double mMinCaptureSecsToCopy
float mMixerInputVol
float mMixerOutputVol
unsigned int mNumCaptureChannels
unsigned int mNumPlaybackChannels
MetermOutputMeter
bool mPaused
bool mPauseRec
RingBuffer ** mPlaybackBuffers
Mixer ** mPlaybackMixers
double mPlaybackRingBufferSecs
WaveTrackArray mPlaybackTracks
bool mPlayLooped
PortAudioStream * mPortStreamV18
double mRate
Resample ** mResample
double mSeek
float mSilenceLevel
bool mSoftwarePlaythrough
int mStopStreamCount
int mStreamToken
double mT
double mT0
double mT1
float * mTempFloats
AudioThreadmThread
double mTime
TimeTrackmTimeTrack
bool mUpdateMeters
bool mUpdatingMeters
double mWarpedT1

Static Private Attributes

static int mNextStreamToken = 0
static const int NumRatesToTry
 How many sample rates to try.
static const int RatesToTry []
 Array of audio sample rates to try to use.

Friends

int audacityAudioCallback (void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, PaTimestamp outTime, void *userData)
class AudioThread
void DeinitAudioIO ()
void InitAudioIO ()

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.5.1   Back to index