diff --git a/samples/afvclient/afvclientbridge.h b/samples/afvclient/afvclientbridge.h index 05b31f1a5..c5ead2272 100644 --- a/samples/afvclient/afvclientbridge.h +++ b/samples/afvclient/afvclientbridge.h @@ -33,7 +33,7 @@ public: double getOutputVolumePeakVU() const { return m_afvClient->getOutputVolumePeakVU(); } //! @} - //! \copydoc CAfvClient::getConnectionStatus + //! \copydoc BlackCore::Afv::Clients::CAfvClient::getConnectionStatus BlackCore::Afv::Clients::CAfvClient::ConnectionStatus getConnectionStatus() const { return m_afvClient->getConnectionStatus(); @@ -44,13 +44,13 @@ public: QString getReceivingCallsignsCom2() { return m_afvClient->getReceivingCallsignsCom2(); } //! @} - //! \copydoc CAfvClient::connectTo + //! \copydoc BlackCore::Afv::Clients::CAfvClient::connectTo Q_INVOKABLE void connectTo(const QString &cid, const QString &password, const QString &callsign) { m_afvClient->connectTo(cid, password, callsign); } - //! \copydoc CAfvClient::disconnectFrom + //! \copydoc BlackCore::Afv::Clients::CAfvClient::disconnectFrom Q_INVOKABLE void disconnectFrom() { m_afvClient->disconnectFrom(); } //! Audio devices @{ @@ -61,22 +61,22 @@ public: //! Enable/disable VHF simulation, true means effects are NOT used Q_INVOKABLE void setBypassEffects(bool value) { m_afvClient->setBypassEffects(value); } - //! \copydoc CAfvClient::startAudio + //! \copydoc BlackCore::Afv::Clients::CAfvClient::startAudio Q_INVOKABLE void startAudio(const QString &inputDeviceName, const QString &outputDeviceName) { m_afvClient->startAudio(inputDeviceName, outputDeviceName); } - //! \copydoc CAfvClient::enableTransceiver + //! \copydoc BlackCore::Afv::Clients::CAfvClient::enableTransceiver Q_INVOKABLE void enableTransceiver(quint16 id, bool enable) { m_afvClient->enableTransceiver(id, enable); } - //! \copydoc CAfvClient::updateComFrequency + //! \copydoc BlackCore::Afv::Clients::CAfvClient::updateComFrequency Q_INVOKABLE void updateComFrequency(quint16 id, quint32 frequencyHz) { m_afvClient->updateComFrequency(id, frequencyHz); } - //! \copydoc CAfvClient::updatePosition + //! \copydoc BlackCore::Afv::Clients::CAfvClient::updatePosition Q_INVOKABLE void updatePosition(double latitudeDeg, double longitudeDeg, double heightMeters) { m_afvClient->updatePosition(latitudeDeg, longitudeDeg, heightMeters); } - //! \copydoc CAfvClient::setPtt + //! \copydoc BlackCore::Afv::Clients::CAfvClient::setPtt Q_INVOKABLE void setPtt(bool active) { m_afvClient->setPtt(active); } //! Loopback @{ @@ -84,10 +84,10 @@ public: Q_INVOKABLE bool isLoopback() const { return m_afvClient->isLoopback(); } //! @} - //! \copydoc CAfvClient::setInputVolumeDb + //! \copydoc BlackCore::Afv::Clients::CAfvClient::setInputVolumeDb Q_INVOKABLE void setInputVolumeDb(double valueDb) { m_afvClient->setInputVolumeDb(valueDb); } - //! \copydoc CAfvClient::setOutputVolumeDb + //! \copydoc BlackCore::Afv::Clients::CAfvClient::setOutputVolumeDb Q_INVOKABLE void setOutputVolumeDb(double valueDb) { m_afvClient->setOutputVolumeDb(valueDb); } signals: diff --git a/src/blackcore/afv/audio/input.h b/src/blackcore/afv/audio/input.h index 769ed4cea..2a5b03a30 100644 --- a/src/blackcore/afv/audio/input.h +++ b/src/blackcore/afv/audio/input.h @@ -60,16 +60,23 @@ namespace BlackCore QByteArray m_buffer; }; + //! Opus data arguments struct OpusDataAvailableArgs { - uint sequenceCounter = 0; - QByteArray audio; + uint sequenceCounter = 0; //!< sequence counter + QByteArray audio; //!< audio data }; + //! Input volume stream arguments struct InputVolumeStreamArgs { + //! Peak volume raw double PeakRaw = 0.0; + + //! Peak volume in dB double PeakDB = -1.0 * std::numeric_limits::infinity(); + + //! Peak volume in VU double PeakVU = 0.0; }; diff --git a/src/blackcore/afv/audio/soundcardsampleprovider.h b/src/blackcore/afv/audio/soundcardsampleprovider.h index 82a7763d8..63dbe1390 100644 --- a/src/blackcore/afv/audio/soundcardsampleprovider.h +++ b/src/blackcore/afv/audio/soundcardsampleprovider.h @@ -42,7 +42,7 @@ namespace BlackCore //! Update PTT void pttUpdate(bool active, const QVector &txTransceivers); - //! \copydoc ISampleProvider::readSamples + //! \copydoc BlackSound::SampleProvider::ISampleProvider::readSamples virtual int readSamples(QVector &samples, qint64 count) override; //! Add OPUS samples diff --git a/src/blackcore/afv/crypto/cryptodtomode.h b/src/blackcore/afv/crypto/cryptodtomode.h index c3e73cd5a..98f7e7f1e 100644 --- a/src/blackcore/afv/crypto/cryptodtomode.h +++ b/src/blackcore/afv/crypto/cryptodtomode.h @@ -31,6 +31,7 @@ namespace BlackCore } // ns } // ns +//! \private MSGPACK_ADD_ENUM(BlackCore::Afv::Crypto::CryptoDtoMode); #endif // guard diff --git a/src/blackcore/afv/crypto/cryptodtoserializer.h b/src/blackcore/afv/crypto/cryptodtoserializer.h index cd2f821e7..4545e910f 100644 --- a/src/blackcore/afv/crypto/cryptodtoserializer.h +++ b/src/blackcore/afv/crypto/cryptodtoserializer.h @@ -21,6 +21,7 @@ #include #ifndef crypto_aead_chacha20poly1305_IETF_ABYTES +//! Number of a bytes #define crypto_aead_chacha20poly1305_IETF_ABYTES 16U #endif @@ -30,6 +31,7 @@ namespace BlackCore { namespace Crypto { + //! Hash of AFV short dto names extern QHash gShortDtoNames; //! Crypto serializer diff --git a/src/blackcore/context/contextapplication.h b/src/blackcore/context/contextapplication.h index cf6ca4465..ea3e02b7a 100644 --- a/src/blackcore/context/contextapplication.h +++ b/src/blackcore/context/contextapplication.h @@ -84,7 +84,7 @@ namespace BlackCore return s; } - //! \copydoc CContext::getPathAndContextId() + //! \copydoc IContext::getPathAndContextId() virtual QString getPathAndContextId() const override { return this->buildPathAndContextId(ObjectPath()); } //! Factory method diff --git a/src/blackcore/context/contextaudio.h b/src/blackcore/context/contextaudio.h index f9e2cf902..f78dffc2d 100644 --- a/src/blackcore/context/contextaudio.h +++ b/src/blackcore/context/contextaudio.h @@ -81,7 +81,7 @@ namespace BlackCore //! Object path static const QString &ObjectPath(); - //! \copydoc CContext::getPathAndContextId() + //! \copydoc IContext::getPathAndContextId() virtual QString getPathAndContextId() const override { return this->buildPathAndContextId(ObjectPath()); } //! Factory method @@ -187,7 +187,6 @@ namespace BlackCore //! .unmute unmute BlackCore::Context::CContextAudio //! .vol .volume volume 0..100 set volume BlackCore::Context::CContextAudio //! - //! \copydoc IContextAudio::parseCommandLine virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override; //! Register a device on a machine (for core/GUI it will return all known devices on all machines) diff --git a/src/blackcore/context/contextnetwork.h b/src/blackcore/context/contextnetwork.h index f66888cd4..bbd4a6f26 100644 --- a/src/blackcore/context/contextnetwork.h +++ b/src/blackcore/context/contextnetwork.h @@ -92,7 +92,7 @@ namespace BlackCore return s; } - //! \copydoc CContext::getPathAndContextId() + //! \copydoc IContext::getPathAndContextId() virtual QString getPathAndContextId() const override { return this->buildPathAndContextId(ObjectPath()); } //! Factory method diff --git a/src/blackcore/context/contextownaircraft.h b/src/blackcore/context/contextownaircraft.h index edeadefb4..1b2eea749 100644 --- a/src/blackcore/context/contextownaircraft.h +++ b/src/blackcore/context/contextownaircraft.h @@ -78,7 +78,7 @@ namespace BlackCore return s; } - //! \copydoc CContext::getPathAndContextId() + //! \copydoc IContext::getPathAndContextId() virtual QString getPathAndContextId() const override { return this->buildPathAndContextId(ObjectPath()); } //! Factory method diff --git a/src/blackcore/context/contextsimulator.h b/src/blackcore/context/contextsimulator.h index 4a41302c0..a422b2cbc 100644 --- a/src/blackcore/context/contextsimulator.h +++ b/src/blackcore/context/contextsimulator.h @@ -78,7 +78,7 @@ namespace BlackCore //! Highlight time static const BlackMisc::PhysicalQuantities::CTime &HighlightTime(); - //! \copydoc CContext::getPathAndContextId() + //! \copydoc IContext::getPathAndContextId() virtual QString getPathAndContextId() const override { return this->buildPathAndContextId(ObjectPath()); } //! Factory method diff --git a/src/blackcore/fsd/atcdataupdate.h b/src/blackcore/fsd/atcdataupdate.h index c9a0fca15..44d380b87 100644 --- a/src/blackcore/fsd/atcdataupdate.h +++ b/src/blackcore/fsd/atcdataupdate.h @@ -21,16 +21,21 @@ namespace BlackCore { namespace Fsd { + //! FSD Message: ATC data update class BLACKCORE_EXPORT AtcDataUpdate : public MessageBase { public: + //! Constructor AtcDataUpdate(const QString &sender, int frequencykHz, BlackMisc::Network::CFacilityType facility, int visibleRange, AtcRating rating, - double latitude, double longitude, int elevation); - - virtual ~AtcDataUpdate() {} + double latitude, double longitude, int elevation); + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static AtcDataUpdate fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return "%"; } int m_frequencykHz = 0.0; @@ -45,6 +50,7 @@ namespace BlackCore AtcDataUpdate(); }; + //! Equal to operator inline bool operator==(const AtcDataUpdate &lhs, const AtcDataUpdate &rhs) { return lhs.sender() == rhs.sender() && @@ -58,6 +64,7 @@ namespace BlackCore lhs.m_elevation == rhs.m_elevation; } + //! Not equal to operator inline bool operator!=(const AtcDataUpdate &lhs, const AtcDataUpdate &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/authchallenge.h b/src/blackcore/fsd/authchallenge.h index 6c1dbdfc4..37de6405b 100644 --- a/src/blackcore/fsd/authchallenge.h +++ b/src/blackcore/fsd/authchallenge.h @@ -17,15 +17,20 @@ namespace BlackCore { namespace Fsd { + //! FSD Message: auth challenge class BLACKCORE_EXPORT AuthChallenge : public MessageBase { public: + //! Constructor AuthChallenge(const QString &sender, const QString &target, const QString &challengeKey); - virtual ~AuthChallenge() {} - + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static AuthChallenge fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return QStringLiteral("$ZC"); } QString m_challengeKey; @@ -34,6 +39,7 @@ namespace BlackCore AuthChallenge(); }; + //! Equal to operator inline bool operator==(const AuthChallenge &lhs, const AuthChallenge &rhs) { return lhs.sender() == rhs.sender() && @@ -41,6 +47,7 @@ namespace BlackCore lhs.m_challengeKey == rhs.m_challengeKey; } + //! Not equal to operator inline bool operator!=(const AuthChallenge &lhs, const AuthChallenge &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/authresponse.h b/src/blackcore/fsd/authresponse.h index 1697d09e5..7da11d99b 100644 --- a/src/blackcore/fsd/authresponse.h +++ b/src/blackcore/fsd/authresponse.h @@ -22,12 +22,16 @@ namespace BlackCore class BLACKCORE_EXPORT AuthResponse : public MessageBase { public: + //! Constructor AuthResponse(const QString &sender, const QString &receiver, const QString &response); - virtual ~AuthResponse() {} - + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static AuthResponse fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return QStringLiteral("$ZR"); } QString m_response; @@ -36,6 +40,7 @@ namespace BlackCore AuthResponse(); }; + //! Equal to operator inline bool operator==(const AuthResponse &lhs, const AuthResponse &rhs) { return lhs.sender() == rhs.sender() && @@ -43,6 +48,7 @@ namespace BlackCore lhs.m_response == rhs.m_response; } + //! Not equal to operator inline bool operator!=(const AuthResponse &lhs, const AuthResponse &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/clientidentification.h b/src/blackcore/fsd/clientidentification.h index e9db815c1..fd11999aa 100644 --- a/src/blackcore/fsd/clientidentification.h +++ b/src/blackcore/fsd/clientidentification.h @@ -24,13 +24,17 @@ namespace BlackCore class BLACKCORE_EXPORT ClientIdentification : public MessageBase { public: + //! Constructor ClientIdentification(const QString &sender, quint16 clientId, const QString &clientName, int clientVersionMajor, int clientVersionMinor, const QString &userCid, const QString &sysUid, const QString &initialChallenge); - virtual ~ClientIdentification() {} - + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static ClientIdentification fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return "$ID"; } std::uint16_t m_clientId; @@ -45,6 +49,7 @@ namespace BlackCore ClientIdentification(); }; + //! Equal to operator inline bool operator==(const ClientIdentification &lhs, const ClientIdentification &rhs) { return lhs.sender() == rhs.sender() && @@ -58,6 +63,7 @@ namespace BlackCore lhs.m_initialChallenge == rhs.m_initialChallenge; } + //! Not equal to operator inline bool operator!=(const ClientIdentification &lhs, const ClientIdentification &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/clientquery.h b/src/blackcore/fsd/clientquery.h index 1d0b10404..652172f9f 100644 --- a/src/blackcore/fsd/clientquery.h +++ b/src/blackcore/fsd/clientquery.h @@ -27,11 +27,16 @@ namespace BlackCore class BLACKCORE_EXPORT ClientQuery : public MessageBase { public: + //! Constructor ClientQuery(const QString &sender, const QString &clientToBeQueried, ClientQueryType queryType, const QStringList &queryData = {}); - virtual ~ClientQuery() {} + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static ClientQuery fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return "$CQ"; } ClientQueryType m_queryType = ClientQueryType::Unknown; @@ -41,6 +46,7 @@ namespace BlackCore ClientQuery(); }; + //! Equal to operator inline bool operator==(const ClientQuery &lhs, const ClientQuery &rhs) { return lhs.sender() == rhs.sender() && @@ -49,6 +55,7 @@ namespace BlackCore lhs.m_queryData == rhs.m_queryData; } + //! Not equal to operator inline bool operator!=(const ClientQuery &lhs, const ClientQuery &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/clientresponse.h b/src/blackcore/fsd/clientresponse.h index a6066cee4..3b2bbc25e 100644 --- a/src/blackcore/fsd/clientresponse.h +++ b/src/blackcore/fsd/clientresponse.h @@ -22,14 +22,18 @@ namespace BlackCore class BLACKCORE_EXPORT ClientResponse : public MessageBase { public: + //! Constructor ClientResponse(const QString &sender, const QString &receiver, ClientQueryType queryType, const QStringList &responseData); - virtual ~ClientResponse() {} - bool isUnknownQuery() const { return m_queryType == ClientQueryType::Unknown; } + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static ClientResponse fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return "$CR"; } ClientQueryType m_queryType; @@ -39,6 +43,7 @@ namespace BlackCore ClientResponse(); }; + //! Equal to operator inline bool operator==(const ClientResponse &lhs, const ClientResponse &rhs) { return lhs.sender() == rhs.sender() && @@ -47,6 +52,7 @@ namespace BlackCore lhs.m_responseData == rhs.m_responseData; } + //! Not equal to operator inline bool operator!=(const ClientResponse &lhs, const ClientResponse &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/deleteatc.h b/src/blackcore/fsd/deleteatc.h index b3093126f..5bdef327d 100644 --- a/src/blackcore/fsd/deleteatc.h +++ b/src/blackcore/fsd/deleteatc.h @@ -17,14 +17,21 @@ namespace BlackCore { namespace Fsd { + //! FSD Message Delete ATC class BLACKCORE_EXPORT DeleteAtc : public MessageBase { public: + //! Constructor DeleteAtc(const QString &sender, const QString &cid); virtual ~DeleteAtc() {} + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static DeleteAtc fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return "#DA"; } QString m_cid; @@ -33,6 +40,7 @@ namespace BlackCore DeleteAtc(); }; + //! Equal to operator inline bool operator==(const DeleteAtc &lhs, const DeleteAtc &rhs) { return lhs.sender() == rhs.sender() && @@ -40,6 +48,7 @@ namespace BlackCore lhs.m_cid == rhs.m_cid; } + //! Not equal to operator inline bool operator!=(const DeleteAtc &lhs, const DeleteAtc &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/deletepilot.h b/src/blackcore/fsd/deletepilot.h index 2b55a978c..236c846bf 100644 --- a/src/blackcore/fsd/deletepilot.h +++ b/src/blackcore/fsd/deletepilot.h @@ -22,11 +22,16 @@ namespace BlackCore class BLACKCORE_EXPORT DeletePilot : public MessageBase { public: + //! Constructor DeletePilot(const QString &sender, const QString &cid); - virtual ~DeletePilot() {} + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static DeletePilot fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return QStringLiteral("#DP"); } QString m_cid; @@ -35,14 +40,16 @@ namespace BlackCore DeletePilot(); }; - inline bool operator==(const DeletePilot& lhs, const DeletePilot& rhs) + //! Equal to operator + inline bool operator==(const DeletePilot &lhs, const DeletePilot &rhs) { return lhs.sender() == rhs.sender() && lhs.receiver() == rhs.receiver() && lhs.m_cid == rhs.m_cid; } - inline bool operator!=(const DeletePilot& lhs, const DeletePilot& rhs) + //! Not equal to operator + inline bool operator!=(const DeletePilot &lhs, const DeletePilot &rhs) { return !(lhs == rhs); } diff --git a/src/blackcore/fsd/flightplan.h b/src/blackcore/fsd/flightplan.h index 644a44cd3..2995fb6f6 100644 --- a/src/blackcore/fsd/flightplan.h +++ b/src/blackcore/fsd/flightplan.h @@ -18,18 +18,23 @@ namespace BlackCore { namespace Fsd { + //! FSD Message: flightplan class BLACKCORE_EXPORT FlightPlan : public MessageBase { public: + //! Constructor FlightPlan(const QString &sender, const QString &receiver, FlightType flightType, const QString &aircraftIcaoType, int trueCruisingSpeed, const QString &depAirport, int estimatedDepTime, int actualDepTime, const QString &cruiseAlt, const QString &destAirport, int hoursEnroute, int minutesEnroute, int fuelAvailHours, int fuelAvailMinutes, const QString &altAirport, const QString &remarks, const QString &route); - virtual ~FlightPlan() {} - + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static FlightPlan fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return "$FP"; } FlightType m_flightType; @@ -52,6 +57,7 @@ namespace BlackCore FlightPlan(); }; + //! Equal to operator inline bool operator==(const FlightPlan &lhs, const FlightPlan &rhs) { return lhs.sender() == rhs.sender() && @@ -73,6 +79,7 @@ namespace BlackCore lhs.m_route == rhs.m_route; } + //! Not equal to operator inline bool operator!=(const FlightPlan &lhs, const FlightPlan &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/fsdidentification.h b/src/blackcore/fsd/fsdidentification.h index b329da482..ce6a8607c 100644 --- a/src/blackcore/fsd/fsdidentification.h +++ b/src/blackcore/fsd/fsdidentification.h @@ -21,12 +21,16 @@ namespace BlackCore class BLACKCORE_EXPORT FSDIdentification : public MessageBase { public: + //! Constructor FSDIdentification(const QString &callsign, const QString &receiver, const QString &serverVersion, const QString &initialChallenge); - virtual ~FSDIdentification() {} - + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static FSDIdentification fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return "$DI"; } QString m_serverVersion; diff --git a/src/blackcore/fsd/interimpilotdataupdate.h b/src/blackcore/fsd/interimpilotdataupdate.h index b5acb3a68..87ec86598 100644 --- a/src/blackcore/fsd/interimpilotdataupdate.h +++ b/src/blackcore/fsd/interimpilotdataupdate.h @@ -17,18 +17,22 @@ namespace BlackCore { namespace Fsd { + //! Interim pilot data update sent to specific receivers faster than + //! the standard broadcast update. class BLACKCORE_EXPORT InterimPilotDataUpdate : public MessageBase { public: - + //! Constructor InterimPilotDataUpdate(const QString &sender, const QString &receiver, double latitude, double longitude, int altitudeTrue, int groundSpeed, double pitch, double bank, double heading, bool onGround); - virtual ~InterimPilotDataUpdate() {} - + //! Message converted to tokens QStringList toTokens() const; + //! Construct from tokens static InterimPilotDataUpdate fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return "#SB"; } double m_latitude = 0.0; @@ -44,6 +48,7 @@ namespace BlackCore InterimPilotDataUpdate(); }; + //! Equal to operator inline bool operator==(const InterimPilotDataUpdate &lhs, const InterimPilotDataUpdate &rhs) { return lhs.sender() == rhs.sender() && @@ -57,6 +62,7 @@ namespace BlackCore lhs.m_onGround == rhs.m_onGround; } + //! Not equal to operator inline bool operator!=(const InterimPilotDataUpdate &lhs, const InterimPilotDataUpdate &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/killrequest.h b/src/blackcore/fsd/killrequest.h index 1b05764b6..cf24e63a0 100644 --- a/src/blackcore/fsd/killrequest.h +++ b/src/blackcore/fsd/killrequest.h @@ -17,15 +17,21 @@ namespace BlackCore { namespace Fsd { + //! Kill request initiated from the server or supervisor. + //! Client needs to disconnect immediatly upon receiving it. class BLACKCORE_EXPORT KillRequest : public MessageBase { public: + //! Constructor KillRequest(const QString &sender, const QString &receiver, const QString &reason); - virtual ~KillRequest() {} - + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static KillRequest fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return "$!!"; } QString m_reason; @@ -34,6 +40,7 @@ namespace BlackCore KillRequest(); }; + //! Equal to operator inline bool operator==(const KillRequest &lhs, const KillRequest &rhs) { return lhs.sender() == rhs.sender() && @@ -41,6 +48,7 @@ namespace BlackCore lhs.m_reason == rhs.m_reason; } + //! Not equal to operator inline bool operator!=(const KillRequest &lhs, const KillRequest &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/messagebase.h b/src/blackcore/fsd/messagebase.h index 54736d6d3..ec18ea049 100644 --- a/src/blackcore/fsd/messagebase.h +++ b/src/blackcore/fsd/messagebase.h @@ -44,22 +44,36 @@ namespace BlackCore { namespace Fsd { + //! FSD message base class class BLACKCORE_EXPORT MessageBase { public: + //! Default Constructor MessageBase() {} + + //! Constructor MessageBase(const QString &sender); + + //! Constructor MessageBase(const QString &sender, const QString &receiver); virtual ~MessageBase() {} + //! Set callsign void setCallsign(const QString &sender) { m_sender = sender; } + + //! get message sender QString sender() const { return m_sender; } + //! Set message receiver void setReceiver(const QString &receiver) { m_receiver = receiver; } + + //! Get message receiver QString receiver() const { return m_receiver; } + //! Is message valid? bool isValid() const { return m_isValid; } + //! set message valid void setValid(bool isValid) { m_isValid = isValid; } protected: @@ -67,10 +81,10 @@ namespace BlackCore // Meta data // MessageType messageType = MessageType::Unknown; - QString m_sender; - QString m_receiver; + QString m_sender; //!< message sender + QString m_receiver; //!< message receiver - bool m_isValid = true; + bool m_isValid = true; //!< is valid? }; } } diff --git a/src/blackcore/fsd/pbh.h b/src/blackcore/fsd/pbh.h index 7deec26b0..ecf197bdb 100644 --- a/src/blackcore/fsd/pbh.h +++ b/src/blackcore/fsd/pbh.h @@ -18,7 +18,7 @@ namespace BlackCore { namespace Fsd { - + //! Pitch bank heading union union PBH { unsigned int pbh = 0; //!< Pitch/Bank/Heading as integer value @@ -32,21 +32,25 @@ namespace BlackCore }; }; + //! Pitch multiplier constexpr double pitchMultiplier() { return 256.0 / 90.0; } + //! Bank multiplier constexpr double bankMultiplier() { return 512.0 / 180.0; } + //! Heading multiplier constexpr double headingMultiplier() { return 1024.0 / 360.0; } + //! Pack pitch, bank, heading and onGround into 32 bit integer inline void packPBH(double pitch, double bank, double heading, bool onGround, quint32 &pbh) { PBH pbhstrct; @@ -63,6 +67,7 @@ namespace BlackCore pbh = pbhstrct.pbh; } + //! Unpack pitch, bank, heading and onGround from 32 bit integer inline void unpackPBH(quint32 pbh, double &pitch, double &bank, double &heading, bool &onGround) { PBH pbhstrct; diff --git a/src/blackcore/fsd/pilotdataupdate.h b/src/blackcore/fsd/pilotdataupdate.h index 6b823791e..2593da168 100644 --- a/src/blackcore/fsd/pilotdataupdate.h +++ b/src/blackcore/fsd/pilotdataupdate.h @@ -19,17 +19,21 @@ namespace BlackCore { namespace Fsd { + //! Pilot data update broadcasted to all clients in range every 5 seconds. class BLACKCORE_EXPORT PilotDataUpdate : public MessageBase { public: - + //! Constructor PilotDataUpdate(BlackMisc::Aviation::CTransponder::TransponderMode transponderMode, const QString &sender, int transponderCode, PilotRating rating, double latitude, double longitude, int altitudeTrue, int altitudePressure, int groundSpeed, double pitch, double bank, double heading, bool onGround); - virtual ~PilotDataUpdate() {} + //! Message converted to tokens QStringList toTokens() const; + //! Construct from tokens static PilotDataUpdate fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return "@"; } BlackMisc::Aviation::CTransponder::TransponderMode m_transponderMode = BlackMisc::Aviation::CTransponder::StateStandby; @@ -49,6 +53,7 @@ namespace BlackCore PilotDataUpdate(); }; + //! Equal to operator inline bool operator==(const PilotDataUpdate &lhs, const PilotDataUpdate &rhs) { return lhs.sender() == rhs.sender() && @@ -67,6 +72,7 @@ namespace BlackCore lhs.m_onGround == rhs.m_onGround; } + //! Not equal to operator inline bool operator!=(const PilotDataUpdate &lhs, const PilotDataUpdate &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/ping.h b/src/blackcore/fsd/ping.h index 9a3afb9dd..d46b0ba20 100644 --- a/src/blackcore/fsd/ping.h +++ b/src/blackcore/fsd/ping.h @@ -17,14 +17,20 @@ namespace BlackCore { namespace Fsd { + //! Ping. Needs to be answered with a pong. class BLACKCORE_EXPORT Ping : public MessageBase { public: + //! Constructor Ping(const QString &sender, const QString &receiver, const QString ×tamp); - virtual ~Ping() {} + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static Ping fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return "$PI"; } QString m_timestamp; @@ -33,6 +39,7 @@ namespace BlackCore Ping(); }; + //! Equal to operator inline bool operator==(const Ping &lhs, const Ping &rhs) { return lhs.sender() == rhs.sender() && @@ -40,6 +47,7 @@ namespace BlackCore lhs.m_timestamp == rhs.m_timestamp; } + //! Not equal to operator inline bool operator!=(const Ping &lhs, const Ping &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/planeinforequest.h b/src/blackcore/fsd/planeinforequest.h index 5cdbfce48..e058c311f 100644 --- a/src/blackcore/fsd/planeinforequest.h +++ b/src/blackcore/fsd/planeinforequest.h @@ -17,6 +17,8 @@ namespace BlackCore { namespace Fsd { + //! Request to send plane information. + //! Shall be answered by a PlaneInformation message. class BLACKCORE_EXPORT PlaneInfoRequest : public MessageBase { public: @@ -24,20 +26,27 @@ namespace BlackCore virtual ~PlaneInfoRequest() {} + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static PlaneInfoRequest fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return QStringLiteral("#SB"); } private: PlaneInfoRequest(); }; + //! Equal to operator inline bool operator==(const PlaneInfoRequest &lhs, const PlaneInfoRequest &rhs) { return lhs.sender() == rhs.sender() && lhs.receiver() == rhs.receiver(); } + //! Not equal to operator inline bool operator!=(const PlaneInfoRequest &lhs, const PlaneInfoRequest &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/planeinforequestfsinn.h b/src/blackcore/fsd/planeinforequestfsinn.h index 02693e6d7..6fa1111c5 100644 --- a/src/blackcore/fsd/planeinforequestfsinn.h +++ b/src/blackcore/fsd/planeinforequestfsinn.h @@ -17,9 +17,11 @@ namespace BlackCore { namespace Fsd { + //! FSinn specific version of plane information request class BLACKCORE_EXPORT PlaneInfoRequestFsinn : public MessageBase { public: + //! Constructor PlaneInfoRequestFsinn(const QString &sender, const QString &receiver, const QString &airlineIcao, @@ -29,8 +31,13 @@ namespace BlackCore virtual ~PlaneInfoRequestFsinn() {} + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static PlaneInfoRequestFsinn fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return QStringLiteral("#SB"); } QString m_airlineIcao; @@ -42,6 +49,7 @@ namespace BlackCore PlaneInfoRequestFsinn(); }; + //! Equal to operator inline bool operator==(const PlaneInfoRequestFsinn &lhs, const PlaneInfoRequestFsinn &rhs) { return lhs.sender() == rhs.sender() && @@ -52,6 +60,7 @@ namespace BlackCore lhs.m_sendMModelString == rhs.m_sendMModelString; } + //! Not equal to operator inline bool operator!=(const PlaneInfoRequestFsinn &lhs, const PlaneInfoRequestFsinn &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/planeinformation.h b/src/blackcore/fsd/planeinformation.h index 0bac3b3fb..264849bcc 100644 --- a/src/blackcore/fsd/planeinformation.h +++ b/src/blackcore/fsd/planeinformation.h @@ -22,12 +22,16 @@ namespace BlackCore class BLACKCORE_EXPORT PlaneInformation : public MessageBase { public: + //! Constructor PlaneInformation(const QString &sender, const QString &receiver, const QString &aircraft, const QString &airline, const QString &livery); - virtual ~PlaneInformation() {} - + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static PlaneInformation fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return "#SB"; } QString m_aircraft; @@ -39,6 +43,7 @@ namespace BlackCore PlaneInformation(); }; + //! Equal to operator inline bool operator==(const PlaneInformation &lhs, const PlaneInformation &rhs) { return lhs.sender() == rhs.sender() && @@ -48,6 +53,7 @@ namespace BlackCore lhs.m_livery == rhs.m_livery; } + //! Not equal to operator inline bool operator!=(const PlaneInformation &lhs, const PlaneInformation &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/planeinformationfsinn.h b/src/blackcore/fsd/planeinformationfsinn.h index 72c7f877d..ea7ad68ec 100644 --- a/src/blackcore/fsd/planeinformationfsinn.h +++ b/src/blackcore/fsd/planeinformationfsinn.h @@ -21,6 +21,7 @@ namespace BlackCore class BLACKCORE_EXPORT PlaneInformationFsinn : public MessageBase { public: + //! Constructor PlaneInformationFsinn(const QString &sender, const QString &receiver, const QString &airlineIcao, @@ -28,10 +29,13 @@ namespace BlackCore const QString &aircraftIcaoCombinedType, const QString &sendMModelString); - virtual ~PlaneInformationFsinn() {} - + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static PlaneInformationFsinn fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return "#SB"; } QString m_airlineIcao; @@ -43,6 +47,7 @@ namespace BlackCore PlaneInformationFsinn(); }; + //! Equal to operator inline bool operator==(const PlaneInformationFsinn &lhs, const PlaneInformationFsinn &rhs) { return lhs.sender() == rhs.sender() && @@ -53,6 +58,7 @@ namespace BlackCore lhs.m_sendMModelString == rhs.m_sendMModelString; } + //! Not equal to operator inline bool operator!=(const PlaneInformationFsinn &lhs, const PlaneInformationFsinn &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/pong.h b/src/blackcore/fsd/pong.h index 135b25188..23dac3a54 100644 --- a/src/blackcore/fsd/pong.h +++ b/src/blackcore/fsd/pong.h @@ -17,15 +17,20 @@ namespace BlackCore { namespace Fsd { + //! Sent or received as reply to a ping. class BLACKCORE_EXPORT Pong : public MessageBase { public: + //! Constructor Pong(const QString &sender, const QString &receiver, const QString ×tamp); - virtual ~Pong() {} - + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static Pong fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return "$PO"; } QString m_timestamp; @@ -34,6 +39,7 @@ namespace BlackCore Pong(); }; + //! Equal to operator inline bool operator==(const Pong &lhs, const Pong &rhs) { return lhs.sender() == rhs.sender() && @@ -41,6 +47,7 @@ namespace BlackCore lhs.m_timestamp == rhs.m_timestamp; } + //! Not equal to operator inline bool operator!=(const Pong &lhs, const Pong &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/servererror.h b/src/blackcore/fsd/servererror.h index d883f8363..aad4a1dce 100644 --- a/src/blackcore/fsd/servererror.h +++ b/src/blackcore/fsd/servererror.h @@ -18,17 +18,22 @@ namespace BlackCore { namespace Fsd { + //! FSD Message Server Error class BLACKCORE_EXPORT ServerError : public MessageBase { public: + //! Constructor ServerError(const QString &sender, const QString &receiver, ServerErrorCode errorCode, const QString &causingParameter, const QString &description); - virtual ~ServerError() {} - - bool isFatalError () const; + bool isFatalError() const; + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static ServerError fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return "$ER"; } ServerErrorCode m_errorNumber; @@ -39,6 +44,7 @@ namespace BlackCore ServerError(); }; + //! Equal to operator inline bool operator==(const ServerError &lhs, const ServerError &rhs) { return lhs.sender() == rhs.sender() && @@ -48,6 +54,7 @@ namespace BlackCore lhs.m_description == rhs.m_description; } + //! Not equal to operator inline bool operator!=(const ServerError &lhs, const ServerError &rhs) { return !(lhs == rhs); diff --git a/src/blackcore/fsd/textmessage.h b/src/blackcore/fsd/textmessage.h index 43c1e1101..4ea6d0b20 100644 --- a/src/blackcore/fsd/textmessage.h +++ b/src/blackcore/fsd/textmessage.h @@ -21,25 +21,32 @@ namespace BlackCore { namespace Fsd { + //! Text, radio or private message class BLACKCORE_EXPORT TextMessage : public MessageBase { public: + //! Message type enum Type { PrivateMessage, RadioMessage, }; + //! Constructor TextMessage(const QString &sender, const QString &receiver, const QString &message); - virtual ~TextMessage() {} + //! Message converted to tokens QStringList toTokens() const; + + //! Construct from tokens static TextMessage fromTokens(const QStringList &tokens); + + //! PDU identifier static QString pdu() { return "#TM"; } - QString m_message; - Type m_type = PrivateMessage; - QVector m_frequencies; + QString m_message; //!< message text + Type m_type = PrivateMessage; //!< message type + QVector m_frequencies; //!< frequencies in case of radio message. private: TextMessage(); diff --git a/src/blackgui/components/settingscomponent.h b/src/blackgui/components/settingscomponent.h index 2cd0bb173..3602610c5 100644 --- a/src/blackgui/components/settingscomponent.h +++ b/src/blackgui/components/settingscomponent.h @@ -55,7 +55,7 @@ namespace BlackGui //! Destructor virtual ~CSettingsComponent(); - //! \copydoc CAudioSetupComponent::playNotificationSounds + //! \copydoc CAudioNotificationComponent::playNotificationSounds bool playNotificationSounds() const; //! Settings for given simulator diff --git a/src/blacksound/dsp/SimpleComp.h b/src/blacksound/dsp/SimpleComp.h index 9d6fe6845..0380f101a 100644 --- a/src/blacksound/dsp/SimpleComp.h +++ b/src/blacksound/dsp/SimpleComp.h @@ -1,109 +1,114 @@ /* - * Simple Compressor (header) + * Simple Compressor (header) * - * File : SimpleComp.h - * Library : SimpleSource - * Version : 1.12 - * Class : SimpleComp, SimpleCompRms + * File : SimpleComp.h + * Library : SimpleSource + * Version : 1.12 + * Class : SimpleComp, SimpleCompRms * - * © 2006, ChunkWare Music Software, OPEN-SOURCE + * © 2006, ChunkWare Music Software, OPEN-SOURCE * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. */ #ifndef __SIMPLE_COMP_H__ #define __SIMPLE_COMP_H__ -#include "SimpleHeader.h" // common header -#include "SimpleEnvelope.h" // for base class -#include "SimpleGain.h" // for gain functions +#include "SimpleHeader.h" // common header +#include "SimpleEnvelope.h" // for base class +#include "SimpleGain.h" // for gain functions namespace chunkware_simple { - //------------------------------------------------------------- - // simple compressor - //------------------------------------------------------------- - class SimpleComp : public AttRelEnvelope - { - public: - SimpleComp(); - virtual ~SimpleComp() {} + //! simple compressor + class SimpleComp : public AttRelEnvelope + { + public: + SimpleComp(); + virtual ~SimpleComp() {} - // parameters - virtual void setThresh( double dB ); - virtual void setRatio( double dB ); - void setMakeUpGain( double gain ); + //! @{ set parameters + virtual void setThresh(double dB); + virtual void setRatio(double dB); + void setMakeUpGain(double gain); + //! @} - virtual double getThresh( void ) const { return threshdB_; } - virtual double getRatio( void ) const { return ratio_; } - double getMakeUpGain( void ) const { return makeUpGain_; } + //! @{ get parameters + virtual double getThresh(void) const { return threshdB_; } + virtual double getRatio(void) const { return ratio_; } + double getMakeUpGain(void) const { return makeUpGain_; } + //! @} + //! init runtime + //! call before runtime (in resume()) + virtual void initRuntime(void); - // runtime - virtual void initRuntime( void ); // call before runtime (in resume()) - void process( double &in1, double &in2 ); // compressor runtime process - void process( double &in1, double &in2, double keyLinked ); // with stereo-linked key in + //! compressor runtime process + void process(double &in1, double &in2); - private: + //! process sample with stereo-linked key in + void process(double &in1, double &in2, double keyLinked); - // transfer function - double threshdB_; // threshold (dB) - double ratio_; // ratio (compression: < 1 ; expansion: > 1) + private: - // runtime variables - double envdB_; // over-threshold envelope (dB) + // transfer function + double threshdB_; // threshold (dB) + double ratio_; // ratio (compression: < 1 ; expansion: > 1) + + // runtime variables + double envdB_; // over-threshold envelope (dB) double makeUpGain_; - }; // end SimpleComp class + }; // end SimpleComp class - //------------------------------------------------------------- - // simple compressor with RMS detection - //------------------------------------------------------------- - class SimpleCompRms : public SimpleComp - { - public: - SimpleCompRms(); - virtual ~SimpleCompRms() {} + //------------------------------------------------------------- + // simple compressor with RMS detection + //------------------------------------------------------------- + class SimpleCompRms : public SimpleComp + { + public: + SimpleCompRms(); + virtual ~SimpleCompRms() {} - // sample rate - virtual void setSampleRate( double sampleRate ) override; + // sample rate + virtual void setSampleRate(double sampleRate) override; - // RMS window - virtual void setWindow( double ms ); - virtual double getWindow( void ) const { return ave_.getTc(); } + // RMS window + virtual void setWindow(double ms); + virtual double getWindow(void) const { return ave_.getTc(); } - // runtime process - virtual void initRuntime( void ) override; // call before runtime (in resume()) - void process( double &in1, double &in2 ); // compressor runtime process + // runtime process + virtual void initRuntime(void) override; // call before runtime (in resume()) + void process(double &in1, double &in2); // compressor runtime process - private: + private: - EnvelopeDetector ave_; // averager - double aveOfSqrs_; // average of squares + EnvelopeDetector ave_; // averager + double aveOfSqrs_; // average of squares - }; // end SimpleCompRms class + }; // end SimpleCompRms class -} // end namespace chunkware_simple +} // end namespace chunkware_simple // include inlined process function #include "SimpleCompProcess.inl" -#endif // end __SIMPLE_COMP_H__ +#endif // end __SIMPLE_COMP_H__ diff --git a/src/blacksound/dsp/SimpleEnvelope.h b/src/blacksound/dsp/SimpleEnvelope.h index f57fcb161..e7914f2c5 100644 --- a/src/blacksound/dsp/SimpleEnvelope.h +++ b/src/blacksound/dsp/SimpleEnvelope.h @@ -1,130 +1,125 @@ /* - * Simple Envelope Detectors (header) + * Simple Envelope Detectors (header) * - * File : SimpleEnvelope.h - * Library : SimpleSource - * Version : 1.12 - * Class : EnvelopeDetector, AttRelEnvelope + * File : SimpleEnvelope.h + * Library : SimpleSource + * Version : 1.12 + * Class : EnvelopeDetector, AttRelEnvelope * - * 2006, ChunkWare Music Software, OPEN-SOURCE + * 2006, ChunkWare Music Software, OPEN-SOURCE * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. */ #ifndef __SIMPLE_ENVELOPE_H__ #define __SIMPLE_ENVELOPE_H__ -#include "SimpleHeader.h" // common header +#include "SimpleHeader.h" // common header namespace chunkware_simple { - //------------------------------------------------------------- - // DC offset (to prevent denormal) - //------------------------------------------------------------- + //------------------------------------------------------------- + // DC offset (to prevent denormal) + //------------------------------------------------------------- - // USE: - // 1. init envelope state to DC_OFFSET before processing - // 2. add to input before envelope runtime function - static const double DC_OFFSET = 1.0E-25; + // USE: + // 1. init envelope state to DC_OFFSET before processing + // 2. add to input before envelope runtime function + static const double DC_OFFSET = 1.0E-25; - //------------------------------------------------------------- - // envelope detector - //------------------------------------------------------------- - class EnvelopeDetector - { - public: - EnvelopeDetector( - double ms = 1.0 - , double sampleRate = 44100.0 - ); - virtual ~EnvelopeDetector() {} + //! envelope detector + class EnvelopeDetector + { + public: + EnvelopeDetector(double ms = 1.0, double sampleRate = 44100.0); + virtual ~EnvelopeDetector() {} - // time constant - virtual void setTc( double ms ); - virtual double getTc( void ) const { return ms_; } + //! set time constant + virtual void setTc(double ms); - // sample rate - virtual void setSampleRate( double sampleRate ); - virtual double getSampleRate( void ) const { return sampleRate_; } + //! get time constant + virtual double getTc(void) const { return ms_; } - // runtime function - INLINE void run( double in, double &state ) { - state = in + coef_ * ( state - in ); - } + //! set sample rate + virtual void setSampleRate(double sampleRate); - protected: - - double sampleRate_; // sample rate - double ms_; // time constant in ms - double coef_; // runtime coefficient - virtual void setCoef( void ); // coef calculation + //! get sample rate + virtual double getSampleRate(void) const { return sampleRate_; } - }; // end SimpleComp class + //! runtime function + INLINE void run(double in, double &state) + { + state = in + coef_ * (state - in); + } - //------------------------------------------------------------- - // attack/release envelope - //------------------------------------------------------------- - class AttRelEnvelope - { - public: - AttRelEnvelope( - double att_ms = 10.0 - , double rel_ms = 100.0 - , double sampleRate = 44100.0 - ); - virtual ~AttRelEnvelope() {} + protected: - // attack time constant - virtual void setAttack( double ms ); - virtual double getAttack( void ) const { return att_.getTc(); } + double sampleRate_; //!< sample rate + double ms_; //!< time constant in ms + double coef_; //!< runtime coefficient + virtual void setCoef(void); //!< coef calculation - // release time constant - virtual void setRelease( double ms ); - virtual double getRelease( void ) const { return rel_.getTc(); } + }; // end SimpleComp class - // sample rate dependencies - virtual void setSampleRate( double sampleRate ); - virtual double getSampleRate( void ) const { return att_.getSampleRate(); } + //! attack/release envelope + class AttRelEnvelope + { + public: + AttRelEnvelope(double att_ms = 10.0, double rel_ms = 100.0, double sampleRate = 44100.0); + virtual ~AttRelEnvelope() {} - // runtime function - INLINE void run( double in, double &state ) { + // attack time constant + virtual void setAttack(double ms); + virtual double getAttack(void) const { return att_.getTc(); } - /* assumes that: - * positive delta = attack - * negative delta = release - * good for linear & log values - */ + // release time constant + virtual void setRelease(double ms); + virtual double getRelease(void) const { return rel_.getTc(); } - if ( in > state ) - att_.run( in, state ); // attack - else - rel_.run( in, state ); // release - } + // sample rate dependencies + virtual void setSampleRate(double sampleRate); + virtual double getSampleRate(void) const { return att_.getSampleRate(); } - private: - - EnvelopeDetector att_; - EnvelopeDetector rel_; - - }; // end AttRelEnvelope class + // runtime function + INLINE void run(double in, double &state) + { -} // end namespace chunkware_simple + /* assumes that: + * positive delta = attack + * negative delta = release + * good for linear & log values + */ -#endif // end __SIMPLE_ENVELOPE_H__ + if (in > state) + att_.run(in, state); // attack + else + rel_.run(in, state); // release + } + + private: + + EnvelopeDetector att_; + EnvelopeDetector rel_; + + }; // end AttRelEnvelope class + +} // end namespace chunkware_simple + +#endif // end __SIMPLE_ENVELOPE_H__ diff --git a/src/blacksound/dsp/SimpleGate.h b/src/blacksound/dsp/SimpleGate.h index ca5d1d3e5..4a0c23bd1 100644 --- a/src/blacksound/dsp/SimpleGate.h +++ b/src/blacksound/dsp/SimpleGate.h @@ -90,11 +90,11 @@ namespace chunkware_simple //! get RMS window virtual double getWindow(void) const { return ave_.getTc(); } - //! \copydoc SimpleGate::initRuntime - virtual void initRuntime(void); // call before runtime (in resume()) + //! call before runtime (in resume()) + virtual void initRuntime(void); - //! \copydoc SimpleGate::process - void process(double &in1, double &in2); // gate runtime process + //! gate runtime process + void process(double &in1, double &in2); private: EnvelopeDetector ave_; //!< averager diff --git a/src/blacksound/dsp/SimpleLimit.h b/src/blacksound/dsp/SimpleLimit.h index 739403c31..f68e16b31 100644 --- a/src/blacksound/dsp/SimpleLimit.h +++ b/src/blacksound/dsp/SimpleLimit.h @@ -1,117 +1,121 @@ /* - * Simple Limiter (header) + * Simple Limiter (header) * - * File : SimpleLimit.h - * Library : SimpleSource - * Version : 1.12 - * Class : SimpleLimit + * File : SimpleLimit.h + * Library : SimpleSource + * Version : 1.12 + * Class : SimpleLimit * - * 2006, ChunkWare Music Software, OPEN-SOURCE + * 2006, ChunkWare Music Software, OPEN-SOURCE * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. */ #ifndef __SIMPLE_LIMIT_H__ #define __SIMPLE_LIMIT_H__ -#include "SimpleHeader.h" // common header -#include "SimpleEnvelope.h" // for base class of FastEnvelope -#include "SimpleGain.h" // for gain functions +#include "SimpleHeader.h" // common header +#include "SimpleEnvelope.h" // for base class of FastEnvelope +#include "SimpleGain.h" // for gain functions #include namespace chunkware_simple { - //------------------------------------------------------------- - // simple limiter - //------------------------------------------------------------- - class SimpleLimit - { - public: - SimpleLimit(); - virtual ~SimpleLimit() {} + //! Simple limiter + class SimpleLimit + { + public: + SimpleLimit(); + virtual ~SimpleLimit() {} - // parameters - virtual void setThresh( double dB ); - virtual void setAttack( double ms ); - virtual void setRelease( double ms ); + //! @{ set parameters + virtual void setThresh(double dB); + virtual void setAttack(double ms); + virtual void setRelease(double ms); + //! @} - virtual double getThresh( void ) const { return threshdB_; } - virtual double getAttack( void ) const { return att_.getTc(); } - virtual double getRelease( void ) const { return rel_.getTc(); } + //! @{ get parameters + virtual double getThresh(void) const { return threshdB_; } + virtual double getAttack(void) const { return att_.getTc(); } + virtual double getRelease(void) const { return rel_.getTc(); } + //! @} - // latency - virtual const unsigned int getLatency( void ) const { return peakHold_; } + //! get latency + virtual const unsigned int getLatency(void) const { return peakHold_; } - // sample rate dependencies - virtual void setSampleRate( double sampleRate ); - virtual double getSampleRate( void ) { return att_.getSampleRate(); } - - // runtime - virtual void initRuntime( void ); // call before runtime (in resume()) - void process( double &in1, double &in2 ); // limiter runtime process + //! @{ sample rate + virtual void setSampleRate(double sampleRate); + virtual double getSampleRate(void) { return att_.getSampleRate(); } + //! @} - protected: + //! call before runtime (in resume()) + virtual void initRuntime(void); - // class for faster attack/release - class FastEnvelope : public EnvelopeDetector - { - public: - FastEnvelope( double ms = 1.0, double sampleRate = 44100.0 ) - : EnvelopeDetector( ms, sampleRate ) - {} - virtual ~FastEnvelope() {} + //! limiter runtime process + void process(double &in1, double &in2); - protected: - // override setCoef() - coefficient calculation - virtual void setCoef( void ); - }; - - private: - - // transfer function - double threshdB_; // threshold (dB) - double thresh_; // threshold (linear) + protected: - // max peak - unsigned int peakHold_; // peak hold (samples) - unsigned int peakTimer_; // peak hold timer - double maxPeak_; // max peak + //! class for faster attack/release + class FastEnvelope : public EnvelopeDetector + { + public: + FastEnvelope(double ms = 1.0, double sampleRate = 44100.0) + : EnvelopeDetector(ms, sampleRate) + {} + virtual ~FastEnvelope() {} - // attack/release envelope - FastEnvelope att_; // attack - FastEnvelope rel_; // release - double env_; // over-threshold envelope (linear) + protected: + // override setCoef() - coefficient calculation + virtual void setCoef(void); + }; - // buffer - // BUFFER_SIZE default can handle up to ~10ms at 96kHz - // change this if you require more - static const int BUFFER_SIZE = 1024; // buffer size (always a power of 2!) - unsigned int mask_; // buffer mask - unsigned int cur_; // cursor - std::vector< double > outBuffer_[ 2 ]; // output buffer - - }; // end SimpleLimit class + private: -} // end namespace chunkware_simple + // transfer function + double threshdB_; // threshold (dB) + double thresh_; // threshold (linear) + + // max peak + unsigned int peakHold_; // peak hold (samples) + unsigned int peakTimer_; // peak hold timer + double maxPeak_; // max peak + + // attack/release envelope + FastEnvelope att_; // attack + FastEnvelope rel_; // release + double env_; // over-threshold envelope (linear) + + // buffer + // BUFFER_SIZE default can handle up to ~10ms at 96kHz + // change this if you require more + static const int BUFFER_SIZE = 1024; // buffer size (always a power of 2!) + unsigned int mask_; // buffer mask + unsigned int cur_; // cursor + std::vector< double > outBuffer_[ 2 ]; // output buffer + + }; // end SimpleLimit class + +} // end namespace chunkware_simple // include inlined process function #include "SimpleLimitProcess.inl" -#endif // end __SIMPLE_LIMIT_H__ +#endif // end __SIMPLE_LIMIT_H__