Abstracts PortAudio using a given audio sample data type.
More...
#include <audio_output.h>
|
| static AudioOutput * | instance () |
| | Factory method to return the AudioOutput. It may be called one or more times. Be sure to destroy() the instance in order to avoid leaks. It is suggested to do so in the teardown of the first caller.
|
| |
| static void | init () |
| | Initializes PortAudio.
|
| |
| static void | destroy () |
| | Tears down PortAudio.
|
| |
| static void | restart () |
| | Restarts PortAudio.
|
| |
| static void | start () |
| | Starts the invokation of the PortAudio callback.
|
| |
| static void | stop () |
| | Stops the invokation of the PortAudio callback.
|
| |
| static bool | isDefault () |
| | Returns whether the default audio output device is used. This indicates that a Bluetooth device is not being used. The default output is typically an audio jack or an HDMI port on the host.
|
| |
|
| static constexpr int | SAMPLE_RATE = 44100 |
| | The AudioOutput sample rate, which is matched to the sample rate of CD audio.
|
| |
|
| static int | pa_callback (const void *input_buffer, void *output_buffer, unsigned long frames_per_buffer, const PaStreamCallbackTimeInfo *time_info, PaStreamCallbackFlags status_flags, void *user_data) |
| | The PortAudio callback.
|
| |
template<typename T>
class AudioOutput< T >
Abstracts PortAudio using a given audio sample data type.
- See also
- Producer/Consumer.
- Template Parameters
-
| T | The audio sample format. Must be int16_t or float. |
Definition at line 20 of file audio_output.h.
◆ destroy()
◆ init()
◆ instance()
Factory method to return the AudioOutput. It may be called one or more times. Be sure to destroy() the instance in order to avoid leaks. It is suggested to do so in the teardown of the first caller.
- Returns
- The AudioOutput.
Definition at line 84 of file audio_output.h.
◆ isDefault()
Returns whether the default audio output device is used. This indicates that a Bluetooth device is not being used. The default output is typically an audio jack or an HDMI port on the host.
- Returns
- Whether the default audio output device is used.
Definition at line 181 of file audio_output.h.
◆ pa_callback()
template<typename T>
| int AudioOutput< T >::pa_callback |
( |
const void * | input_buffer, |
|
|
void * | output_buffer, |
|
|
unsigned long | frames_per_buffer, |
|
|
const PaStreamCallbackTimeInfo * | time_info, |
|
|
PaStreamCallbackFlags | status_flags, |
|
|
void * | user_data ) |
|
staticprivate |
The PortAudio callback.
- See also
- PortAudio documentation.
- Parameters
-
| [in] | input_buffer | Not used. Normally used for audio recording. |
| [in] | output_buffer | Pointer to a buffer of audio samples to be filled. Sent to the audio device upon the method's return. |
| [in] | frames_per_buffer | The number of frames (left + right sample) in the output_buffer. |
| [in] | time_info | Not used. |
| [in] | status_flags | Not used. |
| [in] | user_data | Not used. |
- Returns
- 0 for the successful filling of the output_buffer.
Definition at line 186 of file audio_output.h.
◆ restart()
◆ start()
Starts the invokation of the PortAudio callback.
Definition at line 146 of file audio_output.h.
◆ stop()
Stops the invokation of the PortAudio callback.
Definition at line 155 of file audio_output.h.
◆ _instance
◆ _pa_error
◆ _pa_stream
◆ SAMPLE_RATE
The documentation for this class was generated from the following file: