Browse Source

Cleanup

tags/1.9.4
falkTX 11 years ago
parent
commit
48373ce227
7 changed files with 120 additions and 81 deletions
  1. +2
    -2
      source/bridges/CarlaBridgeUI-LV2.cpp
  2. +5
    -5
      source/bridges/CarlaBridgeUI-VST.cpp
  3. +82
    -59
      source/discovery/carla-discovery.cpp
  4. +6
    -0
      source/includes/CarlaDefines.hpp
  5. +4
    -3
      source/libs/distrho/dgl/Makefile
  6. +9
    -0
      source/libs/lilv/Makefile
  7. +12
    -12
      source/utils/CarlaLv2Utils.hpp

+ 2
- 2
source/bridges/CarlaBridgeUI-LV2.cpp View File

@@ -761,7 +761,7 @@ public:
qDebug("%s", buf);
break;
case CARLA_URI_MAP_ID_LOG_WARNING:
qWarning("%s", buf);
carla_stderr("%s", buf);
break;
default:
break;
@@ -1068,7 +1068,7 @@ int main(int argc, char* argv[])

if (argc != 5)
{
qWarning("usage: %s <osc-url|\"null\"> <plugin-uri> <ui-uri> <ui-title>", argv[0]);
carla_stderr("usage: %s <osc-url|\"null\"> <plugin-uri> <ui-uri> <ui-title>", argv[0]);
return 1;
}



+ 5
- 5
source/bridges/CarlaBridgeUI-VST.cpp View File

@@ -76,7 +76,7 @@ public:

if (! uiLibOpen(binary))
{
qWarning("%s", uiLibError());
carla_stderr("%s", uiLibError());
return false;
}

@@ -129,7 +129,7 @@ public:
{
//effect->dispatcher(effect, effClose, 0, 0, nullptr, 0.0f);
//return false;
qWarning("VST UI failed to open, trying to init anyway...");
carla_stderr("VST UI failed to open, trying to init anyway...");
}

// -----------------------------------------------------------------
@@ -339,7 +339,7 @@ public:
return -1;

// unimplemented
qWarning("CarlaVstClient::hostCanDo(\"%s\") - unknown feature", feature);
carla_stderr("CarlaVstClient::hostCanDo(\"%s\") - unknown feature", feature);
return 0;
}

@@ -376,7 +376,7 @@ public:

if (self->effect != effect)
{
qWarning("CarlaVstClient::hostCallback() - host pointer mismatch: %p != %p", self->effect, effect);
carla_stderr("CarlaVstClient::hostCallback() - host pointer mismatch: %p != %p", self->effect, effect);
self = nullptr;
}
}
@@ -540,7 +540,7 @@ int main(int argc, char* argv[])

if (argc != 4)
{
qWarning("usage: %s <osc-url|\"null\"> <binary> <ui-title>", argv[0]);
carla_stderr("usage: %s <osc-url|\"null\"> <binary> <ui-title>", argv[0]);
return 1;
}



+ 82
- 59
source/discovery/carla-discovery.cpp View File

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

#include "CarlaBackend.hpp"
#include "CarlaBackendUtils.hpp"
#include "CarlaJuceUtils.hpp"
#include "CarlaLibUtils.hpp"
#include "CarlaString.hpp"
@@ -29,7 +29,6 @@
# include "dssi/dssi.h"
#endif
#ifdef WANT_LV2
# include <QtCore/QDir>
# include <QtCore/QUrl>
# include "CarlaLv2Utils.hpp"
#endif
@@ -78,20 +77,18 @@ void print_lib_error(const char* const filename)

#ifdef WANT_VST
// Check if plugin wants midi
bool vstWantsMidi = false;
bool gVstWantsMidi = false;

// Check if plugin is processing
bool vstIsProcessing = false;
bool gVstIsProcessing = false;

// Current uniqueId for vst shell plugins
intptr_t vstCurrentUniqueId = 0;
intptr_t gVstCurrentUniqueId = 0;

// Supported Carla features
intptr_t vstHostCanDo(const char* const feature)
{
#if DEBUG
qDebug("vstHostCanDo(\"%s\")", feature);
#endif
carla_debug("vstHostCanDo(\"%s\")", feature);

if (std::strcmp(feature, "supplyIdle") == 0)
return 1;
@@ -129,27 +126,21 @@ intptr_t vstHostCanDo(const char* const feature)
return 1;

// unimplemented
qWarning("vstHostCanDo(\"%s\") - unknown feature", feature);
carla_stderr("vstHostCanDo(\"%s\") - unknown feature", feature);
return 0;
}

// Host-side callback
intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt)
{
#if DEBUG
qDebug("vstHostCallback(%p, %s, %i, " P_INTPTR ", %p, %f)", effect, vstMasterOpcode2str(opcode), index, value, ptr, opt);
#endif
carla_debug("vstHostCallback(%p, %s, %i, " P_INTPTR ", %p, %f)", effect, vstMasterOpcode2str(opcode), index, value, ptr, opt);

intptr_t ret = 0;

switch (opcode)
{
case audioMasterAutomate:
if (effect)
{
effect->setParameter(effect, index, opt);
ret = 1;
}
ret = 1;
break;

case audioMasterVersion:
@@ -157,19 +148,19 @@ intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t opcode
break;

case audioMasterCurrentId:
ret = vstCurrentUniqueId;
ret = gVstCurrentUniqueId;
break;

#if ! VST_FORCE_DEPRECATED
case audioMasterWantMidi:
vstWantsMidi = true;
gVstWantsMidi = true;
ret = 1;
break;
#endif

case audioMasterGetTime:
static VstTimeInfo_R timeInfo;
memset(&timeInfo, 0, sizeof(VstTimeInfo_R)); //FIXME
carla_zeroStruct<VstTimeInfo_R>(timeInfo);
timeInfo.sampleRate = sampleRate;

// Tempo
@@ -181,7 +172,7 @@ intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t opcode
timeInfo.timeSigDenominator = 4;
timeInfo.flags |= kVstTimeSigValid;

ret = (intptr_t)&timeInfo;
ret = getAddressFromPointer(&timeInfo);
break;

#if ! VST_FORCE_DEPRECATED
@@ -213,7 +204,7 @@ intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t opcode
#endif

case audioMasterGetCurrentProcessLevel:
ret = vstIsProcessing ? kVstProcessLevelRealtime : kVstProcessLevelUser;
ret = gVstIsProcessing ? kVstProcessLevelRealtime : kVstProcessLevelUser;
break;

case audioMasterGetAutomationState:
@@ -250,11 +241,16 @@ intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t opcode
break;

default:
qDebug("vstHostCallback(%p, %s, %i, " P_INTPTR ", %p, %f)", effect, vstMasterOpcode2str(opcode), index, value, ptr, opt);
carla_debug("vstHostCallback(%p, %s, %i, " P_INTPTR ", %p, %f)", effect, vstMasterOpcode2str(opcode), index, value, ptr, opt);
break;
}

return ret;

// unused
(void)index;
(void)value;
(void)opt;
}
#endif

@@ -539,8 +535,11 @@ void do_ladspa_check(void* const libHandle, const bool init)
}
#else
DISCOVERY_OUT("error", "LADSPA support not available");
Q_UNUSED(libHandle);
Q_UNUSED(init);
return;

// unused
(void)libHandle;
(void)init;
#endif
}

@@ -787,8 +786,11 @@ void do_dssi_check(void* const libHandle, const bool init)
}
#else
DISCOVERY_OUT("error", "DSSI support not available");
Q_UNUSED(libHandle);
Q_UNUSED(init);
return;

// unused
(void)libHandle;
(void)init;
#endif
}

@@ -797,8 +799,8 @@ void do_lv2_check(const char* const bundle, const bool init)
#ifdef WANT_LV2
// Convert bundle filename to URI
QString qBundle(QUrl::fromLocalFile(bundle).toString());
if (! qBundle.endsWith(QDir::separator()))
qBundle += QDir::separator();
if (! qBundle.endsWith(QChar(OS_SEP)))
qBundle += QChar(OS_SEP);

// Load bundle
Lilv::Node lilvBundle(lv2World.new_uri(qBundle.toUtf8().constData()));
@@ -1008,8 +1010,11 @@ void do_lv2_check(const char* const bundle, const bool init)
}
#else
DISCOVERY_OUT("error", "LV2 support not available");
Q_UNUSED(bundle);
Q_UNUSED(init);
return;

// unused
(void)bundle;
(void)init;
#endif
}

@@ -1048,40 +1053,40 @@ void do_vst_check(void* const libHandle, const bool init)

if (vstCategory == kPlugCategShell && effect->uniqueID == 0)
{
if ((vstCurrentUniqueId = effect->dispatcher(effect, effShellGetNextPlugin, 0, 0, strBuf, 0.0f)) != 0)
if ((gVstCurrentUniqueId = effect->dispatcher(effect, effShellGetNextPlugin, 0, 0, strBuf, 0.0f)) != 0)
cName = strBuf;
}
else
{
vstCurrentUniqueId = effect->uniqueID;
gVstCurrentUniqueId = effect->uniqueID;

if (effect->dispatcher(effect, effGetEffectName, 0, 0, strBuf, 0.0f) == 1)
cName = strBuf;
}

memset(strBuf, 0, sizeof(char)*STR_MAX); //FIXME
carla_zeroMem(strBuf, sizeof(char)*STR_MAX);
if (effect->dispatcher(effect, effGetVendorString, 0, 0, strBuf, 0.0f) == 1)
cVendor = strBuf;

// FIXME: Waves crash during processing
if (cVendor == "Waves")
memset((void*)&init, 0, sizeof(bool)); //FIXME
std::memset((void*)&init, 0, sizeof(bool)); //FIXME

if (vstCurrentUniqueId == 0)
if (gVstCurrentUniqueId == 0)
{
DISCOVERY_OUT("error", "Plugin doesn't have an Unique ID");
return;
}

while (vstCurrentUniqueId != 0)
while (gVstCurrentUniqueId != 0)
{
memset(strBuf, 0, sizeof(char)*STR_MAX); //FIXME
carla_zeroMem(strBuf, sizeof(char)*STR_MAX);
if (effect->dispatcher(effect, effGetProductString, 0, 0, strBuf, 0.0f) == 1)
cProduct = strBuf;
else
cProduct.clear();

vstWantsMidi = false;
gVstWantsMidi = false;

int hints = 0;
int audioIns = effect->numInputs;
@@ -1120,11 +1125,14 @@ void do_vst_check(void* const libHandle, const bool init)
effect->dispatcher(effect, effSetSampleRate, 0, 0, nullptr, sampleRate);
effect->dispatcher(effect, effSetProcessPrecision, 0, kVstProcessPrecision32, nullptr, 0.0f);

effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f);

effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f);
effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f);

// Plugin might call wantMidi() during resume
if (midiIns == 0 && vstWantsMidi)
if (midiIns == 0 && gVstWantsMidi)
{
midiIns = 1;
midiTotal = midiIns + midiOuts;
@@ -1148,12 +1156,15 @@ void do_vst_check(void* const libHandle, const bool init)
int32_t numEvents;
intptr_t reserved;
VstEvent* data[2];
};
VstEventsFixed events;
VstMidiEvent midiEvents[2];

memset(&events, 0, sizeof(VstEventsFixed)); //FIXME
memset(midiEvents, 0, sizeof(VstMidiEvent)*2); //FIXME
VstEventsFixed()
: numEvents(0),
reserved(0),
data{0} {}
} events;

VstMidiEvent midiEvents[2];
carla_zeroMem(midiEvents, sizeof(VstMidiEvent)*2);

midiEvents[0].type = kVstMidiType;
midiEvents[0].byteSize = sizeof(VstMidiEvent);
@@ -1173,7 +1184,7 @@ void do_vst_check(void* const libHandle, const bool init)

// processing
{
vstIsProcessing = true;
gVstIsProcessing = true;

if (midiIns > 0)
effect->dispatcher(effect, effProcessEvents, 0, 0, &events, 0.0f);
@@ -1198,7 +1209,7 @@ void do_vst_check(void* const libHandle, const bool init)
DISCOVERY_OUT("error", "Plugin doesn't have can't do process replacing");
#endif

vstIsProcessing = false;
gVstIsProcessing = false;
}

effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f);
@@ -1218,7 +1229,7 @@ void do_vst_check(void* const libHandle, const bool init)
DISCOVERY_OUT("label", (const char*)cProduct);
DISCOVERY_OUT("maker", (const char*)cVendor);
DISCOVERY_OUT("copyright", (const char*)cVendor);
DISCOVERY_OUT("unique_id", vstCurrentUniqueId);
DISCOVERY_OUT("unique_id", gVstCurrentUniqueId);
DISCOVERY_OUT("hints", hints);
DISCOVERY_OUT("audio.ins", audioIns);
DISCOVERY_OUT("audio.outs", audioOuts);
@@ -1236,13 +1247,15 @@ void do_vst_check(void* const libHandle, const bool init)
break;

// request next Unique ID
intptr_t nextUniqueId = vstCurrentUniqueId;
intptr_t nextUniqueId = gVstCurrentUniqueId;

// FIXME: Waves sometimes return the same ID
while (nextUniqueId == vstCurrentUniqueId)
while (nextUniqueId == gVstCurrentUniqueId)
{
memset(strBuf, 0, sizeof(char)*STR_MAX); //FIXME
if ((vstCurrentUniqueId = effect->dispatcher(effect, effShellGetNextPlugin, 0, 0, strBuf, 0.0f)) != 0)
carla_zeroMem(strBuf, sizeof(char)*STR_MAX);
gVstCurrentUniqueId = effect->dispatcher(effect, effShellGetNextPlugin, 0, 0, strBuf, 0.0f);

if (gVstCurrentUniqueId != 0)
cName = strBuf;
}
}
@@ -1250,8 +1263,11 @@ void do_vst_check(void* const libHandle, const bool init)
effect->dispatcher(effect, effClose, 0, 0, nullptr, 0.0f);
#else
DISCOVERY_OUT("error", "VST support not available");
Q_UNUSED(libHandle);
Q_UNUSED(init);
return;

// unused
(void)libHandle;
(void)init;
#endif
}

@@ -1323,6 +1339,7 @@ void do_fluidsynth_check(const char* const filename, const bool init)
// 16 channels
if (name.isNotEmpty())
name += " (16 outputs)";

DISCOVERY_OUT("init", "-----------");
DISCOVERY_OUT("name", "");
DISCOVERY_OUT("name", (const char*)name);
@@ -1341,8 +1358,11 @@ void do_fluidsynth_check(const char* const filename, const bool init)
DISCOVERY_OUT("end", "------------");
#else
DISCOVERY_OUT("error", "SF2 support not available");
Q_UNUSED(filename);
Q_UNUSED(init);
return;

// unused
(void)filename;
(void)init;
#endif
}

@@ -1375,8 +1395,11 @@ void do_linuxsampler_check(const char* const filename, const char* const stype,
LinuxSamplerScopedEngine::outputInfo(nullptr, 0, file.baseName().toUtf8().constData());
#else
DISCOVERY_OUT("error", stype << " support not available");
Q_UNUSED(filename);
Q_UNUSED(init);
return;

// unused
(void)filename;
(void)init;
#endif
}

@@ -1437,7 +1460,7 @@ int main(int argc, char* argv[])

if (argc != 3)
{
qWarning("usage: %s <type> </path/to/plugin>", argv[0]);
carla_stdout("usage: %s <type> </path/to/plugin>", argv[0]);
return 1;
}



+ 6
- 0
source/includes/CarlaDefines.hpp View File

@@ -39,6 +39,12 @@
# define CARLA_OS_UNIX
#endif

#ifdef CARLA_OS_WIN
# define OS_SEP '\\'
#else
# define OS_SEP '/'
#endif

// Check for C++11 support
#if defined(HAVE_CPP11_SUPPORT)
# define CARLA_PROPER_CPP11_SUPPORT


+ 4
- 3
source/libs/distrho/dgl/Makefile View File

@@ -8,6 +8,7 @@ include ../../../Makefile.mk

# --------------------------------------------------------------

BUILD_C_FLAGS += -fvisibility=hidden -fPIC
BUILD_CXX_FLAGS += -fvisibility=hidden -fPIC -I.

OBJS = \
@@ -21,6 +22,8 @@ OBJS = \
src/Widget.cpp.o \
src/Window.cpp.o

OBJSM = src/pugl/pugl_osx.m.o

OBJS_posix32 = \
src/App.cpp.posix32.o \
src/Image.cpp.posix32.o \
@@ -65,8 +68,6 @@ OBJS_win64 = \
src/Widget.cpp.win64.o \
src/Window.cpp.win64.o

OBJSM = src/pugl/pugl_osx.m.o

# --------------------------------------------------------------

all: ../../dgl.a
@@ -96,7 +97,7 @@ win64: ../../dgl.win64.a
../../dgl.dll: $(OBJS)
$(CXX) $^ -shared $(LINK_FLAGS) -lopengl32 -lgdi32 -o $@

../../dgl.dylib: $(OBJS) $(OBJSM)
../../dgl.dylib: $(OBJS)
$(CXX) $^ -shared $(LINK_FLAGS) -framework Cocoa -framework OpenGL -o $@

../../dgl.so: $(OBJS)


+ 9
- 0
source/libs/lilv/Makefile View File

@@ -48,6 +48,15 @@ win64: ../lilv.win64.a
../lilv.win64.a: $(OBJS_win64)
$(AR) rs $@ $^

../lilv.dll: $(OBJS)
$(CXX) $^ -shared $(LINK_FLAGS) -o $@

../lilv.dylib: $(OBJS)
$(CXX) $^ -shared $(LINK_FLAGS) -o $@

../lilv.so: $(OBJS)
$(CXX) $^ -shared $(LINK_FLAGS) -o $@

# --------------------------------------------------------------

serd.c.o: serd.c


+ 12
- 12
source/utils/CarlaLv2Utils.hpp View File

@@ -356,7 +356,7 @@ public:

if (! uriNode)
{
qWarning("Lv2WorldClass::getPlugin(\"%s\") - Failed to get node from uri", uri);
carla_stderr("Lv2WorldClass::getPlugin(\"%s\") - Failed to get node from uri", uri);
return nullptr;
}

@@ -367,7 +367,7 @@ public:
}
else
{
qWarning("Lv2WorldClass::getPlugin(\"%s\") - Failed to get plugin", uri);
carla_stderr("Lv2WorldClass::getPlugin(\"%s\") - Failed to get plugin", uri);
lilv_node_free(uriNode);
return nullptr;
}
@@ -394,7 +394,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri)

if (! uri)
{
qWarning("lv2_rdf_new() - Invalid uri");
carla_stderr("lv2_rdf_new() - Invalid uri");
return nullptr;
}

@@ -581,7 +581,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri)
rdfPort->Types |= LV2_PORT_OUTPUT;

else
qWarning("lv2_rdf_new(\"%s\") - port '%s' is not input or output", uri, rdfPort->Name);
carla_stderr("lv2_rdf_new(\"%s\") - port '%s' is not input or output", uri, rdfPort->Name);

// Data Type
if (lilvPort.is_a(lv2World.port_control))
@@ -602,7 +602,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri)
if (bufferTypeNodes.contains(lv2World.atom_sequence))
rdfPort->Types |= LV2_PORT_ATOM_SEQUENCE;
else
qWarning("lv2_rdf_new(\"%s\") - port '%s' uses an unknown atom buffer type", uri, rdfPort->Name);
carla_stderr("lv2_rdf_new(\"%s\") - port '%s' uses an unknown atom buffer type", uri, rdfPort->Name);

Lilv::Nodes supportNodes(lilvPort.get_value(lv2World.atom_supports));

@@ -612,7 +612,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri)
rdfPort->Types |= LV2_PORT_DATA_PATCH_MESSAGE;

if (! (supportNodes.contains(lv2World.midi_event) || supportNodes.contains(lv2World.patch_message)))
qWarning("lv2_rdf_new(\"%s\") - port '%s' is of atom type but doesn't support MIDI or messages", uri, rdfPort->Name);
carla_stderr("lv2_rdf_new(\"%s\") - port '%s' is of atom type but doesn't support MIDI or messages", uri, rdfPort->Name);
}

else if (lilvPort.is_a(lv2World.port_event))
@@ -622,7 +622,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri)
if (lilvPort.supports_event(lv2World.midi_event))
rdfPort->Types |= LV2_PORT_DATA_MIDI_EVENT;
else
qWarning("lv2_rdf_new(\"%s\") - port '%s' is of event type but doesn't support MIDI", uri, rdfPort->Name);
carla_stderr("lv2_rdf_new(\"%s\") - port '%s' is of event type but doesn't support MIDI", uri, rdfPort->Name);
}

else if (lilvPort.is_a(lv2World.port_midi))
@@ -632,7 +632,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri)
}

else
qWarning("lv2_rdf_new(\"%s\") - port '%s' is of unkown data type", uri, rdfPort->Name);
carla_stderr("lv2_rdf_new(\"%s\") - port '%s' is of unkown data type", uri, rdfPort->Name);
}

// --------------------------------------
@@ -712,7 +712,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri)
else if (std::strncmp(designation, LV2_PORT_GROUPS_PREFIX, std::strlen(LV2_PORT_GROUPS_PREFIX)) == 0)
pass();
else
qWarning("lv2_rdf_new(\"%s\") - got unknown port designation '%s'", uri, designation);
carla_stderr("lv2_rdf_new(\"%s\") - got unknown port designation '%s'", uri, designation);
}
}
}
@@ -740,7 +740,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri)
else if (std::strcmp(midiMapType, LV2_MIDI_Map__NRPN) == 0)
rdfPort->MidiMap.Type = LV2_PORT_MIDI_MAP_NRPN;
else
qWarning("lv2_rdf_new(\"%s\") - got unknown port Midi-Map type '%s'", uri, midiMapType);
carla_stderr("lv2_rdf_new(\"%s\") - got unknown port Midi-Map type '%s'", uri, midiMapType);

rdfPort->MidiMap.Number = midiMapNumberNodes.get_first().as_int();
}
@@ -839,7 +839,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri)
else if (std::strcmp(unitUnit, LV2_UNITS__semitone12TET) == 0)
rdfPort->Unit.Unit = LV2_PORT_UNIT_SEMITONE;
else
qWarning("lv2_rdf_new(\"%s\") - got unknown unit type '%s'", uri, unitUnit);
carla_stderr("lv2_rdf_new(\"%s\") - got unknown unit type '%s'", uri, unitUnit);
}
}

@@ -1057,7 +1057,7 @@ const LV2_RDF_Descriptor* lv2_rdf_new(const LV2_URI uri)
else if (lilvUI.is_a(lv2World.ui_externalOld))
rdfUI->Type.Value = LV2_UI_OLD_EXTERNAL;
else
qWarning("lv2_rdf_new(\"%s\") - got unknown UI type '%s'", uri, uiType);
carla_stderr("lv2_rdf_new(\"%s\") - got unknown UI type '%s'", uri, uiType);
}

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


Loading…
Cancel
Save