mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 08:36:52 +08:00
Doxygen
This commit is contained in:
committed by
Mat Sutcliffe
parent
2c89275ea6
commit
11ee2413b5
@@ -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<double>::infinity();
|
||||
|
||||
//! Peak volume in VU
|
||||
double PeakVU = 0.0;
|
||||
};
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace BlackCore
|
||||
//! Update PTT
|
||||
void pttUpdate(bool active, const QVector<TxTransceiverDto> &txTransceivers);
|
||||
|
||||
//! \copydoc ISampleProvider::readSamples
|
||||
//! \copydoc BlackSound::SampleProvider::ISampleProvider::readSamples
|
||||
virtual int readSamples(QVector<float> &samples, qint64 count) override;
|
||||
|
||||
//! Add OPUS samples
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace BlackCore
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
//! \private
|
||||
MSGPACK_ADD_ENUM(BlackCore::Afv::Crypto::CryptoDtoMode);
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <QtDebug>
|
||||
|
||||
#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<QByteArray, QByteArray> gShortDtoNames;
|
||||
|
||||
//! Crypto serializer
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
//! </pre>
|
||||
//! \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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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?
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<int> m_frequencies;
|
||||
QString m_message; //!< message text
|
||||
Type m_type = PrivateMessage; //!< message type
|
||||
QVector<int> m_frequencies; //!< frequencies in case of radio message.
|
||||
|
||||
private:
|
||||
TextMessage();
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace BlackGui
|
||||
//! Destructor
|
||||
virtual ~CSettingsComponent();
|
||||
|
||||
//! \copydoc CAudioSetupComponent::playNotificationSounds
|
||||
//! \copydoc CAudioNotificationComponent::playNotificationSounds
|
||||
bool playNotificationSounds() const;
|
||||
|
||||
//! Settings for given simulator
|
||||
|
||||
@@ -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__
|
||||
|
||||
@@ -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__
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <vector>
|
||||
|
||||
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__
|
||||
|
||||
Reference in New Issue
Block a user