1
0
tetatet/src/audio.h

28 lines
642 B
C
Raw Normal View History

2024-03-21 04:10:02 +04:00
#ifndef _AUDIO_H_
#define _AUDIO_H_
#include <stdint.h>
#include <stdlib.h>
#include <opus/opus.h>
#include <portaudio.h>
#define AUDIO_SAMPLE_FORMAT paFloat32
typedef float audio_sample_t;
2024-03-21 04:10:02 +04:00
typedef struct audio_t {
PaStream *stream;
2024-03-21 04:10:02 +04:00
OpusEncoder *opusEnc;
OpusDecoder *opusDec;
audio_sample_t *buffer;
size_t bufferSz;
} audio_t;
2024-03-21 04:10:02 +04:00
int audio_init(audio_t *aud, int channels, int sampleRate, int frameSize);
2024-03-21 04:10:02 +04:00
int audio_destroy(audio_t *aud);
int audio_read(audio_t *aud, uint8_t *outputData, size_t outputLen);
int audio_write(audio_t *aud, const uint8_t *inputData, size_t inputLen);
2024-03-21 04:10:02 +04:00
#endif /* _AUDIO_H_ */