summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_audio_import.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-12-07 14:45:51 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-12-07 14:45:51 +0000
commite621d704ac16f7da143a1c7ab3d6864c803ec8c9 (patch)
tree6e302424a9707f2b9413d7116e829f8a09683292 /gtk2_ardour/editor_audio_import.cc
parent0a19ce6f1c8859f02920e14bf0cbef4e526a1f78 (diff)
fix crash when importing MIDI with "at timestamp" chosen
git-svn-id: svn://localhost/ardour2/branches/3.0@8206 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_audio_import.cc')
-rw-r--r--gtk2_ardour/editor_audio_import.cc49
1 files changed, 27 insertions, 22 deletions
diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc
index 38355e964d..8ed6248cf1 100644
--- a/gtk2_ardour/editor_audio_import.cc
+++ b/gtk2_ardour/editor_audio_import.cc
@@ -792,30 +792,35 @@ Editor::add_sources (vector<string> paths, SourceList& sources, framepos_t& pos,
for (vector<boost::shared_ptr<Region> >::iterator r = regions.begin(); r != regions.end(); ++r, ++n) {
boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (*r);
- if (use_timestamp && ar) {
+ if (use_timestamp) {
+ if (ar) {
- /* get timestamp for this region */
-
- const boost::shared_ptr<Source> s (ar->sources().front());
- const boost::shared_ptr<AudioSource> as = boost::dynamic_pointer_cast<AudioSource> (s);
-
- assert (as);
-
- if (as->natural_position() != 0) {
- pos = as->natural_position();
- } else if (target_tracks == 1) {
- /* hmm, no timestamp available, put it after the previous region
- */
- if (n == 0) {
- pos = get_preferred_edit_position ();
- } else {
- pos += rlen;
- }
- } else {
- pos = get_preferred_edit_position ();
- }
+ /* get timestamp for this region */
- }
+ const boost::shared_ptr<Source> s (ar->sources().front());
+ const boost::shared_ptr<AudioSource> as = boost::dynamic_pointer_cast<AudioSource> (s);
+
+ assert (as);
+
+ if (as->natural_position() != 0) {
+ pos = as->natural_position();
+ } else if (target_tracks == 1) {
+ /* hmm, no timestamp available, put it after the previous region
+ */
+ if (n == 0) {
+ pos = get_preferred_edit_position ();
+ } else {
+ pos += rlen;
+ }
+ } else {
+ pos = get_preferred_edit_position ();
+ }
+ } else {
+ /* should really get first position in MIDI file, but for now, use edit position*/
+ pos = get_preferred_edit_position ();
+ }
+ }
+
finish_bringing_in_material (*r, input_chan, output_chan, pos, mode, track);