Browse Source

More cleanup

tags/v0.9.0
falkTX 12 years ago
parent
commit
fa394ab731
4 changed files with 52 additions and 101 deletions
  1. +0
    -1
      c++/carla-backend/carla_backend_utils.hpp
  2. +18
    -96
      c++/carla-bridge/carla_bridge_client.hpp
  3. +23
    -2
      c++/carla-bridge/carla_bridge_plugin.cpp
  4. +11
    -2
      c++/carla-engine/jack.cpp

+ 0
- 1
c++/carla-backend/carla_backend_utils.hpp View File

@@ -367,7 +367,6 @@ uintptr_t getAddressFromPointer(void* const ptr)
static inline
void* getPointerFromAddress(const uintptr_t& addr)
{
qDebug("CarlaBackend::getPointerFromAddress(" P_UINTPTR ")", addr);
CARLA_ASSERT(addr != 0);

uintptr_t** const ptr = (uintptr_t**)&addr;


+ 18
- 96
c++/carla-bridge/carla_bridge_client.hpp View File

@@ -42,15 +42,17 @@ CARLA_BRIDGE_START_NAMESPACE
* @{
*/

class CarlaClient
{
public:
CarlaClient(CarlaToolkit* const toolkit)
#ifdef BUILD_BRIDGE_PLUGIN
: m_osc(this, "carla-bridge-plugin"),
const char* const carlaClientName = "carla-bridge-plugin";
#else
: m_osc(this, "carla-bridge-ui"),
const char* const carlaClientName = "carla-bridge-ui";
#endif

class CarlaClient
{
public:
CarlaClient(CarlaToolkit* const toolkit)
: m_osc(this, carlaClientName),
m_toolkit(toolkit)
{
#ifdef BUILD_BRIDGE_UI
@@ -70,97 +72,9 @@ class CarlaClient
}

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

#if 0
void quequeMessage(const MessageType type, const int32_t value1, const int32_t value2, const double value3)
{
const QMutexLocker locker(&m_messages.lock);

for (unsigned int i=0; i < MAX_BRIDGE_MESSAGES; i++)
{
Message* const m = &m_messages.data[i];

if (m->type == MESSAGE_NULL)
{
m->type = type;
m->value1 = value1;
m->value2 = value2;
m->value3 = value3;
break;
}
}
}

bool runMessages()
{
const QMutexLocker locker(&m_messages.lock);

for (unsigned int i=0; i < MAX_BRIDGE_MESSAGES; i++)
{
Message* const m = &m_messages.data[i];

switch (m->type)
{
case MESSAGE_NULL:
return true;

case MESSAGE_PARAMETER:
setParameter(m->value1, m->value3);
break;

case MESSAGE_PROGRAM:
setProgram(m->value1);
break;

case MESSAGE_MIDI_PROGRAM:
#ifdef BUILD_BRIDGE_PLUGIN
setMidiProgram(m->value1);
#else
setMidiProgram(m->value1, m->value2);
#endif
break;

case MESSAGE_NOTE_ON:
noteOn(m->value1, m->value2, rint(m->value3));
break;

case MESSAGE_NOTE_OFF:
noteOff(m->value1, m->value2);
break;

case MESSAGE_SHOW_GUI:
if (m->value1)
m_toolkit->show();
else
m_toolkit->hide();
break;

case MESSAGE_RESIZE_GUI:
m_toolkit->resize(m->value1, m->value2);
break;

case MESSAGE_SAVE_NOW:
#ifdef BUILD_BRIDGE_PLUGIN
saveNow();
#endif
break;

case MESSAGE_QUIT:
m_toolkit->quit();
return false;
}

m->type = MESSAGE_NULL;
}

return true;
}
#endif

// ---------------------------------------------------------------------
// ui initialization

#ifdef BUILD_BRIDGE_UI
// ui initialization
virtual bool init(const char* const, const char* const)
{
m_quit = false;
@@ -175,14 +89,20 @@ class CarlaClient
sendOscExiting();
}
}
#endif

// ---------------------------------------------------------------------
// ui management

#ifdef BUILD_BRIDGE_UI
virtual void* getWidget() const = 0;
virtual bool isResizable() const = 0;
virtual bool needsReparent() const = 0;
#endif

// ---------------------------------------------------------------------
// processing

virtual void setParameter(const int32_t rindex, const double value) = 0;
virtual void setProgram(const uint32_t index) = 0;
#ifdef BUILD_BRIDGE_PLUGIN
@@ -194,8 +114,10 @@ class CarlaClient
virtual void noteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) = 0;
virtual void noteOff(const uint8_t channel, const uint8_t note) = 0;

#ifdef BUILD_BRIDGE_PLUGIN
// ---------------------------------------------------------------------
// plugin

#ifdef BUILD_BRIDGE_PLUGIN
virtual void saveNow() = 0;
virtual void setCustomData(const char* const type, const char* const key, const char* const value) = 0;
virtual void setChunkData(const char* const filePath) = 0;


+ 23
- 2
c++/carla-bridge/carla_bridge_plugin.cpp View File

@@ -192,9 +192,13 @@ protected:
qDebug("BridgePluginGUI::closeEvent(%p)", event);

if (event->spontaneous())
{
callback->guiClosedCallback();
QMainWindow::closeEvent(event);
return;
}

QMainWindow::closeEvent(event);
event->ignore();
}

private:
@@ -232,6 +236,10 @@ public:
pluginGui = nullptr;

m_client = this;

m_needsResize = false;
m_nextSize[0] = 0;
m_nextSize[1] = 0;
}

~BridgePluginClient()
@@ -592,7 +600,11 @@ public:
CARLA_ASSERT(pluginGui);

if (value1 > 0 && value2 > 0 && pluginGui)
pluginGui->setNewSize(value1, value2);
{
m_needsResize = true;
m_nextSize[0] = value1;
m_nextSize[1] = value2;
}

break;

@@ -657,6 +669,12 @@ protected:

if (plugin)
plugin->idleGui();

if (pluginGui && m_needsResize)
{
pluginGui->setNewSize(m_nextSize[0], m_nextSize[1]);
m_needsResize = false;
}
}
else if (event->timerId() == msgTimerOSC)
{
@@ -680,6 +698,9 @@ private:
std::set<int32_t> parametersToUpdate;
#endif

bool m_needsResize;
int m_nextSize[2];

CarlaBackend::CarlaEngine* engine;
CarlaBackend::CarlaPlugin* plugin;



+ 11
- 2
c++/carla-engine/jack.cpp View File

@@ -473,7 +473,9 @@ public:

memset(&m_pos, 0, sizeof(jack_position_t));

#ifndef BUILD_BRIDGE
#ifdef BUILD_BRIDGE
hasQuit = false;
#else
# ifndef Q_COMPILER_INITIALIZER_LISTS
for (int i=0; i < rackPortCount; i++)
m_rackPorts[i] = nullptr;
@@ -580,6 +582,7 @@ public:
CarlaEngine::close();

#ifdef BUILD_BRIDGE
hasQuit = true;
m_client = nullptr;
return true;
#else
@@ -620,7 +623,11 @@ public:

bool isRunning() const
{
#ifdef BUILD_BRIDGE
return bool(m_client || ! hasQuit);
#else
return bool(m_client);
#endif
}

CarlaEngineType type() const
@@ -957,7 +964,9 @@ private:

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

#ifndef BUILD_BRIDGE
#ifdef BUILD_BRIDGE
bool hasQuit;
#else
enum RackPorts {
rackPortAudioIn1 = 0,
rackPortAudioIn2 = 1,


Loading…
Cancel
Save