do not create an empty region for a cue slot when it is selected for editing
There's an assumption that slots with regions cannot be recorded into, so adding a region to an empty slot makes it impossible to record to that slot. Create the region at the appropriate point during a NoteCreateDrag. This may also be needed for some automation drawing drag operations.
This commit is contained in:
@@ -481,6 +481,7 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider,
|
||||
void set_loop_range (Temporal::timepos_t const & start, Temporal::timepos_t const & end, std::string cmd);
|
||||
|
||||
virtual bool allow_trim_cursors () const;
|
||||
virtual void make_a_region() {}
|
||||
|
||||
protected:
|
||||
std::string _name;
|
||||
|
||||
@@ -6853,6 +6853,11 @@ NoteCreateDrag::finished (GdkEvent* ev, bool had_movement)
|
||||
|
||||
Beats start;
|
||||
|
||||
if (!_midi_view->midi_region()) {
|
||||
editing_context.make_a_region ();
|
||||
assert (_midi_view->midi_region());
|
||||
}
|
||||
|
||||
if (_midi_view->show_source()) {
|
||||
Beats spos = _midi_view->midi_region()->source_position().beats() + min (_note[0], _note[1]).beats();
|
||||
start = _midi_view->midi_region ()->absolute_time_to_source_beats (timepos_t (spos));
|
||||
@@ -6914,6 +6919,11 @@ HitCreateDrag::finished (GdkEvent* event, bool had_movement)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_midi_view->midi_region()) {
|
||||
editing_context.make_a_region ();
|
||||
assert (_midi_view->midi_region());
|
||||
}
|
||||
|
||||
std::shared_ptr<MidiRegion> mr = _midi_view->midi_region ();
|
||||
|
||||
timepos_t pos (_drags->current_pointer_time ());
|
||||
|
||||
@@ -2451,35 +2451,41 @@ Pianoroll::set (TriggerReference & tref)
|
||||
|
||||
std::shared_ptr<MidiRegion> mr;
|
||||
|
||||
if (!ref.trigger()->the_region()) {
|
||||
|
||||
std::shared_ptr<MidiSource> new_source = _session->create_midi_source_for_session (_track->name());
|
||||
SourceList sources;
|
||||
sources.push_back (new_source);
|
||||
|
||||
PropertyList plist;
|
||||
plist.add (ARDOUR::Properties::start, timepos_t (Temporal::Beats ()));
|
||||
plist.add (ARDOUR::Properties::length, timepos_t (Temporal::Beats::beats (32)));
|
||||
plist.add (ARDOUR::Properties::name, new_source->name());
|
||||
plist.add (ARDOUR::Properties::whole_file, true);
|
||||
|
||||
mr = std::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (sources, plist, true));
|
||||
|
||||
plist.remove (ARDOUR::Properties::whole_file);
|
||||
mr = std::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (mr, timecnt_t::zero (Temporal::BeatTime), plist, true));
|
||||
|
||||
ref.trigger()->set_region (mr);
|
||||
} else {
|
||||
mr = std::dynamic_pointer_cast<MidiRegion> (ref.trigger()->the_region());
|
||||
}
|
||||
|
||||
if (mr) {
|
||||
set_region (mr);
|
||||
if (ref.trigger()->the_region()) {
|
||||
std::shared_ptr<MidiRegion> mr = std::dynamic_pointer_cast<MidiRegion> (ref.trigger()->the_region());
|
||||
if (mr) {
|
||||
set_region (mr);
|
||||
}
|
||||
}
|
||||
|
||||
_update_connection = Timers::rapid_connect (sigc::mem_fun (*this, &Pianoroll::maybe_update));
|
||||
}
|
||||
|
||||
void
|
||||
Pianoroll::make_a_region ()
|
||||
{
|
||||
std::shared_ptr<MidiSource> new_source = _session->create_midi_source_for_session (_track->name());
|
||||
SourceList sources;
|
||||
sources.push_back (new_source);
|
||||
|
||||
PropertyList plist;
|
||||
plist.add (ARDOUR::Properties::start, timepos_t (Temporal::Beats ()));
|
||||
plist.add (ARDOUR::Properties::length, timepos_t (Temporal::Beats::beats (32)));
|
||||
plist.add (ARDOUR::Properties::name, new_source->name());
|
||||
plist.add (ARDOUR::Properties::whole_file, true);
|
||||
|
||||
std::shared_ptr<MidiRegion> mr = std::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (sources, plist, true));
|
||||
|
||||
plist.remove (ARDOUR::Properties::whole_file);
|
||||
mr = std::dynamic_pointer_cast<MidiRegion> (RegionFactory::create (mr, timecnt_t::zero (Temporal::BeatTime), plist, true));
|
||||
|
||||
if (ref.trigger()) {
|
||||
ref.trigger()->set_region (mr);
|
||||
}
|
||||
|
||||
set_region (mr);
|
||||
}
|
||||
|
||||
void
|
||||
Pianoroll::unset ()
|
||||
{
|
||||
|
||||
@@ -145,6 +145,7 @@ class Pianoroll : public CueEditor
|
||||
bool allow_trim_cursors () const;
|
||||
|
||||
void shift_midi (Temporal::timepos_t const &, bool model);
|
||||
void make_a_region();
|
||||
|
||||
protected:
|
||||
void load_bindings ();
|
||||
|
||||
Reference in New Issue
Block a user