GUI support for type-0/1 SMF import (display channel/track count)

This needs further work:

Type-1 SMF are always
   "One [Ardour] track per [MIDI] track"

Only type-0 SMF have the option
   "One [Ardour] track per [MIDI] channel"
and
   "One [Ardour] track per [MIDI] file"


This is ambiguous with multi-channel audio or multiple selection,
mixed audio+midi and worse with mixed type0/1 .mid selection.

This calls for a dedicated dropdown to select MIDI Import Disposition
for type-0 SMF.
This commit is contained in:
Robin Gareus 2016-10-05 21:01:21 +02:00
parent aa4343a18c
commit 2a27cc4758
2 changed files with 22 additions and 2 deletions

View File

@ -484,6 +484,7 @@ Editor::import_sndfiles (vector<string> paths,
import_status.freeze = false;
import_status.quality = quality;
import_status.replace_existing_source = replace;
import_status.split_midi_channels = (disposition == Editing::ImportDistinctChannels);
import_status.mode = mode;
import_status.pos = pos;

View File

@ -303,7 +303,15 @@ SoundFileBox::setup_labels (const string& filename)
tags_entry.set_sensitive (false);
if (ms) {
channels_value.set_text (to_string(ms->num_tracks(), std::dec));
if (ms->is_type0()) {
channels_value.set_text (to_string(ms->channels().size(), std::dec));
} else {
if (ms->num_tracks() > 1) {
channels_value.set_text (to_string(ms->num_tracks(), std::dec) + _("(Tracks)"));
} else {
channels_value.set_text (to_string(ms->num_tracks(), std::dec));
}
}
length_clock.set (ms->length(ms->timeline_position()));
} else {
channels_value.set_text ("");
@ -1428,6 +1436,7 @@ SoundFileOmega::reset_options ()
vector<string> channel_strings;
if (mode == ImportAsTrack || mode == ImportAsTapeTrack || mode == ImportToTrack) {
/// XXX needs special casing for MIDI type-1 files
channel_strings.push_back (_("one track per file"));
if (selection_includes_multichannel) {
@ -1571,7 +1580,17 @@ SoundFileOmega::check_info (const vector<string>& paths, bool& same_size, bool&
Evoral::SMF reader;
reader.open(*i);
if (reader.num_tracks() > 1) {
multichannel = true; // "channel" == track here...
/* NOTE: we cannot merge midi-tracks.
* they will always be on separate tracks
* "one track per file" is not possible.
*/
//multichannel = true; // "channel" == track here...
}
if (reader.is_type0 () && reader.channels().size() > 1) {
/* for type-0 files, we can split
* "one track per channel"
*/
multichannel = true;
}
/* XXX we need err = true handling here in case