From a2ab3b53c19198ea2769bb42a2492f0f912eda93 Mon Sep 17 00:00:00 2001 From: Doug McLain Date: Wed, 3 Nov 2021 14:51:51 -0400 Subject: [PATCH] Add option to download vocoder file via http --- AboutTab.qml | 1 + DroidStar.pro.user | 213 ++++++++++++++++++++++----------------------- README.md | 14 +-- SettingsTab.qml | 45 +++++++--- codec.cpp | 3 +- codec.h | 3 +- dcscodec.cpp | 7 +- dmrcodec.cpp | 7 +- droidstar.cpp | 33 +++++-- droidstar.h | 4 +- httpmanager.cpp | 18 +++- httpmanager.h | 3 +- main.qml | 10 ++- nxdncodec.cpp | 7 +- refcodec.cpp | 7 +- xrfcodec.cpp | 7 +- ysfcodec.cpp | 7 +- 17 files changed, 225 insertions(+), 164 deletions(-) diff --git a/AboutTab.qml b/AboutTab.qml index 14fae1f..cf09ca0 100644 --- a/AboutTab.qml +++ b/AboutTab.qml @@ -41,6 +41,7 @@ Item { "\nPlatform:\t" + droidstar.get_platform() + "\nArchitecture:\t" + droidstar.get_arch() + "\nBuild ABI:\t" + droidstar.get_build_abi() + + "\n\nProject page: https://github.com/nostar/DroidStar" + "\n\nCopyright (C) 2019-2021 Doug McLain AD8DP\n" + "This program is free software; " + "you can redistribute it and/or modify it under the terms of the GNU General " + diff --git a/DroidStar.pro.user b/DroidStar.pro.user index 7b15b8f..e33ca9f 100644 --- a/DroidStar.pro.user +++ b/DroidStar.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -88,29 +88,44 @@ ProjectExplorer.Project.Target.0 - Desktop - Desktop Qt 5.15.2 GCC 64bit - Desktop Qt 5.15.2 GCC 64bit - qt.qt5.5152.gcc_64_kit - 0 + Android.Device.Type + Android Qt 5.15.2 Clang Multi-Abi + Android Qt 5.15.2 Clang Multi-Abi + {955eaf34-57a0-4cce-b8ac-8097bc82fcb9} + 1 0 0 0 - /mnt/data/src/qt-projects/build-DroidStar-Desktop_Qt_5_15_2_GCC_64bit-Debug - /mnt/data/src/qt-projects/build-DroidStar-Desktop_Qt_5_15_2_GCC_64bit-Debug + /mnt/data/src/qt-projects/build-DroidStar-Android_Qt_5_15_2_Clang_Multi_Abi-Debug + /mnt/data/src/qt-projects/build-DroidStar-Android_Qt_5_15_2_Clang_Multi_Abi-Debug true QtProjectManager.QMakeBuildStep false - + + armeabi-v7a + true Qt4ProjectManager.MakeStep - 2 + + true + Copy application data + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-31 + + true + Build Android APK + QmakeProjectManager.AndroidBuildApkStep + false + + 4 Build Build ProjectExplorer.BuildSteps.Build @@ -135,20 +150,36 @@ 2 - /mnt/data/src/qt-projects/build-DroidStar-Desktop_Qt_5_15_2_GCC_64bit-Release - /mnt/data/src/qt-projects/build-DroidStar-Desktop_Qt_5_15_2_GCC_64bit-Release + /mnt/data/src/qt-projects/build-DroidStar-Android_Qt_5_15_2_Clang_Multi_Abi-Release + /mnt/data/src/qt-projects/build-DroidStar-Android_Qt_5_15_2_Clang_Multi_Abi-Release true QtProjectManager.QMakeBuildStep false - + + armeabi-v7a + arm64-v8a + true Qt4ProjectManager.MakeStep - 2 + + true + Copy application data + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-29 + + true + Build Android APK + QmakeProjectManager.AndroidBuildApkStep + false + + 4 Build Build ProjectExplorer.BuildSteps.Build @@ -175,8 +206,8 @@ 0 - /mnt/data/src/qt-projects/build-DroidStar-Desktop_Qt_5_15_2_GCC_64bit-Profile - /mnt/data/src/qt-projects/build-DroidStar-Desktop_Qt_5_15_2_GCC_64bit-Profile + /mnt/data/src/qt-projects/build-DroidStar-Android_Qt_5_15_2_Clang_Multi_Abi-Profile + /mnt/data/src/qt-projects/build-DroidStar-Android_Qt_5_15_2_Clang_Multi_Abi-Profile true @@ -188,7 +219,20 @@ true Qt4ProjectManager.MakeStep - 2 + + true + Copy application data + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-31 + + true + Build Android APK + QmakeProjectManager.AndroidBuildApkStep + false + + 4 Build Build ProjectExplorer.BuildSteps.Build @@ -217,7 +261,11 @@ 3 - 0 + + true + Qt4ProjectManager.AndroidDeployQtStep + + 1 Deploy Deploy ProjectExplorer.BuildSteps.Deploy @@ -225,25 +273,39 @@ 1 false - ProjectExplorer.DefaultDeployConfiguration + Qt4ProjectManager.AndroidDeployConfiguration2 1 + + + arm64-v8a + armeabi-v7a + armeabi + + 192.168.1.69:55555 + 30 + true true 2 true + + + + + + - 2 + 0 - Qt4ProjectManager.Qt4RunConfiguration:/mnt/data/src/qt-projects/DroidStar/DroidStar.pro + DroidStar + Qt4ProjectManager.AndroidRunConfiguration:/mnt/data/src/qt-projects/DroidStar/DroidStar.pro /mnt/data/src/qt-projects/DroidStar/DroidStar.pro false true - true false true - /mnt/data/src/qt-projects/build-DroidStar-Desktop_Qt_5_15_2_GCC_64bit-Debug 1 @@ -251,44 +313,29 @@ ProjectExplorer.Project.Target.1 - Android.Device.Type - Android Qt 5.15.2 Clang Multi-Abi - Android Qt 5.15.2 Clang Multi-Abi - {955eaf34-57a0-4cce-b8ac-8097bc82fcb9} - 1 + Desktop + Desktop Qt 5.15.2 GCC 64bit + Desktop Qt 5.15.2 GCC 64bit + qt.qt5.5152.gcc_64_kit + 0 0 0 0 - /mnt/data/src/qt-projects/build-DroidStar-Android_Qt_5_15_2_Clang_Multi_Abi-Debug - /mnt/data/src/qt-projects/build-DroidStar-Android_Qt_5_15_2_Clang_Multi_Abi-Debug + /mnt/data/src/qt-projects/build-DroidStar-Desktop_Qt_5_15_2_GCC_64bit-Debug + /mnt/data/src/qt-projects/build-DroidStar-Desktop_Qt_5_15_2_GCC_64bit-Debug true QtProjectManager.QMakeBuildStep false - - armeabi-v7a - + true Qt4ProjectManager.MakeStep - - true - Copy application data - Qt4ProjectManager.AndroidPackageInstallationStep - - - android-31 - - true - Build Android APK - QmakeProjectManager.AndroidBuildApkStep - false - - 4 + 2 Build Build ProjectExplorer.BuildSteps.Build @@ -313,36 +360,20 @@ 2 - /mnt/data/src/qt-projects/build-DroidStar-Android_Qt_5_15_2_Clang_Multi_Abi-Release - /mnt/data/src/qt-projects/build-DroidStar-Android_Qt_5_15_2_Clang_Multi_Abi-Release + /mnt/data/src/qt-projects/build-DroidStar-Desktop_Qt_5_15_2_GCC_64bit-Release + /mnt/data/src/qt-projects/build-DroidStar-Desktop_Qt_5_15_2_GCC_64bit-Release true QtProjectManager.QMakeBuildStep false - - armeabi-v7a - arm64-v8a - + true Qt4ProjectManager.MakeStep - - true - Copy application data - Qt4ProjectManager.AndroidPackageInstallationStep - - - android-29 - - true - Build Android APK - QmakeProjectManager.AndroidBuildApkStep - false - - 4 + 2 Build Build ProjectExplorer.BuildSteps.Build @@ -369,8 +400,8 @@ 0 - /mnt/data/src/qt-projects/build-DroidStar-Android_Qt_5_15_2_Clang_Multi_Abi-Profile - /mnt/data/src/qt-projects/build-DroidStar-Android_Qt_5_15_2_Clang_Multi_Abi-Profile + /mnt/data/src/qt-projects/build-DroidStar-Desktop_Qt_5_15_2_GCC_64bit-Profile + /mnt/data/src/qt-projects/build-DroidStar-Desktop_Qt_5_15_2_GCC_64bit-Profile true @@ -382,20 +413,7 @@ true Qt4ProjectManager.MakeStep - - true - Copy application data - Qt4ProjectManager.AndroidPackageInstallationStep - - - android-31 - - true - Build Android APK - QmakeProjectManager.AndroidBuildApkStep - false - - 4 + 2 Build Build ProjectExplorer.BuildSteps.Build @@ -424,11 +442,7 @@ 3 - - true - Qt4ProjectManager.AndroidDeployQtStep - - 1 + 0 Deploy Deploy ProjectExplorer.BuildSteps.Deploy @@ -436,37 +450,22 @@ 1 false - Qt4ProjectManager.AndroidDeployConfiguration2 + ProjectExplorer.DefaultDeployConfiguration 1 - - - arm64-v8a - armeabi-v7a - armeabi - - R38N502YWQJ - 30 - true true 2 true - - - - - - - 0 + 2 - DroidStar - Qt4ProjectManager.AndroidRunConfiguration:/mnt/data/src/qt-projects/DroidStar/DroidStar.pro + Qt4ProjectManager.Qt4RunConfiguration:/mnt/data/src/qt-projects/DroidStar/DroidStar.pro /mnt/data/src/qt-projects/DroidStar/DroidStar.pro false true + true false true diff --git a/README.md b/README.md index 48316af..06e1669 100644 --- a/README.md +++ b/README.md @@ -17,16 +17,18 @@ There is a vocoder plugin API available for loading of vocoder software. Any vo # Loading a vocoder plugin A vocoder plugin is placed in the standard Download location for the given platform: -Linux: ~/Downloads -MacOS: ~/Downloads -Windows: C:/Users//Documents -Android: /storage/emulated/0/Download (typically referred to as Internal storage -> Download +- Linux: ~/Downloads +- MacOS: ~/Downloads +- Windows: C:/Users/User/Documents +- Android: /storage/emulated/0/Download (typically referred to as Internal storage -> Download -The vocoder plugin filename must be named vocoder_plugin.. where platform and arch can be any of the following: +A vocoder can also be downloaded from a URL. Add a full http url, including the filename, to the Vocoder URL option on the settings tab, and click the Download vocoder button. + +The vocoder plugin filename must be named vocoder_plugin.platform.arch where platform and arch can be any of the following: platform: linux, darwin, winnt, android, ios arch: x86_64, arm, arm64 -There are no software vocoder plugins available in this repository. +There are no software vocoder plugins available in this repository, and I have no information on obtaining one. DONT ASK! # Optional FLite Text-to-speech build I added Flite TTS TX capability so I didn't have to talk to myself all of the time during development and testing. To build DroidStar with Flite TTS support, uncomment the line 'DEFINES += USE_FLITE' from the top of DroidStar.pro (and run/re-run qmake). You will need the Flite library and development header files installed on your system. When built with Flite support, 3 TTS options and a Mic in option will be available at the bottom of the window. TTS1-TTS3 are 3 voice choices, and Mic in turns off TTS and uses the microphone for input. The text to be converted to speech and transmitted goes in the text box under the TTS options. diff --git a/SettingsTab.qml b/SettingsTab.qml index 5d167d4..22ccb49 100644 --- a/SettingsTab.qml +++ b/SettingsTab.qml @@ -73,8 +73,8 @@ Item { Flickable { anchors.fill: parent contentWidth: parent.width - contentHeight: _modemNXDNTXLevelLabel.y + - _modemNXDNTXLevelLabel.height + 10 + contentHeight: vocoderButton.y + + vocoderButton.height + 10 flickableDirection: Flickable.VerticalFlick clip: true @@ -507,17 +507,6 @@ Item { updateDialog.open() } } - Button { - id: vocoderButton - x: 10 - y: 670 - width: 150 - height: 30 - text: qsTr("Vocoder Plugin") - onClicked: { - //vocoderDialog.open() - } - } Text { id: mycallLabel x: 10 @@ -1026,5 +1015,35 @@ Item { selectByMouse: true inputMethodHints: "ImhPreferNumbers" } + Text { + id: _vocoderURLlabel + x: 10 + y: 1550 + width: 80 + height: 25 + text: qsTr("Vocoder URL") + color: "white" + verticalAlignment: Text.AlignVCenter + } + TextField { + id: _vocoderURLEdit + x: 100 + y: 1550 + width: parent.width - 110 + height: 25 + selectByMouse: true + } + Button { + id: vocoderButton + x: 10 + y: 1580 + width: 150 + height: 30 + text: qsTr("Download vocoder") + onClicked: { + droidstar.download_file(_vocoderURLEdit.text, true); + updateDialog.open(); + } + } } } diff --git a/codec.cpp b/codec.cpp index ef0a31c..bccfa99 100644 --- a/codec.cpp +++ b/codec.cpp @@ -59,7 +59,8 @@ Codec::Codec(QString callsign, char module, QString hostname, QString host, int m_modeinfo.frame_total = 0; m_modeinfo.streamid = 0; m_modeinfo.stream_state = STREAM_IDLE; - m_modeinfo.vocoder_loaded = false; + m_modeinfo.sw_vocoder_loaded = false; + m_modeinfo.hw_vocoder_loaded = false; #ifdef USE_FLITE flite_init(); voice_slt = register_cmu_us_slt(nullptr); diff --git a/codec.h b/codec.h index 81f0207..1dc73a4 100644 --- a/codec.h +++ b/codec.h @@ -80,7 +80,8 @@ public: int count; uint32_t streamid; bool mode; - bool vocoder_loaded; + bool sw_vocoder_loaded; + bool hw_vocoder_loaded; } m_modeinfo; enum{ DISCONNECTED, diff --git a/dcscodec.cpp b/dcscodec.cpp index 9d9fc9a..e38d0a3 100755 --- a/dcscodec.cpp +++ b/dcscodec.cpp @@ -67,10 +67,11 @@ void DCSCodec::process_udp() if( (m_modeinfo.status == CONNECTING) && (size == 14) && (!memcmp(buf.data()+10, "ACK", 3)) ){ qDebug() << "Connected to DCS"; m_modeinfo.status = CONNECTED_RW; - m_modeinfo.vocoder_loaded = load_vocoder_plugin(); + m_modeinfo.sw_vocoder_loaded = load_vocoder_plugin(); if(m_vocoder != ""){ m_hwrx = true; m_hwtx = true; + m_modeinfo.hw_vocoder_loaded = true; m_ambedev = new SerialAMBE("DCS"); m_ambedev->connect_to_serial(m_vocoder); connect(m_ambedev, SIGNAL(data_ready()), this, SLOT(get_ambe())); @@ -412,7 +413,7 @@ void DCSCodec::transmit() } } else{ - if(m_modeinfo.vocoder_loaded){ + if(m_modeinfo.sw_vocoder_loaded){ m_mbevocoder->encode_2400x1200(pcm, ambe); } send_frame(ambe); @@ -588,7 +589,7 @@ void DCSCodec::process_rx_data() } } else{ - if(m_modeinfo.vocoder_loaded){ + if(m_modeinfo.sw_vocoder_loaded){ m_mbevocoder->decode_2400x1200(pcm, ambe); } else{ diff --git a/dmrcodec.cpp b/dmrcodec.cpp index 2015628..d3024f7 100755 --- a/dmrcodec.cpp +++ b/dmrcodec.cpp @@ -308,7 +308,7 @@ void DMRCodec::setup_connection() { m_modeinfo.status = CONNECTED_RW; //m_mbeenc->set_gain_adjust(2.5); - m_modeinfo.vocoder_loaded = load_vocoder_plugin(); + m_modeinfo.sw_vocoder_loaded = load_vocoder_plugin(); m_txtimer = new QTimer(); connect(m_txtimer, SIGNAL(timeout()), this, SLOT(transmit())); m_rxtimer = new QTimer(); @@ -319,6 +319,7 @@ void DMRCodec::setup_connection() if(m_vocoder != ""){ m_hwrx = true; m_hwtx = true; + m_modeinfo.hw_vocoder_loaded = true; m_ambedev = new SerialAMBE("DMR"); m_ambedev->connect_to_serial(m_vocoder); connect(m_ambedev, SIGNAL(data_ready()), this, SLOT(get_ambe())); @@ -483,7 +484,7 @@ void DMRCodec::transmit() m_ambedev->encode(pcm); } else{ - if(m_modeinfo.vocoder_loaded){ + if(m_modeinfo.sw_vocoder_loaded){ m_mbevocoder->encode_2450x1150(pcm, ambe); } for(int i = 0; i < 9; ++i){ @@ -958,7 +959,7 @@ void DMRCodec::process_rx_data() } } else{ - if(m_modeinfo.vocoder_loaded){ + if(m_modeinfo.sw_vocoder_loaded){ m_mbevocoder->decode_2450x1150(pcm, ambe); } else{ diff --git a/droidstar.cpp b/droidstar.cpp index 6e48eb0..27ef215 100644 --- a/droidstar.cpp +++ b/droidstar.cpp @@ -124,17 +124,29 @@ void DroidStar::discover_devices() } } -void DroidStar::download_file(QString f) +void DroidStar::download_file(QString f, bool u) { - HttpManager *http = new HttpManager(f); + qDebug() << "download_file() " << f << ":" << u; + HttpManager *http = new HttpManager(f, u); QThread *httpThread = new QThread; http->moveToThread(httpThread); connect(httpThread, SIGNAL(started()), http, SLOT(process())); - connect(http, SIGNAL(file_downloaded(QString)), this, SLOT(file_downloaded(QString))); + if(u){ + connect(http, SIGNAL(file_downloaded(QString)), this, SLOT(url_downloaded(QString))); + } + else{ + connect(http, SIGNAL(file_downloaded(QString)), this, SLOT(file_downloaded(QString))); + } connect(httpThread, SIGNAL(finished()), http, SLOT(deleteLater())); httpThread->start(); } +void DroidStar::url_downloaded(QString url) +{ + qDebug() << "DudeStar::url_downloaded() " << url; + emit update_log("Downloaded " + url); +} + void DroidStar::file_downloaded(QString filename) { qDebug() << "DudeStar::file_downloaded() " << filename; @@ -1349,7 +1361,7 @@ void DroidStar::update_ref_data(Codec::MODEINFO info) if(m_rptr1.isEmpty()) set_rptr1(m_callsign + " " + m_module); emit update_log("Connected to DStar " + m_host + " " + m_hostname + ":" + QString::number(m_port)); - if(info.vocoder_loaded){ + if(info.sw_vocoder_loaded){ emit update_log("Vocoder plugin loaded"); } else{ @@ -1404,7 +1416,7 @@ void DroidStar::update_dcs_data(Codec::MODEINFO info) if(m_rptr1.isEmpty()) set_rptr1(m_callsign + " " + m_module); emit update_log("Connected to DStar " + m_host + " " + m_hostname + ":" + QString::number(m_port)); - if(info.vocoder_loaded){ + if(info.sw_vocoder_loaded){ emit update_log("Vocoder plugin loaded"); } else{ @@ -1460,7 +1472,7 @@ void DroidStar::update_xrf_data(Codec::MODEINFO info) if(m_rptr1.isEmpty()) set_rptr1(m_callsign + " " + m_module); emit update_log("Connected to DStar " + m_host + " " + m_hostname + ":" + QString::number(m_port)); - if(info.vocoder_loaded){ + if(info.sw_vocoder_loaded){ emit update_log("Vocoder plugin loaded"); } else{ @@ -1507,7 +1519,7 @@ void DroidStar::update_nxdn_data(Codec::MODEINFO info) emit swrx_state(!m_nxdn->get_hwrx()); emit update_log("Connected to " + m_protocol + " " + m_host + " " + m_hostname + ":" + QString::number(m_port)); - if(info.vocoder_loaded){ + if(info.sw_vocoder_loaded){ emit update_log("Vocoder plugin loaded"); } else{ @@ -1570,7 +1582,7 @@ void DroidStar::update_dmr_data(Codec::MODEINFO info) emit swrx_state(!m_dmr->get_hwrx()); emit update_log("Connected to " + m_protocol + " " + m_host + " " + m_hostname + ":" + QString::number(m_port)); - if(info.vocoder_loaded){ + if(info.sw_vocoder_loaded){ emit update_log("Vocoder plugin loaded"); } else{ @@ -1620,11 +1632,14 @@ void DroidStar::update_ysf_data(Codec::MODEINFO info) emit swrx_state(!m_ysf->get_hwrx()); emit update_log("Connected to " + m_protocol + " " + m_host + " " + m_hostname + ":" + QString::number(m_port)); - if(info.vocoder_loaded){ + if(info.sw_vocoder_loaded){ emit update_log("Vocoder plugin loaded"); } else{ emit update_log("No vocoder plugin found"); + if(!info.hw_vocoder_loaded) { + emit open_vocoder_dialog(); + } } } m_statustxt = "Host: " + m_hostname + ":" + QString::number(m_port) + " Cnt: " + QString::number(info.count); diff --git a/droidstar.h b/droidstar.h index 9bfe307..37e463b 100644 --- a/droidstar.h +++ b/droidstar.h @@ -43,6 +43,7 @@ signals: void module_changed(char); void update_data(); void update_log(QString); + void open_vocoder_dialog(); void update_settings(); void connect_status_changed(int c); void in_audio_vol_changed(qreal); @@ -233,8 +234,9 @@ public slots: QString get_build_abi() { return QSysInfo::buildAbi(); } QString get_software_build() { return VERSION_NUMBER; } - void download_file(QString); + void download_file(QString, bool u = false); void file_downloaded(QString); + void url_downloaded(QString); unsigned short get_output_level(){ return m_outlevel; } void set_output_level(unsigned short l){ m_outlevel = l; } private: diff --git a/httpmanager.cpp b/httpmanager.cpp index 8174213..9e85d47 100644 --- a/httpmanager.cpp +++ b/httpmanager.cpp @@ -17,11 +17,12 @@ #include "httpmanager.h" -HttpManager::HttpManager(QString f) : QObject(nullptr) +HttpManager::HttpManager(QString f, bool u) : QObject(nullptr) { m_qnam = new QNetworkAccessManager(this); QObject::connect(m_qnam, SIGNAL(finished(QNetworkReply*)), this, SLOT(http_finished(QNetworkReply*))); m_config_path = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation); + m_url = u; #if !defined(Q_OS_ANDROID) && !defined(Q_OS_WIN) m_config_path += "/dudetronics"; #endif @@ -31,13 +32,16 @@ HttpManager::HttpManager(QString f) : QObject(nullptr) void HttpManager::process() { QMetaObject::invokeMethod(this,"doRequest"); - //qDebug() << "process() called"; - //send to the event loop } void HttpManager::doRequest() { - m_qnam->get(QNetworkRequest(QUrl("http://www.dudetronics.com/ar-dns" + m_filename))); + if(m_url){ + m_qnam->get(QNetworkRequest(QUrl(m_filename))); + } + else{ + m_qnam->get(QNetworkRequest(QUrl("http://www.dudetronics.com/ar-dns" + m_filename))); + } //qDebug() << "doRequest() called m_filename == " << m_filename; } @@ -51,7 +55,13 @@ void HttpManager::http_finished(QNetworkReply *reply) return; } else{ + if(m_url){ + QStringList l = m_filename.split('/'); + m_filename = "/" + l.at(l.size() - 1); + } + qDebug() << "m_filename = " << m_filename; QFile *hosts_file = new QFile(m_config_path + m_filename); + qDebug() << "m_config_path + m_filename = " << m_config_path + m_filename; hosts_file->open(QIODevice::WriteOnly); QFileInfo fileInfo(hosts_file->fileName()); QString filename(fileInfo.fileName()); diff --git a/httpmanager.h b/httpmanager.h index 1222964..fa2f1d4 100644 --- a/httpmanager.h +++ b/httpmanager.h @@ -25,7 +25,7 @@ class HttpManager : public QObject { Q_OBJECT public: - explicit HttpManager(QString); + explicit HttpManager(QString, bool u = false); //void start_request(QString file); signals: @@ -35,6 +35,7 @@ private: QString m_filename; QString m_config_path; QNetworkAccessManager *m_qnam; + bool m_url; private slots: void process(); diff --git a/main.qml b/main.qml index 422fe34..43c65b0 100644 --- a/main.qml +++ b/main.qml @@ -55,9 +55,9 @@ ApplicationWindow { text: "Check log tab for details" } MessageDialog { - id: disclaimerDialog - title: "D-Star WARNING" - text: "DroidStar should only be used to monitor D-Star reflectors.\nDO NOT USE DROIDSTAR FOR GENERAL DSTAR TX.\nListening to D-Star reflectors is fine.\nD-Star vocoder quality is not very good, so transmitting should\nonly be done for experimentation and development purposes.\n\nYOU HAVE BEEN WARNED!" + id: vocoderDialog + title: "No vocoder found" + text: "No hardware or software vocoder found for this mode. You can still connect, but you will not RX or TX any audio. See the project website (url on the About tab) for info on loading a sw vocoder, or use a USB AMBE dongle (and an OTG adapter on Android devices)" } TabBar { @@ -405,6 +405,10 @@ ApplicationWindow { function onUpdate_log(s) { logTab.logText.append(s); } + function onOpen_vocoder_dialog() { + vocoderDialog.open(); + } + function onConnect_status_changed(c) { if(c === 0){ if(mainTab.buttonTX.tx){ diff --git a/nxdncodec.cpp b/nxdncodec.cpp index f2e6277..18a2f90 100755 --- a/nxdncodec.cpp +++ b/nxdncodec.cpp @@ -79,10 +79,11 @@ void NXDNCodec::process_udp() m_ping_timer = new QTimer(); connect(m_ping_timer, SIGNAL(timeout()), this, SLOT(send_ping())); //m_mbeenc->set_gain_adjust(2.5); - m_modeinfo.vocoder_loaded = load_vocoder_plugin(); + m_modeinfo.sw_vocoder_loaded = load_vocoder_plugin(); if(m_vocoder != ""){ m_hwrx = true; m_hwtx = true; + m_modeinfo.hw_vocoder_loaded = true; m_ambedev = new SerialAMBE("NXDN"); m_ambedev->connect_to_serial(m_vocoder); connect(m_ambedev, SIGNAL(data_ready()), this, SLOT(get_ambe())); @@ -312,7 +313,7 @@ void NXDNCodec::transmit() m_ambedev->encode(pcm); } else{ - if(m_modeinfo.vocoder_loaded){ + if(m_modeinfo.sw_vocoder_loaded){ m_mbevocoder->encode_2450(pcm, ambe_frame); } for(int i = 0; i < 7; ++i){ @@ -692,7 +693,7 @@ void NXDNCodec::process_rx_data() } } else{ - if(m_modeinfo.vocoder_loaded){ + if(m_modeinfo.sw_vocoder_loaded){ m_mbevocoder->decode_2450(pcm, ambe); } else{ diff --git a/refcodec.cpp b/refcodec.cpp index b641e8b..9878fa8 100755 --- a/refcodec.cpp +++ b/refcodec.cpp @@ -88,11 +88,12 @@ void REFCodec::process_udp() #endif if((m_modeinfo.status == CONNECTING) && (buf.size() == 0x08)){ if((memcmp(&buf.data()[4], "OKRW", 4) == 0) || (memcmp(&buf.data()[4], "OKRO", 4) == 0) || (memcmp(&buf.data()[4], "BUSY", 4) == 0)){ - m_modeinfo.vocoder_loaded = load_vocoder_plugin(); + m_modeinfo.sw_vocoder_loaded = load_vocoder_plugin(); if(m_vocoder != ""){ m_hwrx = true; m_hwtx = true; + m_modeinfo.hw_vocoder_loaded = true; m_ambedev = new SerialAMBE("REF"); m_ambedev->connect_to_serial(m_vocoder); connect(m_ambedev, SIGNAL(data_ready()), this, SLOT(get_ambe())); @@ -453,7 +454,7 @@ void REFCodec::transmit() } } else{ - if(m_modeinfo.vocoder_loaded){ + if(m_modeinfo.sw_vocoder_loaded){ m_mbevocoder->encode_2400x1200(pcm, ambe); } send_frame(ambe); @@ -691,7 +692,7 @@ void REFCodec::process_rx_data() } } else{ - if(m_modeinfo.vocoder_loaded){ + if(m_modeinfo.sw_vocoder_loaded){ m_mbevocoder->decode_2400x1200(pcm, ambe); } else{ diff --git a/xrfcodec.cpp b/xrfcodec.cpp index 65a54e3..a6de062 100755 --- a/xrfcodec.cpp +++ b/xrfcodec.cpp @@ -64,10 +64,11 @@ void XRFCodec::process_udp() if( (m_modeinfo.status == CONNECTING) && (buf.size() == 14) && (!memcmp(buf.data()+10, "ACK", 3)) ){ m_modeinfo.status = CONNECTED_RW; - m_modeinfo.vocoder_loaded = load_vocoder_plugin(); + m_modeinfo.sw_vocoder_loaded = load_vocoder_plugin(); if(m_vocoder != ""){ m_hwrx = true; m_hwtx = true; + m_modeinfo.hw_vocoder_loaded = true; m_ambedev = new SerialAMBE("XRF"); m_ambedev->connect_to_serial(m_vocoder); connect(m_ambedev, SIGNAL(data_ready()), this, SLOT(get_ambe())); @@ -407,7 +408,7 @@ void XRFCodec::transmit() } } else{ - if(m_modeinfo.vocoder_loaded){ + if(m_modeinfo.sw_vocoder_loaded){ m_mbevocoder->encode_2400x1200(pcm, ambe); } send_frame(ambe); @@ -613,7 +614,7 @@ void XRFCodec::process_rx_data() } } else{ - if(m_modeinfo.vocoder_loaded){ + if(m_modeinfo.sw_vocoder_loaded){ m_mbevocoder->decode_2400x1200(pcm, ambe); } else{ diff --git a/ysfcodec.cpp b/ysfcodec.cpp index 8a0a493..0195b62 100755 --- a/ysfcodec.cpp +++ b/ysfcodec.cpp @@ -137,13 +137,14 @@ void YSFCodec::process_udp() connect(m_ping_timer, SIGNAL(timeout()), this, SLOT(send_ping())); set_fcs_mode(false); //m_mbeenc->set_gain_adjust(2.5); - m_modeinfo.vocoder_loaded = load_vocoder_plugin(); + m_modeinfo.sw_vocoder_loaded = load_vocoder_plugin(); m_rxtimer = new QTimer(); connect(m_rxtimer, SIGNAL(timeout()), this, SLOT(process_rx_data())); if(m_vocoder != ""){ m_hwrx = true; m_hwtx = true; + m_modeinfo.hw_vocoder_loaded = true; m_ambedev = new SerialAMBE("YSF"); m_ambedev->connect_to_serial(m_vocoder); connect(m_ambedev, SIGNAL(data_ready()), this, SLOT(get_ambe())); @@ -672,7 +673,7 @@ void YSFCodec::transmit() } else{ s = 7; - if(m_modeinfo.vocoder_loaded){ + if(m_modeinfo.sw_vocoder_loaded){ m_mbevocoder->encode_2450(pcm, ambe); } } @@ -1326,7 +1327,7 @@ void YSFCodec::process_rx_data() } } else{ - if(m_modeinfo.vocoder_loaded){ + if(m_modeinfo.sw_vocoder_loaded){ m_mbevocoder->decode_2450(pcm, ambe); } else{