diff --git a/src/audio.c b/src/audio.c index 5b50069..6b7183a 100644 --- a/src/audio.c +++ b/src/audio.c @@ -74,14 +74,7 @@ int audio_destroy(audio_t *aud) { return 0; } -/* -int encLen = opus_encode_float(aud->opus_enc, (float *)input, frameCount, aud->opusBuf, aud->opusBufSz); - (void)encLen; - int frame_size = opus_decode_float(aud->opus_dec, aud->opusBuf, aud->opusBufSz, (float *)output, frameCount, 0); - (void)frame_size; -*/ - -int audio_read(audio_t *aud, uint8_t *output, size_t output_len) { +int audio_read(audio_t *aud, unsigned char *output, int output_len) { PaError pa_err; if ((pa_err = Pa_ReadStream(aud->stream, aud->buffer, aud->buffer_size)) != paNoError) { @@ -95,10 +88,10 @@ int audio_read(audio_t *aud, uint8_t *output, size_t output_len) { return -1; } - return 0; + return encodedLen; } -int audio_write(audio_t *aud, const uint8_t *input, size_t input_len) { +int audio_write(audio_t *aud, const unsigned char *input, int input_len) { PaError pa_err; int frame_size = opus_decode_float(aud->opus_dec, input, input_len, aud->buffer, aud->buffer_size, 0); diff --git a/src/audio.h b/src/audio.h index bc954c8..fa8e0ea 100644 --- a/src/audio.h +++ b/src/audio.h @@ -16,13 +16,13 @@ typedef struct audio_t { OpusDecoder *opus_dec; audio_sample_t *buffer; - size_t buffer_size; + int buffer_size; } audio_t; int audio_init(audio_t *aud, int channels, int sample_rate, int frame_size); int audio_destroy(audio_t *aud); -int audio_read(audio_t *aud, uint8_t *output, size_t output_len); -int audio_write(audio_t *aud, const uint8_t *input, size_t input_len); +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_ */ \ No newline at end of file