Browse Source

Cleanup

tags/1.9.4
falkTX 11 years ago
parent
commit
83f71f89eb
10 changed files with 23 additions and 163 deletions
  1. +4
    -3
      source/Makefile.mk
  2. +2
    -1
      source/backend/engine/CarlaEngineJack.cpp
  3. +2
    -33
      source/backend/plugin/NativePlugin.cpp
  4. +4
    -4
      source/discovery/carla-discovery.cpp
  5. +7
    -15
      source/modules/CarlaNative.h
  6. +0
    -56
      source/modules/CarlaNative.hpp
  7. +0
    -2
      source/modules/native-plugins/lfo.c
  8. +0
    -3
      source/plugin/carla-native-lv2-export.cpp
  9. +4
    -41
      source/plugin/carla-native-lv2.cpp
  10. +0
    -5
      source/utils/CarlaLv2Utils.hpp

+ 4
- 3
source/Makefile.mk View File

@@ -106,10 +106,11 @@ endif

ifeq ($(TESTBUILD),true)
BASE_FLAGS += -Werror -Wcast-qual -Wconversion -Wformat -Wformat-security -Wredundant-decls -Wshadow -Wstrict-overflow -fstrict-overflow -Wundef -Wwrite-strings
BASE_FLAGS += -Wfloat-equal -Wpointer-arith -Wstrict-overflow=5 -Waggregate-return -Wabi -Winit-self -Wuninitialized -Wold-style-definition
BASE_FLAGS += -Wfloat-equal -Wpointer-arith -Wabi -Winit-self -Wuninitialized #-Wstrict-overflow=5
ifeq ($(CC),clang)
BASE_FLAGS += -Wdocumentation -Wdocumentation-unknown-command
# BASE_FLAGS += -Weverything
ifneq ($(CC),clang)
else
BASE_FLAGS += -Wcast-align -Wunsafe-loop-optimizations
endif
ifneq ($(MACOS),true)
@@ -118,7 +119,7 @@ ifneq ($(CC),clang)
BASE_FLAGS += -Wlogical-op
endif
endif
CFLAGS += -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
CFLAGS += -Wold-style-definition -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
CXXFLAGS += -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual
ifeq ($(LINUX),true)
CFLAGS += -isystem /opt/kxstudio/include


+ 2
- 1
source/backend/engine/CarlaEngineJack.cpp View File

@@ -638,6 +638,7 @@ public:
fUsedPorts(),
fUsedConnections(),
fNewGroups(),
fRetConns(),
#endif
leakDetector_CarlaEngineJack()
{
@@ -710,7 +711,7 @@ public:
carla_zeroStruct<jack_position_t>(fTransportPos);

#ifdef BUILD_BRIDGE
if (pData->bufferSize == 0 || pData->sampleRate == 0.0)
if (pData->bufferSize == 0 || carla_compareFloats(pData->sampleRate, 0.0))
{
// open temp client to get initial buffer-size and sample-rate values
if (jack_client_t* const tmpClient = jackbridge_client_open(clientName, JackNullOption, nullptr))


+ 2
- 33
source/backend/plugin/NativePlugin.cpp View File

@@ -988,9 +988,9 @@ public:
else if (max < min)
min = max;

if (max - min == 0.0f)
if (carla_compareFloats(min, max))
{
carla_stderr2("WARNING - Broken plugin parameter '%s': max - min == 0.0f", paramInfo->name);
carla_stderr2("WARNING - Broken plugin parameter '%s': max == min", paramInfo->name);
max = min + 0.1f;
}

@@ -2137,37 +2137,6 @@ protected:
{
case ::HOST_OPCODE_NULL:
break;
#ifdef BUILD_BRIDGE
case ::HOST_OPCODE_SET_VOLUME:
case ::HOST_OPCODE_SET_DRYWET:
case ::HOST_OPCODE_SET_BALANCE_LEFT:
case ::HOST_OPCODE_SET_BALANCE_RIGHT:
case ::HOST_OPCODE_SET_PANNING:
break;
#else
case ::HOST_OPCODE_SET_VOLUME:
setVolume(opt, true, true);
break;
case ::HOST_OPCODE_SET_DRYWET:
setDryWet(opt, true, true);
break;
case ::HOST_OPCODE_SET_BALANCE_LEFT:
setBalanceLeft(opt, true, true);
break;
case ::HOST_OPCODE_SET_BALANCE_RIGHT:
setBalanceRight(opt, true, true);
break;
case ::HOST_OPCODE_SET_PANNING:
setPanning(opt, true, true);
break;
#endif
case ::HOST_OPCODE_GET_PARAMETER_MIDI_CC:
case ::HOST_OPCODE_SET_PARAMETER_MIDI_CC:
// TODO
break;
case ::HOST_OPCODE_SET_PROCESS_PRECISION:
// TODO
break;
case ::HOST_OPCODE_UPDATE_PARAMETER:
// TODO
pData->engine->callback(ENGINE_CALLBACK_UPDATE, pData->id, -1, 0, 0.0f, nullptr);


+ 4
- 4
source/discovery/carla-discovery.cpp View File

@@ -572,9 +572,9 @@ static void do_ladspa_check(void*& libHandle, const char* const filename, const
DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: min > max");
max = min + 0.1f;
}
else if (max - min == 0.0f)
else if (carla_compareFloats(min, max))
{
DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: max - min == 0");
DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: max == min");
max = min + 0.1f;
}

@@ -838,9 +838,9 @@ static void do_dssi_check(void*& libHandle, const char* const filename, const bo
DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: min > max");
max = min + 0.1f;
}
else if (max - min == 0.0f)
else if (carla_compareFloats(min, max))
{
DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: max - min == 0");
DISCOVERY_OUT("warning", "Parameter '" << portName << "' is broken: max == min");
max = min + 0.1f;
}



+ 7
- 15
source/modules/CarlaNative.h View File

@@ -97,21 +97,13 @@ typedef enum {
} NativePluginDispatcherOpcode;

typedef enum {
HOST_OPCODE_NULL = 0, // nothing
HOST_OPCODE_SET_VOLUME = 1, // uses opt
HOST_OPCODE_SET_DRYWET = 2, // uses opt
HOST_OPCODE_SET_BALANCE_LEFT = 3, // uses opt
HOST_OPCODE_SET_BALANCE_RIGHT = 4, // uses opt
HOST_OPCODE_SET_PANNING = 5, // uses opt
HOST_OPCODE_GET_PARAMETER_MIDI_CC = 6, // uses index; return answer
HOST_OPCODE_SET_PARAMETER_MIDI_CC = 7, // uses index and value
HOST_OPCODE_SET_PROCESS_PRECISION = 8, // uses value
HOST_OPCODE_UPDATE_PARAMETER = 9, // uses index, -1 for all
HOST_OPCODE_UPDATE_MIDI_PROGRAM = 10, // uses index, -1 for all; may use value for channel
HOST_OPCODE_RELOAD_PARAMETERS = 11, // nothing
HOST_OPCODE_RELOAD_MIDI_PROGRAMS = 12, // nothing
HOST_OPCODE_RELOAD_ALL = 13, // nothing
HOST_OPCODE_UI_UNAVAILABLE = 14 // nothing
HOST_OPCODE_NULL = 0, // nothing
HOST_OPCODE_UPDATE_PARAMETER = 1, // uses index, -1 for all
HOST_OPCODE_UPDATE_MIDI_PROGRAM = 2, // uses index, -1 for all; may use value for channel
HOST_OPCODE_RELOAD_PARAMETERS = 3, // nothing
HOST_OPCODE_RELOAD_MIDI_PROGRAMS = 4, // nothing
HOST_OPCODE_RELOAD_ALL = 5, // nothing
HOST_OPCODE_UI_UNAVAILABLE = 6 // nothing
} NativeHostDispatcherOpcode;

// -----------------------------------------------------------------------


+ 0
- 56
source/modules/CarlaNative.hpp View File

@@ -153,62 +153,6 @@ protected:
// -------------------------------------------------------------------
// Host dispatcher calls

void hostSetVolume(const float value) const
{
CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,);

pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_VOLUME, 0, 0, nullptr, value);
}

void hostSetDryWet(const float value) const
{
CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,);

pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_DRYWET, 0, 0, nullptr, value);
}

void hostSetBalanceLeft(const float value) const
{
CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,);

pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_BALANCE_LEFT, 0, 0, nullptr, value);
}

void hostSetBalanceRight(const float value) const
{
CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,);

pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_BALANCE_RIGHT, 0, 0, nullptr, value);
}

void hostSetPanning(const float value) const
{
CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,);

pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_PANNING, 0, 0, nullptr, value);
}

intptr_t hostGetParameterMidiCC(const int32_t index) const
{
CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, -1);

return pHost->dispatcher(pHost->handle, HOST_OPCODE_GET_PARAMETER_MIDI_CC, index, 0, nullptr, 0.0f);
}

void hostSetParameterMidiCC(const int32_t index, const intptr_t value) const
{
CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,);

pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_PARAMETER_MIDI_CC, index, value, nullptr, 0.0f);
}

void hostSetProcessPrecision(const intptr_t value) const
{
CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,);

pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_PROCESS_PRECISION, 0, value, nullptr, 0.0f);
}

void hostUpdateParameter(const int32_t index) const
{
CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,);


+ 0
- 2
source/modules/native-plugins/lfo.c View File

@@ -52,8 +52,6 @@ static NativePluginHandle lfo_instantiate(const NativeHostDescriptor* host)
if (handle == NULL)
return NULL;

host->dispatcher(host->handle, HOST_OPCODE_SET_PROCESS_PRECISION, 0, 32, NULL, 0.0f);

handle->host = host;
handle->mode = 1;
handle->speed = 1.0f;


+ 0
- 3
source/plugin/carla-native-lv2-export.cpp View File

@@ -15,9 +15,6 @@
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/

// include this first to ignore documentation warnings
#include "CarlaLv2Utils.hpp"

#define CARLA_NATIVE_PLUGIN_LV2
#include "carla-native-base.cpp"



+ 4
- 41
source/plugin/carla-native-lv2.cpp View File

@@ -15,12 +15,10 @@
* For a full copy of the GNU General Public License see the doc/GPL.txt file.
*/

// include this first to ignore documentation warnings
#include "CarlaLv2Utils.hpp"

#define CARLA_NATIVE_PLUGIN_LV2
#include "carla-native-base.cpp"

#include "CarlaLv2Utils.hpp"
#include "CarlaMathUtils.hpp"
#include "CarlaString.hpp"

@@ -78,8 +76,6 @@ public:
fMidiEventCount(0),
fTimeInfo(),
fIsProcessing(false),
fVolume(1.0f),
fDryWet(1.0f),
fBufferSize(0),
fSampleRate(sampleRate),
fUridMap(nullptr),
@@ -253,8 +249,6 @@ public:
return;
}

const int iframes(static_cast<int>(frames));

// Check for updated parameters
float curValue;

@@ -366,7 +360,7 @@ public:
}

if (speed != nullptr && speed->type == fURIs.atomFloat)
fTimeInfo.playing = ((LV2_Atom_Float*)speed)->body == 1.0f;
fTimeInfo.playing = carla_compareFloats(((LV2_Atom_Float*)speed)->body, 1.0f);

continue;
}
@@ -407,21 +401,6 @@ public:
fDescriptor->process(fHandle, fPorts.audioIns, fPorts.audioOuts, frames, fMidiEvents, fMidiEventCount);
fIsProcessing = false;

if (fDryWet != 1.0f && fDescriptor->audioIns == fDescriptor->audioOuts)
{
for (uint32_t i=0; i < fDescriptor->audioOuts; ++i)
{
FloatVectorOperations::multiply(fPorts.audioIns[i], fVolume*(1.0f-fDryWet), iframes);
FloatVectorOperations::multiply(fPorts.audioOuts[i], fVolume*fDryWet, iframes);
FloatVectorOperations::add(fPorts.audioOuts[i], fPorts.audioIns[i], iframes);
}
}
else if (fVolume != 1.0f)
{
for (uint32_t i=0; i < fDescriptor->audioOuts; ++i)
FloatVectorOperations::multiply(fPorts.audioOuts[i], fVolume, iframes);
}

// TODO - midi out

updateParameterOutputs();
@@ -784,21 +763,6 @@ protected:
switch (opcode)
{
case HOST_OPCODE_NULL:
break;
case HOST_OPCODE_SET_VOLUME:
fVolume = opt;
break;
case HOST_OPCODE_SET_DRYWET:
fDryWet = opt;
break;
case HOST_OPCODE_SET_BALANCE_LEFT:
case HOST_OPCODE_SET_BALANCE_RIGHT:
case HOST_OPCODE_SET_PANNING:
// nothing
break;
case HOST_OPCODE_GET_PARAMETER_MIDI_CC:
case HOST_OPCODE_SET_PARAMETER_MIDI_CC:
case HOST_OPCODE_SET_PROCESS_PRECISION:
case HOST_OPCODE_UPDATE_PARAMETER:
case HOST_OPCODE_UPDATE_MIDI_PROGRAM:
case HOST_OPCODE_RELOAD_PARAMETERS:
@@ -817,6 +781,7 @@ protected:
(void)index;
(void)value;
(void)ptr;
(void)opt;
}

void updateParameterOutputs()
@@ -846,9 +811,7 @@ private:
NativeMidiEvent fMidiEvents[kMaxMidiEvents*2];
NativeTimeInfo fTimeInfo;

bool fIsProcessing;
float fVolume;
float fDryWet;
bool fIsProcessing;

// Lv2 host data
uint32_t fBufferSize;


+ 0
- 5
source/utils/CarlaLv2Utils.hpp View File

@@ -29,9 +29,6 @@
#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdocumentation"
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdocumentation"
#endif

#include "lv2/lv2.h"
@@ -76,8 +73,6 @@
// enable -Wdocumentation again
#if defined(__clang__)
# pragma clang diagnostic pop
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
# pragma GCC diagnostic pop
#endif

#include "lv2_rdf.hpp"


Loading…
Cancel
Save