diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-03-08 23:22:01 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-03-08 23:22:01 +0100 |
| commit | 1a3bf8411529e2d6c21244b970c3e5d962396cce (patch) | |
| tree | fa50bd229d53c002686f048a08af5c63729fc134 | |
| parent | b3846a3f0f650ded3019bb4305b63d5675fb9d74 (diff) | |
Only look in the filename (not the whole path) when guessing channels for sound files (#2204).
| -rw-r--r-- | src/lib/audio_mapping.cc | 2 | ||||
| -rw-r--r-- | test/audio_mapping_test.cc | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/audio_mapping.cc b/src/lib/audio_mapping.cc index 8b9f102a5..aa67f5097 100644 --- a/src/lib/audio_mapping.cc +++ b/src/lib/audio_mapping.cc @@ -125,7 +125,7 @@ AudioMapping::make_default (AudioProcessor const * processor, optional<boost::fi if (filename) { for (int i = 0; i < regexes; ++i) { boost::regex e (regex[i].regex, boost::regex::icase); - if (boost::regex_match(filename->string(), e) && regex[i].channel < output_channels()) { + if (boost::regex_match(filename->filename().string(), e) && regex[i].channel < output_channels()) { set (0, regex[i].channel, 1); guessed = true; } diff --git a/test/audio_mapping_test.cc b/test/audio_mapping_test.cc index e7e283837..8599c6af5 100644 --- a/test/audio_mapping_test.cc +++ b/test/audio_mapping_test.cc @@ -93,6 +93,9 @@ BOOST_AUTO_TEST_CASE (audio_mapping_guess_test) guess_check ("ptish_Rsr_abc.wav", 7); guess_check ("more_Lss_s.wav", 4); guess_check ("other_Rss.aiff", 5); + + /* Only the filename should be taken into acccount */ + guess_check ("-Lfe-/foo_L.wav", 0); } |
