Only look in the filename (not the whole path) when guessing channels for sound files...
authorCarl Hetherington <cth@carlh.net>
Tue, 8 Mar 2022 22:22:01 +0000 (23:22 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 8 Mar 2022 22:22:01 +0000 (23:22 +0100)
src/lib/audio_mapping.cc
test/audio_mapping_test.cc

index 8b9f102a56fdae460987cac010ee87ab89098178..aa67f5097c09d275be08865efd180aed0ce0281f 100644 (file)
@@ -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;
                                        }
index e7e2838372447d085635affc80adcdaa7325a838..8599c6af561911ad67756d015e5bd4b8f4edb219 100644 (file)
@@ -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);
 }