Clean up ToobAmp log messages and rdf:comment's.
This commit is contained in:
+10
-5
@@ -1257,7 +1257,7 @@ namespace pipedal
|
||||
{
|
||||
message =
|
||||
SS("Device " << alsa_device_name << " in use. The following applications are using your soundcard: " << apps
|
||||
<< ". Stop them as neccesary before trying to restart pipedald.");
|
||||
<< ". Stop them as neccesary before trying to pipedald.");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1671,11 +1671,16 @@ namespace pipedal
|
||||
pBuffer[j] = 0;
|
||||
}
|
||||
}
|
||||
while (!terminateAudio())
|
||||
try {
|
||||
while (!terminateAudio())
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
// zero out input buffers.
|
||||
this->driverHost->OnProcess(this->bufferSize);
|
||||
}
|
||||
} catch (const std::exception &e)
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
// zero out input buffers.
|
||||
this->driverHost->OnProcess(this->bufferSize);
|
||||
|
||||
}
|
||||
}
|
||||
this->driverHost->OnAudioTerminated();
|
||||
|
||||
+1
-1
@@ -1217,7 +1217,7 @@ private:
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
Lv2Log::error("Fatal error while processing jack audio. (%s)", e.what());
|
||||
Lv2Log::error("Fatal error while processing realtime audio. (%s)", e.what());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include "FilePropertyDirectoryTree.hpp"
|
||||
#include <filesystem>
|
||||
|
||||
using namespace pipedal;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace pipedal {
|
||||
virtual bool GetRequestStateChangedNotification() const = 0;
|
||||
virtual void SetRequestStateChangedNotification(bool value) = 0;
|
||||
|
||||
virtual void PrepareNoInputEffect(int numberOfInputs, size_t maxBufferSize) = 0;
|
||||
|
||||
virtual void SetAudioInputBuffer(int index, float *buffer) = 0;
|
||||
virtual void SetAudioOutputBuffer(int index, float*buffer) = 0;
|
||||
|
||||
+123
-28
@@ -47,7 +47,6 @@ namespace fs = std::filesystem;
|
||||
|
||||
const float BYPASS_TIME_S = 0.1f;
|
||||
|
||||
|
||||
static fs::path makeAbsolutePath(const std::filesystem::path &path, const std::filesystem::path &parentPath)
|
||||
{
|
||||
if (path.is_absolute())
|
||||
@@ -57,7 +56,6 @@ static fs::path makeAbsolutePath(const std::filesystem::path &path, const std::f
|
||||
return parentPath / path;
|
||||
}
|
||||
|
||||
|
||||
Lv2Effect::Lv2Effect(
|
||||
IHost *pHost_,
|
||||
const std::shared_ptr<Lv2PluginInfo> &info_,
|
||||
@@ -83,9 +81,9 @@ Lv2Effect::Lv2Effect(
|
||||
this->pathPropertyWriters.push_back(PatchPropertyWriter(instanceId, filePropertyUrid));
|
||||
}
|
||||
}
|
||||
for (auto &pathProperty: pedalboardItem.pathProperties_)
|
||||
for (auto &pathProperty : pedalboardItem.pathProperties_)
|
||||
{
|
||||
SetPathPatchProperty(pathProperty.first,pathProperty.second);
|
||||
SetPathPatchProperty(pathProperty.first, pathProperty.second);
|
||||
}
|
||||
|
||||
// initialize the atom forge used on the realtime thread.
|
||||
@@ -112,7 +110,6 @@ Lv2Effect::Lv2Effect(
|
||||
bundleUriString,
|
||||
storagePath);
|
||||
|
||||
|
||||
mapPathFeature.Prepare(&(pHost_->GetMapFeature()));
|
||||
mapPathFeature.SetPluginStoragePath(pHost_->GetPluginStoragePath());
|
||||
if (info->piPedalUI())
|
||||
@@ -122,10 +119,8 @@ Lv2Effect::Lv2Effect(
|
||||
{
|
||||
if (!fileProperty->resourceDirectory().empty())
|
||||
{
|
||||
mapPathFeature.AddResourceFileMapping({
|
||||
makeAbsolutePath(fileProperty->resourceDirectory(),bundleUriString),
|
||||
makeAbsolutePath(fileProperty->directory(),pHost_->GetPluginStoragePath())
|
||||
});
|
||||
mapPathFeature.AddResourceFileMapping({makeAbsolutePath(fileProperty->resourceDirectory(), bundleUriString),
|
||||
makeAbsolutePath(fileProperty->directory(), pHost_->GetPluginStoragePath())});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,7 +140,6 @@ Lv2Effect::Lv2Effect(
|
||||
this->features.push_back(mapPathFeature.GetMakePathFeature());
|
||||
this->features.push_back(mapPathFeature.GetFreePathFeature());
|
||||
|
||||
|
||||
this->features.push_back(this->fileBrowserFilesFeature.GetFeature());
|
||||
|
||||
this->work_schedule_feature = nullptr;
|
||||
@@ -370,15 +364,52 @@ void Lv2Effect::PreparePortIndices()
|
||||
outputAtomBuffers.resize(outputAtomPortIndices.size());
|
||||
}
|
||||
|
||||
void Lv2Effect::PrepareNoInputEffect(int numberOfInputs, size_t maxBufferSize)
|
||||
{
|
||||
if (outputAudioPortIndices.size() == 0)
|
||||
{
|
||||
// pass the input through unmodified.
|
||||
inputAudioBuffers.resize(std::max((size_t)numberOfInputs, inputAudioPortIndices.size()));
|
||||
outputAudioBuffers.resize(numberOfOutputs);
|
||||
}
|
||||
else if (inputAudioPortIndices.size() == 0)
|
||||
{
|
||||
inputAudioBuffers.resize(numberOfInputs);
|
||||
outputAudioBuffers.resize(std::max((size_t)numberOfInputs, outputAudioPortIndices.size()));
|
||||
|
||||
// allocate a working buffer which we will mix with passed-through data.
|
||||
outputMixBuffers.resize(outputAudioPortIndices.size());
|
||||
for (size_t i = 0; i < outputMixBuffers.size(); ++i)
|
||||
{
|
||||
outputMixBuffers[i].resize(maxBufferSize);
|
||||
}
|
||||
// connect the plugin to the mix buffer instead of output buffer.
|
||||
for (size_t i = 0; i < outputAudioPortIndices.size(); ++i)
|
||||
{
|
||||
int pluginIndex = this->outputAudioPortIndices[i];
|
||||
lilv_instance_connect_port(this->pInstance, pluginIndex, outputMixBuffers[i].data());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Lv2Effect::SetAudioInputBuffer(int index, float *buffer)
|
||||
{
|
||||
if (index >= inputAudioPortIndices.size())
|
||||
{
|
||||
throw PiPedalArgumentException("Buffer index out of range.");
|
||||
}
|
||||
this->inputAudioBuffers[index] = buffer;
|
||||
int pluginIndex = this->inputAudioPortIndices[index];
|
||||
lilv_instance_connect_port(this->pInstance, pluginIndex, buffer);
|
||||
|
||||
if (inputAudioPortIndices.size() == inputAudioBuffers.size())
|
||||
{
|
||||
int pluginIndex = this->inputAudioPortIndices[index];
|
||||
lilv_instance_connect_port(this->pInstance, pluginIndex, buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
// cases: 1->0, 1->1, 2->0, 2->1
|
||||
if (index < inputAudioPortIndices.size())
|
||||
{
|
||||
int pluginIndex = this->inputAudioPortIndices[index];
|
||||
lilv_instance_connect_port(this->pInstance, pluginIndex, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Lv2Effect::SetAudioInputBuffer(float *left)
|
||||
@@ -388,7 +419,7 @@ void Lv2Effect::SetAudioInputBuffer(float *left)
|
||||
SetAudioInputBuffer(0, left);
|
||||
SetAudioInputBuffer(1, left);
|
||||
}
|
||||
else
|
||||
else if (GetNumberOfInputAudioPorts() != 0) /// yyx MIXING!
|
||||
{
|
||||
SetAudioInputBuffer(0, left);
|
||||
}
|
||||
@@ -400,7 +431,7 @@ void Lv2Effect::SetAudioInputBuffers(float *left, float *right)
|
||||
{
|
||||
SetAudioInputBuffer(0, left);
|
||||
}
|
||||
else
|
||||
else if (GetNumberOfInputAudioPorts() > 1)
|
||||
{
|
||||
SetAudioInputBuffer(0, left);
|
||||
SetAudioInputBuffer(1, right);
|
||||
@@ -410,8 +441,15 @@ void Lv2Effect::SetAudioInputBuffers(float *left, float *right)
|
||||
void Lv2Effect::SetAudioOutputBuffer(int index, float *buffer)
|
||||
{
|
||||
this->outputAudioBuffers[index] = buffer;
|
||||
int pluginIndex = this->outputAudioPortIndices[index];
|
||||
lilv_instance_connect_port(pInstance, pluginIndex, buffer);
|
||||
|
||||
if (this->inputAudioPortIndices.size() != 0) // i.e. we're not mixing a zero-input control
|
||||
{
|
||||
if ((size_t)index < this->inputAudioPortIndices.size())
|
||||
{
|
||||
int pluginIndex = this->outputAudioPortIndices[index];
|
||||
lilv_instance_connect_port(pInstance, pluginIndex, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Lv2Effect::GetControlIndex(const std::string &key) const
|
||||
@@ -452,7 +490,7 @@ void Lv2Effect::Activate()
|
||||
|
||||
void Lv2Effect::AssignUnconnectedPorts()
|
||||
{
|
||||
for (int i = 0; i < this->GetNumberOfInputAudioPorts(); ++i)
|
||||
for (size_t i = 0; i < this->inputAudioPortIndices.size(); ++i)
|
||||
{
|
||||
if (GetAudioInputBuffer(i) == nullptr)
|
||||
{
|
||||
@@ -462,14 +500,16 @@ void Lv2Effect::AssignUnconnectedPorts()
|
||||
lilv_instance_connect_port(pInstance, pluginIndex, buffer);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < this->GetNumberOfOutputAudioPorts(); ++i)
|
||||
{
|
||||
if (GetAudioOutputBuffer(i) == nullptr)
|
||||
{
|
||||
int pluginIndex = this->outputAudioPortIndices[i];
|
||||
|
||||
float *buffer = bufferPool.AllocateBuffer<float>(pHost->GetMaxAudioBufferSize());
|
||||
lilv_instance_connect_port(pInstance, pluginIndex, buffer);
|
||||
if (this->inputAudioPortIndices.size() != 0) // i.e. not using a mix buffer.
|
||||
{
|
||||
for (size_t i = 0; i < this->outputAudioPortIndices.size(); ++i)
|
||||
{
|
||||
if (GetAudioOutputBuffer(i) == nullptr)
|
||||
{
|
||||
float *buffer = bufferPool.AllocateBuffer<float>(pHost->GetMaxAudioBufferSize());
|
||||
int pluginIndex = this->outputAudioPortIndices[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < this->GetNumberOfInputAtomPorts(); ++i)
|
||||
@@ -529,6 +569,61 @@ void Lv2Effect::Run(uint32_t samples, RealtimeRingBufferWriter *realtimeRingBuff
|
||||
// relay worker response
|
||||
worker->EmitResponses();
|
||||
}
|
||||
// for zero-input plugins, mix the plugin output with the input signal.
|
||||
if (this->inputAudioPortIndices.size() == 0)
|
||||
{
|
||||
|
||||
// mix a zero input controls into the output buffer using a triangular mix curve.
|
||||
float pluginLevel = std::max(1.0f, this->zeroInputMix * 2);
|
||||
float inputLevel = std::max(1.0f, (1 - this->zeroInputMix) * 2);
|
||||
|
||||
// case
|
||||
// 1 plugin output into 1 output.
|
||||
// 2 plugin outputs into 2 outputs.
|
||||
if (this->outputAudioBuffers.size() == this->outputMixBuffers.size())
|
||||
{
|
||||
for (size_t i = 0; i < this->outputMixBuffers.size(); ++i)
|
||||
{
|
||||
float *__restrict input;
|
||||
if (i >= this->inputAudioBuffers.size()) {
|
||||
if (this->inputAudioBuffers.size() == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
input = this->inputAudioBuffers[0];
|
||||
} else {
|
||||
input = this->inputAudioBuffers[i];
|
||||
}
|
||||
float *__restrict pluginOutput = this->outputMixBuffers[i].data();
|
||||
float *__restrict finalOutput = this->outputAudioBuffers[i];
|
||||
|
||||
for (uint32_t i = 0; i < samples; ++i)
|
||||
{
|
||||
finalOutput[i] = input[i] * inputLevel + pluginOutput[i] * pluginLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this->outputAudioPortIndices.size() == 1 && this->outputAudioBuffers.size() == 2)
|
||||
{
|
||||
// 1 plugin output into 2 outputs.
|
||||
float *__restrict pluginOutput = this->outputMixBuffers[0].data();
|
||||
for (size_t i = 0; i < this->outputMixBuffers.size(); ++i)
|
||||
{
|
||||
float *__restrict input = this->inputAudioBuffers[i];
|
||||
float *__restrict finalOutput = this->outputAudioBuffers[i];
|
||||
|
||||
for (uint32_t i = 0; i < samples; ++i)
|
||||
{
|
||||
finalOutput[i] = input[i] * inputLevel + pluginOutput[i] * pluginLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// e.g. 2 plugin outputs into 1 output (should never happen)
|
||||
std::runtime_error("Internal error 0xEA48");
|
||||
}
|
||||
}
|
||||
|
||||
// do soft bypass.
|
||||
if (this->bypassSamplesRemaining == 0)
|
||||
|
||||
+9
-1
@@ -193,9 +193,12 @@ namespace pipedal
|
||||
|
||||
bool requestStateChangedNotification = false;
|
||||
|
||||
float zeroInputMix = 0.5f;
|
||||
int actualAudioInputs = 0;
|
||||
int actualAudioOutputs = 0;
|
||||
std::vector<std::vector<float>> outputMixBuffers;
|
||||
void BypassTo(float value);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// non RT-thread use only.
|
||||
@@ -242,6 +245,9 @@ namespace pipedal
|
||||
bool HasErrorMessage() const { return this->hasErrorMessage; }
|
||||
const char*TakeErrorMessage() { this->hasErrorMessage = false; return this->errorMessage; }
|
||||
|
||||
virtual void PrepareNoInputEffect(int numberOfInputs,size_t maxBufferSize) override;
|
||||
|
||||
|
||||
virtual void ResetAtomBuffers();
|
||||
virtual uint64_t GetInstanceId() const { return instanceId; }
|
||||
virtual int GetNumberOfInputAudioPorts() const { return inputAudioPortIndices.size(); }
|
||||
@@ -251,6 +257,8 @@ namespace pipedal
|
||||
virtual int GetNumberOfMidiInputPorts() const { return inputMidiPortIndices.size(); }
|
||||
virtual int GetNumberOfMidiOutputPorts() const { return outputMidiPortIndices.size(); }
|
||||
|
||||
|
||||
|
||||
virtual void SetAudioInputBuffer(int index, float *buffer);
|
||||
virtual float *GetAudioInputBuffer(int index) const { return this->inputAudioBuffers[index]; }
|
||||
|
||||
|
||||
@@ -121,6 +121,7 @@ std::vector<float *> Lv2Pedalboard::PrepareItems(
|
||||
|
||||
if (pLv2Effect)
|
||||
{
|
||||
|
||||
if (pLv2Effect->HasErrorMessage())
|
||||
{
|
||||
std::string error = pLv2Effect->TakeErrorMessage();
|
||||
@@ -131,6 +132,7 @@ std::vector<float *> Lv2Pedalboard::PrepareItems(
|
||||
pEffect = pLv2Effect;
|
||||
|
||||
uint64_t instanceId = pEffect->GetInstanceId();
|
||||
pLv2Effect->PrepareNoInputEffect(inputBuffers.size(),pHost->GetMaxAudioBufferSize());
|
||||
|
||||
if (inputBuffers.size() == 1)
|
||||
{
|
||||
@@ -207,7 +209,7 @@ std::vector<float *> Lv2Pedalboard::PrepareItems(
|
||||
effectOutput.push_back(CreateNewAudioBuffer());
|
||||
}
|
||||
#endif
|
||||
for (size_t i = 0; i < effectOutput.size(); ++i)
|
||||
for (size_t i = 0; i < effectOutput.size(); ++i)
|
||||
{
|
||||
pEffect->SetAudioOutputBuffer(i, effectOutput[i]);
|
||||
}
|
||||
|
||||
+15
-6
@@ -2782,6 +2782,7 @@ void PiPedalModel::OnAlsaDriverTerminatedAbnormally() {
|
||||
Lv2Log::info("Restarting audio.");
|
||||
this->RestartAudio();
|
||||
});
|
||||
++audioRestartRetries;
|
||||
} else if (audioRestartRetries < 3)
|
||||
{
|
||||
this->audioRetryPostHandle = this->PostDelayed(
|
||||
@@ -2794,13 +2795,21 @@ void PiPedalModel::OnAlsaDriverTerminatedAbnormally() {
|
||||
|
||||
RestartAudio();
|
||||
});
|
||||
++audioRestartRetries;
|
||||
} else if (audioRestartRetries == 3) // one attempt to start the dummy driver.
|
||||
{
|
||||
{
|
||||
this->audioRetryPostHandle = this->Post(
|
||||
// No lock to avoid deadlocks!
|
||||
[this]() {
|
||||
Lv2Log::info(SS("Switching to dummy driver."));
|
||||
RestartAudio(true); // switch to the dummy driver.
|
||||
});
|
||||
}
|
||||
++audioRestartRetries;
|
||||
} else {
|
||||
this->audioRetryPostHandle = this->Post(
|
||||
// No lock to avoid deadlocks!
|
||||
[this]() {
|
||||
Lv2Log::info(SS("Switching to dummy driver."));
|
||||
RestartAudio(true); // switch to the dummy driver.
|
||||
});
|
||||
Lv2Log::error(SS("Unable to reastart audio."));
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+19
-1
@@ -482,7 +482,19 @@ void PluginHost::Load(const char *lv2Path)
|
||||
Lv2PluginUiInfo info(this, plugin.get());
|
||||
if (plugin->is_valid())
|
||||
{
|
||||
#if SUPPORT_MIDI
|
||||
#if 1
|
||||
if (info.audio_inputs() > 2 || info.audio_outputs() > 2) {
|
||||
Lv2Log::debug(
|
||||
"Plugin %s (%s) skipped. %d inputs, %d outputs.", plugin->name().c_str(), plugin->uri().c_str(),
|
||||
(int)info.audio_inputs(),(int)info.audio_outputs());
|
||||
|
||||
}
|
||||
else if (info.audio_inputs() == 0 && info.audio_outputs() == 0 )
|
||||
{
|
||||
Lv2Log::debug("Plugin %s (%s) skipped. No audio i/o.", plugin->name().c_str(), plugin->uri().c_str());
|
||||
|
||||
}
|
||||
#elif SUPPORT_MIDI
|
||||
if (info.audio_inputs() == 0 && !info.has_midi_input())
|
||||
{
|
||||
Lv2Log::debug("Plugin %s (%s) skipped. No inputs.", plugin->name().c_str(), plugin->uri().c_str());
|
||||
@@ -503,6 +515,12 @@ void PluginHost::Load(const char *lv2Path)
|
||||
#endif
|
||||
else
|
||||
{
|
||||
if (info.audio_inputs() == 0) {
|
||||
Lv2Log::debug("************* ZERO INPUTS: %s (%s) skipped. No audio outputs.", plugin->name().c_str(), plugin->uri().c_str());
|
||||
}
|
||||
if (info.audio_outputs() == 0) {
|
||||
Lv2Log::debug("************* ZERO OUTPUTS: %s (%s) skipped. No audio outputs.", plugin->name().c_str(), plugin->uri().c_str());
|
||||
}
|
||||
ui_plugins_.push_back(std::move(info));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
|
||||
namespace pipedal {
|
||||
class PiPedalModel;
|
||||
|
||||
@@ -370,6 +370,9 @@ namespace pipedal
|
||||
virtual void RequestAllPathPatchProperties() {}
|
||||
|
||||
|
||||
virtual void PrepareNoInputEffect(int numberOfInputs,size_t maxBufferSize) override {
|
||||
// do nothing.
|
||||
}
|
||||
virtual int GetNumberOfOutputAudioPorts() const
|
||||
{
|
||||
return numberOfOutputPorts;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "json.hpp"
|
||||
#include <chrono>
|
||||
#include "UpdaterStatus.hpp"
|
||||
#include <filesystem>
|
||||
|
||||
|
||||
namespace pipedal
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
template <typename T> class TypeDisplay;
|
||||
|
||||
#ifndef SUPPORT_MIDI // currently, only whether midi plugins can be loaded. No routing or handling implemented (yet).
|
||||
#define SUPPORT_MIDI 0
|
||||
#define SUPPORT_MIDI 1
|
||||
#endif
|
||||
|
||||
|
||||
@@ -32,33 +32,9 @@ template <typename T> class TypeDisplay;
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <mutex>
|
||||
#include <stdexcept>
|
||||
#include <cstdlib>
|
||||
#include <map>
|
||||
|
||||
#include <fstream>
|
||||
#include <chrono>
|
||||
#include <filesystem>
|
||||
#include <memory>
|
||||
#ifdef JUNK
|
||||
|
||||
#endif
|
||||
/*
|
||||
#include <lv2/lv2core/lv2.h>
|
||||
|
||||
#include "lv2/atom/atom.h"
|
||||
#include "lv2/atom/util.h"
|
||||
#include "lv2/log/log.h"
|
||||
#include "lv2/log/logger.h"
|
||||
#include "lv2/midi/midi.h"
|
||||
#include "lv2/urid/urid.h"
|
||||
#include "lv2/log/logger.h"
|
||||
#include "lv2/uri-map/uri-map.h"
|
||||
#include "lv2/atom/forge.h"
|
||||
#include "lv2/worker/worker.h"
|
||||
#include "lv2/patch/patch.h"
|
||||
#include "lv2/parameters/parameters.h"
|
||||
#include "lv2/units/units.h"
|
||||
*/
|
||||
#include "ss.hpp"
|
||||
|
||||
Reference in New Issue
Block a user