@@ -22,17 +22,6 @@ | |||||
#include "CarlaMathUtils.hpp" | #include "CarlaMathUtils.hpp" | ||||
#include "CarlaMIDI.h" | #include "CarlaMIDI.h" | ||||
#include "AppConfig.h" | |||||
#include "juce_audio_basics/juce_audio_basics.h" | |||||
using juce::AudioBuffer; | |||||
using juce::FloatVectorOperations; | |||||
using juce::MemoryBlock; | |||||
using juce::String; | |||||
using juce::StringArray; | |||||
using juce::jmin; | |||||
using juce::jmax; | |||||
CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -799,7 +788,6 @@ void RackGraph::process(CarlaEngine::ProtectedData* const data, const float* inB | |||||
uint32_t oldAudioOutCount = 0; | uint32_t oldAudioOutCount = 0; | ||||
uint32_t oldMidiOutCount = 0; | uint32_t oldMidiOutCount = 0; | ||||
bool processed = false; | bool processed = false; | ||||
juce::Range<float> range; | |||||
// process plugins | // process plugins | ||||
for (uint i=0; i < data->curPluginCount; ++i) | for (uint i=0; i < data->curPluginCount; ++i) | ||||
@@ -866,11 +854,8 @@ void RackGraph::process(CarlaEngine::ProtectedData* const data, const float* inB | |||||
if (oldAudioInCount > 0) | if (oldAudioInCount > 0) | ||||
{ | { | ||||
range = FloatVectorOperations::findMinAndMax(inBuf0, frames); | |||||
pluginData.insPeak[0] = carla_maxLimited<float>(std::abs(range.getStart()), std::abs(range.getEnd()), 1.0f); | |||||
range = FloatVectorOperations::findMinAndMax(inBuf1, frames); | |||||
pluginData.insPeak[1] = carla_maxLimited<float>(std::abs(range.getStart()), std::abs(range.getEnd()), 1.0f); | |||||
pluginData.insPeak[0] = carla_findMaxNormalizedFloat(inBuf0, frames); | |||||
pluginData.insPeak[1] = carla_findMaxNormalizedFloat(inBuf1, frames); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -880,11 +865,8 @@ void RackGraph::process(CarlaEngine::ProtectedData* const data, const float* inB | |||||
if (oldAudioOutCount > 0) | if (oldAudioOutCount > 0) | ||||
{ | { | ||||
range = FloatVectorOperations::findMinAndMax(outBuf[0], frames); | |||||
pluginData.outsPeak[0] = carla_maxLimited<float>(std::abs(range.getStart()), std::abs(range.getEnd()), 1.0f); | |||||
range = FloatVectorOperations::findMinAndMax(outBuf[1], frames); | |||||
pluginData.outsPeak[1] = carla_maxLimited<float>(std::abs(range.getStart()), std::abs(range.getEnd()), 1.0f); | |||||
pluginData.outsPeak[0] = carla_findMaxNormalizedFloat(outBuf[0], frames); | |||||
pluginData.outsPeak[1] = carla_findMaxNormalizedFloat(outBuf[1], frames); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -35,13 +35,10 @@ | |||||
#include "CarlaNative.hpp" | #include "CarlaNative.hpp" | ||||
#include "AppConfig.h" | #include "AppConfig.h" | ||||
#include "juce_audio_basics/juce_audio_basics.h" | |||||
#include "juce_core/juce_core.h" | |||||
using juce::File; | using juce::File; | ||||
using juce::FloatVectorOperations; | |||||
using juce::MemoryOutputStream; | using juce::MemoryOutputStream; | ||||
using juce::ScopedPointer; | |||||
using juce::SharedResourcePointer; | |||||
using juce::String; | using juce::String; | ||||
using juce::XmlDocument; | using juce::XmlDocument; | ||||
using juce::XmlElement; | using juce::XmlElement; | ||||
@@ -1348,10 +1345,10 @@ protected: | |||||
if (pData->curPluginCount == 0) | if (pData->curPluginCount == 0) | ||||
{ | { | ||||
if (outBuffer[0] != inBuffer[0]) | if (outBuffer[0] != inBuffer[0]) | ||||
FloatVectorOperations::copy(outBuffer[0], inBuffer[0], static_cast<int>(frames)); | |||||
carla_copyFloats(outBuffer[0], inBuffer[0], frames); | |||||
if (outBuffer[1] != inBuffer[1]) | if (outBuffer[1] != inBuffer[1]) | ||||
FloatVectorOperations::copy(outBuffer[1], inBuffer[1], static_cast<int>(frames)); | |||||
carla_copyFloats(outBuffer[1], inBuffer[1], frames); | |||||
for (uint32_t i=0; i < midiEventCount; ++i) | for (uint32_t i=0; i < midiEventCount; ++i) | ||||
{ | { | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla VST Plugin | * Carla VST Plugin | ||||
* Copyright (C) 2011-2016 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2011-2017 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
@@ -23,8 +23,6 @@ | |||||
#include "CarlaMathUtils.hpp" | #include "CarlaMathUtils.hpp" | ||||
#include "CarlaPluginUI.hpp" | #include "CarlaPluginUI.hpp" | ||||
#include "juce_core/juce_core.h" | |||||
#include <pthread.h> | #include <pthread.h> | ||||
#undef VST_FORCE_DEPRECATED | #undef VST_FORCE_DEPRECATED | ||||
@@ -33,8 +31,6 @@ | |||||
#undef kEffectMagic | #undef kEffectMagic | ||||
#define kEffectMagic (CCONST( 'V', 's', 't', 'P' )) | #define kEffectMagic (CCONST( 'V', 's', 't', 'P' )) | ||||
using juce::File; | |||||
CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
// ----------------------------------------------------- | // ----------------------------------------------------- | ||||
@@ -1891,7 +1887,9 @@ protected: | |||||
ret = kVstProcessLevelRealtime; | ret = kVstProcessLevelRealtime; | ||||
} | } | ||||
else | else | ||||
{ | |||||
ret = kVstProcessLevelUser; | ret = kVstProcessLevelUser; | ||||
} | |||||
break; | break; | ||||
case audioMasterGetAutomationState: | case audioMasterGetAutomationState: | ||||
@@ -27,9 +27,8 @@ | |||||
#include "CarlaLv2Utils.hpp" | #include "CarlaLv2Utils.hpp" | ||||
#include "CarlaUtils.h" | #include "CarlaUtils.h" | ||||
#include "juce_audio_basics/juce_audio_basics.h" | |||||
using juce::FloatVectorOperations; | |||||
#include "AppConfig.h" | |||||
#include "juce_core/juce_core.h" | |||||
// --------------------------------------------------------------------------------------------------------------------- | // --------------------------------------------------------------------------------------------------------------------- | ||||
@@ -21,6 +21,7 @@ | |||||
#include "CarlaMIDI.h" | #include "CarlaMIDI.h" | ||||
#include "LinkedList.hpp" | #include "LinkedList.hpp" | ||||
#include "AppConfig.h" | |||||
#include "juce_core/juce_core.h" | #include "juce_core/juce_core.h" | ||||
#include <string> | #include <string> | ||||
@@ -21,8 +21,6 @@ | |||||
#include "CarlaMIDI.h" | #include "CarlaMIDI.h" | ||||
#include "LinkedList.hpp" | #include "LinkedList.hpp" | ||||
#include "AppConfig.h" | |||||
#ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
# undef HAVE_FLUIDSYNTH | # undef HAVE_FLUIDSYNTH | ||||
# undef HAVE_LINUXSAMPLER | # undef HAVE_LINUXSAMPLER | ||||
@@ -47,6 +45,7 @@ | |||||
#include <iostream> | #include <iostream> | ||||
#include "AppConfig.h" | |||||
#include "juce_core/juce_core.h" | #include "juce_core/juce_core.h" | ||||
#define DISCOVERY_OUT(x, y) std::cout << "\ncarla-discovery::" << x << "::" << y << std::endl; | #define DISCOVERY_OUT(x, y) std::cout << "\ncarla-discovery::" << x << "::" << y << std::endl; | ||||
@@ -259,90 +259,6 @@ static const NativePluginDescriptor sNativePluginDescriptors[] = { | |||||
/* copyright */ "GNU GPL v2+", | /* copyright */ "GNU GPL v2+", | ||||
DESCFUNCS | DESCFUNCS | ||||
}, | }, | ||||
{ | |||||
/* category */ NATIVE_PLUGIN_CATEGORY_OTHER, | |||||
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_SYNTH | |||||
|NATIVE_PLUGIN_HAS_UI | |||||
//|NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS | |||||
|NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD | |||||
|NATIVE_PLUGIN_USES_STATE | |||||
|NATIVE_PLUGIN_USES_TIME), | |||||
/* supports */ static_cast<NativePluginSupports>(NATIVE_PLUGIN_SUPPORTS_EVERYTHING), | |||||
/* audioIns */ 2, | |||||
/* audioOuts */ 2, | |||||
/* midiIns */ 1, | |||||
/* midiOuts */ 1, | |||||
/* paramIns */ 0, | |||||
/* paramOuts */ 0, | |||||
/* name */ "Carla-Patchbay", | |||||
/* label */ "carlapatchbay", | |||||
/* maker */ "falkTX", | |||||
/* copyright */ "GNU GPL v2+", | |||||
DESCFUNCS | |||||
}, | |||||
{ | |||||
/* category */ NATIVE_PLUGIN_CATEGORY_OTHER, | |||||
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_SYNTH | |||||
|NATIVE_PLUGIN_HAS_UI | |||||
//|NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS | |||||
|NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD | |||||
|NATIVE_PLUGIN_USES_STATE | |||||
|NATIVE_PLUGIN_USES_TIME), | |||||
/* supports */ static_cast<NativePluginSupports>(NATIVE_PLUGIN_SUPPORTS_EVERYTHING), | |||||
/* audioIns */ 3, | |||||
/* audioOuts */ 2, | |||||
/* midiIns */ 1, | |||||
/* midiOuts */ 1, | |||||
/* paramIns */ 0, | |||||
/* paramOuts */ 0, | |||||
/* name */ "Carla-Patchbay (sidechain)", | |||||
/* label */ "carlapatchbay3s", | |||||
/* maker */ "falkTX", | |||||
/* copyright */ "GNU GPL v2+", | |||||
DESCFUNCS | |||||
}, | |||||
{ | |||||
/* category */ NATIVE_PLUGIN_CATEGORY_OTHER, | |||||
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_SYNTH | |||||
|NATIVE_PLUGIN_HAS_UI | |||||
//|NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS | |||||
|NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD | |||||
|NATIVE_PLUGIN_USES_STATE | |||||
|NATIVE_PLUGIN_USES_TIME), | |||||
/* supports */ static_cast<NativePluginSupports>(NATIVE_PLUGIN_SUPPORTS_EVERYTHING), | |||||
/* audioIns */ 16, | |||||
/* audioOuts */ 16, | |||||
/* midiIns */ 1, | |||||
/* midiOuts */ 1, | |||||
/* paramIns */ 0, | |||||
/* paramOuts */ 0, | |||||
/* name */ "Carla-Patchbay (16chan)", | |||||
/* label */ "carlapatchbay16", | |||||
/* maker */ "falkTX", | |||||
/* copyright */ "GNU GPL v2+", | |||||
DESCFUNCS | |||||
}, | |||||
{ | |||||
/* category */ NATIVE_PLUGIN_CATEGORY_OTHER, | |||||
/* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_SYNTH | |||||
|NATIVE_PLUGIN_HAS_UI | |||||
//|NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS | |||||
|NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD | |||||
|NATIVE_PLUGIN_USES_STATE | |||||
|NATIVE_PLUGIN_USES_TIME), | |||||
/* supports */ static_cast<NativePluginSupports>(NATIVE_PLUGIN_SUPPORTS_EVERYTHING), | |||||
/* audioIns */ 32, | |||||
/* audioOuts */ 32, | |||||
/* midiIns */ 1, | |||||
/* midiOuts */ 1, | |||||
/* paramIns */ 0, | |||||
/* paramOuts */ 0, | |||||
/* name */ "Carla-Patchbay (32chan)", | |||||
/* label */ "carlapatchbay32", | |||||
/* maker */ "falkTX", | |||||
/* copyright */ "GNU GPL v2+", | |||||
DESCFUNCS | |||||
}, | |||||
#endif | #endif | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla DSSI utils | * Carla DSSI utils | ||||
* Copyright (C) 2013-2016 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2013-2017 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
@@ -17,6 +17,7 @@ | |||||
#include "CarlaDssiUtils.hpp" | #include "CarlaDssiUtils.hpp" | ||||
#include "AppConfig.h" | |||||
#include "juce_core/juce_core.h" | #include "juce_core/juce_core.h" | ||||
// -------------------------------------------------------------------------------------------------------------------- | // -------------------------------------------------------------------------------------------------------------------- | ||||
@@ -200,6 +200,36 @@ void carla_zeroFloats(float floats[], const std::size_t count) noexcept | |||||
std::memset(floats, 0, count*sizeof(float)); | std::memset(floats, 0, count*sizeof(float)); | ||||
} | } | ||||
/* | |||||
* Find the highest absolute and normalized value within a float array. | |||||
*/ | |||||
static inline | |||||
float carla_findMaxNormalizedFloat(float floats[], const std::size_t count) | |||||
{ | |||||
CARLA_SAFE_ASSERT_RETURN(floats != nullptr, 0.0f); | |||||
CARLA_SAFE_ASSERT_RETURN(count > 0, 0.0f); | |||||
static const float kEmptyFloats[8192] = { 0.0f }; | |||||
if (count <= 8192 && std::memcmp(floats, kEmptyFloats, count) == 0) | |||||
return 0.0f; | |||||
float tmp, maxf2 = std::abs(floats[0]); | |||||
for (std::size_t i=1; i<count; ++i) | |||||
{ | |||||
tmp = std::abs(floats[i]); | |||||
if (maxf2 > tmp) | |||||
maxf2 = tmp; | |||||
} | |||||
if (maxf2 > 1.0f) | |||||
maxf2 = 1.0f; | |||||
return maxf2; | |||||
} | |||||
// -------------------------------------------------------------------------------------------------------------------- | // -------------------------------------------------------------------------------------------------------------------- | ||||
// Missing functions in old OSX versions. | // Missing functions in old OSX versions. | ||||