#define MA_WAKEUP_ENGINE_FUNC_GET_AUDIO_FORMAT "wakeup_engine_get_audio_format"
typedef int (*wakeup_engine_get_audio_format)(int* rate, int* channel, int* audio_type);
#define MA_WAKEUP_ENGINE_FUNC_FEED_AUDIO_DATA "wakeup_engine_feed_audio_data"
-typedef int (*wakeup_engine_feed_audio_data)(void* data, int len);
+typedef int (*wakeup_engine_feed_audio_data)(long time, void* data, int len);
#define MA_WAKEUP_ENGINE_FUNC_GET_UTTERANCE_DATA_COUNT "wakeup_engine_get_utterance_data_count"
typedef int (*wakeup_engine_get_utterance_data_count)(void);
#define MA_WAKEUP_ENGINE_FUNC_GET_UTTERANCE_DATA "wakeup_engine_get_utterance_data"
static int buffer_count = 0;
while (!(g_recorder_thread_should_stop.load())) {
- char buffer[BUFFER_LENGTH + 10];
+ unsigned char buffer[BUFFER_LENGTH];
int ret;
- memset(buffer, '\0', BUFFER_LENGTH + 10);
+ memset(buffer, '\0', BUFFER_LENGTH);
+
+ auto now = std::chrono::system_clock::now();
+ auto now_ms = std::chrono::time_point_cast<std::chrono::milliseconds>(now);
+ /* number of milliseconds since the epoch of system_clock */
+ auto value = now_ms.time_since_epoch();
+
+ static long time = 0;
+ if (time == value.count()) {
+ LOGE("[Recorder WARNING] Time value duplicated : %lu", time);
+ }
+ time = value.count();
+
int read_bytes = audio_in_read(g_audio_h, buffer, BUFFER_LENGTH);
if (0 > read_bytes) {
LOGE("[Recorder WARNING] Fail to read audio : %d", read_bytes);
for (int loop = 0;loop < g_engine_count;loop++) {
if (g_wakeup_engine_info[loop].audio_data_require_status &&
g_wakeup_engine_info[loop].interface.feed_audio_data) {
- ret = g_wakeup_engine_info[loop].interface.feed_audio_data(buffer, read_bytes);
+ ret = g_wakeup_engine_info[loop].interface.feed_audio_data(time, buffer, read_bytes);
if (0 == ret) {
LOGE("[ERROR] Fail to feed speech data, ret(%d)", ret);
}