diff --git a/audiohandler.cpp b/audiohandler.cpp index 849051a..65cf057 100644 --- a/audiohandler.cpp +++ b/audiohandler.cpp @@ -96,10 +96,10 @@ bool audioHandler::init(audioSetup setupIn) // plugin->setupPlugin((char*)""); // plugin->setupPlugin((char*)""); - plugin->setupPlugin((char*)"http://eq10q.sourceforge.net/gate"); // works well + //plugin->setupPlugin((char*)"http://eq10q.sourceforge.net/gate"); // works well //plugin->setupPlugin((char*)"http://plugin.org.uk/swh-plugins/gate"); // works well - //plugin->setupPlugin((char*)"http://eq10q.sourceforge.net/compressor"); // works very well + plugin->setupPlugin((char*)"http://eq10q.sourceforge.net/compressor"); // works very well //plugin->setupPlugin((char*)"http://eq10q.sourceforge.net/eq/eq1qm"); // malloc double-free error //plugin->setupPlugin((char*)"http://eq10q.sourceforge.net/eq/eq6qm"); // malloc double-free error diff --git a/audioplugin.cpp b/audioplugin.cpp index c9f3d2f..b369c6b 100644 --- a/audioplugin.cpp +++ b/audioplugin.cpp @@ -28,6 +28,8 @@ audioPlugin::audioPlugin(int maxBufferSizeNeeded, pluginPathType path, instanceId = (uint64_t)this; instanceString = QString("0x%1").arg(instanceId, 16, 16, QChar('0')); + inBypassMode = false; + info.chainPosition = chainPosition; info.instanceID = instanceId; info.path = audioChain; @@ -406,6 +408,8 @@ void audioPlugin::runPlugin(int samples) // samples is the number of samples *at 8-8 bit stereo interlaced* // The interface here is designed so that one can call it with the QByteArray.length() number. + if(inBypassMode) + return; if(haveActivatedPlugin && haveExternalSinkBuffer && haveExternalSourceBuffer) { @@ -414,15 +418,6 @@ void audioPlugin::runPlugin(int samples) sourceBufferSampleCount = samples / 2; // 16-bit is half as many inputBufferSampleCount = samples / 4; // 16-bit per-channel is 1/4 as many per channel. - // Safe multi-line comment - // Remove this statement once things work - // - // emit pluginStatusMessage(QString("runPlugin: externalSampleCount: %1, sourceBufferSampleCount: %2, inputBufferSampleCount: %3")\ - // .arg(externalSampleCount)\ - // .arg(sourceBufferSampleCount)\ - // .arg(inputBufferSampleCount)); - // - // You can safely comment out any of these functions to determine where the crash is: convertInputBuffer(); // seems ok copyControlsToPluginInterface(); // seems ok @@ -482,6 +477,11 @@ void audioPlugin::handleAdjustedPluginControls(controlsType control) } } +void audioPlugin::setBypass(bool bypass) +{ + this->inBypassMode = bypass; +} + void audioPlugin::copyControlsToPluginInterface() { // Haven't figured out exactly how to do this one yet. Something like this: diff --git a/audioplugin.h b/audioplugin.h index 377ada8..7c4e668 100644 --- a/audioplugin.h +++ b/audioplugin.h @@ -121,6 +121,7 @@ public slots: // Only call this function if the buffers have already been connected. // The function will load from the input buffer, and alter the output buffer. void runPlugin(int samples); + void setBypass(bool bypass); void getPluginControlPorts(pluginInstanceInfoType info); void handleAdjustedPluginControls(controlsType control); @@ -142,6 +143,7 @@ private: QMutex pluginRunLocker; bool forceOutputMono = true; bool computeLevels = false; + bool inBypassMode; int bufferSize; int externalBufferSize; bool haveAllocatedInternalBuffers = false; diff --git a/plugingenericgui.cpp b/plugingenericgui.cpp index fce7503..efdb35d 100644 --- a/plugingenericgui.cpp +++ b/plugingenericgui.cpp @@ -2,17 +2,25 @@ pluginGenericGUI::pluginGenericGUI(QWidget *parent) : QWidget(parent) { - button = new QPushButton("test"); layout = new QGridLayout(); + bypassChk = new QCheckBox("Bypass"); - //layout->addWidget(button,0,0); - //setLayout(layout); setWindowTitle("Generic plugin window"); + row=0; + col=0; + layout->addWidget(bypassChk, row, col); + row++; + //col++; + + connect(bypassChk, &QCheckBox::stateChanged, + [=](const int &value) { + emit setBypass((bool)value); + }); + } pluginGenericGUI::~pluginGenericGUI() { - delete button; delete layout; } @@ -55,8 +63,7 @@ void pluginGenericGUI::addControls(QVector controls) void pluginGenericGUI::showControls() { - int row=0; - int col = 0; + for(int i=0; i < sliders.size(); i++) { layout->addWidget(sliders.at(i), row, col); diff --git a/plugingenericgui.h b/plugingenericgui.h index 4276c85..9005436 100644 --- a/plugingenericgui.h +++ b/plugingenericgui.h @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -15,13 +16,15 @@ class pluginGenericGUI : public QWidget { Q_OBJECT QGridLayout *layout; - QPushButton *button; + QCheckBox *bypassChk; QVector sliders; QVector labels; QVector controls; void showControls(); void makeConnections(); float convertLevel(int level, float min, float max); + int row = 0; + int col = 0; public: @@ -30,6 +33,7 @@ public: signals: void setControl(controlsType control); + void setBypass(bool inBypassMode); public slots: void definePlugin(); diff --git a/wfmain.cpp b/wfmain.cpp index ad0a484..f309103 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -5331,6 +5331,11 @@ void wfmain::handlePluginInstanceInfo(pluginInstanceInfoType info) rxPlugin->handleAdjustedPluginControls(c); }); + connect(genericPlugin, &pluginGenericGUI::setBypass, + [=](const bool inBypassMode) { + rxPlugin->setBypass(inBypassMode); + }); + emit getRxAudioControls(info); } } else if (info.path == pluginPathTransmitAudio)