diff --git a/src/blackcore/afv/audio/output.cpp b/src/blackcore/afv/audio/output.cpp index edb052470..77b54969d 100644 --- a/src/blackcore/afv/audio/output.cpp +++ b/src/blackcore/afv/audio/output.cpp @@ -53,8 +53,8 @@ namespace BlackCore { OutputVolumeStreamArgs outputVolumeStreamArgs; outputVolumeStreamArgs.PeakRaw = m_maxSampleOutput / 1.0; - outputVolumeStreamArgs.PeakDB = static_cast(20 * std::log10(outputVolumeStreamArgs.PeakRaw)); - const double db = qBound(m_minDb, outputVolumeStreamArgs.PeakDB, m_maxDb); + outputVolumeStreamArgs.PeakDb = static_cast(20 * std::log10(outputVolumeStreamArgs.PeakRaw)); + const double db = qBound(m_minDb, outputVolumeStreamArgs.PeakDb, m_maxDb); double ratio = (db - m_minDb) / (m_maxDb - m_minDb); if (ratio < 0.30) { ratio = 0.0; } if (ratio > 1.0) { ratio = 1.0; } diff --git a/src/blackcore/afv/audio/output.h b/src/blackcore/afv/audio/output.h index fb4c28699..3f6052f24 100644 --- a/src/blackcore/afv/audio/output.h +++ b/src/blackcore/afv/audio/output.h @@ -26,9 +26,9 @@ namespace BlackCore //! Stream args struct OutputVolumeStreamArgs { - double PeakRaw = 0.0; - double PeakDB = -1 * std::numeric_limits::infinity(); - double PeakVU = 0.0; + double PeakRaw = 0.0; //!< raw peak + double PeakDb = -1 * std::numeric_limits::infinity(); //!< dB peak + double PeakVU = 0.0; //!< VU peak }; //! Output buffer @@ -60,9 +60,9 @@ namespace BlackCore static constexpr int SampleCountPerEvent = 4800; QAudioFormat m_outputFormat; float m_maxSampleOutput = 0.0; - int m_sampleCount = 0; - const double m_maxDb = 0; - const double m_minDb = -40; + int m_sampleCount = 0; + const double m_maxDb = 0; + const double m_minDb = -40; }; //! Output @@ -95,10 +95,9 @@ namespace BlackCore private: bool m_started = false; - BlackMisc::Audio::CAudioDeviceInfo m_device; - QScopedPointer m_audioOutputCom; - CAudioOutputBuffer *m_audioOutputBuffer = nullptr; + QScopedPointer m_audioOutputCom; + CAudioOutputBuffer *m_audioOutputBuffer = nullptr; }; } // ns } // ns diff --git a/src/blackcore/afv/model/afvmapreader.cpp b/src/blackcore/afv/model/afvmapreader.cpp index d0bcf1214..d522a6efd 100644 --- a/src/blackcore/afv/model/afvmapreader.cpp +++ b/src/blackcore/afv/model/afvmapreader.cpp @@ -38,24 +38,24 @@ namespace BlackCore QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData); if (jsonDoc.isObject()) { - QJsonObject rootObject = jsonDoc.object(); + const QJsonObject rootObject = jsonDoc.object(); QVector transceivers; if (rootObject.contains("controllers")) { - QJsonObject otherObject = rootObject.value("controllers").toObject(); + const QJsonObject otherObject = rootObject.value("controllers").toObject(); for (auto it = otherObject.begin(); it != otherObject.end(); ++it) { - QString callsign = it.key(); + const QString callsign = it.key(); if (it.value().isObject()) { - QJsonObject stationObject = it.value().toObject(); + const QJsonObject stationObject = it.value().toObject(); if (stationObject.contains("transceivers")) { QJsonArray txArray = stationObject.value("transceivers").toArray(); for (auto jt = txArray.begin(); jt != txArray.end(); ++jt) { - TransceiverDto transceiver = TransceiverDto::fromJson(jt->toObject()); + const TransceiverDto transceiver = TransceiverDto::fromJson(jt->toObject()); transceivers.push_back({ callsign, transceiver}); } } @@ -65,19 +65,19 @@ namespace BlackCore if (rootObject.contains("other") && rootObject.value("other").isObject()) { - QJsonObject otherObject = rootObject.value("other").toObject(); + const QJsonObject otherObject = rootObject.value("other").toObject(); for (auto it = otherObject.begin(); it != otherObject.end(); ++it) { - QString callsign = it.key(); + const QString callsign = it.key(); if (it.value().isObject()) { QJsonObject stationObject = it.value().toObject(); if (stationObject.contains("transceivers")) { - QJsonArray txArray = stationObject.value("transceivers").toArray(); + const QJsonArray txArray = stationObject.value("transceivers").toArray(); for (auto jt = txArray.begin(); jt != txArray.end(); ++jt) { - TransceiverDto transceiver = TransceiverDto::fromJson(jt->toObject()); + const TransceiverDto transceiver = TransceiverDto::fromJson(jt->toObject()); transceivers.push_back({ callsign, transceiver}); } } diff --git a/src/blackcore/afv/model/afvmapreader.h b/src/blackcore/afv/model/afvmapreader.h index 97e3c75f9..3c65332b4 100644 --- a/src/blackcore/afv/model/afvmapreader.h +++ b/src/blackcore/afv/model/afvmapreader.h @@ -31,10 +31,13 @@ namespace BlackCore //! Ctor CAfvMapReader(QObject *parent = nullptr); + //! Own callsign Q_INVOKABLE void setOwnCallsign(const QString &callsign) { m_callsign = callsign; } + //! Update ATC stations in model void updateFromMap(); + //! ATC model CSampleAtcStationModel *getAtcStationModel() { return m_model; } private: diff --git a/src/blackcore/afv/model/atcstationmodel.cpp b/src/blackcore/afv/model/atcstationmodel.cpp index 2114e2bd6..7e4a10f92 100644 --- a/src/blackcore/afv/model/atcstationmodel.cpp +++ b/src/blackcore/afv/model/atcstationmodel.cpp @@ -44,9 +44,8 @@ namespace BlackCore double CSampleAtcStation::radioDistanceM() const { - double sqrtAltM = qSqrt(m_transceiver.HeightMslM); + const double sqrtAltM = qSqrt(m_transceiver.HeightMslM); const double radioFactor = 4193.18014745372; - return radioFactor * sqrtAltM; } @@ -68,7 +67,7 @@ namespace BlackCore for (int i = m_atcStations.size() - 1; i >= 0; i--) { CSampleAtcStation &station = m_atcStations[i]; - if (! m_atcStations.contains(station)) + if (!m_atcStations.contains(station)) { removeStationAtPosition(i); } @@ -113,12 +112,12 @@ namespace BlackCore QHash CSampleAtcStationModel::roleNames() const { QHash roles; - roles[CallsignRole] = "callsign"; - roles[LatitudeRole] = "latitude"; - roles[LongitudeRole] = "longitude"; + roles[CallsignRole] = "callsign"; + roles[LatitudeRole] = "latitude"; + roles[LongitudeRole] = "longitude"; roles[RadioDistanceRole] = "radioDistanceM"; - roles[FrequencyRole] = "frequencyAsString"; - roles[FrequencyKhzRole] = "frequencyKhz"; + roles[FrequencyRole] = "frequencyAsString"; + roles[FrequencyKhzRole] = "frequencyKhz"; return roles; } }