mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-05 13:15:44 +01:00
speed up track resizing; fixup file DnD; stop use CAAudioFile for imported files
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4148 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
02c49688c7
commit
45b4721be3
18 changed files with 181 additions and 231 deletions
|
|
@ -98,6 +98,7 @@ au_pluginui.mm
|
|||
|
||||
gtkosx_files=Split("""
|
||||
cocoacarbon.mm
|
||||
newoverload.cc
|
||||
""")
|
||||
|
||||
x11_files=Split("""
|
||||
|
|
|
|||
|
|
@ -3,4 +3,5 @@ dir=`dirname "$0"`
|
|||
. $dir/ardev_common.sh
|
||||
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
|
||||
export ARDOUR_INSIDE_GDB=1
|
||||
export DYLD_PRINT_BINDINGS=1
|
||||
exec gdb $EXECUTABLE "$@"
|
||||
|
|
|
|||
|
|
@ -300,6 +300,7 @@ Editor::Editor ()
|
|||
show_gain_after_trim = false;
|
||||
route_redisplay_does_not_sync_order_keys = false;
|
||||
route_redisplay_does_not_reset_order_keys = false;
|
||||
ignore_gui_changes = false;
|
||||
no_route_list_redisplay = false;
|
||||
verbose_cursor_on = true;
|
||||
route_removal = false;
|
||||
|
|
@ -4939,6 +4940,9 @@ Editor::add_to_idle_resize (TimeAxisView* view, uint32_t h)
|
|||
{
|
||||
if (resize_idle_id < 0) {
|
||||
resize_idle_id = g_idle_add (_idle_resizer, this);
|
||||
cerr << "QUEUE and reset idle resize target to " << h << endl;
|
||||
} else {
|
||||
cerr << "JUST reset idle resize target to " << h << endl;
|
||||
}
|
||||
|
||||
resize_idle_target = h;
|
||||
|
|
@ -4948,15 +4952,22 @@ Editor::add_to_idle_resize (TimeAxisView* view, uint32_t h)
|
|||
if (selection->selected (view) && !selection->tracks.empty()) {
|
||||
pending_resizes.insert (pending_resizes.end(), selection->tracks.begin(), selection->tracks.end());
|
||||
}
|
||||
|
||||
cerr << "\tpending now " << pending_resizes.size() << endl;
|
||||
}
|
||||
|
||||
bool
|
||||
Editor::idle_resize ()
|
||||
{
|
||||
cerr << "idle resize to " << resize_idle_target << endl;
|
||||
ignore_gui_changes = true;
|
||||
for (vector<TimeAxisView*>::iterator i = pending_resizes.begin(); i != pending_resizes.end(); ++i) {
|
||||
(*i)->idle_resize (resize_idle_target);
|
||||
}
|
||||
pending_resizes.clear();
|
||||
ignore_gui_changes = false;
|
||||
handle_gui_changes ("track_height", this);
|
||||
flush_canvas ();
|
||||
resize_idle_id = -1;
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1162,32 +1162,16 @@ class Editor : public PublicEditor
|
|||
|
||||
void bring_in_external_audio (Editing::ImportMode mode, nframes64_t& pos);
|
||||
|
||||
bool idle_drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
|
||||
gint x,
|
||||
gint y,
|
||||
const Gtk::SelectionData& data,
|
||||
guint info,
|
||||
guint time);
|
||||
|
||||
void _drop_paths (const Glib::RefPtr<Gdk::DragContext>& context,
|
||||
gint x,
|
||||
gint y,
|
||||
const Gtk::SelectionData& data,
|
||||
guint info,
|
||||
guint time);
|
||||
|
||||
void _do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
|
||||
bool idle_drop_paths (std::vector<Glib::ustring> paths, nframes64_t frame, double ypos);
|
||||
void drop_paths_part_two (const std::vector<Glib::ustring>& paths, nframes64_t frame, double ypos);
|
||||
|
||||
void do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
|
||||
bool idle_do_import (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t&);
|
||||
|
||||
void _do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
|
||||
void do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
|
||||
bool idle_do_embed (vector<Glib::ustring> paths, Editing::ImportDisposition, Editing::ImportMode mode, nframes64_t&);
|
||||
|
||||
int import_sndfiles (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::SrcQuality, nframes64_t& pos,
|
||||
int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool);
|
||||
int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>, bool, uint32_t total);
|
||||
int embed_sndfiles (vector<Glib::ustring> paths, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
|
||||
nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&);
|
||||
nframes64_t& pos, int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>);
|
||||
|
||||
int add_sources (vector<Glib::ustring> paths, ARDOUR::SourceList& sources, nframes64_t& pos, Editing::ImportMode,
|
||||
int target_regions, int target_tracks, boost::shared_ptr<ARDOUR::AudioTrack>&, bool add_channel_suffix);
|
||||
|
|
@ -1215,10 +1199,20 @@ class Editor : public PublicEditor
|
|||
|
||||
/* import specific info */
|
||||
|
||||
ARDOUR::Session::import_status import_status;
|
||||
struct EditorImportStatus : public ARDOUR::Session::import_status {
|
||||
Editing::ImportMode mode;
|
||||
nframes64_t pos;
|
||||
int target_tracks;
|
||||
int target_regions;
|
||||
boost::shared_ptr<ARDOUR::AudioTrack> track;
|
||||
bool replace;
|
||||
};
|
||||
|
||||
EditorImportStatus import_status;
|
||||
gint import_progress_timeout (void *);
|
||||
static void *_import_thread (void *);
|
||||
void* import_thread ();
|
||||
void finish_import ();
|
||||
|
||||
/* to support this ... */
|
||||
|
||||
|
|
@ -1309,6 +1303,7 @@ class Editor : public PublicEditor
|
|||
double snap_threshold;
|
||||
|
||||
void handle_gui_changes (const string &, void *);
|
||||
bool ignore_gui_changes;
|
||||
|
||||
void hide_all_tracks (bool with_select);
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
#include "editing.h"
|
||||
#include "audio_time_axis.h"
|
||||
#include "utils.h"
|
||||
#include "gui_thread.h"
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
|
|
@ -203,6 +204,7 @@ Editor::check_whether_and_how_to_import(string path, bool all_or_nothing)
|
|||
bool wave_name_exists = false;
|
||||
|
||||
for (AudioSourceList::iterator i = all_sources.begin(); i != all_sources.end(); ++i) {
|
||||
|
||||
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource>(i->second);
|
||||
|
||||
string tmp (Glib::path_get_basename (afs->path()));
|
||||
|
|
@ -215,7 +217,6 @@ Editor::check_whether_and_how_to_import(string path, bool all_or_nothing)
|
|||
|
||||
int function = 1;
|
||||
|
||||
|
||||
if (wave_name_exists) {
|
||||
string message;
|
||||
if (all_or_nothing) {
|
||||
|
|
@ -238,7 +239,6 @@ Editor::check_whether_and_how_to_import(string path, bool all_or_nothing)
|
|||
dialog.add_button("Cancel", 2);
|
||||
}
|
||||
|
||||
|
||||
//dialog.add_button("Skip all", 4); // All or rest?
|
||||
|
||||
dialog.show();
|
||||
|
|
@ -281,39 +281,25 @@ Editor::get_nth_selected_audio_track (int nth) const
|
|||
return atv->audio_track();
|
||||
}
|
||||
|
||||
bool
|
||||
Editor::idle_do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mode, SrcQuality quality, nframes64_t& pos)
|
||||
{
|
||||
_do_import (paths, chns, mode, quality, pos);
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
Editor::do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mode, SrcQuality quality, nframes64_t& pos)
|
||||
{
|
||||
_do_import (paths, chns, mode, quality, pos);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::_do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mode, SrcQuality quality, nframes64_t& pos)
|
||||
{
|
||||
boost::shared_ptr<AudioTrack> track;
|
||||
vector<ustring> to_import;
|
||||
bool ok = true;
|
||||
int nth = 0;
|
||||
|
||||
if (interthread_progress_window == 0) {
|
||||
build_interthread_progress_window ();
|
||||
}
|
||||
|
||||
cerr << "Here we go .. disp = " << chns << " mode = " << mode << " @ " << pos << endl;
|
||||
|
||||
if (chns == Editing::ImportMergeFiles) {
|
||||
|
||||
/* create 1 region from all paths, add to 1 track,
|
||||
ignore "track"
|
||||
*/
|
||||
|
||||
bool cancel = false;
|
||||
for (vector<ustring>::iterator a = paths.begin(); a != paths.end() && ok; ++a) {
|
||||
for (vector<ustring>::iterator a = paths.begin(); a != paths.end(); ++a) {
|
||||
int check = check_whether_and_how_to_import(*a, false);
|
||||
if (check == 2) {
|
||||
cancel = true;
|
||||
|
|
@ -322,14 +308,14 @@ Editor::_do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mo
|
|||
}
|
||||
|
||||
if (!cancel) {
|
||||
cerr << "Here we REALLY go ..\n";
|
||||
if (import_sndfiles (paths, mode, quality, pos, 1, 1, track, false)) {
|
||||
ok = false;
|
||||
}
|
||||
import_sndfiles (paths, mode, quality, pos, 1, 1, track, false, paths.size());
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
bool replace = false;
|
||||
bool ok = true;
|
||||
vector<ustring>::size_type total = paths.size();
|
||||
|
||||
for (vector<ustring>::iterator a = paths.begin(); a != paths.end() && ok; ++a) {
|
||||
|
||||
|
|
@ -337,7 +323,7 @@ Editor::_do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mo
|
|||
|
||||
switch (check) {
|
||||
case 2:
|
||||
// skip
|
||||
// user said skip
|
||||
continue;
|
||||
case 0:
|
||||
fatal << "Updating existing sources should be disabled!" << endmsg;
|
||||
|
|
@ -351,80 +337,48 @@ Editor::_do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mo
|
|||
/* NOTREACHED*/
|
||||
}
|
||||
|
||||
|
||||
switch (chns) {
|
||||
case Editing::ImportDistinctFiles:
|
||||
case Editing::ImportDistinctFiles:
|
||||
|
||||
to_import.clear ();
|
||||
to_import.push_back (*a);
|
||||
|
||||
if (mode == Editing::ImportToTrack) {
|
||||
track = get_nth_selected_audio_track (nth++);
|
||||
}
|
||||
|
||||
ok = (import_sndfiles (to_import, mode, quality, pos, 1, -1, track, replace, total) == 0);
|
||||
break;
|
||||
|
||||
case Editing::ImportDistinctChannels:
|
||||
|
||||
to_import.clear ();
|
||||
to_import.push_back (*a);
|
||||
|
||||
ok = (import_sndfiles (to_import, mode, quality, pos, -1, -1, track, replace, total) == 0);
|
||||
break;
|
||||
|
||||
case Editing::ImportSerializeFiles:
|
||||
|
||||
to_import.clear ();
|
||||
to_import.push_back (*a);
|
||||
|
||||
to_import.clear ();
|
||||
to_import.push_back (*a);
|
||||
ok = (import_sndfiles (to_import, mode, quality, pos, 1, 1, track, replace, total) == 0);
|
||||
break;
|
||||
|
||||
if (mode == Editing::ImportToTrack) {
|
||||
track = get_nth_selected_audio_track (nth++);
|
||||
}
|
||||
|
||||
cerr << "Here we REALLY go 2 ..\n";
|
||||
if (import_sndfiles (to_import, mode, quality, pos, 1, -1, track, replace)) {
|
||||
ok = false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Editing::ImportDistinctChannels:
|
||||
|
||||
to_import.clear ();
|
||||
to_import.push_back (*a);
|
||||
|
||||
cerr << "Here we REALLY go 3 ..\n";
|
||||
if (import_sndfiles (to_import, mode, quality, pos, -1, -1, track, replace)) {
|
||||
ok = false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Editing::ImportSerializeFiles:
|
||||
|
||||
to_import.clear ();
|
||||
to_import.push_back (*a);
|
||||
|
||||
/* create 1 region from this path, add to 1 track,
|
||||
reuse "track" across paths
|
||||
*/
|
||||
|
||||
cerr << "Here we REALLY go 4 ..\n";
|
||||
if (import_sndfiles (to_import, mode, quality, pos, 1, 1, track, replace)) {
|
||||
ok = false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Editing::ImportMergeFiles:
|
||||
// Not entered
|
||||
break;
|
||||
case Editing::ImportMergeFiles:
|
||||
// Not entered, handled in earlier if() branch
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ok) {
|
||||
session->save_state ("");
|
||||
}
|
||||
|
||||
interthread_progress_window->hide_all ();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Editor::idle_do_embed (vector<ustring> paths, ImportDisposition chns, ImportMode mode, nframes64_t& pos)
|
||||
{
|
||||
_do_embed (paths, chns, mode, pos);
|
||||
return false;
|
||||
interthread_progress_window->hide_all ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::do_embed (vector<ustring> paths, ImportDisposition chns, ImportMode mode, nframes64_t& pos)
|
||||
{
|
||||
_do_embed (paths, chns, mode, pos);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::_do_embed (vector<ustring> paths, ImportDisposition chns, ImportMode mode, nframes64_t& pos)
|
||||
{
|
||||
boost::shared_ptr<AudioTrack> track;
|
||||
bool check_sample_rate = true;
|
||||
|
|
@ -491,7 +445,8 @@ Editor::_do_embed (vector<ustring> paths, ImportDisposition chns, ImportMode mod
|
|||
|
||||
int
|
||||
Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality quality, nframes64_t& pos,
|
||||
int target_regions, int target_tracks, boost::shared_ptr<AudioTrack>& track, bool replace)
|
||||
int target_regions, int target_tracks, boost::shared_ptr<AudioTrack> track, bool replace,
|
||||
uint32_t total)
|
||||
{
|
||||
WindowTitle title = string_compose (_("importing %1"), paths.front());
|
||||
|
||||
|
|
@ -508,7 +463,14 @@ Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality qual
|
|||
import_status.done = 0.0;
|
||||
import_status.quality = quality;
|
||||
import_status.replace_existing_source = replace;
|
||||
import_status.total = total;
|
||||
|
||||
import_status.mode = mode;
|
||||
import_status.pos = pos;
|
||||
import_status.target_tracks = target_tracks;
|
||||
import_status.target_regions = target_regions;
|
||||
import_status.track = track;
|
||||
import_status.replace = replace;
|
||||
interthread_progress_connection = Glib::signal_timeout().connect
|
||||
(bind (mem_fun(*this, &Editor::import_progress_timeout), (gpointer) 0), 500);
|
||||
|
||||
|
|
@ -516,42 +478,38 @@ Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality qual
|
|||
gdk_flush ();
|
||||
|
||||
/* start import thread for this spec. this will ultimately call Session::import_audiofile()
|
||||
and if successful will add the file(s) as a region to the session region list.
|
||||
which, if successful, will add the files as regions to the region list. its up to us
|
||||
(the GUI) to direct additional steps after that.
|
||||
*/
|
||||
|
||||
cerr << "Creating import thread\n";
|
||||
|
||||
pthread_create_and_store ("import", &import_status.thread, 0, _import_thread, this);
|
||||
pthread_detach (import_status.thread);
|
||||
|
||||
cerr << "into rec loop while thread runs\n";
|
||||
|
||||
while (!(import_status.done || import_status.cancel)) {
|
||||
while (!import_status.done && !import_status.cancel) {
|
||||
gtk_main_iteration ();
|
||||
}
|
||||
|
||||
cerr << "back from rec loop while thread run, status.cancel = " << import_status.cancel
|
||||
<< " done = " << import_status.done << " progress = " << import_status.progress << endl;
|
||||
|
||||
interthread_progress_window->hide ();
|
||||
|
||||
import_status.done = true;
|
||||
interthread_progress_connection.disconnect ();
|
||||
|
||||
/* import thread finished - see if we should build a new track */
|
||||
|
||||
boost::shared_ptr<AudioRegion> r;
|
||||
|
||||
if (import_status.cancel || import_status.sources.empty()) {
|
||||
cerr << "Cancelled ? " << import_status.cancel << " or no files\n";
|
||||
goto out;
|
||||
if (!import_status.cancel && !import_status.sources.empty()) {
|
||||
if (add_sources (import_status.paths,
|
||||
import_status.sources,
|
||||
import_status.pos,
|
||||
import_status.mode,
|
||||
import_status.target_regions,
|
||||
import_status.target_tracks,
|
||||
import_status.track, false) == 0) {
|
||||
session->save_state ("");
|
||||
}
|
||||
|
||||
/* update position from results */
|
||||
|
||||
pos = import_status.pos;
|
||||
}
|
||||
|
||||
if (add_sources (paths, import_status.sources, pos, mode, target_regions, target_tracks, track, false) == 0) {
|
||||
session->save_state ("");
|
||||
}
|
||||
|
||||
out:
|
||||
track_canvas->get_window()->set_cursor (*current_canvas_cursor);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -559,7 +517,7 @@ Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality qual
|
|||
int
|
||||
Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile,
|
||||
bool& check_sample_rate, ImportMode mode, nframes64_t& pos, int target_regions, int target_tracks,
|
||||
boost::shared_ptr<AudioTrack>& track)
|
||||
boost::shared_ptr<AudioTrack> track)
|
||||
{
|
||||
boost::shared_ptr<AudioFileSource> source;
|
||||
SourceList sources;
|
||||
|
|
@ -568,7 +526,7 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile,
|
|||
int ret = 0;
|
||||
|
||||
track_canvas->get_window()->set_cursor (Gdk::Cursor (Gdk::WATCH));
|
||||
ARDOUR_UI::instance()->flush_pending ();
|
||||
gdk_flush ();
|
||||
|
||||
for (vector<Glib::ustring>::iterator p = paths.begin(); p != paths.end(); ++p) {
|
||||
|
||||
|
|
@ -679,8 +637,6 @@ Editor::embed_sndfiles (vector<Glib::ustring> paths, bool multifile,
|
|||
|
||||
if ((s = session->source_by_path_and_channel (path, n)) == 0) {
|
||||
|
||||
cerr << "add embed/import source with defer_peaks = true\n";
|
||||
|
||||
source = boost::dynamic_pointer_cast<AudioFileSource> (SourceFactory::createReadable
|
||||
(*session, path, n,
|
||||
(mode == ImportAsTapeTrack ?
|
||||
|
|
@ -741,7 +697,7 @@ Editor::add_sources (vector<Glib::ustring> paths, SourceList& sources, nframes64
|
|||
(RegionFactory::create (sources, 0, sources[0]->length(), region_name, 0,
|
||||
Region::Flag (Region::DefaultFlags|Region::WholeFile|Region::External))));
|
||||
|
||||
} else if (target_regions == -1) {
|
||||
} else if (target_regions == -1 || target_regions > 1) {
|
||||
|
||||
/* take each source and create a region for each one */
|
||||
|
||||
|
|
|
|||
|
|
@ -447,8 +447,6 @@ Editor::track_canvas_drag_data_received (const RefPtr<Gdk::DragContext>& context
|
|||
const SelectionData& data,
|
||||
guint info, guint time)
|
||||
{
|
||||
cerr << "drop on canvas, target = " << data.get_target() << endl;
|
||||
|
||||
if (data.get_target() == "regions") {
|
||||
drop_regions (context, x, y, data, info, time);
|
||||
} else {
|
||||
|
|
@ -457,69 +455,19 @@ Editor::track_canvas_drag_data_received (const RefPtr<Gdk::DragContext>& context
|
|||
}
|
||||
|
||||
bool
|
||||
Editor::idle_drop_paths (const RefPtr<Gdk::DragContext>& context,
|
||||
int x, int y,
|
||||
const SelectionData& data,
|
||||
guint info, guint time)
|
||||
Editor::idle_drop_paths (vector<ustring> paths, nframes64_t frame, double ypos)
|
||||
{
|
||||
_drop_paths (context, x, y, data, info, time);
|
||||
drop_paths_part_two (paths, frame, ypos);
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
Editor::drop_paths (const RefPtr<Gdk::DragContext>& context,
|
||||
int x, int y,
|
||||
const SelectionData& data,
|
||||
guint info, guint time)
|
||||
{
|
||||
#ifdef GTKOSX
|
||||
Glib::signal_idle().connect (bind (mem_fun (*this, &Editor::idle_drop_paths), context, x, y, data, info, time));
|
||||
#else
|
||||
_drop_paths (context, x, y, data, info, time);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
Editor::_drop_paths (const RefPtr<Gdk::DragContext>& context,
|
||||
int x, int y,
|
||||
const SelectionData& data,
|
||||
guint info, guint time)
|
||||
Editor::drop_paths_part_two (const vector<ustring>& paths, nframes64_t frame, double ypos)
|
||||
{
|
||||
TimeAxisView* tvp;
|
||||
AudioTimeAxisView* tv;
|
||||
double cy;
|
||||
vector<ustring> paths;
|
||||
string spath;
|
||||
GdkEvent ev;
|
||||
nframes64_t frame;
|
||||
|
||||
if (convert_drop_to_paths (paths, context, x, y, data, info, time)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (vector<ustring>::iterator xx = paths.begin(); xx != paths.end(); ++xx) {
|
||||
cerr << "Drop path = " << *xx << endl;
|
||||
}
|
||||
|
||||
/* D-n-D coordinates are window-relative, so convert to "world" coordinates
|
||||
*/
|
||||
|
||||
double wx;
|
||||
double wy;
|
||||
|
||||
track_canvas->window_to_world (x, y, wx, wy);
|
||||
//wx += horizontal_adjustment.get_value();
|
||||
//wy += vertical_adjustment.get_value();
|
||||
|
||||
ev.type = GDK_BUTTON_RELEASE;
|
||||
ev.button.x = wx;
|
||||
ev.button.y = wy;
|
||||
|
||||
frame = event_frame (&ev, 0, &cy);
|
||||
|
||||
snap_to (frame);
|
||||
|
||||
if ((tvp = trackview_by_y_position (cy)) == 0) {
|
||||
if ((tvp = trackview_by_y_position (ypos)) == 0) {
|
||||
|
||||
/* drop onto canvas background: create new tracks */
|
||||
|
||||
|
|
@ -536,18 +484,57 @@ Editor::_drop_paths (const RefPtr<Gdk::DragContext>& context,
|
|||
/* check that its an audio track, not a bus */
|
||||
|
||||
if (tv->get_diskstream()) {
|
||||
/* select the track, then embed */
|
||||
/* select the track, then embed/import */
|
||||
selection->set (tv);
|
||||
|
||||
if (Profile->get_sae() || Config->get_only_copy_imported_files()) {
|
||||
do_import (paths, Editing::ImportDistinctFiles, Editing::ImportToTrack, SrcBest, frame);
|
||||
do_import (paths, Editing::ImportSerializeFiles, Editing::ImportToTrack, SrcBest, frame);
|
||||
} else {
|
||||
do_embed (paths, Editing::ImportDistinctFiles, ImportToTrack, frame);
|
||||
do_embed (paths, Editing::ImportSerializeFiles, ImportToTrack, frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::drop_paths (const RefPtr<Gdk::DragContext>& context,
|
||||
int x, int y,
|
||||
const SelectionData& data,
|
||||
guint info, guint time)
|
||||
{
|
||||
vector<ustring> paths;
|
||||
GdkEvent ev;
|
||||
nframes64_t frame;
|
||||
double wx;
|
||||
double wy;
|
||||
double cy;
|
||||
|
||||
if (convert_drop_to_paths (paths, context, x, y, data, info, time) == 0) {
|
||||
|
||||
/* D-n-D coordinates are window-relative, so convert to "world" coordinates
|
||||
*/
|
||||
|
||||
track_canvas->window_to_world (x, y, wx, wy);
|
||||
|
||||
ev.type = GDK_BUTTON_RELEASE;
|
||||
ev.button.x = wx;
|
||||
ev.button.y = wy;
|
||||
|
||||
frame = event_frame (&ev, 0, &cy);
|
||||
|
||||
snap_to (frame);
|
||||
|
||||
#ifdef GTKOSX
|
||||
/* We are not allowed to call recursive main event loops from within
|
||||
the main event loop with GTK/Quartz. Since import/embed wants
|
||||
to push up a progress dialog, defer all this till we go idle.
|
||||
*/
|
||||
Glib::signal_idle().connect (bind (mem_fun (*this, &Editor::idle_drop_paths), paths, frame, cy));
|
||||
#else
|
||||
drop_paths_part_two (paths, frame, cy);
|
||||
#endif
|
||||
}
|
||||
|
||||
out:
|
||||
context->drag_finish (true, false, time);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include <ardour/audiofilesource.h>
|
||||
#include <ardour/silentfilesource.h>
|
||||
#include <ardour/session_region.h>
|
||||
#include <ardour/profile.h>
|
||||
|
||||
#include <gtkmm2ext/stop_signal.h>
|
||||
|
||||
|
|
@ -637,14 +638,17 @@ Editor::region_list_display_drag_data_received (const RefPtr<Gdk::DragContext>&
|
|||
vector<ustring> paths;
|
||||
|
||||
if (data.get_target() == "GTK_TREE_MODEL_ROW") {
|
||||
cerr << "Delete drag data drop to treeview\n";
|
||||
region_list_display.on_drag_data_received (context, x, y, data, info, time);
|
||||
return;
|
||||
}
|
||||
|
||||
if (convert_drop_to_paths (paths, context, x, y, data, info, time) == 0) {
|
||||
nframes64_t pos = 0;
|
||||
do_embed (paths, Editing::ImportDistinctFiles, ImportAsRegion, pos);
|
||||
if (Profile->get_sae() || Config->get_only_copy_imported_files()) {
|
||||
do_import (paths, Editing::ImportDistinctFiles, Editing::ImportAsRegion, SrcBest, pos);
|
||||
} else {
|
||||
do_embed (paths, Editing::ImportDistinctFiles, ImportAsRegion, pos);
|
||||
}
|
||||
context->drag_finish (true, false, time);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,11 @@ void
|
|||
Editor::handle_gui_changes (const string & what, void *src)
|
||||
{
|
||||
ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::handle_gui_changes), what, src));
|
||||
|
||||
|
||||
if (ignore_gui_changes) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (what == "track_height") {
|
||||
/* Optional :make tracks change height while it happens, instead
|
||||
of on first-idle
|
||||
|
|
@ -591,14 +595,10 @@ Editor::route_list_display_drag_data_received (const RefPtr<Gdk::DragContext>& c
|
|||
const SelectionData& data,
|
||||
guint info, guint time)
|
||||
{
|
||||
cerr << "RouteLD::dddr target = " << data.get_target() << endl;
|
||||
|
||||
if (data.get_target() == "GTK_TREE_MODEL_ROW") {
|
||||
cerr << "Delete drag data drop to treeview\n";
|
||||
route_list_display.on_drag_data_received (context, x, y, data, info, time);
|
||||
return;
|
||||
}
|
||||
cerr << "some other kind of drag\n";
|
||||
context->drag_finish (true, false, time);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -171,6 +171,8 @@ RedirectBox::route_going_away ()
|
|||
void
|
||||
RedirectBox::object_drop (string type, uint32_t cnt, const boost::shared_ptr<Redirect>* ptr)
|
||||
{
|
||||
cerr << "Object drop, type = " << type << " cnt = " << cnt << endl;
|
||||
|
||||
if (type != "redirects" || cnt == 0 || !ptr) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -412,7 +412,8 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev)
|
|||
|
||||
#undef DEBUG_ACCELERATOR_HANDLING
|
||||
#ifdef DEBUG_ACCELERATOR_HANDLING
|
||||
bool debug = (getenv ("ARDOUR_DEBUG_ACCELERATOR_HANDLING") != 0);
|
||||
//bool debug = (getenv ("ARDOUR_DEBUG_ACCELERATOR_HANDLING") != 0);
|
||||
bool debug=true;
|
||||
#endif
|
||||
if (focus) {
|
||||
if (GTK_IS_ENTRY(focus) || Keyboard::some_magic_widget_has_focus()) {
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#ifndef __CAAudioFile_h__
|
||||
#define __CAAudioFile_h__
|
||||
|
||||
#include <iostream>
|
||||
#include <AvailabilityMacros.h>
|
||||
|
||||
#if !defined(__COREAUDIO_USE_FLAT_INCLUDES__)
|
||||
|
|
@ -98,6 +99,7 @@ public:
|
|||
// implementation-independent helpers
|
||||
void Open(const char *filePath) {
|
||||
FSRef fsref;
|
||||
std::cerr << "Opening " << filePath << std::endl;
|
||||
XThrowIfError(FSPathMakeRef((UInt8 *)filePath, &fsref, NULL), "locate audio file");
|
||||
Open(fsref);
|
||||
}
|
||||
|
|
@ -112,9 +114,10 @@ public:
|
|||
// or the file's sample rate is 0 (unknown)
|
||||
|
||||
#if CAAF_USE_EXTAUDIOFILE
|
||||
#warning HERE WE ARE
|
||||
public:
|
||||
CAAudioFile() : mExtAF(NULL) { }
|
||||
virtual ~CAAudioFile() { if (mExtAF) Close(); }
|
||||
CAAudioFile() : mExtAF(NULL) { std::cerr << "Constructing CAAudioFile\n"; }
|
||||
virtual ~CAAudioFile() { std::cerr << "Destroying CAAudiofile @ " << this << std::endl; if (mExtAF) Close(); }
|
||||
|
||||
void Open(const FSRef &fsref) {
|
||||
// open an existing file
|
||||
|
|
@ -131,6 +134,7 @@ public:
|
|||
}
|
||||
|
||||
void Close() {
|
||||
std::cerr << "\tdisposeo of ext audio file @ " << mExtAF << std::endl;
|
||||
XThrowIfError(ExtAudioFileDispose(mExtAF), "ExtAudioFileClose failed");
|
||||
mExtAF = NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import os
|
|||
import os.path
|
||||
import glob
|
||||
|
||||
appleutility_files = glob.glob('*.cpp')
|
||||
appleutility_files = [ glob.glob('*.cpp') + glob.glob('*.c') + glob.glob('*.C') ]
|
||||
|
||||
Import('env install_prefix')
|
||||
appleutility = env.Clone()
|
||||
|
|
|
|||
|
|
@ -585,6 +585,7 @@ class Session : public PBD::StatefulDestructible
|
|||
string doing_what;
|
||||
|
||||
/* control info */
|
||||
uint32_t total;
|
||||
SrcQuality quality;
|
||||
volatile bool freeze;
|
||||
std::vector<Glib::ustring> paths;
|
||||
|
|
@ -592,7 +593,6 @@ class Session : public PBD::StatefulDestructible
|
|||
|
||||
/* result */
|
||||
SourceList sources;
|
||||
|
||||
};
|
||||
|
||||
void import_audiofiles (import_status&);
|
||||
|
|
|
|||
|
|
@ -50,8 +50,10 @@
|
|||
#include <ardour/analyser.h>
|
||||
|
||||
#ifdef HAVE_COREAUDIO
|
||||
#ifdef USE_COREAUDIO_FOR_FILE_IO
|
||||
#include <ardour/caimportable.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
|
|
@ -63,11 +65,13 @@ static boost::shared_ptr<ImportableSource>
|
|||
open_importable_source (const string& path, nframes_t samplerate, ARDOUR::SrcQuality quality)
|
||||
{
|
||||
#ifdef HAVE_COREAUDIO
|
||||
#ifdef USE_COREAUDIO_FOR_FILE_IO
|
||||
|
||||
/* see if we can use CoreAudio to handle the IO */
|
||||
|
||||
try {
|
||||
boost::shared_ptr<CAImportableSource> source(new CAImportableSource(path));
|
||||
CAImportableSource* src = new CAImportableSource(path);
|
||||
boost::shared_ptr<CAImportableSource> source (src);
|
||||
|
||||
if (source->samplerate() == samplerate) {
|
||||
return source;
|
||||
|
|
@ -81,14 +85,12 @@ open_importable_source (const string& path, nframes_t samplerate, ARDOUR::SrcQua
|
|||
catch (...) {
|
||||
|
||||
/* fall back to SndFile */
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
@ -103,8 +105,10 @@ open_importable_source (const string& path, nframes_t samplerate, ARDOUR::SrcQua
|
|||
}
|
||||
|
||||
#ifdef HAVE_COREAUDIO
|
||||
#ifdef USE_COREAUDIO_FOR_FILE_IO
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static std::string
|
||||
|
|
@ -246,8 +250,6 @@ 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]));
|
||||
}
|
||||
|
|
@ -284,8 +286,6 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -306,9 +306,6 @@ 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();
|
||||
|
|
@ -320,13 +317,11 @@ 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;
|
||||
}
|
||||
|
|
@ -355,10 +350,8 @@ Session::import_audiofiles (import_status& status)
|
|||
}
|
||||
|
||||
status.doing_what = compose_status_message (*p, source->samplerate(),
|
||||
frame_rate(), cnt, status.paths.size());
|
||||
frame_rate(), cnt, status.total);
|
||||
|
||||
cerr << "about to write audio data\n";
|
||||
|
||||
write_audio_data_to_new_files (source.get(), status, newfiles);
|
||||
}
|
||||
|
||||
|
|
@ -393,7 +386,6 @@ Session::import_audiofiles (import_status& status)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ 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 ()
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ DnDTreeViewBase::add_drop_targets (list<TargetEntry>& targets)
|
|||
for (list<TargetEntry>::iterator i = targets.begin(); i != targets.end(); ++i) {
|
||||
draggable.push_back (*i);
|
||||
}
|
||||
|
||||
enable_model_drag_source (draggable);
|
||||
enable_model_drag_dest (draggable);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,13 +74,11 @@ 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);
|
||||
|
||||
} else if (data_column >= 0) {
|
||||
|
||||
Gtk::TreeSelection::ListHandle_Path selection = get_selection()->get_selected_rows ();
|
||||
SerializedObjectPointers<DataType>* sr = serialize_pointers (get_model(), &selection, selection_data.get_target());
|
||||
selection_data.set (8, (guchar*)sr, sr->size);
|
||||
|
|
@ -88,7 +86,6 @@ class DnDTreeView : public DnDTreeViewBase
|
|||
}
|
||||
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
$Id$
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <time.h>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue