From patchwork Mon Apr 1 10:07:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oswald Buddenhagen X-Patchwork-Id: 13612736 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 890F2CD1292 for ; Mon, 1 Apr 2024 12:24:15 +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 BFDA721B6; Mon, 1 Apr 2024 14:24:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BFDA721B6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1711974253; bh=phG6hMmRktyZLOVg+7TkRrTGOtgfboaALXpa6eHwtgA=; 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=h4lNkBVwULlLCdNCVtSGYWA6BCdTr1jznSxGVsa1x/KigFNGZGOgTzTF4K+6mLH4p wkioS2TW5gvoaBmvtk5Cnk7VVj8WtKo/QqZKM3uGNdCTtnHK2oC3Ieq3NiXFXLehJF 5VatSX5GRdW6vPcMbdrGm39qk2X6aTRn3fYH2K/Q= Received: by alsa1.perex.cz (Postfix, from userid 50401) id E14EEF806BC; Mon, 1 Apr 2024 14:22:04 +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 CBDDAF806B5; Mon, 1 Apr 2024 14:22:03 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4C382F80600; Mon, 1 Apr 2024 14:21:50 +0200 (CEST) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (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 7BBE4F8020D for ; Mon, 1 Apr 2024 14:21:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7BBE4F8020D 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=KLaQQqpM DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1711974089; x=1712578889; i=oswald.buddenhagen@gmx.de; bh=N+qXgc++moh3UpHq5GwB2BTSLu0+WsnSqCyKOAQ55qo=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To: References; b=KLaQQqpMsUovezNFfGeSmBZD5Ryv08zAsj8A43GQf7a51NNon/7JDaLuOFlHjUGF ojDu0+693t3xkyPzEWGF30GVq32GR4AANlfSzKlpBSa2qLih9frP8UBRVaIO9XueP aNhwIhJOA0eA27SB1bz5W0LUQpsoggn/1HPM07sn5OE9zCfqHqX085JPHDJ3rhsma DpqP1W6bAkFJ2sk3CwfoXATC1S/QQgtmVgVh8L8XC8Kw42j02fBrupJBHQjUN5it5 NxZ/rZ2GZYYtT1xpRO4CmEV8TrqgDCeB73ATD+z4Ph9dCj8KpSIoqiFnA+Ywfg6Ds DWeqG2PNE162O0yMIA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from ugly.fritz.box ([89.247.162.100]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MuDc7-1shAvc2ax3-00uW3c; Mon, 01 Apr 2024 14:21:29 +0200 Received: by ugly.fritz.box (masqmail 0.3.6-dev, from userid 1000) id 1rrEZq-7es-00; Mon, 01 Apr 2024 12:07:42 +0200 From: Oswald Buddenhagen To: alsa-devel@alsa-project.org Cc: Takashi Iwai , Jaroslav Kysela , Arthur Marsh Subject: [PATCH 14/18] ALSA: emu10k1: fix wavetable offset recalculation Date: Mon, 1 Apr 2024 12:07:38 +0200 Message-ID: <20240401100742.506001-15-oswald.buddenhagen@gmx.de> X-Mailer: git-send-email 2.42.0.419.g70bf8a5751 In-Reply-To: <20240401100742.506001-1-oswald.buddenhagen@gmx.de> References: <20240401100742.506001-1-oswald.buddenhagen@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:vLAQrOFl91Ipf440/++p9ydbBTkY78S6rLq1k8tFo5Ek9gm//fz XueAgalC2Pyo6mxUjTvlSTZNn6Cv0oyPB1JV/NXQg1BrvToQxBDI1wQmWWTy+PgV4ANDoMZ q4H1+SgBPbJxzIvdS86JY5eVGQYi9eGS4PvulZ0VINj9RLR/CE0IgIs40v9lcoB3o1PKzwX 6/PcmxBhCcGTkSx7VBpow== UI-OutboundReport: notjunk:1;M01:P0:1ti4O3dzWdM=;UkX4ogIwi6PZ7meNhGNVeosZ5YN FHB1/NV1n5i4+B5DmKl8FVacqL9OdbXMlf7tLv46fcWGh5NxTQN4o0SIvtg+LafL+T0Hn/Dl1 3Pz5o/+6JwW2NH2ZyMBNeZvmDj+OhZsrzyAWHLeTivX7oC2DDzUX4PTcLfQCBUDnseD6sdYcp eiZ6AnIflRWzlCa9jFWKR9xOyi5wdK9FSV/b4BG3T2KSlaW0iSnhdQ7Uzka0uyMB4p2OQ3STt f3bLnLndOcKKa2l41JR6ixWPMBJdjI2sbIDSzGtyNQmKT88DNsyt8vHQMG/Phm49GymWgflmb n0WwwDKL4wp5VNL+QzcD1ooB1FpXch3aOs2AhtSw+8D5y/DZn3Evs0KACnhz/NlfzuoZzbXw/ FJXm7DtsEWk2H/8mHiFfQvaich9iLsbZPJFN0nRKYNCu7cgxxkwgVYKNDhGQ4V5fzs//s9POd CQu6PYmR2xpmxGyPf02oBPy9R1yhgKYyxpthwQIsONlJbo1fs+KJ05e/rsxY3RojDl2Mz6MeZ ZB1eLwzXrGta8kj5gxfwIigDJgk9+0MvJ/FNA0gGm4LPsjgjTfa0l2o7l4x+4ke80N08nqTYf B3YjHbjdg/WXECTng0WI3wDg8RtE/bpeb7hTBJNuPaoepCw1wU/qtq4lD5ad/ooX028rm8lQh wokaxhGnyQdPO5uoFoAtA3Bzdy7CDJWfJHtde19UIkPd1k8TH4S8+8sx9UPEXU3ZSHEdC8ON+ 9EEZDlrhn/N4nxNwdkZbVUwQdwqV9FI/RORUnEmDuUiCaShdwCSW46X4jkvhKfVK7xekfZdeM 5p/f2KVkQZzevtOhGB2GqlPbcTYiBiAyOrD0T9V5KuF7o= Message-ID-Hash: PKDD2T5OB75NBJOCNDHJE7FCZLZ6Z4NL X-Message-ID-Hash: PKDD2T5OB75NBJOCNDHJE7FCZLZ6Z4NL 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(-) -- 2.42.0.419.g70bf8a5751 diff --git a/sound/pci/emu10k1/emu10k1_patch.c b/sound/pci/emu10k1/emu10k1_patch.c index c7d54f38d28c..eb8365650bd4 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; }