40 lines
1.7 KiB
C
40 lines
1.7 KiB
C
/* Android-накопитель голосового: init → start(target,48000,1) → feed PCM int16 → stop либо cancel.
|
|
* target — channel_id либо dm:conv_id. feed копирует count mono-сэмплов; управление защищено mutex.
|
|
* stop отсоединяет PCM/компрессор и ставит attachment_send в uasync: encode/file работа идёт в worker.
|
|
* stop=0 означает постановку подготовки либо отбрасывание записи короче 500мс, не доставку сообщения.
|
|
* deinit освобождает текущую запись; завершение сетевой отправки отслеживается событиями ядра. */
|
|
#ifndef VOICE_RECORDER_H
|
|
#define VOICE_RECORDER_H
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct voice_recorder;
|
|
|
|
int voice_recorder_init(const char* db_path);
|
|
void voice_recorder_deinit(void);
|
|
|
|
int voice_recorder_start(const char* channel_id, int sample_rate, int channels, const uint8_t reply_to[32], uint64_t request_id);
|
|
int voice_recorder_feed(const int16_t* samples, int count);
|
|
int voice_recorder_stop(int* out_duration_ms);
|
|
void voice_recorder_cancel(void);
|
|
int voice_recorder_is_active(void);
|
|
|
|
void voice_recorder_set_preset(int preset);
|
|
int voice_recorder_get_preset(void);
|
|
void voice_recorder_set_compressor_enabled(int enabled);
|
|
int voice_recorder_is_compressor_enabled(void);
|
|
void voice_recorder_set_compressor_config(int max_gain_db, int lookback_ms, int lookahead_ms,
|
|
float rise_rate_per_sec, float target_level_db);
|
|
float voice_recorder_get_peak_level(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|