clang-format: Increase column limit from 80 to 120

This commit is contained in:
Ryan Foster
2024-10-04 18:19:27 -04:00
parent 109f64c446
commit a1fbf1015f
736 changed files with 22684 additions and 45435 deletions
+1 -3
View File
@@ -19,9 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "headers/EditorWidget.h"
#include <QCloseEvent>
EditorWidget::EditorWidget(QWidget *parent, VSTPlugin *plugin)
: QWidget(parent),
plugin(plugin)
EditorWidget::EditorWidget(QWidget *parent, VSTPlugin *plugin) : QWidget(parent), plugin(plugin)
{
setWindowFlags(this->windowFlags() |= Qt::MSWindowsFixedSizeDialogHint);
}
+35 -75
View File
@@ -19,9 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "headers/VSTPlugin.h"
#include <util/platform.h>
intptr_t VSTPlugin::hostCallback_static(AEffect *effect, int32_t opcode,
int32_t index, intptr_t value,
void *ptr, float opt)
intptr_t VSTPlugin::hostCallback_static(AEffect *effect, int32_t opcode, int32_t index, intptr_t value, void *ptr,
float opt)
{
UNUSED_PARAMETER(opt);
@@ -80,9 +79,7 @@ float VSTPlugin::GetSampleRate()
return mTimeInfo.sampleRate;
}
VSTPlugin::VSTPlugin(obs_source_t *sourceContext) : sourceContext{sourceContext}
{
}
VSTPlugin::VSTPlugin(obs_source_t *sourceContext) : sourceContext{sourceContext} {}
VSTPlugin::~VSTPlugin()
{
@@ -103,10 +100,8 @@ void VSTPlugin::createChannelBuffers(size_t count)
outputs = (float **)bmalloc(sizeof(float *) * numChannels);
channelrefs = (float **)bmalloc(sizeof(float *) * numChannels);
for (size_t channel = 0; channel < numChannels; channel++) {
inputs[channel] =
(float *)bmalloc(sizeof(float) * blocksize);
outputs[channel] =
(float *)bmalloc(sizeof(float) * blocksize);
inputs[channel] = (float *)bmalloc(sizeof(float) * blocksize);
outputs[channel] = (float *)bmalloc(sizeof(float) * blocksize);
}
}
}
@@ -142,8 +137,7 @@ void VSTPlugin::loadEffectFromPath(const std::string &path)
{
if (this->pluginPath.compare(path) != 0) {
unloadEffect();
blog(LOG_INFO, "User selected new VST plugin: '%s'",
path.c_str());
blog(LOG_INFO, "User selected new VST plugin: '%s'", path.c_str());
}
if (!effect) {
@@ -173,25 +167,19 @@ void VSTPlugin::loadEffectFromPath(const std::string &path)
int maxchans = std::max(effect->numInputs, effect->numOutputs);
// sanity check
if (maxchans < 0 || maxchans > 256) {
blog(LOG_WARNING,
"VST Plug-in has invalid number of channels");
blog(LOG_WARNING, "VST Plug-in has invalid number of channels");
return;
}
createChannelBuffers(maxchans);
// It is better to invoke this code after checking magic number
effect->dispatcher(effect, effGetEffectName, 0, 0, effectName,
0);
effect->dispatcher(effect, effGetVendorString, 0, 0,
vendorString, 0);
effect->dispatcher(effect, effGetEffectName, 0, 0, effectName, 0);
effect->dispatcher(effect, effGetVendorString, 0, 0, vendorString, 0);
// This check logic is refer to open source project : Audacity
if ((effect->flags & effFlagsIsSynth) ||
!(effect->flags & effFlagsCanReplacing)) {
blog(LOG_WARNING,
"VST Plug-in can't support replacing. '%s'",
path.c_str());
if ((effect->flags & effFlagsIsSynth) || !(effect->flags & effFlagsCanReplacing)) {
blog(LOG_WARNING, "VST Plug-in can't support replacing. '%s'", path.c_str());
return;
}
@@ -201,8 +189,7 @@ void VSTPlugin::loadEffectFromPath(const std::string &path)
effect->dispatcher(effect, effOpen, 0, 0, nullptr, 0.0f);
// Set some default properties
size_t sampleRate =
audio_output_get_sample_rate(obs_get_audio());
size_t sampleRate = audio_output_get_sample_rate(obs_get_audio());
// Initialize time info
memset(&mTimeInfo, 0, sizeof(mTimeInfo));
@@ -211,14 +198,11 @@ void VSTPlugin::loadEffectFromPath(const std::string &path)
mTimeInfo.tempo = 120.0;
mTimeInfo.timeSigNumerator = 4;
mTimeInfo.timeSigDenominator = 4;
mTimeInfo.flags = kVstTempoValid | kVstNanosValid |
kVstTransportPlaying;
mTimeInfo.flags = kVstTempoValid | kVstNanosValid | kVstTransportPlaying;
effect->dispatcher(effect, effSetSampleRate, 0, 0, nullptr,
sampleRate);
effect->dispatcher(effect, effSetSampleRate, 0, 0, nullptr, sampleRate);
int blocksize = BLOCK_SIZE;
effect->dispatcher(effect, effSetBlockSize, 0, blocksize,
nullptr, 0.0f);
effect->dispatcher(effect, effSetBlockSize, 0, blocksize, nullptr, 0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0);
@@ -230,8 +214,7 @@ void VSTPlugin::loadEffectFromPath(const std::string &path)
}
}
static void silenceChannel(float **channelData, size_t numChannels,
long numFrames)
static void silenceChannel(float **channelData, size_t numChannels, long numFrames)
{
for (size_t channel = 0; channel < numChannels; ++channel) {
for (long frame = 0; frame < numFrames; ++frame) {
@@ -254,32 +237,24 @@ obs_audio_data *VSTPlugin::process(struct obs_audio_data *audio)
uint passes = (audio->frames + BLOCK_SIZE - 1) / BLOCK_SIZE;
uint extra = audio->frames % BLOCK_SIZE;
for (uint pass = 0; pass < passes; pass++) {
uint frames = pass == passes - 1 && extra ? extra
: BLOCK_SIZE;
uint frames = pass == passes - 1 && extra ? extra : BLOCK_SIZE;
silenceChannel(outputs, numChannels, BLOCK_SIZE);
for (size_t d = 0; d < numChannels; d++) {
if (d < MAX_AV_PLANES &&
audio->data[d] != nullptr) {
channelrefs[d] =
((float *)audio->data[d]) +
(pass * BLOCK_SIZE);
if (d < MAX_AV_PLANES && audio->data[d] != nullptr) {
channelrefs[d] = ((float *)audio->data[d]) + (pass * BLOCK_SIZE);
} else {
channelrefs[d] = inputs[d];
}
};
effect->processReplacing(effect, channelrefs, outputs,
frames);
effect->processReplacing(effect, channelrefs, outputs, frames);
// only copy back the channels the plugin may have generated
for (size_t c = 0; c < (size_t)effect->numOutputs &&
c < MAX_AV_PLANES;
c++) {
for (size_t c = 0; c < (size_t)effect->numOutputs && c < MAX_AV_PLANES; c++) {
if (audio->data[c]) {
for (size_t i = 0; i < frames; i++) {
channelrefs[c][i] =
outputs[c][i];
channelrefs[c][i] = outputs[c][i];
}
}
}
@@ -300,10 +275,8 @@ void VSTPlugin::unloadEffect()
effectReady = false;
if (effect) {
effect->dispatcher(effect, effMainsChanged, 0, 0,
nullptr, 0);
effect->dispatcher(effect, effClose, 0, 0, nullptr,
0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0);
effect->dispatcher(effect, effClose, 0, 0, nullptr, 0.0f);
}
effect = nullptr;
@@ -338,9 +311,7 @@ void VSTPlugin::openEditor()
if (effect && !editorWidget) {
// This check logic is refer to open source project : Audacity
if (!(effect->flags & effFlagsHasEditor)) {
blog(LOG_WARNING,
"VST Plug-in: Can't support edit feature. '%s'",
pluginPath.c_str());
blog(LOG_WARNING, "VST Plug-in: Can't support edit feature. '%s'", pluginPath.c_str());
return;
}
@@ -353,13 +324,10 @@ void VSTPlugin::openEditor()
}
if (filterName.empty()) {
editorWidget->setWindowTitle(QString("%1 - %2").arg(
sourceName.c_str(), effectName));
editorWidget->setWindowTitle(QString("%1 - %2").arg(sourceName.c_str(), effectName));
} else {
editorWidget->setWindowTitle(
QString("%1: %2 - %3")
.arg(sourceName.c_str(),
filterName.c_str(), effectName));
QString("%1: %2 - %3").arg(sourceName.c_str(), filterName.c_str(), effectName));
}
editorWidget->show();
}
@@ -385,8 +353,7 @@ std::string VSTPlugin::getChunk()
if (effect->flags & effFlagsProgramChunks) {
void *buf = nullptr;
intptr_t chunkSize = effect->dispatcher(effect, effGetChunk, 1,
0, &buf, 0.0);
intptr_t chunkSize = effect->dispatcher(effect, effGetChunk, 1, 0, &buf, 0.0);
QByteArray data = QByteArray((char *)buf, chunkSize);
return QString(data.toBase64()).toStdString();
@@ -398,8 +365,7 @@ std::string VSTPlugin::getChunk()
}
const char *bytes = reinterpret_cast<const char *>(&params[0]);
QByteArray data =
QByteArray(bytes, (int)(sizeof(float) * params.size()));
QByteArray data = QByteArray(bytes, (int)(sizeof(float) * params.size()));
std::string encoded = QString(data.toBase64()).toStdString();
return encoded;
}
@@ -412,21 +378,17 @@ void VSTPlugin::setChunk(const std::string &data)
}
if (effect->flags & effFlagsProgramChunks) {
QByteArray base64Data =
QByteArray(data.c_str(), (int)data.length());
QByteArray base64Data = QByteArray(data.c_str(), (int)data.length());
QByteArray chunkData = QByteArray::fromBase64(base64Data);
void *buf = nullptr;
buf = chunkData.data();
effect->dispatcher(effect, effSetChunk, 1, chunkData.length(),
buf, 0);
effect->dispatcher(effect, effSetChunk, 1, chunkData.length(), buf, 0);
} else {
QByteArray base64Data =
QByteArray(data.c_str(), (int)data.length());
QByteArray base64Data = QByteArray(data.c_str(), (int)data.length());
QByteArray paramData = QByteArray::fromBase64(base64Data);
const char *p_chars = paramData.data();
const float *p_floats =
reinterpret_cast<const float *>(p_chars);
const float *p_floats = reinterpret_cast<const float *>(p_chars);
const size_t size = paramData.length() / sizeof(float);
@@ -445,11 +407,9 @@ void VSTPlugin::setChunk(const std::string &data)
void VSTPlugin::setProgram(const int programNumber)
{
if (programNumber < effect->numPrograms) {
effect->dispatcher(effect, effSetProgram, 0, programNumber,
NULL, 0.0f);
effect->dispatcher(effect, effSetProgram, 0, programNumber, NULL, 0.0f);
} else {
blog(LOG_ERROR,
"Failed to load program, number was outside possible program range.");
blog(LOG_ERROR, "Failed to load program, number was outside possible program range.");
}
}
+2 -3
View File
@@ -79,9 +79,8 @@ class VSTPlugin : public QObject {
void unloadLibrary();
static intptr_t hostCallback_static(AEffect *effect, int32_t opcode,
int32_t index, intptr_t value,
void *ptr, float opt);
static intptr_t hostCallback_static(AEffect *effect, int32_t opcode, int32_t index, intptr_t value, void *ptr,
float opt);
VstTimeInfo *GetTimeInfo();
float GetSampleRate();
+1 -2
View File
@@ -26,8 +26,7 @@ void EditorWidget::buildEffectContainer(AEffect *effect)
effect->dispatcher(effect, effEditGetRect, 0, 0, &vstRect, 0);
if (vstRect) {
setFixedSize(vstRect->right - vstRect->left,
vstRect->bottom - vstRect->top);
setFixedSize(vstRect->right - vstRect->left, vstRect->bottom - vstRect->top);
}
}
+1 -2
View File
@@ -37,8 +37,7 @@ AEffect *VSTPlugin::loadEffect()
mainEntryPoint = (vstPluginMain)os_dlsym(soHandle, "VSTPluginMain");
if (mainEntryPoint == nullptr) {
mainEntryPoint =
(vstPluginMain)os_dlsym(soHandle, "VstPluginMain()");
mainEntryPoint = (vstPluginMain)os_dlsym(soHandle, "VstPluginMain()");
}
if (mainEntryPoint == nullptr) {
+39 -85
View File
@@ -35,8 +35,7 @@ MODULE_EXPORT const char *obs_module_description(void)
return "VST 2.x Plug-in filter";
}
static bool open_editor_button_clicked(obs_properties_t *props,
obs_property_t *property, void *data)
static bool open_editor_button_clicked(obs_properties_t *props, obs_property_t *property, void *data)
{
VSTPlugin *vstPlugin = (VSTPlugin *)data;
@@ -44,10 +43,8 @@ static bool open_editor_button_clicked(obs_properties_t *props,
QMetaObject::invokeMethod(vstPlugin, "openEditor");
obs_property_set_visible(
obs_properties_get(props, OPEN_VST_SETTINGS), false);
obs_property_set_visible(
obs_properties_get(props, CLOSE_VST_SETTINGS), true);
obs_property_set_visible(obs_properties_get(props, OPEN_VST_SETTINGS), false);
obs_property_set_visible(obs_properties_get(props, CLOSE_VST_SETTINGS), true);
}
UNUSED_PARAMETER(props);
@@ -57,8 +54,7 @@ static bool open_editor_button_clicked(obs_properties_t *props,
return true;
}
static bool close_editor_button_clicked(obs_properties_t *props,
obs_property_t *property, void *data)
static bool close_editor_button_clicked(obs_properties_t *props, obs_property_t *property, void *data)
{
VSTPlugin *vstPlugin = (VSTPlugin *)data;
@@ -66,10 +62,8 @@ static bool close_editor_button_clicked(obs_properties_t *props,
QMetaObject::invokeMethod(vstPlugin, "closeEditor");
obs_property_set_visible(
obs_properties_get(props, OPEN_VST_SETTINGS), true);
obs_property_set_visible(
obs_properties_get(props, CLOSE_VST_SETTINGS), false);
obs_property_set_visible(obs_properties_get(props, OPEN_VST_SETTINGS), true);
obs_property_set_visible(obs_properties_get(props, CLOSE_VST_SETTINGS), false);
}
UNUSED_PARAMETER(property);
@@ -106,20 +100,16 @@ static void vst_update(void *data, obs_data_t *settings)
{
VSTPlugin *vstPlugin = (VSTPlugin *)data;
vstPlugin->openInterfaceWhenActive =
obs_data_get_bool(settings, OPEN_WHEN_ACTIVE_VST_SETTINGS);
vstPlugin->openInterfaceWhenActive = obs_data_get_bool(settings, OPEN_WHEN_ACTIVE_VST_SETTINGS);
const char *path = obs_data_get_string(settings, "plugin_path");
#ifdef __linux__
// Migrate freedesktop.org Flatpak runtime 21.08 VST paths to 22.08.
if (QFile::exists("/.flatpak-info") &&
QString(path).startsWith("/app/extensions/Plugins/lxvst")) {
if (QFile::exists("/.flatpak-info") && QString(path).startsWith("/app/extensions/Plugins/lxvst")) {
QString newPath(path);
newPath.replace("/app/extensions/Plugins/lxvst",
"/app/extensions/Plugins/vst");
obs_data_set_string(settings, "plugin_path",
newPath.toStdString().c_str());
newPath.replace("/app/extensions/Plugins/lxvst", "/app/extensions/Plugins/vst");
obs_data_set_string(settings, "plugin_path", newPath.toStdString().c_str());
path = obs_data_get_string(settings, "plugin_path");
}
#endif
@@ -134,10 +124,8 @@ static void vst_update(void *data, obs_data_t *settings)
const char *chunkHash = obs_data_get_string(settings, "chunk_hash");
const char *chunkData = obs_data_get_string(settings, "chunk_data");
bool chunkHashesMatch = chunkHash && *chunkHash &&
hash.compare(chunkHash) == 0;
if (chunkData && *chunkData &&
(chunkHashesMatch || !chunkHash || !*chunkHash)) {
bool chunkHashesMatch = chunkHash && *chunkHash && hash.compare(chunkHash) == 0;
if (chunkData && *chunkData && (chunkHashesMatch || !chunkHash || !*chunkHash)) {
vstPlugin->setChunk(std::string(chunkData));
}
}
@@ -153,15 +141,11 @@ static void *vst_create(obs_data_t *settings, obs_source_t *filter)
static void vst_save(void *data, obs_data_t *settings)
{
VSTPlugin *vstPlugin = (VSTPlugin *)data;
obs_data_set_string(settings, "chunk_data",
vstPlugin->getChunk().c_str());
obs_data_set_string(
settings, "chunk_hash",
getFileMD5(vstPlugin->getEffectPath().c_str()).c_str());
obs_data_set_string(settings, "chunk_data", vstPlugin->getChunk().c_str());
obs_data_set_string(settings, "chunk_hash", getFileMD5(vstPlugin->getEffectPath().c_str()).c_str());
}
static struct obs_audio_data *vst_filter_audio(void *data,
struct obs_audio_data *audio)
static struct obs_audio_data *vst_filter_audio(void *data, struct obs_audio_data *audio)
{
VSTPlugin *vstPlugin = (VSTPlugin *)data;
vstPlugin->process(audio);
@@ -192,29 +176,19 @@ static void fill_out_plugins(obs_property_t *list)
if (!isWow64) {
#endif
dir_list << qEnvironmentVariable("ProgramFiles") +
"/Steinberg/VstPlugins/"
<< qEnvironmentVariable("CommonProgramFiles") +
"/Steinberg/Shared Components/"
dir_list << qEnvironmentVariable("ProgramFiles") + "/Steinberg/VstPlugins/"
<< qEnvironmentVariable("CommonProgramFiles") + "/Steinberg/Shared Components/"
<< qEnvironmentVariable("CommonProgramFiles") + "/VST2"
<< qEnvironmentVariable("CommonProgramFiles") +
"/Steinberg/VST2"
<< qEnvironmentVariable("CommonProgramFiles") +
"/VSTPlugins/"
<< qEnvironmentVariable("ProgramFiles") +
"/VSTPlugins/";
<< qEnvironmentVariable("CommonProgramFiles") + "/Steinberg/VST2"
<< qEnvironmentVariable("CommonProgramFiles") + "/VSTPlugins/"
<< qEnvironmentVariable("ProgramFiles") + "/VSTPlugins/";
#ifndef _WIN64
} else {
dir_list << qEnvironmentVariable("ProgramFiles(x86)") +
"/Steinberg/VstPlugins/"
<< qEnvironmentVariable("CommonProgramFiles(x86)") +
"/Steinberg/Shared Components/"
<< qEnvironmentVariable("CommonProgramFiles(x86)") +
"/VST2"
<< qEnvironmentVariable("CommonProgramFiles(x86)") +
"/VSTPlugins/"
<< qEnvironmentVariable("ProgramFiles(x86)") +
"/VSTPlugins/";
dir_list << qEnvironmentVariable("ProgramFiles(x86)") + "/Steinberg/VstPlugins/"
<< qEnvironmentVariable("CommonProgramFiles(x86)") + "/Steinberg/Shared Components/"
<< qEnvironmentVariable("CommonProgramFiles(x86)") + "/VST2"
<< qEnvironmentVariable("CommonProgramFiles(x86)") + "/VSTPlugins/"
<< qEnvironmentVariable("ProgramFiles(x86)") + "/VSTPlugins/";
}
#endif
#elif __linux__
@@ -263,9 +237,7 @@ static void fill_out_plugins(obs_property_t *list)
for (int a = 0; a < dir_list.size(); ++a) {
QDir search_dir(dir_list[a]);
search_dir.setNameFilters(filters);
QDirIterator it(search_dir,
QDirIterator::Subdirectories |
QDirIterator::FollowSymlinks);
QDirIterator it(search_dir, QDirIterator::Subdirectories | QDirIterator::FollowSymlinks);
while (it.hasNext()) {
QString path = it.next();
QString name = it.fileName();
@@ -285,27 +257,18 @@ static void fill_out_plugins(obs_property_t *list)
}
// Now sort list alphabetically (still case-sensitive though).
std::stable_sort(vst_list.begin(), vst_list.end(),
std::less<QString>());
std::stable_sort(vst_list.begin(), vst_list.end(), std::less<QString>());
// Now add said list to the plug-in list of OBS
obs_property_list_add_string(list, "{Please select a plug-in}",
nullptr);
obs_property_list_add_string(list, "{Please select a plug-in}", nullptr);
for (int b = 0; b < vst_list.size(); ++b) {
QString vst_sorted = vst_list[b];
obs_property_list_add_string(
list,
vst_sorted.left(vst_sorted.indexOf('='))
.toStdString()
.c_str(),
vst_sorted.mid(vst_sorted.indexOf('=') + 1)
.toStdString()
.c_str());
obs_property_list_add_string(list, vst_sorted.left(vst_sorted.indexOf('=')).toStdString().c_str(),
vst_sorted.mid(vst_sorted.indexOf('=') + 1).toStdString().c_str());
}
}
static bool vst_changed(void *data, obs_properties_t *props,
obs_property_t *list, obs_data_t *settings)
static bool vst_changed(void *data, obs_properties_t *props, obs_property_t *list, obs_data_t *settings)
{
UNUSED_PARAMETER(settings);
UNUSED_PARAMETER(list);
@@ -325,10 +288,8 @@ static bool vst_changed(void *data, obs_properties_t *props,
}
}
obs_property_set_visible(obs_properties_get(props, OPEN_VST_SETTINGS),
open_settings_vis);
obs_property_set_visible(obs_properties_get(props, CLOSE_VST_SETTINGS),
close_settings_vis);
obs_property_set_visible(obs_properties_get(props, OPEN_VST_SETTINGS), open_settings_vis);
obs_property_set_visible(obs_properties_get(props, CLOSE_VST_SETTINGS), close_settings_vis);
return true;
}
@@ -336,17 +297,13 @@ static bool vst_changed(void *data, obs_properties_t *props,
static obs_properties_t *vst_properties(void *data)
{
obs_properties_t *props = obs_properties_create();
obs_property_t *list = obs_properties_add_list(props, "plugin_path",
PLUG_IN_NAME,
OBS_COMBO_TYPE_LIST,
obs_property_t *list = obs_properties_add_list(props, "plugin_path", PLUG_IN_NAME, OBS_COMBO_TYPE_LIST,
OBS_COMBO_FORMAT_STRING);
fill_out_plugins(list);
obs_properties_add_button(props, OPEN_VST_SETTINGS, OPEN_VST_TEXT,
open_editor_button_clicked);
obs_properties_add_button(props, CLOSE_VST_SETTINGS, CLOSE_VST_TEXT,
close_editor_button_clicked);
obs_properties_add_button(props, OPEN_VST_SETTINGS, OPEN_VST_TEXT, open_editor_button_clicked);
obs_properties_add_button(props, CLOSE_VST_SETTINGS, CLOSE_VST_TEXT, close_editor_button_clicked);
bool open_settings_vis = true;
bool close_settings_vis = false;
@@ -363,13 +320,10 @@ static obs_properties_t *vst_properties(void *data)
}
}
obs_property_set_visible(obs_properties_get(props, OPEN_VST_SETTINGS),
open_settings_vis);
obs_property_set_visible(obs_properties_get(props, CLOSE_VST_SETTINGS),
close_settings_vis);
obs_property_set_visible(obs_properties_get(props, OPEN_VST_SETTINGS), open_settings_vis);
obs_property_set_visible(obs_properties_get(props, CLOSE_VST_SETTINGS), close_settings_vis);
obs_properties_add_bool(props, OPEN_WHEN_ACTIVE_VST_SETTINGS,
OPEN_WHEN_ACTIVE_VST_TEXT);
obs_properties_add_bool(props, OPEN_WHEN_ACTIVE_VST_SETTINGS, OPEN_WHEN_ACTIVE_VST_TEXT);
obs_property_set_modified_callback2(list, vst_changed, data);
+4 -6
View File
@@ -28,15 +28,14 @@ void EditorWidget::buildEffectContainer(AEffect *effect)
RegisterClassExW(&wcex);
const auto style = WS_CAPTION | WS_THICKFRAME | WS_OVERLAPPEDWINDOW;
windowHandle = CreateWindowW(wcex.lpszClassName, TEXT(""), style, 0, 0,
0, 0, nullptr, nullptr, nullptr, nullptr);
windowHandle =
CreateWindowW(wcex.lpszClassName, TEXT(""), style, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr);
// set pointer to vst effect for window long
LONG_PTR wndPtr = (LONG_PTR)effect;
SetWindowLongPtr(windowHandle, -21 /*GWLP_USERDATA*/, wndPtr);
QWidget *widget = QWidget::createWindowContainer(
QWindow::fromWinId((WId)windowHandle), nullptr);
QWidget *widget = QWidget::createWindowContainer(QWindow::fromWinId((WId)windowHandle), nullptr);
widget->move(0, 0);
QGridLayout *layout = new QGridLayout();
layout->setContentsMargins(0, 0, 0, 0);
@@ -70,8 +69,7 @@ void EditorWidget::handleResizeRequest(int, int)
// so we must resize window manually
// get pointer to vst effect from window long
LONG_PTR wndPtr = (LONG_PTR)GetWindowLongPtrW(windowHandle,
-21 /*GWLP_USERDATA*/);
LONG_PTR wndPtr = (LONG_PTR)GetWindowLongPtrW(windowHandle, -21 /*GWLP_USERDATA*/);
AEffect *effect = (AEffect *)(wndPtr);
VstRect *rec = nullptr;
+4 -8
View File
@@ -46,17 +46,14 @@ AEffect *VSTPlugin::loadEffect()
return nullptr;
}
vstPluginMain mainEntryPoint =
(vstPluginMain)GetProcAddress(dllHandle, "VSTPluginMain");
vstPluginMain mainEntryPoint = (vstPluginMain)GetProcAddress(dllHandle, "VSTPluginMain");
if (mainEntryPoint == nullptr) {
mainEntryPoint = (vstPluginMain)GetProcAddress(
dllHandle, "VstPluginMain()");
mainEntryPoint = (vstPluginMain)GetProcAddress(dllHandle, "VstPluginMain()");
}
if (mainEntryPoint == nullptr) {
mainEntryPoint =
(vstPluginMain)GetProcAddress(dllHandle, "main");
mainEntryPoint = (vstPluginMain)GetProcAddress(dllHandle, "main");
}
if (mainEntryPoint == nullptr) {
@@ -73,8 +70,7 @@ AEffect *VSTPlugin::loadEffect()
}
if (plugin == nullptr) {
blog(LOG_WARNING, "Couldn't create instance for '%s'",
pluginPath.c_str());
blog(LOG_WARNING, "Couldn't create instance for '%s'", pluginPath.c_str());
return nullptr;
}