Browse Source

Carla: Fix midi-program changes in lv2-ui bridges

tags/v0.9.0
falkTX 13 years ago
parent
commit
55d5919b21
10 changed files with 79 additions and 57 deletions
  1. +1
    -1
      c++/carla-backend/carla_plugin.h
  2. +1
    -1
      c++/carla-backend/lv2.cpp
  3. +1
    -1
      c++/carla-bridge/carla_bridge.h
  4. +8
    -0
      c++/carla-bridge/carla_bridge_client.h
  5. +1
    -1
      c++/carla-bridge/carla_bridge_osc.cpp
  6. +2
    -5
      c++/carla-bridge/carla_bridge_plugin.cpp
  7. +29
    -29
      c++/carla-bridge/carla_bridge_ui-lv2.cpp
  8. +18
    -18
      c++/carla-bridge/carla_bridge_ui-vst.cpp
  9. +17
    -0
      c++/carla-includes/carla_osc_includes.h
  10. +1
    -1
      src/shared_carla.py

+ 1
- 1
c++/carla-backend/carla_plugin.h View File

@@ -1568,7 +1568,7 @@ public:
if (m_type == PLUGIN_DSSI) if (m_type == PLUGIN_DSSI)
osc_send_program(&osc.data, midiprog.data[midiprog.current].bank, midiprog.data[midiprog.current].program); osc_send_program(&osc.data, midiprog.data[midiprog.current].bank, midiprog.data[midiprog.current].program);
else else
osc_send_midi_program(&osc.data, midiprog.current);
osc_send_midi_program(&osc.data, midiprog.data[midiprog.current].bank, midiprog.data[midiprog.current].program);
} }


for (uint32_t i=0; i < param.count; i++) for (uint32_t i=0; i < param.count; i++)


+ 1
- 1
c++/carla-backend/lv2.cpp View File

@@ -2562,7 +2562,7 @@ public:
if (gui.type == GUI_EXTERNAL_OSC) if (gui.type == GUI_EXTERNAL_OSC)
{ {
if (osc.data.target) if (osc.data.target)
osc_send_program(&osc.data, midiprog.data[index].bank, midiprog.data[index].program);
osc_send_midi_program(&osc.data, midiprog.data[index].bank, midiprog.data[index].program);
} }
else else
#endif #endif


+ 1
- 1
c++/carla-bridge/carla_bridge.h View File

@@ -40,7 +40,7 @@ enum MessageType {
MESSAGE_NULL = 0, MESSAGE_NULL = 0,
MESSAGE_PARAMETER, // index, 0, value MESSAGE_PARAMETER, // index, 0, value
MESSAGE_PROGRAM, // index, 0, 0 MESSAGE_PROGRAM, // index, 0, 0
MESSAGE_MIDI_PROGRAM, // bank, program, 0
MESSAGE_MIDI_PROGRAM, // index, 0, 0 | bank, program, 0
MESSAGE_NOTE_ON, // note, velocity, 0 MESSAGE_NOTE_ON, // note, velocity, 0
MESSAGE_NOTE_OFF, // note, 0, 0 MESSAGE_NOTE_OFF, // note, 0, 0
MESSAGE_SHOW_GUI, // show, 0, 0 MESSAGE_SHOW_GUI, // show, 0, 0


+ 8
- 0
c++/carla-bridge/carla_bridge_client.h View File

@@ -110,7 +110,11 @@ public:
break; break;


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


case MESSAGE_NOTE_ON: case MESSAGE_NOTE_ON:
@@ -165,7 +169,11 @@ public:
// processing // processing
virtual void setParameter(const int32_t rindex, const double value) = 0; virtual void setParameter(const int32_t rindex, const double value) = 0;
virtual void setProgram(const uint32_t index) = 0; virtual void setProgram(const uint32_t index) = 0;
#ifdef BUILD_BRIDGE_PLUGIN
virtual void setMidiProgram(const uint32_t index) = 0;
#else
virtual void setMidiProgram(const uint32_t bank, const uint32_t program) = 0; virtual void setMidiProgram(const uint32_t bank, const uint32_t program) = 0;
#endif
virtual void noteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) = 0; 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; virtual void noteOff(const uint8_t channel, const uint8_t note) = 0;




+ 1
- 1
c++/carla-bridge/carla_bridge_osc.cpp View File

@@ -261,7 +261,7 @@ int CarlaOsc::handleMsgMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS)


#ifdef BUILD_BRIDGE_PLUGIN #ifdef BUILD_BRIDGE_PLUGIN
const int32_t index = argv[0]->i; const int32_t index = argv[0]->i;
client->quequeMessage(MESSAGE_MIDI_PROGRAM, index, -1, 0.0);
client->quequeMessage(MESSAGE_MIDI_PROGRAM, index, 0, 0.0);
#else #else
const int32_t bank = argv[0]->i; const int32_t bank = argv[0]->i;
const int32_t program = argv[1]->i; const int32_t program = argv[1]->i;


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

@@ -137,17 +137,14 @@ public:
} }
} }


void setMidiProgram(const uint32_t index, const uint32_t test)
void setMidiProgram(const uint32_t index)
{ {
qDebug("CarlaPluginClient::setMidiProgram(%i, %i)", index, test);
qDebug("CarlaPluginClient::setMidiProgram(%i)", index);
Q_ASSERT(engine); Q_ASSERT(engine);
Q_ASSERT(plugin); Q_ASSERT(plugin);
Q_ASSERT(test == -1);


if (! (plugin && engine)) if (! (plugin && engine))
return; return;
if (test != -1)
return;


plugin->setMidiProgram(index, true, true, false, true); plugin->setMidiProgram(index, true, true, false, true);




+ 29
- 29
c++/carla-bridge/carla_bridge_ui-lv2.cpp View File

@@ -327,10 +327,36 @@ public:
libClose(); libClose();
} }


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

void* getWidget() const
{
#ifdef BRIDGE_LV2_X11
return x11_widget;
#else
return widget;
#endif
}

bool isResizable() const
{
return m_resizable;
}

bool needsReparent() const
{
#ifdef BRIDGE_LV2_X11
return true;
#else
return false;
#endif
}

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


void setParameter(int32_t rindex, double value)
void setParameter(const int32_t rindex, const double value)
{ {
Q_ASSERT(handle && descriptor); Q_ASSERT(handle && descriptor);


@@ -341,11 +367,11 @@ public:
} }
} }


void setProgram(uint32_t)
void setProgram(const uint32_t)
{ {
} }


void setMidiProgram(uint32_t bank, uint32_t program)
void setMidiProgram(const uint32_t bank, const uint32_t program)
{ {
Q_ASSERT(handle); Q_ASSERT(handle);


@@ -375,32 +401,6 @@ public:
} }
} }


// ---------------------------------------------------------------------
// gui

void* getWidget() const
{
#ifdef BRIDGE_LV2_X11
return x11_widget;
#else
return widget;
#endif
}

bool isResizable() const
{
return m_resizable;
}

bool needsReparent() const
{
#ifdef BRIDGE_LV2_X11
return true;
#else
return false;
#endif
}

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


uint32_t getCustomURID(const char* const uri) uint32_t getCustomURID(const char* const uri)


+ 18
- 18
c++/carla-bridge/carla_bridge_ui-vst.cpp View File

@@ -145,6 +145,24 @@ public:
} }
} }


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

void* getWidget() const
{
return widget;
}

bool isResizable() const
{
return false;
}

bool needsReparent() const
{
return true;
}

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


@@ -172,24 +190,6 @@ public:
{ {
} }


// ---------------------------------------------------------------------
// gui

void* getWidget() const
{
return widget;
}

bool isResizable() const
{
return false;
}

bool needsReparent() const
{
return true;
}

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


void handleAudioMasterAutomate(const uint32_t index, const float value) void handleAudioMasterAutomate(const uint32_t index, const float value)


+ 17
- 0
c++/carla-includes/carla_osc_includes.h View File

@@ -134,6 +134,23 @@ void osc_send_midi_program(const CarlaOscData* const oscData, const int32_t inde
} }
} }


static inline
void osc_send_midi_program(const CarlaOscData* const oscData, const int32_t bank, const int32_t program)
{
Q_ASSERT(oscData && oscData->path);
Q_ASSERT(program >= 0 && program < 128);
Q_ASSERT(bank >= 0);
qDebug("osc_send_midi_program(path:\"%s\", %i, %i)", oscData->path, bank, program);

if (oscData->target)
{
char targetPath[strlen(oscData->path)+14];
strcpy(targetPath, oscData->path);
strcat(targetPath, "/midi_program");
lo_send(oscData->target, targetPath, "ii", bank, program);
}
}

static inline static inline
void osc_send_midi(const CarlaOscData* const oscData, const uint8_t buf[4]) void osc_send_midi(const CarlaOscData* const oscData, const uint8_t buf[4])
{ {


+ 1
- 1
src/shared_carla.py View File

@@ -1667,7 +1667,7 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget):


def loadStateDict(self, content): def loadStateDict(self, content):
# --------------------------------------------------------------------- # ---------------------------------------------------------------------
# Part 1 - set custom data (non-binary/chunks)
# Part 1 - set custom data (except binary/chunks)


for customData in content['CustomData']: for customData in content['CustomData']:
if customData['type'] not in (CUSTOM_DATA_BINARY, CUSTOM_DATA_CHUNK): if customData['type'] not in (CUSTOM_DATA_BINARY, CUSTOM_DATA_CHUNK):


Loading…
Cancel
Save