164 m_mutex(QMutex::Recursive),
168 m_elementSpace(false),
169 m_characterSpace(false),
175 m_keyIambicState(KeySilent),
176 m_textState(TextStart)
196 QMutexLocker mutexLocker(&
m_mutex);
201 return m_key ? 1 : 0;
206 return m_key ? 1 : 0;
213 return m_key ? 1 : 0;
463 QMutexLocker mutexLocker(&
m_mutex);
475 float x =
i/ (float) m_nbFadeSamples;
489 QMutexLocker mutexLocker(&
m_mutex);
527 if (MsgConfigureCWKeyer::match(cmd))
530 qDebug() <<
"CWKeyer::handleMessage: MsgConfigureCWKeyer";
544 while ((message = m_inputMessageQueue.pop()) != 0)
546 if (handleMessage(*message)) {
554 if ((m_settings.m_wpm != settings.
m_wpm)
555 || (m_settings.m_sampleRate != settings.
m_sampleRate) || force)
557 QMutexLocker mutexLocker(&
m_mutex);
559 m_cwSmoother.setNbFadeSamples(m_dotLength/5);
562 if ((m_settings.m_mode != settings.
m_mode) || force)
564 QMutexLocker mutexLocker(&
m_mutex);
568 m_textState = TextStart;
574 m_keyIambicState = KeySilent;
580 m_keyIambicState = KeySilent;
586 m_keyIambicState = KeySilent;
590 if ((m_settings.m_text != settings.
m_text) || force)
592 QMutexLocker mutexLocker(&
m_mutex);
593 m_textState = TextStart;
596 m_settings = settings;
600 const QStringList& channelSettingsKeys,
605 if (channelSettingsKeys.contains(
"cwKeyer.loop")) {
608 if (channelSettingsKeys.contains(
"cwKeyer.mode")) {
611 if (channelSettingsKeys.contains(
"cwKeyer.text")) {
614 if (channelSettingsKeys.contains(
"cwKeyer.sampleRate")) {
617 if (channelSettingsKeys.contains(
"cwKeyer.wpm")) {
618 cwKeyerSettings.
m_wpm = apiCwKeyerSettings->
getWpm();
620 if (channelSettingsKeys.contains(
"cwKeyer.keyboardIambic")) {
623 if (channelSettingsKeys.contains(
"cwKeyer.dotKey")) {
626 if (channelSettingsKeys.contains(
"cwKeyer.dotKeyModifiers")) {
629 if (channelSettingsKeys.contains(
"cwKeyer.dashKey")) {
632 if (channelSettingsKeys.contains(
"cwKeyer.dashKeyModifiers")) {
646 if (apiCwKeyerSettings->
getText()) {
649 apiCwKeyerSettings->
setText(
new QString(cwKeyerSettings.
m_text));
void push(Message *message, bool emitSignal=true)
Push message onto queue.
void handleInputMessages()
bool handleMessage(const Message &cmd)
void setLoop(qint32 loop)
static float smootherstep(float x)
qint32 getDashKeyModifiers()
qint32 getKeyboardIambic()
static const signed char m_asciiToMorse[128][7]
void setText(QString *text)
qint32 getDotKeyModifiers()
#define MESSAGE_CLASS_DEFINITION(Name, BaseClass)
bool getFadeSample(bool on, float &sample)
void setKeyboardSilence()
int m_dotLength
dot length in samples
void setNbFadeSamples(unsigned int nbFadeSamples)
void setMode(qint32 mode)
void setKeyboardIambic(qint32 keyboard_iambic)
void setDashKey(qint32 dash_key)
Qt::KeyboardModifiers m_dotKeyModifiers
MessageQueue m_inputMessageQueue
static void webapiFormatChannelSettings(SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings, const CWKeyerSettings &cwKeyerSettings)
unsigned int m_nbFadeSamples
void applySettings(const CWKeyerSettings &settings, bool force=false)
Qt::KeyboardModifiers m_dashKeyModifiers
CWKeyIambicState m_keyIambicState
unsigned int m_fadeInCounter
void setSampleRate(qint32 sample_rate)
static void webapiSettingsPutPatch(const QStringList &channelSettingsKeys, CWKeyerSettings &cwKeyerSettings, SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings)
void setDashKeyModifiers(qint32 dash_key_modifiers)
void setDotKey(qint32 dot_key)
CWKeyerSettings m_settings
void setDotKeyModifiers(qint32 dot_key_modifiers)
void setSampleRate(int sampleRate)
unsigned int m_fadeOutCounter