From: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
To: alsa-devel@alsa-project.org
Cc: Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>
Subject: [PATCH 6/6] ALSA: emu10k1: factor out snd_emu10k1_compose_audigy_sendamounts()
Date: Tue, 16 May 2023 11:36:12 +0200 [thread overview]
Message-ID: <20230516093612.3536451-7-oswald.buddenhagen@gmx.de> (raw)
In-Reply-To: <20230516093612.3536451-1-oswald.buddenhagen@gmx.de>
Saves a bit of code duplication.
Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
---
include/sound/emu10k1.h | 3 +++
sound/pci/emu10k1/emumixer.c | 7 ++-----
sound/pci/emu10k1/emupcm.c | 5 +----
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 5c1e5b123362..456af84735a8 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -1501,6 +1501,9 @@ struct snd_emu10k1_pcm_mixer {
#define snd_emu10k1_compose_audigy_fxrt2(route) \
((unsigned int)route[4] | ((unsigned int)route[5] << 8) | ((unsigned int)route[6] << 16) | ((unsigned int)route[7] << 24))
+#define snd_emu10k1_compose_audigy_sendamounts(vol) \
+(((unsigned int)vol[4] << 24) | ((unsigned int)vol[5] << 16) | ((unsigned int)vol[6] << 8) | (unsigned int)vol[7])
+
struct snd_emu10k1_memblk {
struct snd_util_memblk mem;
/* private part */
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c
index e067a4066cda..1ebf161d410e 100644
--- a/sound/pci/emu10k1/emumixer.c
+++ b/sound/pci/emu10k1/emumixer.c
@@ -1196,11 +1196,8 @@ static void update_emu10k1_send_volume(struct snd_emu10k1 *emu, int voice, unsig
snd_emu10k1_ptr_write(emu, PSST_FXSENDAMOUNT_C, voice, volume[2]);
snd_emu10k1_ptr_write(emu, DSL_FXSENDAMOUNT_D, voice, volume[3]);
if (emu->audigy) {
- unsigned int val = ((unsigned int)volume[4] << 24) |
- ((unsigned int)volume[5] << 16) |
- ((unsigned int)volume[6] << 8) |
- (unsigned int)volume[7];
- snd_emu10k1_ptr_write(emu, A_SENDAMOUNTS, voice, val);
+ snd_emu10k1_ptr_write(emu, A_SENDAMOUNTS, voice,
+ snd_emu10k1_compose_audigy_sendamounts(volume));
}
}
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index 4ade0ef2cd1b..d669f93d8930 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -316,10 +316,7 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu,
snd_emu10k1_ptr_write(emu, A_FXRT2, voice,
snd_emu10k1_compose_audigy_fxrt2(send_routing));
snd_emu10k1_ptr_write(emu, A_SENDAMOUNTS, voice,
- ((unsigned int)send_amount[4] << 24) |
- ((unsigned int)send_amount[5] << 16) |
- ((unsigned int)send_amount[6] << 8) |
- (unsigned int)send_amount[7]);
+ snd_emu10k1_compose_audigy_sendamounts(send_amount));
} else
snd_emu10k1_ptr_write(emu, FXRT, voice,
snd_emu10k1_compose_send_routing(send_routing));
--
2.40.0.152.g15d061e6df
next prev parent reply other threads:[~2023-05-16 9:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-16 9:36 [PATCH 0/6] ALSA: emu10k1: assorted playback-related cleanups Oswald Buddenhagen
2023-05-16 9:36 ` [PATCH 1/6] ALSA: emu10k1: straighten out FX send init Oswald Buddenhagen
2023-05-16 9:36 ` [PATCH 2/6] ALSA: emu10k1: cleanup envelope register init Oswald Buddenhagen
2023-05-16 9:36 ` [PATCH 3/6] ALSA: emu10k1: remove useless resets of stop-on-loop-end bits Oswald Buddenhagen
2023-05-16 9:36 ` [PATCH 4/6] ALSA: emu10k1: rewire {en,dis}abling interrupts for PCM playback Oswald Buddenhagen
2023-05-16 9:36 ` [PATCH 5/6] ALSA: emu10k1: skip needless setting of some voice registers Oswald Buddenhagen
2023-05-16 9:36 ` Oswald Buddenhagen [this message]
2023-05-17 15:08 ` [PATCH 0/6] ALSA: emu10k1: assorted playback-related cleanups Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230516093612.3536451-7-oswald.buddenhagen@gmx.de \
--to=oswald.buddenhagen@gmx.de \
--cc=alsa-devel@alsa-project.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox