summaryrefslogtreecommitdiff
path: root/src/speech
diff options
context:
space:
mode:
authorasanoaozora <fifitaneki@hotmail.com>2016-12-15 17:37:28 +0100
committerasanoaozora <fifitaneki@hotmail.com>2016-12-15 17:37:28 +0100
commit3c6e487547e7692fe7e7fd30d4531a496680ee7d (patch)
treeb481a5ae00885fba36c8edff3f61f33ca05f1a3c /src/speech
parent5620ee809fc37bf862bf504fc9ed5f05e9a12fba (diff)
downloadpoi-service-3c6e487547e7692fe7e7fd30d4531a496680ee7d.tar.gz
apply patch for layer manager update
Diffstat (limited to 'src/speech')
-rw-r--r--src/speech/CMakeLists.txt4
-rw-r--r--src/speech/README.md45
-rwxr-xr-xsrc/speech/build.sh69
-rw-r--r--src/speech/main.cpp24
-rwxr-xr-xsrc/speech/run.sh3
-rwxr-xr-xsrc/speech/test-speech-capi.py15
6 files changed, 146 insertions, 14 deletions
diff --git a/src/speech/CMakeLists.txt b/src/speech/CMakeLists.txt
index 5e092ba..f8d73ab 100644
--- a/src/speech/CMakeLists.txt
+++ b/src/speech/CMakeLists.txt
@@ -40,8 +40,8 @@ endif()
# Packages
find_package(PkgConfig REQUIRED)
-find_package(CommonAPI 3.1.5 REQUIRED)
-find_package(CommonAPI-DBus 3.1.5 REQUIRED)
+find_package(CommonAPI)
+find_package(CommonAPI)
#pkg_check_modules(DBUS "dbus-1 >= 1.8.4") // #to be fixed, it doesn't work so the paths are set manually (see above)
pkg_check_modules(COMMONAPI "CommonAPI >= 3.1.5")
diff --git a/src/speech/README.md b/src/speech/README.md
new file mode 100644
index 0000000..4d64503
--- /dev/null
+++ b/src/speech/README.md
@@ -0,0 +1,45 @@
+# Speech Output Service middleware: CommonAPI based POC
+
+## Synopsis
+This folder contains the server part of the proof of concepts (POC) for the Speech Output Service interfaces, based on CommonAPI
+
+##Tested targets
+Desktop: Tested under Ubuntu 16.04 LTS 64 bits
+
+## Prerequisites
+You need CommonAPI 3.1.9 and Franca 0.9.1 installed
+For the Ubuntu 64 bits, due to the use of symbol versioning LIBDBUS_1_0 by CommonAPI-DBus, the patched version of DBus has to be >= 1.10.0
+NB: In case you migrate from 3.1.5 to 3.1.9, due to a cmake issue (wrong management of micro version), it's necessary to do:
+```
+sudo mv /usr/local/lib/cmake/CommonAPI-3.1.5 /usr/local/lib/cmake/oldCommonAPI-3.1.5
+```
+Symbolic links are also not well managed, so you need to fix it:
+```
+sudo ln -sfn /usr/local/lib/libCommonAPI.so.3.1.9 /usr/local/lib/libCommonAPI.so.3
+sudo ln -sfn /usr/local/lib/libCommonAPI-DBus.so.3.1.9 /usr/local/lib/libCommonAPI-DBus.so.3
+```
+
+NB: the patch common-api-dbus-runtime/src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch may fail a little bit, in that case it's needed to update the dbus/dbus-string.h manually
+
+## How to build
+First it's required to set some paths:
+```
+export DBUS_LIB_PATH=<path to the patched version of the DBus lib>
+export COMMONAPI_DBUS_TOOL_DIR=<path to the common-api-dbus-tools folder>
+export COMMONAPI_TOOL_DIR=<path to the common-api-tools folder>
+```
+A script allows either:
+to clean and rebuild all (including invoking cmake)
+```./build.sh -c```
+or to build updated parts
+```./build.sh```
+
+## How To Run
+```./run.sh &```
+
+## How To Test
+```./test-speech-capi.py```
+
+## License
+
+Mozilla Public License Version 2.0
diff --git a/src/speech/build.sh b/src/speech/build.sh
new file mode 100755
index 0000000..0533402
--- /dev/null
+++ b/src/speech/build.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+commonapi_tools_option=""
+clean=0
+
+while getopts cdh opt
+do
+ case $opt in
+ c)
+ clean=1
+ ;;
+ d)
+ debug="ON"
+ ;;
+ h)
+ echo "Usage:"
+ echo "$0 [-cd]"
+ echo "-c: Rebuild with clean"
+ echo "-d: Enable the debug messages"
+ exit 1
+ esac
+done
+set -e
+
+if [ ! $COMMONAPI_TOOL_DIR ]
+then
+ echo 'Set the dir of the common api tools'
+ echo 'export COMMONAPI_TOOL_DIR=<path>'
+ exit 1
+fi
+
+if [ ! $COMMONAPI_DBUS_TOOL_DIR ]
+then
+ echo 'Set the dir of the common api dbus tools'
+ echo 'export COMMONAPI_DBUS_TOOL_DIR=<path>'
+ exit 1
+fi
+
+if [ ! $DBUS_LIB_PATH ]
+then
+ echo 'Set the dir of the patched dbus'
+ echo 'export DBUS_LIB_PATH=<path>'
+ exit 1
+fi
+
+commonapi_tools_option="-DDBUS_LIB_PATH="$DBUS_LIB_PATH" -DCOMMONAPI_DBUS_TOOL_DIR="$COMMONAPI_DBUS_TOOL_DIR" -DCOMMONAPI_TOOL_DIR="$COMMONAPI_TOOL_DIR
+
+
+if [ "$clean" = 1 ]
+then
+ echo 'clean up the build folder'
+ if [ -d "./build" ]
+ then
+ find ./build ! -name '*.cbp' -type f -exec rm -f {} +
+ fi
+fi
+
+
+mkdir -p build
+cd build
+
+echo 'build speech-output-server'
+if [ "$clean" = 1 ]
+then
+ cmake $commonapi_tools_option -DWITH_DEBUG=$debug ../
+fi
+make
+
+
diff --git a/src/speech/main.cpp b/src/speech/main.cpp
index bddada8..261cd5a 100644
--- a/src/speech/main.cpp
+++ b/src/speech/main.cpp
@@ -2,13 +2,15 @@
* @licence app begin@
* SPDX-License-Identifier: MPL-2.0
*
-* \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen
+* \copyright Copyright (C) 2013-2017, PCA Peugeot Citroen
*
* \file main.cpp
*
* \brief This file is part of the speech proof of concept.
*
* \author Philippe Colliot <philippe.colliot@mpsa.com>
+* \brief Some parts of the code has been inspired by the following people:
+* \brief Mario Thielert, David Kämpf, Dominique Massonie
*
* \version 1.1
*
@@ -97,6 +99,22 @@ static std::string m_chunkBuffer; /** max size = MAX_CHUNK_SIZE*MAX_SLOT_COUNT *
int last, cst_audio_streaming_info_struct *asi)
{
printf("\n>>> [server] fliteCallback()\n");
+ printf("start: %d size: %d last: %d \n",start,size,last);
+ static cst_audiodev *ad = 0;
+
+ if (start == 0)
+ ad = audio_open(w->sample_rate,w->num_channels,CST_AUDIO_LINEAR16);
+
+ audio_write(ad,&w->samples[start],size*sizeof(short));
+
+ if (last == 1)
+ {
+ audio_close(ad);
+ ad = NULL;
+ }
+
+ /* if you want to stop return CST_AUDIO_STREAM_STOP */
+ return CST_AUDIO_STREAM_CONT;
}
class SpeechOutputServerStub
@@ -117,11 +135,11 @@ public:
flite_init();
mp_voice = register_cmu_us_kal(NULL);
-/* mp_asi = new_audio_streaming_info();
+ mp_asi = new_audio_streaming_info();
mp_asi->asc = fliteCallback;
feat_set(mp_voice->features,"streaming_info",audio_streaming_info_val(mp_asi));
-*/
+
}
~SpeechOutputServerStub() {
diff --git a/src/speech/run.sh b/src/speech/run.sh
new file mode 100755
index 0000000..6a6126d
--- /dev/null
+++ b/src/speech/run.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+./bin/speech-output-server
+
diff --git a/src/speech/test-speech-capi.py b/src/speech/test-speech-capi.py
index 3ed92e1..7fc4bb0 100755
--- a/src/speech/test-speech-capi.py
+++ b/src/speech/test-speech-capi.py
@@ -33,9 +33,6 @@ import time
import pdb;
#pdb.set_trace()
#constants as defined in the Navigation API
-GENIVI_Configuration_Settings_LOCALE = 37
-GENIVI_SearchStatusState_FINISHED = 1298
-GENIVI_SearchStatusState_NOT_STARTED = 1296
#constants used into the script
TIME_OUT = 10000
@@ -65,20 +62,20 @@ if __name__ == '__main__':
bus = dbus.SessionBus()
bus.add_signal_receiver(catch_speech_notifyConnectionStatus_signal_handler, \
- dbus_interface = "org.genivi.hmi.speechoutputservice.SpeechOutput", \
+ dbus_interface = "org.genivi.hmi.speechoutputservice.SpeechOutput.v4_0", \
signal_name = "notifyConnectionStatus")
bus.add_signal_receiver(catch_speech_notifyMarkerReached_signal_handler, \
- dbus_interface = "org.genivi.hmi.speechoutputservice.SpeechOutput", \
+ dbus_interface = "org.genivi.hmi.speechoutputservice.SpeechOutput.v4_0", \
signal_name = "notifyMarkerReached")
bus.add_signal_receiver(catch_speech_notifyQueueStatus_signal_handler, \
- dbus_interface = "org.genivi.hmi.speechoutputservice.SpeechOutput", \
+ dbus_interface = "org.genivi.hmi.speechoutputservice.SpeechOutput.v4_0", \
signal_name = "notifyQueueStatus")
bus.add_signal_receiver(catch_speech_notifyTTSStatus_signal_handler, \
- dbus_interface = "org.genivi.hmi.speechoutputservice.SpeechOutput", \
+ dbus_interface = "org.genivi.hmi.speechoutputservice.SpeechOutput.v4_0", \
signal_name = "notifyTTSStatus")
-speech = bus.get_object('org.genivi.hmi.speechoutputservice.SpeechOutput_SpeechOutput','/SpeechOutput')
-g_speech_interface = dbus.Interface(speech, dbus_interface='org.genivi.hmi.speechoutputservice.SpeechOutput')
+speech = bus.get_object('org.genivi.hmi.speechoutputservice.SpeechOutput.v4_0_SpeechOutput','/SpeechOutput')
+g_speech_interface = dbus.Interface(speech, dbus_interface='org.genivi.hmi.speechoutputservice.SpeechOutput.v4_0')
g_speech_interface.addTextChunk(dbus.String("Hello"))