From patchwork Wed Dec 7 16:44:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud POULIQUEN X-Patchwork-Id: 9465193 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E40A66022E for ; Wed, 7 Dec 2016 20:11:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA503284AD for ; Wed, 7 Dec 2016 20:11:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDF3B28569; Wed, 7 Dec 2016 20:11:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34E56284AD for ; Wed, 7 Dec 2016 20:11:29 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8656226732F; Wed, 7 Dec 2016 21:11:28 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 54800266801; Wed, 7 Dec 2016 21:09:08 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 29F8C267256; Wed, 7 Dec 2016 17:45:17 +0100 (CET) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by alsa0.perex.cz (Postfix) with ESMTP id 6E757267234 for ; Wed, 7 Dec 2016 17:45:13 +0100 (CET) Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id uB7Gfkhf021660; Wed, 7 Dec 2016 17:45:13 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-.pphosted.com with ESMTP id 275mqtdc7f-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 07 Dec 2016 17:45:13 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B650E3A; Wed, 7 Dec 2016 16:45:07 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas21.st.com [10.75.90.44]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id EC5F52BAD; Wed, 7 Dec 2016 16:45:06 +0000 (GMT) Received: from localhost (10.201.23.162) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.294.0; Wed, 7 Dec 2016 17:45:06 +0100 From: Arnaud Pouliquen To: Date: Wed, 7 Dec 2016 17:44:26 +0100 Message-ID: <1481129066-15961-1-git-send-email-arnaud.pouliquen@st.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.201.23.162] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-12-07_06:, , signatures=0 Cc: Takashi Iwai , lgirdwood@gmail.com, broonie@kernel.org, Anssi Hannula , Charles Keepax , Takashi Sakamoto Subject: [alsa-devel] [PATCH] speaker-test: Fix chmap wav file selection. X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The channel selection currently does not work properly when a channel map control is provided but no manual channel map was explicitly requested with "-m". For example, the CEA/HDMI 6ch (surround 5.1) map is: FL, FR, LFE, FC, RL, RR. Tested command: speaker-test -D hdmi -c 6 -t wav Speaker-test tries to play channels in this following order: 0 - Front Left 3 - Front Center 1 - Front Right 5 - Rear Right 4 - Rear Left 2 - LFE But wav file played on associated speakers are not aligned. Here are the real files played: 0- /usr/share/sounds/alsa/Front_Left.wav => OK 3- /usr/share/sounds/alsa/Rear_Right.wav => OK 1- /usr/share/sounds/alsa/Front_Right.wav => OK 5- /usr/share/sounds/alsa/Rear_Center.wav => KO 4- found file /usr/share/sounds/alsa/Front_Center.wav => KO 2- /usr/share/sounds/alsa/Rear_Left.wav => KO Issue is that associated wav files ordering is reworked only if channel_map_set variable is set. Fix consists in allowing wavs re-ordering if a channel mapping as been get or set, i.e. channel_map is not null. Signed-off-by: Arnaud Pouliquen --- speaker-test/speaker-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c index 5b9cbec..46b0589 100644 --- a/speaker-test/speaker-test.c +++ b/speaker-test/speaker-test.c @@ -843,7 +843,7 @@ static int setup_wav_file(int chn) return check_wav_file(chn, given_test_wav_file); #ifdef CONFIG_SUPPORT_CHMAP - if (channel_map_set && chn < channel_map->channels) { + if (channel_map && 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]);