summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-03-08 23:22:01 +0100
committerCarl Hetherington <cth@carlh.net>2022-03-09 17:02:38 +0100
commitb308b958c1d3e117ff7036482d9fc3b4164aca25 (patch)
tree81491b8a94b4ccb0828fa4d7b02e47ccccc7541d
parent8faf9f61d2c0a2f79cb45b0a13a9950d4b795a1b (diff)
Only look in the filename (not the whole path) when guessing channels for sound files (#2204).
-rw-r--r--src/lib/audio_mapping.cc2
-rw-r--r--test/audio_mapping_test.cc3
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);
}