static void PrintErrorState(stt_error_e reason);
static void PrintState(stt_state_e previous, stt_state_e current);
static void PrintResultState(stt_result_event_e result_type);
+ static void ReleaseSoundFocus();
};
}} /** end of is::stt */
#include <app_control.h>
#include <Evas.h>
+const int KEYBOARD_EDITOR_CHAR_COUNT_MAX = 50;
bool input_keyboard_init(app_control_h app_control);
void input_keyboard_deinit(void);
bool input_keyboard_launch(Evas_Object *window, void * data);
<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.tizen.inputdelegator" version="0.1.160927">
+<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.tizen.inputdelegator" version="0.1.161102">
<profile name="wearable" />
<ui-application appid="org.tizen.inputdelegator" exec="/usr/apps/org.tizen.inputdelegator/bin/inputdelegator" launch_mode="caller" type="capp" multiple="true" taskmanage="false" hw-acceleration="use-GL" nodisplay="true" process-pool="true">
Name: org.tizen.inputdelegator
Summary: Input Delegator Application
-Version: 0.1.160927
+Version: 0.1.161102
Release: 1
Group: Applications
License: Apache-2.0
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(db-util)
BuildRequires: pkgconfig(sqlite3)
+BuildRequires: pkgconfig(capi-media-audio-io)
%if %{enable_log_manager}
PKG_CHECK_MODULES(VCONF REQUIRED vconf)
PKG_CHECK_MODULES(DB_UTIL_PKG REQUIRED db-util)
PKG_CHECK_MODULES(SQLITE3_PKG REQUIRED sqlite3)
+pkg_check_modules(CAPI_MEDIA_AUDIO_IO REQUIRED capi-media-audio-io)
#PKG_CHECK_MODULES(GRAPHICS_EXTENSION REQUIRED graphics-extension)
#PKG_CHECK_MODULES(WNOTI_SERVICE REQUIRED wnoti-service2)
#PKG_CHECK_MODULES(SAP_CLIENT_STUB_API REQUIRED sap-client-stub-api)
${SQLITE3_PKG_INCLUDE_DIRS}
${DATA_CONTROL_INCLUDE_DIRS}
${WNOTI_SERVICE_INCLUDE_DIRS}
- ${SAP_CLIENT_STUB_API_INCLUDE_DIRS})
+ ${SAP_CLIENT_STUB_API_INCLUDE_DIRS}
+ ${CAPI_MEDIA_AUDIO_IO_INCLUDE_DIRS})
LINK_DIRECTORIES(${DLOG_LIBRARY_DIRS}
${VCONF_LIBRARY_DIRS}
${WNOTI_SERVICE_LIBRARY_DIRS}
${SAP_CLIENT_STUB_API_LIBRARY_DIRS}
+ ${CAPI_MEDIA_AUDIO_IO_LIBRARY_DIRS}
)
ADD_EXECUTABLE(${W_INPUT_SELECTOR}
${DB_UTIL_PKG_LIBRARIES}
${SQLITE3_PKG_LIBRARIES}
${VCONF_LIBRARIES}
+ ${CAPI_MEDIA_AUDIO_IO_LIBRARIES}
)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -fPIE")
volumes = ieffect.GetVolume();
} else {
for(unsigned int i = 0; i < spectrum_count; i++) {
- volumes.push_back(rand_r((unsigned int*)time(NULL)) % 2);
+ unsigned int seed = time(NULL);
+ volumes.push_back(rand_r(&seed) % 2);
}
}
#include <assert.h>
#include <vconf.h>
#include <vconf-keys.h>
+#include <sound_manager.h>
#include "Debug.h"
#include "SttManager.h"
CREATE = 0x1000
};
+static sound_stream_info_h g_stream_info_h = NULL;
+
static inline const char *stt_state_str(stt_state_e cur) {
if (cur == STT_STATE_CREATED)
return (const char *) "STT_STATE_CREATED";
return (const char *) "ABNORMAL CASE";
}
+static void player_focus_state_cb(sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *extra_info, void *user_data)
+{
+}
+
SttManager::SttManager(ISttFeedback& feedback)
: ifeedback(feedback),
iscancelled(false)
if(ret != STT_ERROR_NONE)
throw SttException(ret, ErrorString((stt_error_e)ret));
+ ret = sound_manager_create_stream_information(SOUND_STREAM_TYPE_VOICE_RECOGNITION, player_focus_state_cb, NULL, &g_stream_info_h);
+ if (SOUND_MANAGER_ERROR_NONE != ret) {
+ LOGW("Fail to create stream info. ret : %d", ret);
+ }
+
/**
* Set default properties
*
PRINTFUNC(DLOG_ERROR, "reason : %s", e.what());
stt_destroy(handle);
}
+
+ ReleaseSoundFocus();
+
+ sound_manager_destroy_stream_information(g_stream_info_h);
}
void SttManager::Prepare() {
*/
asrtype = STT_RECOGNITION_TYPE_FREE_PARTIAL;
int ret;
- ret = stt_start(handle, language.c_str(), asrtype.c_str());
+
+ ret = sound_manager_acquire_focus(g_stream_info_h, (sound_stream_focus_mask_e)(SOUND_STREAM_FOCUS_FOR_PLAYBACK | SOUND_STREAM_FOCUS_FOR_RECORDING), NULL);
+ if (SOUND_MANAGER_ERROR_NONE != ret) {
+ LOGW("Fail to acquire playback or recording focus. ret : %d, stream handle : %p", ret, g_stream_info_h);
+ }
+
+ ret = stt_start(handle, language.c_str(), asrtype.c_str());
if(ret != STT_ERROR_NONE)
throw SttException(ret, ErrorString((stt_error_e)ret));
SttManager& manager = *((SttManager *) user_data);
if (current== STT_STATE_READY) {
+ if (previous == STT_STATE_RECORDING ||
+ previous == STT_STATE_PROCESSING) {
+ ReleaseSoundFocus();
+ }
+
if (previous == STT_STATE_CREATED) {
manager.EnableSilenceDetection();
manager.ifeedback.AutoStart();
}
}
+void SttManager::ReleaseSoundFocus()
+{
+ int ret = sound_manager_release_focus(g_stream_info_h, (sound_stream_focus_mask_e)(SOUND_STREAM_FOCUS_FOR_PLAYBACK | SOUND_STREAM_FOCUS_FOR_RECORDING), NULL);
+ if (SOUND_MANAGER_ERROR_NONE != ret) {
+ LOGW("Fail to release playback or recording focus. ret : %d", ret);
+ }
+}
return EINA_TRUE;
}
+static void maxlength_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ LOGD("maxlength_cb : size = %d", KEYBOARD_EDITOR_CHAR_COUNT_MAX);
+}
+
void create_fullscreen_editor(void *data)
{
App_Data *ad = (App_Data *)data;
elm_win_resize_object_add(ad->naviframe, box);
entry = elm_entry_add(box);
+
+ static Elm_Entry_Filter_Limit_Size limit_filter_data;
+ limit_filter_data.max_char_count = KEYBOARD_EDITOR_CHAR_COUNT_MAX;
+ elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_filter_data);
+ evas_object_smart_callback_add(entry, "maxlength,reached", maxlength_cb, data);
+
elm_entry_single_line_set(entry, EINA_TRUE);
elm_entry_scrollable_set(entry, EINA_TRUE);
elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);