, _midi_thru_item (0)
, default_channel_menu (0)
, controller_menu (0)
+ , _step_editor (0)
{
subplugin_menu.set_name ("ArdourContextMenu");
/* ask for notifications of any new RegionViews */
_view->RegionViewAdded.connect (sigc::mem_fun(*this, &MidiTimeAxisView::region_view_added));
- _view->attach ();
-
+
+ if (!_editor.have_idled()) {
+ /* first idle will do what we need */
+ } else {
+ first_idle ();
+ }
}
HBox* midi_controls_hbox = manage(new HBox());
}
}
+void
+MidiTimeAxisView::first_idle ()
+{
+ if (is_track ()) {
+ _view->attach ();
+ }
+}
+
MidiTimeAxisView::~MidiTimeAxisView ()
{
delete _piano_roll_header;
automation_items.push_back (SeparatorElem());
- /* these 3 MIDI "command" types are semantically more like automation than note data,
+ /* these 2 MIDI "command" types are semantically more like automation than note data,
but they are not MIDI controllers. We give them special status in this menu, since
they will not show up in the controller list and anyone who actually knows
something about MIDI (!) would not expect to find them there.
*/
- add_channel_command_menu_item (automation_items, _("Program Change"), MidiPgmChangeAutomation, 0);
add_channel_command_menu_item (automation_items, _("Bender"), MidiPitchBenderAutomation, 0);
add_channel_command_menu_item (automation_items, _("Pressure"), MidiChannelPressureAutomation, 0);
}
}
- /* loop over all 127 MIDI controllers, in groups of 16 */
+ /* loop over all 127 MIDI controllers, in groups of 16; except don't offer
+ bank select controllers, as they are handled by the `patch' code */
for (int i = 0; i < 127; i += 16) {
for (int ctl = i; ctl < i+16; ++ctl) {
+ if (ctl == MIDI_CTL_MSB_BANK || ctl == MIDI_CTL_LSB_BANK) {
+ continue;
+ }
+
if (chn_cnt > 1) {
/* multiple channels - create a submenu, with 1 item per channel */
void
MidiTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool show)
{
- /* These controllers are region "automation", so we do not create
- * an AutomationList/Line for the track */
-
if (param.type() == NullAutomation) {
cerr << "WARNING: Attempt to create NullAutomation child, ignoring" << endl;
return;
}
-
+
AutomationTracks::iterator existing = _automation_tracks.find (param);
if (existing != _automation_tracks.end()) {
return;
}
-
- boost::shared_ptr<AutomationControl> c = _route->get_control (param);
-
- assert(c);
-
- boost::shared_ptr<AutomationTimeAxisView> track(new AutomationTimeAxisView (_session,
- _route, boost::shared_ptr<ARDOUR::Automatable>(), c,
- _editor,
- *this,
- true,
- parent_canvas,
- _route->describe_parameter(param)));
-
- add_automation_child (param, track, show);
+
+ if (param.type() == GainAutomation) {
+ create_gain_automation_child (param, show);
+ } else {
+
+ /* These controllers are region "automation", so we do not create
+ * an AutomationList/Line for the track */
+
+ boost::shared_ptr<AutomationControl> c = _route->get_control (param);
+ assert (c);
+
+ boost::shared_ptr<AutomationTimeAxisView> track(new AutomationTimeAxisView (_session,
+ _route, boost::shared_ptr<ARDOUR::Automatable>(), c,
+ _editor,
+ *this,
+ true,
+ parent_canvas,
+ _route->describe_parameter(param)));
+
+ add_automation_child (param, track, show);
+ }
}
no_redraw = false;
- /* TODO: Bender, PgmChange, Pressure */
+ /* TODO: Bender, Pressure */
/* invalidate the controller menu, so that we rebuilt it next time */
_controller_menu_map.clear ();
}
boost::shared_ptr<MidiRegion>
-MidiTimeAxisView::add_region (framepos_t pos)
+MidiTimeAxisView::add_region (framepos_t pos, framecnt_t length, bool commit)
{
Editor* real_editor = dynamic_cast<Editor*> (&_editor);
real_editor->begin_reversible_command (_("create region"));
- playlist()->clear_history ();
+ playlist()->clear_changes ();
real_editor->snap_to (pos, 0);
- const Meter& m = _session->tempo_map().meter_at(pos);
- const Tempo& t = _session->tempo_map().tempo_at(pos);
- double length = floor (m.frames_per_bar(t, _session->frame_rate()));
-
+
boost::shared_ptr<Source> src = _session->create_midi_source_for_session (view()->trackview().track().get(),
view()->trackview().track()->name());
PropertyList plist;
playlist()->add_region (region, pos);
_session->add_command (new StatefulDiffCommand (playlist()));
- real_editor->commit_reversible_command();
+ if (commit) {
+ real_editor->commit_reversible_command ();
+ }
return boost::dynamic_pointer_cast<MidiRegion>(region);
}