mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-10 15:36:24 +01:00
allow import to selected MIDI tracks (note that this gets confused if the MIDI file contains multiple MetaTracks - each track ends up in the same track, which may or may not be the right thing)
git-svn-id: svn://localhost/ardour2/branches/3.0@9938 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
921358a5f3
commit
8fb9e72a77
3 changed files with 67 additions and 35 deletions
|
|
@ -98,7 +98,8 @@ void
|
|||
Editor::external_audio_dialog ()
|
||||
{
|
||||
vector<string> paths;
|
||||
uint32_t track_cnt;
|
||||
uint32_t audio_track_cnt;
|
||||
uint32_t midi_track_cnt;
|
||||
|
||||
if (_session == 0) {
|
||||
MessageDialog msg (_("You can't import or embed an audiofile until you have a session loaded."));
|
||||
|
|
@ -106,22 +107,32 @@ Editor::external_audio_dialog ()
|
|||
return;
|
||||
}
|
||||
|
||||
track_cnt = 0;
|
||||
audio_track_cnt = 0;
|
||||
midi_track_cnt = 0;
|
||||
|
||||
for (TrackSelection::iterator x = selection->tracks.begin(); x != selection->tracks.end(); ++x) {
|
||||
AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*>(*x);
|
||||
|
||||
if (!atv) {
|
||||
continue;
|
||||
} else if (atv->is_audio_track()) {
|
||||
track_cnt++;
|
||||
if (atv) {
|
||||
if (atv->is_audio_track()) {
|
||||
audio_track_cnt++;
|
||||
}
|
||||
|
||||
} else {
|
||||
MidiTimeAxisView* mtv = dynamic_cast<MidiTimeAxisView*>(*x);
|
||||
|
||||
if (mtv) {
|
||||
if (mtv->is_midi_track()) {
|
||||
midi_track_cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sfbrowser == 0) {
|
||||
sfbrowser = new SoundFileOmega (*this, _("Add Existing Media"), _session, track_cnt, true);
|
||||
sfbrowser = new SoundFileOmega (*this, _("Add Existing Media"), _session, audio_track_cnt, midi_track_cnt, true);
|
||||
} else {
|
||||
sfbrowser->reset (track_cnt);
|
||||
sfbrowser->reset (audio_track_cnt, midi_track_cnt);
|
||||
}
|
||||
|
||||
sfbrowser->show_all ();
|
||||
|
|
|
|||
|
|
@ -940,29 +940,42 @@ SoundFileOmega::reset_options ()
|
|||
string existing_choice;
|
||||
vector<string> action_strings;
|
||||
|
||||
if (selected_track_cnt > 0) {
|
||||
if (channel_combo.get_active_text().length()) {
|
||||
ImportDisposition id = get_channel_disposition();
|
||||
if (chooser.get_filter() == &audio_filter) {
|
||||
|
||||
switch (id) {
|
||||
case Editing::ImportDistinctFiles:
|
||||
if (selected_track_cnt == paths.size()) {
|
||||
/* AUDIO */
|
||||
|
||||
if (selected_audio_track_cnt > 0) {
|
||||
if (channel_combo.get_active_text().length()) {
|
||||
ImportDisposition id = get_channel_disposition();
|
||||
|
||||
switch (id) {
|
||||
case Editing::ImportDistinctFiles:
|
||||
if (selected_audio_track_cnt == paths.size()) {
|
||||
action_strings.push_back (importmode2string (ImportToTrack));
|
||||
}
|
||||
break;
|
||||
|
||||
case Editing::ImportDistinctChannels:
|
||||
/* XXX it would be nice to allow channel-per-selected track
|
||||
but its too hard we don't want to deal with all the
|
||||
different per-file + per-track channel configurations.
|
||||
*/
|
||||
break;
|
||||
|
||||
default:
|
||||
action_strings.push_back (importmode2string (ImportToTrack));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case Editing::ImportDistinctChannels:
|
||||
/* XXX it would be nice to allow channel-per-selected track
|
||||
but its too hard we don't want to deal with all the
|
||||
different per-file + per-track channel configurations.
|
||||
*/
|
||||
break;
|
||||
|
||||
default:
|
||||
action_strings.push_back (importmode2string (ImportToTrack));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/* MIDI */
|
||||
|
||||
if (selected_midi_track_cnt > 0) {
|
||||
action_strings.push_back (importmode2string (ImportToTrack));
|
||||
}
|
||||
}
|
||||
|
||||
action_strings.push_back (importmode2string (ImportAsTrack));
|
||||
|
|
@ -1225,11 +1238,15 @@ SoundFileChooser::get_filename ()
|
|||
return paths.front();
|
||||
}
|
||||
|
||||
SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Session* s, int selected_tracks, bool persistent,
|
||||
SoundFileOmega::SoundFileOmega (Gtk::Window& parent, string title, ARDOUR::Session* s,
|
||||
uint32_t selected_audio_tracks,
|
||||
uint32_t selected_midi_tracks,
|
||||
bool persistent,
|
||||
Editing::ImportMode mode_hint)
|
||||
: SoundFileBrowser (parent, title, s, persistent),
|
||||
copy_files_btn ( _("Copy files to session")),
|
||||
selected_track_cnt (selected_tracks)
|
||||
: SoundFileBrowser (parent, title, s, persistent)
|
||||
, copy_files_btn ( _("Copy files to session"))
|
||||
, selected_audio_track_cnt (selected_audio_tracks)
|
||||
, selected_midi_track_cnt (selected_midi_tracks)
|
||||
{
|
||||
VBox* vbox;
|
||||
HBox* hbox;
|
||||
|
|
@ -1449,9 +1466,10 @@ SoundFileOmega::get_channel_disposition () const
|
|||
}
|
||||
|
||||
void
|
||||
SoundFileOmega::reset (int selected_tracks)
|
||||
SoundFileOmega::reset (uint32_t selected_audio_tracks, uint32_t selected_midi_tracks)
|
||||
{
|
||||
selected_track_cnt = selected_tracks;
|
||||
selected_audio_track_cnt = selected_audio_tracks;
|
||||
selected_midi_track_cnt = selected_midi_tracks;
|
||||
reset_options ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -205,10 +205,12 @@ class SoundFileOmega : public SoundFileBrowser
|
|||
{
|
||||
|
||||
public:
|
||||
SoundFileOmega (Gtk::Window& parent, std::string title, ARDOUR::Session* _s, int selected_tracks, bool persistent,
|
||||
SoundFileOmega (Gtk::Window& parent, std::string title, ARDOUR::Session* _s,
|
||||
uint32_t selected_audio_tracks, uint32_t selected_midi_tracks,
|
||||
bool persistent,
|
||||
Editing::ImportMode mode_hint = Editing::ImportAsTrack);
|
||||
|
||||
void reset (int selected_tracks);
|
||||
void reset (uint32_t selected_audio_tracks, uint32_t selected_midi_tracks);
|
||||
|
||||
Gtk::ComboBoxText action_combo;
|
||||
Gtk::ComboBoxText where_combo;
|
||||
|
|
@ -227,7 +229,8 @@ class SoundFileOmega : public SoundFileBrowser
|
|||
void on_hide();
|
||||
|
||||
private:
|
||||
uint32_t selected_track_cnt;
|
||||
uint32_t selected_audio_track_cnt;
|
||||
uint32_t selected_midi_track_cnt;
|
||||
|
||||
typedef std::map<std::string,Editing::ImportDisposition> DispositionMap;
|
||||
DispositionMap disposition_map;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue