summaryrefslogtreecommitdiff
path: root/libs/ardour/import.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-05-19 23:36:18 +0000
committerCarl Hetherington <carl@carlh.net>2010-05-19 23:36:18 +0000
commit03bed9a8cbce3cdc6c00040967f58686e91536ca (patch)
treea0b31c939d6f72ec6fe41c9f371665e2142cfe25 /libs/ardour/import.cc
parent6ad69a206ca325e9e50eff4f8f2088170b468f00 (diff)
Use SMFSource static method to look for MIDI file extensions.
git-svn-id: svn://localhost/ardour2/branches/3.0@7120 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/import.cc')
-rw-r--r--libs/ardour/import.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc
index 0f57ea0144..021e456bb4 100644
--- a/libs/ardour/import.cc
+++ b/libs/ardour/import.cc
@@ -169,8 +169,7 @@ get_paths_for_new_sources (const bool allow_replacing, const string& import_file
for (uint n = 0; n < channels; ++n) {
- const DataType type = (import_file_path.rfind(".mid") != string::npos)
- ? DataType::MIDI : DataType::AUDIO;
+ const DataType type = SMFSource::safe_midi_file_extension (import_file_path) ? DataType::MIDI : DataType::AUDIO;
std::string filepath = (type == DataType::MIDI)
? sdir.midi_path().to_string() : sdir.sound_path().to_string();
@@ -213,8 +212,7 @@ create_mono_sources_for_writing (const vector<string>& new_paths, Session& sess,
try
{
- const DataType type = ((*i).rfind(".mid") != string::npos)
- ? DataType::MIDI : DataType::AUDIO;
+ const DataType type = SMFSource::safe_midi_file_extension (*i) ? DataType::MIDI : DataType::AUDIO;
source = SourceFactory::createWritable (type, sess,
@@ -453,8 +451,7 @@ Session::import_audiofiles (ImportStatus& status)
{
boost::shared_ptr<ImportableSource> source;
std::auto_ptr<Evoral::SMF> smf_reader;
- const DataType type = ((*p).rfind(".mid") != string::npos) ?
- DataType::MIDI : DataType::AUDIO;
+ const DataType type = SMFSource::safe_midi_file_extension (*p) ? DataType::MIDI : DataType::AUDIO;
if (type == DataType::AUDIO) {
try {