mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-07 06:05:43 +01:00
more upgrades to the import dialog
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2358 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
cc455e0d0a
commit
6c2728f981
9 changed files with 277 additions and 151 deletions
|
|
@ -161,5 +161,26 @@ const char *importmodestrs[] = {
|
|||
#undef IMPORTMODE
|
||||
#define IMPORTMODE(a) /*empty*/
|
||||
|
||||
//IMPORTPOSITION
|
||||
#undef IMPORTPOSITION
|
||||
#define IMPORTPOSITION(s) N_(#s),
|
||||
const char *importpositionstrs[] = {
|
||||
#include "editing_syms.h"
|
||||
0
|
||||
};
|
||||
#undef IMPORTPOSITION
|
||||
#define IMPORTPOSITION(a) /*empty*/
|
||||
|
||||
//IMPORTCHANNEL
|
||||
#undef IMPORTCHANNEL
|
||||
#define IMPORTCHANNEL(s) N_(#s),
|
||||
const char *importchannelstrs[] = {
|
||||
#include "editing_syms.h"
|
||||
0
|
||||
};
|
||||
#undef IMPORTCHANNEL
|
||||
#define IMPORTCHANNEL(a) /*empty*/
|
||||
|
||||
|
||||
} // namespace Editing
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
#define ZOOMFOCUS(a) /*empty*/
|
||||
#define DISPLAYCONTROL(a) /*empty*/
|
||||
#define IMPORTMODE(a) /*empty*/
|
||||
#define IMPORTPOSITION(a) /*empty*/
|
||||
#define IMPORTCHANNEL(a) /*empty*/
|
||||
|
||||
namespace Editing {
|
||||
|
||||
|
|
@ -127,13 +129,37 @@ enum ImportMode {
|
|||
#include "editing_syms.h"
|
||||
};
|
||||
|
||||
extern const char *importmodestrs[];
|
||||
inline const char* enum2str(ImportMode m) {return importmodestrs[m];}
|
||||
ImportMode str2importmode (const std::string &);
|
||||
|
||||
#undef IMPORTMODE
|
||||
#define IMPORTMODE(a) /*empty*/
|
||||
|
||||
// IMPORTPOSITION
|
||||
#undef IMPORTPOSITION
|
||||
#define IMPORTPOSITION(a) a,
|
||||
enum ImportPosition {
|
||||
#include "editing_syms.h"
|
||||
};
|
||||
|
||||
extern const char *importpositionstrs[];
|
||||
inline const char* enum2str(ImportPosition m) {return importpositionstrs[m];}
|
||||
ImportPosition str2importposition (const std::string &);
|
||||
|
||||
#undef IMPORTPOSITION
|
||||
#define IMPORTPOSITION(a) /*empty*/
|
||||
|
||||
// IMPORTCHANNEL
|
||||
#undef IMPORTCHANNEL
|
||||
#define IMPORTCHANNEL(a) a,
|
||||
enum ImportChannel {
|
||||
#include "editing_syms.h"
|
||||
};
|
||||
|
||||
extern const char *importchannelstrs[];
|
||||
inline const char* enum2str(ImportChannel m) {return importchannelstrs[m];}
|
||||
ImportPosition str2importchannel (const std::string &);
|
||||
|
||||
#undef IMPORTCHANNEL
|
||||
#define IMPORTCHANNEL(a) /*empty*/
|
||||
|
||||
/////////////////////
|
||||
// These don't need their state saved. yet...
|
||||
enum CutCopyOp {
|
||||
|
|
|
|||
|
|
@ -78,3 +78,15 @@ IMPORTMODE(ImportAsRegion=0)
|
|||
IMPORTMODE(ImportToTrack=1)
|
||||
IMPORTMODE(ImportAsTrack=2)
|
||||
IMPORTMODE(ImportAsTapeTrack=3)
|
||||
|
||||
// if this is changed, remember to update the string table in sfdb_ui.cc
|
||||
IMPORTPOSITION(ImportAtTimestamp=0)
|
||||
IMPORTPOSITION(ImportAtEditCursor=1)
|
||||
IMPORTPOSITION(ImportAtPlayhead=2)
|
||||
IMPORTPOSITION(ImportAtStart=3)
|
||||
|
||||
// if this is changed, remember to update the string table in sfdb_ui.cc
|
||||
IMPORTCHANNEL(ImportThingPerFile=0)
|
||||
IMPORTCHANNEL(ImportThingPerChannel=1)
|
||||
IMPORTCHANNEL(ImportThingForAll=2)
|
||||
|
||||
|
|
|
|||
|
|
@ -965,17 +965,17 @@ class Editor : public PublicEditor
|
|||
void external_audio_dialog ();
|
||||
bool check_multichannel_status (const std::vector<Glib::ustring>& paths);
|
||||
|
||||
void bring_in_external_audio (Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes_t& pos);
|
||||
void do_import (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes_t&);
|
||||
void bring_in_external_audio (Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes64_t& pos);
|
||||
void do_import (vector<Glib::ustring> paths, Editing::ImportChannel, Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes64_t&);
|
||||
|
||||
void _do_embed (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes_t&);
|
||||
void do_embed (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes_t&);
|
||||
bool idle_do_embed (vector<Glib::ustring> paths, bool split, Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes_t&);
|
||||
void _do_embed (vector<Glib::ustring> paths, Editing::ImportChannel, Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes64_t&);
|
||||
void do_embed (vector<Glib::ustring> paths, Editing::ImportChannel, Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes64_t&);
|
||||
bool idle_do_embed (vector<Glib::ustring> paths, Editing::ImportChannel, Editing::ImportMode mode, ARDOUR::AudioTrack*, nframes64_t&);
|
||||
|
||||
int import_sndfile (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::AudioTrack* track, nframes_t& pos);
|
||||
int embed_sndfile (vector<Glib::ustring> paths, bool split, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
|
||||
ARDOUR::AudioTrack* track, nframes_t& pos);
|
||||
int finish_bringing_in_audio (boost::shared_ptr<ARDOUR::AudioRegion> region, uint32_t, uint32_t, ARDOUR::AudioTrack* track, nframes_t& pos, Editing::ImportMode mode);
|
||||
int import_sndfile (vector<Glib::ustring> paths, Editing::ImportMode mode, ARDOUR::AudioTrack* track, nframes64_t& pos);
|
||||
int embed_sndfile (vector<Glib::ustring> paths, Editing::ImportChannel, bool multiple_files, bool& check_sample_rate, Editing::ImportMode mode,
|
||||
ARDOUR::AudioTrack* track, nframes64_t& pos);
|
||||
int finish_bringing_in_audio (boost::shared_ptr<ARDOUR::AudioRegion> region, uint32_t, uint32_t, ARDOUR::AudioTrack* track, nframes64_t& pos, Editing::ImportMode mode);
|
||||
|
||||
/* generic interthread progress window */
|
||||
|
||||
|
|
|
|||
|
|
@ -66,20 +66,8 @@ using Glib::ustring;
|
|||
void
|
||||
Editor::add_external_audio_action (ImportMode mode)
|
||||
{
|
||||
nframes_t& pos = edit_cursor->current_frame;
|
||||
AudioTrack* track = 0;
|
||||
|
||||
if (!selection->tracks.empty()) {
|
||||
AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*>(selection->tracks.front());
|
||||
if (atv) {
|
||||
track = atv->audio_track();
|
||||
}
|
||||
}
|
||||
|
||||
bring_in_external_audio (mode, track, pos);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Editor::external_audio_dialog ()
|
||||
{
|
||||
|
|
@ -119,27 +107,46 @@ Editor::external_audio_dialog ()
|
|||
}
|
||||
paths = browser.get_paths ();
|
||||
|
||||
ImportPosition pos = browser.get_position ();
|
||||
ImportMode mode = browser.get_mode ();
|
||||
ImportChannel chns = browser.get_channel_disposition ();
|
||||
nframes64_t where;
|
||||
|
||||
switch (pos) {
|
||||
case ImportAtEditCursor:
|
||||
where = edit_cursor->current_frame;
|
||||
break;
|
||||
case ImportAtTimestamp:
|
||||
where = -1;
|
||||
break;
|
||||
case ImportAtPlayhead:
|
||||
where = playhead_cursor->current_frame;
|
||||
break;
|
||||
case ImportAtStart:
|
||||
where = session->current_start_frame();
|
||||
break;
|
||||
}
|
||||
|
||||
if (browser.import.get_active()) {
|
||||
do_import (paths, browser.split_files.get_active(), browser.get_mode(), track, edit_cursor->current_frame);
|
||||
do_import (paths, chns, mode, track, where);
|
||||
} else {
|
||||
do_embed (paths, browser.split_files.get_active(), browser.get_mode(), track, edit_cursor->current_frame);
|
||||
do_embed (paths, chns, mode, track, where);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::bring_in_external_audio (ImportMode mode, AudioTrack* track, nframes_t& pos)
|
||||
Editor::do_import (vector<ustring> paths, ImportChannel chns, ImportMode mode, AudioTrack* track, nframes64_t& pos)
|
||||
{
|
||||
}
|
||||
switch (chns) {
|
||||
case Editing::ImportThingPerFile:
|
||||
case Editing::ImportThingForAll:
|
||||
import_status.multichan = true;
|
||||
break;
|
||||
|
||||
void
|
||||
Editor::do_import (vector<ustring> paths, bool split, ImportMode mode, AudioTrack* track, nframes_t& pos)
|
||||
{
|
||||
/* SFDB sets "multichan" to true to indicate "split channels"
|
||||
so reverse the setting to match the way libardour
|
||||
interprets it.
|
||||
*/
|
||||
|
||||
import_status.multichan = !split;
|
||||
case Editing::ImportThingPerChannel:
|
||||
import_status.multichan = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (interthread_progress_window == 0) {
|
||||
build_interthread_progress_window ();
|
||||
|
|
@ -159,112 +166,62 @@ Editor::do_import (vector<ustring> paths, bool split, ImportMode mode, AudioTrac
|
|||
}
|
||||
|
||||
bool
|
||||
Editor::idle_do_embed (vector<ustring> paths, bool split, ImportMode mode, AudioTrack* track, nframes_t& pos)
|
||||
Editor::idle_do_embed (vector<ustring> paths, ImportChannel chns, ImportMode mode, AudioTrack* track, nframes64_t& pos)
|
||||
{
|
||||
_do_embed (paths, split, mode, track, pos);
|
||||
_do_embed (paths, chns, mode, track, pos);
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
Editor::do_embed (vector<ustring> paths, bool split, ImportMode mode, AudioTrack* track, nframes_t& pos)
|
||||
Editor::do_embed (vector<ustring> paths, ImportChannel chns, ImportMode mode, AudioTrack* track, nframes64_t& pos)
|
||||
{
|
||||
#ifdef GTKOSX
|
||||
Glib::signal_idle().connect (bind (mem_fun (*this, &Editor::idle_do_embed), paths, split, mode, track, pos));
|
||||
Glib::signal_idle().connect (bind (mem_fun (*this, &Editor::idle_do_embed), paths, chns, mode, track, pos));
|
||||
#else
|
||||
_do_embed (paths, split, mode, track, pos);
|
||||
_do_embed (paths, chns, mode, track, pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
Editor::_do_embed (vector<ustring> paths, bool split, ImportMode mode, AudioTrack* track, nframes_t& pos)
|
||||
Editor::_do_embed (vector<ustring> paths, ImportChannel chns, ImportMode mode, AudioTrack* track, nframes64_t& pos)
|
||||
{
|
||||
bool multiple_files = paths.size() > 1;
|
||||
bool check_sample_rate = true;
|
||||
vector<ustring>::iterator a;
|
||||
|
||||
for (a = paths.begin(); a != paths.end(); ) {
|
||||
|
||||
Glib::ustring path = *a;
|
||||
Glib::ustring pair_base;
|
||||
vector<ustring> to_embed;
|
||||
|
||||
to_embed.push_back (path);
|
||||
a = paths.erase (a);
|
||||
|
||||
if (path_is_paired (path, pair_base)) {
|
||||
|
||||
ustring::size_type len = pair_base.length();
|
||||
|
||||
for (vector<Glib::ustring>::iterator b = paths.begin(); b != paths.end(); ) {
|
||||
|
||||
if (((*b).substr (0, len) == pair_base) && ((*b).length() == path.length())) {
|
||||
|
||||
to_embed.push_back (*b);
|
||||
|
||||
/* don't process this one again */
|
||||
|
||||
b = paths.erase (b);
|
||||
break;
|
||||
|
||||
} else {
|
||||
++b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (to_embed.size() > 1) {
|
||||
|
||||
vector<string> choices;
|
||||
|
||||
choices.push_back (string_compose (_("Import as a %1 region"),
|
||||
to_embed.size() > 2 ? _("multichannel") : _("stereo")));
|
||||
choices.push_back (_("Import as multiple regions"));
|
||||
|
||||
Choice chooser (string_compose (_("Paired files detected (%1, %2 ...).\nDo you want to:"),
|
||||
to_embed[0],
|
||||
to_embed[1]),
|
||||
choices);
|
||||
|
||||
if (chooser.run () == 0) {
|
||||
|
||||
/* keep them paired */
|
||||
|
||||
if (embed_sndfile (to_embed, split, multiple_files, check_sample_rate, mode, track, pos) < -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/* one thing per file */
|
||||
|
||||
vector<ustring> foo;
|
||||
|
||||
for (vector<ustring>::iterator x = to_embed.begin(); x != to_embed.end(); ++x) {
|
||||
|
||||
foo.clear ();
|
||||
foo.push_back (*x);
|
||||
|
||||
if (embed_sndfile (foo, split, multiple_files, check_sample_rate, mode, track, pos) < -1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (embed_sndfile (to_embed, split, multiple_files, check_sample_rate, mode, track, pos) < -1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool ok = false;
|
||||
vector<ustring> to_embed;
|
||||
|
||||
if (a == paths.end()) {
|
||||
|
||||
switch (chns) {
|
||||
case Editing::ImportThingPerFile:
|
||||
case Editing::ImportThingPerChannel:
|
||||
for (vector<ustring>::iterator a = paths.begin(); a != paths.end(); ++a) {
|
||||
|
||||
to_embed.clear ();
|
||||
to_embed.push_back (*a);
|
||||
|
||||
if (embed_sndfile (to_embed, chns, multiple_files, check_sample_rate, mode, track, pos) < -1) {
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Editing::ImportThingForAll:
|
||||
if (embed_sndfile (paths, chns, multiple_files, check_sample_rate, mode, track, pos) < -1) {
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
ok = true;
|
||||
|
||||
out:
|
||||
if (ok) {
|
||||
session->save_state ("");
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
Editor::import_sndfile (vector<ustring> paths, ImportMode mode, AudioTrack* track, nframes_t& pos)
|
||||
Editor::import_sndfile (vector<ustring> paths, ImportMode mode, AudioTrack* track, nframes64_t& pos)
|
||||
{
|
||||
WindowTitle title = string_compose (_("importing %1"), paths.front());
|
||||
|
||||
|
|
@ -315,8 +272,8 @@ Editor::import_sndfile (vector<ustring> paths, ImportMode mode, AudioTrack* trac
|
|||
}
|
||||
|
||||
int
|
||||
Editor::embed_sndfile (vector<Glib::ustring> paths, bool split, bool multiple_files, bool& check_sample_rate, ImportMode mode,
|
||||
AudioTrack* track, nframes_t& pos)
|
||||
Editor::embed_sndfile (vector<Glib::ustring> paths, Editing::ImportChannel chns, bool multiple_files, bool& check_sample_rate, ImportMode mode,
|
||||
AudioTrack* track, nframes64_t& pos)
|
||||
{
|
||||
boost::shared_ptr<AudioFileSource> source;
|
||||
SourceList sources;
|
||||
|
|
@ -470,22 +427,71 @@ Editor::embed_sndfile (vector<Glib::ustring> paths, bool split, bool multiple_fi
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (sources[0]->natural_position() != 0) {
|
||||
pos = sources[0]->natural_position();
|
||||
}
|
||||
|
||||
region_name = region_name_from_path (paths.front(), (sources.size() > 1));
|
||||
|
||||
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 {
|
||||
output_chan = input_chan;
|
||||
if (pos == -1) { // "use timestamp"
|
||||
if (sources[0]->natural_position() != 0) {
|
||||
pos = sources[0]->natural_position();
|
||||
} else {
|
||||
// XXX is this the best alternative ?
|
||||
pos = edit_cursor->current_frame;
|
||||
}
|
||||
}
|
||||
|
||||
if (chns == Editing::ImportThingPerFile || chns == Editing::ImportThingForAll) {
|
||||
|
||||
/* take all the sources we have and package them up as a region */
|
||||
|
||||
region_name = region_name_from_path (paths.front(), (sources.size() > 1));
|
||||
|
||||
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 {
|
||||
output_chan = input_chan;
|
||||
}
|
||||
|
||||
finish_bringing_in_audio (region, input_chan, output_chan, track, pos, mode);
|
||||
|
||||
} else {
|
||||
|
||||
/* take each source and create a region for each one */
|
||||
|
||||
SourceList just_one;
|
||||
SourceList::iterator x;
|
||||
vector<Glib::ustring>::iterator p = paths.begin();
|
||||
vector<Glib::ustring>::iterator next_path;
|
||||
|
||||
for (x = sources.begin(); x != sources.end(); ++x) {
|
||||
|
||||
just_one.clear ();
|
||||
just_one.push_back (*x);
|
||||
|
||||
region_name = region_name_from_path ((*p), false);
|
||||
|
||||
region = boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (just_one, 0, (*x)->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 {
|
||||
output_chan = input_chan;
|
||||
}
|
||||
|
||||
finish_bringing_in_audio (region, 1, output_chan, track, pos, mode);
|
||||
|
||||
/* don't run out of paths */
|
||||
|
||||
next_path = p;
|
||||
next_path++;
|
||||
|
||||
if (next_path != paths.end()) {
|
||||
p = next_path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
finish_bringing_in_audio (region, input_chan, output_chan, track, pos, mode);
|
||||
|
||||
out:
|
||||
track_canvas.get_window()->set_cursor (*current_canvas_cursor);
|
||||
|
|
@ -493,7 +499,7 @@ Editor::embed_sndfile (vector<Glib::ustring> paths, bool split, bool multiple_fi
|
|||
}
|
||||
|
||||
int
|
||||
Editor::finish_bringing_in_audio (boost::shared_ptr<AudioRegion> region, uint32_t in_chans, uint32_t out_chans, AudioTrack* track, nframes_t& pos, ImportMode mode)
|
||||
Editor::finish_bringing_in_audio (boost::shared_ptr<AudioRegion> region, uint32_t in_chans, uint32_t out_chans, AudioTrack* track, nframes64_t& pos, ImportMode mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case ImportAsRegion:
|
||||
|
|
@ -520,6 +526,7 @@ Editor::finish_bringing_in_audio (boost::shared_ptr<AudioRegion> region, uint32_
|
|||
list<boost::shared_ptr<AudioTrack> > at (session->new_audio_track (in_chans, out_chans, Normal, 1));
|
||||
if (!at.empty()) {
|
||||
boost::shared_ptr<AudioRegion> copy (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (region)));
|
||||
at.front()->set_name (basename_nosuffix (copy->name()), this);
|
||||
at.front()->diskstream()->playlist()->add_region (copy, pos);
|
||||
}
|
||||
break;
|
||||
|
|
@ -530,6 +537,7 @@ Editor::finish_bringing_in_audio (boost::shared_ptr<AudioRegion> region, uint32_
|
|||
list<boost::shared_ptr<AudioTrack> > at (session->new_audio_track (in_chans, out_chans, Destructive));
|
||||
if (!at.empty()) {
|
||||
boost::shared_ptr<AudioRegion> copy (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (region)));
|
||||
at.front()->set_name (basename_nosuffix (copy->name()), this);
|
||||
at.front()->diskstream()->playlist()->add_region (copy, pos);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context,
|
|||
vector<ustring> paths;
|
||||
string spath;
|
||||
GdkEvent ev;
|
||||
nframes_t frame;
|
||||
nframes64_t frame;
|
||||
|
||||
if (convert_drop_to_paths (paths, context, x, y, data, info, time)) {
|
||||
goto out;
|
||||
|
|
@ -463,15 +463,16 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context,
|
|||
|
||||
/* drop onto canvas background: create new tracks */
|
||||
|
||||
nframes_t pos = 0;
|
||||
do_embed (paths, false, ImportAsTrack, 0, pos);
|
||||
frame = 0;
|
||||
|
||||
do_embed (paths, Editing::ImportThingPerFile, ImportAsTrack, 0, frame);
|
||||
|
||||
} else if ((tv = dynamic_cast<AudioTimeAxisView*>(tvp)) != 0) {
|
||||
|
||||
/* check that its an audio track, not a bus */
|
||||
|
||||
|
||||
if (tv->get_diskstream()) {
|
||||
do_embed (paths, false, ImportToTrack, tv->audio_track(), frame);
|
||||
do_embed (paths, Editing::ImportThingPerFile, ImportToTrack, tv->audio_track(), frame);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -620,8 +620,8 @@ Editor::region_list_display_drag_data_received (const RefPtr<Gdk::DragContext>&
|
|||
vector<ustring> paths;
|
||||
|
||||
if (convert_drop_to_paths (paths, context, x, y, data, info, time) == 0) {
|
||||
nframes_t pos = 0;
|
||||
do_embed (paths, false, ImportAsRegion, 0, pos);
|
||||
nframes64_t pos = 0;
|
||||
do_embed (paths, Editing::ImportThingPerFile, ImportAsRegion, 0, pos);
|
||||
context->drag_finish (true, false, time);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -293,8 +293,6 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S
|
|||
found_list (ListStore::create(found_list_columns)),
|
||||
chooser (FILE_CHOOSER_ACTION_OPEN),
|
||||
found_list_view (found_list),
|
||||
split_files (_("Split non-mono files")),
|
||||
merge_stereo (_("Use files as single stereo track")),
|
||||
import (rgroup2, _("Copy to Ardour-native files")),
|
||||
embed (rgroup2, _("Use file without copying")),
|
||||
mode (ImportAsTrack),
|
||||
|
|
@ -346,14 +344,24 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S
|
|||
vbox->pack_start (*hbox, false, false);
|
||||
options.pack_start (*vbox, false, false);
|
||||
|
||||
|
||||
l = manage (new Label);
|
||||
l->set_text (_("Mapping:"));
|
||||
|
||||
hbox = manage (new HBox);
|
||||
hbox->set_border_width (12);
|
||||
hbox->set_spacing (6);
|
||||
hbox->pack_start (*l, false, false);
|
||||
hbox->pack_start (channel_combo, false, false);
|
||||
vbox = manage (new VBox);
|
||||
vbox->pack_start (*hbox, false, false);
|
||||
options.pack_start (*vbox, false, false);
|
||||
|
||||
reset_options ();
|
||||
|
||||
block_three.pack_start (merge_stereo, false, false);
|
||||
block_three.pack_start (split_files, false, false);
|
||||
block_four.pack_start (import, false, false);
|
||||
block_four.pack_start (embed, false, false);
|
||||
|
||||
options.pack_start (block_three, false, false);
|
||||
options.pack_start (block_four, false, false);
|
||||
|
||||
get_vbox()->pack_start (*hpacker, true, true);
|
||||
|
|
@ -524,6 +532,7 @@ SoundFileBrowser::reset_options ()
|
|||
|
||||
vector<string> action_strings;
|
||||
vector<string> where_strings;
|
||||
vector<string> channel_strings;
|
||||
|
||||
action_strings.push_back (_("as new tracks"));
|
||||
if (selected_track_cnt > 0) {
|
||||
|
|
@ -532,6 +541,7 @@ SoundFileBrowser::reset_options ()
|
|||
action_strings.push_back (_("to the region list"));
|
||||
action_strings.push_back (_("as new tape tracks"));
|
||||
|
||||
|
||||
set_popdown_strings (action_combo, action_strings);
|
||||
action_combo.set_active_text (action_strings.front());
|
||||
|
||||
|
|
@ -543,6 +553,23 @@ SoundFileBrowser::reset_options ()
|
|||
set_popdown_strings (where_combo, where_strings);
|
||||
where_combo.set_active_text (where_strings.front());
|
||||
|
||||
if (mode == ImportAsTrack) {
|
||||
channel_strings.push_back (_("one file per track"));
|
||||
|
||||
if (selection_includes_multichannel) {
|
||||
channel_strings.push_back (_("one channel per track"));
|
||||
}
|
||||
if (paths.size() > 1) {
|
||||
channel_strings.push_back (_("all files in one track"));
|
||||
}
|
||||
channel_combo.show();
|
||||
} else {
|
||||
channel_combo.hide();
|
||||
}
|
||||
|
||||
set_popdown_strings (channel_combo, channel_strings);
|
||||
channel_combo.set_active_text (channel_strings.front());
|
||||
|
||||
if (Profile->get_sae()) {
|
||||
if (selection_can_be_embedded_with_links) {
|
||||
block_four.show ();
|
||||
|
|
@ -674,4 +701,32 @@ SoundFileBrowser::get_mode () const
|
|||
}
|
||||
}
|
||||
|
||||
ImportPosition
|
||||
SoundFileBrowser::get_position() const
|
||||
{
|
||||
Glib::ustring str = where_combo.get_active_text();
|
||||
|
||||
if (str == _("use file timestamp")) {
|
||||
return ImportAtTimestamp;
|
||||
} else if (str == _("at edit cursor")) {
|
||||
return ImportAtEditCursor;
|
||||
} else if (str == _("at playhead")) {
|
||||
return ImportAtPlayhead;
|
||||
} else {
|
||||
return ImportAtStart;
|
||||
}
|
||||
}
|
||||
|
||||
ImportChannel
|
||||
SoundFileBrowser::get_channel_disposition () const
|
||||
{
|
||||
Glib::ustring str = channel_combo.get_active_text();
|
||||
|
||||
if (str == _("one file per track")) {
|
||||
return ImportThingPerFile;
|
||||
} else if (str == _("one channel per track")) {
|
||||
return ImportThingPerChannel;
|
||||
} else {
|
||||
return ImportThingForAll;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,11 +122,14 @@ class SoundFileBrowser : public ArdourDialog
|
|||
|
||||
Gtk::ComboBoxText action_combo;
|
||||
Gtk::ComboBoxText where_combo;
|
||||
Gtk::ComboBoxText channel_combo;
|
||||
|
||||
Gtk::RadioButton import;
|
||||
Gtk::RadioButton embed;
|
||||
|
||||
Editing::ImportMode get_mode() const;
|
||||
Editing::ImportPosition get_position() const;
|
||||
Editing::ImportChannel get_channel_disposition() const;
|
||||
|
||||
protected:
|
||||
Editing::ImportMode mode;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue