Skip to content

Commit 4fdc83f

Browse files
Added Low Solo Mode -> 0.0.1.1.0.16
1 parent 3b2c3f2 commit 4fdc83f

9 files changed

+65
-22
lines changed

src/FFTAnalyzer.cpp

+12-5
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void FFTAnalyzer::calculateWindow()
5050
}
5151
}
5252

53-
void FFTAnalyzer::calculateFFT()
53+
void FFTAnalyzer::calculateFFT(bool lowSoloMode)
5454
{
5555
// apply window:
5656
for (int i=0; i < NUM_SAMPLES; ++i) {
@@ -73,8 +73,15 @@ void FFTAnalyzer::calculateFFT()
7373
// give linear spectrum to ScaledSpectrum object to be scalled:
7474
m_scaledSpectrum.updateWithLinearSpectrum(m_linearSpectrum);
7575

76-
// next element in processing chain: TriggerGenerators
77-
for (int i=0; i<m_triggerContainer.size(); ++i) {
78-
m_triggerContainer[i]->checkForTrigger(m_scaledSpectrum);
79-
}
76+
// next element in processing chain: TriggerGenerators
77+
bool triggered = false;
78+
for (int i=0; i<m_triggerContainer.size(); ++i) {
79+
TriggerGeneratorInterface* trigger = m_triggerContainer[i];
80+
if (trigger->isBandpass()) {
81+
bool active = trigger->checkForTrigger(m_scaledSpectrum, lowSoloMode && triggered);
82+
triggered = triggered || active;
83+
} else {
84+
trigger->checkForTrigger(m_scaledSpectrum, false);
85+
}
86+
}
8087
}

src/FFTAnalyzer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class FFTAnalyzer
6060

6161
// calculates the FFT based on the data in the inputBuffer and updates the ScaledSpectrum
6262
// - usually called periodically 44 times per second
63-
void calculateFFT();
63+
void calculateFFT(bool lowSoloMode);
6464

6565
// returns the normalized spectrum of the ScaledSpectrum
6666
const QVector<float>& getNormalizedSpectrum() const { return m_scaledSpectrum.getNormalizedSpectrum(); }

src/MainController.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ MainController::MainController(QQmlApplicationEngine* qmlEngine, QObject *parent
4545
, m_osc()
4646
, m_consoleType("EOS")
4747
, m_oscMapping(this)
48+
, m_lowSoloMode(false)
4849
{
4950
m_audioInput = new QAudioInputWrapper(&m_buffer);
5051

@@ -116,6 +117,7 @@ void MainController::initializeGenerators()
116117

117118
// append triggerGenerators to triggerContainer:
118119
// (container is used to access all generators at once)
120+
// order is important because of lowSoloMode
119121
m_triggerContainer.append(m_bass);
120122
m_triggerContainer.append(m_loMid);
121123
m_triggerContainer.append(m_hiMid);
@@ -363,6 +365,7 @@ void MainController::loadPreset(const QString &constFileName, bool createIfNotEx
363365
setFftCompression(settings.value("fftCompression").toReal());
364366
setAgcEnabled(settings.value("agcEnabled").toBool());
365367
setConsoleType(settings.value("consoleType").toString());
368+
setLowSoloMode(settings.value("lowSoloMode").toBool());
366369

367370
// restore the settings in all TriggerGenerators:
368371
for (int i=0; i<m_triggerContainer.size(); ++i) {
@@ -423,6 +426,7 @@ void MainController::savePresetAs(const QString &constFileName, bool isAutosave)
423426
settings.setValue("fftCompression", getFftCompression());
424427
settings.setValue("agcEnabled", getAgcEnabled());
425428
settings.setValue("consoleType", getConsoleType());
429+
settings.setValue("lowSoloMode", getLowSoloMode());
426430

427431
// save the settings in all TriggerGenerators:
428432
for (int i=0; i<m_triggerContainer.size(); ++i) {

src/MainController.h

+13-2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ class MainController : public QObject
7272
Q_PROPERTY(QString presetName READ getPresetName NOTIFY presetNameChanged)
7373
// this property indicates if the current preset has been changed but not stored yet:
7474
Q_PROPERTY(bool presetChangedButNotSaved READ getPresetChangedButNotSaved NOTIFY presetChangedButNotSavedChanged)
75+
// this property is used for the lowSoloMode checkbox:
76+
Q_PROPERTY(bool lowSoloMode READ getLowSoloMode WRITE setLowSoloMode NOTIFY lowSoloModeChanged)
7577

7678
public:
7779
explicit MainController(QQmlApplicationEngine* m_qmlEngine, QObject *parent = 0);
@@ -110,7 +112,10 @@ class MainController : public QObject
110112
void compressionChanged();
111113

112114
// emitted when a value of the preset changed
113-
void presetChanged();
115+
void presetChanged();
116+
117+
// emitted when lowSoloMode changed
118+
void lowSoloModeChanged();
114119

115120
// forwarded from OSCNetworkManager:
116121
void messageReceived(OSCMessage msg);
@@ -139,7 +144,7 @@ public slots:
139144
// restores the window size and position
140145
void restoreWindowGeometry();
141146

142-
void updateFFT() { m_fft.calculateFFT(); }
147+
void updateFFT() { m_fft.calculateFFT(m_lowSoloMode); }
143148

144149
// ------------------- Presets --------------------------------
145150

@@ -186,6 +191,11 @@ public slots:
186191
// sets the used console type (either "EOS" or "Cobalt")
187192
void setConsoleType(QString value);
188193

194+
// returns if low solo mode is active
195+
bool getLowSoloMode() const { return m_lowSoloMode; }
196+
// enables or disables low solo mode
197+
void setLowSoloMode(bool value) { m_lowSoloMode = value; emit lowSoloModeChanged(); }
198+
189199
// returns the current spectrum outline as a list of qreal values in the range 0...1
190200
// used in GUI to display SpectrumPlot
191201
QList<qreal> getSpectrumPoints();
@@ -307,6 +317,7 @@ private slots:
307317
QMap<QString, QObject*> m_dialogs; // list of all open dialogs (QML-filename -> GUI element instance)
308318
OSCMapping m_oscMapping; // OSCMapping instance
309319
QTimer m_oscUpdateTimer; // Timer used to trigger OSC level feedback
320+
bool m_lowSoloMode; // true if low solo mode is active
310321

311322
TriggerGenerator* m_bass; // pointer to Bass TriggerGenerator instance
312323
TriggerGenerator* m_loMid; // pointer to LoMid TriggerGenerator instance

src/TriggerGenerator.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@
2626
#include <QtMath>
2727

2828
TriggerGenerator::TriggerGenerator(QString name, OSCNetworkManager* osc, bool isBandpass, bool invert, int midFreq)
29-
: TriggerGeneratorInterface()
29+
: TriggerGeneratorInterface(isBandpass)
3030
, m_name(name)
31-
, m_osc(osc)
32-
, m_isBandpass(isBandpass)
31+
, m_osc(osc)
3332
, m_invert(invert)
3433
, m_midFreq(midFreq)
3534
, m_defaultMidFreq(midFreq)
@@ -42,7 +41,7 @@ TriggerGenerator::TriggerGenerator(QString name, OSCNetworkManager* osc, bool is
4241
resetParameters();
4342
}
4443

45-
void TriggerGenerator::checkForTrigger(ScaledSpectrum &spectrum)
44+
bool TriggerGenerator::checkForTrigger(ScaledSpectrum &spectrum, bool forceRelease)
4645
{
4746
qreal value;
4847
if (m_isBandpass) {
@@ -53,11 +52,11 @@ void TriggerGenerator::checkForTrigger(ScaledSpectrum &spectrum)
5352
if (m_invert) value = 1 - value;
5453

5554
// check for trigger:
56-
if (!m_isActive && value >= m_threshold) {
55+
if ((!m_isActive && value >= m_threshold) && !forceRelease) {
5756
// activate trigger:
5857
m_isActive = true;
5958
m_filter.triggerOn();
60-
} else if (m_isActive && value < m_threshold) {
59+
} else if ((m_isActive && value < m_threshold) || forceRelease) {
6160
// release trigger:
6261
m_isActive = false;
6362
m_filter.triggerOff();
@@ -76,6 +75,7 @@ void TriggerGenerator::checkForTrigger(ScaledSpectrum &spectrum)
7675
}
7776

7877
m_lastValue = value;
78+
return m_isActive;
7979
}
8080

8181
void TriggerGenerator::save(QSettings& settings) const

src/TriggerGenerator.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class TriggerGenerator : public TriggerGeneratorInterface
8383
qreal getCurrentLevel() const { return m_lastValue; }
8484

8585
// checks if the max level within the frequency band is greater than the threshold
86-
void checkForTrigger(ScaledSpectrum& spectrum) override;
86+
bool checkForTrigger(ScaledSpectrum& spectrum, bool forceRelease) override;
8787

8888
// ---------------- Save and Restore ---------------
8989

@@ -98,8 +98,7 @@ class TriggerGenerator : public TriggerGeneratorInterface
9898

9999
protected:
100100
const QString m_name; // name of the Trigger (used for save, restore and UI)
101-
OSCNetworkManager* m_osc; // pointer to OSCNetworkManager instance (i.e. of MainController)
102-
const bool m_isBandpass; // true if this is a bandpass (with frequency and width parameter)
101+
OSCNetworkManager* m_osc; // pointer to OSCNetworkManager instance (i.e. of MainController)
103102
const bool m_invert; // true if signal values should be inverted (i.e. for "silence" trigger)
104103
int m_midFreq; // middle frequency of bandpass in Hz
105104
const int m_defaultMidFreq; // default midFreq in Hz, used for reset

src/TriggerGeneratorInterface.h

+10-2
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ class TriggerGeneratorInterface
3636
{
3737

3838
public:
39-
explicit TriggerGeneratorInterface() {}
39+
explicit TriggerGeneratorInterface(bool isBandpass)
40+
: m_isBandpass(isBandpass) {}
4041
virtual ~TriggerGeneratorInterface() {}
4142

4243
// checks if a signal should be triggered by analyzing the given spectrum
43-
virtual void checkForTrigger(ScaledSpectrum& spectrum) = 0;
44+
// forceRelease is true when low solo mode is active and a lower trigger was activated
45+
virtual bool checkForTrigger(ScaledSpectrum& spectrum, bool forceRelease) = 0;
4446

4547
// returns a reference to the internal TriggerFilter
4648
virtual TriggerFilter& getTriggerFilter() = 0;
@@ -50,6 +52,12 @@ class TriggerGeneratorInterface
5052

5153
// restores parameters from QSettings
5254
virtual void restore(QSettings& settings) = 0;
55+
56+
// returns if this is a Bandpass trigger generator
57+
bool isBandpass() const { return m_isBandpass; }
58+
59+
protected:
60+
const bool m_isBandpass; // true if this is a bandpass (with frequency and width parameter)
5361
};
5462

5563

src/qml/SpectrumWithControls.qml

+16-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Row {
165165
// ------------------------- Gain and Compressor Sliders ---------------------
166166
Row {
167167
width: parent.width
168-
height: parent.height - 30*2
168+
height: parent.height - 30*3
169169
// -------------------------- Gain
170170
Column {
171171
width: 80
@@ -232,7 +232,7 @@ Row {
232232
}
233233
} // Row Gain and Compressor Sliders end
234234

235-
// ----------------------------- dB Checkbox and AGC Checkbox -----------------------
235+
// ----------------------------- dB + AGC + LowSolo Checkbox -----------------------
236236
DarkCheckBox {
237237
id: agcCheckbox
238238
width: parent.width - 20
@@ -261,5 +261,19 @@ Row {
261261
onDecibelConversionChanged: dbCheckbox.checked = controller.decibelConversion
262262
}
263263
}
264+
DarkCheckBox {
265+
id: lowSoloCheckbox
266+
width: parent.width - 20
267+
height: 30
268+
x: 20
269+
checked: controller.lowSoloMode
270+
onCheckedChanged: if (checked !== controller.lowSoloMode) controller.setLowSoloMode(checked)
271+
text: "Low Solo Mode"
272+
273+
Connections {
274+
target: controller
275+
onLowSoloModeChanged: lowSoloCheckbox.checked = controller.lowSoloMode
276+
}
277+
}
264278
} // Right area column end
265279
}

src/versionInfo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
// This file includes the version number of this software.
2727

28-
static const QString VERSION_STRING = "0.0.1.1.0.15";
28+
static const QString VERSION_STRING = "0.0.1.1.0.16";
2929
static const int SETTINGS_FORMAT_VERSION = 1;
3030

3131
#endif // VERSIONINFO_H

0 commit comments

Comments
 (0)