/*
-* Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
#include <stdio.h>
#include <Ecore.h>
-#include <dlog/dlog.h>
+#include <dlog.h>
#include <stt.h>
#include <stt_file.h>
return EINA_FALSE;
}
+static Eina_Bool __stt_get_volume(void *data)
+{
+ float volume = 0.0;
+ int ret = stt_get_recording_volume(g_stt, &volume);
+ if (STT_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, TAG_STT_TEST, "[ERROR] Fail to get volume");
+ return EINA_FALSE;
+ }
+
+ SLOG(LOG_DEBUG, TAG_STT_TEST, "Get volume : %f", volume);
+
+ return EINA_TRUE;
+}
+
static Eina_Bool __stt_start(void *data)
{
int ret;
if (STT_ERROR_NONE != ret) {
SLOG(LOG_ERROR, TAG_STT_TEST, "[ERROR] Fail to start");
}
+
+ ecore_timer_add(0.1, __stt_get_volume, NULL);
+
return EINA_FALSE;
}
SLOG(LOG_DEBUG, TAG_STT_TEST, "( %s )", data[0]);
}
+ if (STT_RESULT_EVENT_FINAL_RESULT == event) {
ecore_timer_add(0, __stt_finalize, NULL);
+ }
}
int main(int argc, char *argv[])
{
- if (2 < argc) {
+ if (2 > argc) {
SLOG(LOG_DEBUG, TAG_STT_TEST, "Please check parameter");
SLOG(LOG_DEBUG, TAG_STT_TEST, "Ex> stt-test -f <file path>");
SLOG(LOG_DEBUG, TAG_STT_TEST, "Ex> stt-test -m");
return 0;
}
- if (strcmp("-f", argv[1]) && strcmp("-m", argv[1])) {
+ if (0 != strcmp("-f", argv[1]) && 0 != strcmp("-m", argv[1])) {
SLOG(LOG_DEBUG, TAG_STT_TEST, "Please check parameter");
SLOG(LOG_DEBUG, TAG_STT_TEST, "Ex> stt-test -f <file path>");
SLOG(LOG_DEBUG, TAG_STT_TEST, "Ex> stt-test -m");
return 0;
}
+ SLOG(LOG_DEBUG, TAG_STT_TEST, "STT set credential");
+ ret = stt_set_credential(g_stt, "1Q2W3E4R5T");
+ if (STT_ERROR_NONE != ret) {
+ SLOG(LOG_ERROR, TAG_STT_TEST, "Fail to set credential");
+ return 0;
+ }
+
SLOG(LOG_DEBUG, TAG_STT_TEST, "STT prepare");
ret = stt_prepare(g_stt);
if (STT_ERROR_NONE != ret) {