Browse Source

Fixes for gcc4.4 compatibility, misc changes

tags/1.9.4
falkTX 13 years ago
parent
commit
b977a0907a
6 changed files with 119 additions and 100 deletions
  1. +4
    -0
      source/backend/CarlaEngine.hpp
  2. +2
    -0
      source/backend/engine/rtaudio-4.0.11/RtAudio.h
  3. +2
    -0
      source/backend/engine/rtmidi-2.0.1/RtMidi.h
  4. +103
    -98
      source/discovery/carla-discovery.cpp
  5. +7
    -2
      source/includes/CarlaDefines.hpp
  6. +1
    -0
      source/utils/CarlaStateUtils.hpp

+ 4
- 0
source/backend/CarlaEngine.hpp View File

@@ -149,10 +149,12 @@ struct EngineControlEvent {
uint16_t param; //!< Parameter ID, midi bank or midi program.
double value; //!< Parameter value, normalized to 0.0<->1.0.

#ifndef CARLA_PROPER_CPP11_SUPPORT
EngineControlEvent()
{
clear();
}
#endif

void clear()
{
@@ -170,10 +172,12 @@ struct EngineMidiEvent {
uint8_t data[3]; //!< MIDI data, without channel bit
uint8_t size; //!< Number of bytes used

#ifndef CARLA_PROPER_CPP11_SUPPORT
EngineMidiEvent()
{
clear();
}
#endif

void clear()
{


+ 2
- 0
source/backend/engine/rtaudio-4.0.11/RtAudio.h View File

@@ -47,6 +47,8 @@
#ifndef __RTAUDIO_H
#define __RTAUDIO_H

#include "CarlaDefines.hpp"

#include <string>
#include <vector>
#include "RtError.h"


+ 2
- 0
source/backend/engine/rtmidi-2.0.1/RtMidi.h View File

@@ -45,6 +45,8 @@
#ifndef RTMIDI_H
#define RTMIDI_H

#include "CarlaDefines.hpp"

#include "RtError.h"
#include <string>
#include <vector>


+ 103
- 98
source/discovery/carla-discovery.cpp View File

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

#include "carla_backend.hpp"
#include "carla_juce_utils.hpp"
#include "carla_lib_utils.hpp"
#include "carla_midi.h"
#include "CarlaBackend.hpp"
#include "CarlaJuceUtils.hpp"
#include "CarlaLibUtils.hpp"
#include "CarlaMIDI.h"

#ifdef WANT_LADSPA
# include "carla_ladspa_utils.hpp"
# include "CarlaLadspaUtils.hpp"
#endif
#ifdef WANT_DSSI
# include "carla_ladspa_utils.hpp"
# include "CarlaLadspaUtils.hpp"
# include "dssi/dssi.h"
#endif
#ifdef WANT_LV2
# include <QtCore/QDir>
# include <QtCore/QUrl>
# include "carla_lv2_utils.hpp"
# include "CarlaLv2Utils.hpp"
#endif
#ifdef WANT_VST
# include "carla_vst_utils.hpp"
# include "CarlaVstUtils.hpp"
#endif
#ifdef WANT_FLUIDSYNTH
# include <fluidsynth.h>
@@ -257,6 +257,101 @@ intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t opcode
}
#endif

// --------------------------------------------------------------------------
// LinuxSampler stuff

#ifdef WANT_LINUXSAMPLER
class LinuxSamplerScopedEngine
{
public:
LinuxSamplerScopedEngine(const char* const filename, const char* const stype)
: engine(nullptr),
ins(nullptr)
{
using namespace LinuxSampler;

try {
engine = EngineFactory::Create(stype);
}
catch (const Exception& e)
{
DISCOVERY_OUT("error", e.what());
return;
}

if (engine == nullptr)
return;

ins = engine->GetInstrumentManager();

if (ins == nullptr)
{
DISCOVERY_OUT("error", "Failed to get LinuxSampler instrument manager");
return;
}

std::vector<InstrumentManager::instrument_id_t> ids;

try {
ids = ins->GetInstrumentFileContent(filename);
}
catch (const Exception& e)
{
DISCOVERY_OUT("error", e.what());
return;
}

if (ids.size() > 0)
{
InstrumentManager::instrument_info_t info = ins->GetInstrumentInfo(ids[0]);
outputInfo(&info, ids.size());
}
}

~LinuxSamplerScopedEngine()
{
if (engine != nullptr)
EngineFactory::Destroy(engine);
}

static void outputInfo(InstrumentManager::instrument_info_t* const info, const int programs, const char* const basename = nullptr)
{
DISCOVERY_OUT("init", "-----------");

if (info)
{
DISCOVERY_OUT("name", info->InstrumentName);
DISCOVERY_OUT("label", info->Product);
DISCOVERY_OUT("maker", info->Artists);
DISCOVERY_OUT("copyright", info->Artists);
}
else
{
DISCOVERY_OUT("name", basename);
DISCOVERY_OUT("label", basename);
}

DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH);
DISCOVERY_OUT("audio.outs", 2);
DISCOVERY_OUT("audio.total", 2);
DISCOVERY_OUT("midi.ins", 1);
DISCOVERY_OUT("midi.total", 1);
DISCOVERY_OUT("programs.total", programs);
//DISCOVERY_OUT("parameters.ins", 13); // defined in Carla - TODO
//DISCOVERY_OUT("parameters.outs", 1);
//DISCOVERY_OUT("parameters.total", 14);
DISCOVERY_OUT("build", BINARY_NATIVE);
DISCOVERY_OUT("end", "------------");
}

private:
Engine* engine;
InstrumentManager* ins;

CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(LinuxSamplerScopedEngine)
};
#endif

// ------------------------------ Plugin Checks -----------------------------

void do_ladspa_check(void* const libHandle, const bool init)
@@ -1241,96 +1336,6 @@ void do_linuxsampler_check(const char* const filename, const char* const stype,
return;
}

using namespace LinuxSampler;

class LinuxSamplerScopedEngine
{
public:
LinuxSamplerScopedEngine(const char* const filename, const char* const stype)
{
engine = nullptr;

try {
engine = EngineFactory::Create(stype);
}
catch (const Exception& e)
{
DISCOVERY_OUT("error", e.what());
return;
}

if (! engine)
return;

ins = engine->GetInstrumentManager();

if (! ins)
{
DISCOVERY_OUT("error", "Failed to get LinuxSampler instrument manager");
return;
}

std::vector<InstrumentManager::instrument_id_t> ids;

try {
ids = ins->GetInstrumentFileContent(filename);
}
catch (const Exception& e)
{
DISCOVERY_OUT("error", e.what());
return;
}

if (ids.size() > 0)
{
InstrumentManager::instrument_info_t info = ins->GetInstrumentInfo(ids[0]);
outputInfo(&info, ids.size());
}
}

~LinuxSamplerScopedEngine()
{
if (engine)
EngineFactory::Destroy(engine);
}

static void outputInfo(InstrumentManager::instrument_info_t* const info, const int programs, const char* const basename = nullptr)
{
DISCOVERY_OUT("init", "-----------");

if (info)
{
DISCOVERY_OUT("name", info->InstrumentName);
DISCOVERY_OUT("label", info->Product);
DISCOVERY_OUT("maker", info->Artists);
DISCOVERY_OUT("copyright", info->Artists);
}
else
{
DISCOVERY_OUT("name", basename);
DISCOVERY_OUT("label", basename);
}

DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH);
DISCOVERY_OUT("audio.outs", 2);
DISCOVERY_OUT("audio.total", 2);
DISCOVERY_OUT("midi.ins", 1);
DISCOVERY_OUT("midi.total", 1);
DISCOVERY_OUT("programs.total", programs);
//DISCOVERY_OUT("parameters.ins", 13); // defined in Carla - TODO
//DISCOVERY_OUT("parameters.outs", 1);
//DISCOVERY_OUT("parameters.total", 14);
DISCOVERY_OUT("build", BINARY_NATIVE);
DISCOVERY_OUT("end", "------------");
}

private:
Engine* engine;
InstrumentManager* ins;

CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(LinuxSamplerScopedEngine)
};

if (init)
const LinuxSamplerScopedEngine engine(filename, stype);
else


+ 7
- 2
source/includes/CarlaDefines.hpp View File

@@ -41,13 +41,18 @@

// Check for C++11 support
#if defined(HAVE_CPP11_SUPPORT) || defined(QTCREATOR_TEST)
# define CARLA_CPP11_SUPPORT
# define CARLA_PROPER_CPP11_SUPPORT
#elif defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__)
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
# define CARLA_CPP11_SUPPORT
# define CARLA_PROPER_CPP11_SUPPORT
# endif
#endif

#ifndef CARLA_PROPER_CPP11_SUPPORT
# define noexcept
# define nullptr (0)
#endif

// Common includes
#ifdef CARLA_OS_WIN
# include <winsock2.h>


+ 1
- 0
source/utils/CarlaStateUtils.hpp View File

@@ -22,6 +22,7 @@
#include "CarlaUtils.hpp"

#include <QtXml/QDomNode>
#include <vector>

CARLA_BACKEND_START_NAMESPACE



Loading…
Cancel
Save