Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/gui/FlexControlDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ const FlexActionDef kFlexActions[] = {
{"WheelRit", "RIT (Receive Incremental Tuning)"},
{"WheelXit", "XIT (Transmit Incremental Tuning)"},
{"WheelVolume", "Master Volume"},
{"WheelSliceAudio", "Slice Audio Volume"},
{"WheelHeadphoneVolume", "Headphone Volume"},
{"WheelAgcT", "AGCT (Automatic Gain Control Threshold)"},
{"WheelApf", "APF (Audio Peaking Filter)"},
Expand Down Expand Up @@ -452,6 +453,7 @@ bool isWheelActionId(const QString& actionId)
// so saved bindings made before consolidation still register as
// wheel actions in this predicate.
|| actionId == QLatin1String("WheelMasterAf")
|| actionId == QLatin1String("WheelSliceAudio")
|| actionId == QLatin1String("WheelPower")
|| actionId == QLatin1String("WheelRit")
|| actionId == QLatin1String("WheelXit")
Expand Down
1 change: 1 addition & 0 deletions src/gui/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ enum class FlexWheelMode {
Power,
Rit,
Xit,
SliceAudio,
HeadphoneVolume,
AgcT,
Apf,
Expand Down
16 changes: 16 additions & 0 deletions src/gui/MainWindow_Controllers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ bool flexWheelModeForAction(const QString& actionName, FlexWheelMode& mode)
// Back-compat for saved FlexControl bindings made before #2986
// consolidation. Routes to the same Volume mode (master volume).
mode = FlexWheelMode::Volume;
} else if (actionName == QLatin1String("WheelSliceAudio")) {
mode = FlexWheelMode::SliceAudio;
} else if (actionName == QLatin1String("WheelHeadphoneVolume")) {
mode = FlexWheelMode::HeadphoneVolume;
} else if (actionName == QLatin1String("WheelAgcT")) {
Expand Down Expand Up @@ -250,6 +252,9 @@ void MainWindow::handleFlexControlTuneSteps(int steps)
case FlexWheelMode::Xit:
applyFlexControlWheelAction(QStringLiteral("WheelXit"), steps);
break;
case FlexWheelMode::SliceAudio:
applyFlexControlWheelAction(QStringLiteral("WheelSliceAudio"), steps);
break;
case FlexWheelMode::HeadphoneVolume:
applyFlexControlWheelAction(QStringLiteral("WheelHeadphoneVolume"), steps);
break;
Expand Down Expand Up @@ -966,6 +971,7 @@ void MainWindow::refreshStreamDeckLabels()
{QStringLiteral("WheelRit"), QStringLiteral("RIT")},
{QStringLiteral("WheelXit"), QStringLiteral("XIT")},
{QStringLiteral("WheelVolume"), QStringLiteral("VOL")},
{QStringLiteral("WheelSliceAudio"), QStringLiteral("S.VOL")},
{QStringLiteral("WheelHeadphoneVolume"),QStringLiteral("H.VOL")},
{QStringLiteral("WheelAgcT"), QStringLiteral("AGC-T")},
{QStringLiteral("WheelApf"), QStringLiteral("APF")},
Expand Down Expand Up @@ -1126,6 +1132,14 @@ void MainWindow::applyFlexControlWheelAction(const QString& actionId, int steps)
#ifdef HAVE_HIDAPI
triggerTMate2Overlay(TMate2Overlay::Volume, next);
#endif
} else if (actionId == "WheelSliceAudio") {
if (auto* s = activeSlice()) {
const float next = std::clamp(s->audioGain() + steps * 2.0f, 0.0f, 100.0f);
s->setAudioGain(next);
#ifdef HAVE_HIDAPI
triggerTMate2Overlay(TMate2Overlay::Volume, static_cast<int>(next));
#endif
}
} else if (actionId == "WheelHeadphoneVolume") {
const int next = std::clamp(m_radioModel.headphoneGain() + steps * 2, 0, 100);
if (m_titleBar)
Expand Down Expand Up @@ -1213,6 +1227,8 @@ QJsonObject MainWindow::buildControlDevicesSnapshot() const
case FlexWheelMode::Power: return QStringLiteral("Power");
case FlexWheelMode::Rit: return QStringLiteral("Rit");
case FlexWheelMode::Xit: return QStringLiteral("Xit");
case FlexWheelMode::SliceAudio:
return QStringLiteral("SliceAudio");
case FlexWheelMode::HeadphoneVolume:
return QStringLiteral("HeadphoneVolume");
case FlexWheelMode::AgcT: return QStringLiteral("AgcT");
Expand Down
3 changes: 3 additions & 0 deletions src/gui/RadioSetupDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4194,6 +4194,7 @@ QWidget* RadioSetupDialog::buildSerialTab()
"ToggleAgc", "VolumeUp", "VolumeDown",
"WheelFrequency", "WheelVolume", "WheelPower",
"WheelRit", "WheelXit",
"WheelSliceAudio",
"WheelHeadphoneVolume",
"WheelAgcT", "WheelApf", "WheelCwSpeed",
"ClearRit", "ClearXit", "ToggleApf",
Expand Down Expand Up @@ -4353,6 +4354,7 @@ QWidget* RadioSetupDialog::buildSerialTab()
{"WheelRit", "RIT (Receive Incremental Tuning)"},
{"WheelXit", "XIT (Transmit Incremental Tuning)"},
{"WheelVolume", "Master Volume"},
{"WheelSliceAudio", "Slice Audio Volume"},
{"WheelHeadphoneVolume","Headphone Volume"},
{"WheelAgcT", "AGC Threshold"},
{"WheelApf", "APF Level"},
Expand Down Expand Up @@ -4536,6 +4538,7 @@ QWidget* RadioSetupDialog::buildSerialTab()
{"WheelRit", "RIT (Receive Incremental Tuning)"},
{"WheelXit", "XIT (Transmit Incremental Tuning)"},
{"WheelVolume", "Master Volume"},
{"WheelSliceAudio", "Slice Audio Volume"},
{"WheelHeadphoneVolume","Headphone Volume"},
{"WheelAgcT", "AGC Threshold"},
{"WheelApf", "APF Level"},
Expand Down
10 changes: 10 additions & 0 deletions src/models/RadioModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4811,8 +4811,13 @@ void RadioModel::handleRadioStatus(const QMap<QString, QString>& kvs)
void RadioModel::setLineoutGain(int v)
{
v = std::clamp(v, 0, 100);
if (m_lineoutGain == v) {
return;
}
m_lineoutGain = v;
qCDebug(lcAudio) << "setLineoutGain:" << v;
sendCmd(QString("mixer lineout gain %1").arg(v));
emit audioOutputChanged();
}

void RadioModel::setLineoutMute(bool m)
Expand All @@ -4824,8 +4829,13 @@ void RadioModel::setLineoutMute(bool m)
void RadioModel::setHeadphoneGain(int v)
{
v = std::clamp(v, 0, 100);
if (m_headphoneGain == v) {
return;
}
m_headphoneGain = v;
qCDebug(lcAudio) << "setHeadphoneGain:" << v;
sendCmd(QString("mixer headphone gain %1").arg(v));
emit audioOutputChanged();
}

void RadioModel::setHeadphoneMute(bool m)
Expand Down
Loading