|
| double | LA_get_cur_record_time (void) |
| | Get the current time (in seconds) of the recording stream.
|
| |
| double | LA_get_cur_play_time (void) |
| | Get the current time (in seconds) of the playback stream.
|
| |
| void | LA_stop_recording (void) |
| | Stop the current recording.
|
| |
| void | LA_stop_playing (void) |
| | Stop the current playback.
|
| |
| int | LA_is_recording (void) |
| | Check if the recording stream is currently active.
|
| |
| int | LA_is_playing (void) |
| | Check if the playback stream is currently active.
|
| |
| static int | _ContinuousRecordCallback (const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData) |
| | Callback for continuous (circular buffer) recording.
|
| |
| static int | _RecordCallback (const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData) |
| | Callback for one-shot recording (fill the buffer once, then stop).
|
| |
| static int | _PlayCallback (const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData) |
| | Callback for playback: reads mono samples and duplicates them to both stereo output channels (left and right get the same data).
|
| |
| static void | _RecordStreamFinished (void *userData) |
| | Called by PortAudio when a one-shot recording stream finishes.
|
| |
| static void | _PlayStreamFinished (void *userData) |
| | Called by PortAudio when a playback stream finishes.
|
| |
| static LaError_t | _ensure_init (void) |
| | Auto-initialise PortAudio if not already done.
|
| |
| static LaError_t | _setup_input_params (PaStreamParameters *p) |
| | Configure mono 16-bit input parameters for the default device.
|
| |
| static LaError_t | _setup_output_params (PaStreamParameters *p) |
| | Configure stereo 16-bit output parameters for the default device.
|
| |
| LaError_t | LA_record_callback (unsigned samprate, PaStreamCallback *cb, void *cb_data) |
| | Record using a user-supplied PortAudio callback function.
|
| |
| LaError_t | LA_record (void *buffer, unsigned long bufsize, unsigned samprate, int rectype) |
| | Record audio from the default input device into a buffer.
|
| |
| LaError_t | LA_play_callback (unsigned samprate, PaStreamCallback *cb, void *cb_data) |
| | Play using a user-supplied PortAudio callback function.
|
| |
| LaError_t | LA_play (const void *buffer, unsigned long bufsize, unsigned samprate) |
| | Play audio from a buffer to the default output device.
|
| |
| void | LA_print_last_error (FILE *stream) |
| | Print the last PortAudio error message to the given stream.
|
| |
| LaError_t | LA_init (void) |
| | Initialise the PortAudio system.
|
| |
| LaError_t | LA_terminate (void) |
| | Terminate the PortAudio system and release resources.
|
| |
Live audio recording and playback implementation.
- Author
- Chuck Wooters woote.nosp@m.rs@h.nosp@m.ey.co.nosp@m.m
This is a wrapper around PortAudio (http://portaudio.com), a cross-platform library for real-time audio I/O.
PortAudio works on a callback model: you give it a function, and it calls that function whenever it needs more audio data (for playback) or has new data available (for recording). The callbacks run on a separate high-priority thread managed by the OS audio subsystem.
Definition in file liveio.c.