## Dependent packages ##
INCLUDE(FindPkgConfig)
IF("${_TV_PRODUCT}" STREQUAL "TRUE")
-pkg_check_modules(pkgs REQUIRED
+pkg_check_modules(pkgs REQUIRED
aul capi-media-audio-io capi-media-wav-player capi-network-bluetooth capi-network-bluetooth-tv capi-system-info cynara-client cynara-session
- dbus-1 dlog ecore glib-2.0 libgum libtzplatform-config libxml-2.0 libsystemd-login vconf vconf-internal-keys buxton2
+ dbus-1 dlog ecore glib-2.0 libgum libtzplatform-config libxml-2.0 libsystemd-login vconf vconf-internal-keys buxton2 farfield-voice-api
)
ELSE()
-pkg_check_modules(pkgs REQUIRED
+pkg_check_modules(pkgs REQUIRED
aul capi-media-audio-io capi-media-wav-player capi-system-info cynara-client cynara-session
dbus-1 dlog ecore glib-2.0 libgum libtzplatform-config libxml-2.0 libsystemd-login vconf vconf-internal-keys buxton2
)
#ifdef TV_PRODUCT
#define TV_BT_MODE
+#define TV_FFV_MODE
#endif
#include <audio_io.h>
#ifdef TV_BT_MODE
#include <bluetooth_product.h>
#endif
+#ifdef TV_FFV_MODE
+#include <farfield-voice-api.h>
+#endif
#include "stt_defs.h"
#include "sttd_dbus.h"
static int g_stream_focus_id;
+#ifdef TV_FFV_MODE
+farfield_voice_h g_farfieldvoice_h = NULL;
+#endif
+
/* Sound buf save for test */
/*
#define BUF_SAVE_MODE
}
#endif
+#ifdef TV_FFV_MODE
+static void _ffv_audio_function_cb(void* data, unsigned int length, void* user_data)
+{
+ if (0 == g_buffer_count % 50) {
+ SLOG(LOG_INFO, TAG_STTD, "[Recorder INFO] farfield audio function callback is invoked");
+
+ if (100000 == g_buffer_count) {
+ g_buffer_count = 0;
+ }
+ }
+
+ g_buffer_count++;
+
+ if (NULL != g_audio_cb) {
+ if (0 != g_audio_cb(data, length)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to read audio");
+ sttd_recorder_stop();
+ }
+
+ if (NULL == g_recorder) {
+ SLOG(LOG_INFO, TAG_STTD, "[Recorder INFO] g_recoder is NULL");
+ return;
+ }
+
+ float vol_db = get_volume_decibel((char*)data, (int)length, g_recorder->audio_type);
+ if (0 != sttdc_send_set_volume(g_recorder->uid, vol_db)) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Recorder] Fail to send recording volume(%f)", vol_db);
+ }
+ }
+}
+#endif
const char* __stt_get_focus_changed_reason_code(sound_stream_focus_change_reason_e reason)
{
SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to add focus state watch callback");
}
+#ifdef TV_FFV_MODE
+ g_farfieldvoice_h = farfield_voice_init();
+ if (NULL == g_farfieldvoice_h) {
+ SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to init farfield_voice_init");
+ } else {
+ SLOG(LOG_INFO, TAG_STTD, "[Recorder INFO] Register farfield voice audio callback");
+ farfield_voice_register_audio_cb(g_farfieldvoice_h, _ffv_audio_function_cb, NULL);
+ }
+#endif
+
#ifdef TV_BT_MODE
if (BT_ERROR_NONE != bt_product_init()) {
SLOG(LOG_ERROR, TAG_STTD, "[Recorder ERROR] Fail to init bt");
}
#endif
+#ifdef TV_FFV_MODE
+ if (NULL != g_farfieldvoice_h) {
+ SLOG(LOG_INFO, TAG_STTD, "[Recorder INFO] Unregister farfield voice");
+ farfield_voice_unregister_audio_cb(g_farfieldvoice_h);
+ farfield_voice_final(g_farfieldvoice_h);
+ g_farfieldvoice_h = NULL;
+ }
+#endif
+
#ifdef TV_BT_MODE
bt_hid_host_deinitialize();