2 Copyright (C) 2000-2006 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include <sys/types.h>
29 #include "pbd/pthread_utils.h"
30 #include "pbd/basename.h"
31 #include "pbd/shortpath.h"
32 #include "pbd/stateful_diff_command.h"
34 #include "widgets/choice.h"
36 #include "ardour/audio_track.h"
37 #include "ardour/audiofilesource.h"
38 #include "ardour/audioregion.h"
39 #include "ardour/midi_region.h"
40 #include "ardour/midi_track.h"
41 #include "ardour/operations.h"
42 #include "ardour/profile.h"
43 #include "ardour/region_factory.h"
44 #include "ardour/smf_source.h"
45 #include "ardour/source_factory.h"
46 #include "ardour/utils.h"
47 #include "pbd/memento_command.h"
49 #include "ardour_ui.h"
50 #include "cursor_context.h"
54 #include "audio_time_axis.h"
55 #include "midi_time_axis.h"
56 #include "session_import_dialog.h"
57 #include "gui_thread.h"
58 #include "interthread_progress_window.h"
59 #include "mouse_cursors.h"
60 #include "editor_cursors.h"
65 using namespace ARDOUR;
68 using namespace Gtkmm2ext;
69 using namespace Editing;
72 /* Functions supporting the incorporation of external (non-captured) audio material into ardour */
75 Editor::add_external_audio_action (ImportMode mode_hint)
78 MessageDialog msg (_("You can't import or embed an audiofile until you have a session loaded."));
84 sfbrowser = new SoundFileOmega (_("Add Existing Media"), _session, 0, 0, true, mode_hint);
86 sfbrowser->set_mode (mode_hint);
89 external_audio_dialog ();
93 Editor::external_audio_dialog ()
96 uint32_t audio_track_cnt;
97 uint32_t midi_track_cnt;
100 MessageDialog msg (_("You can't import or embed an audiofile until you have a session loaded."));
108 for (TrackSelection::iterator x = selection->tracks.begin(); x != selection->tracks.end(); ++x) {
109 AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*>(*x);
112 if (atv->is_audio_track()) {
117 MidiTimeAxisView* mtv = dynamic_cast<MidiTimeAxisView*>(*x);
120 if (mtv->is_midi_track()) {
127 if (sfbrowser == 0) {
128 sfbrowser = new SoundFileOmega (_("Add Existing Media"), _session, audio_track_cnt, midi_track_cnt, true);
130 sfbrowser->reset (audio_track_cnt, midi_track_cnt);
133 sfbrowser->show_all ();
137 Editor::session_import_dialog ()
139 SessionImportDialog dialog (_session);
143 typedef std::map<PBD::ID,boost::shared_ptr<ARDOUR::Source> > SourceMap;
146 * Updating is still disabled, see note in libs/ardour/import.cc Session::import_files()
149 * true = show "Update", "Import" and "Skip"
150 * false = show "Import", and "Cancel"
153 * 0 To update an existing source of the same name
154 * 1 To import/embed the file normally (make sure the new name will be unique)
155 * 2 If the user wants to skip this file
158 Editor::check_whether_and_how_to_import(string path, bool all_or_nothing)
160 string wave_name (Glib::path_get_basename(path));
162 bool already_exists = false;
165 if ((existing = _session->count_sources_by_origin (path)) > 0) {
166 already_exists = true;
171 if (already_exists) {
173 if (all_or_nothing) {
174 // updating is still disabled
175 //message = string_compose(_("The session already contains a source file named %1. Do you want to update that file (and thus all regions using the file) or import this file as a new file?"),wave_name);
176 message = string_compose (_("The session already contains a source file named %1. Do you want to import %1 as a new file, or skip it?"), wave_name);
178 message = string_compose (_("The session already contains a source file named %1. Do you want to import %2 as a new source, or skip it?"), wave_name, wave_name);
181 MessageDialog dialog(message, false, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true);
183 if (all_or_nothing) {
185 //dialog.add_button("Update", 0);
186 dialog.add_button("Import", 1);
187 dialog.add_button("Skip", 2);
189 dialog.add_button("Import", 1);
190 dialog.add_button("Cancel", 2);
193 //dialog.add_button("Skip all", 4); // All or rest?
197 function = dialog.run ();
205 boost::shared_ptr<AudioTrack>
206 Editor::get_nth_selected_audio_track (int nth) const
208 AudioTimeAxisView* atv;
209 TrackSelection::iterator x;
211 for (x = selection->tracks.begin(); nth > 0 && x != selection->tracks.end(); ++x) {
213 atv = dynamic_cast<AudioTimeAxisView*>(*x);
217 } else if (atv->is_audio_track()) {
222 if (x == selection->tracks.end()) {
223 atv = dynamic_cast<AudioTimeAxisView*>(selection->tracks.back());
225 atv = dynamic_cast<AudioTimeAxisView*>(*x);
228 if (!atv || !atv->is_audio_track()) {
229 return boost::shared_ptr<AudioTrack>();
232 return atv->audio_track();
235 boost::shared_ptr<MidiTrack>
236 Editor::get_nth_selected_midi_track (int nth) const
238 MidiTimeAxisView* mtv;
239 TrackSelection::iterator x;
241 for (x = selection->tracks.begin(); nth > 0 && x != selection->tracks.end(); ++x) {
243 mtv = dynamic_cast<MidiTimeAxisView*>(*x);
247 } else if (mtv->is_midi_track()) {
252 if (x == selection->tracks.end()) {
253 mtv = dynamic_cast<MidiTimeAxisView*>(selection->tracks.back());
255 mtv = dynamic_cast<MidiTimeAxisView*>(*x);
258 if (!mtv || !mtv->is_midi_track()) {
259 return boost::shared_ptr<MidiTrack>();
262 return mtv->midi_track();
266 Editor::import_smf_tempo_map (Evoral::SMF const & smf, samplepos_t pos)
272 const size_t num_tempos = smf.num_tempos ();
274 if (num_tempos == 0) {
278 const samplecnt_t sample_rate = _session->sample_rate ();
279 TempoMap new_map (sample_rate);
280 Meter last_meter (4.0, 4.0);
281 bool have_initial_meter = false;
283 for (size_t n = 0; n < num_tempos; ++n) {
285 Evoral::SMF::Tempo* t = smf.nth_tempo (n);
288 Tempo tempo (t->tempo(), 32.0 / (double) t->notes_per_note);
289 Meter meter (t->numerator, t->denominator);
290 Timecode::BBT_Time bbt; /* 1|1|0 which is correct for the no-meter case */
292 if (have_initial_meter) {
293 new_map.add_tempo (tempo, t->time_pulses/ (double)smf.ppqn() / 4.0, 0, MusicTime);
294 if (!(meter == last_meter)) {
295 bbt = new_map.bbt_at_quarter_note (t->time_pulses/(double)smf.ppqn());
296 new_map.add_meter (meter, bbt, 0, MusicTime);
300 new_map.replace_meter (new_map.meter_section_at_sample (0), meter, bbt, pos, AudioTime);
301 new_map.replace_tempo (new_map.tempo_section_at_sample (0), tempo, 0.0, pos, AudioTime);
302 have_initial_meter = true;
308 cerr << "@ " << t->time_pulses/(double)smf.ppqn() << " ("
309 << t->time_seconds << ") Add T " << tempo << " M " << meter << endl;
312 cerr << "NEW MAP:\n";
315 _session->tempo_map() = new_map;
319 Editor::do_import (vector<string> paths,
320 ImportDisposition disposition,
323 MidiTrackNameSource midi_track_name_source,
324 MidiTempoMapDisposition smf_tempo_disposition,
326 ARDOUR::PluginInfoPtr instrument)
328 boost::shared_ptr<Track> track;
329 vector<string> to_import;
331 bool use_timestamp = (pos == -1);
333 if (smf_tempo_disposition == SMFTempoUse) {
334 /* Find the first MIDI file with a tempo map, and import it
335 before we do anything else.
338 for (vector<string>::iterator a = paths.begin(); a != paths.end(); ++a) {
343 if (smf.num_tempos() > 0) {
344 import_smf_tempo_map (smf, pos);
352 current_interthread_info = &import_status;
353 import_status.current = 1;
354 import_status.total = paths.size ();
355 import_status.all_done = false;
356 import_status.midi_track_name_source = midi_track_name_source;
358 ImportProgressWindow ipw (&import_status, _("Import"), _("Cancel Import"));
362 if (disposition == Editing::ImportMergeFiles) {
364 /* create 1 region from all paths, add to 1 track,
369 for (vector<string>::iterator a = paths.begin(); a != paths.end(); ++a) {
370 int check = check_whether_and_how_to_import(*a, false);
381 ok = (import_sndfiles (paths, disposition, mode, quality, pos, 1, 1, track, false, instrument) == 0);
382 import_status.sources.clear();
387 bool replace = false;
389 for (vector<string>::iterator a = paths.begin(); a != paths.end(); ++a) {
391 const int check = check_whether_and_how_to_import (*a, true);
398 fatal << "Updating existing sources should be disabled!" << endmsg;
399 abort(); /* NOTREACHED*/
405 fatal << "Illegal return " << check << " from check_whether_and_how_to_import()!" << endmsg;
406 abort(); /* NOTREACHED*/
409 /* have to reset this for every file we handle */
417 switch (disposition) {
418 case Editing::ImportDistinctFiles:
421 to_import.push_back (*a);
423 if (mode == Editing::ImportToTrack) {
424 track = get_nth_selected_audio_track (nth++);
427 ok = (import_sndfiles (to_import, disposition, mode, quality, pos, 1, -1, track, replace, instrument) == 0);
428 import_status.sources.clear();
431 case Editing::ImportDistinctChannels:
434 to_import.push_back (*a);
436 ok = (import_sndfiles (to_import, disposition, mode, quality, pos, -1, -1, track, replace, instrument) == 0);
437 import_status.sources.clear();
440 case Editing::ImportSerializeFiles:
443 to_import.push_back (*a);
445 ok = (import_sndfiles (to_import, disposition, mode, quality, pos, 1, 1, track, replace, instrument) == 0);
446 import_status.sources.clear();
449 case Editing::ImportMergeFiles:
450 // Not entered, handled in earlier if() branch
457 _session->save_state ("");
460 import_status.all_done = true;
464 Editor::do_embed (vector<string> paths, ImportDisposition import_as, ImportMode mode, samplepos_t& pos, ARDOUR::PluginInfoPtr instrument)
466 boost::shared_ptr<Track> track;
467 bool check_sample_rate = true;
469 vector<string> to_embed;
470 bool multi = paths.size() > 1;
472 bool use_timestamp = (pos == -1);
475 case Editing::ImportDistinctFiles:
476 for (vector<string>::iterator a = paths.begin(); a != paths.end(); ++a) {
478 /* have to reset this for every file we handle */
484 to_embed.push_back (*a);
486 if (mode == Editing::ImportToTrack) {
487 track = get_nth_selected_audio_track (nth++);
490 if (embed_sndfiles (to_embed, multi, check_sample_rate, import_as, mode, pos, 1, -1, track, instrument) < -1) {
496 case Editing::ImportDistinctChannels:
497 for (vector<string>::iterator a = paths.begin(); a != paths.end(); ++a) {
499 /* have to reset this for every file we handle */
505 to_embed.push_back (*a);
507 if (embed_sndfiles (to_embed, multi, check_sample_rate, import_as, mode, pos, -1, -1, track, instrument) < -1) {
513 case Editing::ImportMergeFiles:
514 if (embed_sndfiles (paths, multi, check_sample_rate, import_as, mode, pos, 1, 1, track, instrument) < -1) {
519 case Editing::ImportSerializeFiles:
520 for (vector<string>::iterator a = paths.begin(); a != paths.end(); ++a) {
522 /* have to reset this for every file we handle */
528 to_embed.push_back (*a);
530 if (embed_sndfiles (to_embed, multi, check_sample_rate, import_as, mode, pos, 1, 1, track, instrument) < -1) {
541 _session->save_state ("");
546 Editor::import_sndfiles (vector<string> paths,
547 ImportDisposition disposition,
553 boost::shared_ptr<Track>& track,
555 ARDOUR::PluginInfoPtr instrument)
557 import_status.paths = paths;
558 import_status.done = false;
559 import_status.cancel = false;
560 import_status.freeze = false;
561 import_status.quality = quality;
562 import_status.replace_existing_source = replace;
563 import_status.split_midi_channels = (disposition == Editing::ImportDistinctChannels);
565 import_status.mode = mode;
566 import_status.pos = pos;
567 import_status.target_tracks = target_tracks;
568 import_status.target_regions = target_regions;
569 import_status.track = track;
570 import_status.replace = replace;
572 CursorContext::Handle cursor_ctx = CursorContext::create(*this, _cursors->wait);
575 /* start import thread for this spec. this will ultimately call Session::import_files()
576 which, if successful, will add the files as regions to the region list. its up to us
577 (the GUI) to direct additional steps after that.
580 pthread_create_and_store ("import", &import_status.thread, _import_thread, this);
581 pthread_detach (import_status.thread);
583 while (!import_status.done && !import_status.cancel) {
584 gtk_main_iteration ();
587 // wait for thread to terminate
588 while (!import_status.done) {
589 gtk_main_iteration ();
594 if (!import_status.cancel && !import_status.sources.empty()) {
595 result = add_sources (
597 import_status.sources,
601 import_status.target_regions,
602 import_status.target_tracks,
603 track, false, instrument
606 /* update position from results */
608 pos = import_status.pos;
615 Editor::embed_sndfiles (vector<string> paths,
617 bool& check_sample_rate,
618 ImportDisposition disposition,
623 boost::shared_ptr<Track>& track,
624 ARDOUR::PluginInfoPtr instrument)
626 boost::shared_ptr<AudioFileSource> source;
631 CursorContext::Handle cursor_ctx = CursorContext::create(*this, _cursors->wait);
634 for (vector<string>::iterator p = paths.begin(); p != paths.end(); ++p) {
639 /* note that we temporarily truncated _id at the colon */
641 if (!AudioFileSource::get_soundfile_info (path, finfo, error_msg)) {
642 error << string_compose(_("Editor: cannot open file \"%1\", (%2)"), path, error_msg ) << endmsg;
646 if (check_sample_rate && (finfo.samplerate != (int) _session->sample_rate())) {
647 vector<string> choices;
650 choices.push_back (_("Cancel entire import"));
651 choices.push_back (_("Don't embed it"));
652 choices.push_back (_("Embed all without questions"));
654 ArdourWidgets::Choice rate_choice (
656 string_compose (_("%1\nThis audiofile's sample rate doesn't match the session sample rate!"),
657 short_path (path, 40)),
661 int resx = rate_choice.run ();
664 case 0: /* stop a multi-file import */
666 case 1: /* don't embed this one */
668 case 2: /* do it, and the rest without asking */
669 check_sample_rate = false;
677 choices.push_back (_("Cancel"));
678 choices.push_back (_("Embed it anyway"));
680 ArdourWidgets::Choice rate_choice (
682 string_compose (_("%1\nThis audiofile's sample rate doesn't match the session sample rate!"), path),
686 int resx = rate_choice.run ();
689 case 0: /* don't import */
699 for (int n = 0; n < finfo.channels; ++n) {
703 /* check if we have this thing embedded already */
705 boost::shared_ptr<Source> s;
707 if ((s = _session->audio_source_by_path_and_channel (path, n)) == 0) {
709 source = boost::dynamic_pointer_cast<AudioFileSource> (
710 SourceFactory::createExternal (DataType::AUDIO, *_session,
712 (mode == ImportAsTapeTrack
713 ? Source::Destructive
717 source = boost::dynamic_pointer_cast<AudioFileSource> (s);
720 sources.push_back(source);
723 catch (failed_constructor& err) {
724 error << string_compose(_("could not open %1"), path) << endmsg;
728 gtk_main_iteration();
732 if (!sources.empty()) {
733 return add_sources (paths, sources, pos, disposition, mode, target_regions, target_tracks, track, true, instrument);
740 Editor::add_sources (vector<string> paths,
743 ImportDisposition disposition,
747 boost::shared_ptr<Track>& track,
748 bool /*add_channel_suffix*/,
749 ARDOUR::PluginInfoPtr instrument)
751 vector<boost::shared_ptr<Region> > regions;
753 uint32_t input_chan = 0;
754 uint32_t output_chan = 0;
756 vector<string> track_names;
758 use_timestamp = (pos == -1);
760 // kludge (for MIDI we're abusing "channel" for "track" here)
761 if (SMFSource::safe_midi_file_extension (paths.front())) {
765 if (target_regions == 1) {
767 /* take all the sources we have and package them up as a region */
769 region_name = region_name_from_path (paths.front(), (sources.size() > 1), false);
771 /* we checked in import_sndfiles() that there were not too many */
773 while (RegionFactory::region_by_name (region_name)) {
774 region_name = bump_name_once (region_name, '.');
779 plist.add (ARDOUR::Properties::start, 0);
780 plist.add (ARDOUR::Properties::length, sources[0]->length (pos));
781 plist.add (ARDOUR::Properties::name, region_name);
782 plist.add (ARDOUR::Properties::layer, 0);
783 plist.add (ARDOUR::Properties::whole_file, true);
784 plist.add (ARDOUR::Properties::external, true);
786 boost::shared_ptr<Region> r = RegionFactory::create (sources, plist);
788 if (use_timestamp && boost::dynamic_pointer_cast<AudioRegion>(r)) {
789 boost::dynamic_pointer_cast<AudioRegion>(r)->special_set_position(sources[0]->natural_position());
792 regions.push_back (r);
794 /* if we're creating a new track, name it after the cleaned-up
795 * and "merged" region name.
798 track_names.push_back (region_name);
800 } else if (target_regions == -1 || target_regions > 1) {
802 /* take each source and create a region for each one */
805 SourceList::iterator x;
808 for (n = 0, x = sources.begin(); x != sources.end(); ++x, ++n) {
811 just_one.push_back (*x);
813 boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource> (*x);
815 if (sources.size() > 1 && disposition == ImportDistinctChannels) {
817 /* generate a per-channel region name so that things work as
824 region_name = basename_nosuffix (fs->path());
826 region_name = (*x)->name();
829 if (sources.size() == 2) {
835 } else if (sources.size() > 2) {
836 region_name += string_compose ("-%1", n+1);
839 track_names.push_back (region_name);
843 region_name = region_name_from_path (fs->path(), false, false, sources.size(), n);
845 region_name = (*x)->name();
848 if (SMFSource::safe_midi_file_extension (paths.front())) {
849 string track_name = string_compose ("%1-t%2", PBD::basename_nosuffix (fs->path()), (n + 1));
850 track_names.push_back (track_name);
852 track_names.push_back (PBD::basename_nosuffix (paths[n]));
858 /* Fudge region length to ensure it is non-zero; make it 1 beat at 120bpm
859 for want of a better idea. It can't be too small, otherwise if this
860 is a MIDI region the conversion from samples -> beats -> samples will
861 round it back down to 0 again.
863 samplecnt_t len = (*x)->length (pos);
865 len = (60.0 / 120.0) * _session->sample_rate ();
868 plist.add (ARDOUR::Properties::start, 0);
869 plist.add (ARDOUR::Properties::length, len);
870 plist.add (ARDOUR::Properties::name, region_name);
871 plist.add (ARDOUR::Properties::layer, 0);
872 plist.add (ARDOUR::Properties::whole_file, true);
873 plist.add (ARDOUR::Properties::external, true);
875 boost::shared_ptr<Region> r = RegionFactory::create (just_one, plist);
877 if (use_timestamp && boost::dynamic_pointer_cast<AudioRegion>(r)) {
878 boost::dynamic_pointer_cast<AudioRegion>(r)->special_set_position((*x)->natural_position());
881 regions.push_back (r);
885 if (target_regions == 1) {
886 input_chan = regions.front()->n_channels();
888 if (target_tracks == 1) {
889 input_chan = regions.size();
895 if (Config->get_output_auto_connect() & AutoConnectMaster) {
896 output_chan = (_session->master_out() ? _session->master_out()->n_inputs().n_audio() : input_chan);
898 output_chan = input_chan;
902 samplepos_t rlen = 0;
904 begin_reversible_command (Operations::insert_file);
906 /* we only use tracks names when importing to new tracks, but we
907 * require that one is defined for every region, just to keep
910 assert (regions.size() == track_names.size());
912 for (vector<boost::shared_ptr<Region> >::iterator r = regions.begin(); r != regions.end(); ++r, ++n) {
913 boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (*r);
918 /* get timestamp for this region */
920 const boost::shared_ptr<Source> s (ar->sources().front());
921 const boost::shared_ptr<AudioSource> as = boost::dynamic_pointer_cast<AudioSource> (s);
925 if (as->natural_position() != 0) {
926 pos = as->natural_position();
927 } else if (target_tracks == 1) {
928 /* hmm, no timestamp available, put it after the previous region
931 pos = get_preferred_edit_position ();
936 pos = get_preferred_edit_position ();
939 /* should really get first position in MIDI file, but for now, use edit position*/
940 pos = get_preferred_edit_position ();
944 finish_bringing_in_material (*r, input_chan, output_chan, pos, mode, track, track_names[n], instrument);
946 rlen = (*r)->length();
948 if (target_tracks != 1) {
951 if (!use_timestamp || !ar) {
952 /* line each one up right after the other */
953 pos += (*r)->length();
958 commit_reversible_command ();
960 /* setup peak file building in another thread */
962 for (SourceList::iterator x = sources.begin(); x != sources.end(); ++x) {
963 SourceFactory::setup_peakfile (*x, true);
970 Editor::finish_bringing_in_material (boost::shared_ptr<Region> region,
975 boost::shared_ptr<Track>& existing_track,
976 const string& new_track_name,
977 ARDOUR::PluginInfoPtr instrument)
979 boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion>(region);
980 boost::shared_ptr<MidiRegion> mr = boost::dynamic_pointer_cast<MidiRegion>(region);
984 /* relax, its been done */
989 if (!existing_track) {
992 existing_track = get_nth_selected_audio_track (0);
994 existing_track = get_nth_selected_midi_track (0);
997 if (!existing_track) {
1002 boost::shared_ptr<Playlist> playlist = existing_track->playlist();
1003 boost::shared_ptr<Region> copy (RegionFactory::create (region, region->properties()));
1004 playlist->clear_changes ();
1005 playlist->add_region (copy, pos);
1006 if (Config->get_edit_mode() == Ripple)
1007 playlist->ripple (pos, copy->length(), copy);
1009 _session->add_command (new StatefulDiffCommand (playlist));
1015 if (!existing_track) {
1017 list<boost::shared_ptr<AudioTrack> > at (_session->new_audio_track (in_chans, out_chans, 0, 1, string(), PresentationInfo::max_order, Normal));
1022 if (Config->get_strict_io ()) {
1023 for (list<boost::shared_ptr<AudioTrack> >::iterator i = at.begin(); i != at.end(); ++i) {
1024 (*i)->set_strict_io (true);
1028 existing_track = at.front();
1030 list<boost::shared_ptr<MidiTrack> > mt (
1031 _session->new_midi_track (ChanCount (DataType::MIDI, 1),
1032 ChanCount (DataType::MIDI, 1),
1033 Config->get_strict_io () || Profile->get_mixbus (),
1034 instrument, (Plugin::PresetRecord*) 0,
1038 PresentationInfo::max_order));
1044 // TODO set strict_io from preferences
1045 existing_track = mt.front();
1048 if (!new_track_name.empty()) {
1049 existing_track->set_name (new_track_name);
1051 existing_track->set_name (region->name());
1055 boost::shared_ptr<Playlist> playlist = existing_track->playlist();
1056 boost::shared_ptr<Region> copy (RegionFactory::create (region, true));
1057 playlist->clear_changes ();
1058 playlist->add_region (copy, pos);
1059 _session->add_command (new StatefulDiffCommand (playlist));
1063 case ImportAsTapeTrack:
1069 list<boost::shared_ptr<AudioTrack> > at (_session->new_audio_track (in_chans, out_chans, 0, 1, string(), PresentationInfo::max_order, Destructive));
1071 boost::shared_ptr<Playlist> playlist = at.front()->playlist();
1072 boost::shared_ptr<Region> copy (RegionFactory::create (region, true));
1073 playlist->clear_changes ();
1074 playlist->add_region (copy, pos);
1075 _session->add_command (new StatefulDiffCommand (playlist));
1077 if (Config->get_strict_io ()) {
1078 for (list<boost::shared_ptr<AudioTrack> >::iterator i = at.begin(); i != at.end(); ++i) {
1079 (*i)->set_strict_io (true);
1090 Editor::_import_thread (void *arg)
1092 SessionEvent::create_per_thread_pool ("import events", 64);
1094 Editor *ed = (Editor *) arg;
1095 return ed->import_thread ();
1099 Editor::import_thread ()
1101 _session->import_files (import_status);