diff --git a/DroidStar.pro b/DroidStar.pro index b0ac966..9f0afa9 100644 --- a/DroidStar.pro +++ b/DroidStar.pro @@ -5,7 +5,7 @@ equals(QT_MAJOR_VERSION, 5){ } unix:!ios:QT += serialport -CONFIG += c++11 +CONFIG += c++17 LFLAGS += android:INCLUDEPATH += $$(HOME)/Android/local/include LIBS += -limbe_vocoder -lvocoder diff --git a/audioengine.cpp b/audioengine.cpp index 2f0caba..f730975 100644 --- a/audioengine.cpp +++ b/audioengine.cpp @@ -176,20 +176,15 @@ QStringList AudioEngine::discover_audio_devices(uint8_t d) void AudioEngine::init() { QAudioFormat format; - QAudioFormat tempformat; format.setSampleRate(8000); format.setChannelCount(1); format.setSampleFormat(QAudioFormat::Int16); - //format.setSampleSize(16); - //format.setCodec("audio/pcm"); - //format.setByteOrder(QAudioFormat::LittleEndian); - //format.setSampleType(QAudioFormat::SignedInt); m_agc = true; QList devices = QMediaDevices::audioOutputs(); if(devices.size() == 0){ - fprintf(stderr, "No audio playback hardware found\n");fflush(stderr); + qDebug() << "No audio playback hardware found"; } else{ QAudioDevice device(QMediaDevices::defaultAudioOutput()); @@ -204,25 +199,20 @@ void AudioEngine::init() } } if (!device.isFormatSupported(format)) { - qWarning() << "Raw audio format not supported by backend, trying nearest format."; - //tempformat = device.nearestFormat(format); - //qWarning() << "Format now set to " << format.sampleRate() << ":" << format.sampleSize(); - } - else{ - tempformat = format; - } - fprintf(stderr, "Using playback device %s\n", device.description().toStdString().c_str());fflush(stderr); + qWarning() << "Raw audio format not supported by playback device"; + } - m_out = new QAudioSink(device, tempformat, this); + qDebug() << "Playback device: " << device.description() << "SR: " << format.sampleRate(); + + m_out = new QAudioSink(device, format, this); m_out->setBufferSize(1280); connect(m_out, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State))); - //m_outdev = m_out->start(); } devices = QMediaDevices::audioInputs(); - if(devices.size() == 0){ - fprintf(stderr, "No audio recording hardware found\n");fflush(stderr); + if(devices.size() == 0){ + qDebug() << "No audio capture hardware found"; } else{ QAudioDevice device(QMediaDevices::defaultAudioInput()); @@ -237,13 +227,8 @@ void AudioEngine::init() } } if (!device.isFormatSupported(format)) { - qWarning() << "Raw audio format not supported by backend, trying nearest format."; - //tempformat = device.nearestFormat(format); - //qWarning() << "Format now set to " << format.sampleRate() << ":" << format.sampleSize(); - } - else{ - tempformat = format; - } + qWarning() << "Raw audio format not supported by capture device"; + } int sr = 8000; if(MACHAK){ @@ -251,11 +236,9 @@ void AudioEngine::init() m_srm = (float)sr / 8000.0; } format.setSampleRate(sr); - m_in = new QAudioSource(device, format, this); - fprintf(stderr, "Capture device: %s SR: %d resample factor: %f\n", device.description().toStdString().c_str(), sr, m_srm);fflush(stderr); + m_in = new QAudioSource(device, format, this); + qDebug() << "Capture device: " << device.description() << " SR: " << sr << " resample factor: " << m_srm; } - - //start_playback(); } #endif diff --git a/dmr.cpp b/dmr.cpp index 381ad63..56c03c7 100755 --- a/dmr.cpp +++ b/dmr.cpp @@ -188,7 +188,7 @@ void DMR::process_udp() (m_modeinfo.status == CONNECTED_RW)) { m_rxwatchdog = 0; - uint8_t t; + uint8_t t = 0; if((uint8_t)buf.data()[15] & 0x02){ qDebug() << "DMR RX EOT"; m_modeinfo.stream_state = STREAM_END; diff --git a/droidstar.cpp b/droidstar.cpp index c6b5401..4af2356 100644 --- a/droidstar.cpp +++ b/droidstar.cpp @@ -417,7 +417,7 @@ void DroidStar::process_connect() m_modethread->start(); } - +/* qDebug() << "process_connect called m_callsign == " << m_callsign; qDebug() << "process_connect called m_dmrid == " << m_dmrid; qDebug() << "process_connect called m_bm_password == " << m_bm_password; @@ -428,6 +428,7 @@ void DroidStar::process_connect() qDebug() << "process_connect called m_module == " << m_module; qDebug() << "process_connect called m_protocol == " << m_protocol; qDebug() << "process_connect called m_port == " << m_port; +*/ } void DroidStar::process_host_change(const QString &h) @@ -720,7 +721,7 @@ void DroidStar::process_dstar_hosts(QString m) } m_customhosts = m_localhosts.split('\n'); - for (const auto& i : qAsConst(m_customhosts)){ + for (const auto& i : std::as_const(m_customhosts)){ QStringList line = i.simplified().split(' '); if(line.at(0) == m){ @@ -761,7 +762,7 @@ void DroidStar::process_ysf_hosts() } m_customhosts = m_localhosts.split('\n'); - for (const auto& i : qAsConst(m_customhosts)){ + for (const auto& i : std::as_const(m_customhosts)){ QStringList line = i.simplified().split(' '); if(line.at(0) == "YSF"){ @@ -804,7 +805,7 @@ void DroidStar::process_fcs_rooms() } m_customhosts = m_localhosts.split('\n'); - for (const auto& i : qAsConst(m_customhosts)){ + for (const auto& i : std::as_const(m_customhosts)){ QStringList line = i.simplified().split(' '); if(line.at(0) == "FCS"){ @@ -850,7 +851,7 @@ void DroidStar::process_dmr_hosts() } m_customhosts = m_localhosts.split('\n'); - for (const auto& i : qAsConst(m_customhosts)){ + for (const auto& i : std::as_const(m_customhosts)){ QStringList line = i.simplified().split(' '); if(line.at(0) == "DMR"){ @@ -891,7 +892,7 @@ void DroidStar::process_p25_hosts() } m_customhosts = m_localhosts.split('\n'); - for (const auto& i : qAsConst(m_customhosts)){ + for (const auto& i : std::as_const(m_customhosts)){ QStringList line = i.simplified().split(' '); if(line.at(0) == "P25"){ @@ -935,7 +936,7 @@ void DroidStar::process_nxdn_hosts() } m_customhosts = m_localhosts.split('\n'); - for (const auto& i : qAsConst(m_customhosts)){ + for (const auto& i : std::as_const(m_customhosts)){ QStringList line = i.simplified().split(' '); if(line.at(0) == "NXDN"){ @@ -980,7 +981,7 @@ void DroidStar::process_m17_hosts() } m_customhosts = m_localhosts.split('\n'); - for (const auto& i : qAsConst(m_customhosts)){ + for (const auto& i : std::as_const(m_customhosts)){ QStringList line = i.simplified().split(' '); if(line.at(0) == "M17"){