diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-11-09 22:08:18 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-11-09 22:08:18 +0000 |
commit | 1082218dfadd636865c1b84fce1ca1d6c3dd23de (patch) | |
tree | 85a459a46a5753a8eb32ddc7c6035c85733c4893 /libs | |
parent | 6a67738db993971e62360e4d058b146957dafb1c (diff) |
fix for handling DnD path data, plus lots of d-n-d drop debugging (to be cleaned up)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4129 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/import.cc | 19 | ||||
-rw-r--r-- | libs/ardour/sndfileimportable.cc | 2 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/dndtreeview.h | 4 |
3 files changed, 21 insertions, 4 deletions
diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc index 2694acd9ab..9f103346fd 100644 --- a/libs/ardour/import.cc +++ b/libs/ardour/import.cc @@ -87,10 +87,12 @@ open_importable_source (const string& path, nframes_t samplerate, ARDOUR::SrcQua try { boost::shared_ptr<SndFileImportableSource> source(new SndFileImportableSource(path)); + cerr << "Got a new sndfile source from " << path << " as " << source->length() << endl; + if (source->samplerate() == samplerate) { return source; } - + /* rewrap as a resampled source */ return boost::shared_ptr<ImportableSource>(new ResampledImportableSource(source, samplerate, quality)); @@ -244,6 +246,8 @@ write_audio_data_to_new_files (ImportableSource* source, Session::import_status& boost::scoped_array<float> data(new float[nframes * channels]); vector<boost::shared_array<Sample> > channel_data; + cerr << "writing " << channels << " to new file, length = " << source->length() << endl; + for (uint n = 0; n < channels; ++n) { channel_data.push_back(boost::shared_array<Sample>(new Sample[nframes])); } @@ -280,6 +284,8 @@ write_audio_data_to_new_files (ImportableSource* source, Session::import_status& read_count += nread; status.progress = read_count / (source->ratio () * source->length() * channels); + + cerr << "status.progress = " << status.progress << endl; } } @@ -300,6 +306,9 @@ Session::import_audiofiles (import_status& status) typedef vector<boost::shared_ptr<AudioFileSource> > AudioSources; AudioSources all_new_sources; + + cerr << "start import of AF\n"; + status.sources.clear (); for (vector<Glib::ustring>::iterator p = status.paths.begin(); @@ -311,11 +320,13 @@ Session::import_audiofiles (import_status& status) try { source = open_importable_source (*p, frame_rate(), status.quality); + cerr << "New source from " << *p << " length = " << source->length() << endl; } catch (const failed_constructor& err) { error << string_compose(_("Import: cannot open input sound file \"%1\""), (*p)) << endmsg; + cerr << string_compose(_("Import: cannot open input sound file \"%1\""), (*p)) << endl; status.done = status.cancel = true; return; } @@ -346,6 +357,8 @@ Session::import_audiofiles (import_status& status) status.doing_what = compose_status_message (*p, source->samplerate(), frame_rate(), cnt, status.paths.size()); + cerr << "about to write audio data\n"; + write_audio_data_to_new_files (source.get(), status, newfiles); } @@ -374,13 +387,13 @@ Session::import_audiofiles (import_status& status) save_state (_name); - std::copy (all_new_sources.begin(), all_new_sources.end(), - std::back_inserter(status.sources)); + std::copy (all_new_sources.begin(), all_new_sources.end(), std::back_inserter(status.sources)); } else { // this can throw...but it seems very unlikely std::for_each (all_new_sources.begin(), all_new_sources.end(), remove_file_source); } + cerr << "end of import, setting done = true\n"; status.done = true; } diff --git a/libs/ardour/sndfileimportable.cc b/libs/ardour/sndfileimportable.cc index eb0e8a8afb..542999f6f1 100644 --- a/libs/ardour/sndfileimportable.cc +++ b/libs/ardour/sndfileimportable.cc @@ -1,5 +1,6 @@ #include <ardour/sndfileimportable.h> #include <sndfile.h> +#include <iostream> using namespace ARDOUR; using namespace std; @@ -8,6 +9,7 @@ SndFileImportableSource::SndFileImportableSource (const string& path) : in (sf_open (path.c_str(), SFM_READ, &sf_info), sf_close) { if (!in) throw failed_constructor(); + std::cerr << "new SFIS @ " << path << " frames = " << sf_info.frames << std::endl; } SndFileImportableSource::~SndFileImportableSource () diff --git a/libs/gtkmm2ext/gtkmm2ext/dndtreeview.h b/libs/gtkmm2ext/gtkmm2ext/dndtreeview.h index 7b2c8d9882..92872ee60f 100644 --- a/libs/gtkmm2ext/gtkmm2ext/dndtreeview.h +++ b/libs/gtkmm2ext/gtkmm2ext/dndtreeview.h @@ -74,6 +74,7 @@ class DnDTreeView : public DnDTreeViewBase sigc::signal<void,std::string,uint32_t,const DataType*> signal_object_drop; void on_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& selection_data, guint info, guint time) { + std::cerr << "DRAG DATA Get, context = " << context->gobj() << " src = " << context->gobj()->is_source << std::endl; if (selection_data.get_target() == "GTK_TREE_MODEL_ROW") { TreeView::on_drag_data_get (context, selection_data, info, time); @@ -85,8 +86,9 @@ class DnDTreeView : public DnDTreeViewBase selection_data.set (8, (guchar*)sr, sr->size); } } - + void on_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, const Gtk::SelectionData& selection_data, guint info, guint time) { + std::cerr << "DRAG DATA Receive, context = " << context->gobj() << " src = " << context->gobj()->is_source << std::endl; if (suggested_action) { /* this is a drag motion callback. just update the status to say that we are still dragging, and that's it. |