Underflow on clipped outputs; Fix for Shiroverb.

This commit is contained in:
Robin E. R. Davies
2025-03-13 19:48:01 -04:00
parent 28f4aeafe2
commit 5f71d0b0e1
3 changed files with 11 additions and 9 deletions
+7 -7
View File
@@ -720,7 +720,7 @@ namespace pipedal
std::vector<float *> &buffers = this->captureBuffers;
int channels = this->captureChannels;
constexpr float scale = 1.0f / (std::numeric_limits<int16_t>::max() + 1L);
constexpr double scale = 1.0f / (std::numeric_limits<int16_t>::max() + 1L);
for (size_t frame = 0; frame < frames; ++frame)
{
for (int channel = 0; channel < channels; ++channel)
@@ -891,7 +891,7 @@ namespace pipedal
std::vector<float *> &buffers = this->playbackBuffers;
int channels = this->playbackChannels;
constexpr float scale = std::numeric_limits<int32_t>::max();
constexpr double scale = std::numeric_limits<int32_t>::max();
for (size_t frame = 0; frame < frames; ++frame)
{
for (int channel = 0; channel < channels; ++channel)
@@ -913,7 +913,7 @@ namespace pipedal
std::vector<float *> &buffers = this->playbackBuffers;
int channels = this->playbackChannels;
constexpr float scale = 0x00FFFFFF;
constexpr double scale = 0x00FFFFFF;
for (size_t frame = 0; frame < frames; ++frame)
{
for (int channel = 0; channel < channels; ++channel)
@@ -935,7 +935,7 @@ namespace pipedal
std::vector<float *> &buffers = this->playbackBuffers;
int channels = this->playbackChannels;
constexpr float scale = 0x00FFFFFF;
constexpr double scale = 0x00FFFFFF;
for (size_t frame = 0; frame < frames; ++frame)
{
for (int channel = 0; channel < channels; ++channel)
@@ -955,7 +955,7 @@ namespace pipedal
std::vector<float *> &buffers = this->playbackBuffers;
int channels = this->playbackChannels;
constexpr float scale = std::numeric_limits<int32_t>::max();
constexpr double scale = std::numeric_limits<int32_t>::max();
for (size_t frame = 0; frame < frames; ++frame)
{
for (int channel = 0; channel < channels; ++channel)
@@ -975,7 +975,7 @@ namespace pipedal
std::vector<float *> &buffers = this->playbackBuffers;
int channels = this->playbackChannels;
constexpr float scale = std::numeric_limits<int32_t>::max();
constexpr double scale = std::numeric_limits<int32_t>::max();
for (size_t frame = 0; frame < frames; ++frame)
{
for (int channel = 0; channel < channels; ++channel)
@@ -1000,7 +1000,7 @@ namespace pipedal
std::vector<float *> &buffers = this->playbackBuffers;
int channels = this->playbackChannels;
constexpr float scale = std::numeric_limits<int32_t>::max();
constexpr double scale = std::numeric_limits<int32_t>::max();
for (size_t frame = 0; frame < frames; ++frame)
{
for (int channel = 0; channel < channels; ++channel)
+2 -1
View File
@@ -464,7 +464,7 @@ void Lv2Effect::SetAudioOutputBuffer(int index, float *buffer)
if (this->inputAudioPortIndices.size() != 0) // i.e. we're not mixing a zero-input control
{
if ((size_t)index < this->inputAudioPortIndices.size())
if ((size_t)index < this->outputAudioPortIndices.size())
{
int pluginIndex = this->outputAudioPortIndices[index];
lilv_instance_connect_port(pInstance, pluginIndex, buffer);
@@ -562,6 +562,7 @@ void Lv2Effect::AssignUnconnectedPorts()
{
float *buffer = bufferPool.AllocateBuffer<float>(pHost->GetMaxAudioBufferSize());
int pluginIndex = this->outputAudioPortIndices[i];
lilv_instance_connect_port(pInstance, pluginIndex, buffer);
}
}
}
+2 -1
View File
@@ -112,7 +112,8 @@ std::vector<float *> Lv2Pedalboard::PrepareItems(
{
std::shared_ptr<IEffect> pLv2Effect;
if (existingEffects && existingEffects->contains(item.instanceId()))
if (existingEffects && existingEffects->contains(item.instanceId())
)
{
pLv2Effect = existingEffects->at(item.instanceId());
((Lv2Effect*)pLv2Effect.get())->SetBorrowedEffect(true);