13
0

Add ImportAsTrigger mode

This is like ImportAsTrack, except the imported region is not
added to the timeline, but the first trigger slot.
This commit is contained in:
Robin Gareus 2022-01-03 23:51:33 +01:00
parent 3c2878974c
commit e0c07e2306
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 18 additions and 5 deletions

View File

@ -86,6 +86,7 @@ DISPLAYCONTROL(ShowWaveformsRecording)
IMPORTMODE(ImportAsRegion) IMPORTMODE(ImportAsRegion)
IMPORTMODE(ImportToTrack) IMPORTMODE(ImportToTrack)
IMPORTMODE(ImportAsTrack) IMPORTMODE(ImportAsTrack)
IMPORTMODE(ImportAsTrigger)
// if this is changed, remember to update the string table in sfdb_ui.cc // if this is changed, remember to update the string table in sfdb_ui.cc
IMPORTPOSITION(ImportAtTimestamp) IMPORTPOSITION(ImportAtTimestamp)

View File

@ -1085,6 +1085,8 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region,
break; break;
} }
case ImportAsTrigger:
/* fallthrough */
case ImportAsTrack: case ImportAsTrack:
{ {
if (!existing_track) { if (!existing_track) {
@ -1137,11 +1139,17 @@ Editor::finish_bringing_in_material (boost::shared_ptr<Region> region,
} }
} }
boost::shared_ptr<Playlist> playlist = existing_track->playlist(); if (mode == ImportAsTrigger) {
boost::shared_ptr<Region> copy (RegionFactory::create (region, true)); boost::shared_ptr<Region> copy (RegionFactory::create (region, true));
playlist->clear_changes (); /* TODO handle ImportSerializeFiles, pos > 0, use next free trigger-slot */
playlist->add_region (copy, pos); existing_track->triggerbox ()->set_from_selection (0, copy);
_session->add_command (new StatefulDiffCommand (playlist)); } else {
boost::shared_ptr<Playlist> playlist = existing_track->playlist();
boost::shared_ptr<Region> copy (RegionFactory::create (region, true));
playlist->clear_changes ();
playlist->add_region (copy, pos);
_session->add_command (new StatefulDiffCommand (playlist));
}
break; break;
} }

View File

@ -80,6 +80,7 @@ setup_gtk_ardour_enums ()
REGISTER_ENUM (ImportAsTrack); REGISTER_ENUM (ImportAsTrack);
REGISTER_ENUM (ImportToTrack); REGISTER_ENUM (ImportToTrack);
REGISTER_ENUM (ImportAsRegion); REGISTER_ENUM (ImportAsRegion);
REGISTER_ENUM (ImportAsTrigger);
REGISTER (import_mode); REGISTER (import_mode);
REGISTER_ENUM (EditAtPlayhead); REGISTER_ENUM (EditAtPlayhead);

View File

@ -142,6 +142,9 @@ importmode2string (ImportMode mode)
return _("to selected tracks"); return _("to selected tracks");
case ImportAsRegion: case ImportAsRegion:
return _("to source list"); return _("to source list");
case ImportAsTrigger:
/* TODO: n/a */
break;
} }
abort(); /*NOTREACHED*/ abort(); /*NOTREACHED*/
return _("as new tracks"); return _("as new tracks");