2024-10-13 22:43:33 +08:00
|
|
|
#ifndef AUDIO_H
|
|
|
|
#define AUDIO_H
|
2024-10-15 01:36:02 +08:00
|
|
|
#include <stdint.h>
|
2024-10-13 22:43:33 +08:00
|
|
|
|
2024-10-13 23:03:27 +08:00
|
|
|
#define MAX_RECORDING_SECONDS 2
|
|
|
|
|
2024-10-13 22:43:33 +08:00
|
|
|
typedef struct audio_state {
|
|
|
|
int recording_device_id;
|
|
|
|
int playback_device_id;
|
2024-10-15 01:36:02 +08:00
|
|
|
uint8_t* recording_buffer;
|
2024-10-13 22:43:33 +08:00
|
|
|
unsigned int recording_buffer_size;
|
|
|
|
unsigned int recording_buffer_position;
|
|
|
|
} audio_state;
|
|
|
|
|
|
|
|
int audio_init(audio_state* state);
|
|
|
|
void audio_destroy(audio_state* state);
|
|
|
|
int audio_recording_init(audio_state* state, int index);
|
|
|
|
int audio_playback_init(audio_state* state);
|
2024-11-04 22:40:48 +08:00
|
|
|
void audio_device_pause(audio_state* state, int is_recording, int pause);
|
|
|
|
void audio_device_close(audio_state* state, int is_recording);
|
2024-10-20 22:13:11 +08:00
|
|
|
void audio_buffer_reset(audio_state* state);
|
2024-10-13 22:43:33 +08:00
|
|
|
|
|
|
|
#endif
|