From patchwork Sat Apr 6 06:48:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oswald Buddenhagen X-Patchwork-Id: 13619683 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D06E4C67861 for ; Sat, 6 Apr 2024 07:17:08 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0130C2D15; Sat, 6 Apr 2024 09:16:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0130C2D15 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1712387827; bh=ZNxz9XRfUws3hzgYnAmMbJsNLrK48W67Ch08nhuDE14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=nQiMcJ1gb36kySRO53WH++6DbMKGsW/A3dOYeVYDVg0aUhN6Hji1CcZmOxdh4itRF DGeU59V+F4hTTmBeRm2/I818riz/rCrFovwQSLF8Kp1AS1Lom4/ALtVpSCV5GYlbyp Deh1CgubPRbY9YOmgNqL8CFvP+liu/fMcgWWQwAM= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D1BEBF805FE; Sat, 6 Apr 2024 09:15:47 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 807AAF80639; Sat, 6 Apr 2024 09:15:46 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BDC23F80570; Sat, 6 Apr 2024 09:01:07 +0200 (CEST) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id DBF37F8055C for ; Sat, 6 Apr 2024 09:00:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DBF37F8055C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=gmx.de header.i=oswald.buddenhagen@gmx.de header.a=rsa-sha256 header.s=s31663417 header.b=oKskrQ4y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1712386851; x=1712991651; i=oswald.buddenhagen@gmx.de; bh=xn63gzqr9xb3rSSv9m6pshIRgF/4ohQI6zGY6rUcaZo=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To: References; b=oKskrQ4y6TTCXQX4Szz3VPB+q0q6B6hn6ad2X4Lr/HdMvi6dHsQQdWX5rQSdaUsa EBQOQQqmLqq7fwHy2hzd9bnogIpajONqM4EkF0akylRl36VieefYJjQxqzQbbdloU Gaa6oeCEMXGUnVNbA3P0yfcxXXEO9eklwUr5X0M2shAWE33bixIHGN/lQhq3FXcLE nVVeYMoBYmf4A9+RboLaDYCmyhQ9uLPj8ceiL0B0wdhqa6znGBeam3aqigKuLCYlQ Dlnkz4zajhHMFD4qd30CDNBYj8zRJBhnU63uqxxjhZhEfAx5j1TPasSXtajpqMeu7 +KiDPefLbmGFFPnsJQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from ugly.fritz.box ([89.247.162.118]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MqJqD-1sXELA2Voh-00nUO6; Sat, 06 Apr 2024 09:00:51 +0200 Received: by ugly.fritz.box (masqmail 0.3.6-dev, from userid 1000) id 1rszqo-JrP-00; Sat, 06 Apr 2024 08:48:30 +0200 From: Oswald Buddenhagen To: alsa-devel@alsa-project.org Cc: Takashi Iwai , Jaroslav Kysela , Arthur Marsh Subject: [PATCH v3 12/17] ALSA: emu10k1: fix wavetable offset recalculation Date: Sat, 6 Apr 2024 08:48:25 +0200 Message-ID: <20240406064830.1029573-13-oswald.buddenhagen@gmx.de> X-Mailer: git-send-email 2.44.0.701.g2cf7baacf3.dirty In-Reply-To: <20240406064830.1029573-1-oswald.buddenhagen@gmx.de> References: <20240406064830.1029573-1-oswald.buddenhagen@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:nx0bvHlTGeloEcsuMiRFqWaVqwANfyyLmZrond+BPLQGiPM3ec1 yzz2crerYycGnFHUiVStY4sq0HLwkUbxWZX1Lr0/+TgY56CwrUkMSN+/p4VyOrts3/EO8g2 oyyo/xrILGCTBeBhPKh87/3IiGbhXAJ/IgADiQu5+kg79vmv1RyT1Qi5hdob3xRhikiWLpP IN+mTYC+P9me8KXWylHZg== UI-OutboundReport: notjunk:1;M01:P0:9tkejHezi1Y=;LSa+tYg1c/YNvmmEzZLhGqAc3Bw PJEliYfh8mAWbKSrWexLxMfnTgvrSRVnQtVLsWeBJqi4G45sckieeUiRdxl5gSPvGd5fP5elI 8vjutBOA5owZ9RERnHRY8MtK5DWAbDPBkbojQ7gLg/D6meR7t5HaVqrl/hJRR3gg5mQt1r07h ypycou61TzmtvMwXggygh8Vof8UIn08jCt5WGNGPT9J3T6o3en6ZXKejPxIfm40wxjmjtLp5l NvWHQ0Pe5pDZsb0gSdO0SQVlNBjo7Qun2pTrS6hnx2p9JJboVya+ndX2QBclVcNw94pEknlHx LEC1w+cU2MeKav0lyra0II7x14C5pcDf+bXtdJF2OhF8mYBdyvgAEYbhaOVg1OyGLvxONUKNv wMooiZdTikLXOvQ4tYB4mQ/SCV3CzvgcNEzVIOvitR0kxN1nI6+KZBOxyOp7MGxbE2zS+MYE6 BqDjWTdCGr3tDGz0vVG0C+A1LhfqR1hwBDgeyRsMgAE2m+l9A7l4eIoS1cq1oVPnEFwLKM5pH 8xc3uUqcbVfq4fuv5GWWGhKzQGa+N9wJykviMjGCp52zjlZOt3+cWlBqopb11vx940iN0ygab iEcvbXw1kYjt4ggCGFerw78ef1wKXoqAHoTR16IvzLW+V9Dry63VlwG3n5s2afF7liiW+jzER akgOOUmef/BD+OoO1vF7nStRqv62ntgkVa3iL7YfAWnSwgIsy5Gt6LCfebntRmEFaZww9RF+c Q/WSvcjdoEkyvGCPcdeahL8P5kfuO5KXiG7NuoAEi3w1zL99cVs9Nr03aNFHfuRNOw2i7RRuZ mIOIW+cpSvyX51B75Ih4JB0a1LXECPRUaOh6LAaapReQA= Message-ID-Hash: AAMCKWTZRS3X247GDWJ32GAMTFACOTAP X-Message-ID-Hash: AAMCKWTZRS3X247GDWJ32GAMTFACOTAP X-MailFrom: oswald.buddenhagen@gmx.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The offsets are counted in samples, not in bytes. While the code block is being rewritten, also move it up a bit, to avoid churn in a subsequent patch. Signed-off-by: Oswald Buddenhagen --- sound/pci/emu10k1/emu10k1_patch.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/sound/pci/emu10k1/emu10k1_patch.c b/sound/pci/emu10k1/emu10k1_patch.c index 281881f7d0a4..ad16de99b800 100644 --- a/sound/pci/emu10k1/emu10k1_patch.c +++ b/sound/pci/emu10k1/emu10k1_patch.c @@ -30,7 +30,6 @@ snd_emu10k1_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp, u32 xor; int offset; int truesize, size, blocksize; - unsigned int start_addr; struct snd_emu10k1 *emu; emu = rec->hw; @@ -62,6 +61,12 @@ snd_emu10k1_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp, } } + /* recalculate offset */ + sp->v.start += BLANK_HEAD_SIZE; + sp->v.end += BLANK_HEAD_SIZE; + sp->v.loopstart += BLANK_HEAD_SIZE; + sp->v.loopend += BLANK_HEAD_SIZE; + /* try to allocate a memory block */ blocksize = truesize; if (! (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS)) @@ -99,15 +104,6 @@ snd_emu10k1_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp, if (offset < blocksize) snd_emu10k1_synth_memset(emu, sp->block, offset, blocksize - offset, fill); - /* recalculate offset */ - start_addr = BLANK_HEAD_SIZE * 2; - if (! (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS)) - start_addr >>= 1; - sp->v.start += start_addr; - sp->v.end += start_addr; - sp->v.loopstart += start_addr; - sp->v.loopend += start_addr; - return 0; }