Sungchan Kim <sungchan81.kim@samsung.com>
Samsung Multimedia R&D Group
+Kwangyoun Kim <ky85.kim@samsung.com>
+Wonnam Jang <wn.jang@samsung.com>
+Sooyeon Kim <sooyeon.kim@samsung.com>
+
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${TZ_SYS_RO_SHARE}/voice/tts/1.0/engine COMPONENT RuntimeLibraries)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/vdata/ DESTINATION ${TZ_SYS_RO_SHARE}/voice/tts/smt_vdata)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/ttssmt-info.xml DESTINATION ${TZ_SYS_RO_SHARE}/voice/tts/1.0/engine-info/)
+
+ADD_SUBDIRECTORY(setting-app)
-Copyright (c) 2012-2014 Samsung Electronics Co., Ltd. All rights reserved.
+Copyright (c) 2012-2016 Samsung Electronics Co., Ltd. All rights reserved.
Except as noted, this software is licensed under Flora License, Version 1.1
Please, see the LICENSE.Flora file for Flora License, Version 1.1 terms and conditions.
-%define _optdir /opt
-%define _appdir %{_optdir}/apps
-
Name: libttssmt
Summary: Text To Speech smt plugin shared library
Version: 0.1.2
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(tts)
BuildRequires: pkgconfig(tts-engine)
+BuildRequires: pkgconfig(libxml-2.0)
+
+BuildRequires: pkgconfig(appcore-efl)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(ecore)
+BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(efl-extension)
+BuildRequires: pkgconfig(capi-web-url-download)
provides : libsmt.so
%setup -q
cp %{SOURCE1001} .
+%define APP_PREFIX %{TZ_SYS_RO_APP}/org.tizen.ttssmt-setting
+%define APP_MANIFESTDIR %{TZ_SYS_RO_PACKAGES}
+
cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} \
- -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -DTZ_SYS_BIN=%TZ_SYS_BIN
+ -DTZ_SYS_RO_SHARE=%TZ_SYS_RO_SHARE -DTZ_SYS_BIN=%TZ_SYS_BIN \
+ -DAPP_INSTALL_PREFIX=%{APP_PREFIX} -DAPP_MANIFESTDIR=%{APP_MANIFESTDIR}
%build
export CFLAGS="${CFLAGS} -fPIC -fvisibility=hidden"
%{TZ_SYS_RO_SHARE}/voice/tts/smt_vdata/*
%{TZ_SYS_RO_SHARE}/voice/tts/1.0/engine-info/ttssmt-info.xml
%{TZ_SYS_RO_SHARE}/license/%{name}
+%{TZ_SYS_RO_APP}/org.tizen.ttssmt-setting/bin/ttssmt-setting
+%{TZ_SYS_RO_PACKAGES}/org.tizen.ttssmt-setting.xml
\ No newline at end of file
--- /dev/null
+Kwangyoun Kim <ky85.kim@samsung.com>
+Wonnam Jang <wn.jang@samsung.com>
--- /dev/null
+SET(SETTING_SRCS
+ src/ttssmt_setting_main.c
+)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs_setting REQUIRED
+ appcore-efl elementary ecore-imf eina ecore ecore-input evas edje glib-2.0
+ capi-base-common aul capi-appfw-application efl-extension vconf vconf-internal-keys capi-web-url-download libxml-2.0
+)
+
+FOREACH(flag ${pkgs_setting_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -fPIE")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS} -Wall -fPIE")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -Wall -fPIE")
+SET(CMAKE_C_FLAGS_RELEASE "-O2 -Wall -fPIE")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -fPIE")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -g -fPIE")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
+
+SET(BINDIR "${APP_INSTALL_PREFIX}/bin")
+
+ADD_EXECUTABLE("${PROJECT_NAME}-setting" ${SETTING_SRCS})
+TARGET_LINK_LIBRARIES("${PROJECT_NAME}-setting" ${pkgs_setting_LDFLAGS})
+INSTALL(TARGETS "${PROJECT_NAME}-setting" DESTINATION ${BINDIR})
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.tizen.ttssmt-setting.xml DESTINATION ${APP_MANIFESTDIR})
--- /dev/null
+Flora License
+
+Version 1.1, April, 2013
+
+http://floralicense.org/license/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction,
+and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by
+the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and
+all other entities that control, are controlled by, or are
+under common control with that entity. For the purposes of
+this definition, "control" means (i) the power, direct or indirect,
+to cause the direction or management of such entity,
+whether by contract or otherwise, or (ii) ownership of fifty percent (50%)
+or more of the outstanding shares, or (iii) beneficial ownership of
+such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity
+exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation source,
+and configuration files.
+
+"Object" form shall mean any form resulting from mechanical
+transformation or translation of a Source form, including but
+not limited to compiled object code, generated documentation,
+and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form,
+made available under the License, as indicated by a copyright notice
+that is included in or attached to the work (an example is provided
+in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form,
+that is based on (or derived from) the Work and for which the editorial
+revisions, annotations, elaborations, or other modifications represent,
+as a whole, an original work of authorship. For the purposes of this License,
+Derivative Works shall not include works that remain separable from,
+or merely link (or bind by name) to the interfaces of, the Work and
+Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original
+version of the Work and any modifications or additions to that Work or
+Derivative Works thereof, that is intentionally submitted to Licensor
+for inclusion in the Work by the copyright owner or by an individual or
+Legal Entity authorized to submit on behalf of the copyright owner.
+For the purposes of this definition, "submitted" means any form of
+electronic, verbal, or written communication sent to the Licensor or
+its representatives, including but not limited to communication on
+electronic mailing lists, source code control systems, and issue
+tracking systems that are managed by, or on behalf of, the Licensor
+for the purpose of discussing and improving the Work, but excluding
+communication that is conspicuously marked or otherwise designated
+in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity
+on behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+
+"Tizen Certified Platform" shall mean a software platform that complies
+with the standards set forth in the Tizen Compliance Specification
+and passes the Tizen Compliance Tests as defined from time to time
+by the Tizen Technical Steering Group and certified by the Tizen
+Association or its designated agent.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the
+Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made,
+use, offer to sell, sell, import, and otherwise transfer the Work
+solely as incorporated into a Tizen Certified Platform, where such
+license applies only to those patent claims licensable by such
+Contributor that are necessarily infringed by their Contribution(s)
+alone or by combination of their Contribution(s) with the Work solely
+as incorporated into a Tizen Certified Platform to which such
+Contribution(s) was submitted. If You institute patent litigation
+against any entity (including a cross-claim or counterclaim
+in a lawsuit) alleging that the Work or a Contribution incorporated
+within the Work constitutes direct or contributory patent infringement,
+then any patent licenses granted to You under this License for that
+Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+Work or Derivative Works thereof pursuant to the copyright license
+above, in any medium, with or without modifications, and in Source or
+Object form, provided that You meet the following conditions:
+
+ 1. You must give any other recipients of the Work or Derivative Works
+ a copy of this License; and
+ 2. You must cause any modified files to carry prominent notices stating
+ that You changed the files; and
+ 3. You must retain, in the Source form of any Derivative Works that
+ You distribute, all copyright, patent, trademark, and attribution
+ notices from the Source form of the Work, excluding those notices
+ that do not pertain to any part of the Derivative Works; and
+ 4. If the Work includes a "NOTICE" text file as part of its distribution,
+ then any Derivative Works that You distribute must include a readable
+ copy of the attribution notices contained within such NOTICE file,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works, in at least one of the following places:
+ within a NOTICE text file distributed as part of the Derivative Works;
+ within the Source form or documentation, if provided along with the
+ Derivative Works; or, within a display generated by the Derivative Works,
+ if and wherever such third-party notices normally appear.
+ The contents of the NOTICE file are for informational purposes only
+ and do not modify the License. You may add Your own attribution notices
+ within Derivative Works that You distribute, alongside or as an addendum
+ to the NOTICE text from the Work, provided that such additional attribution
+ notices cannot be construed as modifying the License. You may add Your own
+ copyright statement to Your modifications and may provide additional or
+ different license terms and conditions for use, reproduction, or
+ distribution of Your modifications, or for any such Derivative Works
+ as a whole, provided Your use, reproduction, and distribution of
+ the Work otherwise complies with the conditions stated in this License
+ and your own copyright statement or terms and conditions do not conflict
+ the conditions stated in the License including section 3.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+any Contribution intentionally submitted for inclusion in the Work
+by You to the Licensor shall be under the terms and conditions of
+this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify
+the terms of any separate license agreement you may have executed
+with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+names, trademarks, service marks, or product names of the Licensor,
+except as required for reasonable and customary use in describing the
+origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+agreed to in writing, Licensor provides the Work (and each
+Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied, including, without limitation, any warranties or conditions
+of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+PARTICULAR PURPOSE. You are solely responsible for determining the
+appropriateness of using or redistributing the Work and assume any
+risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+whether in tort (including negligence), contract, or otherwise,
+unless required by applicable law (such as deliberate and grossly
+negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a
+result of this License or out of the use or inability to use the
+Work (including but not limited to damages for loss of goodwill,
+work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses), even if such Contributor
+has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+the Work or Derivative Works thereof, You may choose to offer,
+and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this
+License. However, in accepting such obligations, You may act only
+on Your own behalf and on Your sole responsibility, not on behalf
+of any other Contributor, and only if You agree to indemnify,
+defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason
+of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Flora License to your work
+
+To apply the Flora License to your work, attach the following
+boilerplate notice, with the fields enclosed by brackets "[]"
+replaced with your own identifying information. (Don't include
+the brackets!) The text should be enclosed in the appropriate
+comment syntax for the file format. We also recommend that a
+file or class name and description of purpose be included on the
+same "printed page" as the copyright notice for easier
+identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Flora License, Version 1.1 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://floralicense.org/license/
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
--- /dev/null
+Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE file for Apache License terms and conditions.
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_" />
+ </request>
+</manifest>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ttssmt-setting" version="0.1" install-location="internal-only" api-version="3.0">
+ <label>TTSSMT engine setting</label>
+ <author email="ky85.kim@samsung.com" href="www.samsung.com">Kwangyoun Kim</author>
+ <description>TTSSMT engine setting Application</description>
+ <ui-application appid="org.tizen.ttssmt-setting" exec="ttssmt-setting" nodisplay="true" multiple="false" type="capp" taskmanage="false">
+ <label>TTSSMT engine setting</label>
+ </ui-application>
+ <privileges>
+ <privilege>http://tizen.org/privilege/internet</privilege>
+ <privilege>http://tizen.org/privilege/download</privilege>
+ </privileges>
+</manifest>
--- /dev/null
+/*
+* Copyright (c) 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
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+
+#include "ttssmt_setting_main.h"
+
+typedef struct appdata {
+ Evas_Object *win;
+ Evas_Object *conform;
+ Evas_Object *naviframe;
+ Evas_Object *genlist;
+
+ Evas_Object *progress_popup;
+ Evas_Object *delete_popup;
+ Elm_Object_Item *selected_lang;
+} appdata_s;
+
+typedef enum {
+ DOWNLOAD_TITLE = 0,
+ CS_CZ_FEMALE,
+ DA_DK_FEMALE,
+ DE_DE_FEMALE,
+ DE_DE_MALE,
+ EL_GR_MALE,
+ EN_GB_FEMALE,
+ EN_GB_MALE,
+ EN_IN_FEMALE,
+ EN_US_FEMALE,
+ EN_US_MALE,
+ ES_ES_FEMALE,
+ ES_ES_MALE,
+ ES_MX_FEMALE,
+ ES_MX_MALE,
+ FI_FI_FEMALE,
+ FR_FR_FEMALE,
+ FR_FR_MALE,
+ HI_IN_FEMALE,
+ HU_HU_FEMALE,
+ IT_IT_FEMALE,
+ IT_IT_MALE,
+ JA_JP_FEMALE,
+ JA_JP_MALE,
+ KO_KR_FEMALE,
+ KO_KR_MALE,
+ NB_NO_FEMALE,
+ NL_NL_FEMALE,
+ PL_PL_FEMALE,
+ PT_BR_FEMALE,
+ PT_BR_MALE,
+ PT_PT_FEMALE,
+ PT_PT_MALE,
+ RU_RU_FEMALE,
+ SK_SK_FEMALE,
+ SV_SE_FEMALE,
+ TR_TR_FEMALE,
+ ZH_CN_FEMALE,
+ ZH_CN_MALE,
+ ZH_HK_FEMALE,
+ ZH_HK_MALE,
+ ZH_TW_FEMALE,
+ END_INDEX
+} item_index_e;
+
+/* Todo - update language name */
+static char* item_data[END_INDEX][5] = {
+ {"Download (via network)", "", "", "", ""},
+ {"\xC4\x8C\x65\xC5\xA1\x74\x69\x6e\x61 - \xC5\xBD\x65\x6e\x61", "cs_CZ_Female", "libttssmt-cs_CZ_Female", "cs_CZ", "Female"},
+ {"Dansk - Kvinde", "da_DK_Female", "libttssmt-da_DK_Female", "da_DK", "Famale"},
+ {"\x44\x65\x75\x74\x73\x63\x68 - Weiblich", "de_DE_Female", "libttssmt-de_DE_Female", "de_DE", "Female"},
+ {"\x44\x65\x75\x74\x73\x63\x68 - Mannlich", "de_DE_Male", "libttssmt-de_DE_Male", "de_DE", "Male"},
+ {"\xCE\x95\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC - \xCE\x98\xCE\xB7\xCE\xBB\xCF\x85\xCE\xBA\xCF\x8C", "el_GR_Female", "libttssmt-el_GR_Female", "el_GR", "Female"},
+ {"English (United Kingdom) - Female", "en_GB_Female", "libttssmt-en_GB_Female", "en_GB", "Female"},
+ {"English (United Kingdom) - Male", "en_GB_Male", "libttssmt-en_GB_Male", "en_GB", "Male"},
+ {"English (India) - Female", "en_IN_Female", "libttssmt-en_IN_Female", "en_IN", "Famale"},
+ {"\x45\x6E\x67\x6C\x69\x73\x68 - Female", "en_US_Female", "libttssmt-en_US_Female", "en_US", "Female"},
+ {"\x45\x6E\x67\x6C\x69\x73\x68 - Male", "en_US_Male", "libttssmt-en_US_Male", "en_US", "Male"},
+ {"\x45\x73\x70\x61\xC3\xB1\x6F\x6C - Mujer", "es_ES_Female", "libttssmt-es_ES_Female", "es_ES", "Female"},
+ {"\x45\x73\x70\x61\xC3\xB1\x6F\x6C - Hombre", "es_ES_Male", "libttssmt-es_ES_Male", "es_ES", "Male"},
+ {"\x45\x73\x70\x61\xC3\xB1\x6f\x6c\x20\x28\x45\x73\x74\x61\x64\x6f\x73\x20\x55\x6e\x69\x64\x6f\x73\x29 - Mujer", "es_MX_Female", "libttssmt-es_MX_Female", "es_MX", "Female"},
+ {"\x45\x73\x70\x61\xC3\xB1\x6f\x6c\x20\x28\x45\x73\x74\x61\x64\x6f\x73\x20\x55\x6e\x69\x64\x6f\x73\x29 - Hombre", "es_MX_Male", "libttssmt-es_MX_Male", "es_MX", "Male"},
+ {"Suomi - Nainen ", "fi_FI_Female", "libttssmt-fi_FI_Female", "fi_FI", "Female"},
+ {"\x46\x72\x61\x6E\xC3\xA7\x61\x69\x73 - Femme", "fr_FR_Female", "libttssmt-fr_FR_Female", "fr_FR", "Female"},
+ {"\x46\x72\x61\x6E\xC3\xA7\x61\x69\x73 - Homme", "fr_FR_Male", "libttssmt-fr_FR_Male", "fr_FR", "Male"},
+ {"\xE0\xA4\xB9\xE0\xA4\xBF\xE0\xA4\xA8\xE0\xA5\x8D\xE0\xA4\xA6\xE0\xA5\x80 - \xE0\xA4\xB8\xE0\xA5\x8D\xE0\xA4\xA4\xE0\xA5\x8D\xE0\xA4\xB0\xE0\xA5\x80", "hi_IN_Female", "libttssmt-hi_IN_Female", "hi_IN", "Female"},
+ {"Magyar - \x4e\xC5\x91", "hu_HU_Female", "libttssmt-hu_HU_Female", "hu_HU", "Female"},
+ {"\x49\x74\x61\x6C\x69\x61\x6E\x6F - Femmina", "it_IT_Female", "libttssmt-it_IT_Female", "it_IT", "Female"},
+ {"\x49\x74\x61\x6C\x69\x61\x6E\x6F - Maschio", "it_IT_Male", "libttssmt-it_IT_Male", "it_IT", "Male"},
+ {"\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E - \xE5\xA5\xB3\xE6\x80\xA7", "ja_JP_Female", "libttssmt-ja_JP_Female", "ja_JP", "Female"},
+ {"\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E - \xE7\x94\xB7\xE6\x80\xA7", "ja_JP_Male", "libttssmt-ja_JP_Male", "ja_JP", "Male"},
+ {"\xED\x95\x9C\xEA\xB5\xAD\xEC\x96\xB4 - \xEC\x97\xAC", "ko_KR_Female", "libttssmt-ko_KR_Female", "ko_KR", "Female"},
+ {"\xED\x95\x9C\xEA\xB5\xAD\xEC\x96\xB4 - \xEB\x82\xA8", "ko_KR_Male", "libttssmt-ko_KR_Male", "ko_KR", "Male"},
+ {"Norsk - Kvinne", "nb_NO_Female", "libttssmt-nb_NO_Female", "nb_NO", "Female"},
+ {"Nederlands - Vrouw", "nl_NL_Female", "libttssmt-nl_NL_Female", "nl_NL", "Female"},
+ {"Polski - Kobieta", "pl_PL_Female", "libttssmt-pl_PL_Female", "pl_PL", "Female"},
+ {"\x50\x6f\x72\x74\x75\x67\x75\xC3\xAA\x73\x20\x28\x42\x72\x61\x73\x69\x6c\x29 - Feminino", "pt_BR_Female", "libttssmt-pt_BR_Female", "pt_BR", "Female"},
+ {"\x50\x6f\x72\x74\x75\x67\x75\xC3\xAA\x73\x20\x28\x42\x72\x61\x73\x69\x6c\x29 - Masculino", "pt_BR_Male", "libttssmt-pt_BR_Male", "pt_BR", "Male"},
+ {"\x50\x6f\x72\x74\x75\x67\x75\xC3\xAA\x73\x20\x28\x50\x6f\x72\x74\x75\x67\x61\x6c\x29 - Feminino", "pt_PT_Female", "libttssmt-pt_PT_Female", "pt_PT", "Female"},
+ {"\x50\x6f\x72\x74\x75\x67\x75\xC3\xAA\x73\x20\x28\x50\x6f\x72\x74\x75\x67\x61\x6c\x29 - Masculino", "pt_PT_Male", "libttssmt-pt_PT_Male", "pt_PT", "Male"},
+ {"\x50\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 - \xD0\x96\xD0\xB5\xD0\xBD\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9", "ru_RU_Female", "libttssmt-ru_RU_Female", "ru_RU", "Female"},
+ {"\x53\x6c\x6f\x76\x65\x6e\xC4\x8D\x69\x6e\x61 - \xC5\xBD\x65\x6e\x61", "sk_SK_Female", "libttssmt-sk_SK_Female", "sk_SK", "Female"},
+ {"Svenska - Kvinna", "sv_SE_Female", "libttssmt-sv_SE_Female", "sv_SE", "Female"},
+ {"\x54\xC3\xBC\x72\x6b\xC3\xA7\x65 - \x4b\x61\x64\xC4\xB1\x6e", "tr_TR_Female", "libttssmt-tr_TR_Female", "tr_TR", "Female"},
+ {"\xE7\xAE\x80\xE4\xBD\x93\xE4\xB8\xAD\xE6\x96\x87 - \xE5\xA5\xB3", "zh_CN_Female", "libttssmt-zh_CN_Female", "zh_CN", "Female"},
+ {"\xE7\xAE\x80\xE4\xBD\x93\xE4\xB8\xAD\xE6\x96\x87 - \xE7\x94\xB7", "zh_CN_Male", "libttssmt-zh_CN_Male", "zh_CN", "Male"},
+ {"\xE7\xB9\x81\xE4\xBD\x93\xE4\xB8\xAD\xE6\x96\x87\x28\xE9\xA6\x99\xE6\xB8\xAF\x29 - \xE5\xA5\xB3", "zh_HK_Female", "libttssmt-zh_HK_Female", "zh_HK", "Female"},
+ {"\xE7\xB9\x81\xE4\xBD\x93\xE4\xB8\xAD\xE6\x96\x87\x28\xE9\xA6\x99\xE6\xB8\xAF\x29 - \xE7\x94\xB7", "zh_HK_Male", "libttssmt-zh_HK_Male", "zh_HK", "Male"},
+ {"\xE7\xB9\x81\xE4\xBD\x93\xE4\xB8\xAD\xE6\x96\x87\x28\xE5\x8F\xB0\xE6\xB9\xBE\x29 - \xE5\xA5\xB3", "zh_TW_Female", "libttssmt-zh_TW_Female", "zh_TW", "Female"}
+};
+
+#define TTS_TAG_ENGINE_BASE_TAG "tts-engine"
+#define TTS_TAG_ENGINE_VOICE_SET "voices"
+#define TTS_TAG_ENGINE_VOICE "voice"
+#define TTS_TAG_ENGINE_VOICE_TYPE "type"
+
+#define TTS_TAG_VOICE_TYPE_FEMALE "female"
+#define TTS_TAG_VOICE_TYPE_MALE "male"
+#define TTS_TAG_VOICE_TYPE_CHILD "child"
+
+#define TTS_ENGINE_INFO tzplatform_mkpath(TZ_USER_HOME, "/share/.voice/tts/engine-info/ttssmt-info.xml")
+
+#define TTS_ENGINE_DATA_PATH tzplatform_mkpath(TZ_USER_HOME, "/share/.voice/tts/engine-info/")
+
+static Elm_Genlist_Item_Class *g_itc_group_title = NULL;
+static Elm_Genlist_Item_Class *g_itc_button_1line = NULL;
+
+static appdata_s *g_ad;
+
+typedef struct {
+ char* language;
+ int type;
+} tts_config_voice_s;
+
+static int __tts_engine_info_add_voice(const char* path, tts_config_voice_s* voice)
+{
+ if (NULL == path || NULL == voice) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "[ERROR] Input parameter is NULL");
+ return -1;
+ }
+
+ xmlDocPtr doc = NULL;
+ xmlNodePtr cur = NULL;
+
+ doc = xmlParseFile(path);
+ if (doc == NULL) {
+ return -1;
+ }
+
+ cur = xmlDocGetRootElement(doc);
+ if (cur == NULL) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "[ERROR] Empty document");
+ xmlFreeDoc(doc);
+ return -1;
+ }
+
+ if (xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_ENGINE_BASE_TAG)) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "[ERROR] The wrong type, root node is NOT 'tts-engine'");
+ xmlFreeDoc(doc);
+ return -1;
+ }
+
+ cur = cur->xmlChildrenNode;
+ if (cur == NULL) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "[ERROR] Empty document");
+ xmlFreeDoc(doc);
+ return -1;
+ }
+
+ while (cur != NULL) {
+ if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_ENGINE_VOICE_SET)) {
+ xmlNodePtr voice_node = NULL;
+ voice_node = xmlNewNode(NULL, (const xmlChar *)TTS_TAG_ENGINE_VOICE);
+ if (2 == voice->type) {
+ xmlSetProp(voice_node, (const xmlChar *)TTS_TAG_ENGINE_VOICE_TYPE, (const xmlChar*)TTS_TAG_VOICE_TYPE_FEMALE);
+ } else {
+ xmlSetProp(voice_node, (const xmlChar *)TTS_TAG_ENGINE_VOICE_TYPE, (const xmlChar*)TTS_TAG_VOICE_TYPE_MALE);
+ }
+
+ xmlNodeSetContent(voice_node, (const xmlChar *)voice->language);
+ xmlAddChild(cur, voice_node);
+ }
+ cur = cur->next;
+ }
+
+ int ret = xmlSaveFormatFile(path, doc, 1);
+ if (0 > ret) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "[ERROR] Save result : %d", ret);
+ }
+
+ xmlFreeDoc(doc);
+
+ return 0;
+}
+
+static int __tts_engine_info_remove_voice(const char* path, tts_config_voice_s* voice)
+{
+ if (NULL == path || NULL == voice) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "[ERROR] Input parameter is NULL");
+ return -1;
+ }
+
+ xmlDocPtr doc = NULL;
+ xmlNodePtr cur = NULL;
+ xmlChar *key = NULL;
+ xmlChar *attr = NULL;
+
+ doc = xmlParseFile(path);
+ if (doc == NULL) {
+ return -1;
+ }
+
+ cur = xmlDocGetRootElement(doc);
+ if (cur == NULL) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "[ERROR] Empty document");
+ xmlFreeDoc(doc);
+ return -1;
+ }
+
+ if (xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_ENGINE_BASE_TAG)) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "[ERROR] The wrong type, root node is NOT 'tts-engine'");
+ xmlFreeDoc(doc);
+ return -1;
+ }
+
+ cur = cur->xmlChildrenNode;
+ if (cur == NULL) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "[ERROR] Empty document");
+ xmlFreeDoc(doc);
+ return -1;
+ }
+
+ while (cur != NULL) {
+ if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_ENGINE_VOICE_SET)) {
+ xmlNodePtr voice_node = NULL;
+ voice_node = cur->xmlChildrenNode;
+
+ while (NULL != voice_node) {
+ if (0 == xmlStrcmp(voice_node->name, (const xmlChar *)TTS_TAG_ENGINE_VOICE)) {
+ key = xmlNodeGetContent(voice_node);
+ if (NULL != key) {
+ if (!strcmp((char*)key, voice->language)) {
+ int temp_type = -1;
+ attr = xmlGetProp(voice_node, (const xmlChar*)TTS_TAG_ENGINE_VOICE_TYPE);
+ if (NULL != attr) {
+ if (0 == xmlStrcmp(attr, (const xmlChar *)TTS_TAG_VOICE_TYPE_FEMALE)) {
+ temp_type = (int)2;
+ } else if (0 == xmlStrcmp(attr, (const xmlChar *)TTS_TAG_VOICE_TYPE_MALE)) {
+ temp_type = (int)1;
+ }
+ xmlFree(attr);
+ }
+ if (temp_type == voice->type) {
+ /* remove */
+ xmlUnlinkNode(voice_node);
+ xmlFreeNode(voice_node);
+ }
+ }
+ xmlFree(key);
+ } else {
+ dlog_print(DLOG_ERROR, LOG_TAG, "[ERROR] <%s> has no content", TTS_TAG_ENGINE_VOICE_TYPE);
+ }
+ }
+ voice_node = voice_node->next;
+ }
+ }
+ cur = cur->next;
+ }
+
+ int ret = xmlSaveFormatFile(path, doc, 1);
+ if (0 > ret) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "[ERROR] Save result : %d", ret);
+ }
+
+ xmlFreeDoc(doc);
+
+ return 0;
+}
+
+static char * __genlist_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ item_index_e idx = (item_index_e)data;
+
+ if (!strcmp("elm.text", part)) {
+ return strdup(item_data[idx][0]);
+ }
+
+ return NULL;
+}
+
+static bool __installed_lang(int idx)
+{
+ char filepath[1024] = {'\0',};
+ const char* data_path = TTS_ENGINE_DATA_PATH;
+ snprintf(filepath, 1024, "%s/%s", data_path, item_data[idx][1]);
+
+ if (EN_US_FEMALE == idx || KO_KR_FEMALE == idx || DE_DE_FEMALE == idx || FR_FR_FEMALE == idx || IT_IT_FEMALE == idx || ES_ES_FEMALE == idx) {
+ return true;
+ } else {
+ if (0 != access(filepath, F_OK)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+}
+
+static void __check_changed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ elm_genlist_item_update(g_ad->selected_lang);
+}
+
+static Evas_Object * __genlist_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ item_index_e idx = (item_index_e)data;
+
+ if (!strcmp("elm.swallow.icon.1", part)) {
+ Evas_Object *check = elm_check_add(obj);
+ elm_object_style_set(check, "default");
+ elm_check_state_set(check, __installed_lang(idx));
+ if (EN_US_FEMALE == idx || KO_KR_FEMALE == idx || DE_DE_FEMALE == idx || FR_FR_FEMALE == idx || IT_IT_FEMALE == idx || ES_ES_FEMALE == idx) {
+ elm_object_disabled_set(check, EINA_TRUE);
+ }
+
+ evas_object_propagate_events_set(check, EINA_TRUE);
+ evas_object_smart_callback_add(check, "changed", __check_changed_cb, data);
+ evas_object_show(check);
+ return check;
+ }
+
+ return NULL;
+}
+
+static void __progress_popup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ if (NULL != g_ad->progress_popup) {
+ evas_object_del(g_ad->progress_popup);
+ g_ad->progress_popup = NULL;
+ }
+ return;
+}
+
+static void __progress_popup_back_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ return;
+}
+
+static void __show_progress_popup(bool failed)
+{
+ if (NULL != g_ad->progress_popup) {
+ evas_object_del(g_ad->progress_popup);
+ g_ad->progress_popup = NULL;
+ }
+
+ Evas_Object *popup = elm_popup_add(g_ad->win);
+ elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_text_set(popup, "title,text", "Downloading");
+
+ if (failed) {
+ elm_object_part_text_set(popup, "default", "Fail to download language pack.");
+ elm_popup_timeout_set(popup, 2.0);
+
+ } else {
+ Evas_Object *progressbar = elm_progressbar_add(popup);
+ elm_object_style_set(progressbar, "process_large");
+ evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5);
+ evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_progressbar_pulse(progressbar, EINA_TRUE);
+
+ elm_object_content_set(popup, progressbar);
+ evas_object_show(progressbar);
+ }
+
+ evas_object_smart_callback_add(popup, "block,clicked", NULL, NULL);
+ evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, __progress_popup_del_cb, NULL);
+ eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, __progress_popup_back_cb, NULL);
+
+ g_ad->progress_popup = popup;
+
+ evas_object_show(popup);
+}
+
+static void __delete_popup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ if (NULL != g_ad->delete_popup) {
+ evas_object_del(g_ad->delete_popup);
+ g_ad->delete_popup = NULL;
+ }
+ return;
+}
+
+static void __delete_popup_back_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ return;
+}
+
+static void __show_delete_popup()
+{
+ if (NULL != g_ad->delete_popup) {
+ evas_object_del(g_ad->delete_popup);
+ g_ad->delete_popup = NULL;
+ }
+
+ Evas_Object *popup = elm_popup_add(g_ad->win);
+ elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_part_text_set(popup, "title,text", "Deleting");
+ elm_popup_timeout_set(popup, 1.0);
+
+ Evas_Object *progressbar = elm_progressbar_add(popup);
+ elm_object_style_set(progressbar, "process_large");
+ evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5);
+ evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_progressbar_pulse(progressbar, EINA_TRUE);
+
+ elm_object_content_set(popup, progressbar);
+ evas_object_show(progressbar);
+
+ evas_object_smart_callback_add(popup, "block,clicked", NULL, NULL);
+ evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, __delete_popup_del_cb, NULL);
+ eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, __delete_popup_back_cb, NULL);
+
+ g_ad->delete_popup = popup;
+
+ evas_object_show(popup);
+}
+
+static void __hide_progress_popup()
+{
+ if (NULL != g_ad->progress_popup) {
+ evas_object_del(g_ad->progress_popup);
+ g_ad->progress_popup = NULL;
+ }
+}
+
+static void* __download_completed_cb(void *user_data)
+{
+ intptr_t pidx = (intptr_t)user_data;
+ int idx = (int)pidx;
+ char cmd[1024] = {'\0',};
+ //char* data_path = app_get_data_path();
+ const char* data_path = TTS_ENGINE_DATA_PATH;
+ snprintf(cmd, 1024, "tar zxvf %s/%s.tar.gz -C %s", data_path, item_data[idx][2], data_path);
+ int ret = system(cmd);
+ dlog_print(DLOG_DEBUG, LOG_TAG, "system return(%d)", ret);
+
+ char filepath[1024] = {'\0',};
+ snprintf(filepath, 1024, "%s/%s.tar.gz", data_path, item_data[idx][2]);
+ remove(filepath);
+
+ /* TODO */
+ tts_config_voice_s *voice = (tts_config_voice_s *)calloc(1, sizeof(tts_config_voice_s));
+ voice->language = strdup(item_data[idx][3]);
+ if (!strcmp(item_data[idx][4], "Male")) {
+ voice->type = 1;
+ } else {
+ voice->type = 2;
+ }
+ __tts_engine_info_add_voice(TTS_ENGINE_INFO, voice);
+
+ free(voice->language);
+ free(voice);
+
+ __hide_progress_popup();
+ elm_genlist_item_update(g_ad->selected_lang);
+
+ return NULL;
+}
+
+static void* __download_failed_cb(void *user_data)
+{
+ __hide_progress_popup();
+ __show_progress_popup(true);
+ elm_genlist_item_update(g_ad->selected_lang);
+ return NULL;
+}
+
+static void __download_state_changed_cb(int download_id, download_state_e state, void *user_data)
+{
+ if (DOWNLOAD_STATE_COMPLETED == state) {
+ dlog_print(DLOG_INFO, LOG_TAG, "===== Download Completed");
+ ecore_main_loop_thread_safe_call_sync(__download_completed_cb, user_data);
+ } else if (DOWNLOAD_STATE_FAILED == state) {
+ dlog_print(DLOG_INFO, LOG_TAG, "===== Download Failed");
+ ecore_main_loop_thread_safe_call_sync(__download_failed_cb, user_data);
+ }
+
+ dlog_print(DLOG_INFO, LOG_TAG, "=====");
+}
+
+static void __lang_item_clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *item = (Elm_Object_Item *)event_info;
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+ g_ad->selected_lang = item;
+
+ intptr_t pidx = (intptr_t)data;
+ int idx = (int)pidx;
+ dlog_print(DLOG_INFO, LOG_TAG, "[%d] item clicked", idx);
+
+ /* download */
+ if (false == __installed_lang(idx)) {
+ dlog_print(DLOG_INFO, LOG_TAG, ">> Download <<");
+ download_error_e error;
+ int download_id;
+
+ error = download_create(&download_id);
+ if (DOWNLOAD_ERROR_NONE != error) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "[ERROR] create");
+ }
+ error = download_set_state_changed_cb(download_id, __download_state_changed_cb, (void *)pidx);
+ if (DOWNLOAD_ERROR_NONE != error) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "[ERROR] set state cb");
+ }
+
+ char url[1024] = {'\0',};
+ snprintf(url, 1024, "http://download.tizen.org/releases/resources/voice/tts/smt-language-pack/%s.tar.gz", item_data[idx][2]);
+ error = download_set_url(download_id, url);
+ if (DOWNLOAD_ERROR_NONE != error) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "[ERROR] set url");
+ }
+
+ //char *data_path = app_get_data_path();
+ const char *data_path = TTS_ENGINE_DATA_PATH;
+ error = download_set_destination(download_id, data_path);
+ if (DOWNLOAD_ERROR_NONE != error) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "[ERROR] set destination");
+ }
+ //free(data_path);
+
+ error = download_start(download_id);
+ if (DOWNLOAD_ERROR_NONE != error) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "[ERROR] start");
+ }
+
+ __show_progress_popup(false);
+
+ dlog_print(DLOG_INFO, LOG_TAG, "<< End >>");
+ } else {
+ dlog_print(DLOG_INFO, LOG_TAG, ">> Delete <<");
+ char cmd[1024] = {'\0',};
+ //char* data_path = app_get_data_path();
+ const char* data_path = TTS_ENGINE_DATA_PATH;
+ snprintf(cmd, 1024, "rm -rf %s/*%s*", data_path, item_data[idx][1]);
+ int ret = system(cmd);
+ dlog_print(DLOG_DEBUG, LOG_TAG, "system return (%d)", ret);
+ elm_genlist_item_update(g_ad->selected_lang);
+
+ __show_delete_popup();
+
+ tts_config_voice_s *voice = (tts_config_voice_s *)calloc(1, sizeof(tts_config_voice_s));
+ voice->language = strdup(item_data[idx][3]);
+ if (!strcmp(item_data[idx][4], "Male")) {
+ voice->type = 1;
+ } else {
+ voice->type = 2;
+ }
+ __tts_engine_info_remove_voice(TTS_ENGINE_INFO, voice);
+
+ free(voice->language);
+ free(voice);
+
+ dlog_print(DLOG_INFO, LOG_TAG, "<< End >>");
+ }
+}
+
+static void create_contents(appdata_s *ad)
+{
+ /* Genlist */
+ ad->genlist = elm_genlist_add(ad->naviframe);
+ elm_genlist_mode_set(ad->genlist, ELM_LIST_COMPRESS);
+ elm_genlist_homogeneous_set(ad->genlist, EINA_TRUE);
+
+ g_itc_group_title = elm_genlist_item_class_new();
+ if (NULL == g_itc_group_title) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Fail to item class new");
+ return;
+ }
+ g_itc_group_title->item_style = "group_index";
+ g_itc_group_title->func.text_get = __genlist_text_get;
+ g_itc_group_title->func.content_get = NULL;
+ g_itc_group_title->func.state_get = NULL;
+ g_itc_group_title->func.del = NULL;
+
+ g_itc_button_1line = elm_genlist_item_class_new();
+ if (NULL == g_itc_button_1line) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Fail to item class new");
+ return;
+ }
+ g_itc_button_1line->item_style = "type1";
+ g_itc_button_1line->func.text_get = __genlist_text_get;
+ g_itc_button_1line->func.content_get = __genlist_content_get;
+ g_itc_button_1line->func.state_get = NULL;
+ g_itc_button_1line->func.del = NULL;
+
+ /* Download - Title */
+ Elm_Object_Item *it;
+ intptr_t pi = (intptr_t)DOWNLOAD_TITLE;
+ it = elm_genlist_item_append(ad->genlist, g_itc_group_title, (void *)pi, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ int i;
+ for (i = DOWNLOAD_TITLE + 1; i < END_INDEX; i++) {
+ pi = (intptr_t)i;
+ it = elm_genlist_item_append(ad->genlist, g_itc_button_1line, (void *)pi, NULL, ELM_GENLIST_ITEM_NONE, __lang_item_clicked_cb, (void *)pi);
+ if (EN_US_FEMALE == i || KO_KR_FEMALE == i || DE_DE_FEMALE == i || FR_FR_FEMALE == i || IT_IT_FEMALE == i || ES_ES_FEMALE == i) {
+ elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_NONE);
+ }
+ }
+
+ evas_object_show(ad->genlist);
+}
+
+static Eina_Bool __naviframe_item_pop_cb(void *data, Elm_Object_Item *it)
+{
+ dlog_print(DLOG_DEBUG, LOG_TAG, "");
+ ui_app_exit();
+ return EINA_TRUE;
+}
+
+static void create_base_gui(appdata_s *ad)
+{
+ g_ad = ad;
+ /* Window */
+ ad->win = elm_win_util_standard_add("org.tizen.ttssmt-setting", "org.tizen.ttssmt-setting");
+ elm_win_autodel_set(ad->win, EINA_TRUE);
+
+ if (elm_win_wm_rotation_supported_get(ad->win)) {
+ int rots[4] = { 0, 90, 180, 270 };
+ elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
+ }
+
+ /* Conformant */
+ ad->conform = elm_conformant_add(ad->win);
+ elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
+ elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
+ evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(ad->win, ad->conform);
+ evas_object_show(ad->conform);
+
+ /* Naviframe */
+ ad->naviframe = elm_naviframe_add(ad->conform);
+ eext_object_event_callback_add(ad->naviframe, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
+ evas_object_size_hint_weight_set(ad->naviframe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(ad->naviframe, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_part_content_set(ad->conform, "elm.swallow.content", ad->naviframe);
+ evas_object_show(ad->naviframe);
+
+ /* Contents */
+ create_contents(ad);
+ Elm_Object_Item *main_item = elm_naviframe_item_push(ad->naviframe, "TTSSMT Setting", NULL, NULL, ad->genlist, NULL);
+ elm_naviframe_item_title_enabled_set(main_item, EINA_TRUE, EINA_TRUE);
+ elm_naviframe_item_pop_cb_set(main_item, __naviframe_item_pop_cb, ad);
+ elm_object_content_set(ad->conform, ad->naviframe);
+
+ /* Show window after base gui is set up */
+ evas_object_show(ad->win);
+}
+
+
+static bool app_create(void *data)
+{
+ /* Hook to take necessary actions before main event loop starts
+ Initialize UI resources and application's data
+ If this function returns true, the main loop of application starts
+ If this function returns false, the application is terminated */
+ appdata_s *ad = data;
+
+ create_base_gui(ad);
+
+ return true;
+}
+
+static void app_control(app_control_h app_control, void *data)
+{
+ /* Handle the launch request. */
+}
+
+static void app_pause(void *data)
+{
+ /* Take necessary actions when application becomes invisible. */
+}
+
+static void app_resume(void *data)
+{
+ /* Take necessary actions when application becomes visible. */
+}
+
+static void app_terminate(void *data)
+{
+ /* Release all resources. */
+}
+
+static void ui_app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_LANGUAGE_CHANGED*/
+ return;
+}
+
+static void ui_app_orient_changed(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
+ return;
+}
+
+static void ui_app_region_changed(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_REGION_FORMAT_CHANGED*/
+}
+
+static void ui_app_low_battery(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_LOW_BATTERY*/
+}
+
+static void ui_app_low_memory(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_LOW_MEMORY*/
+}
+
+int main(int argc, char *argv[])
+{
+ appdata_s ad = {0,};
+ int ret = 0;
+
+ ui_app_lifecycle_callback_s event_callback = {0,};
+ app_event_handler_h handlers[5] = {NULL, };
+
+ event_callback.create = app_create;
+ event_callback.terminate = app_terminate;
+ event_callback.pause = app_pause;
+ event_callback.resume = app_resume;
+ event_callback.app_control = app_control;
+
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
+ ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
+ ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
+ ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);
+
+ ret = ui_app_main(argc, argv, &event_callback, &ad);
+ if (ret != APP_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
+ }
+
+ return ret;
+}
+
+
+/*
+vi:ts=4:ai:nowrap:expandtab
+*/
--- /dev/null
+/*
+* Copyright (c) 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
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef __TTSSMT_SETTING_MAIN_H
+#define __TTSSMT_SETTING_MAIN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <app.h>
+#include <glib.h>
+#include <Elementary.h>
+#include <efl_extension.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+#include <dlog.h>
+#include <download.h>
+#include <libxml/parser.h>
+#include <tzplatform_config.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "ttssmt_setting"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TTSSMT_SETTING_MAIN_H */
+
+/*
+vi:ts=4:ai:nowrap:expandtab
+*/
/*
* Samsung TTS
- * Copyright 2012-2014 Samsung Electronics Co., Ltd
+ * Copyright 2012-2016 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the License);
* you may not use this file except in compliance with the License.
/*
* Samsung TTS
-* Copyright 2012-2014 Samsung Electronics Co., Ltd
+* Copyright 2012-2016 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the License);
* you may not use this file except in compliance with the License.
// Not supported yet }
-
-
-
-
-
-
-
-
typedef struct __TypeVoiceInfo _TypeVoiceInfo;
struct __TypeVoiceInfo
{
static char const _pszKorean [] = "ko_KR";
static char const _pszUSEnglish [] = "en_US";
+static char const _pszChinese [] = "zh_CN";
+static char const _pszUKEnglish [] = "en_GB";
static char const _pszGerman [] = "de_DE";
static char const _pszSpanish [] = "es_ES";
static char const _pszFrench [] = "fr_FR";
static char const _pszItalian [] = "it_IT";
+static char const _pszRussian [] = "ru_RU";
+static char const _pszJapanese [] = "ja_JP";
+static char const _pszBRPortuguese [] = "pt_BR";
+static char const _pszPTPortuguese [] = "pt_PT";
+static char const _pszMXSpanish [] = "es_US";
+
+static char const _pszGreek [] = "el_GR";
+static char const _pszTWChinese [] = "zh_TW";
+static char const _pszNorwegian [] = "nb_NO";
+static char const _pszHKChinese [] = "zh_HK";
+static char const _pszPolish [] = "pl_PL";
+static char const _pszHungarian [] = "hu_HU";
+static char const _pszCzech [] = "cs_CZ";
+static char const _pszFinnish [] = "fi_FI";
+static char const _pszHindi [] = "hi_IN";
+static char const _pszINEnglish [] = "en_IN";
+static char const _pszSwedish [] = "sv_SE";
+static char const _pszDanish [] = "da_DK";
+static char const _pszTurkish [] = "tr_TR";
+static char const _pszSlovak [] = "sk_SK";
+static char const _pszDutch [] = "nl_NL";
static unsigned int const _sszKorean = sizeof(_pszKorean);
static unsigned int const _sszUSEnglish = sizeof(_pszUSEnglish);
+static unsigned int const _sszChinese = sizeof(_pszChinese);
+static unsigned int const _sszUKEnglish = sizeof(_pszUKEnglish);
static unsigned int const _sszGerman = sizeof(_pszGerman);
static unsigned int const _sszSpanish = sizeof(_pszSpanish);
static unsigned int const _sszFrench = sizeof(_pszFrench);
static unsigned int const _sszItalian = sizeof(_pszItalian);
+static unsigned int const _sszRussian = sizeof(_pszRussian);
+static unsigned int const _sszJapanese = sizeof(_pszJapanese);
+static unsigned int const _sszBRPortuguese = sizeof(_pszBRPortuguese);
+static unsigned int const _sszPTPortuguese = sizeof(_pszPTPortuguese);
+static unsigned int const _sszMXSpanish = sizeof(_pszMXSpanish);
+
+static unsigned int const _sszGreek = sizeof(_pszGreek );
+static unsigned int const _sszTWChinese = sizeof(_pszTWChinese );
+static unsigned int const _sszNorwegian = sizeof(_pszNorwegian );
+static unsigned int const _sszHKChinese = sizeof(_pszHKChinese );
+static unsigned int const _sszPolish = sizeof(_pszPolish );
+static unsigned int const _sszHungarian = sizeof(_pszHungarian );
+static unsigned int const _sszCzech = sizeof(_pszCzech );
+static unsigned int const _sszFinnish = sizeof(_pszFinnish );
+static unsigned int const _sszHindi = sizeof(_pszHindi );
+static unsigned int const _sszINEnglish = sizeof(_pszINEnglish );
+static unsigned int const _sszSwedish = sizeof(_pszSwedish );
+static unsigned int const _sszDanish = sizeof(_pszDanish );
+static unsigned int const _sszTurkish = sizeof(_pszTurkish );
+static unsigned int const _sszSlovak = sizeof(_pszSlovak );
+static unsigned int const _sszDutch = sizeof(_pszDutch );
static const _TypeVoiceInfo _pVoiceInfos[] =
{
- { _pszKorean , _sszKorean , TTSP_VOICE_TYPE_FEMALE },
- { _pszUSEnglish , _sszUSEnglish , TTSP_VOICE_TYPE_FEMALE },
-
- { _pszGerman , _sszGerman , TTSP_VOICE_TYPE_FEMALE },
- { _pszSpanish , _sszSpanish , TTSP_VOICE_TYPE_FEMALE },
- { _pszFrench , _sszFrench , TTSP_VOICE_TYPE_FEMALE },
- { _pszItalian , _sszItalian , TTSP_VOICE_TYPE_FEMALE },
+ { _pszKorean , _sszKorean , TTSP_VOICE_TYPE_FEMALE },
+ { _pszKorean , _sszKorean , TTSP_VOICE_TYPE_MALE },
+ { _pszUSEnglish , _sszUSEnglish , TTSP_VOICE_TYPE_FEMALE },
+ { _pszUSEnglish , _sszUSEnglish , TTSP_VOICE_TYPE_MALE },
+ { _pszChinese , _sszChinese , TTSP_VOICE_TYPE_FEMALE },
+ { _pszChinese , _sszChinese , TTSP_VOICE_TYPE_MALE },
+ { _pszUKEnglish , _sszUKEnglish , TTSP_VOICE_TYPE_FEMALE },
+ { _pszUKEnglish , _sszUKEnglish , TTSP_VOICE_TYPE_MALE },
+ { _pszGerman , _sszGerman , TTSP_VOICE_TYPE_FEMALE },
+ { _pszGerman , _sszGerman , TTSP_VOICE_TYPE_MALE },
+ { _pszSpanish , _sszSpanish , TTSP_VOICE_TYPE_FEMALE },
+ { _pszSpanish , _sszSpanish , TTSP_VOICE_TYPE_MALE },
+ { _pszFrench , _sszFrench , TTSP_VOICE_TYPE_FEMALE },
+ { _pszFrench , _sszFrench , TTSP_VOICE_TYPE_MALE },
+ { _pszItalian , _sszItalian , TTSP_VOICE_TYPE_FEMALE },
+ { _pszItalian , _sszItalian , TTSP_VOICE_TYPE_MALE },
+ { _pszRussian , _sszRussian , TTSP_VOICE_TYPE_FEMALE },
+ { _pszJapanese , _sszJapanese , TTSP_VOICE_TYPE_FEMALE },
+ { _pszJapanese , _sszJapanese , TTSP_VOICE_TYPE_MALE },
+ { _pszBRPortuguese , _sszBRPortuguese , TTSP_VOICE_TYPE_FEMALE },
+ { _pszBRPortuguese , _sszBRPortuguese , TTSP_VOICE_TYPE_MALE },
+ { _pszPTPortuguese , _sszPTPortuguese , TTSP_VOICE_TYPE_FEMALE },
+ { _pszPTPortuguese , _sszPTPortuguese , TTSP_VOICE_TYPE_MALE },
+ { _pszMXSpanish , _sszMXSpanish , TTSP_VOICE_TYPE_FEMALE },
+ { _pszMXSpanish , _sszMXSpanish , TTSP_VOICE_TYPE_MALE },
+
+ { _pszGreek , _sszGreek , TTSP_VOICE_TYPE_FEMALE },
+ { _pszTWChinese , _sszTWChinese , TTSP_VOICE_TYPE_FEMALE },
+ { _pszNorwegian , _sszNorwegian , TTSP_VOICE_TYPE_FEMALE },
+ { _pszHKChinese , _sszHKChinese , TTSP_VOICE_TYPE_FEMALE },
+ { _pszHKChinese , _sszHKChinese , TTSP_VOICE_TYPE_MALE },
+ { _pszPolish , _sszPolish , TTSP_VOICE_TYPE_FEMALE },
+ { _pszHungarian , _sszHungarian , TTSP_VOICE_TYPE_FEMALE },
+ { _pszCzech , _sszCzech , TTSP_VOICE_TYPE_FEMALE },
+ { _pszFinnish , _sszFinnish , TTSP_VOICE_TYPE_FEMALE },
+ { _pszHindi , _sszHindi , TTSP_VOICE_TYPE_FEMALE },
+ { _pszINEnglish , _sszINEnglish , TTSP_VOICE_TYPE_FEMALE },
+ { _pszSwedish , _sszSwedish , TTSP_VOICE_TYPE_FEMALE },
+ { _pszDanish , _sszDanish , TTSP_VOICE_TYPE_FEMALE },
+ { _pszTurkish , _sszTurkish , TTSP_VOICE_TYPE_FEMALE },
+ { _pszSlovak , _sszSlovak , TTSP_VOICE_TYPE_FEMALE },
+ { _pszDutch , _sszDutch , TTSP_VOICE_TYPE_FEMALE }
};
#define _nVoiceInfos (sizeof(_pVoiceInfos) / sizeof(_pVoiceInfos[0]))
// index of VoiceInfos
-#define VOICE_INDEX_KOREAN_WOMAN 0
-#define VOICE_INDEX_USENGLISH_WOMAN 1
-#define VOICE_INDEX_GERMAN_WOMAN 2
-#define VOICE_INDEX_SPANISH_WOMAN 3
-#define VOICE_INDEX_FRENCH_WOMAN 4
-#define VOICE_INDEX_ITALIAN_WOMAN 5
-
-
-
+#define VOICE_INDEX_KOREAN_WOMAN 0
+#define VOICE_INDEX_KOREAN_MAN 1
+#define VOICE_INDEX_USENGLISH_WOMAN 2
+#define VOICE_INDEX_USENGLISH_MAN 3
+#define VOICE_INDEX_CHINESE_WOMAN 4
+#define VOICE_INDEX_CHINESE_MAN 5
+#define VOICE_INDEX_UKENGLISH_WOMAN 6
+#define VOICE_INDEX_UKENGLISH_MAN 7
+#define VOICE_INDEX_GERMAN_WOMAN 8
+#define VOICE_INDEX_GERMAN_MAN 9
+#define VOICE_INDEX_SPANISH_WOMAN 10
+#define VOICE_INDEX_SPANISH_MAN 11
+#define VOICE_INDEX_FRENCH_WOMAN 12
+#define VOICE_INDEX_FRENCH_MAN 13
+#define VOICE_INDEX_ITALIAN_WOMAN 14
+#define VOICE_INDEX_ITALIAN_MAN 15
+#define VOICE_INDEX_RUSSIAN_WOMAN 16
+#define VOICE_INDEX_JAPANESE_WOMAN 17
+#define VOICE_INDEX_JAPANESE_MAN 18
+#define VOICE_INDEX_BRPORTUGUESE_WOMAN 19
+#define VOICE_INDEX_BRPORTUGUESE_MAN 20
+#define VOICE_INDEX_PTPORTUGUESE_WOMAN 21
+#define VOICE_INDEX_PTPORTUGUESE_MAN 22
+#define VOICE_INDEX_MXSPANISH_WOMAN 23
+#define VOICE_INDEX_MXSPANISH_MAN 24
+
+#define VOICE_INDEX_GREEK_WOMAN 25
+#define VOICE_INDEX_TWCHINESE_WOMAN 26
+#define VOICE_INDEX_NORWEGIAN_WOMAN 27
+#define VOICE_INDEX_HKCHINESE_WOMAN 28
+#define VOICE_INDEX_HKCHINESE_MAN 29
+#define VOICE_INDEX_POLISH_WOMAN 30
+#define VOICE_INDEX_HUNGARIAN_WOMAN 31
+#define VOICE_INDEX_CZECH_WOMAN 32
+#define VOICE_INDEX_FINNISH_WOMAN 33
+#define VOICE_INDEX_HINDI_WOMAN 34
+#define VOICE_INDEX_INENGLISH_WOMAN 35
+#define VOICE_INDEX_SWEDISH_WOMAN 36
+#define VOICE_INDEX_DANISH_WOMAN 37
+#define VOICE_INDEX_TURKISH_WOMAN 38
+#define VOICE_INDEX_SLOVAK_WOMAN 39
+#define VOICE_INDEX_DUTCH_WOMAN 40
+
+#define VOICE_INDEX_MAX VOICE_INDEX_DUTCH_WOMAN
+
+#define DATA_DIR1 tzplatform_mkpath(TZ_SYS_RO_SHARE, "/voice/tts/smt_vdata/")
+
+//static const char* DATA_DIR2 = app_get_data_path();
+#define DATA_DIR2 tzplatform_mkpath(TZ_USER_HOME, "/share/.voice/tts/engine-info/")
+
+static ttspe_voice_info_s * _gpVoiceInfos = NULL;
typedef struct _TypeThreadQueueNode TypeThreadQueueNode;
struct _TypeThreadQueueNode
static void _CallBack (ttsp_result_event_e eEvent, unsigned int const nPCMs, void * pPCMs, void* pUserParam);
static int _Synthesize_SamsungTTS(char const * const pszTextUtf8, void* pUserParam, int const FramePeriod);
-
-
-
-char const * SLPSMT_GetPszKorean (void) { return _pszKorean ; }
-char const * SLPSMT_GetPszUSEnglish (void) { return _pszUSEnglish ; }
-
-
+char const * SLPSMT_GetPszKorean (void) { return _pszKorean ; }
+char const * SLPSMT_GetPszUSEnglish (void) { return _pszUSEnglish ; }
+char const * SLPSMT_GetPszChinese (void) { return _pszChinese ; }
+char const * SLPSMT_GetPszUKEnglish (void) { return _pszUKEnglish ; }
char const * SLPSMT_GetPszGerman (void) { return _pszGerman ; }
char const * SLPSMT_GetPszSpanish (void) { return _pszSpanish ; }
char const * SLPSMT_GetPszFrench (void) { return _pszFrench ; }
char const * SLPSMT_GetPszItalian (void) { return _pszItalian ; }
+char const * SLPSMT_GetPszRussian (void) { return _pszRussian ; }
+char const * SLPSMT_GetPszJapanese (void) { return _pszJapanese ; }
+char const * SLPSMT_GetPszBRPortuguese (void) { return _pszBRPortuguese ; }
+char const * SLPSMT_GetPszPTPortuguese (void) { return _pszPTPortuguese ; }
+char const * SLPSMT_GetPszMXSpanish (void) { return _pszMXSpanish ; }
+
+char const * SLPSMT_GetPszGreek(void) { return _pszGreek ;}
+char const * SLPSMT_GetPszTWChinese(void) { return _pszTWChinese ;}
+char const * SLPSMT_GetPszNorwegian(void) { return _pszNorwegian ;}
+char const * SLPSMT_GetPszHKChinese(void) { return _pszHKChinese ;}
+char const * SLPSMT_GetPszPolish(void) { return _pszPolish ;}
+char const * SLPSMT_GetPszHungarian(void) { return _pszHungarian ;}
+char const * SLPSMT_GetPszCzech(void) { return _pszCzech ;}
+char const * SLPSMT_GetPszFinnish(void) { return _pszFinnish ;}
+char const * SLPSMT_GetPszHindi(void) { return _pszHindi ;}
+char const * SLPSMT_GetPszINEnglish(void) { return _pszINEnglish ;}
+char const * SLPSMT_GetPszSwedish(void) { return _pszSwedish ;}
+char const * SLPSMT_GetPszDanish(void) { return _pszDanish ;}
+char const * SLPSMT_GetPszTurkish(void) { return _pszTurkish ;}
+char const * SLPSMT_GetPszSlovak(void) { return _pszSlovak ;}
+char const * SLPSMT_GetPszDutch(void) { return _pszDutch ;}
+
int SLPSMT_GetWorkingThreadId(void) { return _g.ThreadId; }
return TTSP_ERROR_NONE;
}
-
-
-
-
-
-
-ttspe_voice_info_s * _gpVoiceInfos = NULL;
-#define DATA_DIR1 "/usr/share/voice/tts/smt_vdata/"
-
-
+/*
int SLPSMT_GetiVoiceInfoEx(char const *pszLanguage, int const eVoiceType)
{
int i;
}
return -1;
}
+*/
int SLPSMT_SetVoiceList(ttspe_voice_list_s * p)
{
int level = -1;
if (eSpeechSpeed == 0) {
-// level = TTSP_SPEED_NORMAL;
+ // level = TTSP_SPEED_NORMAL;
level = 8;
} else if (eSpeechSpeed >= 1 && eSpeechSpeed <= 3) {
level = 2;
}
_g.pfnCallback = NULL;
-// _g.eSpeechSpeed = TTSP_SPEED_NORMAL;
_g.eSpeechSpeed = 8;
_g.iVoiceInfo = -1;
while(_g.ThreadId != -1){
static int _ChangeVoice(int const iVoiceInfo)
{
- int r;
- bool bSamsungTTS = false;
- bool bSvoxTTS = false;
- char const * pszLanguage = NULL;
- char const * pszContury = NULL;
+ if (iVoiceInfo < 0 || iVoiceInfo > VOICE_INDEX_MAX) {
+ SLOG(LOG_ERROR, TAG_TTSP, "[ERROR] Invalid Voice");
+ return -1;
+ }
- switch (iVoiceInfo)
- {
- case VOICE_INDEX_KOREAN_WOMAN : SMTSet_Language(eKOREAN , 0, 0); break;
- case VOICE_INDEX_USENGLISH_WOMAN : SMTSet_Language(eUSENGLISH , 0, 0); break;
- case VOICE_INDEX_GERMAN_WOMAN : SMTSet_Language(eGERMAN , 0, 0); break;
- case VOICE_INDEX_SPANISH_WOMAN : SMTSet_Language(eSPANISH , 0, 0); break;
- case VOICE_INDEX_FRENCH_WOMAN : SMTSet_Language(eFRENCH , 0, 0); break;
- case VOICE_INDEX_ITALIAN_WOMAN : SMTSet_Language(eITALIAN , 0, 0); break;
-
- default : break; // This case has already been checked.
+ int r;
+
+ char const * pszLanguage = _pVoiceInfos[iVoiceInfo].pszLanguage;
+
+
+ _eTypeTTSMode TTSType = eTTSMode_Normal;
+ char Language[3] = {0,};
+ char Country[3] = {0,};
+ char VoiceType[2] = {0,};
+ int VoiceIndex = 0;
+
+ VoiceType[0] = 'f';
+ VoiceType[1] = 0;
+ memcpy(Language, pszLanguage, sizeof(Language)-1);
+ memcpy(Country, pszLanguage+3, sizeof(Country)-1);
+
+ int const eVoiceType = _pVoiceInfos[iVoiceInfo].eVoiceType;
+
+ if(eVoiceType == TTSP_VOICE_TYPE_MALE) VoiceType[0] = 'm';
+
+ char filepath[512] = {'\0',};
+ if (VOICE_INDEX_KOREAN_WOMAN == iVoiceInfo || VOICE_INDEX_USENGLISH_WOMAN == iVoiceInfo
+ || VOICE_INDEX_GERMAN_WOMAN == iVoiceInfo || VOICE_INDEX_SPANISH_WOMAN == iVoiceInfo
+ || VOICE_INDEX_FRENCH_WOMAN == iVoiceInfo || VOICE_INDEX_ITALIAN_WOMAN == iVoiceInfo) {
+ snprintf(filepath, 512, "%s", DATA_DIR1);
+ } else {
+ snprintf(filepath, 512, "%s%s_%s/", DATA_DIR2, pszLanguage, (TTSP_VOICE_TYPE_MALE == eVoiceType) ? "Male" : "Female");
+ }
+
+ SLOG(LOG_DEBUG, TAG_TTSP, "data path (%s)", filepath);
+
+ if (VOICE_INDEX_KOREAN_MAN == iVoiceInfo) {
+ VoiceIndex = 1;
+ }
+
+ if (0 == SMTCheckVoiceAvailable(TTSType, filepath, '/', Language, Country, VoiceType, VoiceIndex)) {
+ if (0 != SMTSetVoice(TTSType, filepath, '/', Language, Country, VoiceType, VoiceIndex)) {
+ SLOG(LOG_ERROR, TAG_TTSP, "[ERROR] Fail to set voice");
+ return -1;
+ }
+ } else {
+ SLOG(LOG_ERROR, TAG_TTSP, "[ERROR] Fail to check voice available");
+ return -1;
}
_g.iVoiceInfo = iVoiceInfo;
case 11 : SMTSetSpeechSpeed(eSMTSpeechSpeed_Fast ); break;
case 5 : SMTSetSpeechSpeed(eSMTSpeechSpeed_Slow ); break;
case 2 : SMTSetSpeechSpeed(eSMTSpeechSpeed_VerySlow); break;
-// case TTSP_SPEED_NORMAL : SMTSetSpeechSpeed(eSMTSpeechSpeed_Normal ); break;
+ // case TTSP_SPEED_NORMAL : SMTSetSpeechSpeed(eSMTSpeechSpeed_Normal ); break;
case 8 : SMTSetSpeechSpeed(eSMTSpeechSpeed_Normal ); break;
}
}
/*
* Samsung TTS
- * Copyright 2012-2014 Samsung Electronics Co., Ltd
+ * Copyright 2012-2016 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the License);
* you may not use this file except in compliance with the License.
#define __SLP_SMT_APIS_H__
#include <ttsp.h>
+#include <tzplatform_config.h>
#include "plugin_internal.h"
int SLPSMT_Initialize (ttspe_result_cb const pfnCallBack);
/*
* Samsung TTS
- * Copyright 2012-2014 Samsung Electronics Co., Ltd
+ * Copyright 2012-2016 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the License);
* you may not use this file except in compliance with the License.
#include <string.h>
#include "plugin_internal.h"
#include "_SlpSmtApis.h"
-
+#include <string>
+#include <libxml/parser.h>
+#include <glib.h>
+#include <unistd.h>
+#include <tzplatform_config.h>
+
+#define TTSSMT_INFO_XML_PATH tzplatform_mkpath(TZ_USER_HOME, "/share/.voice/tts/engine-info/ttssmt-info.xml")
+
+#define TTSSMT_INFO_TAG_TTS_ENGINE "tts-engine"
+#define TTSSMT_INFO_TAG_NAME "name"
+#define TTSSMT_INFO_TAG_ID "id"
+#define TTSSMT_INFO_TAG_SETTING "setting"
+#define TTSSMT_INFO_TAG_VOICES "voices"
+#define TTSSMT_INFO_TAG_VOICE "voice"
+#define TTSSMT_INFO_TAG_VOICE_TYPE "type"
+#define TTSSMT_INFO_TAG_VOICE_TYPE_FEMALE "female"
+#define TTSSMT_INFO_TAG_VOICE_TYPE_MALE "male"
+#define TTSSMT_INFO_TAG_VOICE_TYPE_CHILD "child"
+
+using namespace std;
// Once eigine was initialize, that means gpDaemonAPIs and its members are not NULL.
// So we do not need to check whether this is NULL, nor its members are NULL.
static ttspd_funcs_s const * gpDaemonAPIs = NULL;
+static std::string g_current_lang;
+
+GSList* g_ttsinfo_list = NULL;
+
+static int _plugin_get_language_info(void);
+static int _plugin_free_language_info(void);
+static void _plugin_parse_tts_config(void);
int plugin_Initialize(ttspe_result_cb const pfnCallBack)
{
int r = SLPSMT_Initialize(pfnCallBack);
SLOG(LOG_DEBUG, TAG_TTSP, ">>>plugin Initialize() returns %d.", r);
+ _plugin_get_language_info();
return r;
}
{
int r = SLPSMT_Finalize();
SLOG(LOG_DEBUG, TAG_TTSP, ">>>plugin Initialize() returns %d.", r);
+ _plugin_free_language_info();
return r;
}
SLPSMT_SetSpeechSpeed(eSpeechSpeed);
// set voice
- iVoiceInfo = SLPSMT_GetiVoiceInfoEx(pszLanguage, eVoiceType);
+ iVoiceInfo = SLPSMT_GetiVoiceInfo(pszLanguage, eVoiceType);
if (iVoiceInfo < 0)
{
SLOG(LOG_ERROR, TAG_TTSP, "iVoiceInfo < 0");
if(NULL == callback)
return TTSP_ERROR_INVALID_PARAMETER;
- ttspe_voice_list_s pVoiceList;
- SLPSMT_SetVoiceList(&pVoiceList);
- int i = 0;
+ if(!g_ttsinfo_list){
+ return -1;
+ }
- ttspe_voice_info_s* temp = pVoiceList.voice_info;
+ GSList* iter;
- for(i=0 ; i < pVoiceList.size; i++)
- {
- if (false == callback(temp[i].lang, temp[i].vctype, user_data))
+ for (iter = g_ttsinfo_list; iter != NULL; iter = g_slist_next(iter)) {
+ ttspe_voice_info_s *lang_info = (ttspe_voice_info_s*)iter->data;
+ if (NULL == lang_info)
+ continue;
+ if (NULL == lang_info->lang)
+ continue;
+
+ char* lang = strdup(lang_info->lang);
+ int vctype = lang_info->vctype;
+
+ SLOG(LOG_DEBUG, TAG_TTSP, "[ %s, %d ]", lang, vctype);
+
+ if (false == callback(lang, vctype, user_data))
{
SLOG(LOG_ERROR, TAG_TTSP, ">> plugin_ForeachVoices(), callback fail!!");
+ if (lang)
+ free(lang);
break;
}
+
+ if(lang)
+ free(lang);
}
return TTSP_ERROR_NONE;
bool plugin_IsValidVoice(const char* language, int type)
{
if (NULL == language)
- return TTSP_ERROR_INVALID_PARAMETER;
-
- int iVoiceInfo = SLPSMT_GetiVoiceInfoEx((char* )language, type);
+ return false;
- if (iVoiceInfo < 0)
- {
- SLOG(LOG_ERROR, TAG_TTSP, "iVoiceInfo < 0");
+ if(!g_ttsinfo_list){
+ SLOG(LOG_ERROR, TAG_TTSP, "ttsinfo is NULL");
return false;
}
- return true;
+
+ GSList* iter;
+
+ for (iter = g_ttsinfo_list; iter != NULL; iter = g_slist_next(iter)) {
+ ttspe_voice_info_s *lang_info = (ttspe_voice_info_s*)iter->data;
+ if (NULL == lang_info)
+ continue;
+ if (NULL == lang_info->lang)
+ continue;
+
+ if(!strcmp(lang_info->lang, language) && type == lang_info->vctype){
+ SLOG(LOG_DEBUG, TAG_TTSP, "[ %s, %d ] IS VALID", lang_info->lang, lang_info->vctype);
+ return true;
+ }
+ }
+
+ SLOG(LOG_DEBUG, TAG_TTSP, "[ %s, %d ] NOT EXIST", language, type);
+ return false;
}
int plugin_LoadVoice(const char* language, int type)
printf("[SMT] Pitch range : min(%d) normal(%d) max(%d)\n", min, normal, max);
}
+static void _plugin_parse_tts_config(void)
+{
+ xmlDocPtr doc = NULL;
+ xmlNodePtr cur = NULL;
+ xmlChar *key;
+
+ SLOG(LOG_DEBUG, TAG_TTSP, "tts xml path (%s)", TTSSMT_INFO_XML_PATH);
+
+ doc = xmlParseFile(TTSSMT_INFO_XML_PATH);
+ if (doc == NULL) {
+ SLOG(LOG_ERROR, TAG_TTSP, " Fail to parse file error : %s", TTSSMT_INFO_XML_PATH);
+ return ;
+ }
+
+ cur = xmlDocGetRootElement(doc);
+ if (cur == NULL) {
+ SLOG(LOG_ERROR, TAG_TTSP, "Empty document");
+ xmlFreeDoc(doc);
+ return ;
+ }
+
+ if (xmlStrcmp(cur->name, (const xmlChar *) TTSSMT_INFO_TAG_TTS_ENGINE)) {
+ SLOG(LOG_ERROR, TAG_TTSP, "The wrong type, root node is NOT %s", TTSSMT_INFO_TAG_TTS_ENGINE);
+ xmlFreeDoc(doc);
+ return ;
+ }
+
+ cur = cur->xmlChildrenNode;
+ if (cur == NULL) {
+ SLOG(LOG_ERROR, TAG_TTSP, "<tts-engine> child NULL");
+ xmlFreeDoc(doc);
+ return ;
+ }
+
+ while (cur != NULL) {
+ if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTSSMT_INFO_TAG_NAME)) {
+ key = xmlNodeGetContent(cur);
+ if (NULL != key) {
+ SLOG(LOG_DEBUG, TAG_TTSP, "<name>%s</name>", (char *)key);
+ xmlFree(key);
+ } else {
+ SLOG(LOG_ERROR, TAG_TTSP, "setting path is NULL");
+ }
+ } else if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTSSMT_INFO_TAG_ID)) {
+ key = xmlNodeGetContent(cur);
+ if (NULL != key) {
+ SLOG(LOG_DEBUG, TAG_TTSP, "<id>%s<id>", (char *)key);
+ xmlFree(key);
+ } else {
+ SLOG(LOG_ERROR, TAG_TTSP, "setting path is NULL");
+ }
+ } else if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTSSMT_INFO_TAG_SETTING)) {
+ key = xmlNodeGetContent(cur);
+ if (NULL != key) {
+ SLOG(LOG_DEBUG, TAG_TTSP, "<setting>%s</setting>", (char *)key);
+ xmlFree(key);
+ } else {
+ SLOG(LOG_ERROR, TAG_TTSP, "setting path is NULL");
+ }
+ } else if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTSSMT_INFO_TAG_VOICES)) {
+
+ SLOG(LOG_DEBUG, TAG_TTSP, "<voices>");
+ xmlNodePtr voice_node = NULL;
+ voice_node = cur->xmlChildrenNode;
+
+ xmlChar *attr = NULL;
+
+ while (NULL != voice_node) {
+ if (0 == xmlStrcmp(voice_node->name, (const xmlChar *)TTSSMT_INFO_TAG_VOICE)) {
+
+ char current_language[16] = {0, };
+ int current_voicetype = -1;
+
+ attr = xmlGetProp(voice_node, (const xmlChar*)TTSSMT_INFO_TAG_VOICE_TYPE);
+ if (NULL != attr) {
+ if (0 == xmlStrcmp(attr, (const xmlChar *)TTSSMT_INFO_TAG_VOICE_TYPE_FEMALE)) {
+ key = xmlNodeGetContent(voice_node);
+ if (NULL != key) {
+ SLOG(LOG_DEBUG, TAG_TTSP, "<voice type=%s>", key);
+ }
+
+ current_voicetype = TTSP_VOICE_TYPE_FEMALE;
+ } else if (0 == xmlStrcmp(attr, (const xmlChar *)TTSSMT_INFO_TAG_VOICE_TYPE_MALE)) {
+ key = xmlNodeGetContent(voice_node);
+ if (NULL != key) {
+ SLOG(LOG_DEBUG, TAG_TTSP, "<voice type=%s>", key);
+ }
+ current_voicetype = TTSP_VOICE_TYPE_MALE;
+ } else if (0 == xmlStrcmp(attr, (const xmlChar *)TTSSMT_INFO_TAG_VOICE_TYPE_CHILD)) {
+ key = xmlNodeGetContent(voice_node);
+ if (NULL != key) {
+ SLOG(LOG_DEBUG, TAG_TTSP, "<voice type=%s>", key);
+ }
+ current_voicetype = TTSP_VOICE_TYPE_CHILD;
+ } else {
+ SLOG(LOG_DEBUG, TAG_TTSP, "user defined voice type");
+ // fallback
+ current_voicetype = TTSP_VOICE_TYPE_FEMALE;
+ }
+
+ xmlFree(attr);
+ } else {
+ SLOG(LOG_DEBUG, TAG_TTSP, "<%s> has no content", TTSSMT_INFO_TAG_VOICE_TYPE);
+ }
+
+ key = xmlNodeGetContent(voice_node);
+ if (NULL != key) {
+ strncpy(current_language, (char*)key, strlen((char*)key));
+ xmlFree(key);
+ } else {
+ SLOG(LOG_DEBUG, TAG_TTSP, "<%s> has no content", TTSSMT_INFO_TAG_VOICE);
+ }
+
+ ttspe_voice_info_s *lang_info = (ttspe_voice_info_s*)malloc(sizeof(ttspe_voice_info_s));
+ if (NULL == lang_info) {
+ SLOG(LOG_ERROR, TAG_TTSP, "[ERROR] Fail to memory allocation");
+ xmlFreeDoc(doc);
+ return;
+ }
+ if(!strcmp(current_language, "no-NO")){
+ lang_info->lang = strdup("nb-NO");
+ } else if(!strcmp(current_language, "no_NO")){
+ lang_info->lang = strdup("nb_NO");
+ } else {
+ lang_info->lang = strdup(current_language);
+ }
+ lang_info->vctype = current_voicetype;
+
+ SLOG(LOG_DEBUG, TAG_TTSP, "Language (%s) Voicetype (%d)", lang_info->lang, lang_info->vctype);
+
+ g_ttsinfo_list = g_slist_append(g_ttsinfo_list, lang_info);
+ }
+
+ voice_node = voice_node->next;
+ }
+
+ } else {
+ SLOG(LOG_DEBUG, TAG_TTSP, "[WARNING] unknown tag (%s)", (const char*)cur->name );
+ }
+
+ cur = cur->next;
+ }
+
+ xmlFreeDoc(doc);
+}
+
+
+static int _plugin_get_language_info(void)
+{
+ _plugin_parse_tts_config();
+ return 0;
+}
+
+static int _plugin_free_language_info()
+{
+ if(!g_ttsinfo_list){
+ return -1;
+ }
+
+ GSList* iter;
+
+ for (iter = g_ttsinfo_list; iter != NULL; iter = g_slist_next(iter)) {
+ ttspe_voice_info_s *lang_info = (ttspe_voice_info_s*)iter->data;
+ if(lang_info) {
+ if(lang_info->lang)
+ free(lang_info->lang);
+
+ free(lang_info);
+ }
+ }
+
+ g_slist_free(g_ttsinfo_list);
+ g_ttsinfo_list = NULL;
+
+ return 0;
+}
+
/*
* Samsung TTS
- * Copyright 2012-2014 Samsung Electronics Co., Ltd
+ * Copyright 2012-2016 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the License);
* you may not use this file except in compliance with the License.
#define ENGINE_UUID "27F277E9-BBC4-4dca-B553-D9884A3CDAA0"
#define ENGINE_NAME "Samsung TTS"
-#define ENGINE_UG_NAME "tts_smt_setting_ug.so"
+#define ENGINE_UG_NAME "org.tizen.ttssmt-setting"
#define VTTS_VOICE_NAME_BUF_SIZE 8
/*
* Samsung TTS
- * Copyright 2012-2014 Samsung Electronics Co., Ltd
+ * Copyright 2012-2016 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.1 (the License);
* you may not use this file except in compliance with the License.
<tts-engine>
<name>Samsung TTS</name>
<id>27F277E9-BBC4-4dca-B553-D9884A3CDAA0</id>
- <setting>/usr/ug/ug-tts-setting-smt.so</setting>
+ <setting>org.tizen.ttssmt-setting</setting>
<voices>
<voice type="female">en_US</voice>
<voice type="female">ko_KR</voice>