SHA256
1
0
forked from pool/alsa-utils
alsa-utils/0007-speaker-test-Fix-wrong-wave-file-played-back-in-chma.patch
Takashi Iwai 09505b7b5a Accepting request 179268 from home:tiwai:branches:multimedia:libs
- Backport upstream fixes wrt chmap handling:
  0006-amixer-Print-TLV-of-channel-map-controls.patch
  0007-speaker-test-Fix-wrong-wave-file-played-back-in-chma.patch

- Backport upstream fixes wrt amixer:
  0004-amixer-Fix-the-hctl-elem-search-bug.patch
  0005-amixer-fix-print_dB-for-0.99-.-0.01-range.patch

OBS-URL: https://build.opensuse.org/request/show/179268
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=83
2013-06-17 09:40:34 +00:00

50 lines
1.6 KiB
Diff

From 7ac9508c4e20097290b322c661f550e7c24bfa44 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Mon, 10 Jun 2013 16:42:48 +0200
Subject: [PATCH] speaker-test: Fix wrong wave file played back in chmap setup
When explicitly specifying channel maps, we need to use that when
loading wave files so the correct file is played back.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
speaker-test/speaker-test.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
index a41b5bd..d35065f 100644
--- a/speaker-test/speaker-test.c
+++ b/speaker-test/speaker-test.c
@@ -771,8 +771,16 @@ static int setup_wav_file(int chn)
if (given_test_wav_file)
return check_wav_file(chn, given_test_wav_file);
- else
- return check_wav_file(chn, wavs[chn]);
+
+#ifdef CONFIG_SUPPORT_CHMAP
+ if (channel_map_set && chn < channel_map->channels) {
+ int channel = channel_map->pos[chn] - SND_CHMAP_FL;
+ if (channel >= 0 && channel < MAX_CHANNELS)
+ return check_wav_file(chn, wavs[channel]);
+ }
+#endif
+
+ return check_wav_file(chn, wavs[chn]);
}
static int read_wav(uint16_t *buf, int channel, int offset, int bufsize)
@@ -1179,7 +1187,7 @@ int main(int argc, char *argv[]) {
if (test_type == TEST_WAV) {
for (chn = 0; chn < channels; chn++) {
- if (setup_wav_file(chn) < 0)
+ if (setup_wav_file(get_speaker_channel(chn)) < 0)
prg_exit(EXIT_FAILURE);
}
}
--
1.8.3