Browse Source

Add some engine error checking

tags/1.9.4
falkTX 11 years ago
parent
commit
a0cff9d861
12 changed files with 279 additions and 262 deletions
  1. +4
    -15
      source/backend/CarlaBackend.hpp
  2. +18
    -11
      source/backend/CarlaEngine.hpp
  3. +173
    -159
      source/backend/engine/CarlaEngine.cpp
  4. +0
    -2
      source/backend/engine/CarlaEngineInternal.hpp
  5. +28
    -53
      source/backend/engine/CarlaEngineJack.cpp
  6. +5
    -0
      source/backend/engine/CarlaEngineJuce.cpp
  7. +37
    -0
      source/backend/engine/CarlaEngineRtAudio.cpp
  8. +1
    -1
      source/backend/plugin/BridgePlugin.cpp
  9. +1
    -1
      source/backend/plugin/DssiPlugin.cpp
  10. +1
    -1
      source/backend/standalone/CarlaStandalone.cpp
  11. +0
    -8
      source/carla_backend.py
  12. +11
    -11
      source/modules/rtaudio/RtAudio.h

+ 4
- 15
source/backend/CarlaBackend.hpp View File

@@ -208,18 +208,6 @@ enum InternalParametersIndex SIZE_INT {
PARAMETER_MAX = -9 //!< Max value, defined for convenience.
};

/*!
* The icon of a patchbay client/group.
*/
enum PatchbayIconType SIZE_INT {
PATCHBAY_ICON_APPLICATION = 0, //!< Generic application icon.
PATCHBAY_ICON_HARDWARE = 1, //!< Hardware icon.
PATCHBAY_ICON_CARLA = 2, //!< Carla icon.
PATCHBAY_ICON_DISTRHO = 3, //!< DISTRHO icon.
PATCHBAY_ICON_FILE = 4, //!< File icon.
PATCHBAY_ICON_PLUGIN = 5 //!< Plugin icon.
};

/*!
* Options used in the CarlaEngine::setOption() calls.\n
* All options except paths must be set before initiliazing or after closing the engine.
@@ -595,18 +583,19 @@ enum CallbackType SIZE_INT {
/*!
* Canvas client icon changed.
* \param value1 Client Id
* \param value2 New client icon
* \param valueStr Client name
* \param valueStr New icon name
*/
CALLBACK_PATCHBAY_ICON_CHANGED = 26,

/*!
* Engine buffer-size changed.
* \param value1 New buffer size
*/
CALLBACK_BUFFER_SIZE_CHANGED = 27,

/*!
* Engine sample-rate changed.
* \param value3 New sample rate
*/
CALLBACK_SAMPLE_RATE_CHANGED = 28,

@@ -763,7 +752,7 @@ struct ParameterRanges {
return normValue;
}

float getNormalizedFixedValue(const float& value) const noexcept
float getFixedAndNormalizedValue(const float& value) const noexcept
{
if (value <= min)
return 0.0f;


+ 18
- 11
source/backend/CarlaEngine.hpp View File

@@ -564,14 +564,14 @@ public:
* Arguments are the same as in the EngineControlEvent struct.
* \note You must only call this for output ports.
*/
virtual void writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEventType type, const uint16_t param, const float value = 0.0f);
virtual bool writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEventType type, const uint16_t param, const float value = 0.0f);

/*!
* Write a control event into the buffer, overloaded call.
*/
void writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEvent& ctrl)
bool writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEvent& ctrl)
{
writeControlEvent(time, channel, ctrl.type, ctrl.param, ctrl.value);
return writeControlEvent(time, channel, ctrl.type, ctrl.param, ctrl.value);
}

/*!
@@ -579,22 +579,22 @@ public:
* Arguments are the same as in the EngineMidiEvent struct.
* \note You must only call this for output ports.
*/
virtual void writeMidiEvent(const uint32_t time, const uint8_t channel, const uint8_t port, const uint8_t* const data, const uint8_t size);
virtual bool writeMidiEvent(const uint32_t time, const uint8_t channel, const uint8_t port, const uint8_t* const data, const uint8_t size);

/*!
* Write a MIDI event into the buffer, overloaded call.
*/
void writeMidiEvent(const uint32_t time, const uint8_t* const data, const uint8_t size)
bool writeMidiEvent(const uint32_t time, const uint8_t* const data, const uint8_t size)
{
writeMidiEvent(time, MIDI_GET_CHANNEL_FROM_DATA(data), 0, data, size);
return writeMidiEvent(time, MIDI_GET_CHANNEL_FROM_DATA(data), 0, data, size);
}

/*!
* Write a MIDI event into the buffer, overloaded call.
*/
void writeMidiEvent(const uint32_t time, const uint8_t channel, const EngineMidiEvent& midi)
bool writeMidiEvent(const uint32_t time, const uint8_t channel, const EngineMidiEvent& midi)
{
writeMidiEvent(time, channel, midi.port, midi.data, midi.size);
return writeMidiEvent(time, channel, midi.port, midi.data, midi.size);
}

#ifndef DOXYGEN
@@ -789,6 +789,11 @@ public:
*/
virtual EngineType getType() const noexcept = 0;

/*!
* Get the currently used driver name.
*/
virtual const char* getCurrentDriverName() const noexcept = 0;

/*!
* Add new engine client.
* \note This function must only be called within a plugin class.
@@ -819,7 +824,7 @@ public:
/*!
* Remove all plugins.
*/
void removeAllPlugins();
bool removeAllPlugins();

/*!
* Rename plugin with id \a id to \a newName.\n
@@ -847,7 +852,7 @@ public:
/*!
* Get plugin with id \a id.
*/
CarlaPlugin* getPlugin(const unsigned int id) const;
CarlaPlugin* getPlugin(const unsigned int id);

/*!
* Get plugin with id \a id, faster unchecked version.
@@ -1008,8 +1013,10 @@ public:

/*!
* Set last error.
*
* \note Will always return false for convenience
*/
void setLastError(const char* const error);
bool setLastError(const char* const error);

// -------------------------------------------------------------------
// Misc


+ 173
- 159
source/backend/engine/CarlaEngine.cpp View File

@@ -30,6 +30,10 @@ CARLA_BACKEND_START_NAMESPACE
} // Fix editor indentation
#endif

// Engine helper macro, sets lastError and returns false/NULL
#define CARLA_SAFE_ASSERT_RETURN_ERR(cond, err) if (cond) pass(); else { carla_assert(#cond, __FILE__, __LINE__); setLastError(err); return false; }
#define CARLA_SAFE_ASSERT_RETURN_ERRN(cond, err) if (cond) pass(); else { carla_assert(#cond, __FILE__, __LINE__); setLastError(err); return nullptr; }

// -----------------------------------------------------------------------
// Fallback data

@@ -170,13 +174,13 @@ const EngineEvent& CarlaEngineEventPort::getEventUnchecked(const uint32_t index)
return fBuffer[index];
}

void CarlaEngineEventPort::writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEventType type, const uint16_t param, const float value)
bool CarlaEngineEventPort::writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEventType type, const uint16_t param, const float value)
{
CARLA_SAFE_ASSERT_RETURN(! fIsInput,);
CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fEngine.getProccessMode() != PROCESS_MODE_SINGLE_CLIENT && fEngine.getProccessMode() != PROCESS_MODE_MULTIPLE_CLIENTS,);
CARLA_SAFE_ASSERT_RETURN(type != kEngineControlEventTypeNull,);
CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,);
CARLA_SAFE_ASSERT_RETURN(! fIsInput, false);
CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fEngine.getProccessMode() != PROCESS_MODE_SINGLE_CLIENT && fEngine.getProccessMode() != PROCESS_MODE_MULTIPLE_CLIENTS, false);
CARLA_SAFE_ASSERT_RETURN(type != kEngineControlEventTypeNull, false);
CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS, false);
CARLA_SAFE_ASSERT(value >= 0.0f && value <= 1.0f);

if (type == kEngineControlEventTypeParameter)
@@ -201,20 +205,21 @@ void CarlaEngineEventPort::writeControlEvent(const uint32_t time, const uint8_t
event.ctrl.param = param;
event.ctrl.value = fixedValue;

return;
return true;
}

carla_stderr2("CarlaEngineEventPort::writeControlEvent() - buffer full");
return false;
}

void CarlaEngineEventPort::writeMidiEvent(const uint32_t time, const uint8_t channel, const uint8_t port, const uint8_t* const data, const uint8_t size)
bool CarlaEngineEventPort::writeMidiEvent(const uint32_t time, const uint8_t channel, const uint8_t port, const uint8_t* const data, const uint8_t size)
{
CARLA_SAFE_ASSERT_RETURN(! fIsInput,);
CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fEngine.getProccessMode() != PROCESS_MODE_SINGLE_CLIENT && fEngine.getProccessMode() != PROCESS_MODE_MULTIPLE_CLIENTS,);
CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,);
CARLA_SAFE_ASSERT_RETURN(data != nullptr,);
CARLA_SAFE_ASSERT_RETURN(size > 0 && size <= 4,);
CARLA_SAFE_ASSERT_RETURN(! fIsInput, false);
CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(fEngine.getProccessMode() != PROCESS_MODE_SINGLE_CLIENT && fEngine.getProccessMode() != PROCESS_MODE_MULTIPLE_CLIENTS, false);
CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS, false);
CARLA_SAFE_ASSERT_RETURN(data != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(size > 0 && size <= 4, false);

for (uint32_t i=0; i < kEngineMaxInternalEventCount; ++i)
{
@@ -235,10 +240,11 @@ void CarlaEngineEventPort::writeMidiEvent(const uint32_t time, const uint8_t cha
for (uint8_t j=1; j < size; ++j)
event.midi.data[j] = data[j];

return;
return true;
}

carla_stderr2("CarlaEngineEventPort::writeMidiEvent() - buffer full");
return false;
}

// -----------------------------------------------------------------------
@@ -463,18 +469,18 @@ unsigned int CarlaEngine::getMaxPluginNumber() const noexcept

bool CarlaEngine::init(const char* const clientName)
{
CARLA_SAFE_ASSERT_RETURN(clientName != nullptr && clientName[0] != '\0', false);
CARLA_ASSERT(fName.isEmpty());
CARLA_ASSERT(pData->oscData == nullptr);
CARLA_ASSERT(pData->plugins == nullptr);
CARLA_ASSERT(pData->bufEvents.in == nullptr);
CARLA_ASSERT(pData->bufEvents.out == nullptr);
CARLA_SAFE_ASSERT_RETURN_ERR(fName.isEmpty(), "Invalid engine internal data (err #1)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->oscData == nullptr, "Invalid engine internal data (err #2)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins == nullptr, "Invalid engine internal data (err #3)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->bufEvents.in == nullptr, "Invalid engine internal data (err #4)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->bufEvents.out == nullptr, "Invalid engine internal data (err #5)");
CARLA_SAFE_ASSERT_RETURN_ERR(clientName != nullptr && clientName[0] != '\0', "Invalid client name");
carla_debug("CarlaEngine::init(\"%s\")", clientName);

pData->aboutToClose = false;
pData->curPluginCount = 0;
pData->aboutToClose = false;
pData->curPluginCount = 0;
pData->maxPluginNumber = 0;
pData->nextPluginId = 0;
pData->nextPluginId = 0;

switch (fOptions.processMode)
{
@@ -485,8 +491,8 @@ bool CarlaEngine::init(const char* const clientName)

case PROCESS_MODE_CONTINUOUS_RACK:
pData->maxPluginNumber = MAX_RACK_PLUGINS;
pData->bufEvents.in = new EngineEvent[kEngineMaxInternalEventCount];
pData->bufEvents.out = new EngineEvent[kEngineMaxInternalEventCount];
pData->bufEvents.in = new EngineEvent[kEngineMaxInternalEventCount];
pData->bufEvents.out = new EngineEvent[kEngineMaxInternalEventCount];
break;

case PROCESS_MODE_PATCHBAY:
@@ -495,13 +501,12 @@ bool CarlaEngine::init(const char* const clientName)

case PROCESS_MODE_BRIDGE:
pData->maxPluginNumber = 1;
pData->bufEvents.in = new EngineEvent[kEngineMaxInternalEventCount];
pData->bufEvents.out = new EngineEvent[kEngineMaxInternalEventCount];
pData->bufEvents.in = new EngineEvent[kEngineMaxInternalEventCount];
pData->bufEvents.out = new EngineEvent[kEngineMaxInternalEventCount];
break;
}

if (pData->maxPluginNumber == 0)
return false;
CARLA_SAFE_ASSERT_RETURN_ERR(pData->maxPluginNumber != 0, "Invalid engine process mode");

pData->nextPluginId = pData->maxPluginNumber;

@@ -520,15 +525,17 @@ bool CarlaEngine::init(const char* const clientName)
pData->nextAction.ready();
pData->thread.startThread();

callback(CALLBACK_ENGINE_STARTED, 0, 0, 0, 0.0f, getCurrentDriverName());

return true;
}

bool CarlaEngine::close()
{
CARLA_ASSERT(fName.isNotEmpty());
CARLA_ASSERT(pData->plugins != nullptr);
CARLA_ASSERT(pData->nextAction.opcode == kEnginePostActionNull);
CARLA_ASSERT(pData->nextPluginId == pData->maxPluginNumber);
CARLA_SAFE_ASSERT_RETURN_ERR(fName.isNotEmpty(), "Invalid engine internal data (err #6)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins != nullptr, "Invalid engine internal data (err #7)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextPluginId == pData->maxPluginNumber, "Invalid engine internal data (err #8)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextAction.opcode == kEnginePostActionNull, "Invalid engine internal data (err #9)");
carla_debug("CarlaEngine::close()");

pData->thread.stopThread(500);
@@ -565,6 +572,8 @@ bool CarlaEngine::close()

fName.clear();

callback(CALLBACK_ENGINE_STOPPED, 0, 0, 0, 0.0f, nullptr);

return true;
}

@@ -593,11 +602,13 @@ CarlaEngineClient* CarlaEngine::addClient(CarlaPlugin* const)

bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, const char* const filename, const char* const name, const char* const label, const void* const extra)
{
CARLA_ASSERT(btype != BINARY_NONE);
CARLA_ASSERT(ptype != PLUGIN_NONE);
CARLA_ASSERT(pData->plugins != nullptr);
CARLA_ASSERT(pData->nextAction.opcode == kEnginePostActionNull);
carla_debug("CarlaEngine::addPlugin(%s, %s, \"%s\", \"%s\", \"%s\", %p)", BinaryType2Str(btype), PluginType2Str(ptype), filename, name, label, extra);
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins != nullptr, "Invalid engine internal data (err #10)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextPluginId <= pData->maxPluginNumber, "Invalid engine internal data (err #11)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextAction.opcode == kEnginePostActionNull, "Invalid engine internal data (err #12)");
CARLA_SAFE_ASSERT_RETURN_ERR(btype != BINARY_NONE, "Invalid plugin params (err #1)");
CARLA_SAFE_ASSERT_RETURN_ERR(ptype != PLUGIN_NONE, "Invalid plugin params (err #2)");
CARLA_SAFE_ASSERT_RETURN_ERR((filename != nullptr && filename[0] != '\0') || (label != nullptr && label[0] != '\0'), "Invalid plugin params (err #3)");
carla_debug("CarlaEngine::addPlugin(%i:%s, %i:%s, \"%s\", \"%s\", \"%s\", %p)", btype, BinaryType2Str(btype), ptype, PluginType2Str(ptype), filename, name, label, extra);

unsigned int id;
CarlaPlugin* oldPlugin = nullptr;
@@ -608,7 +619,8 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, cons
pData->nextPluginId = pData->maxPluginNumber;

oldPlugin = pData->plugins[id].plugin;
CARLA_ASSERT(oldPlugin != nullptr);

CARLA_SAFE_ASSERT_RETURN_ERR(oldPlugin != nullptr, "Invalid replace plugin Id");
}
else
{
@@ -620,7 +632,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, cons
return false;
}

CARLA_ASSERT(pData->plugins[id].plugin == nullptr);
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins[id].plugin == nullptr, "Invalid engine internal data (err #13)");
}

CarlaPlugin::Initializer init = {
@@ -655,18 +667,46 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, cons
break;
}

# ifndef Q_OS_WIN
# ifndef CARLA_OS_WIN
if (btype == BINARY_NATIVE && fOptions.bridge_native.isNotEmpty())
bridgeBinary = (const char*)fOptions.bridge_native;
# endif

if (bridgeBinary != nullptr && (btype != BINARY_NATIVE || fOptions.preferPluginBridges))
if (btype != BINARY_NATIVE || (fOptions.preferPluginBridges && bridgeBinary != nullptr))
{
plugin = CarlaPlugin::newBridge(init, btype, ptype, bridgeBinary);
if (bridgeBinary != nullptr)
{
plugin = CarlaPlugin::newBridge(init, btype, ptype, bridgeBinary);
}
# ifdef CARLA_OS_LINUX
else if (btype == BINARY_WIN32)
{
// fallback to dssi-vst
CarlaString label2("filename");
label2.replace(' ', '*');

CarlaPlugin::Initializer init2 = {
this,
id,
"/usr/lib/dssi/dssi-vst.so",
name,
(const char*)label2
};

plugin = CarlaPlugin::newDSSI(init2);
}
# endif
else
{
setLastError("This Carla build cannot handle this binary");
return false;
}
}
else
#endif // BUILD_BRIDGE
{
setLastError("Invalid or unsupported plugin type");

switch (ptype)
{
case PLUGIN_NONE:
@@ -719,11 +759,12 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, cons

plugin->registerToOscClient();

pData->plugins[id].plugin = plugin;
pData->plugins[id].insPeak[0] = 0.0f;
pData->plugins[id].insPeak[1] = 0.0f;
pData->plugins[id].outsPeak[0] = 0.0f;
pData->plugins[id].outsPeak[1] = 0.0f;
EnginePluginData& pluginData(pData->plugins[id]);
pluginData.plugin = plugin;
pluginData.insPeak[0] = 0.0f;
pluginData.insPeak[1] = 0.0f;
pluginData.outsPeak[0] = 0.0f;
pluginData.outsPeak[1] = 0.0f;

if (oldPlugin != nullptr)
{
@@ -741,27 +782,16 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, cons

bool CarlaEngine::removePlugin(const unsigned int id)
{
CARLA_ASSERT(pData->curPluginCount != 0);
CARLA_ASSERT(id < pData->curPluginCount);
CARLA_ASSERT(pData->plugins != nullptr);
CARLA_ASSERT(pData->nextAction.opcode == kEnginePostActionNull);
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins != nullptr, "Invalid engine internal data (err #14)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->curPluginCount != 0, "Invalid engine internal data (err #15)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextAction.opcode == kEnginePostActionNull, "Invalid engine internal data (err #16)");
CARLA_SAFE_ASSERT_RETURN_ERR(id < pData->curPluginCount, "Invalid plugin Id (err #1)");
carla_debug("CarlaEngine::removePlugin(%i)", id);

if (pData->plugins == nullptr || pData->curPluginCount == 0)
{
setLastError("Critical error: no plugins are currently loaded!");
return false;
}

CarlaPlugin* const plugin(pData->plugins[id].plugin);

if (plugin == nullptr)
{
setLastError("Could not find plugin to remove");
return false;
}

CARLA_ASSERT(plugin->getId() == id);
CARLA_SAFE_ASSERT_RETURN_ERR(plugin != nullptr, "Could not find plugin to remove");
CARLA_SAFE_ASSERT_RETURN_ERR(plugin->getId() == id, "Invalid engine internal data (err #17)");

pData->thread.stopThread(500);

@@ -782,14 +812,12 @@ bool CarlaEngine::removePlugin(const unsigned int id)
return true;
}

void CarlaEngine::removeAllPlugins()
bool CarlaEngine::removeAllPlugins()
{
CARLA_ASSERT(pData->plugins != nullptr);
CARLA_ASSERT(pData->nextAction.opcode == kEnginePostActionNull);
carla_debug("CarlaEngine::removeAllPlugins() - START");

if (pData->plugins == nullptr || pData->curPluginCount == 0)
return;
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins != nullptr, "Invalid engine internal data (err #18)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->curPluginCount != 0, "Invalid engine internal data (err #19)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextAction.opcode == kEnginePostActionNull, "Invalid engine internal data (err #20)");
carla_debug("CarlaEngine::removeAllPlugins()");

pData->thread.stopThread(500);

@@ -798,49 +826,39 @@ void CarlaEngine::removeAllPlugins()

for (unsigned int i=0; i < pData->maxPluginNumber; ++i)
{
if (CarlaPlugin* const plugin = pData->plugins[i].plugin)
EnginePluginData& pluginData(pData->plugins[i]);

if (pluginData.plugin != nullptr)
{
pData->plugins[i].plugin = nullptr;
delete plugin;
delete pluginData.plugin;
pluginData.plugin = nullptr;
}

// clear this plugin
pData->plugins[i].insPeak[0] = 0.0f;
pData->plugins[i].insPeak[1] = 0.0f;
pData->plugins[i].outsPeak[0] = 0.0f;
pData->plugins[i].outsPeak[1] = 0.0f;
pluginData.insPeak[0] = 0.0f;
pluginData.insPeak[1] = 0.0f;
pluginData.outsPeak[0] = 0.0f;
pluginData.outsPeak[1] = 0.0f;
}

if (isRunning() && ! pData->aboutToClose)
pData->thread.startThread();

carla_debug("CarlaEngine::removeAllPlugins() - END");
return true;
}

const char* CarlaEngine::renamePlugin(const unsigned int id, const char* const newName)
{
CARLA_ASSERT(pData->curPluginCount != 0);
CARLA_ASSERT(id < pData->curPluginCount);
CARLA_ASSERT(pData->plugins != nullptr);
CARLA_ASSERT(pData->nextAction.opcode == kEnginePostActionNull);
CARLA_ASSERT(newName != nullptr);
CARLA_SAFE_ASSERT_RETURN_ERRN(pData->plugins != nullptr, "Invalid engine internal data (err #21)");
CARLA_SAFE_ASSERT_RETURN_ERRN(pData->curPluginCount != 0, "Invalid engine internal data (err #22)");
CARLA_SAFE_ASSERT_RETURN_ERRN(pData->nextAction.opcode == kEnginePostActionNull, "Invalid engine internal data (err #23)");
CARLA_SAFE_ASSERT_RETURN_ERRN(id < pData->curPluginCount, "Invalid plugin Id (err #2)");
CARLA_SAFE_ASSERT_RETURN_ERRN(newName != nullptr && newName[0] != '\0', "Invalid plugin name");
carla_debug("CarlaEngine::renamePlugin(%i, \"%s\")", id, newName);

if (pData->plugins == nullptr || pData->curPluginCount == 0)
{
setLastError("Critical error: no plugins are currently loaded!");
return nullptr;
}

CarlaPlugin* const plugin(pData->plugins[id].plugin);

if (plugin == nullptr)
{
carla_stderr("CarlaEngine::clonePlugin(%i) - could not find plugin", id);
return nullptr;
}

CARLA_ASSERT(plugin->getId() == id);
CARLA_SAFE_ASSERT_RETURN_ERRN(plugin != nullptr, "Could not find plugin to rename");
CARLA_SAFE_ASSERT_RETURN_ERRN(plugin->getId() == id, "Invalid engine internal data (err #24)");

if (const char* const name = getUniquePluginName(newName))
{
@@ -848,34 +866,25 @@ const char* CarlaEngine::renamePlugin(const unsigned int id, const char* const n
return name;
}

setLastError("Unable to get new unique plugin name");
return nullptr;
}

bool CarlaEngine::clonePlugin(const unsigned int id)
{
CARLA_ASSERT(pData->curPluginCount > 0);
CARLA_ASSERT(id < pData->curPluginCount);
CARLA_ASSERT(pData->plugins != nullptr);
CARLA_ASSERT(pData->nextAction.opcode == kEnginePostActionNull);
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins != nullptr, "Invalid engine internal data (err #25)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->curPluginCount != 0, "Invalid engine internal data (err #26)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextAction.opcode == kEnginePostActionNull, "Invalid engine internal data (err #27)");
CARLA_SAFE_ASSERT_RETURN_ERR(id < pData->curPluginCount, "Invalid plugin Id (err #3)");
carla_debug("CarlaEngine::clonePlugin(%i)", id);

if (pData->plugins == nullptr || pData->curPluginCount == 0)
{
setLastError("Critical error: no plugins are currently loaded!");
return false;
}

CarlaPlugin* const plugin(pData->plugins[id].plugin);

if (plugin == nullptr)
{
carla_stderr("CarlaEngine::clonePlugin(%i) - could not find plugin", id);
return false;
}

CARLA_ASSERT(plugin->getId() == id);
CARLA_SAFE_ASSERT_RETURN_ERR(plugin != nullptr, "Could not find plugin to clone");
CARLA_SAFE_ASSERT_RETURN_ERR(plugin->getId() == id, "Invalid engine internal data (err #28)");

char label[STR_MAX+1] = { '\0' };
char label[STR_MAX+1];
carla_zeroChar(label, STR_MAX+1);
plugin->getLabel(label);

const unsigned int pluginCountBefore(pData->curPluginCount);
@@ -893,33 +902,39 @@ bool CarlaEngine::clonePlugin(const unsigned int id)

bool CarlaEngine::replacePlugin(const unsigned int id)
{
CARLA_ASSERT(pData->curPluginCount > 0);
CARLA_ASSERT(id < pData->curPluginCount);
CARLA_ASSERT(pData->plugins != nullptr);
CARLA_ASSERT(pData->nextAction.opcode == kEnginePostActionNull);
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins != nullptr, "Invalid engine internal data (err #29)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->curPluginCount != 0, "Invalid engine internal data (err #30)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextAction.opcode == kEnginePostActionNull, "Invalid engine internal data (err #31)");
CARLA_SAFE_ASSERT_RETURN_ERR(id < pData->curPluginCount, "Invalid plugin Id (err #4)");
carla_debug("CarlaEngine::replacePlugin(%i)", id);

if (id < pData->curPluginCount)
pData->nextPluginId = id;
CarlaPlugin* const plugin(pData->plugins[id].plugin);

return false;
CARLA_SAFE_ASSERT_RETURN_ERR(plugin != nullptr, "Could not find plugin to replace");
CARLA_SAFE_ASSERT_RETURN_ERR(plugin->getId() == id, "Invalid engine internal data (err #32)");

pData->nextPluginId = id;

return true;
}

bool CarlaEngine::switchPlugins(const unsigned int idA, const unsigned int idB)
{
CARLA_ASSERT(pData->curPluginCount >= 2);
CARLA_ASSERT(pData->plugins != nullptr);
CARLA_ASSERT(pData->nextAction.opcode == kEnginePostActionNull);
CARLA_ASSERT(idA != idB);
CARLA_ASSERT(idA < pData->curPluginCount);
CARLA_ASSERT(idB < pData->curPluginCount);
CARLA_SAFE_ASSERT_RETURN_ERR(pData->plugins != nullptr, "Invalid engine internal data (err #33)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->curPluginCount >= 2, "Invalid engine internal data (err #34)");
CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextAction.opcode == kEnginePostActionNull, "Invalid engine internal data (err #35)");
CARLA_SAFE_ASSERT_RETURN_ERR(idA != idB, "Invalid operation, cannot switch plugin with itself");
CARLA_SAFE_ASSERT_RETURN_ERR(idA < pData->curPluginCount, "Invalid plugin Id (err #5)");
CARLA_SAFE_ASSERT_RETURN_ERR(idB < pData->curPluginCount, "Invalid plugin Id (err #6)");
carla_debug("CarlaEngine::switchPlugins(%i)", idA, idB);

if (pData->plugins == nullptr || pData->curPluginCount == 0)
{
setLastError("Critical error: no plugins are currently loaded!");
return false;
}
CarlaPlugin* const pluginA(pData->plugins[idA].plugin);
CarlaPlugin* const pluginB(pData->plugins[idB].plugin);

CARLA_SAFE_ASSERT_RETURN_ERR(pluginA != nullptr, "Could not find plugin to switch (err #1)");
CARLA_SAFE_ASSERT_RETURN_ERR(pluginA != nullptr, "Could not find plugin to switch (err #2)");
CARLA_SAFE_ASSERT_RETURN_ERR(pluginA->getId() == idA, "Invalid engine internal data (err #36)");
CARLA_SAFE_ASSERT_RETURN_ERR(pluginB->getId() == idB, "Invalid engine internal data (err #37)");

pData->thread.stopThread(500);

@@ -937,18 +952,15 @@ bool CarlaEngine::switchPlugins(const unsigned int idA, const unsigned int idB)
return true;
}

CarlaPlugin* CarlaEngine::getPlugin(const unsigned int id) const
CarlaPlugin* CarlaEngine::getPlugin(const unsigned int id)
{
CARLA_ASSERT(pData->curPluginCount != 0);
CARLA_ASSERT(id < pData->curPluginCount);
CARLA_ASSERT(pData->plugins != nullptr);
CARLA_ASSERT(pData->nextAction.opcode == kEnginePostActionNull); // TESTING, remove later
CARLA_SAFE_ASSERT_RETURN_ERRN(pData->plugins != nullptr, "Invalid engine internal data (err #38)");
CARLA_SAFE_ASSERT_RETURN_ERRN(pData->curPluginCount != 0, "Invalid engine internal data (err #39)");
CARLA_SAFE_ASSERT_RETURN_ERRN(pData->nextAction.opcode == kEnginePostActionNull, "Invalid engine internal data (err #40)");
CARLA_SAFE_ASSERT_RETURN_ERRN(id < pData->curPluginCount, "Invalid plugin Id (err #7)");
carla_debug("CarlaEngine::getPlugin(%i) [count:%i]", id, pData->curPluginCount);

if (id < pData->curPluginCount && pData->plugins != nullptr)
return pData->plugins[id].plugin;

return nullptr;
return pData->plugins[id].plugin;
}

CarlaPlugin* CarlaEngine::getPluginUnchecked(const unsigned int id) const noexcept
@@ -958,14 +970,14 @@ CarlaPlugin* CarlaEngine::getPluginUnchecked(const unsigned int id) const noexce

const char* CarlaEngine::getUniquePluginName(const char* const name)
{
CARLA_ASSERT(pData->maxPluginNumber != 0);
CARLA_ASSERT(pData->plugins != nullptr);
CARLA_ASSERT(pData->nextAction.opcode == kEnginePostActionNull);
CARLA_ASSERT(name != nullptr);
CARLA_SAFE_ASSERT_RETURN(pData->maxPluginNumber != 0, nullptr);
CARLA_SAFE_ASSERT_RETURN(pData->plugins != nullptr, nullptr);
CARLA_SAFE_ASSERT_RETURN(pData->nextAction.opcode == kEnginePostActionNull, nullptr);
CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', nullptr);
carla_debug("CarlaEngine::getUniquePluginName(\"%s\")", name);

//static CarlaMutex m;
//const CarlaMutex::ScopedLocker sl(m);
static CarlaMutex m;
const CarlaMutex::ScopedLocker sl(m);

static CarlaString sname;
sname = name;
@@ -984,10 +996,7 @@ const char* CarlaEngine::getUniquePluginName(const char* const name)

for (unsigned short i=0; i < pData->curPluginCount; ++i)
{
CARLA_ASSERT(pData->plugins[i].plugin != nullptr);

if (pData->plugins[i].plugin == nullptr)
break;
CARLA_SAFE_ASSERT_BREAK(pData->plugins[i].plugin != nullptr);

// Check if unique name doesn't exist
if (const char* const pluginName = pData->plugins[i].plugin->getName())
@@ -1051,7 +1060,7 @@ const char* CarlaEngine::getUniquePluginName(const char* const name)

bool CarlaEngine::loadFilename(const char* const filename)
{
CARLA_ASSERT(filename != nullptr && filename[0] != '\0');
CARLA_SAFE_ASSERT_RETURN_ERR(filename != nullptr && filename[0] != '\0', "Invalid filename (err #1)");
carla_debug("CarlaEngine::loadFilename(\"%s\")", filename);

using namespace juce;
@@ -1185,7 +1194,7 @@ bool charEndsWith(const char* const str, const char* const suffix)

bool CarlaEngine::loadProject(const char* const filename)
{
CARLA_ASSERT(filename != nullptr && filename[0] != '\0');
CARLA_SAFE_ASSERT_RETURN_ERR(filename != nullptr && filename[0] != '\0', "Invalid filename (err #2)");
carla_debug("CarlaEngine::loadProject(\"%s\")", filename);

using namespace juce;
@@ -1255,7 +1264,7 @@ bool CarlaEngine::loadProject(const char* const filename)

bool CarlaEngine::saveProject(const char* const filename)
{
CARLA_ASSERT(filename != nullptr && filename[0] != '\0');
CARLA_SAFE_ASSERT_RETURN_ERR(filename != nullptr && filename[0] != '\0', "Invalid filename (err #3)");
carla_debug("CarlaEngine::saveProject(\"%s\")", filename);

using namespace juce;
@@ -1399,9 +1408,10 @@ const char* CarlaEngine::getLastError() const noexcept
return (const char*)pData->lastError;
}

void CarlaEngine::setLastError(const char* const error)
bool CarlaEngine::setLastError(const char* const error)
{
pData->lastError = error;
return false;
}

void CarlaEngine::setAboutToClose()
@@ -2419,4 +2429,8 @@ void CarlaEngine::oscSend_bridge_set_chunk_data(const char* const chunkFile)
}
#endif

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

#undef CARLA_SAFE_ASSERT_RETURN_ERR

CARLA_BACKEND_END_NAMESPACE

+ 0
- 2
source/backend/engine/CarlaEngineInternal.hpp View File

@@ -140,8 +140,6 @@ struct EnginePluginData {
insPeak[0] = insPeak[1] = 0.0f;
outsPeak[0] = outsPeak[1] = 0.0f;
}

CARLA_DECLARE_NON_COPY_STRUCT(EnginePluginData)
};

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


+ 28
- 53
source/backend/engine/CarlaEngineJack.cpp View File

@@ -310,16 +310,16 @@ public:
return fRetEvent;
}

void writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEventType type, const uint16_t param, const float value) override
bool writeControlEvent(const uint32_t time, const uint8_t channel, const EngineControlEventType type, const uint16_t param, const float value) override
{
if (fPort == nullptr)
return CarlaEngineEventPort::writeControlEvent(time, channel, type, param, value);

CARLA_SAFE_ASSERT_RETURN(! fIsInput,);
CARLA_SAFE_ASSERT_RETURN(fJackBuffer != nullptr,);
CARLA_SAFE_ASSERT_RETURN(type != kEngineControlEventTypeNull,);
CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,);
CARLA_SAFE_ASSERT_RETURN(param < 0x5F,);
CARLA_SAFE_ASSERT_RETURN(! fIsInput, false);
CARLA_SAFE_ASSERT_RETURN(fJackBuffer != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(type != kEngineControlEventTypeNull, false);
CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS, false);
CARLA_SAFE_ASSERT_RETURN(param < 0x5F, false);
CARLA_SAFE_ASSERT(value >= 0.0f && value <= 1.0f);

if (type == kEngineControlEventTypeParameter)
@@ -367,20 +367,22 @@ public:
break;
}

if (size > 0)
jackbridge_midi_event_write(fJackBuffer, time, data, size);
if (size == 0)
return false;

return jackbridge_midi_event_write(fJackBuffer, time, data, size);
}

void writeMidiEvent(const uint32_t time, const uint8_t channel, const uint8_t port, const uint8_t* const data, const uint8_t size) override
bool writeMidiEvent(const uint32_t time, const uint8_t channel, const uint8_t port, const uint8_t* const data, const uint8_t size) override
{
if (fPort == nullptr)
return CarlaEngineEventPort::writeMidiEvent(time, channel, port, data, size);

CARLA_SAFE_ASSERT_RETURN(! fIsInput,);
CARLA_SAFE_ASSERT_RETURN(fJackBuffer != nullptr,);
CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,);
CARLA_SAFE_ASSERT_RETURN(data != nullptr,);
CARLA_SAFE_ASSERT_RETURN(size > 0,);
CARLA_SAFE_ASSERT_RETURN(! fIsInput, false);
CARLA_SAFE_ASSERT_RETURN(fJackBuffer != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS, false);
CARLA_SAFE_ASSERT_RETURN(data != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(size > 0, false);

jack_midi_data_t jdata[size];
std::memset(jdata, 0, sizeof(jack_midi_data_t)*size);
@@ -391,7 +393,7 @@ public:
for (uint8_t i=1; i < size; ++i)
jdata[i] = data[i];

jackbridge_midi_event_write(fJackBuffer, time, jdata, size);
return jackbridge_midi_event_write(fJackBuffer, time, jdata, size);
}

private:
@@ -796,24 +798,7 @@ public:
const char* const icon((const char*)data);
CARLA_ASSERT(std::strlen(icon)+1 == dataSize);

PatchbayIconType groupIcon;

if (std::strcmp(icon, "app") == 0 || std::strcmp(icon, "application") == 0)
groupIcon = PATCHBAY_ICON_APPLICATION;
else if (std::strcmp(icon, "hardware") == 0)
groupIcon = PATCHBAY_ICON_HARDWARE;
else if (std::strcmp(icon, "carla") == 0)
groupIcon = PATCHBAY_ICON_CARLA;
else if (std::strcmp(icon, "distrho") == 0)
groupIcon = PATCHBAY_ICON_DISTRHO;
else if (std::strcmp(icon, "file") == 0)
groupIcon = PATCHBAY_ICON_FILE;
else if (std::strcmp(icon, "plugin") == 0)
groupIcon = PATCHBAY_ICON_PLUGIN;
else
groupIcon = PATCHBAY_ICON_APPLICATION;

callback(CALLBACK_PATCHBAY_ICON_CHANGED, 0, groupId, groupIcon, 0.0f, groupName);
callback(CALLBACK_PATCHBAY_ICON_CHANGED, 0, groupId, 0, 0.0f, icon);

jackbridge_free(data);
}
@@ -842,6 +827,11 @@ public:
return kEngineTypeJack;
}

const char* getCurrentDriverName() const noexcept override
{
return "JACK";
}

CarlaEngineClient* addClient(CarlaPlugin* const plugin) override
{
const char* const iconName(plugin->getIconName());
@@ -1485,11 +1475,11 @@ protected:

if (jackPortFlags & JackPortIsPhysical)
{
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupId, PATCHBAY_ICON_HARDWARE, 0.0f, groupName);
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupId, 0, 0.0f, "hardware");
}
else
{
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupId, PATCHBAY_ICON_APPLICATION, 0.0f, groupName);
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupId, 0, 0.0f, "application");
fGroupIconsChanged.append(groupId);
}
}
@@ -1881,7 +1871,7 @@ private:
GroupNameToId groupNameToId(fLastGroupId++, ourName);
fUsedGroupNames.append(groupNameToId);

callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupNameToId.id, PATCHBAY_ICON_CARLA, 0.0f, ourName);
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupNameToId.id, 0, 0.0f, "carla");
}

if (const char** ports = jackbridge_get_ports(fClient, nullptr, nullptr, 0))
@@ -1917,35 +1907,20 @@ private:
GroupNameToId groupNameToId(groupId, groupName);
fUsedGroupNames.append(groupNameToId);

PatchbayIconType groupIcon = PATCHBAY_ICON_APPLICATION;

void* data = nullptr;
size_t dataSize = 0;

if (jackPortFlags & JackPortIsPhysical)
{
groupIcon = PATCHBAY_ICON_HARDWARE;
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupId, 0, 0.0f, "hardware");
}
else if (jackbridge_custom_get_data(fClient, groupName, URI_CANVAS_ICON, &data, &dataSize) && data != nullptr && dataSize != 0)
{
const char* const icon((const char*)data);
CARLA_ASSERT(std::strlen(icon)+1 == dataSize);

if (std::strcmp(icon, "app") == 0 || std::strcmp(icon, "application") == 0)
groupIcon = PATCHBAY_ICON_APPLICATION;
else if (std::strcmp(icon, "hardware") == 0)
groupIcon = PATCHBAY_ICON_HARDWARE;
else if (std::strcmp(icon, "carla") == 0)
groupIcon = PATCHBAY_ICON_CARLA;
else if (std::strcmp(icon, "distrho") == 0)
groupIcon = PATCHBAY_ICON_DISTRHO;
else if (std::strcmp(icon, "file") == 0)
groupIcon = PATCHBAY_ICON_FILE;
else if (std::strcmp(icon, "plugin") == 0)
groupIcon = PATCHBAY_ICON_PLUGIN;
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupId, 0, 0.0f, icon);
}

callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupId, groupIcon, 0.0f, groupName);
}

bool portIsInput = (jackPortFlags & JackPortIsInput);


+ 5
- 0
source/backend/engine/CarlaEngineJuce.cpp View File

@@ -84,6 +84,11 @@ public:
return kEngineTypeJuce;
}

const char* getCurrentDriverName() const noexcept override
{
return nullptr;
}

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

protected:


+ 37
- 0
source/backend/engine/CarlaEngineRtAudio.cpp View File

@@ -378,6 +378,43 @@ public:
return kEngineTypeRtAudio;
}

const char* getCurrentDriverName() const noexcept override
{
const RtAudio::Api api(fAudio.getCurrentApi());

switch (api)
{
case RtAudio::UNSPECIFIED:
return "Unspecified";
case RtAudio::LINUX_ALSA:
return "ALSA";
case RtAudio::LINUX_PULSE:
return "PulseAudio";
case RtAudio::LINUX_OSS:
return "OSS";
case RtAudio::UNIX_JACK:
#if defined(CARLA_OS_WIN)
return "JACK with WinMM";
#elif defined(CARLA_OS_MAC)
return "JACK with CoreMidi";
#elif defined(CARLA_OS_LINUX)
return "JACK with ALSA-MIDI";
#else
return "JACK (RtAudio)";
#endif
case RtAudio::MACOSX_CORE:
return "CoreAudio";
case RtAudio::WINDOWS_ASIO:
return "ASIO";
case RtAudio::WINDOWS_DS:
return "DirectSound";
case RtAudio::RTAUDIO_DUMMY:
return "Dummy";
}

return nullptr;
}

// -------------------------------------------------------------------
// Patchbay



+ 1
- 1
source/backend/plugin/BridgePlugin.cpp View File

@@ -1581,7 +1581,7 @@ public:

QString chunkFileStr(chunkFileChar);

#ifndef Q_OS_WIN
#ifndef CARLA_OS_WIN
// Using Wine, fix temp dir
if (m_binary == BINARY_WIN32 || m_binary == BINARY_WIN64)
{


+ 1
- 1
source/backend/plugin/DssiPlugin.cpp View File

@@ -1405,7 +1405,7 @@ public:
{
channel = pData->param.data[k].midiChannel;
param = static_cast<uint16_t>(pData->param.data[k].midiCC);
value = pData->param.ranges[k].getNormalizedFixedValue(fParamBuffers[k]);
value = pData->param.ranges[k].getFixedAndNormalizedValue(fParamBuffers[k]);
pData->event.portOut->writeControlEvent(0, channel, kEngineControlEventTypeParameter, param, value);
}
}


+ 1
- 1
source/backend/standalone/CarlaStandalone.cpp View File

@@ -398,7 +398,7 @@ bool carla_engine_init(const char* driverName, const char* clientName)
return false;
}

#ifdef Q_OS_WIN
#ifdef CARLA_OS_WIN
carla_setenv("WINEASIO_CLIENT_NAME", clientName);
#endif



+ 0
- 8
source/carla_backend.py View File

@@ -191,14 +191,6 @@ PARAMETER_PANNING = -7
PARAMETER_CTRL_CHANNEL = -8
PARAMETER_MAX = -9

# Patchbay Icon Type
PATCHBAY_ICON_APPLICATION = 0
PATCHBAY_ICON_HARDWARE = 1
PATCHBAY_ICON_CARLA = 2
PATCHBAY_ICON_DISTRHO = 3
PATCHBAY_ICON_FILE = 4
PATCHBAY_ICON_PLUGIN = 5

# Options Type
OPTION_PROCESS_NAME = 0
OPTION_PROCESS_MODE = 1


+ 11
- 11
source/modules/rtaudio/RtAudio.h View File

@@ -351,7 +351,7 @@ class RtAudio
~RtAudio() throw();

//! Returns the audio API specifier for the current instance of RtAudio.
RtAudio::Api getCurrentApi( void ) throw();
RtAudio::Api getCurrentApi( void ) const throw();

//! A public function that queries for the number of audio devices available.
/*!
@@ -613,7 +613,7 @@ public:

RtApi();
virtual ~RtApi();
virtual RtAudio::Api getCurrentApi( void ) = 0;
virtual RtAudio::Api getCurrentApi( void ) const = 0;
virtual unsigned int getDeviceCount( void ) = 0;
virtual RtAudio::DeviceInfo getDeviceInfo( unsigned int device ) = 0;
virtual unsigned int getDefaultInputDevice( void );
@@ -760,7 +760,7 @@ protected:
//
// **************************************************************** //

inline RtAudio::Api RtAudio :: getCurrentApi( void ) throw() { return rtapi_->getCurrentApi(); }
inline RtAudio::Api RtAudio :: getCurrentApi( void ) const throw() { return rtapi_->getCurrentApi(); }
inline unsigned int RtAudio :: getDeviceCount( void ) throw() { return rtapi_->getDeviceCount(); }
inline RtAudio::DeviceInfo RtAudio :: getDeviceInfo( unsigned int device ) { return rtapi_->getDeviceInfo( device ); }
inline unsigned int RtAudio :: getDefaultInputDevice( void ) throw() { return rtapi_->getDefaultInputDevice(); }
@@ -788,7 +788,7 @@ public:

RtApiCore();
~RtApiCore();
RtAudio::Api getCurrentApi( void ) { return RtAudio::MACOSX_CORE; }
RtAudio::Api getCurrentApi( void ) const { return RtAudio::MACOSX_CORE; }
unsigned int getDeviceCount( void );
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
unsigned int getDefaultOutputDevice( void );
@@ -826,7 +826,7 @@ public:

RtApiJack();
~RtApiJack();
RtAudio::Api getCurrentApi( void ) { return RtAudio::UNIX_JACK; }
RtAudio::Api getCurrentApi( void ) const { return RtAudio::UNIX_JACK; }
unsigned int getDeviceCount( void );
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
void closeStream( void );
@@ -859,7 +859,7 @@ public:

RtApiAsio();
~RtApiAsio();
RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_ASIO; }
RtAudio::Api getCurrentApi( void ) const { return RtAudio::WINDOWS_ASIO; }
unsigned int getDeviceCount( void );
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
void closeStream( void );
@@ -895,7 +895,7 @@ public:

RtApiDs();
~RtApiDs();
RtAudio::Api getCurrentApi( void ) { return RtAudio::WINDOWS_DS; }
RtAudio::Api getCurrentApi( void ) const { return RtAudio::WINDOWS_DS; }
unsigned int getDeviceCount( void );
unsigned int getDefaultOutputDevice( void );
unsigned int getDefaultInputDevice( void );
@@ -934,7 +934,7 @@ public:

RtApiAlsa();
~RtApiAlsa();
RtAudio::Api getCurrentApi() { return RtAudio::LINUX_ALSA; }
RtAudio::Api getCurrentApi() const { return RtAudio::LINUX_ALSA; }
unsigned int getDeviceCount( void );
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
void closeStream( void );
@@ -966,7 +966,7 @@ class RtApiPulse: public RtApi
{
public:
~RtApiPulse();
RtAudio::Api getCurrentApi() { return RtAudio::LINUX_PULSE; }
RtAudio::Api getCurrentApi() const { return RtAudio::LINUX_PULSE; }
unsigned int getDeviceCount( void );
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
void closeStream( void );
@@ -1000,7 +1000,7 @@ public:

RtApiOss();
~RtApiOss();
RtAudio::Api getCurrentApi() { return RtAudio::LINUX_OSS; }
RtAudio::Api getCurrentApi() const { return RtAudio::LINUX_OSS; }
unsigned int getDeviceCount( void );
RtAudio::DeviceInfo getDeviceInfo( unsigned int device );
void closeStream( void );
@@ -1031,7 +1031,7 @@ class RtApiDummy: public RtApi
public:

RtApiDummy() { errorText_ = "RtApiDummy: This class provides no functionality."; error( RtError::WARNING ); }
RtAudio::Api getCurrentApi( void ) { return RtAudio::RTAUDIO_DUMMY; }
RtAudio::Api getCurrentApi( void ) const { return RtAudio::RTAUDIO_DUMMY; }
unsigned int getDeviceCount( void ) { return 0; }
RtAudio::DeviceInfo getDeviceInfo( unsigned int /*device*/ ) { RtAudio::DeviceInfo info; return info; }
void closeStream( void ) {}


Loading…
Cancel
Save