Update to Qt6

main
Doug McLain 1 year ago
parent 5d2213f1c0
commit 534d5e5d03

@ -15,7 +15,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.10
import QtQuick
Item {
id: aboutTab

@ -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

@ -15,8 +15,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick
import QtQuick.Controls
Item {
id: hostsTab

@ -15,8 +15,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick
import QtQuick.Controls
Item {
id: logTab

@ -15,11 +15,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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

@ -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.

@ -15,8 +15,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick
import QtQuick.Controls
Item {
id: settingsTab

@ -1,76 +1,21 @@
<?xml version="1.0"?>
<manifest package="org.dudetronics.droidstar" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="78" android:installLocation="auto">
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.dudetronics.droidstar" android:installLocation="auto" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:versionName="-- %%INSERT_VERSION_NAME%% --">
<!-- %%INSERT_PERMISSIONS -->
<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
Remove the comment if you do not require these default features. -->
<!-- %%INSERT_FEATURES -->
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:extractNativeLibs="true" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop" android:exported="true">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
<application android:name="org.qtproject.qt.android.bindings.QtApplication" android:hardwareAccelerated="true" android:label="-- %%INSERT_APP_NAME%% --" android:requestLegacyExternalStorage="true" android:allowNativeHeapPointerTagging="false" android:allowBackup="true" android:fullBackupOnly="false" android:icon="@drawable/icon">
<activity android:name="org.qtproject.qt.android.bindings.QtActivity" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:label="-- %%INSERT_APP_NAME%% --" android:launchMode="singleTop" android:screenOrientation="unspecified" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Application arguments -->
<!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
<!-- Application arguments -->
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
<meta-data android:name="android.app.repository" android:value="default"/>
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
<!-- Deploy Qt libs as part of package -->
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
<!-- Run with local libs -->
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
<meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/>
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
<!-- Used to specify custom system library path to run with local system libs -->
<!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> -->
<!-- Messages maps -->
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
<meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/>
<!-- Messages maps -->
<!-- Splash screen -->
<!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation,
then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and
use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you
are done populating your window with content. -->
<!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / -->
<!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / -->
<!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
<!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
<!-- Splash screen -->
<!-- Background running -->
<!-- Warning: changing this value to true may cause unexpected crashes if the
application still try to draw after
"applicationStateChanged(Qt::ApplicationSuspended)"
signal is sent! -->
<meta-data android:name="android.app.background_running" android:value="false"/>
<!-- Background running -->
<!-- auto screen scale factor -->
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
<!-- auto screen scale factor -->
<!-- extract android style -->
<!-- available android:values :
* default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons
* full - useful QWidget & Quick Controls 1 apps
* minimal - useful for Quick Controls 2 apps, it is much faster than "full"
* none - useful for apps that don't use any of the above Qt modules
-->
<meta-data android:name="android.app.extract_android_style" android:value="default"/>
<!-- extract android style -->
<meta-data android:name="android.app.arguments" android:value="-- %%INSERT_APP_ARGUMENTS%% --"/>
<meta-data android:name="android.app.extract_android_style" android:value="minimal"/>
</activity>
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
</application>
<provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.qtprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/qtprovider_paths"/>
</provider>
</application>
</manifest>

@ -1,23 +1,24 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
classpath 'com.android.tools.build:gradle:7.4.1'
}
}
repositories {
google()
jcenter()
mavenCentral()
}
apply plugin: 'com.android.application'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.core:core:1.10.1'
}
android {
@ -25,7 +26,7 @@ android {
* The following variables:
* - androidBuildToolsVersion,
* - androidCompileSdkVersion
* - qt5AndroidDir - holds the path to qt android files
* - qtAndroidDir - holds the path to qt android files
* needed to build any Qt application
* on Android.
*
@ -34,18 +35,19 @@ android {
* Changing them manually might break the compilation!
*******************************************************/
compileSdkVersion androidCompileSdkVersion.toInteger()
compileSdkVersion androidCompileSdkVersion
buildToolsVersion androidBuildToolsVersion
ndkVersion androidNdkVersion
// Extract native libraries from the APK
packagingOptions.jniLibs.useLegacyPackaging true
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']
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']
@ -53,6 +55,15 @@ android {
}
}
tasks.withType(JavaCompile) {
options.incremental = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
}
@ -61,4 +72,11 @@ android {
aaptOptions {
noCompress 'rcc'
}
defaultConfig {
resConfig "en"
minSdkVersion qtMinSdkVersion
targetSdkVersion qtTargetSdkVersion
ndk.abiFilters = qtTargetAbiList.split(",")
}
}

@ -1,2 +1,18 @@
# 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
android.enableJetifier=true

Binary file not shown.

@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

301
android/gradlew vendored

@ -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" "$@"

@ -1,4 +1,20 @@
@if "%DEBUG%" == "" @echo off
@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
@ -9,19 +25,23 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
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=
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%" == "0" goto init
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -35,7 +55,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -45,38 +65,26 @@ 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%
"%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%"=="0" goto mainEnd
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!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
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

@ -1,11 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<array name="qt_sources">
<item>https://download.qt.io/ministro/android/qt5/qt-5.14</item>
</array>
<!-- The following is handled automatically by the deployment tool. It should
not be edited manually. -->
<!-- DO NOT EDIT THIS: This file is populated automatically by the deployment tool. -->
<array name="bundled_libs">
<!-- %%INSERT_EXTRA_LIBS%% -->
@ -19,4 +14,8 @@
<!-- %%INSERT_LOCAL_LIBS%% -->
</array>
<string name="static_init_classes"><!-- %%INSERT_INIT_CLASSES%% --></string>
<string name="use_local_qt_libs"><!-- %%USE_LOCAL_QT_LIBS%% --></string>
<string name="bundle_local_qt_libs"><!-- %%BUNDLE_LOCAL_QT_LIBS%% --></string>
<string name="system_libs_prefix"><!-- %%SYSTEM_LIBS_PREFIX%% --></string>
</resources>

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<usb-device vendor-id="1027" product-id="24597" />
<usb-device vendor-id="1027" product-id="24577" />
<usb-device vendor-id="3405" product-id="567" />
<usb-device vendor-id="1155" product-id="22336" />
<usb-device vendor-id="7855" product-id="0004" />
<usb-device vendor-id="4292" product-id="60000" />
</resources>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<files-path name="files_path" path="/"/>
</paths>

@ -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<jobjectArray>();
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;

@ -20,12 +20,9 @@
#include <QObject>
#ifdef Q_OS_ANDROID
#if QT_VERSION < QT_VERSION_CHECK(6, 3, 0)
#include <QtAndroidExtras>
#else
#include <QCoreApplication>
#include <QJniObject>
#endif
class AndroidSerialPort : public QObject
{

@ -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<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(m);
for (QList<QAudioDeviceInfo>::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<QAudioDeviceInfo> 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<QAudioDeviceInfo>::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<QAudioDeviceInfo>::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()
{

@ -23,6 +23,9 @@
#include "SHA256.h"
#include "CRCenc.h"
#include "MMDVMDefines.h"
#ifdef USE_MD380_VOCODER
#include <md380_vocoder.h>
#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));

@ -18,13 +18,9 @@
#include "droidstar.h"
#include "httpmanager.h"
#ifdef Q_OS_ANDROID
#if QT_VERSION < QT_VERSION_CHECK(6, 3, 0)
#include <QtAndroidExtras>
#else
#include <QCoreApplication>
#include <QJniObject>
#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<void>("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()

@ -21,7 +21,7 @@
#ifndef _PITCH_REF
#define _PIRCH_REF
#define _PITCH_REF
void pitch_ref(IMBE_PARAM *imbe_param, Cmplx16 *fft_buf);

@ -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 <https://www.gnu.org/licenses/>.
*/
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickStyle>
#include <QIcon>
#include <fcntl.h>
#include <QQmlContext>
#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<DroidStar>("org.dudetronics.droidstar", 1, 0, "DroidStar");
QGuiApplication app(argc, argv);
QQuickStyle::setStyle("Fusion");
app.setWindowIcon(QIcon(":/images/droidstar.png"));
qmlRegisterType<DroidStar>("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();
}

@ -15,11 +15,11 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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

@ -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

@ -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<count; i++) {
dest[i] = src & 1;
src = src >> 1;
}
}
static inline void store_reg(int reg, uint8_t val[], int len)
{
for (int i=0; i<len; i++){
@ -762,13 +754,13 @@ void encode_ambe(const IMBE_PARAM *imbe_param, int b[], mbe_parms*cur_mp, mbe_pa
// prediction residuals
float l_prev_l = (float) (prev_mp->L) / 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++) {

@ -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;

@ -17,6 +17,9 @@
#include "nxdn.h"
#include <cstring>
#ifdef USE_MD380_VOCODER
#include <md380_vocoder.h>
#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));

@ -1,11 +0,0 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>images/droidstar.png</file>
<file>AboutTab.qml</file>
<file>HostsTab.qml</file>
<file>LogTab.qml</file>
<file>SettingsTab.qml</file>
<file>MainTab.qml</file>
</qresource>
</RCC>

@ -23,6 +23,9 @@
#include "MMDVMDefines.h"
#include <iostream>
#include <cstring>
#ifdef USE_MD380_VOCODER
#include <md380_vocoder.h>
#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));

Loading…
Cancel
Save