From b6bff5c93a798dcb552289c78cd33dcc7768883a Mon Sep 17 00:00:00 2001 From: Doug McLain Date: Sun, 21 Nov 2021 18:12:58 -0500 Subject: [PATCH] Finish adding Flite Text-to-sppech support --- DroidStar.pro | 149 ++++++++++++++++++------------------ MainTab.qml | 86 ++++++++++++++++++++- README.md | 2 +- android/AndroidManifest.xml | 2 +- dcscodec.h | 1 - dmrcodec.cpp | 2 +- droidstar.cpp | 32 ++++++++ droidstar.h | 6 ++ iaxcodec.h | 1 - main.cpp | 6 ++ p25codec.cpp | 2 +- p25codec.h | 1 - refcodec.cpp | 2 - refcodec.h | 1 - serialmodem.cpp | 1 - xrfcodec.h | 1 - 16 files changed, 206 insertions(+), 89 deletions(-) diff --git a/DroidStar.pro b/DroidStar.pro index 6a563c5..cdae746 100644 --- a/DroidStar.pro +++ b/DroidStar.pro @@ -12,6 +12,7 @@ win32:LIBS += -L/mnt/data/src/mxe/usr/lib64 win32:QMAKE_LFLAGS += -static QMAKE_LFLAGS_WINDOWS += --enable-stdcall-fixup RC_ICONS = images/droidstar.ico +ICON = images/droidstar.icns macx:QT += serialport macx::INCLUDEPATH += /usr/local/include macx:LIBS += -L/usr/local/lib -framework AVFoundation @@ -24,80 +25,6 @@ DEFINES += VERSION_NUMBER=\"\\\"$${VERSION_BUILD}\\\"\" DEFINES += QT_DEPRECATED_WARNINGS #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += USE_FLITE -ICON = images/droidstar.icns - -SOURCES += \ - CRCenc.cpp \ - DMRData.cpp \ - Golay24128.cpp \ - M17Convolution.cpp \ - SHA256.cpp \ - YSFConvolution.cpp \ - YSFFICH.cpp \ - androidserialport.cpp \ - audioengine.cpp \ - cbptc19696.cpp \ - cgolay2087.cpp \ - chamming.cpp \ - codec.cpp \ - codec2/codebooks.cpp \ - codec2/codec2.cpp \ - codec2/kiss_fft.cpp \ - codec2/lpc.cpp \ - codec2/nlp.cpp \ - codec2/pack.cpp \ - codec2/qbase.cpp \ - codec2/quantise.cpp \ - crs129.cpp \ - dcscodec.cpp \ - dmrcodec.cpp \ - droidstar.cpp \ - httpmanager.cpp \ - iaxcodec.cpp \ - m17codec.cpp \ - main.cpp \ - nxdncodec.cpp \ - p25codec.cpp \ - refcodec.cpp \ - serialambe.cpp \ - serialmodem.cpp \ - xrfcodec.cpp \ - ysfcodec.cpp -macx:OBJECTIVE_SOURCES += micpermission.mm -ios:OBJECTIVE_SOURCES += micpermission.mm -RESOURCES += qml.qrc - -QML_IMPORT_PATH = -QML_DESIGNER_IMPORT_PATH = - -# Default rules for deployment. -qnx: target.path = /tmp/$${TARGET}/bin -else: unix:!android: target.path = /opt/$${TARGET}/bin -!isEmpty(target.path): INSTALLS += target - -DISTFILES += \ - android/AndroidManifest.xml \ - android/build.gradle \ - android/gradle/wrapper/gradle-wrapper.jar \ - android/gradle/wrapper/gradle-wrapper.properties \ - android/gradlew \ - android/gradlew.bat \ - android/res/values/libs.xml \ - images/log.png - -contains(ANDROID_TARGET_ARCH,armeabi-v7a) { - LIBS += -L$$(HOME)/Android/local/lib - ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android - OTHER_FILES += android/src -} - -contains(ANDROID_TARGET_ARCH,arm64-v8a) { - LIBS += -L$$(HOME)/Android/local/lib64 - ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android - OTHER_FILES += android/src -} - -ANDROID_ABIS = armeabi-v7a arm64-v8a HEADERS += \ CRCenc.h \ @@ -142,6 +69,80 @@ HEADERS += \ ysfcodec.h macx:HEADERS += micpermission.h +SOURCES += \ + CRCenc.cpp \ + DMRData.cpp \ + Golay24128.cpp \ + M17Convolution.cpp \ + SHA256.cpp \ + YSFConvolution.cpp \ + YSFFICH.cpp \ + androidserialport.cpp \ + audioengine.cpp \ + cbptc19696.cpp \ + cgolay2087.cpp \ + chamming.cpp \ + codec.cpp \ + codec2/codebooks.cpp \ + codec2/codec2.cpp \ + codec2/kiss_fft.cpp \ + codec2/lpc.cpp \ + codec2/nlp.cpp \ + codec2/pack.cpp \ + codec2/qbase.cpp \ + codec2/quantise.cpp \ + crs129.cpp \ + dcscodec.cpp \ + dmrcodec.cpp \ + droidstar.cpp \ + httpmanager.cpp \ + iaxcodec.cpp \ + m17codec.cpp \ + main.cpp \ + nxdncodec.cpp \ + p25codec.cpp \ + refcodec.cpp \ + serialambe.cpp \ + serialmodem.cpp \ + xrfcodec.cpp \ + ysfcodec.cpp + +macx:OBJECTIVE_SOURCES += micpermission.mm +ios:OBJECTIVE_SOURCES += micpermission.mm +RESOURCES += qml.qrc + +QML_IMPORT_PATH = +QML_DESIGNER_IMPORT_PATH = + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + +DISTFILES += \ + android/AndroidManifest.xml \ + android/build.gradle \ + android/gradle/wrapper/gradle-wrapper.jar \ + android/gradle/wrapper/gradle-wrapper.properties \ + android/gradlew \ + android/gradlew.bat \ + android/res/values/libs.xml \ + images/log.png + +contains(ANDROID_TARGET_ARCH,armeabi-v7a) { + LIBS += -L$$(HOME)/Android/local/lib + ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android + OTHER_FILES += android/src +} + +contains(ANDROID_TARGET_ARCH,arm64-v8a) { + LIBS += -L$$(HOME)/Android/local/lib64 + ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android + OTHER_FILES += android/src +} + +ANDROID_ABIS = armeabi-v7a arm64-v8a + contains(DEFINES, USE_FLITE){ LIBS += -lflite_cmu_us_slt -lflite_cmu_us_kal16 -lflite_cmu_us_awb -lflite_cmu_us_rms -lflite_usenglish -lflite_cmulex -lflite -lasound } diff --git a/MainTab.qml b/MainTab.qml index a2032a0..22e90ec 100644 --- a/MainTab.qml +++ b/MainTab.qml @@ -23,7 +23,25 @@ import QtQuick.Controls 2.3 Item { id: mainTab - property int rows: 18; + //property int rows: 18; + //property bool tts: false; + property int rows: { + if(USE_FLITE){ + rows = 20; + } + else{ + rows = 18; + } + } + property bool tts: { + if(USE_FLITE){ + tts = true; + } + else{ + tts = false; + } + } + onWidthChanged:{ if(_comboMode.currentText == "DMR"){ _comboMode.width = (mainTab.width / 5) - 5; @@ -616,7 +634,69 @@ Item { border.width: 1 radius: 5 } - + ButtonGroup { + id: ttsvoicegroup + onClicked: { + droidstar.tts_changed(button.text); + } + } + CheckBox { + id: mic + visible: tts ? true : false; + x: 5 + y: (parent.height / rows + 1) * 15; + height: 25 + spacing: 1 + text: qsTr("Mic") + checked: true + ButtonGroup.group: ttsvoicegroup + } + CheckBox { + id: tts1 + visible: tts ? true : false; + x: parent.width / 4 + y: (parent.height / rows + 1) * 15; + height: 25 + spacing: 1 + text: qsTr("TTS1") + ButtonGroup.group: ttsvoicegroup + } + CheckBox { + id: tts2 + visible: tts ? true : false; + x: parent.width * 2 / 4 + y: (parent.height / rows + 1) * 15; + height: 25 + spacing: 1 + text: qsTr("TTS2") + checked: true + ButtonGroup.group: ttsvoicegroup + } + CheckBox { + id: tts3 + visible: tts ? true : false; + x: parent.width * 3 / 4 + y: (parent.height / rows + 1) * 15; + height: 25 + spacing: 1 + text: qsTr("TTS3") + ButtonGroup.group: ttsvoicegroup + } + TextField { + id: _ttstxtedit + visible: tts ? true : false; + x: 5 + y: (parent.height / rows + 1) * 16; + width: parent.width - 10 + height: parent.height / rows + font.pixelSize: parent.height / 35 + selectByMouse: true + inputMethodHints: "ImhPreferNumbers" + text: qsTr("") + onEditingFinished: { + droidstar.tts_text_changed(_ttstxtedit.text) + } + } Button { Timer { id: _txtimer @@ -649,7 +729,7 @@ Item { } } x: 10 - y: (parent.height / rows + 1) * 15; + y: (parent.height / rows + 1) * ( tts ? 17 : 15); //y: parent.height - ((parent.height / 5) + 5); width: parent.width - 20 height: parent.height - y - 10 diff --git a/README.md b/README.md index 6e6f1cb..384089b 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ Port: UDP port of node, usually 4569. Add DTMF commands like \*3node, \*1node, \*70, etc in the IAX DTMF box and hit send to send the DTMF string. The asterisk (*) character is already added on the Droidstar app, so only input the numeric portion of the command (70 instead of *70, etc). Details on various commands can be found at the AllStar wiki and others. # General building instructions -This software is written primarily in C++ on Linux and requires Qt5 >= Qt5.15, and natually the devel packages to build. Java, QML (Javascript based), and C# code is also used where necessary. The preffered way to obtain Qt 5.15 is to use the Qt open source online installer from the Qt website. Run this installer as a user (not root) to keep the Qt installation separate from your system libs. Select the option as shown in this pic https://imgur.com/i0WuFCY which will install everything under ~/Qt. +This software is written primarily in C++ on Linux and requires Qt5 >= Qt5.15, and natually the devel packages to build. Java, QML (Javascript based), and C# code is also used where necessary. The preferred way to obtain Qt 5.15 is to use the Qt open source online installer from the Qt website. Run this installer as a user (not root) to keep the Qt installation separate from your system libs. Select the option as shown in this pic https://imgur.com/i0WuFCY which will install everything under ~/Qt. ## Note for building on Raspbian/RaspiOS The Qt online installer does not support RPi, but fortunately there is a great Qt 5.15.2 installer for RaspiOS: diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index fd8b2a2..ee99e5a 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,5 +1,5 @@ - +