Added bypass button.

lv2
Elliott Liggett 2021-08-15 19:08:31 -07:00
rodzic ee701795db
commit 06827a4d0b
6 zmienionych plików z 36 dodań i 18 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -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:

Wyświetl plik

@ -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;

Wyświetl plik

@ -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<controlsType> 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);

Wyświetl plik

@ -5,6 +5,7 @@
#include <QWidget>
#include <QPushButton>
#include <QCheckBox>
#include <QSlider>
#include <QLabel>
#include <QLayout>
@ -15,13 +16,15 @@ class pluginGenericGUI : public QWidget
{
Q_OBJECT
QGridLayout *layout;
QPushButton *button;
QCheckBox *bypassChk;
QVector<QSlider*> sliders;
QVector<QLabel*> labels;
QVector<controlsType> 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();

Wyświetl plik

@ -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)