finished saving/loading vsts

This commit is contained in:
itsmattkc
2019-01-09 14:11:39 +11:00
parent 9e8fe16005
commit b34f7a2900
4 changed files with 35 additions and 40 deletions
+26
View File
@@ -7,6 +7,8 @@
#include <QPushButton>
#include <QDialog>
#include <QMessageBox>
#include <QFile>
#include <QXmlStreamWriter>
#include "playback/audio.h"
#include "mainwindow.h"
@@ -30,6 +32,9 @@ extern "C" {
case audioMasterGetCurrentProcessLevel:
return 0;
// Handle other opcodes here... there will be lots of them
case audioMasterEndEdit: // change made
mainWindow->setWindowModified(true);
break;
default:
dout << "[INFO] Plugin requested unhandled opcode" << opcode;
break;
@@ -214,6 +219,27 @@ void VSTHostWin::process_audio(double timecode_start, double timecode_end, quint
}
}
void VSTHostWin::custom_load(QXmlStreamReader &stream) {
if (stream.name() == "plugindata") {
stream.readNext();
QByteArray b = QByteArray::fromBase64(stream.text().toUtf8());
const char* data = b.constData();
if (plugin != NULL) {
dispatcher(plugin, effSetChunk, 0, (VstInt32) b.size(), (void*) b.constData(), 0);
}
}
}
void VSTHostWin::save(QXmlStreamWriter &stream) {
Effect::save(stream);
if (plugin != NULL) {
char* p = NULL;
VstInt32 length = dispatcher(plugin, effGetChunk, 0, 0, &p, 0);
QByteArray b(p, length);
stream.writeTextElement("plugindata", b.toBase64());
}
}
void VSTHostWin::show_interface(bool show) {
dialog->setVisible(show);
}