miniDSP
A small C library for audio DSP
Loading...
Searching...
No Matches
liveio.h
Go to the documentation of this file.
1
17#ifndef LIVEIO_H
18#define LIVEIO_H
19
20#include <stdio.h>
21#include <stdlib.h>
22#include <string.h>
23#include <stdint.h>
24#include <portaudio.h>
25
27typedef int LaError_t;
28
31 LA_OK = 0,
32 LA_ERROR = 1
33};
34
40
42LaError_t LA_init(void);
43
46
48void LA_print_last_error(FILE *stream);
49
51int LA_is_recording(void);
52
54double LA_get_cur_record_time(void);
55
57void LA_stop_recording(void);
58
70LaError_t LA_record(void *buffer, unsigned long bufsize,
71 unsigned samprate, int rectype);
72
81LaError_t LA_record_callback(unsigned samprate, PaStreamCallback *cb, void *cb_data);
82
84int LA_is_playing(void);
85
87double LA_get_cur_play_time(void);
88
90void LA_stop_playing(void);
91
103LaError_t LA_play(const void *buffer, unsigned long bufsize, unsigned samprate);
104
113LaError_t LA_play_callback(unsigned samprate, PaStreamCallback *cb, void *cb_data);
114
115#endif /* LIVEIO_H */
double LA_get_cur_play_time(void)
Get the current time (in seconds) of the playback stream.
Definition liveio.c:57
int LA_is_playing(void)
Check if the playback stream is active.
Definition liveio.c:94
int LaError_t
Return type for live audio functions.
Definition liveio.h:27
LaError_t LA_terminate(void)
Shut down the PortAudio system.
Definition liveio.c:441
LaError_t LA_init(void)
Initialise the PortAudio system.
Definition liveio.c:420
LaError_t LA_record(void *buffer, unsigned long bufsize, unsigned samprate, int rectype)
Record audio from the default input device into a buffer.
Definition liveio.c:314
LaError_t LA_play(const void *buffer, unsigned long bufsize, unsigned samprate)
Play audio from a buffer to the default output device.
Definition liveio.c:378
LA_RECORDTYPE
Recording modes for LA_record().
Definition liveio.h:36
@ LA_REC_CONT
Record continuously in a circular buffer.
Definition liveio.h:38
@ LA_REC_ONCE
Record until the buffer is full, then stop.
Definition liveio.h:37
LaError_t LA_record_callback(unsigned samprate, PaStreamCallback *cb, void *cb_data)
Record using a user-supplied PortAudio callback function.
Definition liveio.c:294
void LA_stop_recording(void)
Stop the current recording.
Definition liveio.c:65
LaError_t LA_play_callback(unsigned samprate, PaStreamCallback *cb, void *cb_data)
Play using a user-supplied PortAudio callback function.
Definition liveio.c:358
LA_ERRORCODE
Error codes returned by live audio functions.
Definition liveio.h:30
@ LA_OK
Operation succeeded.
Definition liveio.h:31
@ LA_ERROR
Something went wrong.
Definition liveio.h:32
int LA_is_recording(void)
Check if the recording stream is active.
Definition liveio.c:83
void LA_print_last_error(FILE *stream)
Print the last PortAudio error message to the given stream.
Definition liveio.c:409
void LA_stop_playing(void)
Stop the current playback.
Definition liveio.c:72
double LA_get_cur_record_time(void)
Get the current time (in seconds) of the recording stream.
Definition liveio.c:49