diff options
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/ardour.bindings | 7 | ||||
-rw-r--r-- | gtk2_ardour/audio_region_view.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/editor_audio_import.cc | 74 | ||||
-rw-r--r-- | gtk2_ardour/editor_export_audio.cc | 10 | ||||
-rw-r--r-- | gtk2_ardour/sfdb_ui.cc | 2 |
5 files changed, 60 insertions, 37 deletions
diff --git a/gtk2_ardour/ardour.bindings b/gtk2_ardour/ardour.bindings index 1297a98266..537ae9c60d 100644 --- a/gtk2_ardour/ardour.bindings +++ b/gtk2_ardour/ardour.bindings @@ -70,9 +70,9 @@ (gtk_accel_path "<Actions>/Editor/editor-paste" "<Control>v") (gtk_accel_path "<Actions>/Editor/scroll-tracks-down" "Page_Down") ; (gtk_accel_path "<Actions>/Snap/snap-to-smpte-minutes" "") +; (gtk_accel_path "<Actions>/Main/FlushWastebasket" "") (gtk_accel_path "<Actions>/Editor/normalize-region" "n") (gtk_accel_path "<Actions>/Editor/nudge-forward" "KP_Add") -; (gtk_accel_path "<Actions>/Main/FlushWastebasket" "") ; (gtk_accel_path "<Actions>/RegionList/SortByRegionEndinFile" "") ; (gtk_accel_path "<Actions>/Editor/ToggleMeasureVisibility" "") ; (gtk_accel_path "<Actions>/Zoom/zoom-focus-center" "") @@ -99,6 +99,7 @@ ; (gtk_accel_path "<Actions>/Editor/addExternalAudioAsTapeTrack" "") ; (gtk_accel_path "<Actions>/redirectmenu/paste" "") ; (gtk_accel_path "<Actions>/Editor/Smpte25" "") +; (gtk_accel_path "<Actions>/options/RegionEquivalentsOverlap" "") ; (gtk_accel_path "<Actions>/Main/MeteringFallOffRate" "") ; (gtk_accel_path "<Actions>/options/UseHardwareMonitoring" "") ; (gtk_accel_path "<Actions>/Editor/Smpte24" "") @@ -174,6 +175,7 @@ ; (gtk_accel_path "<Actions>/options/MeterFalloffMedium" "") (gtk_accel_path "<Actions>/Editor/toggle-follow-playhead" "f") ; (gtk_accel_path "<Actions>/Main/SaveTemplate" "") +(gtk_accel_path "<Actions>/Transport/TransitionToRoll" "<Control>uparrow") ; (gtk_accel_path "<Actions>/RegionList/SortByRegionStartinFile" "") ; (gtk_accel_path "<Actions>/options/GainReduceFastTransport" "") ; (gtk_accel_path "<Actions>/Common/ToggleInspector" "") @@ -213,6 +215,7 @@ (gtk_accel_path "<Actions>/MouseMode/set-mouse-mode-gain" "g") ; (gtk_accel_path "<Actions>/Snap/snap-to-frame" "") ; (gtk_accel_path "<Actions>/Editor/SnapTo" "") +(gtk_accel_path "<Actions>/Transport/TransitionToReverse" "<Control>downarrow") ; (gtk_accel_path "<Actions>/Editor/Crossfades" "") ; (gtk_accel_path "<Actions>/Editor/PullupPlus4" "") (gtk_accel_path "<Actions>/Editor/add-location-from-playhead" "KP_Enter") @@ -257,8 +260,6 @@ ; (gtk_accel_path "<Actions>/Main/Snapshot" "") ; (gtk_accel_path "<Actions>/Transport/ToggleVideoSync" "") (gtk_accel_path "<Actions>/Transport/ToggleRoll" "space") -(gtk_accel_path "<Actions>/Transport/TransitionToRoll" "<Ctrl>uparrow") -(gtk_accel_path "<Actions>/Transport/TransitionToReverse" "<Ctrl>downarrow") ; (gtk_accel_path "<Actions>/RegionList/SortBySourceFilesystem" "") (gtk_accel_path "<Actions>/Common/ToggleColorManager" "<Alt>c") ; (gtk_accel_path "<Actions>/Common/About" "") diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 2fdc3d42de..ba5b9a1ce1 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -737,7 +737,7 @@ AudioRegionView::create_waves () for (uint32_t n = 0; n < nchans; ++n) { tmp_waves.push_back (0); } - + for (uint32_t n = 0; n < nchans; ++n) { if (n >= audio_region()->n_channels()) { @@ -828,7 +828,7 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct) break; } } - + if (n == nwaves && waves.empty()) { /* all waves are ready */ tmp_waves.resize(nwaves); diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc index 7067d9dce0..2a8f2a4516 100644 --- a/gtk2_ardour/editor_audio_import.cc +++ b/gtk2_ardour/editor_audio_import.cc @@ -130,6 +130,8 @@ Editor::do_embed (vector<ustring> paths, bool split, ImportMode mode, AudioTrack vector<ustring>::iterator a; for (a = paths.begin(); a != paths.end(); ) { + + cerr << "Considering embed of " << (*a) << endl; Glib::ustring path = *a; Glib::ustring pair_base; @@ -264,12 +266,12 @@ Editor::embed_sndfile (vector<Glib::ustring> paths, bool split, bool multiple_fi boost::shared_ptr<AudioFileSource> source; SourceList sources; boost::shared_ptr<AudioRegion> region; - string idspec; string linked_path; SoundFileInfo finfo; ustring region_name; uint32_t input_chan = 0; uint32_t output_chan = 0; + int ret = 0; track_canvas.get_window()->set_cursor (Gdk::Cursor (Gdk::WATCH)); ARDOUR_UI::instance()->flush_pending (); @@ -301,7 +303,7 @@ Editor::embed_sndfile (vector<Glib::ustring> paths, bool split, bool multiple_fi if (!AudioFileSource::get_soundfile_info (path, finfo, error_msg)) { error << string_compose(_("Editor: cannot open file \"%1\", (%2)"), selection, error_msg ) << endmsg; - return 0; + goto out; } if (check_sample_rate && (finfo.samplerate != (int) session->frame_rate())) { @@ -311,27 +313,47 @@ Editor::embed_sndfile (vector<Glib::ustring> paths, bool split, bool multiple_fi choices.push_back (_("Cancel entire import")); choices.push_back (_("Don't embed it")); choices.push_back (_("Embed all without questions")); + + Gtkmm2ext::Choice rate_choice ( + string_compose (_("%1\nThis audiofile's sample rate doesn't match the session sample rate!"), path), + choices, false); + + int resx = rate_choice.run (); + + switch (resx) { + case 0: /* stop a multi-file import */ + case 1: /* don't import this one */ + ret = -1; + goto out; + case 2: /* do it, and the rest without asking */ + check_sample_rate = false; + break; + case 3: /* do it */ + break; + default: + ret = -2; + goto out; + } } else { choices.push_back (_("Cancel")); - } - - choices.push_back (_("Embed it anyway")); + choices.push_back (_("Embed it anyway")); - Gtkmm2ext::Choice rate_choice ( - string_compose (_("%1\nThis audiofile's sample rate doesn't match the session sample rate!"), path), - choices, false); - - switch (rate_choice.run()) { - case 0: /* stop a multi-file import */ - case 1: /* don't import this one */ - return -1; - case 2: /* do it, and the rest without asking */ - check_sample_rate = false; - break; - case 3: /* do it */ - break; - default: - return -2; + Gtkmm2ext::Choice rate_choice ( + string_compose (_("%1\nThis audiofile's sample rate doesn't match the session sample rate!"), path), + choices, false); + + int resx = rate_choice.run (); + + switch (resx) { + case 0: /* don't import */ + ret = -1; + goto out; + case 1: /* do it */ + break; + default: + ret = -2; + goto out; + } } } @@ -341,18 +363,16 @@ Editor::embed_sndfile (vector<Glib::ustring> paths, bool split, bool multiple_fi /* make the proper number of channels in the region */ input_chan += finfo.channels; - + for (int n = 0; n < finfo.channels; ++n) { - idspec = path; - idspec += string_compose(":%1", n); - try { source = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable - (*session, idspec, + (*session, path, n, (mode == ImportAsTapeTrack ? AudioFileSource::Destructive : AudioFileSource::Flag (0)))); + sources.push_back(source); } @@ -377,7 +397,7 @@ Editor::embed_sndfile (vector<Glib::ustring> paths, bool split, bool multiple_fi region = boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (sources, 0, sources[0]->length(), region_name, 0, Region::Flag (Region::DefaultFlags|Region::WholeFile|Region::External))); - + if (Config->get_output_auto_connect() & AutoConnectMaster) { output_chan = (session->master_out() ? session->master_out()->n_inputs() : input_chan); } else { @@ -388,7 +408,7 @@ Editor::embed_sndfile (vector<Glib::ustring> paths, bool split, bool multiple_fi out: track_canvas.get_window()->set_cursor (*current_canvas_cursor); - return 0; + return ret; } int diff --git a/gtk2_ardour/editor_export_audio.cc b/gtk2_ardour/editor_export_audio.cc index 57ab02e3a3..8b4b3c140c 100644 --- a/gtk2_ardour/editor_export_audio.cc +++ b/gtk2_ardour/editor_export_audio.cc @@ -208,7 +208,7 @@ Editor::write_region (string path, boost::shared_ptr<AudioRegion> region) try { - fs = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable (*session, path, AudioFileSource::Flag (0))); + fs = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createWritable (*session, path, false, session->frame_rate())); } catch (failed_constructor& err) { @@ -256,6 +256,7 @@ Editor::write_region (string path, boost::shared_ptr<AudioRegion> region) for (vector<boost::shared_ptr<AudioFileSource> >::iterator src = sources.begin(); src != sources.end(); ++src) { (*src)->update_header (0, *now, tnow); + (*src)->mark_immutable (); } return true; @@ -339,7 +340,7 @@ Editor::write_audio_range (AudioPlaylist& playlist, uint32_t channels, list<Audi path = s; try { - fs = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable (*session, path, AudioFileSource::Flag (0))); + fs = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createWritable (*session, path, false, session->frame_rate())); } catch (failed_constructor& err) { @@ -412,8 +413,9 @@ Editor::write_audio_range (AudioPlaylist& playlist, uint32_t channels, list<Audi time (&tnow); now = localtime (&tnow); - for (uint32_t n=0; n < channels; ++n) { - sources[n]->update_header (0, *now, tnow); + for (vector<boost::shared_ptr<AudioFileSource> >::iterator s = sources.begin(); s != sources.end(); ++s) { + (*s)->update_header (0, *now, tnow); + (*s)->mark_immutable (); // do we need to ref it again? } diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index a90f9289a8..cb91fcba6b 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -197,7 +197,7 @@ SoundFileBox::play_btn_clicked () for (int n = 0; n < sf_info.channels; ++n) { try { - afs = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable (*_session, path+":"+string_compose("%1", n), AudioFileSource::Flag (0))); + afs = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable (*_session, path, n, AudioFileSource::Flag (0))); srclist.push_back(afs); } catch (failed_constructor& err) { |