--- /dev/null
+Wonyoung Lee <wy1115.lee@samsung.com>
+Sungchan Kim <sungchan81.kim@samsung.com>
+Samsung Multimedia R&D Group
+
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(ttssmt)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "${PREFIX}")
+SET(LIBDIR "${PREFIX}/lib/voice/tts/1.0/engine")
+SET(USRLIBDIR "${PREFIX}/lib")
+SET(INCLUDEDIR "${PREFIX}/include")
+SET(INCLUDEDIRGLIB "${PREFIX}/include/glib-2.0")
+SET(INCLUDEDIRLIB "${PREFIX}/lib/glib-2.0/include")
+SET(LIBRARY_NAME "smt")
+SET(VERSION 0.0.1)
+
+SET(SRCS
+ src/ttsp.c
+ src/plugin_internal.cpp
+ src/_SlpSmtApis.cpp
+ )
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
+INCLUDE_DIRECTORIES(${INCLUDEDIR})
+INCLUDE_DIRECTORIES(${INCLUDEDIRLIB})
+INCLUDE_DIRECTORIES(${INCLUDEDIRGLIB})
+
+## Dependent packages ##
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED
+ glib-2.0
+ tts
+)
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+###########################
+# DEFINITION TTS FEATURES #
+###########################
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DSLP" )
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DCOMPILE_FEATURE_TTS_SLIM")
+#SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -D__FIXED_C" )
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DKOREAN" )
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DUSENGLISH" )
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DCHINESE" )
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -DDICTIONARY" )
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC" )
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_C_FLAGS_DEBUG "-O0")
+#SET(CMAKE_C_FLAGS_RELEASE "-O2")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wall,--as-needed")
+
+###########################
+# COMPILE AS RELEASE MODE #
+###########################
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+
+#ADD_LIBRARY(${LIBRARY_NAME} STATIC ${LIB_SRCS})
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS} )
+
+#SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
+FIND_PROGRAM(UNAME NAMES uname)
+EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
+IF("${ARCH}" MATCHES "^arm.*")
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} -Llib/arm -lsmt ${pkgs_LDFLAGS})
+INSTALL(FILES lib/arm/libsmt.so DESTINATION ${USRLIBDIR})
+ELSE("${ARCH}" MATCHES "^arm.*")
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} -Llib/i386 -lsmt ${pkgs_LDFLAGS})
+INSTALL(FILES lib/i386/libsmt.so DESTINATION ${USRLIBDIR})
+ENDIF("${ARCH}" MATCHES "^arm.*")
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR} COMPONENT RuntimeLibraries)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/vdata/ DESTINATION /usr/share/voice/tts/smt_vdata)
--- /dev/null
+Flora License
+
+Version 1.0, May, 2012
+
+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 Compatibility Definition Document
+and passes the Compatibility Test Suite 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.
+
+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.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://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) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Flora License, Version 1.
+Please, see the LICENSE file for Flora License terms and conditions.
+
--- /dev/null
+<manifest>
+ <define>
+ <domain name="tts-engine-samsung"/>
+ <provide>
+ <label name="tts-engine-samsung::vdata"/>
+ </provide>
+ </define>
+ <request>
+ <domain name="_" />
+ </request>
+ <assign>
+ <filesystem path="/usr/share/voice/tts/smt_vdata" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_de_DE.dic" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_de_DE_f01.am" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_de_DE_f01.cfg" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_de_DE_f01.dt" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_de_DE_f01.qs" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_en_GB_f01.am" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_en_GB_f01.cfg" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_en_GB_f01.dt" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_en_GB_f01.qs" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_en_GB.lng" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_en_US_f01.am" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_en_US_f01.cfg" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_en_US_f01.dt" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_en_US_f01.qs" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_en_US.lng" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_en_US.pos" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_es_ES.dic" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_es_ES_f01.am" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_es_ES_f01.cfg" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_es_ES_f01.dt" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_es_ES_f01.qs" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_fr_FR.dic" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_fr_FR_f01.am" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_fr_FR_f01.cfg" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_fr_FR_f01.dt" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_fr_FR_f01.qs" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_it_IT_f01.am" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_it_IT_f01.cfg" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_it_IT_f01.dt" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_it_IT_f01.qs" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_it_IT.lng" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_ko_KR_f01.am" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_ko_KR_f01.cfg" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_ko_KR_f01.dt" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_ko_KR_f01.qs" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_ko_KR_f02.am" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_ko_KR_f02.cfg" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_ko_KR_f02.dt" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_ko_KR_f02.qs" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_ko_KR.lng" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_zh_CN.cart" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_zh_CN_f01.am" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_zh_CN_f01.cfg" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_zh_CN_f01.dt" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_zh_CN_f01.qs" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_zh_CN.pb" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_en_US_dict.lng" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_en_US_dict_f01.am" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_en_US_dict_f01.cfg" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_en_US_dict_f01.dt" label="tts-engine-samsung::vdata"/>
+ <filesystem path="/usr/share/voice/tts/smt_vdata/smt_en_US_dict_f01.qs" label="tts-engine-samsung::vdata"/>
+ </assign>
+</manifest>
--- /dev/null
+#sbs-git:slp/pkgs/l/libttssmt libttssmt 0.0.15 9c82c715d55cf32bb3d69112526145654ec2fbcc
+%define _optdir /opt
+%define _appdir %{_optdir}/apps
+
+
+
+Name: libttssmt
+Summary: Text To Speech smt plugin shared library
+Version: 0.0.28
+Release: 1
+Group: TO_BE/FILLED_IN
+License: TO_BE/FILLED_IN
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(tts)
+
+provides : libsmt.so
+
+%description
+Description: Text To Speech smt plugin shared library
+
+
+%prep
+%setup -q
+
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+
+%build
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%files
+%manifest libttssmt.manifest
+%defattr(-,root,root,-)
+%{_libdir}/voice/tts/1.0/engine/*
+/usr/share/voice/tts/smt_vdata/*
+%{_libdir}/libsmt.so*
--- /dev/null
+/*\r
+ * Samsung TTS\r
+ * Copyright 2012 Samsung Electronics Co., Ltd\r
+ *\r
+ * Licensed under the Flora License, Version 1.0 (the License);\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://floralicense.org/license/\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an AS IS BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#ifndef _SMTAPIS_H_\r
+#define _SMTAPIS_H_\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+\r
+typedef enum _eTypeLanguage\r
+{\r
+ eLANGUAGE_BEGIN = 0x00000000,\r
+\r
+ eKOREAN = eLANGUAGE_BEGIN, // Çѱ¹¾î\r
+\r
+ eUSENGLISH = 0x00000100, // ¹Ì±¹¿µ¾î\r
+ eUSENGLISH_OLD = 0x0000010F,\r
+ eGBENGLISH = 0x00000110, // ¿µ±¹¿µ¾î\r
+ eGBENGLISH_OLD = 0x0000011F,\r
+ eINENGLISH = 0x00000120, // Àεµ¿µ¾î\r
+\r
+ eCHINESE = 0x00000200, // Áß±¹¾î(ºÏ°æ¾î)\r
+ eTAIWANESE = 0x00000210, // ´ë¸¸¾î\r
+ eCANTONESE = 0x00000220, // ±¤µ¿¾î(È«Äá¾î)\r
+\r
+ eGERMAN = 0x00000300, // µ¶ÀϾî\r
+ eGERMAN_OLD = 0x0000030F,\r
+ eSPANISH = 0x00000400, // ½ºÆäÀξî\r
+ eSPANISH_OLD = 0x0000040F,\r
+ eFRENCH = 0x00000500, // ÇÁ¶û½º¾î\r
+ eFRENCH_OLD = 0x0000050F,\r
+ eITALIAN = 0x00000600, // ÀÌÅ»¸®¾Æ¾î\r
+ eITALIAN_OLD = 0x0000060F,\r
+ eDUTCH = 0x00000700, // ³×´ú¶õµå¾î\r
+ ePORTUGUESE = 0x00000800, // Æ÷¸£ÅõÄ®¾î\r
+ eGREEK = 0x00000900, // ±×¸®½º¾î\r
+ eTURKISH = 0x00000A00, // ÅÍÅ°¾î\r
+\r
+ eRUSSIAN = 0x00000B00, // ·¯½Ã¾Æ¾î\r
+\r
+ eJAPANESE = 0x00000C00, // ÀϺ»¾î\r
+ eJAPANESE_OLD = 0x00000C0F,\r
+\r
+ ///////////////////////////////////////////\r
+ eDICTIONARY_USENGLISH = 0x10000100, // ¿µ¾î»çÀü\r
+\r
+ eLANGUAGE_END,\r
+ eLANGUAGE_INVALID = eLANGUAGE_END,\r
+} eTypeLanguage;\r
+\r
+\r
+#define SMT_SUCCESS 0\r
+#define SMT_SYNTHESIS_FRAME_GENERATED 0\r
+#define SMT_SYNTHESIS_ALL_DONE 1\r
+#define SMT_SYNTHESIS_SENTENCE_DONE 2\r
+#define SMT_SYNTHESIS_PAUSE_DONE 3\r
+\r
+int SMTInitialize(void);\r
+int SMTFinalize(void);\r
+int SMTSet_Language(eTypeLanguage eLanguage, int VoiceType, int ModelFileLocation);\r
+int SMTInputText(char const * const pszText_UTF8);\r
+int SMTSynthesize(short * const pPcmBuffer);\r
+\r
+int SMTGetFramePeriod (void);\r
+\r
+\r
+typedef enum\r
+{\r
+ eSMTSpeechSpeed_VerySlow,\r
+ eSMTSpeechSpeed_Slow,\r
+ eSMTSpeechSpeed_Normal,\r
+ eSMTSpeechSpeed_Fast,\r
+ eSMTSpeechSpeed_VeryFast,\r
+} etypeSpeechSpeed;\r
+\r
+void SMTSetSpeechSpeed(etypeSpeechSpeed const speed);\r
+\r
+int SMTSaveWave(char* pszFileName, short* pOutData, int const nDataSize);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif //_SMTAPIS_H_\r
+\r
+\r
--- /dev/null
+/*\r
+ * Samsung TTS\r
+ * Copyright 2012 Samsung Electronics Co., Ltd\r
+ *\r
+ * Licensed under the Flora License, Version 1.0 (the License);\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://floralicense.org/license/\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an AS IS BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "SMTApis.h"\r
+\r
+#include "_SlpSmtApis.h"\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+\r
+#include <pthread.h>\r
+\r
+\r
+\r
+\r
+#define PCM_BUFFER_SIZE 640000\r
+\r
+// Not supported yet {\r
+#define TTSPE_LANG_CANTONESE "zh_HK"\r
+#define TTSPE_LANG_TAIWAN "zh_TW"\r
+#define TTSPE_LANG_RUSSIAN "ru_RU"\r
+#define TTSPE_LANG_JAPANESE "ja_JP"\r
+#define TTSPE_LANG_NETHERLANDS "nl_NL"\r
+#define TTSPE_LANG_PORTUGUESE "pt_PT"\r
+#define TTSPE_LANG_GREEK "el_GR"\r
+#define TTSPE_LANG_TURKEY "tr_TR"\r
+// Not supported yet }\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+typedef struct __TypeVoiceInfo _TypeVoiceInfo;\r
+struct __TypeVoiceInfo\r
+{\r
+ char const * const pszLanguage;\r
+ unsigned int const sszLanguage;\r
+ ttsp_voice_type_e const eVoiceType;\r
+\r
+};\r
+\r
+\r
+static char const _pszKorean [] = "ko_KR";\r
+static char const _pszUSEnglish [] = "en_US";\r
+static char const _pszChinese [] = "zh_CN";\r
+\r
+\r
+static char const _pszUKEnglish [] = "en_GB";\r
+static char const _pszGerman [] = "de_DE";\r
+static char const _pszSpanish [] = "es_ES";\r
+static char const _pszFrench [] = "fr_FR";\r
+static char const _pszItalian [] = "it_IT";\r
+\r
+static unsigned int const _sszKorean = sizeof(_pszKorean);\r
+static unsigned int const _sszUSEnglish = sizeof(_pszUSEnglish);\r
+static unsigned int const _sszChinese = sizeof(_pszChinese);\r
+static unsigned int const _sszUKEnglish = sizeof(_pszUKEnglish);\r
+static unsigned int const _sszGerman = sizeof(_pszGerman);\r
+static unsigned int const _sszSpanish = sizeof(_pszSpanish);\r
+static unsigned int const _sszFrench = sizeof(_pszFrench);\r
+static unsigned int const _sszItalian = sizeof(_pszItalian);\r
+\r
+\r
+static const _TypeVoiceInfo _pVoiceInfos[] =\r
+{\r
+ { _pszKorean , _sszKorean , TTSP_VOICE_TYPE_FEMALE },\r
+ { _pszUSEnglish , _sszUSEnglish , TTSP_VOICE_TYPE_FEMALE },\r
+ { _pszChinese , _sszChinese , TTSP_VOICE_TYPE_FEMALE },\r
+\r
+ { _pszUKEnglish , _sszUKEnglish , TTSP_VOICE_TYPE_FEMALE },\r
+ { _pszGerman , _sszGerman , TTSP_VOICE_TYPE_FEMALE },\r
+ { _pszSpanish , _sszSpanish , TTSP_VOICE_TYPE_FEMALE },\r
+ { _pszFrench , _sszFrench , TTSP_VOICE_TYPE_FEMALE },\r
+ { _pszItalian , _sszItalian , TTSP_VOICE_TYPE_FEMALE },\r
+};\r
+\r
+#define _nVoiceInfos (sizeof(_pVoiceInfos) / sizeof(_pVoiceInfos[0]))\r
+\r
+// index of VoiceInfos\r
+#define VOICE_INDEX_KOREAN_WOMAN 0\r
+#define VOICE_INDEX_USENGLISH_WOMAN 1\r
+#define VOICE_INDEX_CHINESE_WOMAN 2\r
+#define VOICE_INDEX_UKENGLISH_WOMAN 3\r
+#define VOICE_INDEX_GERMAN_WOMAN 4\r
+#define VOICE_INDEX_SPANISH_WOMAN 5\r
+#define VOICE_INDEX_FRENCH_WOMAN 6\r
+#define VOICE_INDEX_ITALIAN_WOMAN 7\r
+\r
+\r
+\r
+\r
+typedef struct _TypeThreadQueueNode TypeThreadQueueNode;\r
+struct _TypeThreadQueueNode\r
+{\r
+ int iVoiceInfo;\r
+ char * pszTextUtf8;\r
+ void * pUserParam;\r
+ TypeThreadQueueNode * pNext;\r
+};\r
+\r
+static struct _global\r
+{\r
+ ttspe_result_cb pfnCallback;\r
+ ttsp_speed_e eSpeechSpeed;\r
+ int iVoiceInfo;\r
+ bool bStop;\r
+ bool bSentenceDone;\r
+\r
+ // thread\r
+ int ThreadId;\r
+ pthread_t Thread;\r
+ pthread_mutex_t ThreadLock;\r
+ pthread_mutex_t MainThreadFinalizeLock;\r
+ TypeThreadQueueNode* ThreadQueue_pHead;\r
+ TypeThreadQueueNode* ThreadQueue_pTail;\r
+\r
+} _g =\r
+{\r
+ NULL , // pfnCallback\r
+\r
+ TTSP_SPEED_NORMAL , // eSpeechSpeed\r
+ -1 , // iVoiceInfo, initial value means INVALID INDEX\r
+ false , // bStop\r
+ true , // bSentenceDone\r
+\r
+ -1 , // ThreadId\r
+ 0 , // Thread\r
+ PTHREAD_MUTEX_INITIALIZER, // ThreadLock\r
+ PTHREAD_MUTEX_INITIALIZER, // MainThreadFinalizeLock\r
+ NULL , // ThreadQueue_pHead\r
+ NULL , // ThreadQueue_pTail\r
+};\r
+\r
+static void _PushThreadData (int const iVoiceInfo, char const * pszTextUtf8, void* pUserParam);\r
+static TypeThreadQueueNode* _PopThreadData (void);\r
+static bool _bEmptyThreadData(void);\r
+static void _CleanThreadData(void);\r
+static void * _Synthesize (void* NotUsed); // Thread routine\r
+\r
+\r
+static int _ChangeVoice (int const iVoiceInfo);\r
+static void _SetSpeechSpeed (void);\r
+static void _CallBack (ttsp_result_event_e eEvent, unsigned int const nPCMs, void * pPCMs, void* pUserParam);\r
+static int _Synthesize_SamsungTTS(char const * const pszTextUtf8, void* pUserParam, int const FramePeriod);\r
+\r
+\r
+\r
+\r
+char const * SLPSMT_GetPszKorean (void) { return _pszKorean ; }\r
+char const * SLPSMT_GetPszUSEnglish (void) { return _pszUSEnglish ; }\r
+char const * SLPSMT_GetPszChinese (void) { return _pszChinese ; }\r
+char const * SLPSMT_GetPszUKEnglish (void) { return _pszUKEnglish ; }\r
+char const * SLPSMT_GetPszGerman (void) { return _pszGerman ; }\r
+char const * SLPSMT_GetPszSpanish (void) { return _pszSpanish ; }\r
+char const * SLPSMT_GetPszFrench (void) { return _pszFrench ; }\r
+char const * SLPSMT_GetPszItalian (void) { return _pszItalian ; }\r
+\r
+int SLPSMT_GetWorkingThreadId(void) { return _g.ThreadId; }\r
+\r
+\r
+\r
+\r
+int SLPSMT_StopSynthesis(void)\r
+{\r
+ printf(">> SLPSMT_StopSynthesis()\n");\r
+ _g.bStop = true;\r
+ _g.bSentenceDone = true;\r
+ _CleanThreadData();\r
+ return TTSP_ERROR_NONE;\r
+}\r
+\r
+int SLPSMT_SynthesizeText(int const iVoiceInfo, char const * pszTextUtf8, void * const pUserParam)\r
+{\r
+ if (! _g.pfnCallback) { return TTSP_ERROR_INVALID_STATE; }\r
+ if (! pszTextUtf8 || ! *pszTextUtf8) { return TTSP_ERROR_INVALID_PARAMETER; }\r
+\r
+ printf(">> SLPSMT_SynthesizeText()\n");\r
+ printf(">>>> iVoiceInfo : %d\n", iVoiceInfo );\r
+ printf(">>>> pszTextUtf8 : %s\n", pszTextUtf8);\r
+\r
+ _g.bStop = false;\r
+\r
+ _PushThreadData(iVoiceInfo, pszTextUtf8, pUserParam);\r
+\r
+ if (_g.ThreadId < 0)\r
+ {\r
+ _g.ThreadId = pthread_create(& _g.Thread, NULL, _Synthesize, pUserParam);\r
+ if (_g.ThreadId < 0)\r
+ {\r
+ printf(">>> Fail to create thread\n");\r
+ return TTSP_ERROR_OPERATION_FAILED;\r
+ }\r
+ }\r
+ return TTSP_ERROR_NONE;\r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+ttspe_voice_info_s * _gpVoiceInfos = NULL;\r
+\r
+int SLPSMT_SetVoiceList(ttspe_voice_list_s * p)\r
+{\r
+ if (! _gpVoiceInfos)\r
+ {\r
+ unsigned int i;\r
+\r
+ _gpVoiceInfos = (ttspe_voice_info_s*) calloc(_nVoiceInfos, sizeof(ttspe_voice_info_s));\r
+ if (! _gpVoiceInfos) { return TTSP_ERROR_OUT_OF_MEMORY; }\r
+\r
+ for (i=0 ; i<_nVoiceInfos ; i++)\r
+ {\r
+ _gpVoiceInfos[i].lang = strdup(_pVoiceInfos[i].pszLanguage);\r
+ _gpVoiceInfos[i].vctype = _pVoiceInfos[i].eVoiceType ;\r
+ }\r
+ }\r
+ p->voice_info = _gpVoiceInfos;\r
+ p->size = _nVoiceInfos;\r
+ return TTSP_ERROR_NONE;\r
+}\r
+\r
+void SLPSMT_SetSpeechSpeed(ttsp_speed_e const eSpeechSpeed)\r
+{\r
+ switch (eSpeechSpeed)\r
+ {\r
+ case TTSP_SPEED_VERY_FAST :\r
+ case TTSP_SPEED_FAST :\r
+ case TTSP_SPEED_SLOW :\r
+ case TTSP_SPEED_VERY_SLOW :\r
+ case TTSP_SPEED_NORMAL : _g.eSpeechSpeed = eSpeechSpeed; break;\r
+ default : _g.eSpeechSpeed = TTSP_SPEED_NORMAL; break;\r
+ }\r
+}\r
+\r
+int SLPSMT_GetiVoiceInfo(char* const pszLanguage, ttsp_voice_type_e const eVoiceType)\r
+{\r
+ int i;\r
+ for (i=0 ; i<_nVoiceInfos ; i++)\r
+ {\r
+ if ( eVoiceType == _pVoiceInfos[i].eVoiceType\r
+ && ! strcmp(pszLanguage , _pVoiceInfos[i].pszLanguage)\r
+ )\r
+ {\r
+ return i;\r
+ }\r
+ }\r
+ return -1;\r
+}\r
+\r
+int SLPSMT_Initialize(ttspe_result_cb pfnCallBack)\r
+{\r
+ if (pfnCallBack)\r
+ {\r
+ _g.pfnCallback = pfnCallBack;\r
+ return TTSP_ERROR_NONE;\r
+ }\r
+ return TTSP_ERROR_INVALID_STATE;\r
+}\r
+\r
+int SLPSMT_Finalize(void)\r
+{\r
+ printf(">>>> SLPSMT_Finalize() called.\n");\r
+\r
+ _g.bStop = true;\r
+ _CleanThreadData();\r
+\r
+ pthread_mutex_lock (& _g.MainThreadFinalizeLock); // <---- lock\r
+ SMTFinalize();\r
+ pthread_mutex_unlock(& _g.MainThreadFinalizeLock); // <---- unlock\r
+\r
+ if (_gpVoiceInfos)\r
+ {\r
+ unsigned int i;\r
+ for (i=0 ; i<_nVoiceInfos ; i++)\r
+ {\r
+ if (_gpVoiceInfos[i].lang) { free(_gpVoiceInfos[i].lang); }\r
+ }\r
+ free(_gpVoiceInfos);\r
+ }\r
+\r
+ _g.pfnCallback = NULL;\r
+ _g.eSpeechSpeed = TTSP_SPEED_NORMAL;\r
+ _g.iVoiceInfo = -1;\r
+ _g.ThreadId = -1;\r
+\r
+ printf(">>>> SLPSMT_Finalize() returns.\n");\r
+ return TTSP_ERROR_NONE;\r
+}\r
+\r
+\r
+\r
+\r
+static void _PushThreadData(int const iVoiceInfo, char const * pszTextUtf8, void* pUserParam)\r
+// iVoiceInfo should be correct.\r
+// pszTextUtf8 should not be NULL.\r
+{\r
+ bool b = false;\r
+ char * pszDuplicatedTextUtf8;\r
+\r
+ pthread_mutex_lock (& _g.ThreadLock); // <---- lock\r
+\r
+ pszDuplicatedTextUtf8 = strdup(pszTextUtf8);\r
+ if (pszDuplicatedTextUtf8)\r
+ {\r
+ TypeThreadQueueNode* p = (TypeThreadQueueNode*) calloc (1, sizeof(TypeThreadQueueNode));\r
+ if (p)\r
+ {\r
+ p->iVoiceInfo = iVoiceInfo;\r
+ p->pszTextUtf8 = pszDuplicatedTextUtf8;\r
+ p->pUserParam = pUserParam;\r
+ if (! _g.ThreadQueue_pHead) { _g.ThreadQueue_pHead = p; }\r
+ if ( _g.ThreadQueue_pTail) { _g.ThreadQueue_pTail->pNext = p; }\r
+ _g.ThreadQueue_pTail = p;\r
+ b = true;\r
+ }\r
+\r
+ if (! b) { free(pszDuplicatedTextUtf8); }\r
+ }\r
+\r
+ if (! b) { printf(">>>__PushThreadData, out of memory\n"); }\r
+\r
+ pthread_mutex_unlock(& _g.ThreadLock); // <---- unlock\r
+}\r
+\r
+static TypeThreadQueueNode* _PopThreadData(void)\r
+{\r
+ TypeThreadQueueNode* p;\r
+\r
+ pthread_mutex_lock (& _g.ThreadLock); // <---- lock\r
+\r
+ p = _g.ThreadQueue_pHead;\r
+ if (_g.ThreadQueue_pHead) { _g.ThreadQueue_pHead = _g.ThreadQueue_pHead->pNext; }\r
+ if (p == _g.ThreadQueue_pTail) { _g.ThreadQueue_pTail = NULL; }\r
+\r
+ pthread_mutex_unlock(& _g.ThreadLock); // <---- unlock\r
+\r
+ return p;\r
+}\r
+\r
+static bool _bEmptyThreadData(void)\r
+{\r
+ bool b = true;\r
+ pthread_mutex_lock (& _g.ThreadLock); // <---- lock\r
+\r
+ if (_g.ThreadQueue_pHead) { b = false; }\r
+\r
+ pthread_mutex_unlock(& _g.ThreadLock); // <---- unlock\r
+ return b;\r
+}\r
+\r
+\r
+static void _CleanThreadData(void)\r
+{\r
+ pthread_mutex_lock (& _g.ThreadLock); // <---- lock\r
+\r
+ while (_g.ThreadQueue_pHead)\r
+ {\r
+ TypeThreadQueueNode* const p = _g.ThreadQueue_pHead;\r
+ _g.ThreadQueue_pHead = p->pNext;\r
+ free(p->pszTextUtf8);\r
+ free(p);\r
+ }\r
+ _g.ThreadQueue_pHead = NULL;\r
+ _g.ThreadQueue_pTail = NULL;\r
+\r
+ pthread_mutex_unlock(& _g.ThreadLock); // <---- unlock\r
+}\r
+\r
+static void * _Synthesize(void* NotUsed)\r
+{\r
+ unsigned int const FramePeriod = (unsigned int) SMTGetFramePeriod();\r
+ TypeThreadQueueNode* p = _PopThreadData();\r
+\r
+ for ( ; p ; p=_PopThreadData())\r
+ {\r
+ int const iVoiceInfo = p->iVoiceInfo;\r
+ char const * pszTextUtf8 = p->pszTextUtf8;\r
+ void * pUserParam = p->pUserParam;\r
+\r
+ if (_g.pfnCallback)\r
+ {\r
+ int r = SMT_SUCCESS;\r
+\r
+ printf(">>>> Thread, _Synthesize(), iVoiceInfo = %d\n", iVoiceInfo);\r
+ printf(">>>>>> pszTextUtf8 = %s\n", pszTextUtf8);\r
+\r
+ if (iVoiceInfo != _g.iVoiceInfo)\r
+ {\r
+ r = _ChangeVoice(iVoiceInfo);\r
+ printf(">>>>>> iVoiceInfo was changed.\n");\r
+ }\r
+\r
+ if (r == SMT_SUCCESS)\r
+ {\r
+ _SetSpeechSpeed();\r
+\r
+ printf(">>>>>> Set speech-speed\n");\r
+\r
+ pthread_mutex_lock (& _g.MainThreadFinalizeLock); // <---- lock\r
+\r
+ r = _Synthesize_SamsungTTS(pszTextUtf8, pUserParam, FramePeriod);\r
+\r
+ pthread_mutex_unlock(& _g.MainThreadFinalizeLock); // <---- unlock\r
+\r
+ }\r
+ printf(">>>Thread, _Synthesize() done\n");\r
+ }\r
+\r
+ free(p->pszTextUtf8);\r
+ free(p);\r
+ } // end of while loop\r
+\r
+ _g.ThreadId = -1;\r
+ return (void*) 1;\r
+}\r
+\r
+//\r
+// END\r
+//\r
+// functions managing < Thread Queue >\r
+//\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+//\r
+// functions managing < Engine Switching >\r
+//\r
+// BEGIN\r
+//\r
+\r
+static int _ChangeVoice(int const iVoiceInfo)\r
+{\r
+ int r;\r
+ bool bSamsungTTS = false;\r
+ bool bSvoxTTS = false;\r
+ char const * pszLanguage = NULL;\r
+ char const * pszContury = NULL;\r
+\r
+ switch (iVoiceInfo)\r
+ {\r
+ case VOICE_INDEX_KOREAN_WOMAN : SMTSet_Language(eKOREAN , 1, 0); break;\r
+ case VOICE_INDEX_USENGLISH_WOMAN : SMTSet_Language(eUSENGLISH , 1, 0); break;\r
+ case VOICE_INDEX_CHINESE_WOMAN : SMTSet_Language(eCHINESE , 1, 0); break;\r
+\r
+ case VOICE_INDEX_UKENGLISH_WOMAN : SMTSet_Language(eGBENGLISH , 1, 0); break;\r
+ case VOICE_INDEX_GERMAN_WOMAN : SMTSet_Language(eGERMAN , 1, 0); break;\r
+ case VOICE_INDEX_SPANISH_WOMAN : SMTSet_Language(eSPANISH , 1, 0); break;\r
+ case VOICE_INDEX_FRENCH_WOMAN : SMTSet_Language(eFRENCH , 1, 0); break;\r
+ case VOICE_INDEX_ITALIAN_WOMAN : SMTSet_Language(eITALIAN , 1, 0); break;\r
+\r
+ default : break; // This case has already been checked.\r
+ }\r
+\r
+ _g.iVoiceInfo = iVoiceInfo;\r
+\r
+ SMTFinalize();\r
+ r = SMTInitialize();\r
+\r
+ if (r != SMT_SUCCESS) { printf(">>> _ChangeVoice() returns %d.\n", r); }\r
+\r
+ return r;\r
+}\r
+\r
+static void _SetSpeechSpeed(void)\r
+{\r
+ switch (_g.eSpeechSpeed)\r
+ {\r
+ case TTSP_SPEED_VERY_FAST : SMTSetSpeechSpeed(eSMTSpeechSpeed_VeryFast); break;\r
+ case TTSP_SPEED_FAST : SMTSetSpeechSpeed(eSMTSpeechSpeed_Fast ); break;\r
+ case TTSP_SPEED_SLOW : SMTSetSpeechSpeed(eSMTSpeechSpeed_Slow ); break;\r
+ case TTSP_SPEED_VERY_SLOW : SMTSetSpeechSpeed(eSMTSpeechSpeed_VerySlow); break;\r
+ case TTSP_SPEED_NORMAL : SMTSetSpeechSpeed(eSMTSpeechSpeed_Normal ); break;\r
+ }\r
+}\r
+\r
+static void _CallBack(ttsp_result_event_e eEvent, unsigned int const nPCMs, void * pPCMs, void* pUserParam)\r
+{\r
+ unsigned int const n = nPCMs * sizeof(short);\r
+\r
+\r
+ printf(">>> callback, pUserParam = 0x%x\n", (unsigned int) pUserParam);\r
+ printf(">>> callback, event=");\r
+\r
+ switch (eEvent)\r
+ {\r
+ case TTSP_RESULT_EVENT_CONTINUE :\r
+ if (_g.bSentenceDone)\r
+ {\r
+ eEvent = TTSP_RESULT_EVENT_START;\r
+ _g.bSentenceDone = false;\r
+ }\r
+ break;\r
+\r
+ case TTSP_RESULT_EVENT_FINISH :\r
+ _g.bSentenceDone = true;\r
+ break;\r
+ }\r
+\r
+#if 1\r
+ if (nPCMs)\r
+ {\r
+ static int iWave = 0;\r
+ static char pszWave[100];\r
+\r
+ printf("@@@ saving wave file @@@\n");\r
+ sprintf(pszWave, "/mnt/nfs/tts/play%d.wav", iWave++);\r
+ SMTSaveWave(pszWave, (short*) pPCMs, nPCMs * 2);\r
+ }\r
+#endif\r
+\r
+ switch (eEvent)\r
+ {\r
+ case TTSP_RESULT_EVENT_START : printf("TTSPE_CBEVENT_SYNTH_START\n"); break;\r
+ case TTSP_RESULT_EVENT_CONTINUE: printf("TTSPE_CBEVENT_SYNTH_CONTINUE\n"); break;\r
+ case TTSP_RESULT_EVENT_FINISH : printf("TTSPE_CBEVENT_SYNTH_FINISH\n"); break;\r
+ case TTSP_RESULT_EVENT_CANCEL : printf("TTSPE_CBEVENT_SYNTH_CANCEL\n"); break;\r
+ case TTSP_RESULT_EVENT_FAIL : printf("TTSPE_CBEVENT_SYNTH_FAIL\n"); break;\r
+ default : printf("invalid\n"); break;\r
+ }\r
+\r
+ if (eEvent==TTSP_RESULT_EVENT_FINISH && ! _bEmptyThreadData())\r
+ {\r
+ printf(">>> There is another input text.\n");\r
+ printf(">>> TTSPE_CBEVENT_SYNTH_FINISH was chanage into TTSPE_CBEVENT_SYNTH_CONTINUE.\n");\r
+ eEvent = TTSP_RESULT_EVENT_CONTINUE;\r
+ }\r
+\r
+ printf(">>> data size = %d\n", n);\r
+ printf(">> >> Here we jump into the callback function.\n");\r
+\r
+ int const cbreturn = _g.pfnCallback(eEvent, pPCMs, n, pUserParam);\r
+ printf(">> >> Here we return from the callback function.\n");\r
+ printf(">> >> callback function return value = %d\n", cbreturn);\r
+ if (-1 == cbreturn)\r
+ {\r
+ printf(">>> Callback function returns TTS_CALLBACK_HALT.\n");\r
+ _g.bStop = true;\r
+ _g.bSentenceDone = true;\r
+ }\r
+}\r
+\r
+static int _Synthesize_SamsungTTS(char const * const pszTextUtf8, void* pUserParam, int const FramePeriod)\r
+{\r
+ static short pPcmBuffer[PCM_BUFFER_SIZE];\r
+\r
+ int r = SMTInputText(pszTextUtf8);\r
+ unsigned int i = 0;\r
+\r
+ if (r != SMT_SUCCESS)\r
+ {\r
+ _CleanThreadData();\r
+ printf(">>> SMTInputText() returns %d.\n", r);\r
+ }\r
+\r
+\r
+ while (r == SMT_SUCCESS)\r
+ {\r
+ r = SMTSynthesize(& pPcmBuffer[i]);\r
+ if (_g.bStop)\r
+ {\r
+ _CleanThreadData();\r
+ _CallBack(TTSP_RESULT_EVENT_CANCEL, i, pPcmBuffer, pUserParam);\r
+ break;\r
+ }\r
+ else\r
+ {\r
+ switch (r)\r
+ {\r
+ case SMT_SYNTHESIS_FRAME_GENERATED:\r
+ if (i + FramePeriod == PCM_BUFFER_SIZE)\r
+ {\r
+ _CallBack(TTSP_RESULT_EVENT_CONTINUE, PCM_BUFFER_SIZE, pPcmBuffer, pUserParam);\r
+ i = 0;\r
+ }\r
+ else\r
+ {\r
+ i += FramePeriod;\r
+ }\r
+ break;\r
+\r
+ case SMT_SYNTHESIS_PAUSE_DONE :\r
+ case SMT_SYNTHESIS_SENTENCE_DONE :\r
+ r = SMT_SUCCESS;\r
+ break;\r
+\r
+ case SMT_SYNTHESIS_ALL_DONE :\r
+ _CallBack(TTSP_RESULT_EVENT_FINISH, i, pPcmBuffer, pUserParam);\r
+ break;\r
+\r
+ default :\r
+ _CleanThreadData();\r
+\r
+ printf(">>> SMTSynthesize() returns %d\n", r);\r
+\r
+ _CallBack(TTSP_RESULT_EVENT_FAIL, i, pPcmBuffer, pUserParam);\r
+ break;\r
+ }\r
+ }\r
+\r
+ } // end of while loop\r
+\r
+ return r;\r
+}\r
+\r
+//\r
+// END\r
+//\r
+// functions managing < Engine Switching >\r
+//\r
--- /dev/null
+/*\r
+ * Samsung TTS\r
+ * Copyright 2012 Samsung Electronics Co., Ltd\r
+ *\r
+ * Licensed under the Flora License, Version 1.0 (the License);\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://floralicense.org/license/\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an AS IS BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#ifndef __SLP_SMT_APIS_H__\r
+#define __SLP_SMT_APIS_H__\r
+\r
+#include <ttsp.h>\r
+#include "plugin_internal.h"\r
+\r
+int SLPSMT_Initialize (ttspe_result_cb const pfnCallBack);\r
+int SLPSMT_Finalize (void);\r
+\r
+int SLPSMT_SetVoiceList (ttspe_voice_list_s *);\r
+void SLPSMT_SetSpeechSpeed(ttsp_speed_e const eSpeechSpeed);\r
+int SLPSMT_GetiVoiceInfo (char* const pszLanguage, ttsp_voice_type_e const eVoiceType);\r
+int SLPSMT_SynthesizeText(int const iVoiceInfo, char const * pszTextUtf8, void* const pUserParam);\r
+int SLPSMT_StopSynthesis (void);\r
+\r
+char const * SLPSMT_GetPszKorean (void);\r
+char const * SLPSMT_GetPszUSEnglish (void);\r
+char const * SLPSMT_GetPszChinese (void);\r
+char const * SLPSMT_GetPszUKEnglish (void);\r
+char const * SLPSMT_GetPszGerman (void);\r
+char const * SLPSMT_GetPszSpanish (void);\r
+char const * SLPSMT_GetPszFrench (void);\r
+char const * SLPSMT_GetPszItalian (void);\r
+int SLPSMT_GetWorkingThreadId (void);\r
+\r
+\r
+#endif // __SLP_SMT_APIS_H__\r
--- /dev/null
+/*\r
+ * Samsung TTS\r
+ * Copyright 2012 Samsung Electronics Co., Ltd\r
+ *\r
+ * Licensed under the Flora License, Version 1.0 (the License);\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://floralicense.org/license/\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an AS IS BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include "plugin_internal.h"\r
+#include "_SlpSmtApis.h"\r
+\r
+\r
+// Once eigine was initialize, that means gpDaemonAPIs and its members are not NULL.\r
+// So we do not need to check whether this is NULL, nor its members are NULL.\r
+static ttspd_funcs_s const * gpDaemonAPIs = NULL;\r
+\r
+\r
+int plugin_Initialize(ttspe_result_cb const pfnCallBack)\r
+{\r
+ int r = SLPSMT_Initialize(pfnCallBack);\r
+ printf(">>>plugin Initialize() returns %d.\n", r);\r
+ return r;\r
+}\r
+\r
+int plugin_Finalize(void)\r
+{\r
+ int r = SLPSMT_Finalize();\r
+ printf(">>>plugin Initialize() returns %d.\n", r);\r
+ return r;\r
+}\r
+\r
+int plugin_SynthesizeText(char* const pszLanguage, ttsp_voice_type_e eVoiceType_0, char const * pszTextUtf8,\r
+ ttsp_speed_e eSpeechSpeed_0, void* pUserParam)\r
+{\r
+ int iVoiceInfo = -1;\r
+ ttsp_voice_type_e eVoiceType = eVoiceType_0;\r
+ ttsp_speed_e eSpeechSpeed = eSpeechSpeed_0;\r
+\r
+ int ThreadId = SLPSMT_GetWorkingThreadId();\r
+ printf(">>>plugin SynthesizeText()\n");\r
+ if (ThreadId != -1)\r
+ {\r
+ printf(">>> A new text is comming into the TTS engine, while Synthesizing.\n");\r
+ printf(">>> The text would be pushed into the thread queue.\n");\r
+ }\r
+ printf(">>> ThreadId = %d\n", ThreadId);\r
+ printf(">>> pUserParam = 0x%x\n", (unsigned int) pUserParam);\r
+\r
+ printf(">>> eSpeechSpeed = %s\n", //eSpeechSpeed==TTSPE_SPEED_DEFAULT ? "TTSPE_SPEED_DEFAULT" :\r
+ eSpeechSpeed==TTSP_SPEED_VERY_FAST ? "TTSP_SPEED_VERY_FAST" :\r
+ eSpeechSpeed==TTSP_SPEED_FAST ? "TTSP_SPEED_FAST" :\r
+ eSpeechSpeed==TTSP_SPEED_NORMAL ? "TTSP_SPEED_NORMAL" :\r
+ eSpeechSpeed==TTSP_SPEED_SLOW ? "TTSP_SPEED_SLOW" :\r
+ eSpeechSpeed==TTSP_SPEED_VERY_SLOW ? "TTSP_SPEED_VERY_SLOW" : ""\r
+ );\r
+ printf(">>> pszLanguage = %s\n", pszLanguage);\r
+ printf(">>> eVoiceType = %s\n", //eVoiceType==TTSPE_VCTYPE_DEFAULT ? "TTSPE_VCTYPE_DEFAULT" :\r
+ eVoiceType==TTSP_VOICE_TYPE_MALE ? "TTSP_VOICE_TYPE_MALE" :\r
+ eVoiceType==TTSP_VOICE_TYPE_FEMALE ? "TTSP_VOICE_TYPE_FEMALE" :\r
+ eVoiceType==TTSP_VOICE_TYPE_CHILD ? "TTSP_VOICE_TYPE_CHILD" :\r
+ eVoiceType==TTSP_VOICE_TYPE_USER1 ? "TTSP_VOICE_TYPE_USER1" :\r
+ eVoiceType==TTSP_VOICE_TYPE_USER2 ? "TTSP_VOICE_TYPE_USER2" :\r
+ eVoiceType==TTSP_VOICE_TYPE_USER3 ? "TTSP_VOICE_TYPE_USER3" : ""\r
+ );\r
+\r
+ SLPSMT_SetSpeechSpeed(eSpeechSpeed);\r
+\r
+ printf(">>> \n");\r
+ printf(">>> eSpeechSpeed = %s\n", //eSpeechSpeed==TTSP_SPEED_DEFAULT ? "TTSPE_SPEED_DEFAULT" :\r
+ eSpeechSpeed==TTSP_SPEED_VERY_FAST ? "TTSPE_SPEED_VERY_FAST" :\r
+ eSpeechSpeed==TTSP_SPEED_FAST ? "TTSPE_SPEED_FAST" :\r
+ eSpeechSpeed==TTSP_SPEED_NORMAL ? "TTSPE_SPEED_NORMAL" :\r
+ eSpeechSpeed==TTSP_SPEED_SLOW ? "TTSPE_SPEED_SLOW" :\r
+ eSpeechSpeed==TTSP_SPEED_VERY_SLOW ? "TTSPE_SPEED_VERY_SLOW" : ""\r
+ );\r
+ printf(">>> pszLanguage = %s\n", pszLanguage);\r
+ printf(">>> eVoiceType = %s\n", //eVoiceType==TTSPE_VCTYPE_DEFAULT ? "TTSPE_VCTYPE_DEFAULT" :\r
+ eVoiceType==TTSP_VOICE_TYPE_MALE ? "TTSPE_VCTYPE_MALE" :\r
+ eVoiceType==TTSP_VOICE_TYPE_FEMALE ? "TTSPE_VCTYPE_FEMALE" :\r
+ eVoiceType==TTSP_VOICE_TYPE_CHILD ? "TTSPE_VCTYPE_CHILD" :\r
+ eVoiceType==TTSP_VOICE_TYPE_USER1 ? "TTSPE_VCTYPE_USER1" :\r
+ eVoiceType==TTSP_VOICE_TYPE_USER2 ? "TTSPE_VCTYPE_USER2" :\r
+ eVoiceType==TTSP_VOICE_TYPE_USER3 ? "TTSPE_VCTYPE_USER3" : ""\r
+ );\r
+\r
+ // set voice\r
+ iVoiceInfo = SLPSMT_GetiVoiceInfo(pszLanguage, eVoiceType);\r
+ if (iVoiceInfo < 0)\r
+ {\r
+ printf("iVoiceInfo < 0\n");\r
+ return TTSP_ERROR_INVALID_VOICE;\r
+ }\r
+\r
+ return SLPSMT_SynthesizeText(iVoiceInfo, pszTextUtf8, pUserParam);\r
+}\r
+\r
+int plugin_StopSynthesis(void)\r
+{\r
+ return SLPSMT_StopSynthesis();\r
+}\r
+\r
+int plugin_GetAudioFormat(ttsp_audio_type_e* pType, int* pSamplingRate, int* pnChannels)\r
+{\r
+ if (pType && pSamplingRate && pnChannels)\r
+ {\r
+ *pSamplingRate = 16000;\r
+ *pnChannels = 1;\r
+ *pType = TTSP_AUDIO_TYPE_RAW;\r
+ return TTSP_ERROR_NONE;\r
+ }\r
+ return TTSP_ERROR_INVALID_PARAMETER;\r
+}\r
+\r
+\r
+\r
+\r
+int plugin_ForeachVoices(ttspe_supported_voice_cb callback, void* user_data)\r
+{\r
+ if(NULL == callback)\r
+ return TTSP_ERROR_INVALID_PARAMETER;\r
+\r
+ ttspe_voice_list_s pVoiceList;\r
+ SLPSMT_SetVoiceList(&pVoiceList);\r
+\r
+ int i = 0;\r
+\r
+ ttspe_voice_info_s* temp = pVoiceList.voice_info;\r
+\r
+ for(i=0 ; i < pVoiceList.size; i++)\r
+ {\r
+ if (false == callback(temp[i].lang, temp[i].vctype, user_data))\r
+ {\r
+ printf(">> plugin_ForeachVoices(), callback fail!!\n");\r
+ break;\r
+ }\r
+ }\r
+\r
+ return TTSP_ERROR_NONE;\r
+}\r
+\r
+bool plugin_IsValidVoice(const char* language, ttsp_voice_type_e type)\r
+{\r
+ if (NULL == language)\r
+ return TTSP_ERROR_INVALID_PARAMETER;\r
+\r
+ int iVoiceInfo = SLPSMT_GetiVoiceInfo((char* )language, type);\r
+\r
+ if (iVoiceInfo < 0)\r
+ {\r
+ printf("iVoiceInfo < 0\n");\r
+ return false;\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+int plugin_SetSettingInfo(const char* key, const char* value)\r
+{\r
+ if (NULL == key || NULL == value) {\r
+ return TTSP_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ printf("Set engine setting : key(%s) value(%s)\n", key, value);\r
+\r
+ return TTSP_ERROR_NONE;\r
+}\r
+\r
+int plugin_ForeachEngineSetting(ttspe_engine_setting_cb callback, void* user_data)\r
+{\r
+ if (false == callback("Sample_key1", "Sample_value1", user_data))\r
+ return TTSP_ERROR_NONE;\r
+\r
+ if (false == callback("Sample_key2", "Sample_value2", user_data))\r
+ return TTSP_ERROR_NONE;\r
+\r
+ return TTSP_ERROR_NONE;\r
+}\r
+\r
+void plugin_SetDaemonAPIs(ttspd_funcs_s const * pAPIs)\r
+{\r
+ gpDaemonAPIs = pAPIs;\r
+}\r
--- /dev/null
+/*\r
+ * Samsung TTS\r
+ * Copyright 2012 Samsung Electronics Co., Ltd\r
+ *\r
+ * Licensed under the Flora License, Version 1.0 (the License);\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://floralicense.org/license/\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an AS IS BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+\r
+#ifndef _PLUGIN_INTERNAL_H_\r
+#define _PLUGIN_INTERNAL_H_\r
+\r
+#include <ttsp.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+#define ENGINE_UUID "27F277E9-BBC4-4dca-B553-D9884A3CDAA0"\r
+#define ENGINE_NAME "Samsung TTS"\r
+#define ENGINE_UG_NAME "tts_smt_setting_ug.so"\r
+\r
+#define VTTS_VOICE_NAME_BUF_SIZE 8\r
+\r
+typedef char* ttspe_language;\r
+\r
+typedef struct {\r
+ ttspe_language lang; /**< Language */\r
+ ttsp_voice_type_e vctype; /**< Voice type */\r
+} ttspe_voice_info_s;\r
+\r
+typedef struct {\r
+ ttspe_voice_info_s* voice_info; /**< Voice info array */\r
+ int size; /**< size of array */\r
+} ttspe_voice_list_s;\r
+\r
+int plugin_Initialize(ttspe_result_cb const cb_func);\r
+\r
+int plugin_Finalize(void);\r
+\r
+int plugin_SynthesizeText\r
+(\r
+ char* const pszLanguage,\r
+ ttsp_voice_type_e const eVoiceType,\r
+ char const * pszTextUtf8,\r
+ ttsp_speed_e const eSpeechSpeed,\r
+ void * pUserParam\r
+);\r
+\r
+int plugin_StopSynthesis(void);\r
+\r
+int plugin_GetAudioFormat(ttsp_audio_type_e* pType, int* pSamplingRate, int* pnChannels);\r
+\r
+int plugin_ForeachVoices(ttspe_supported_voice_cb callback, void* user_data);\r
+\r
+bool plugin_IsValidVoice(const char* language, ttsp_voice_type_e type);\r
+\r
+int plugin_SetDefaultSpeechSpeed(ttsp_speed_e const SpeechSpeed);\r
+\r
+int plugin_SetSettingInfo(const char* key, const char* value);\r
+\r
+int plugin_ForeachEngineSetting(ttspe_engine_setting_cb callback, void* user_data);\r
+\r
+void plugin_SetDaemonAPIs (ttspd_funcs_s const * pAPIs);\r
+\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* _PLUGIN_INTERNAL_H_ */\r
--- /dev/null
+/*\r
+ * Samsung TTS\r
+ * Copyright 2012 Samsung Electronics Co., Ltd\r
+ *\r
+ * Licensed under the Flora License, Version 1.0 (the License);\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://floralicense.org/license/\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an AS IS BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "stdio.h"\r
+#include "memory.h"\r
+\r
+#include <ttsp.h>\r
+#include "plugin_internal.h"\r
+\r
+char * _psz = NULL;\r
+char * _pszEngineUUID;\r
+char * _pszEngineName;\r
+char * _pszEngineUgName;\r
+\r
+\r
+\r
+int ttsp_load_engine(ttspd_funcs_s* pdfuncs, ttspe_funcs_s* pefuncs)\r
+{\r
+ if (! pdfuncs)\r
+ {\r
+ printf("parameter1, pdfuncs is NULL.");\r
+ return TTSP_ERROR_INVALID_PARAMETER;\r
+ }\r
+ if (! pefuncs)\r
+ {\r
+ printf("parameter2, pefuncs is NULL.");\r
+ return TTSP_ERROR_INVALID_PARAMETER;\r
+ }\r
+\r
+ pefuncs->size = sizeof(ttspe_funcs_s);\r
+ pefuncs->version = 1;\r
+\r
+ pefuncs->initialize = plugin_Initialize;\r
+ pefuncs->deinitialize = plugin_Finalize;\r
+\r
+ pefuncs->start_synth = plugin_SynthesizeText;\r
+ pefuncs->cancel_synth = plugin_StopSynthesis;\r
+ pefuncs->get_audio_format = plugin_GetAudioFormat;\r
+\r
+ pefuncs->foreach_voices = plugin_ForeachVoices;\r
+ pefuncs->is_valid_voice = plugin_IsValidVoice;\r
+\r
+ pefuncs->set_engine_setting = plugin_SetSettingInfo;\r
+ pefuncs->foreach_engine_setting = plugin_ForeachEngineSetting;\r
+\r
+ plugin_SetDaemonAPIs(pdfuncs);\r
+\r
+ printf("[SMT] ttsp_load_engine() : version(%d), (6.20110527), size(%d)\n", pefuncs->version, pefuncs->size);\r
+\r
+ return TTSP_ERROR_NONE;\r
+}\r
+\r
+void ttsp_unload_engine(void)\r
+{\r
+ printf("[SMT] ttsp_unload_engine() \n");\r
+}\r
+\r
+int ttsp_get_engine_info(ttsp_engine_info_cb callback, void* user_data)\r
+{\r
+\r
+ callback(ENGINE_UUID, ENGINE_NAME, ENGINE_UG_NAME, false, user_data);\r
+\r
+ return 0;\r
+}\r