diff --git a/AboutTab.qml b/AboutTab.qml index cf09ca0..89c111c 100644 --- a/AboutTab.qml +++ b/AboutTab.qml @@ -15,7 +15,7 @@ along with this program. If not, see . */ -import QtQuick 2.10 +import QtQuick Item { id: aboutTab diff --git a/DroidStar.pro b/DroidStar.pro index e87e975..30aa841 100644 --- a/DroidStar.pro +++ b/DroidStar.pro @@ -1,14 +1,8 @@ QT += quick quickcontrols2 network multimedia -equals(QT_MAJOR_VERSION, 5){ - android:QT += androidextras -} - unix:!ios:QT += serialport -CONFIG += c++17 -LFLAGS += -!win32:LIBS += -ldl win32:QT += serialport +!win32:LIBS += -ldl win32:LIBS += -lws2_32 win32:QMAKE_LFLAGS += -static QMAKE_LFLAGS_WINDOWS += --enable-stdcall-fixup @@ -31,10 +25,76 @@ VERSION_BUILD='$(shell cd $$PWD;git rev-parse --short HEAD)' DEFINES += VERSION_NUMBER=\"\\\"$${VERSION_BUILD}\\\"\" DEFINES += QT_DEPRECATED_WARNINGS #DEFINES += QT_DEBUG_PLUGINS=1 -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += VOCODER_PLUGIN #DEFINES += USE_FLITE #DEFINES += USE_EXTERNAL_CODEC2 +#DEFINES += USE_MD380_VOCODER + +SOURCES += \ + CRCenc.cpp \ + Golay24128.cpp \ + M17Convolution.cpp \ + SHA256.cpp \ + YSFConvolution.cpp \ + YSFFICH.cpp \ + audioengine.cpp \ + cbptc19696.cpp \ + cgolay2087.cpp \ + chamming.cpp \ + crs129.cpp \ + dcs.cpp \ + dmr.cpp \ + droidstar.cpp \ + httpmanager.cpp \ + iax.cpp \ + imbe_vocoder/aux_sub.cc \ + imbe_vocoder/basicop2.cc \ + imbe_vocoder/ch_decode.cc \ + imbe_vocoder/ch_encode.cc \ + imbe_vocoder/dc_rmv.cc \ + imbe_vocoder/decode.cc \ + imbe_vocoder/dsp_sub.cc \ + imbe_vocoder/encode.cc \ + imbe_vocoder/imbe_vocoder.cc \ + imbe_vocoder/imbe_vocoder_impl.cc \ + imbe_vocoder/math_sub.cc \ + imbe_vocoder/pe_lpf.cc \ + imbe_vocoder/pitch_est.cc \ + imbe_vocoder/pitch_ref.cc \ + imbe_vocoder/qnt_sub.cc \ + imbe_vocoder/rand_gen.cc \ + imbe_vocoder/sa_decode.cc \ + imbe_vocoder/sa_encode.cc \ + imbe_vocoder/sa_enh.cc \ + imbe_vocoder/tbls.cc \ + imbe_vocoder/uv_synt.cc \ + imbe_vocoder/v_synt.cc \ + imbe_vocoder/v_uv_det.cc \ + m17.cpp \ + main.cpp \ + mode.cpp \ + nxdn.cpp \ + p25.cpp \ + ref.cpp \ + xrf.cpp \ + ysf.cpp +android:SOURCES += androidserialport.cpp +!ios:SOURCES += serialambe.cpp serialmodem.cpp + +resources.files = main.qml AboutTab.qml HostsTab.qml LogTab.qml MainTab.qml SettingsTab.qml +resources.prefix = /$${TARGET} +RESOURCES += resources + +# Additional import path used to resolve QML modules in Qt Creator's code model +QML_IMPORT_PATH = + +# Additional import path used to resolve QML modules just for Qt Quick Designer +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 HEADERS += \ CRCenc.h \ @@ -93,60 +153,7 @@ HEADERS += \ vocoder_plugin.h \ xrf.h \ ysf.h -android:HEADERS += androidserialport.h -macx:HEADERS += micpermission.h -!ios:HEADERS += serialambe.h serialmodem.h -SOURCES += \ - CRCenc.cpp \ - Golay24128.cpp \ - M17Convolution.cpp \ - SHA256.cpp \ - YSFConvolution.cpp \ - YSFFICH.cpp \ - audioengine.cpp \ - cbptc19696.cpp \ - cgolay2087.cpp \ - chamming.cpp \ - crs129.cpp \ - dcs.cpp \ - dmr.cpp \ - droidstar.cpp \ - httpmanager.cpp \ - iax.cpp \ - imbe_vocoder/aux_sub.cc \ - imbe_vocoder/basicop2.cc \ - imbe_vocoder/ch_decode.cc \ - imbe_vocoder/ch_encode.cc \ - imbe_vocoder/dc_rmv.cc \ - imbe_vocoder/decode.cc \ - imbe_vocoder/dsp_sub.cc \ - imbe_vocoder/encode.cc \ - imbe_vocoder/imbe_vocoder.cc \ - imbe_vocoder/imbe_vocoder_impl.cc \ - imbe_vocoder/math_sub.cc \ - imbe_vocoder/pe_lpf.cc \ - imbe_vocoder/pitch_est.cc \ - imbe_vocoder/pitch_ref.cc \ - imbe_vocoder/qnt_sub.cc \ - imbe_vocoder/rand_gen.cc \ - imbe_vocoder/sa_decode.cc \ - imbe_vocoder/sa_encode.cc \ - imbe_vocoder/sa_enh.cc \ - imbe_vocoder/tbls.cc \ - imbe_vocoder/uv_synt.cc \ - imbe_vocoder/v_synt.cc \ - imbe_vocoder/v_uv_det.cc \ - m17.cpp \ - main.cpp \ - mode.cpp \ - nxdn.cpp \ - p25.cpp \ - ref.cpp \ - xrf.cpp \ - ysf.cpp -android:SOURCES += androidserialport.cpp -!ios:SOURCES += serialambe.cpp serialmodem.cpp !contains(DEFINES, USE_EXTERNAL_CODEC2){ HEADERS += \ codec2/codec2_api.h \ @@ -189,44 +196,15 @@ SOURCES += \ mbe/vocoder_plugin.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 +android:HEADERS += androidserialport.h +macx:HEADERS += micpermission.h +!ios:HEADERS += serialambe.h serialmodem.h +android:ANDROID_VERSION_CODE = 79 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 = arm64-v8a -} - -#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 } -ios:HEADERS += micpermission.h diff --git a/HostsTab.qml b/HostsTab.qml index 7300d06..03e21c5 100644 --- a/HostsTab.qml +++ b/HostsTab.qml @@ -15,8 +15,8 @@ along with this program. If not, see . */ -import QtQuick 2.10 -import QtQuick.Controls 2.3 +import QtQuick +import QtQuick.Controls Item { id: hostsTab diff --git a/LogTab.qml b/LogTab.qml index 60dcb5c..df9c5d6 100644 --- a/LogTab.qml +++ b/LogTab.qml @@ -15,8 +15,8 @@ along with this program. If not, see . */ -import QtQuick 2.10 -import QtQuick.Controls 2.3 +import QtQuick +import QtQuick.Controls Item { id: logTab diff --git a/MainTab.qml b/MainTab.qml index b541d63..150a160 100644 --- a/MainTab.qml +++ b/MainTab.qml @@ -15,11 +15,8 @@ along with this program. If not, see . */ -import QtQuick 2.10 -//import QtQuick.Window 2.15 -import QtQuick.Controls 2.3 -//import QtQuick.Dialogs 1.3 -//import org.dudetronics.droidstar 1.0 +import QtQuick +import QtQuick.Controls Item { id: mainTab diff --git a/README.md b/README.md index 6d7f0c2..530ecd4 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Latitude/Longitude/Location/Description: These are DMR config options, sent to DMR+ IPSC2 hosts: The format for the DMR+ options string is the complete string including 'Options='. Create your options string and check 'Send DMR+ options on connect' before connecting. A description of the DMR+ options string can be found here: https://github.com/g4klx/MMDVMHost/blob/master/DMRplus_startup_options.md . -Talkgroup: For DMR, enter the talkgroup ID number. A very active TG for testing functionality on Brandmeister is 91 (Brandmeister Worldwide). You must TX with a talkgroup entered to link to that talkgroup, just like a real radio. Any ststics you have defined in BM selfcare will work the same way they do if you were using a hotspot/radio. +Talkgroup: For DMR, enter the talkgroup ID number. A very active TG for testing functionality on Brandmeister is 91 (Brandmeister Worldwide). You must TX with a talkgroup entered to link to that talkgroup, just like a real radio. Any statics you have defined in BM selfcare will work the same way they do if you were using a hotspot/radio. MYCALL/URCALL/RPTR1/RPTR2 are for Dstar modes REF/DCS/XRF. These fields need to be entered correctly before attempting to TX on any DSTAR reflector. All fields are populated with suggested values upon connect, but can still be modified for advanced users. RPT2 is always overwritten with the current reflector upon connected. @@ -63,33 +63,38 @@ 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. 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 or Qt6 >= Qt6.3, 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 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 Qt6 >= Qt6.4, and naturally the devel packages to build. Java, QML (Javascript based), and C# code is also used where necessary. The preferred way to obtain Qt 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. -In an effort to encourage others to build from source on multiple platforms, there are no longer any external build dependencies. In order to build DroidStar with no internal AMBE vocider, uncomment the the following line in the DroidStar.pro file: +In an effort to encourage others to build from source on multiple platforms, there are no longer any external build dependencies. In order to build DroidStar with no internal AMBE vocoder, uncomment the the following line in the DroidStar.pro file: ``` DEFINES+=VOCODER_PLUGIN ``` Building DroidStar with this line commented out will build with internal AMBE support. If you choose to do this, it is your responsibility to determine if you will violate any patents in your area. -## 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: - -https://github.com/koendv/qt5-opengl-raspberrypi - -This installer puts everything in the same place as the Qt installer, so build instructions are the same for all: +## Note for building on RaspiOS (Also applies to debian based Linux desktops) +The following commands should install everything necessary to build and run DroidStar: +``` +sudo apt install libqt6* +sudo apt install qml6* +sudo apt install qt6-*-dev +``` +Then to build: ``` +git clone https://github.com/nostar/DroidStar.git cd DroidStar mkdir build cd build -/usr/lib/qt5.15.2/bin/qmake .. +qmake6 ../DroidStar.pro make ``` - -And if pulseaudio is not currently installed: +If building an an arm based platform like rpi, the md380 vocoder can be used. In order to build with this, uncomment the following line in DroidStar.pro: ``` -sudo apt-get install pulseaudio +#DEFINES += USE_MD380_VOCODER ``` +This requires the md380_vocoder library to be installed: https://github.com/nostar/md380_vocoder +You must make sure that you are not in violation of any patent laws in your area if you decide to use this. + My primary development platform is Fedora Linux. With a proper build environment, the build instructions apply to all other platforms/distributions, including Windows and macOS. All of the gradle build files are provided to create an APK file ready to be installed on an Android device. A proper Android build system including the Android NDK is required and beyond the scope of this document. diff --git a/SettingsTab.qml b/SettingsTab.qml index c5e8f87..2041f30 100644 --- a/SettingsTab.qml +++ b/SettingsTab.qml @@ -15,8 +15,8 @@ along with this program. If not, see . */ -import QtQuick 2.10 -import QtQuick.Controls 2.3 +import QtQuick +import QtQuick.Controls Item { id: settingsTab diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 1c7284a..6f4d27e 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,76 +1,21 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/android/build.gradle b/android/build.gradle index b7c11c4..34c0843 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,64 +1,82 @@ -buildscript { - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.0.0' - } -} - -repositories { - google() - jcenter() -} - -apply plugin: 'com.android.application' - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) -} - -android { - /******************************************************* - * The following variables: - * - androidBuildToolsVersion, - * - androidCompileSdkVersion - * - qt5AndroidDir - holds the path to qt android files - * needed to build any Qt application - * on Android. - * - * are defined in gradle.properties file. This file is - * updated by QtCreator and androiddeployqt tools. - * Changing them manually might break the compilation! - *******************************************************/ - - compileSdkVersion androidCompileSdkVersion.toInteger() - - buildToolsVersion '28.0.3' - defaultConfig { - targetSdkVersion 34 - } - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java'] - aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl'] - res.srcDirs = [qt5AndroidDir + '/res', 'res'] - resources.srcDirs = ['resources'] - renderscript.srcDirs = ['src'] - assets.srcDirs = ['assets'] - jniLibs.srcDirs = ['libs'] - } - } - - lintOptions { - abortOnError false - } - - // Do not compress Qt binary resources file - aaptOptions { - noCompress 'rcc' - } -} +buildscript { + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.4.1' + } +} + +repositories { + google() + mavenCentral() +} + +apply plugin: 'com.android.application' + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) + implementation 'androidx.core:core:1.10.1' +} + +android { + /******************************************************* + * The following variables: + * - androidBuildToolsVersion, + * - androidCompileSdkVersion + * - qtAndroidDir - holds the path to qt android files + * needed to build any Qt application + * on Android. + * + * are defined in gradle.properties file. This file is + * updated by QtCreator and androiddeployqt tools. + * Changing them manually might break the compilation! + *******************************************************/ + + compileSdkVersion androidCompileSdkVersion + buildToolsVersion androidBuildToolsVersion + ndkVersion androidNdkVersion + + // Extract native libraries from the APK + packagingOptions.jniLibs.useLegacyPackaging true + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = [qtAndroidDir + '/src', 'src', 'java'] + aidl.srcDirs = [qtAndroidDir + '/src', 'src', 'aidl'] + res.srcDirs = [qtAndroidDir + '/res', 'res'] + resources.srcDirs = ['resources'] + renderscript.srcDirs = ['src'] + assets.srcDirs = ['assets'] + jniLibs.srcDirs = ['libs'] + } + } + + tasks.withType(JavaCompile) { + options.incremental = true + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + lintOptions { + abortOnError false + } + + // Do not compress Qt binary resources file + aaptOptions { + noCompress 'rcc' + } + + defaultConfig { + resConfig "en" + minSdkVersion qtMinSdkVersion + targetSdkVersion qtTargetSdkVersion + ndk.abiFilters = qtTargetAbiList.split(",") + } +} diff --git a/android/gradle.properties b/android/gradle.properties index 646c51b..82e3f93 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,2 +1,18 @@ -android.useAndroidX=true -android.enableJetifier=true +# Project-wide Gradle settings. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2500m -XX:MaxMetaspaceSize=768m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# Enable building projects in parallel +org.gradle.parallel=true + +# Gradle caching allows reusing the build artifacts from a previous +# build with the same inputs. However, over time, the cache size will +# grow. Uncomment the following line to enable it. +#org.gradle.caching=true +#org.gradle.configuration-cache=true + +# Allow AndroidX usage +android.useAndroidX=true diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar index f6b961f..7f93135 100644 Binary files a/android/gradle/wrapper/gradle-wrapper.jar and b/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index fbce071..1237eca 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-all.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/android/gradlew b/android/gradlew old mode 100755 new mode 100644 index cccdd3d..c22a517 --- a/android/gradlew +++ b/android/gradlew @@ -1,78 +1,127 @@ -#!/usr/bin/env sh +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -81,92 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" fi +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + exec "$JAVACMD" "$@" diff --git a/android/gradlew.bat b/android/gradlew.bat index f955316..3624bce 100644 --- a/android/gradlew.bat +++ b/android/gradlew.bat @@ -1,84 +1,92 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/android/res/values/libs.xml b/android/res/values/libs.xml index 6b1a4a2..b10112d 100644 --- a/android/res/values/libs.xml +++ b/android/res/values/libs.xml @@ -1,22 +1,21 @@ - - - - https://download.qt.io/ministro/android/qt5/qt-5.14 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/android/res/xml/device_filter.xml b/android/res/xml/device_filter.xml deleted file mode 100644 index f78cbf9..0000000 --- a/android/res/xml/device_filter.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/android/res/xml/qtprovider_paths.xml b/android/res/xml/qtprovider_paths.xml new file mode 100644 index 0000000..41f7202 --- /dev/null +++ b/android/res/xml/qtprovider_paths.xml @@ -0,0 +1,4 @@ + + + + diff --git a/androidserialport.cpp b/androidserialport.cpp index 2174deb..a5f7908 100644 --- a/androidserialport.cpp +++ b/androidserialport.cpp @@ -41,11 +41,8 @@ QStringList AndroidSerialPort::discover_devices() QStringList l; l.clear(); qDebug() << "AndroidSerialPort::discover_devices()"; -#if QT_VERSION < QT_VERSION_CHECK(6, 3, 0) - QAndroidJniObject d = serialJavaObject.callObjectMethod("discover_devices", "(Landroid/content/Context;)[Ljava/lang/String;", QtAndroid::androidContext().object()); -#else + QAndroidJniObject d = serialJavaObject.callObjectMethod("discover_devices", "(Landroid/content/Context;)[Ljava/lang/String;", QNativeInterface::QAndroidApplication::context()); -#endif jobjectArray devices = d.object(); int size = env->GetArrayLength(devices); @@ -58,12 +55,7 @@ QStringList AndroidSerialPort::discover_devices() int AndroidSerialPort::open(int p) { -#if QT_VERSION < QT_VERSION_CHECK(6, 3, 0) - QString s = serialJavaObject.callObjectMethod("setup_serial", "(Landroid/content/Context;)Ljava/lang/String;", QtAndroid::androidContext().object()).toString(); - qDebug() << s; -#else serialJavaObject.callObjectMethod("setup_serial", "(Landroid/content/Context;)Ljava/lang/String;", QNativeInterface::QAndroidApplication::context()); -#endif return p; } @@ -137,7 +129,7 @@ QByteArray AndroidSerialPort::readAll() return r; } -void AndroidSerialPort::java_data_received(JNIEnv *env, jobject t, jbyteArray data) +void AndroidSerialPort::java_data_received(JNIEnv *env, jobject, jbyteArray data) { QByteArray r; jboolean copy; diff --git a/androidserialport.h b/androidserialport.h index b007bba..a89d77e 100644 --- a/androidserialport.h +++ b/androidserialport.h @@ -20,12 +20,9 @@ #include #ifdef Q_OS_ANDROID -#if QT_VERSION < QT_VERSION_CHECK(6, 3, 0) -#include -#else #include #include -#endif + class AndroidSerialPort : public QObject { diff --git a/audioengine.cpp b/audioengine.cpp index 8f957a2..9d1833e 100644 --- a/audioengine.cpp +++ b/audioengine.cpp @@ -44,115 +44,6 @@ AudioEngine::~AudioEngine() { } -#if QT_VERSION < QT_VERSION_CHECK(6, 3, 0) -QStringList AudioEngine::discover_audio_devices(uint8_t d) -{ - QStringList list; - QAudio::Mode m = (d) ? QAudio::AudioOutput : QAudio::AudioInput; - QList devices = QAudioDeviceInfo::availableDevices(m); - - for (QList::ConstIterator it = devices.constBegin(); it != devices.constEnd(); ++it ) { - list.append((*it).deviceName()); - } - return list; -} - -void AudioEngine::init() -{ - QAudioFormat format; - QAudioFormat tempformat; - format.setSampleRate(8000); - format.setChannelCount(1); - format.setSampleSize(16); - format.setCodec("audio/pcm"); - format.setByteOrder(QAudioFormat::LittleEndian); - format.setSampleType(QAudioFormat::SignedInt); - - m_agc = true; - - QList devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput); - - if(devices.size() == 0){ - fprintf(stderr, "No audio playback hardware found\n");fflush(stderr); - } - else{ - QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice()); - - for (QList::ConstIterator it = devices.constBegin(); it != devices.constEnd(); ++it ) { - if(MACHAK){ - qDebug() << "Playback device name = " << (*it).deviceName(); - qDebug() << (*it).supportedByteOrders(); - qDebug() << (*it).supportedChannelCounts(); - qDebug() << (*it).supportedCodecs(); - qDebug() << (*it).supportedSampleRates(); - qDebug() << (*it).supportedSampleSizes(); - qDebug() << (*it).supportedSampleTypes(); - qDebug() << (*it).preferredFormat(); - } - - if((*it).deviceName() == m_outputdevice){ - info = *it; - } - } - - if (!info.isFormatSupported(format)) { - qWarning() << "Raw audio format not supported by backend, trying nearest format."; - tempformat = info.nearestFormat(format); - qWarning() << "Format now set to " << format.sampleRate() << ":" << format.sampleSize(); - } - else{ - tempformat = format; - } - fprintf(stderr, "Playback device: %s\n", info.deviceName().toStdString().c_str());fflush(stderr); - - m_out = new QAudioOutput(info, tempformat, this); - m_out->setBufferSize(2560); - connect(m_out, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State))); - //m_outdev = m_out->start(); - } - - devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput); - - if(devices.size() == 0){ - fprintf(stderr, "No audio recording hardware found\n");fflush(stderr); - } - else{ - QAudioDeviceInfo info(QAudioDeviceInfo::defaultInputDevice()); - for (QList::ConstIterator it = devices.constBegin(); it != devices.constEnd(); ++it ) { - if(MACHAK){ - qDebug() << "Capture device name = " << (*it).deviceName(); - qDebug() << (*it).supportedByteOrders(); - qDebug() << (*it).supportedChannelCounts(); - qDebug() << (*it).supportedCodecs(); - qDebug() << (*it).supportedSampleRates(); - qDebug() << (*it).supportedSampleSizes(); - qDebug() << (*it).supportedSampleTypes(); - qDebug() << (*it).preferredFormat(); - } - if((*it).deviceName() == m_inputdevice){ - info = *it; - } - } - if (!info.isFormatSupported(format)) { - qWarning() << "Raw audio format not supported by backend, trying nearest format."; - tempformat = info.nearestFormat(format); - qWarning() << "Format now set to " << format.sampleRate() << ":" << format.sampleSize(); - } - else{ - tempformat = format; - } - - int sr = 8000; - if(MACHAK){ - sr = info.preferredFormat().sampleRate(); - m_srm = (float)sr / 8000.0; - } - format.setSampleRate(sr); - m_in = new QAudioInput(info, format, this); - fprintf(stderr, "Capture device: %s SR: %d resample factor: %f\n", info.deviceName().toStdString().c_str(), sr, m_srm);fflush(stderr); - } -} -#else QStringList AudioEngine::discover_audio_devices(uint8_t d) { QStringList list; @@ -240,7 +131,6 @@ void AudioEngine::init() qDebug() << "Capture device: " << device.description() << " SR: " << sr << " resample factor: " << m_srm; } } -#endif void AudioEngine::start_capture() { diff --git a/dmr.cpp b/dmr.cpp index 56c03c7..0b955d0 100755 --- a/dmr.cpp +++ b/dmr.cpp @@ -23,6 +23,9 @@ #include "SHA256.h" #include "CRCenc.h" #include "MMDVMDefines.h" +#ifdef USE_MD380_VOCODER +#include +#endif const uint32_t ENCODING_TABLE_1676[] = {0x0000U, 0x0273U, 0x04E5U, 0x0696U, 0x09C9U, 0x0BBAU, 0x0D2CU, 0x0F5FU, 0x11E2U, 0x1391U, 0x1507U, 0x1774U, @@ -45,6 +48,9 @@ DMR::DMR() : m_dmrcnt = 0; m_flco = FLCO_GROUP; m_attenuation = 5; +#ifdef USE_MD380_VOCODER + md380_init(); +#endif } DMR::~DMR() @@ -465,7 +471,11 @@ void DMR::transmit() } else{ if(m_modeinfo.sw_vocoder_loaded){ +#ifdef USE_MD380_VOCODER + md380_encode_fec(ambe, pcm); +#else m_mbevocoder->encode_2450x1150(pcm, ambe); +#endif } for(int i = 0; i < 9; ++i){ m_txcodecq.append(ambe[i]); @@ -946,7 +956,11 @@ void DMR::process_rx_data() } else{ if(m_modeinfo.sw_vocoder_loaded){ +#ifdef USE_MD380_VOCODER + md380_decode_fec(ambe, pcm); +#else m_mbevocoder->decode_2450x1150(pcm, ambe); +#endif } else{ memset(pcm, 0, 160 * sizeof(int16_t)); diff --git a/droidstar.cpp b/droidstar.cpp index 4af2356..edc82ea 100644 --- a/droidstar.cpp +++ b/droidstar.cpp @@ -18,13 +18,9 @@ #include "droidstar.h" #include "httpmanager.h" #ifdef Q_OS_ANDROID -#if QT_VERSION < QT_VERSION_CHECK(6, 3, 0) -#include -#else #include #include #endif -#endif #ifdef Q_OS_IOS #include "micpermission.h" #endif @@ -82,22 +78,6 @@ DroidStar::~DroidStar() } #ifdef Q_OS_ANDROID -#if QT_VERSION < QT_VERSION_CHECK(6, 3, 0) -void DroidStar::keepScreenOn() -{ - char const * const action = "addFlags"; - QtAndroid::runOnAndroidThread([action](){ - QAndroidJniObject activity = QtAndroid::androidActivity(); - if (activity.isValid()) { - QAndroidJniObject window = activity.callObjectMethod("getWindow", "()Landroid/view/Window;"); - - if (window.isValid()) { - const int FLAG_KEEP_SCREEN_ON = 128; - window.callMethod("addFlags", "(I)V", FLAG_KEEP_SCREEN_ON); - } - }}); -} -#else void DroidStar::keepScreenOn() { char const * const action = "addFlags"; @@ -112,7 +92,6 @@ void DroidStar::keepScreenOn() } }}); } -#endif void DroidStar::reset_connect_status() { if(connect_status == Mode::CONNECTED_RW){ @@ -120,7 +99,6 @@ void DroidStar::reset_connect_status() process_connect(); } } - #endif void DroidStar::discover_devices() diff --git a/imbe_vocoder/pitch_ref.h b/imbe_vocoder/pitch_ref.h index 29ccf8a..3a72b7f 100644 --- a/imbe_vocoder/pitch_ref.h +++ b/imbe_vocoder/pitch_ref.h @@ -18,11 +18,11 @@ * Software Foundation, Inc., 51 Franklin Street, Boston, MA * 02110-1301, USA. */ - - -#ifndef _PITCH_REF -#define _PIRCH_REF - -void pitch_ref(IMBE_PARAM *imbe_param, Cmplx16 *fft_buf); - -#endif + + +#ifndef _PITCH_REF +#define _PITCH_REF + +void pitch_ref(IMBE_PARAM *imbe_param, Cmplx16 *fft_buf); + +#endif diff --git a/main.cpp b/main.cpp index 7dc2edf..f00a7e8 100644 --- a/main.cpp +++ b/main.cpp @@ -1,50 +1,30 @@ -/* - Copyright (C) 2019-2021 Doug McLain - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - #include #include -#include #include #include -#include +#include #include "droidstar.h" int main(int argc, char *argv[]) { - //QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QGuiApplication app(argc, argv); + QQuickStyle::setStyle("Fusion"); + app.setWindowIcon(QIcon(":/images/droidstar.png")); + qmlRegisterType("org.dudetronics.droidstar", 1, 0, "DroidStar"); - QGuiApplication app(argc, argv); - QQuickStyle::setStyle("Fusion"); - app.setWindowIcon(QIcon(":/images/droidstar.png")); - qmlRegisterType("org.dudetronics.droidstar", 1, 0, "DroidStar"); - QQmlApplicationEngine engine; + QQmlApplicationEngine engine; #ifdef USE_FLITE - engine.rootContext()->setContextProperty("USE_FLITE", QVariant(true)); + engine.rootContext()->setContextProperty("USE_FLITE", QVariant(true)); #else - engine.rootContext()->setContextProperty("USE_FLITE", QVariant(false)); + engine.rootContext()->setContextProperty("USE_FLITE", QVariant(false)); #endif - const QUrl url(QStringLiteral("qrc:/main.qml")); - QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, - &app, [url](QObject *obj, const QUrl &objUrl) { - if (!obj && url == objUrl) - QCoreApplication::exit(-1); - }, Qt::QueuedConnection); - engine.load(url); - QObject::connect(&engine, &QQmlApplicationEngine::quit, &app, &QGuiApplication::quit); - return app.exec(); + const QUrl url(u"qrc:/DroidStar/main.qml"_qs); + QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, + &app, [url](QObject *obj, const QUrl &objUrl) { + if (!obj && url == objUrl) + QCoreApplication::exit(-1); + }, Qt::QueuedConnection); + engine.load(url); + + return app.exec(); } diff --git a/main.qml b/main.qml index 15e3476..496b78b 100644 --- a/main.qml +++ b/main.qml @@ -15,11 +15,11 @@ along with this program. If not, see . */ -import QtQuick 2.10 -import QtQuick.Window 2.10 -import QtQuick.Controls 2.3 -import QtQuick.Dialogs 1.3 -import org.dudetronics.droidstar 1.0 +import QtQuick +import QtQuick.Window +import QtQuick.Controls +import QtQuick.Dialogs +import org.dudetronics.droidstar ApplicationWindow { // @disable-check M16 diff --git a/mbe/ambe3600x2400.c b/mbe/ambe3600x2400.c index ec44fd3..fe3f619 100644 --- a/mbe/ambe3600x2400.c +++ b/mbe/ambe3600x2400.c @@ -281,6 +281,7 @@ mbe_decodeAmbe2400Parms (char *ambe_d, mbe_parms * cur_mp, mbe_parms * prev_mp) //unvc = (float) 0.2046 / sqrtf (f0); // decode L + L = 0; if (silence == 0) { // L from specification document diff --git a/mbe/vocoder_plugin.cpp b/mbe/vocoder_plugin.cpp index a365ed0..227f6bf 100644 --- a/mbe/vocoder_plugin.cpp +++ b/mbe/vocoder_plugin.cpp @@ -130,7 +130,7 @@ static const short b0_lookup[] = { static const int m_list[] = {0, 1, 2, 3, 4, 5, 11, 12, 13, 14, 17, 18, 19, 20, 21, 22, 23, 26, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 7, 8, 9, 10, 15, 16, 24, 25, 31, 32, 6}; static const int d_list[] = {7, 1, 11, 21, 31, 25, 35, 45, 55, 49, 59, 69, 6, 0, 10, 20, 30, 24, 34, 44, 54, 48, 58, 68, 5, 15, 9, 19, 29, 39, 33, 43, 53, 63, 57, 67, 4, 14, 8, 18, 28, 38, 32, 42, 52, 62, 56, 66, 3, 13, 23, 17, 27, 37, 47, 41, 51, 61, 71, 65, 2, 12, 22, 16, 26, 36, 46, 40, 50, 60, 70, 64}; -static const int alt_d_list[] = {0, 12, 24, 36, 48, 60, 1, 13, 25, 37, 49, 61, 2, 14, 26, 38, 50, 62, 3, 15, 27, 39, 51, 63, 4, 16, 28, 40, 52, 64, 5, 17, 29, 41, 53, 65, 6, 18, 30, 42, 54, 66, 7, 19, 31, 43, 55, 67, 8, 20, 32, 44, 56, 68, 9, 21, 33, 45, 57, 69, 10, 22, 34, 46, 58, 70, 11, 23, 35, 47, 59, 71}; +//static const int alt_d_list[] = {0, 12, 24, 36, 48, 60, 1, 13, 25, 37, 49, 61, 2, 14, 26, 38, 50, 62, 3, 15, 27, 39, 51, 63, 4, 16, 28, 40, 52, 64, 5, 17, 29, 41, 53, 65, 6, 18, 30, 42, 54, 66, 7, 19, 31, 43, 55, 67, 8, 20, 32, 44, 56, 68, 9, 21, 33, 45, 57, 69, 10, 22, 34, 46, 58, 70, 11, 23, 35, 47, 59, 71}; static const int b_lengths[] = {7,4,6,9,7,4,4,4,3}; const int dW[72] = {0,0,3,2,1,1,0,0,1,1,0,0,3,2,1,1,3,2,1,1,0,0,3,2,0,0,3,2,1,1,0,0,1,1,0,0, @@ -208,14 +208,6 @@ static inline uint32_t golay_23_encode(uint32_t code_word_in) return golay_24_encode(code_word_in) >> 1; } -static inline void dump_i(uint8_t dest[], int src, int count) -{ - for (int i=0; i> 1; - } -} - static inline void store_reg(int reg, uint8_t val[], int len) { for (int i=0; iL) / num_harms_f; - float tmp_s = 0.0; + //float tmp_s = 0.0; prev_mp->log2Ml[0] = prev_mp->log2Ml[1]; for (int i1 = 0; i1 < imbe_param->num_harms; i1++) { - float kl = l_prev_l * (float)(i1+1); - int kl_floor = (int) kl; - float kl_frac = kl - kl_floor; - tmp_s += (1.0 - kl_frac) * prev_mp->log2Ml[kl_floor +0] + kl_frac * prev_mp->log2Ml[kl_floor+1 +0]; + //float kl = l_prev_l * (float)(i1+1); + //int kl_floor = (int) kl; + //float kl_frac = kl - kl_floor; + //tmp_s += (1.0 - kl_frac) * prev_mp->log2Ml[kl_floor +0] + kl_frac * prev_mp->log2Ml[kl_floor+1 +0]; } float T[NUM_HARMS_MAX]; for (int i1 = 0; i1 < imbe_param->num_harms; i1++) { diff --git a/mbe/vocoder_plugin.h b/mbe/vocoder_plugin.h index f2ccb80..6d6e53a 100644 --- a/mbe/vocoder_plugin.h +++ b/mbe/vocoder_plugin.h @@ -39,9 +39,9 @@ private: float m_audio_out_temp_buf[160]; //!< output of decoder float *m_audio_out_temp_buf_p; - float m_aout_max_buf[200]; - float *m_aout_max_buf_p; - int m_aout_max_buf_idx; + //float m_aout_max_buf[200]; + //float *m_aout_max_buf_p; + //int m_aout_max_buf_idx; short m_audio_out_buf[2*48000]; //!< final result - 1s of L+R S16LE samples short *m_audio_out_buf_p; int m_audio_out_nb_samples; diff --git a/nxdn.cpp b/nxdn.cpp index 533ec8a..7957014 100755 --- a/nxdn.cpp +++ b/nxdn.cpp @@ -17,6 +17,9 @@ #include "nxdn.h" #include +#ifdef USE_MD380_VOCODER +#include +#endif const int dvsi_interleave[49] = { 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 41, 43, 45, 47, @@ -43,6 +46,9 @@ NXDN::NXDN() m_txcnt = 0; m_txtimerint = 19; m_attenuation = 5; +#ifdef USE_MD380_VOCODER + md380_init(); +#endif } NXDN::~NXDN() @@ -264,7 +270,11 @@ void NXDN::transmit() } else{ if(m_modeinfo.sw_vocoder_loaded){ - m_mbevocoder->encode_2450(pcm, ambe); +#ifdef USE_MD380_VOCODER + md380_encode(ambe, pcm); +#else + m_mbevocoder->encode_2450(pcm, ambe); +#endif } ambe[6] &= 0x80; @@ -649,7 +659,11 @@ void NXDN::process_rx_data() } else{ if(m_modeinfo.sw_vocoder_loaded){ +#ifdef USE_MD380_VOCODER + md380_decode(ambe, pcm); +#else m_mbevocoder->decode_2450(pcm, ambe); +#endif } else{ memset(pcm, 0, 160 * sizeof(int16_t)); diff --git a/qml.qrc b/qml.qrc deleted file mode 100644 index 531ecd1..0000000 --- a/qml.qrc +++ /dev/null @@ -1,11 +0,0 @@ - - - main.qml - images/droidstar.png - AboutTab.qml - HostsTab.qml - LogTab.qml - SettingsTab.qml - MainTab.qml - - diff --git a/ysf.cpp b/ysf.cpp index 5b8df5c..881bf36 100755 --- a/ysf.cpp +++ b/ysf.cpp @@ -23,6 +23,9 @@ #include "MMDVMDefines.h" #include #include +#ifdef USE_MD380_VOCODER +#include +#endif const uint32_t IMBE_INTERLEAVE[] = { @@ -104,6 +107,9 @@ YSF::YSF() : { m_mode = "YSF"; m_attenuation = 5; +#ifdef USE_MD380_VOCODER + md380_init(); +#endif } YSF::~YSF() @@ -748,7 +754,11 @@ void YSF::transmit() else{ s = 7; if(m_modeinfo.sw_vocoder_loaded){ +#ifdef USE_MD380_VOCODER + md380_encode(ambe, pcm); +#else m_mbevocoder->encode_2450(pcm, ambe); +#endif } } @@ -1404,7 +1414,11 @@ void YSF::process_rx_data() } else{ if(m_modeinfo.sw_vocoder_loaded){ +#ifdef USE_MD380_VOCODER + md380_decode(ambe, pcm); +#else m_mbevocoder->decode_2450(pcm, ambe); +#endif } else{ memset(pcm, 0, 160 * sizeof(int16_t));