Browse Source

Carla VST work, fixes

tags/v0.9.0
falkTX 13 years ago
parent
commit
8cde6bcdc9
5 changed files with 1078 additions and 16 deletions
  1. +6
    -4
      src/carla/carla_plugin.h
  2. +18
    -7
      src/carla/dssi.cpp
  3. +6
    -0
      src/carla/ladspa.cpp
  4. +19
    -2
      src/carla/sf2.cpp
  5. +1029
    -3
      src/carla/vst.cpp

+ 6
- 4
src/carla/carla_plugin.h View File

@@ -33,6 +33,8 @@
#include <QtCore/QMutex>
#include <QtCore/QString>

// TODO - check and try '#ifndef BUILD_BRIDGE' in all global_jack_client

#define CARLA_PROCESS_CONTINUE_CHECK if (m_id != plugin_id) { return callback_action(CALLBACK_DEBUG, plugin_id, m_id, 0, 0.0); }

const unsigned short MAX_POST_EVENTS = 128;
@@ -652,7 +654,7 @@ public:
{
}

virtual void set_program(uint32_t index, bool, bool osc_send, bool callback_send, bool)
virtual void set_program(int32_t index, bool, bool osc_send, bool callback_send, bool)
{
prog.current = index;

@@ -683,7 +685,7 @@ public:
callback_action(CALLBACK_PROGRAM_CHANGED, m_id, prog.current, 0, 0.0);
}

virtual void set_midi_program(uint32_t index, bool, bool osc_send, bool callback_send, bool)
virtual void set_midi_program(int32_t index, bool, bool osc_send, bool callback_send, bool)
{
midiprog.current = index;

@@ -754,11 +756,11 @@ public:
callback_action(onoff ? CALLBACK_NOTE_ON : CALLBACK_NOTE_OFF, m_id, note, velo, 0.0);
}

virtual void set_gui_data(int, void*)
virtual void set_gui_data(int /*data*/, void* /*ptr*/)
{
}

virtual void show_gui(bool)
virtual void show_gui(bool /*yesno*/)
{
}



+ 18
- 7
src/carla/dssi.cpp View File

@@ -211,20 +211,23 @@ public:
descriptor->set_custom_data(handle, chunk.data(), chunk.size());
}

virtual void set_midi_program(uint32_t index, bool gui_send, bool osc_send, bool callback_send, bool block)
virtual void set_midi_program(int32_t index, bool gui_send, bool osc_send, bool callback_send, bool block)
{
if (! descriptor->select_program)
return;

// TODO - go for id -1 so we don't block audio
if (block) carla_proc_lock();
descriptor->select_program(handle, midiprog.data[index].bank, midiprog.data[index].program);
if (block) carla_proc_unlock();
if (index >= 0)
{
// TODO - go for id -1 so we don't block audio
if (block) carla_proc_lock();
descriptor->select_program(handle, midiprog.data[index].bank, midiprog.data[index].program);
if (block) carla_proc_unlock();

#ifndef BUILD_BRIDGE
if (gui_send)
osc_send_program_as_midi(&osc.data, midiprog.data[index].bank, midiprog.data[index].program);
if (gui_send)
osc_send_program_as_midi(&osc.data, midiprog.data[index].bank, midiprog.data[index].program);
#endif
}

CarlaPlugin::set_midi_program(index, gui_send, osc_send, callback_send, block);
}
@@ -315,6 +318,7 @@ public:

if (LADSPA_IS_PORT_AUDIO(PortType))
{
#ifndef BUILD_BRIDGE
if (carla_options.global_jack_client)
{
strcpy(port_name, m_name);
@@ -322,6 +326,7 @@ public:
strncat(port_name, ldescriptor->PortNames[i], port_name_size/2);
}
else
#endif
strncpy(port_name, ldescriptor->PortNames[i], port_name_size/2);

if (LADSPA_IS_PORT_INPUT(PortType))
@@ -530,12 +535,14 @@ public:

if (needs_cin)
{
#ifndef BUILD_BRIDGE
if (carla_options.global_jack_client)
{
strcpy(port_name, m_name);
strcat(port_name, ":control-in");
}
else
#endif
strcpy(port_name, "control-in");

param.port_cin = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0);
@@ -543,12 +550,14 @@ public:

if (needs_cout)
{
#ifndef BUILD_BRIDGE
if (carla_options.global_jack_client)
{
strcpy(port_name, m_name);
strcat(port_name, ":control-out");
}
else
#endif
strcpy(port_name, "control-out");

param.port_cout = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0);
@@ -556,12 +565,14 @@ public:

if (mins == 1)
{
#ifndef BUILD_BRIDGE
if (carla_options.global_jack_client)
{
strcpy(port_name, m_name);
strcat(port_name, ":midi-in");
}
else
#endif
strcpy(port_name, "midi-in");

midi.port_min = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0);


+ 6
- 0
src/carla/ladspa.cpp View File

@@ -335,6 +335,7 @@ public:

if (LADSPA_IS_PORT_AUDIO(PortType))
{
#ifndef BUILD_BRIDGE
if (carla_options.global_jack_client)
{
strcpy(port_name, m_name);
@@ -342,6 +343,7 @@ public:
strncat(port_name, descriptor->PortNames[i], port_name_size/2);
}
else
#endif
strncpy(port_name, descriptor->PortNames[i], port_name_size/2);

if (LADSPA_IS_PORT_INPUT(PortType))
@@ -549,12 +551,14 @@ public:

if (needs_cin)
{
#ifndef BUILD_BRIDGE
if (carla_options.global_jack_client)
{
strcpy(port_name, m_name);
strcat(port_name, ":control-in");
}
else
#endif
strcpy(port_name, "control-in");

param.port_cin = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0);
@@ -562,12 +566,14 @@ public:

if (needs_cout)
{
#ifndef BUILD_BRIDGE
if (carla_options.global_jack_client)
{
strcpy(port_name, m_name);
strcat(port_name, ":control-out");
}
else
#endif
strcpy(port_name, "control-out");

param.port_cout = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0);


+ 19
- 2
src/carla/sf2.cpp View File

@@ -15,6 +15,10 @@
* For a full copy of the GNU General Public License see the COPYING file
*/

#ifdef BUILD_BRIDGE
#error You should not use bridge for soundfonts
#endif

#include "carla_plugin.h"

#include <fluidsynth.h>
@@ -261,9 +265,10 @@ public:
CarlaPlugin::set_parameter_value(param_id, value, gui_send, osc_send, callback_send);
}

virtual void set_midi_program(uint32_t index, bool gui_send, bool osc_send, bool callback_send, bool block)
virtual void set_midi_program(int32_t index, bool gui_send, bool osc_send, bool callback_send, bool block)
{
fluid_synth_program_select(f_synth, 0, f_id, midiprog.data[index].bank, midiprog.data[index].program);
if (index >= 0)
fluid_synth_program_select(f_synth, 0, f_id, midiprog.data[index].bank, midiprog.data[index].program);

CarlaPlugin::set_midi_program(index, gui_send, osc_send, callback_send, block);
}
@@ -1033,6 +1038,18 @@ public:
m_active_before = m_active;
}

virtual void delete_buffers()
{
qDebug("Sf2Plugin::delete_buffers() - start");

if (param.count > 0)
delete[] param_buffers;

param_buffers = nullptr;

qDebug("Sf2Plugin::delete_buffers() - end");
}

bool init(const char* filename, const char* label)
{
f_id = fluid_synth_sfload(f_synth, filename, 0);


+ 1029
- 3
src/carla/vst.cpp
File diff suppressed because it is too large
View File


Loading…
Cancel
Save