summaryrefslogtreecommitdiff
path: root/gtk2_ardour/sfdb_ui.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-02-18 19:45:52 +0000
committerDavid Robillard <d@drobilla.net>2008-02-18 19:45:52 +0000
commitfbfb26b45c075da880861cf2303b851fe1acc0e8 (patch)
tree4673a82d5516535b17e9c60ffd57a206801a1e01 /gtk2_ardour/sfdb_ui.cc
parent1b2fe7bf34f1e05ab4e3975ac91aeda28a4d11d0 (diff)
Preliminary (read: kludgey) MIDI import support.
Only really works when tracks contain only channel 1 data for now. git-svn-id: svn://localhost/ardour2/branches/3.0@3083 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/sfdb_ui.cc')
-rw-r--r--gtk2_ardour/sfdb_ui.cc28
1 files changed, 24 insertions, 4 deletions
diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc
index 9bb0c75795..13d3230437 100644
--- a/gtk2_ardour/sfdb_ui.cc
+++ b/gtk2_ardour/sfdb_ui.cc
@@ -39,6 +39,8 @@
#include <ardour/auditioner.h>
#include <ardour/audioregion.h>
#include <ardour/audiofilesource.h>
+#include <ardour/smf_source.h>
+#include <ardour/smf_reader.h>
#include <ardour/region_factory.h>
#include <ardour/source_factory.h>
#include <ardour/session.h>
@@ -433,13 +435,17 @@ SoundFileBrowser::SoundFileBrowser (Gtk::Window& parent, string title, ARDOUR::S
found_list_view.get_selection()->set_mode (SELECTION_MULTIPLE);
found_list_view.signal_row_activated().connect (mem_fun (*this, &SoundFileBrowser::found_list_view_activated));
- custom_filter.add_custom (FILE_FILTER_FILENAME, mem_fun(*this, &SoundFileBrowser::on_custom));
- custom_filter.set_name (_("Audio files"));
+ audio_filter.add_custom (FILE_FILTER_FILENAME, mem_fun(*this, &SoundFileBrowser::on_audio_filter));
+ audio_filter.set_name (_("Audio files"));
+
+ midi_filter.add_custom (FILE_FILTER_FILENAME, mem_fun(*this, &SoundFileBrowser::on_midi_filter));
+ midi_filter.set_name (_("MIDI files"));
matchall_filter.add_pattern ("*.*");
matchall_filter.set_name (_("All files"));
- chooser.add_filter (custom_filter);
+ chooser.add_filter (audio_filter);
+ chooser.add_filter (midi_filter);
chooser.add_filter (matchall_filter);
chooser.set_select_multiple (true);
chooser.signal_update_preview().connect(mem_fun(*this, &SoundFileBrowser::update_preview));
@@ -552,11 +558,17 @@ SoundFileBrowser::meter ()
}
bool
-SoundFileBrowser::on_custom (const FileFilter::Info& filter_info)
+SoundFileBrowser::on_audio_filter (const FileFilter::Info& filter_info)
{
return AudioFileSource::safe_file_extension (filter_info.filename);
}
+bool
+SoundFileBrowser::on_midi_filter (const FileFilter::Info& filter_info)
+{
+ return SMFSource::safe_file_extension (filter_info.filename);
+}
+
void
SoundFileBrowser::update_preview ()
{
@@ -894,6 +906,14 @@ SoundFileOmega::check_info (const vector<ustring>& paths, bool& same_size, bool&
src_needed = true;
}
+ } else if (SMFSource::safe_file_extension (*i)) {
+ SMFReader reader(*i);
+ if (reader.num_tracks() > 1) {
+ cout << *i << " MULTI CHANNEL" << endl;
+ multichannel = true;
+ } else {
+ cout << *i << " SINGLE CHANNEL" << endl;
+ }
} else {
err = true;
}