Some misc tweaks and cleanups

pull/3/head
Doug McLain 3 years ago
parent bf13158387
commit 8a52904611

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?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="64" android:installLocation="auto"> <manifest package="org.dudetronics.droidstar" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="66" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30"/> <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30"/>
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
@ -81,5 +81,5 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
</manifest> </manifest>

@ -17,6 +17,7 @@
#include "audioengine.h" #include "audioengine.h"
#include <QDebug> #include <QDebug>
#include <QTimer>
#include <cmath> #include <cmath>
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
@ -110,7 +111,7 @@ void AudioEngine::init()
fprintf(stderr, "Using playback device %s\n", info.deviceName().toStdString().c_str());fflush(stderr); fprintf(stderr, "Using playback device %s\n", info.deviceName().toStdString().c_str());fflush(stderr);
m_out = new QAudioOutput(info, tempformat, this); m_out = new QAudioOutput(info, tempformat, this);
m_out->setBufferSize(19200); m_out->setBufferSize(2560);
connect(m_out, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State))); connect(m_out, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State)));
//m_outdev = m_out->start(); //m_outdev = m_out->start();
} }
@ -176,12 +177,13 @@ void AudioEngine::stop_capture()
void AudioEngine::start_playback() void AudioEngine::start_playback()
{ {
//m_out->reset();
m_outdev = m_out->start(); m_outdev = m_out->start();
} }
void AudioEngine::stop_playback() void AudioEngine::stop_playback()
{ {
//m_outdev->reset();
m_out->reset();
m_out->stop(); m_out->stop();
} }
@ -233,7 +235,12 @@ void AudioEngine::write(int16_t *pcm, size_t s)
process_audio(pcm, s); process_audio(pcm, s);
} }
m_outdev->write((const char *) pcm, sizeof(int16_t) * s); size_t l = m_outdev->write((const char *) pcm, sizeof(int16_t) * s);
if (l*2 < s){
qDebug() << "AudioEngine::write() " << s << ":" << l << ":" << (int)m_out->bytesFree() << ":" << m_out->bufferSize() << ":" << m_out->error();
}
for(uint32_t i = 0; i < s; ++i){ for(uint32_t i = 0; i < s; ++i){
if(pcm[i] > m_maxlevel){ if(pcm[i] > m_maxlevel){
m_maxlevel = pcm[i]; m_maxlevel = pcm[i];

@ -1429,7 +1429,7 @@ void DroidStar::update_ref_data(Codec::MODEINFO info)
} }
} }
m_netstatustxt = "Host: " + m_hostname + ":" + QString::number(m_port) + " Cnt: " + QString::number(info.count); m_netstatustxt = "Connected ping cnt: " + QString::number(info.count);
m_ambestatustxt = "AMBE: " + (info.ambeprodid.isEmpty() ? "No device" : info.ambeprodid); m_ambestatustxt = "AMBE: " + (info.ambeprodid.isEmpty() ? "No device" : info.ambeprodid);
m_mmdvmstatustxt = "MMDVM: "; m_mmdvmstatustxt = "MMDVM: ";
@ -1502,7 +1502,7 @@ void DroidStar::update_dcs_data(Codec::MODEINFO info)
} }
} }
m_netstatustxt = "Host: " + m_hostname + ":" + QString::number(m_port) + " Cnt: " + QString::number(info.count); m_netstatustxt = "Connected ping cnt: " + QString::number(info.count);
m_ambestatustxt = "AMBE: " + (info.ambeprodid.isEmpty() ? "No device" : info.ambeprodid); m_ambestatustxt = "AMBE: " + (info.ambeprodid.isEmpty() ? "No device" : info.ambeprodid);
m_mmdvmstatustxt = "MMDVM: "; m_mmdvmstatustxt = "MMDVM: ";
@ -1576,7 +1576,7 @@ void DroidStar::update_xrf_data(Codec::MODEINFO info)
} }
} }
m_netstatustxt = "Host: " + m_hostname + ":" + QString::number(m_port) + " Cnt: " + QString::number(info.count); m_netstatustxt = "Connected ping cnt: " + QString::number(info.count);
m_ambestatustxt = "AMBE: " + (info.ambeprodid.isEmpty() ? "No device" : info.ambeprodid); m_ambestatustxt = "AMBE: " + (info.ambeprodid.isEmpty() ? "No device" : info.ambeprodid);
m_mmdvmstatustxt = "MMDVM: "; m_mmdvmstatustxt = "MMDVM: ";
@ -1641,7 +1641,7 @@ void DroidStar::update_nxdn_data(Codec::MODEINFO info)
} }
} }
m_netstatustxt = "Host: " + m_hostname + ":" + QString::number(m_port) + " Cnt: " + QString::number(info.count); m_netstatustxt = "Connected ping cnt: " + QString::number(info.count);
m_ambestatustxt = "AMBE: " + (info.ambeprodid.isEmpty() ? "No device" : info.ambeprodid); m_ambestatustxt = "AMBE: " + (info.ambeprodid.isEmpty() ? "No device" : info.ambeprodid);
m_mmdvmstatustxt = "MMDVM: "; m_mmdvmstatustxt = "MMDVM: ";
@ -1722,7 +1722,7 @@ void DroidStar::update_dmr_data(Codec::MODEINFO info)
} }
} }
m_netstatustxt = "Host: " + m_hostname + ":" + QString::number(m_port) + " Cnt: " + QString::number(info.count); m_netstatustxt = "Connected ping cnt: " + QString::number(info.count);
m_ambestatustxt = "AMBE: " + (info.ambeprodid.isEmpty() ? "No device" : info.ambeprodid); m_ambestatustxt = "AMBE: " + (info.ambeprodid.isEmpty() ? "No device" : info.ambeprodid);
m_mmdvmstatustxt = "MMDVM: "; m_mmdvmstatustxt = "MMDVM: ";
@ -1810,7 +1810,7 @@ void DroidStar::update_ysf_data(Codec::MODEINFO info)
} }
} }
m_netstatustxt = "Host: " + m_hostname + ":" + QString::number(m_port) + " Cnt: " + QString::number(info.count); m_netstatustxt = "Connected ping cnt: " + QString::number(info.count);
m_ambestatustxt = "AMBE: " + (info.ambeprodid.isEmpty() ? "No device" : info.ambeprodid); m_ambestatustxt = "AMBE: " + (info.ambeprodid.isEmpty() ? "No device" : info.ambeprodid);
m_mmdvmstatustxt = "MMDVM: "; m_mmdvmstatustxt = "MMDVM: ";
@ -1948,7 +1948,7 @@ void DroidStar::update_m17_data(M17Codec::MODEINFO info)
emit update_log("Connected to " + m_protocol + " " + m_host + " " + m_hostname + ":" + QString::number(m_port)); emit update_log("Connected to " + m_protocol + " " + m_host + " " + m_hostname + ":" + QString::number(m_port));
} }
m_netstatustxt = "Host: " + m_hostname + ":" + QString::number(m_port) + " Cnt: " + QString::number(info.count); m_netstatustxt = "Connected ping cnt: " + QString::number(info.count);
m_ambestatustxt = "AMBE: " + (info.ambeprodid.isEmpty() ? "No device" : info.ambeprodid); m_ambestatustxt = "AMBE: " + (info.ambeprodid.isEmpty() ? "No device" : info.ambeprodid);
m_mmdvmstatustxt = "MMDVM: "; m_mmdvmstatustxt = "MMDVM: ";
@ -2010,7 +2010,7 @@ void DroidStar::update_iax_data()
emit update_log("Connected to " + m_protocol + " " + m_iaxhost + ":" + QString::number(m_iaxport)); emit update_log("Connected to " + m_protocol + " " + m_iaxhost + ":" + QString::number(m_iaxport));
} }
m_netstatustxt = "Host: " + m_iaxhost + ":" + QString::number(m_iaxport) + " Cnt: " + QString::number(m_iax->get_cnt()); m_netstatustxt = "Connected ping cnt: " + QString::number(m_iax->get_cnt());
emit update_data(); emit update_data();
} }

@ -474,19 +474,19 @@ void M17Codec::process_modem_data(QByteArray d)
CM17Convolution conv; CM17Convolution conv;
uint8_t tmp[M17_FRAME_LENGTH_BYTES]; uint8_t tmp[M17_FRAME_LENGTH_BYTES];
if(d.size() < 3){ if( (d.size() < 3) || m_tx ){
return; return;
} }
if( (d.data()[2] == MMDVM_M17_LINK_SETUP) && if( (d.data()[2] == MMDVM_M17_LINK_SETUP) &&
(((uint8_t)d.data()[4] != M17_LINK_SETUP_SYNC_BYTES[0]) || ((uint8_t)d.data()[5] != M17_LINK_SETUP_SYNC_BYTES[1]))){ (((uint8_t)d.data()[4] != M17_LINK_SETUP_SYNC_BYTES[0]) || ((uint8_t)d.data()[5] != M17_LINK_SETUP_SYNC_BYTES[1]))){
qDebug() << "LSF with no sync bytes" << (d.data()[2] == MMDVM_M17_LINK_SETUP) << ((uint8_t)d.data()[4] != M17_LINK_SETUP_SYNC_BYTES[0]) << ((uint8_t)d.data()[5] != M17_LINK_SETUP_SYNC_BYTES[1]); qDebug() << "M17 LSF with no sync bytes" << (d.data()[2] == MMDVM_M17_LINK_SETUP) << ((uint8_t)d.data()[4] != M17_LINK_SETUP_SYNC_BYTES[0]) << ((uint8_t)d.data()[5] != M17_LINK_SETUP_SYNC_BYTES[1]);
return; return;
} }
if( (d.data()[2] == MMDVM_M17_STREAM) && if( (d.data()[2] == MMDVM_M17_STREAM) &&
(((uint8_t)d.data()[4] != M17_STREAM_SYNC_BYTES[0]) || ((uint8_t)d.data()[5] != M17_STREAM_SYNC_BYTES[1]))){ (((uint8_t)d.data()[4] != M17_STREAM_SYNC_BYTES[0]) || ((uint8_t)d.data()[5] != M17_STREAM_SYNC_BYTES[1]))){
qDebug() << "stream frame with no sync bytes" << (d.data()[2] == MMDVM_M17_STREAM) << ((uint8_t)d.data()[4] != M17_STREAM_SYNC_BYTES[0]) << ((uint8_t)d.data()[5] != M17_STREAM_SYNC_BYTES[1]); qDebug() << "M17 stream frame with no sync bytes" << (d.data()[2] == MMDVM_M17_STREAM) << ((uint8_t)d.data()[4] != M17_STREAM_SYNC_BYTES[0]) << ((uint8_t)d.data()[5] != M17_STREAM_SYNC_BYTES[1]);
return; return;
} }

@ -174,9 +174,11 @@ void SerialModem::process_serial()
void SerialModem::process_modem() void SerialModem::process_modem()
{ {
QByteArray out; QByteArray out;
if(m_serialdata.size() < 3){ if(m_serialdata.size() < 3){
return; return;
} }
//qDebug() << "process_modem() " << (uint8_t)m_serialdata[0] << ":" << (uint8_t)m_serialdata[1] << ":" << m_serialdata.size(); //qDebug() << "process_modem() " << (uint8_t)m_serialdata[0] << ":" << (uint8_t)m_serialdata[1] << ":" << m_serialdata.size();
if(((uint8_t)m_serialdata[0] == MMDVM_FRAME_START) && (m_serialdata.size() >= m_serialdata[1])){ if(((uint8_t)m_serialdata[0] == MMDVM_FRAME_START) && (m_serialdata.size() >= m_serialdata[1])){
const uint8_t r = (uint8_t)m_serialdata[2]; const uint8_t r = (uint8_t)m_serialdata[2];
@ -187,14 +189,14 @@ void SerialModem::process_modem()
for(int i = 0; i < s; ++i){ for(int i = 0; i < s; ++i){
m_serialdata.dequeue(); m_serialdata.dequeue();
} }
if(m_serialdata[3] == 2){ if( (m_serialdata.size() > 3) && (m_serialdata[3] == 2) ){
} }
} }
else if(r == MMDVM_ACK){ else if(r == MMDVM_ACK){
qDebug() << "Received MMDVM_ACK"; qDebug() << "Received MMDVM_ACK";
if(m_serialdata[3] == 2){ if( (m_serialdata.size() > 3) && (m_serialdata[3] == 2) ){
emit connected(true); emit connected(true);
} }
for(int i = 0; i < s; ++i){ for(int i = 0; i < s; ++i){

Loading…
Cancel
Save