]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_cepstral] Remove from tree 2694/head
authorAndrey Volk <andywolk@gmail.com>
Tue, 27 Aug 2024 22:37:30 +0000 (22:37 +0000)
committerAndrey Volk <andywolk@gmail.com>
Mon, 6 Jan 2025 14:41:58 +0000 (17:41 +0300)
15 files changed:
Freeswitch.2017.sln
build/modules.conf.in
build/modules.conf.most
conf/insideout/autoload_configs/modules.conf.xml [changed mode: 0644->0755]
conf/vanilla/autoload_configs/cepstral.conf.xml [deleted file]
conf/vanilla/autoload_configs/modules.conf.xml
configure.ac
debian/bootstrap.sh
debian/control-modules
freeswitch.spec
src/mod/asr_tts/mod_cepstral/Makefile.am [deleted file]
src/mod/asr_tts/mod_cepstral/WinReadme.txt [deleted file]
src/mod/asr_tts/mod_cepstral/conf/cepstral.conf.xml [deleted file]
src/mod/asr_tts/mod_cepstral/mod_cepstral.2017.vcxproj [deleted file]
src/mod/asr_tts/mod_cepstral/mod_cepstral.c [deleted file]

index 459419ff440b00b427fe2c010d410b908e7e8b29..f75602a56f9b424fbf23eccf21edc517368e0f51 100644 (file)
@@ -191,8 +191,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_v8", "src\mod\languages
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_v8_skel", "src\mod\languages\mod_v8\mod_v8_skel.2017.vcxproj", "{8B754330-A434-4791-97E5-1EE67060BAC0}"\r
 EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_cepstral", "src\mod\asr_tts\mod_cepstral\mod_cepstral.2017.vcxproj", "{692F6330-4D87-4C82-81DF-40DB5892636E}"\r
-EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_ilbc", "src\mod\codecs\mod_ilbc\mod_ilbc.2017.vcxproj", "{D3EC0AFF-76FC-4210-A825-9A17410660A3}"\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_commands", "src\mod\applications\mod_commands\mod_commands.2017.vcxproj", "{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}"\r
@@ -696,13 +694,6 @@ Global
                {8B754330-A434-4791-97E5-1EE67060BAC0}.Debug|x64.ActiveCfg = Debug|x64\r
                {8B754330-A434-4791-97E5-1EE67060BAC0}.Release|Win32.ActiveCfg = Release|Win32\r
                {8B754330-A434-4791-97E5-1EE67060BAC0}.Release|x64.ActiveCfg = Release|x64\r
-               {692F6330-4D87-4C82-81DF-40DB5892636E}.All|Win32.ActiveCfg = Release|x64\r
-               {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.ActiveCfg = Release|x64\r
-               {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.Build.0 = Release|x64\r
-               {692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|Win32.ActiveCfg = Debug|Win32\r
-               {692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|x64.ActiveCfg = Debug|x64\r
-               {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|Win32.ActiveCfg = Release|Win32\r
-               {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x64.ActiveCfg = Release|x64\r
                {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|Win32.ActiveCfg = Release|x64\r
                {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64.ActiveCfg = Release|x64\r
                {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64.Build.0 = Release|x64\r
@@ -2539,7 +2530,6 @@ Global
                {89385C74-5860-4174-9CAF-A39E7C48909C} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}\r
                {9B9D2551-D6BD-4F20-8BE5-DE30E154A064} = {0C808854-54D1-4230-BFF5-77B5FD905000}\r
                {8B754330-A434-4791-97E5-1EE67060BAC0} = {0C808854-54D1-4230-BFF5-77B5FD905000}\r
-               {692F6330-4D87-4C82-81DF-40DB5892636E} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}\r
                {D3EC0AFF-76FC-4210-A825-9A17410660A3} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}\r
                {30A5B29C-983E-4580-9FD0-D647CCDCC7EB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}\r
                {1C453396-D912-4213-89FD-9B489162B7B5} = {A7AB4405-FDB7-4853-9FBB-1516B1C3D80A}\r
index a2e027d4ab6588c3e7dddcac18ba96fcef941068..b1dfdc7bf0615d0f38f2daaa2f862932356164e9 100755 (executable)
@@ -55,7 +55,6 @@ applications/mod_valet_parking
 #applications/mod_vmd
 applications/mod_voicemail
 #applications/mod_voicemail_ivr
-#asr_tts/mod_cepstral
 #asr_tts/mod_flite
 #asr_tts/mod_pocketsphinx
 #asr_tts/mod_tts_commandline
index d489f2d51f5a19a78991a0be68c1ac49ecd9e16a..0cc812dba467be8e1a2ed11d1fcad4890842c945 100755 (executable)
@@ -53,7 +53,6 @@ applications/mod_video_filter
 applications/mod_vmd
 applications/mod_voicemail
 applications/mod_voicemail_ivr
-#asr_tts/mod_cepstral
 asr_tts/mod_flite
 asr_tts/mod_pocketsphinx
 asr_tts/mod_tts_commandline
old mode 100644 (file)
new mode 100755 (executable)
index 9408bcd..e54dbfe
@@ -88,7 +88,6 @@
     <!-- ASR /TTS -->
     <!-- <load module="mod_flite"/> -->
     <!-- <load module="mod_pocketsphinx"/> -->
-    <!-- <load module="mod_cepstral"/> -->
     <!-- <load module="mod_openmrcp"/> -->
     <!-- <load module="mod_rss"/> -->
     
diff --git a/conf/vanilla/autoload_configs/cepstral.conf.xml b/conf/vanilla/autoload_configs/cepstral.conf.xml
deleted file mode 100644 (file)
index cf4aa92..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<configuration name="cepstral.conf" description="Cepstral TTS configuration">\r
-  <settings>\r
-    <!--\r
-        Possible encodings:\r
-        * utf-8\r
-        * us-ascii\r
-        * iso8859-1 (default)\r
-        * iso8859-15\r
-    -->\r
-    <param name="encoding" value="utf-8"/>\r
-  </settings>\r
-</configuration>
\ No newline at end of file
index 9df8209d1b26e53434ec403fa96d9773122a564d..3002a22f0a6484bd9353eb2b7e593ff46b605304 100755 (executable)
     <!-- ASR /TTS -->
     <!-- <load module="mod_flite"/> -->
     <!-- <load module="mod_pocketsphinx"/> -->
-    <!-- <load module="mod_cepstral"/> -->
     <!-- <load module="mod_tts_commandline"/> -->
     <!-- <load module="mod_rss"/> -->
 
index 6246f1b5a8c37dcf246d6ab2b29c35fcff25e939..f22076fa84e41f43c526166b19fa3ea72e56bc81 100755 (executable)
@@ -1080,7 +1080,7 @@ fi
 
 # Tested and fixed lot of modules, but some are untested.  Will be added back when the core team decide it ready
 # Untested modules : mod_osp mod_soundtouch mod_opal mod_h323 mod_khomp 
-#                    mod_cepstral mod_erlang_event mod_snmp mod_perl mod_java mod_managed
+#                    mod_erlang_event mod_snmp mod_perl mod_java mod_managed
 #
 #saved_CFLAGS="$CFLAGS"
 #AC_CACHE_CHECK([whether compiler supports -Wunused-but-set-variable], [ac_cv_gcc_unused_but_set_variable], [
@@ -2150,7 +2150,6 @@ AC_CONFIG_FILES([Makefile
                src/mod/applications/mod_vmd/Makefile
                src/mod/applications/mod_voicemail/Makefile
                src/mod/applications/mod_voicemail_ivr/Makefile
-               src/mod/asr_tts/mod_cepstral/Makefile
                src/mod/asr_tts/mod_flite/Makefile
                src/mod/asr_tts/mod_pocketsphinx/Makefile
                src/mod/asr_tts/mod_tts_commandline/Makefile
index 05ee167c51a3aa0ac47d576d2c58765ce2ad812b..1744077f43316ff3e1636a2218a851048328f763 100755 (executable)
@@ -42,7 +42,6 @@ avoid_mods=(
   applications/mod_rad_auth
   applications/mod_skel
   applications/mod_cluechoo
-  asr_tts/mod_cepstral
   codecs/mod_com_g729
   codecs/mod_openh264
   codecs/mod_siren
index 05820b0b726fab7be50a099eccaed41d36bc0901..8e59f8f3ae3eebfadf46060b4e2b4500064e4fe4 100755 (executable)
@@ -269,10 +269,6 @@ Description: Voicemail IVR
 
 ## mod/asr_tts
 
-Module: asr_tts/mod_cepstral
-Description: mod_cepstral
- Adds mod_cepstral.
-
 Module: asr_tts/mod_flite
 Description: mod_flite
  Adds mod_flite.
index a3ddd6efc269a3d6c5239f3610a44d56429ecd5f..d949208ad65ca3734dfe1c43e767a1c8b9fe36db 100755 (executable)
@@ -1809,7 +1809,6 @@ fi
 %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/cdr_mongodb.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/cdr_pg_csv.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/cdr_sqlite.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/cepstral.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/cidlookup.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/conference.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/conference_layouts.conf.xml
diff --git a/src/mod/asr_tts/mod_cepstral/Makefile.am b/src/mod/asr_tts/mod_cepstral/Makefile.am
deleted file mode 100644 (file)
index 2b62243..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-include $(top_srcdir)/build/modmake.rulesam
-MODNAME=mod_cepstral
-
-mod_LTLIBRARIES = mod_cepstral.la
-mod_cepstral_la_SOURCES  = mod_cepstral.c
-mod_cepstral_la_CFLAGS   = $(AM_CFLAGS) -w
-mod_cepstral_la_LIBADD   = $(switch_builddir)/libfreeswitch.la
-mod_cepstral_la_LDFLAGS  = -avoid-version -module -no-undefined -shared
-
-if ISMAC
-mod_cepstral_la_LDFLAGS += -framework swift
-mod_cepstral_la_CFLAGS  += -I/Library/Frameworks/swift.framework/Versions/5/Headers/
-else
-mod_cepstral_la_LDFLAGS += -Wl,-rpath -Wl,/opt/swift/lib -L$(SWIFT_HOME)/lib -L/opt/swift/lib -lswift -lm
-mod_cepstral_la_CFLAGS  += -I$(SWIFT_HOME)/include -I/opt/swift/include 
-endif
-
diff --git a/src/mod/asr_tts/mod_cepstral/WinReadme.txt b/src/mod/asr_tts/mod_cepstral/WinReadme.txt
deleted file mode 100644 (file)
index 50ca93d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-The Cepstral SDK for Windows should be placed in c:\dev\cepstral
-ex. C:\dev\cepstral\sdk\include
-This SDK can be obtained from http://cepstral.com/
-If you want a prebuilt version you may download one from http://files.freeswitch.org/windows/installer/
\ No newline at end of file
diff --git a/src/mod/asr_tts/mod_cepstral/conf/cepstral.conf.xml b/src/mod/asr_tts/mod_cepstral/conf/cepstral.conf.xml
deleted file mode 100644 (file)
index cf431de..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<configuration name="cepstral.conf" description="Cepstral TTS configuration">
-  <settings>
-    <!--
-        Possible encodings:
-        * utf-8
-        * us-ascii
-        * iso8859-1 (default)
-        * iso8859-15
-    -->
-    <param name="encoding" value="utf-8"/>
-  </settings>
-</configuration>
\ No newline at end of file
diff --git a/src/mod/asr_tts/mod_cepstral/mod_cepstral.2017.vcxproj b/src/mod/asr_tts/mod_cepstral/mod_cepstral.2017.vcxproj
deleted file mode 100644 (file)
index 6f8d4be..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|x64">
-      <Configuration>Debug</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|x64">
-      <Configuration>Release</Configuration>
-      <Platform>x64</Platform>
-    </ProjectConfiguration>
-  </ItemGroup>
-  <PropertyGroup Label="Globals">
-    <ProjectName>mod_cepstral</ProjectName>
-    <ProjectGuid>{692F6330-4D87-4C82-81DF-40DB5892636E}</ProjectGuid>
-    <RootNamespace>mod_cepstral</RootNamespace>
-    <Keyword>Win32Proj</Keyword>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
-    <ConfigurationType>DynamicLibrary</ConfigurationType>
-    <CharacterSet>MultiByte</CharacterSet>
-    <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
-  </PropertyGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
-  <ImportGroup Label="ExtensionSettings">
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="..\..\..\..\w32\module_release.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="..\..\..\..\w32\module_debug.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="..\..\..\..\w32\module_release.props" />
-  </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
-    <Import Project="..\..\..\..\w32\module_debug.props" />
-  </ImportGroup>
-  <PropertyGroup Label="UserMacros" />
-  <PropertyGroup>
-    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <AdditionalIncludeDirectories>C:\dev\cepstral\sdk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
-    </ClCompile>
-    <Link>
-      <AdditionalDependencies>swift.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>C:\dev\cepstral\sdk\lib\lib-windows;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
-      <DataExecutionPrevention>
-      </DataExecutionPrevention>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <Midl>
-      <TargetEnvironment>X64</TargetEnvironment>
-    </Midl>
-    <ClCompile>
-      <AdditionalIncludeDirectories>C:\dev\cepstral\sdk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
-    </ClCompile>
-    <Link>
-      <AdditionalDependencies>swift.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>C:\dev\cepstral\sdk\lib\lib-windows_x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
-      <DataExecutionPrevention>
-      </DataExecutionPrevention>
-      <TargetMachine>MachineX64</TargetMachine>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <AdditionalIncludeDirectories>C:\dev\cepstral\sdk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
-    </ClCompile>
-    <Link>
-      <AdditionalDependencies>swift.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>C:\dev\cepstral\sdk\lib\lib-windows;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
-      <DataExecutionPrevention>
-      </DataExecutionPrevention>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <Midl>
-      <TargetEnvironment>X64</TargetEnvironment>
-    </Midl>
-    <ClCompile>
-      <AdditionalIncludeDirectories>C:\dev\cepstral\sdk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
-    </ClCompile>
-    <Link>
-      <AdditionalDependencies>swift.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>C:\dev\cepstral\sdk\lib\lib-windows_x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
-      <DataExecutionPrevention>
-      </DataExecutionPrevention>
-      <TargetMachine>MachineX64</TargetMachine>
-    </Link>
-  </ItemDefinitionGroup>
-  <ItemGroup>
-    <ClCompile Include="mod_cepstral.c" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2017.vcxproj">
-      <Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project>
-    </ProjectReference>
-  </ItemGroup>
-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-  <ImportGroup Label="ExtensionTargets">
-  </ImportGroup>
-</Project>
\ No newline at end of file
diff --git a/src/mod/asr_tts/mod_cepstral/mod_cepstral.c b/src/mod/asr_tts/mod_cepstral/mod_cepstral.c
deleted file mode 100644 (file)
index b66581c..0000000
+++ /dev/null
@@ -1,491 +0,0 @@
-/*
- * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
- *
- * Version: MPL 1.1
- *
- * The contents of this file are subject to the Mozilla Public 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://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- *
- * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthm@freeswitch.org>
- * Portions created by the Initial Developer are Copyright (C)
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Anthony Minessale II <anthm@freeswitch.org>
- *
- *
- * mod_cepstral.c -- Cepstral Interface
- *
- * Contains some material derived from the Cepstral Swift SDK, by
- * permission.  You are free to copy and modify the source under the
- * terms of FreeSWITCH itself, without additional permission from
- * Cepstral
- *
- *
- */
-#ifdef __ICC
-#pragma warning (disable:188)
-#endif
-#include <swift.h>
-#include <switch.h>
-
-#define MY_BUF_LEN 1024 * 32
-#define MY_BLOCK_SIZE MY_BUF_LEN
-
-#undef SWIFT_FAILED
-#define SWIFT_FAILED(r) ((void *)(r) < (void *)0)
-
-SWITCH_MODULE_LOAD_FUNCTION(mod_cepstral_load);
-SWITCH_MODULE_DEFINITION_EX(mod_cepstral, mod_cepstral_load, NULL, NULL, SMODF_GLOBAL_SYMBOLS);
-
-static swift_engine *engine;
-
-
-typedef struct {
-       swift_background_t tts_stream;
-       swift_port *port;
-       swift_params *params;
-       swift_voice *voice;
-       switch_mutex_t *audio_lock;
-       switch_buffer_t *audio_buffer;
-       int done;
-       int done_gen;
-} cepstral_t;
-
-
-static struct {
-       char *encoding;
-} globals;
-
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_encoding, globals.encoding);
-
-
-
-/* This callback caches the audio in the buffer */
-static swift_result_t write_audio(swift_event * event, swift_event_t type, void *udata)
-{
-       cepstral_t *cepstral;
-       swift_event_t rv = SWIFT_SUCCESS;
-       void *buf = NULL;
-       int len = 0, i = 0;
-
-       cepstral = udata;
-       assert(cepstral != NULL);
-
-       if (!cepstral->port || cepstral->done || cepstral->done_gen) {
-               return SWIFT_UNKNOWN_ERROR;
-       }
-
-       /* Only proceed when we have success */
-       if (!SWIFT_FAILED((rv = swift_event_get_audio(event, &buf, &len)))) {
-               while (!cepstral->done) {
-                       switch_mutex_lock(cepstral->audio_lock);
-                       if (switch_buffer_write(cepstral->audio_buffer, buf, len) > 0) {
-                               switch_mutex_unlock(cepstral->audio_lock);
-                               break;
-                       }
-                       switch_mutex_unlock(cepstral->audio_lock);
-                       if (!cepstral->done) {
-                               for (i = 0; i < 10; i++) {
-                                       switch_yield(10000);
-                                       if (cepstral->done) {
-                                               break;
-                                       }
-                               }
-                       }
-
-               }
-       } else {
-               cepstral->done = 1;
-       }
-
-       if (cepstral->done) {
-               rv = SWIFT_UNKNOWN_ERROR;
-       }
-
-       return rv;
-}
-
-static switch_status_t cepstral_speech_open(switch_speech_handle_t *sh, const char *voice_name, int rate, int channels, switch_speech_flag_t *flags)
-{
-       cepstral_t *cepstral = switch_core_alloc(sh->memory_pool, sizeof(*cepstral));
-       char srate[25];
-
-       if (!cepstral) {
-               return SWITCH_STATUS_MEMERR;
-       }
-
-       if (switch_buffer_create_dynamic(&cepstral->audio_buffer, MY_BLOCK_SIZE, MY_BUF_LEN, 0) != SWITCH_STATUS_SUCCESS) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Write Buffer Failed!\n");
-               return SWITCH_STATUS_MEMERR;
-       }
-
-
-       switch_mutex_init(&cepstral->audio_lock, SWITCH_MUTEX_NESTED, sh->memory_pool);
-
-
-       cepstral->params = swift_params_new(NULL);
-       swift_params_set_string(cepstral->params, "audio/encoding", "pcm16");
-       switch_snprintf(srate, sizeof(srate), "%d", rate);
-       swift_params_set_string(cepstral->params, "audio/sampling-rate", srate);
-
-
-       /* Open a Swift Port through which to make TTS calls */
-       if (!(cepstral->port = swift_port_open(engine, cepstral->params))) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open Swift Port.\n");
-               goto all_done;
-       }
-
-
-       if (voice_name && SWIFT_FAILED(swift_port_set_voice_by_name(cepstral->port, voice_name))) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid voice %s!\n", voice_name);
-               voice_name = NULL;
-       }
-
-       if (zstr(voice_name)) {
-               /* Find the first voice on the system */
-               if ((cepstral->voice = swift_port_find_first_voice(cepstral->port, NULL, NULL)) == NULL) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find any voices!\n");
-                       goto all_done;
-               }
-
-               /* Set the voice found by find_first_voice() as the port's current voice */
-               if (SWIFT_FAILED(swift_port_set_voice(cepstral->port, cepstral->voice))) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set voice.\n");
-                       goto all_done;
-               }
-
-               voice_name = (char *) swift_voice_get_attribute(cepstral->voice, "name");
-       }
-
-       if (voice_name) {
-               switch_copy_string(sh->voice, voice_name, sizeof(sh->voice));
-       }
-
-       swift_port_set_callback(cepstral->port, &write_audio, SWIFT_EVENT_AUDIO, cepstral);
-
-       sh->private_info = cepstral;
-       return SWITCH_STATUS_SUCCESS;
-
-  all_done:
-       return SWITCH_STATUS_FALSE;
-}
-
-static switch_status_t cepstral_speech_close(switch_speech_handle_t *sh, switch_speech_flag_t *flags)
-{
-       cepstral_t *cepstral;
-
-       assert(sh != NULL);
-       cepstral = sh->private_info;
-       assert(cepstral != NULL);
-
-
-       cepstral->done = 1;
-       cepstral->done_gen = 1;
-       swift_port_stop(cepstral->port, SWIFT_ASYNC_ANY, SWIFT_EVENT_NOW);
-       /* Close the Swift Port and Engine */
-       if (NULL != cepstral->port)
-               swift_port_close(cepstral->port);
-       //if (NULL != cepstral->engine) swift_engine_close(cepstral->engine);
-
-       cepstral->port = NULL;
-       //cepstral->engine = NULL;
-
-       switch_buffer_destroy(&cepstral->audio_buffer);
-
-       return SWITCH_STATUS_SUCCESS;
-}
-
-static switch_status_t cepstral_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
-{
-       cepstral_t *cepstral;
-       const char *fp = "file:";
-       int len = (int) strlen(fp);
-
-       assert(sh != NULL);
-       cepstral = sh->private_info;
-       assert(cepstral != NULL);
-
-       cepstral->done_gen = 0;
-       cepstral->done = 0;
-
-       cepstral->tts_stream = NULL;
-
-       if (zstr(text)) {
-               return SWITCH_STATUS_FALSE;
-       }
-       if (!strncasecmp(text, fp, len)) {
-               text += len;
-               if (zstr(text)) {
-                       return SWITCH_STATUS_FALSE;
-               }
-               swift_port_speak_file(cepstral->port, text, globals.encoding, &cepstral->tts_stream, NULL);
-       } else {
-               char *to_say;
-               if (zstr(text)) {
-                       return SWITCH_STATUS_FALSE;
-               }
-
-               if ((to_say = switch_mprintf("<break time=\"1000ms\"/> %s <break time=\"1000ms\"/>", text))) {
-                       swift_port_speak_text(cepstral->port, to_say, 0, globals.encoding, &cepstral->tts_stream, NULL);
-                       switch_safe_free(to_say);
-               }
-       }
-
-       return SWITCH_STATUS_SUCCESS;
-}
-
-static void cepstral_speech_flush_tts(switch_speech_handle_t *sh)
-{
-       cepstral_t *cepstral;
-
-       cepstral = sh->private_info;
-       assert(cepstral != NULL);
-
-       cepstral->done_gen = 1;
-       cepstral->done = 1;
-       if (cepstral->audio_buffer) {
-               switch_mutex_lock(cepstral->audio_lock);
-               switch_buffer_zero(cepstral->audio_buffer);
-               switch_mutex_unlock(cepstral->audio_lock);
-       }
-       swift_port_stop(cepstral->port, SWIFT_ASYNC_ANY, SWIFT_EVENT_NOW);
-}
-
-static switch_status_t cepstral_speech_read_tts(switch_speech_handle_t *sh, void *data, size_t *datalen, switch_speech_flag_t *flags)
-{
-       cepstral_t *cepstral;
-       size_t desired = *datalen;
-       switch_status_t status = SWITCH_STATUS_FALSE;
-       size_t used, padding = 0;
-
-       assert(sh != NULL);
-       cepstral = sh->private_info;
-       assert(cepstral != NULL);
-
-       while (!cepstral->done) {
-               if (!cepstral->done_gen) {
-                       int check = swift_port_status(cepstral->port, cepstral->tts_stream);
-
-                       if (!check == SWIFT_STATUS_RUNNING) {
-                               cepstral->done_gen = 1;
-                       }
-               }
-
-               switch_mutex_lock(cepstral->audio_lock);
-               used = switch_buffer_inuse(cepstral->audio_buffer);
-               switch_mutex_unlock(cepstral->audio_lock);
-
-
-               if (!used && cepstral->done_gen) {
-                       status = SWITCH_STATUS_BREAK;
-                       break;
-               }
-
-               /* wait for the right amount of data (unless there is no blocking flag) */
-               if (used < desired) {
-                       if (cepstral->done_gen) {
-                               padding = desired - used;
-                               desired = used;
-                       }
-                       if (!(*flags & SWITCH_SPEECH_FLAG_BLOCKING)) {
-                               *datalen = 0;
-                               status = SWITCH_STATUS_SUCCESS;
-                               break;
-                       }
-                       switch_cond_next();
-                       continue;
-               }
-
-               /* There is enough, read it and return */
-               switch_mutex_lock(cepstral->audio_lock);
-               *datalen = switch_buffer_read(cepstral->audio_buffer, data, desired);
-               if (padding) {
-                       size_t x = 0;
-                       unsigned char *p = data;
-
-                       for (x = 0; x < padding; x++) {
-                               *(p + x) = 0;
-                               (*datalen)++;
-                       }
-               }
-
-               switch_mutex_unlock(cepstral->audio_lock);
-               status = SWITCH_STATUS_SUCCESS;
-
-               break;
-       }
-
-       return status;
-}
-
-static void cepstral_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val)
-{
-       cepstral_t *cepstral;
-
-       cepstral = sh->private_info;
-       assert(cepstral != NULL);
-
-       if (!strcasecmp(param, "voice")) {
-               const char *voice_name = val;
-               if (!strcasecmp(voice_name, "next")) {
-                       if ((cepstral->voice = swift_port_find_next_voice(cepstral->port))) {
-                               if (SWIFT_FAILED(swift_port_set_voice(cepstral->port, cepstral->voice))) {
-                                       cepstral->done = cepstral->done_gen = 1;
-                                       return;
-                               }
-                               voice_name = swift_voice_get_attribute(cepstral->voice, "name");
-                       } else {
-                               voice_name = NULL;
-                       }
-               } else {
-                       if (voice_name && SWIFT_FAILED(swift_port_set_voice_by_name(cepstral->port, voice_name))) {
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid voice %s!\n", voice_name);
-                               voice_name = NULL;
-                       }
-               }
-
-               if (!voice_name) {
-                       /* Find the first voice on the system */
-                       if ((cepstral->voice = swift_port_find_first_voice(cepstral->port, NULL, NULL)) == NULL) {
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find any voices!\n");
-                               cepstral->done = cepstral->done_gen = 1;
-                               return;
-                       }
-
-                       /* Set the voice found by find_first_voice() as the port's current voice */
-                       if (SWIFT_FAILED(swift_port_set_voice(cepstral->port, cepstral->voice))) {
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set voice.\n");
-                               cepstral->done = cepstral->done_gen = 1;
-                               return;
-                       }
-
-                       voice_name = swift_voice_get_attribute(cepstral->voice, "name");
-               }
-
-               if (voice_name) {
-                       switch_copy_string(sh->voice, voice_name, sizeof(sh->voice));
-               }
-
-               return;
-       }
-
-       swift_port_set_param_string(cepstral->port, param, val, NULL);
-}
-
-static void cepstral_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val)
-{
-       cepstral_t *cepstral;
-
-       cepstral = sh->private_info;
-       assert(cepstral != NULL);
-
-       swift_port_set_param_int(cepstral->port, param, val, NULL);
-
-}
-
-
-static void cepstral_float_param_tts(switch_speech_handle_t *sh, char *param, double val)
-{
-       cepstral_t *cepstral;
-
-       cepstral = sh->private_info;
-       assert(cepstral != NULL);
-
-       swift_port_set_param_float(cepstral->port, param, val, NULL);
-
-}
-
-static switch_status_t load_config(void)
-{
-       char *cf = "cepstral.conf";
-       switch_xml_t cfg, xml = NULL, param, settings;
-
-       /* Init to SWIFT default encoding */
-       set_global_encoding(SWIFT_DEFAULT_ENCODING);
-
-       if (xml = switch_xml_open_cfg(cf, &cfg, NULL)) {
-               if ((settings = switch_xml_child(cfg, "settings"))) {
-                       for (param = switch_xml_child(settings, "param"); param; param = param->next) {
-                               char *var = (char *) switch_xml_attr_soft(param, "name");
-                               char *val = (char *) switch_xml_attr_soft(param, "value");
-                               if (!strcasecmp(var, "encoding")) {
-                                       if (!strcasecmp(val, "utf-8")) {
-                                               set_global_encoding(SWIFT_UTF8);
-                                       } else if (!strcasecmp(val, "us-ascii")) {
-                                               set_global_encoding(SWIFT_ASCII);
-                                       } else if (!strcasecmp(val, "iso8859-1")) {
-                                               set_global_encoding(SWIFT_ISO_8859_1);
-                                       } else if (!strcasecmp(val, "iso8859-15")) {
-                                               set_global_encoding(SWIFT_ISO_8859_15);
-                                       } else {
-                                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown value \"%s\" for param \"%s\". Setting to default.\n", val, var);
-                                       }
-                               } else {
-                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Param \"%s\" unknown\n", var);
-                               }
-                       }
-               }
-        } else {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Open of \"%s\" failed. Using default settings.\n", cf);
-       }
-
-       if (xml) {
-               switch_xml_free(xml);
-       }
-
-       return SWITCH_STATUS_SUCCESS;
-}
-
-SWITCH_MODULE_LOAD_FUNCTION(mod_cepstral_load)
-{
-       switch_speech_interface_t *speech_interface;
-
-       memset(&globals, 0, sizeof(globals));
-       load_config();
-
-       /* Open the Swift TTS Engine */
-       if (!(engine = swift_engine_open(NULL))) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open Swift Engine.");
-               return SWITCH_STATUS_GENERR;
-       }
-
-       /* connect my internal structure to the blank pointer passed to me */
-       *module_interface = switch_loadable_module_create_module_interface(pool, modname);
-       speech_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SPEECH_INTERFACE);
-       speech_interface->interface_name = "cepstral";
-       speech_interface->speech_open = cepstral_speech_open;
-       speech_interface->speech_close = cepstral_speech_close;
-       speech_interface->speech_feed_tts = cepstral_speech_feed_tts;
-       speech_interface->speech_read_tts = cepstral_speech_read_tts;
-       speech_interface->speech_flush_tts = cepstral_speech_flush_tts;
-       speech_interface->speech_text_param_tts = cepstral_text_param_tts;
-       speech_interface->speech_numeric_param_tts = cepstral_numeric_param_tts;
-       speech_interface->speech_float_param_tts = cepstral_float_param_tts;
-
-       /* indicate that the module should continue to be loaded */
-       return SWITCH_STATUS_SUCCESS;
-}
-
-/* For Emacs:
- * Local Variables:
- * mode:c
- * indent-tabs-mode:t
- * tab-width:4
- * c-basic-offset:4
- * End:
- * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
- */