31 changed files with 7646 additions and 190 deletions
@ -0,0 +1,302 @@
@@ -0,0 +1,302 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// Some code by AI //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QDir> |
||||
#include <QFileInfo> |
||||
#include <QByteArray> |
||||
#include <QFile> |
||||
#include <QLibrary> |
||||
#include <QThread> |
||||
#include <cstring> |
||||
|
||||
#ifdef Q_OS_WIN |
||||
#define WIN32_LEAN_AND_MEAN |
||||
#ifndef NOMINMAX |
||||
#define NOMINMAX |
||||
#endif |
||||
#include <windows.h> |
||||
#endif |
||||
|
||||
#include "nvidiaaudioeffects.h" |
||||
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_LINUX) |
||||
struct NvidiaAudioEffects::Impl |
||||
{ |
||||
using CreateEffect = int (*)(const char *, void **); |
||||
using DestroyEffect = int (*)(void *); |
||||
using SetString = int (*)(void *, const char *, const char *); |
||||
using SetU32 = int (*)(void *, const char *, unsigned int); |
||||
using SetFloat = int (*)(void *, const char *, float); |
||||
using GetU32 = int (*)(void *, const char *, unsigned int *); |
||||
using Load = int (*)(void *); |
||||
using Run = int (*)(void *, const float **, float **, unsigned int, unsigned int); |
||||
|
||||
QLibrary library; |
||||
void *effect = nullptr; |
||||
QByteArray modelPath; |
||||
Qt::HANDLE threadId = nullptr; |
||||
DestroyEffect destroyEffect = nullptr; |
||||
Run run = nullptr; |
||||
}; |
||||
#else |
||||
struct NvidiaAudioEffects::Impl {}; |
||||
#endif |
||||
|
||||
NvidiaAudioEffects::NvidiaAudioEffects() :
|
||||
m_impl(nullptr)
|
||||
{ |
||||
} |
||||
|
||||
NvidiaAudioEffects::~NvidiaAudioEffects() |
||||
{ |
||||
shutdown(); |
||||
} |
||||
|
||||
bool NvidiaAudioEffects::initialize(QString& error, float intensityRatio, bool enableVad) |
||||
{ |
||||
shutdown(); |
||||
#if defined(Q_OS_WIN) || defined(Q_OS_LINUX) |
||||
QString sdkDir = qEnvironmentVariable("NVAFX_SDK_DIR"); |
||||
|
||||
#ifdef Q_OS_WIN |
||||
if (sdkDir.isEmpty()) { |
||||
sdkDir = QDir(qEnvironmentVariable("ProgramFiles")).filePath("NVIDIA Corporation/NVIDIA Audio Effects SDK"); |
||||
} |
||||
|
||||
const QString libraryPath = QDir(sdkDir).filePath("NVAudioEffects.dll"); |
||||
const QString modelPath = QDir(sdkDir).filePath("models/denoiser_48k.trtpkg"); |
||||
#else |
||||
if (sdkDir.isEmpty()) { |
||||
sdkDir = qEnvironmentVariable("AFX_SDK_ROOT"); |
||||
} |
||||
if (sdkDir.isEmpty()) { |
||||
error = QStringLiteral("Set NVAFX_SDK_DIR to the Linux Audio Effects SDK root"); |
||||
return false; |
||||
} |
||||
|
||||
const QString libraryPath = QDir(sdkDir).filePath("nvafx/lib/libnv_audiofx.so"); |
||||
QString modelPath = qEnvironmentVariable("NVAFX_MODEL_PATH"); |
||||
if (modelPath.isEmpty()) |
||||
{ |
||||
// Packages contain GPU-specific models. Pick one only if unambiguous.
|
||||
QStringList models; |
||||
for (const QString& feature : {QStringLiteral("denoiser"), QStringLiteral("nvafxdenoiser")}) |
||||
{ |
||||
const QDir modelDir(QDir(sdkDir).filePath(QStringLiteral("features/%1/models").arg(feature))); |
||||
for (const QString& gpuDir : modelDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) |
||||
{ |
||||
const QString path = modelDir.filePath(gpuDir + QStringLiteral("/denoiser_48k.trtpkg")); |
||||
if (QFileInfo(path).isFile()) { |
||||
models.append(path); |
||||
} |
||||
} |
||||
} |
||||
if (models.size() == 1) { |
||||
modelPath = models.first(); |
||||
} else { |
||||
error = QStringLiteral("Set NVAFX_MODEL_PATH to this GPU's denoiser_48k.trtpkg (found %1 models)").arg(models.size()); |
||||
return false; |
||||
} |
||||
} |
||||
#endif |
||||
|
||||
if (!QFileInfo(libraryPath).isFile() || !QFileInfo(modelPath).isFile()) |
||||
{ |
||||
error = QStringLiteral("NVIDIA Audio Effects library or 48 kHz model was not found: %1, %2").arg(libraryPath, modelPath); |
||||
return false; |
||||
} |
||||
|
||||
m_impl = new Impl; |
||||
m_impl->modelPath = QFile::encodeName(QDir::toNativeSeparators(modelPath)); |
||||
m_impl->library.setFileName(QFileInfo(libraryPath).absoluteFilePath()); |
||||
#ifdef Q_OS_WIN |
||||
// QLibrary's ordinary load cannot find this SDK's adjacent DLL dependencies.
|
||||
// Load once with the SDK directory in the dependency search path, then let
|
||||
// QLibrary acquire and own its own reference to the already loaded DLL.
|
||||
HMODULE bootstrap = LoadLibraryExW(reinterpret_cast<LPCWSTR>(QDir::toNativeSeparators(libraryPath).utf16()), |
||||
nullptr, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_DEFAULT_DIRS); |
||||
if (!bootstrap) |
||||
{ |
||||
error = QStringLiteral("Could not load NVIDIA Audio Effects DLL (Windows error %1)").arg(GetLastError()); |
||||
shutdown(); |
||||
return false; |
||||
} |
||||
#endif |
||||
const bool loaded = m_impl->library.load(); |
||||
#ifdef Q_OS_WIN |
||||
FreeLibrary(bootstrap); |
||||
#endif |
||||
if (!loaded) |
||||
{ |
||||
error = QStringLiteral("Could not load NVIDIA Audio Effects library: %1").arg(m_impl->library.errorString()); |
||||
shutdown(); |
||||
return false; |
||||
} |
||||
|
||||
m_impl->threadId = QThread::currentThreadId(); |
||||
const auto resolve = [this](const char *name) { return m_impl->library.resolve(name); }; |
||||
const auto createEffect = reinterpret_cast<Impl::CreateEffect>(resolve("NvAFX_CreateEffect")); |
||||
m_impl->destroyEffect = reinterpret_cast<Impl::DestroyEffect>(resolve("NvAFX_DestroyEffect")); |
||||
const auto setString = reinterpret_cast<Impl::SetString>(resolve("NvAFX_SetString")); |
||||
const auto setU32 = reinterpret_cast<Impl::SetU32>(resolve("NvAFX_SetU32")); |
||||
const auto setFloat = reinterpret_cast<Impl::SetFloat>(resolve("NvAFX_SetFloat")); |
||||
const auto getU32 = reinterpret_cast<Impl::GetU32>(resolve("NvAFX_GetU32")); |
||||
const auto load = reinterpret_cast<Impl::Load>(resolve("NvAFX_Load")); |
||||
m_impl->run = reinterpret_cast<Impl::Run>(resolve("NvAFX_Run")); |
||||
|
||||
if (!createEffect || !m_impl->destroyEffect || !setString || !setU32 || !setFloat || !getU32 || !load || !m_impl->run) |
||||
{ |
||||
error = QStringLiteral("NVIDIA Audio Effects library is missing required functions"); |
||||
shutdown(); |
||||
return false; |
||||
} |
||||
|
||||
int status = createEffect("denoiser", &m_impl->effect); |
||||
|
||||
if (status == 0) { |
||||
status = setU32(m_impl->effect, "input_sample_rate", 48000); |
||||
} |
||||
if (status == 0) { |
||||
status = setFloat(m_impl->effect, "intensity_ratio", qBound(0.0f, intensityRatio, 1.0f)); |
||||
} |
||||
if (status == 0) { |
||||
status = setU32(m_impl->effect, "enable_vad", enableVad ? 1U : 0U); |
||||
} |
||||
|
||||
#ifdef Q_OS_LINUX |
||||
if (status == 0) { |
||||
status = setU32(m_impl->effect, "num_streams", 1); |
||||
} |
||||
if (status == 0) { |
||||
status = setU32(m_impl->effect, "num_samples_per_input_frame", 480); |
||||
} |
||||
#endif |
||||
|
||||
if (status == 0) { |
||||
status = setString(m_impl->effect, "model_path", m_impl->modelPath.constData()); |
||||
} |
||||
|
||||
if (status == 0) { |
||||
status = load(m_impl->effect); |
||||
} |
||||
|
||||
unsigned int frameSize = 0; |
||||
unsigned int outputFrameSize = 0; |
||||
unsigned int inputChannels = 0; |
||||
unsigned int outputChannels = 0; |
||||
unsigned int outputSampleRate = 0; |
||||
|
||||
#ifdef Q_OS_LINUX |
||||
const char *inputFrameSelector = "num_samples_per_input_frame"; |
||||
const char *outputFrameSelector = "num_samples_per_output_frame"; |
||||
#else |
||||
const char *inputFrameSelector = "num_input_samples_per_frame"; |
||||
const char *outputFrameSelector = "num_output_samples_per_frame"; |
||||
#endif |
||||
|
||||
if (status == 0) { |
||||
status = getU32(m_impl->effect, inputFrameSelector, &frameSize); |
||||
} |
||||
|
||||
if (status == 0) { |
||||
status = getU32(m_impl->effect, outputFrameSelector, &outputFrameSize); |
||||
} |
||||
|
||||
if (status == 0) { |
||||
status = getU32(m_impl->effect, "num_input_channels", &inputChannels); |
||||
} |
||||
|
||||
if (status == 0) { |
||||
status = getU32(m_impl->effect, "num_output_channels", &outputChannels); |
||||
} |
||||
|
||||
if (status == 0) { |
||||
status = getU32(m_impl->effect, "output_sample_rate", &outputSampleRate); |
||||
} |
||||
|
||||
if (status != 0 || frameSize != 480 || outputFrameSize != 480 || inputChannels != 1 || outputChannels != 1 || outputSampleRate != 48000) |
||||
{ |
||||
error = QStringLiteral("NVIDIA denoiser initialization failed (status %1, frames %2/%3, channels %4/%5, output rate %6)") |
||||
.arg(status).arg(frameSize).arg(outputFrameSize).arg(inputChannels).arg(outputChannels).arg(outputSampleRate); |
||||
shutdown(); |
||||
return false; |
||||
} |
||||
|
||||
return true; |
||||
#else |
||||
error = QStringLiteral("NVIDIA Audio Effects is available only on Windows and Linux"); |
||||
return false; |
||||
#endif |
||||
} |
||||
|
||||
void NvidiaAudioEffects::shutdown() |
||||
{ |
||||
if (!m_impl) { |
||||
return; |
||||
} |
||||
#if defined(Q_OS_WIN) || defined(Q_OS_LINUX) |
||||
if (m_impl->effect && m_impl->destroyEffect) { |
||||
m_impl->destroyEffect(m_impl->effect); |
||||
} |
||||
if (m_impl->library.isLoaded()) { |
||||
m_impl->library.unload(); |
||||
} |
||||
#endif |
||||
delete m_impl; |
||||
m_impl = nullptr; |
||||
} |
||||
|
||||
bool NvidiaAudioEffects::process(const float *input, float *output, QString& error) |
||||
{ |
||||
#if defined(Q_OS_WIN) || defined(Q_OS_LINUX) |
||||
if (!m_impl || !m_impl->effect) { |
||||
error = QStringLiteral("NVIDIA denoiser is not initialized"); |
||||
return false; |
||||
} |
||||
|
||||
if (QThread::currentThreadId() != m_impl->threadId) { |
||||
error = QStringLiteral("NVIDIA denoiser was called from a different thread than it was initialized on"); |
||||
return false; |
||||
} |
||||
|
||||
// Keep the caller's input intact for failure passthrough.
|
||||
std::memcpy(output, input, 480 * sizeof(float)); |
||||
#ifdef Q_OS_WIN |
||||
// The installed Windows runtime processes the buffer in place, as in OBS.
|
||||
const float *inputs[] = {output}; |
||||
#else |
||||
const float *inputs[] = {input}; |
||||
#endif |
||||
float *outputs[] = {output}; |
||||
const int status = m_impl->run(m_impl->effect, inputs, outputs, 480, 1); |
||||
|
||||
if (status != 0) |
||||
{ |
||||
error = QStringLiteral("NVIDIA denoiser processing failed (status %1)").arg(status); |
||||
shutdown(); |
||||
return false; |
||||
} |
||||
|
||||
return true; |
||||
#else |
||||
Q_UNUSED(input) |
||||
Q_UNUSED(output) |
||||
error = QStringLiteral("NVIDIA Audio Effects is available only on Windows and Linux"); |
||||
return false; |
||||
#endif |
||||
} |
||||
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// Some code by AI //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_FEATURE_DENOISER_NVIDIAAUDIOEFFECTS_H_ |
||||
#define INCLUDE_FEATURE_DENOISER_NVIDIAAUDIOEFFECTS_H_ |
||||
|
||||
#include <QString> |
||||
|
||||
// Loads the user-installed NVIDIA Audio Effects redistributable at runtime.
|
||||
// No NVIDIA headers or binaries are required.
|
||||
class NvidiaAudioEffects |
||||
{ |
||||
public: |
||||
NvidiaAudioEffects(); |
||||
~NvidiaAudioEffects(); |
||||
|
||||
bool initialize(QString& error, float intensityRatio, bool enableVad); |
||||
void shutdown(); |
||||
bool process(const float *input, float *output, QString& error); |
||||
|
||||
private: |
||||
struct Impl; |
||||
Impl *m_impl; |
||||
}; |
||||
|
||||
#endif |
||||
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
//----------------------------------------------------------------------------- |
||||
// LICENSE |
||||
// (c) 2025, Steinberg Media Technologies GmbH, All Rights Reserved |
||||
//----------------------------------------------------------------------------- |
||||
// Redistribution and use in source and binary forms, with or without modification, |
||||
// are permitted provided that the following conditions are met: |
||||
// |
||||
// * Redistributions of source code must retain the above copyright notice, |
||||
// this list of conditions and the following disclaimer. |
||||
// * Redistributions in binary form must reproduce the above copyright notice, |
||||
// this list of conditions and the following disclaimer in the documentation |
||||
// and/or other materials provided with the distribution. |
||||
// * Neither the name of the Steinberg Media Technologies nor the names of its |
||||
// contributors may be used to endorse or promote products derived from this |
||||
// software without specific prior written permission. |
||||
// |
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
||||
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
||||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
||||
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
||||
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
||||
// OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
//----------------------------------------------------------------------------- |
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,87 @@
@@ -0,0 +1,87 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// Some code by AI //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_FEATURE_DENOISER_VST3EFFECT_H_ |
||||
#define INCLUDE_FEATURE_DENOISER_VST3EFFECT_H_ |
||||
|
||||
#include <QByteArray> |
||||
#include <QString> |
||||
#include <QStringList> |
||||
#include <QVector> |
||||
#include <QtGlobal> |
||||
#include <functional> |
||||
#include <memory> |
||||
|
||||
class QWidget; |
||||
|
||||
struct Vst3PluginInfo |
||||
{ |
||||
QString modulePath; |
||||
QByteArray classId; // The factory's 16-byte platform-specific class ID.
|
||||
QString name; |
||||
}; |
||||
|
||||
struct Vst3ParameterInfo |
||||
{ |
||||
quint32 id; |
||||
QString name; |
||||
double defaultValue; |
||||
double currentValue; |
||||
int steps; |
||||
bool readOnly; |
||||
bool hidden; |
||||
}; |
||||
|
||||
// Owns one audio effect. Construct, configure and destroy on the feature thread;
|
||||
// only process() is called by the audio worker while the instance is active.
|
||||
class Vst3Effect |
||||
{ |
||||
public: |
||||
Vst3Effect(); |
||||
~Vst3Effect(); |
||||
|
||||
static QVector<Vst3PluginInfo> discover(const QStringList& extraPaths = {}); |
||||
static QStringList modulePaths(const QStringList& extraPaths = {}); |
||||
// state is a blob from state(); it is ignored if it belongs to a different class.
|
||||
bool open(const QString& modulePath, const QByteArray& classId, int sampleRate, |
||||
int sourceChannels, QString& error, const QByteArray& state = QByteArray()); |
||||
bool process(const float *left, const float *right, float *outLeft, float *outRight, |
||||
int count, QString& error); |
||||
void close(); |
||||
unsigned int latencySamples() const; |
||||
QVector<Vst3ParameterInfo> parameters() const; |
||||
double parameterValue(quint32 id) const; |
||||
// Not safe while another thread calls process(); flushes queued parameter changes.
|
||||
QByteArray state(QString& error); |
||||
bool setState(const QByteArray& state, QString& error); |
||||
bool setParameter(quint32 id, double value); |
||||
QString parameterText(quint32 id, double value) const; |
||||
void setParameterEditCallback(std::function<void(quint32, double)> callback); |
||||
#ifdef QT_WIDGETS_LIB |
||||
QWidget *createEditorWidget(QWidget *parent, QString& error); |
||||
#endif |
||||
|
||||
private: |
||||
#ifdef QT_WIDGETS_LIB |
||||
class EditorWidget; |
||||
#endif |
||||
struct Impl; |
||||
std::unique_ptr<Impl> m_impl; |
||||
}; |
||||
|
||||
#endif |
||||
@ -0,0 +1,83 @@
@@ -0,0 +1,83 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// Some code by AI //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QCoreApplication> |
||||
#include <QJsonArray> |
||||
#include <QJsonDocument> |
||||
#include <QJsonObject> |
||||
#include <QProcess> |
||||
#include <cstdio> |
||||
|
||||
#include "vst3effect.h" |
||||
|
||||
int main(int argc, char **argv) |
||||
{ |
||||
QCoreApplication app(argc, argv); |
||||
QStringList paths = app.arguments().mid(1); |
||||
|
||||
const bool probe = !paths.isEmpty() && paths.first() == QStringLiteral("--probe"); |
||||
if (probe) { |
||||
paths.removeFirst(); |
||||
} |
||||
|
||||
QJsonArray plugins; |
||||
|
||||
if (probe)
|
||||
{ |
||||
for (const Vst3PluginInfo& plugin : Vst3Effect::discover(paths))
|
||||
{ |
||||
QJsonObject object; |
||||
object.insert(QStringLiteral("path"), plugin.modulePath); |
||||
object.insert(QStringLiteral("id"), QString::fromLatin1(plugin.classId.toHex())); |
||||
object.insert(QStringLiteral("name"), plugin.name); |
||||
plugins.append(object); |
||||
|
||||
} |
||||
}
|
||||
else
|
||||
{ |
||||
for (const QString& path : Vst3Effect::modulePaths(paths))
|
||||
{ |
||||
QProcess child; |
||||
child.setProgram(app.applicationFilePath()); |
||||
child.setArguments({QStringLiteral("--probe"), path}); |
||||
child.start(); |
||||
if (!child.waitForStarted(5000)) { |
||||
continue; |
||||
} |
||||
if (!child.waitForFinished(60000))
|
||||
{ |
||||
child.kill(); |
||||
child.waitForFinished(5000); |
||||
continue; |
||||
} |
||||
if (child.exitStatus() != QProcess::NormalExit || child.exitCode() != 0)
|
||||
continue; |
||||
const QJsonDocument result = QJsonDocument::fromJson(child.readAllStandardOutput()); |
||||
if (!result.isArray()) { |
||||
continue; |
||||
} |
||||
for (const QJsonValue& value : result.array()) { |
||||
plugins.append(value); |
||||
} |
||||
} |
||||
} |
||||
const QByteArray json = QJsonDocument(plugins).toJson(QJsonDocument::Compact); |
||||
std::fwrite(json.constData(), 1, static_cast<size_t>(json.size()), stdout); |
||||
return 0; |
||||
} |
||||
Loading…
Reference in new issue