32 lines
799 B
C
32 lines
799 B
C
#ifndef _AUDIO_H_
|
|
#define _AUDIO_H_
|
|
|
|
#include <opus/opus.h>
|
|
#include <portaudio.h>
|
|
|
|
#define AUDIO_SAMPLE_FORMAT paFloat32
|
|
typedef float audio_sample_t;
|
|
|
|
int audio_init_soundsystem(void);
|
|
int audio_terminate_soundsystem(void);
|
|
|
|
typedef struct audio_t {
|
|
PaStream *stream_in, *stream_out;
|
|
OpusEncoder *opus_enc;
|
|
OpusDecoder *opus_dec;
|
|
|
|
audio_sample_t *buffer;
|
|
int buffer_size;
|
|
} audio_t;
|
|
|
|
int audio_init_default(audio_t *aud, int channels, int sample_rate, int frame_size);
|
|
int audio_destroy(audio_t *aud);
|
|
|
|
int audio_stream_input_toggle(audio_t *aud);
|
|
int audio_stream_output_toggle(audio_t *aud);
|
|
|
|
int audio_read(audio_t *aud, unsigned char *output, int output_len);
|
|
int audio_write(audio_t *aud, const unsigned char *input, int input_len);
|
|
|
|
#endif /* _AUDIO_H_ */
|