mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
Some work towards MIDI plugins (LV2 plugins with (MIDI supporting) event ports shown in plugin selector).
git-svn-id: svn://localhost/ardour2/branches/3.0@3092 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
a2a6cc0404
commit
68bfed0a46
5 changed files with 60 additions and 19 deletions
|
|
@ -362,7 +362,7 @@ MidiRegionView::create_note_at(double x, double y, double dur)
|
|||
//double dur = m.frames_per_bar(t, trackview.session().frame_rate()) / m.beats_per_bar();
|
||||
|
||||
// Add a 1 beat long note (for now)
|
||||
const boost::shared_ptr<Note> new_note(new Note(stamp, dur, (uint8_t)note, 0x40));
|
||||
const boost::shared_ptr<Note> new_note(new Note(0, stamp, dur, (uint8_t)note, 0x40));
|
||||
|
||||
view->update_bounds(new_note->note());
|
||||
|
||||
|
|
|
|||
|
|
@ -71,8 +71,10 @@ PluginSelector::PluginSelector (PluginManager *mgr)
|
|||
plugin_display.append_column (_("Type"), plugin_columns.type_name);
|
||||
plugin_display.append_column (_("Category"), plugin_columns.category);
|
||||
plugin_display.append_column (_("Creator"), plugin_columns.creator);
|
||||
plugin_display.append_column (_("# Inputs"),plugin_columns.ins);
|
||||
plugin_display.append_column (_("# Outputs"), plugin_columns.outs);
|
||||
plugin_display.append_column (_("# Audio In"),plugin_columns.audio_ins);
|
||||
plugin_display.append_column (_("# Audio Out"), plugin_columns.audio_outs);
|
||||
plugin_display.append_column (_("# MIDI In"),plugin_columns.midi_ins);
|
||||
plugin_display.append_column (_("# MIDI Out"), plugin_columns.midi_outs);
|
||||
plugin_display.set_headers_visible (true);
|
||||
plugin_display.set_headers_clickable (true);
|
||||
plugin_display.set_reorderable (false);
|
||||
|
|
@ -86,7 +88,7 @@ PluginSelector::PluginSelector (PluginManager *mgr)
|
|||
added_list.set_headers_visible (true);
|
||||
added_list.set_reorderable (false);
|
||||
|
||||
for (int i = 0; i <=3; i++) {
|
||||
for (int i = 0; i <=7; i++) {
|
||||
Gtk::TreeView::Column* column = plugin_display.get_column(i);
|
||||
column->set_sort_column(i);
|
||||
}
|
||||
|
|
@ -258,16 +260,22 @@ PluginSelector::refiller (const PluginInfoList& plugs, const::std::string& filte
|
|||
newrow[plugin_columns.creator] = creator;
|
||||
|
||||
if ((*i)->n_inputs.n_total() < 0) {
|
||||
newrow[plugin_columns.ins] = "various";
|
||||
newrow[plugin_columns.audio_ins] = "various";
|
||||
newrow[plugin_columns.midi_ins] = "various";
|
||||
} else {
|
||||
snprintf (buf, sizeof(buf), "%d", (*i)->n_inputs.n_total());
|
||||
newrow[plugin_columns.ins] = buf;
|
||||
snprintf (buf, sizeof(buf), "%d", (*i)->n_inputs.n_audio());
|
||||
newrow[plugin_columns.audio_ins] = buf;
|
||||
snprintf (buf, sizeof(buf), "%d", (*i)->n_inputs.n_midi());
|
||||
newrow[plugin_columns.midi_ins] = buf;
|
||||
}
|
||||
if ((*i)->n_outputs.n_total() < 0) {
|
||||
newrow[plugin_columns.outs] = "various";
|
||||
newrow[plugin_columns.audio_outs] = "various";
|
||||
newrow[plugin_columns.midi_outs] = "various";
|
||||
} else {
|
||||
snprintf (buf, sizeof(buf), "%d", (*i)->n_outputs.n_total());
|
||||
newrow[plugin_columns.outs] = buf;
|
||||
snprintf (buf, sizeof(buf), "%d", (*i)->n_outputs.n_audio());
|
||||
newrow[plugin_columns.audio_outs] = buf;
|
||||
snprintf (buf, sizeof(buf), "%d", (*i)->n_outputs.n_midi());
|
||||
newrow[plugin_columns.midi_outs] = buf;
|
||||
}
|
||||
|
||||
newrow[plugin_columns.plugin] = *i;
|
||||
|
|
|
|||
|
|
@ -61,16 +61,20 @@ class PluginSelector : public ArdourDialog
|
|||
add (type_name);
|
||||
add (category);
|
||||
add (creator);
|
||||
add (ins);
|
||||
add (outs);
|
||||
add (audio_ins);
|
||||
add (audio_outs);
|
||||
add (midi_ins);
|
||||
add (midi_outs);
|
||||
add (plugin);
|
||||
}
|
||||
Gtk::TreeModelColumn<std::string> name;
|
||||
Gtk::TreeModelColumn<std::string> type_name;
|
||||
Gtk::TreeModelColumn<std::string> category;
|
||||
Gtk::TreeModelColumn<std::string> creator;
|
||||
Gtk::TreeModelColumn<std::string> ins;
|
||||
Gtk::TreeModelColumn<std::string> outs;
|
||||
Gtk::TreeModelColumn<std::string> audio_ins;
|
||||
Gtk::TreeModelColumn<std::string> audio_outs;
|
||||
Gtk::TreeModelColumn<std::string> midi_ins;
|
||||
Gtk::TreeModelColumn<std::string> midi_outs;
|
||||
Gtk::TreeModelColumn<ARDOUR::PluginInfoPtr> plugin;
|
||||
};
|
||||
PluginColumns plugin_columns;
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ class LV2Plugin : public ARDOUR::Plugin
|
|||
|
||||
bool parameter_is_audio(uint32_t) const;
|
||||
bool parameter_is_control(uint32_t) const;
|
||||
bool parameter_is_midi(uint32_t) const;
|
||||
bool parameter_is_input(uint32_t) const;
|
||||
bool parameter_is_output(uint32_t) const;
|
||||
bool parameter_is_toggled(uint32_t) const;
|
||||
|
|
@ -138,11 +139,12 @@ struct LV2World {
|
|||
~LV2World();
|
||||
|
||||
SLV2World world;
|
||||
SLV2Value input_class;
|
||||
SLV2Value output_class;
|
||||
SLV2Value audio_class;
|
||||
SLV2Value control_class;
|
||||
SLV2Value event_class;
|
||||
SLV2Value input_class; ///< Input port
|
||||
SLV2Value output_class; ///< Output port
|
||||
SLV2Value audio_class; ///< Audio port
|
||||
SLV2Value control_class; ///< Control port
|
||||
SLV2Value event_class; ///< Event port
|
||||
SLV2Value midi_class; ///< MIDI event
|
||||
SLV2Value in_place_broken;
|
||||
SLV2Value integer;
|
||||
SLV2Value toggled;
|
||||
|
|
|
|||
|
|
@ -389,6 +389,23 @@ LV2Plugin::connect_and_run (BufferSet& bufs, uint32_t& in_index, uint32_t& out_i
|
|||
bufs.get_audio(index).data(nframes, offset));
|
||||
out_index++;
|
||||
}
|
||||
} else if (parameter_is_midi(port_index)) {
|
||||
// FIXME: Switch MIDI buffer format to LV2 event buffer
|
||||
if (parameter_is_input(port_index)) {
|
||||
//const size_t index = min(in_index, nbufs - 1);
|
||||
//slv2_instance_connect_port(_instance, port_index,
|
||||
// bufs.get_midi(index).data(nframes, offset));
|
||||
// FIXME: hope it's connection optional...
|
||||
slv2_instance_connect_port(_instance, port_index, NULL);
|
||||
in_index++;
|
||||
} else if (parameter_is_output(port_index)) {
|
||||
//const size_t index = min(out_index,nbufs - 1);
|
||||
//slv2_instance_connect_port(_instance, port_index,
|
||||
// bufs.get_midi(index).data(nframes, offset));
|
||||
// FIXME: hope it's connection optional...
|
||||
slv2_instance_connect_port(_instance, port_index, NULL);
|
||||
out_index++;
|
||||
}
|
||||
}
|
||||
port_index++;
|
||||
}
|
||||
|
|
@ -414,6 +431,14 @@ LV2Plugin::parameter_is_audio (uint32_t param) const
|
|||
return slv2_port_is_a(_plugin, port, _world.audio_class);
|
||||
}
|
||||
|
||||
bool
|
||||
LV2Plugin::parameter_is_midi (uint32_t param) const
|
||||
{
|
||||
SLV2Port port = slv2_plugin_get_port_by_index(_plugin, param);
|
||||
return slv2_port_is_a(_plugin, port, _world.event_class)
|
||||
&& slv2_port_supports_event(_plugin, port, _world.midi_class);
|
||||
}
|
||||
|
||||
bool
|
||||
LV2Plugin::parameter_is_output (uint32_t param) const
|
||||
{
|
||||
|
|
@ -505,6 +530,7 @@ LV2World::LV2World()
|
|||
control_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_CONTROL);
|
||||
audio_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_AUDIO);
|
||||
event_class = slv2_value_new_uri(world, SLV2_PORT_CLASS_EVENT);
|
||||
midi_class = slv2_value_new_uri(world, SLV2_EVENT_CLASS_MIDI);
|
||||
in_place_broken = slv2_value_new_uri(world, SLV2_NAMESPACE_LV2 "inPlaceBroken");
|
||||
integer = slv2_value_new_uri(world, SLV2_NAMESPACE_LV2 "integer");
|
||||
toggled = slv2_value_new_uri(world, SLV2_NAMESPACE_LV2 "toggled");
|
||||
|
|
@ -518,6 +544,7 @@ LV2World::~LV2World()
|
|||
slv2_value_free(control_class);
|
||||
slv2_value_free(audio_class);
|
||||
slv2_value_free(event_class);
|
||||
slv2_value_free(midi_class);
|
||||
slv2_value_free(in_place_broken);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue