JackTrip: RtApi Class Reference

JackTrip

Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
RtApi Class Referenceabstract

`#include <RtAudio.h>`

Inheritance diagram for RtApi:
[legend]
Collaboration diagram for RtApi:
[legend]

## Classes
struct | ConvertInfo
struct | RtApiStream

## Public Member Functions
| RtApi ()
virtual | ~RtApi ()
virtual RtAudio::Api | getCurrentApi (void)=0
virtual unsigned int | getDeviceCount (void)=0
virtual RtAudio::DeviceInfo | getDeviceInfo (unsigned int device)=0
virtual unsigned int | getDefaultInputDevice (void)
virtual unsigned int | getDefaultOutputDevice (void)
void | openStream (RtAudio::StreamParameters *outputParameters, RtAudio::StreamParameters *inputParameters, RtAudioFormat format, unsigned int sampleRate, unsigned int *bufferFrames, RtAudioCallback callback, void *userData, RtAudio::StreamOptions *options)
virtual void | closeStream (void)
virtual void | startStream (void)=0
virtual void | stopStream (void)=0
virtual void | abortStream (void)=0
long | getStreamLatency (void)
unsigned int | getStreamSampleRate (void)
virtual double | getStreamTime (void)
bool | isStreamOpen (void) const
bool | isStreamRunning (void) const
void | showWarnings (bool value)

## Protected Types
enum | { FAILURE, SUCCESS }
enum | StreamState { STREAM_STOPPED, STREAM_STOPPING, STREAM_RUNNING, STREAM_CLOSED = -50 }
enum | StreamMode { OUTPUT, INPUT, DUPLEX, UNINITIALIZED = -75 }
typedef signed short | Int16
typedef signed int | Int32
typedef float | Float32
typedef double | Float64

## Protected Member Functions
virtual bool | probeDeviceOpen (unsigned int device, StreamMode mode, unsigned int channels, unsigned int firstChannel, unsigned int sampleRate, RtAudioFormat format, unsigned int *bufferSize, RtAudio::StreamOptions *options)
void | tickStreamTime (void)
| A protected function used to increment the stream time. More...
void | clearStreamInfo ()
| Protected common method to clear an RtApiStream structure. More...
void | verifyStream (void)
void | error (RtError::Type type)
| Protected common error method to allow global control over error handling. More...
void | convertBuffer (char *outBuffer, char *inBuffer, ConvertInfo &info)
void | byteSwapBuffer (char *buffer, unsigned int samples, RtAudioFormat format)
| Protected common method used to perform byte-swapping on buffers. More...
unsigned int | formatBytes (RtAudioFormat format)
| Protected common method that returns the number of bytes for a given format. More...
void | setConvertInfo (StreamMode mode, unsigned int firstChannel)
| Protected common method that sets up the parameters for buffer conversion. More...

## Protected Attributes
std::ostringstream | errorStream_
std::string | errorText_
bool | showWarnings_
RtApiStream | stream_

## Static Protected Attributes
static const unsigned int | MAX_SAMPLE_RATES = 14
static const unsigned int | SAMPLE_RATES []

## Member Typedef Documentation

## ◆ Float32

typedef float RtApi::Float32
| protected

## ◆ Float64

typedef double RtApi::Float64
| protected

## ◆ Int16

typedef signed short RtApi::Int16
| protected

## ◆ Int32

typedef signed int RtApi::Int32
| protected

## Member Enumeration Documentation

## ◆ anonymous enum

anonymous enum
| protected

Enumerator
FAILURE |
SUCCESS |

## ◆ StreamMode

enum RtApi::StreamMode
| protected

Enumerator
OUTPUT |
INPUT |
DUPLEX |
UNINITIALIZED |

## ◆ StreamState

enum RtApi::StreamState
| protected

Enumerator
STREAM_STOPPED |
STREAM_STOPPING |
STREAM_RUNNING |
STREAM_CLOSED |

## Constructor & Destructor Documentation

## ◆ RtApi()

RtApi::RtApi | ( |  | ) |

## ◆ ~RtApi()

RtApi::~RtApi | ( |  | ) |
| virtual

## Member Function Documentation

## ◆ abortStream()

virtual void RtApi::abortStream | ( | void |  | ) |
| pure virtual

Implemented in RtApiDummy.

## ◆ byteSwapBuffer()

void RtApi::byteSwapBuffer | ( | char * | buffer,
|  | unsigned int | samples,
|  | RtAudioFormat | format
| ) |  |
| protected

Protected common method used to perform byte-swapping on buffers.

## ◆ clearStreamInfo()

void RtApi::clearStreamInfo | ( |  | ) |
| protected

Protected common method to clear an RtApiStream structure.

## ◆ closeStream()

void RtApi::closeStream | ( | void |  | ) |
| virtual

Reimplemented in RtApiDummy.

## ◆ convertBuffer()

void RtApi::convertBuffer | ( | char * | outBuffer,
|  | char * | inBuffer,
|  | ConvertInfo & | info
| ) |  |
| protected

Protected method used to perform format, channel number, and/or interleaving conversions between the user and device buffers.

## ◆ error()

void RtApi::error | ( | RtError::Type | type | ) |
| protected

Protected common error method to allow global control over error handling.

## ◆ formatBytes()

unsigned int RtApi::formatBytes | ( | RtAudioFormat | format | ) |
| protected

Protected common method that returns the number of bytes for a given format.

## ◆ getCurrentApi()

virtual RtAudio::Api RtApi::getCurrentApi | ( | void |  | ) |
| pure virtual

Implemented in RtApiDummy.

## ◆ getDefaultInputDevice()

unsigned int RtApi::getDefaultInputDevice | ( | void |  | ) |
| virtual

## ◆ getDefaultOutputDevice()

unsigned int RtApi::getDefaultOutputDevice | ( | void |  | ) |
| virtual

## ◆ getDeviceCount()

virtual unsigned int RtApi::getDeviceCount | ( | void |  | ) |
| pure virtual

Implemented in RtApiDummy.

## ◆ getDeviceInfo()

virtual RtAudio::DeviceInfo RtApi::getDeviceInfo | ( | unsigned int | device | ) |
| pure virtual

Implemented in RtApiDummy.

## ◆ getStreamLatency()

long RtApi::getStreamLatency | ( | void |  | ) |

## ◆ getStreamSampleRate()

unsigned int RtApi::getStreamSampleRate | ( | void |  | ) |

## ◆ getStreamTime()

double RtApi::getStreamTime | ( | void |  | ) |
| virtual

## ◆ isStreamOpen()

bool RtApi::isStreamOpen | ( | void |  | ) | const
| inline

## ◆ isStreamRunning()

bool RtApi::isStreamRunning | ( | void |  | ) | const
| inline

## ◆ openStream()

void RtApi::openStream | ( | RtAudio::StreamParameters * | outputParameters,
|  | RtAudio::StreamParameters * | inputParameters,
|  | RtAudioFormat | format,
|  | unsigned int | sampleRate,
|  | unsigned int * | bufferFrames,
|  | RtAudioCallback | callback,
|  | void * | userData,
|  | RtAudio::StreamOptions * | options
| ) |  |

## ◆ probeDeviceOpen()

bool RtApi::probeDeviceOpen | ( | unsigned int | device,
|  | StreamMode | mode,
|  | unsigned int | channels,
|  | unsigned int | firstChannel,
|  | unsigned int | sampleRate,
|  | RtAudioFormat | format,
|  | unsigned int * | bufferSize,
|  | RtAudio::StreamOptions * | options
| ) |  |
| protectedvirtual

Protected, api-specific method that attempts to open a device with the given parameters. This function MUST be implemented by all subclasses. If an error is encountered during the probe, a "warning" message is reported and FAILURE is returned. A successful probe is indicated by a return value of SUCCESS.

## ◆ setConvertInfo()

void RtApi::setConvertInfo | ( | StreamMode | mode,
|  | unsigned int | firstChannel
| ) |  |
| protected

Protected common method that sets up the parameters for buffer conversion.

## ◆ showWarnings()

void RtApi::showWarnings | ( | bool | value | ) |
| inline

## ◆ startStream()

virtual void RtApi::startStream | ( | void |  | ) |
| pure virtual

Implemented in RtApiDummy.

## ◆ stopStream()

virtual void RtApi::stopStream | ( | void |  | ) |
| pure virtual

Implemented in RtApiDummy.

## ◆ tickStreamTime()

void RtApi::tickStreamTime | ( | void |  | ) |
| protected

A protected function used to increment the stream time.

## ◆ verifyStream()

void RtApi::verifyStream | ( | void |  | ) |
| protected

Protected common method that throws an RtError (type = INVALID_USE) if a stream is not open.

## Member Data Documentation

## ◆ errorStream_

std::ostringstream RtApi::errorStream_
| protected

## ◆ errorText_

std::string RtApi::errorText_
| protected

## ◆ MAX_SAMPLE_RATES

const unsigned int RtApi::MAX_SAMPLE_RATES = 14
| staticprotected

## ◆ SAMPLE_RATES

const unsigned int RtApi::SAMPLE_RATES
| staticprotected

Initial value:
= {
4000, 5512, 8000, 9600, 11025, 16000, 22050,
32000, 44100, 48000, 88200, 96000, 176400, 192000
}

## ◆ showWarnings_

bool RtApi::showWarnings_
| protected

## ◆ stream_

RtApiStream RtApi::stream_
| protected

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

- src/RtAudio.h
- src/RtAudio.cpp