Skip to contentSkip to conversation

Add a software amplifier plugin

PATCH In review Stas Sergeev 2 participants 3 messages Aug 1, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add a software amplifier plugin

Hi.

Most of the modern built-in cards do not have an internal amplifier. This makes it difficult to use them with those cheap small passive speakers that were in a heavy use 15 years ago when the cards had an amplifier builtin.
I wrote a simple software amplifier plugin, it is attached. Of course you trade a sound quality, but whoever uses the passive speakers, have already made his choice anyway.

Would it be possible to apply such a patch to the repository?

# HG changeset patch
# User Stas Sergeev <[email protected]> # Date 1185966660 -14400
# Node ID 1164919ed31213ef9ae463e3af7a04cdd47fe019 # Parent dc32d9f00649b5c89589e1dc5eeba6924568bf41 Add a software amplifier plugin.

configure.in +2 -1
diff -r dc32d9f00649 -r 1164919ed312 configure.in
@@ -397,7 +397,7 @@ pcm_plugins=""
 pcm_plugins=""
 fi
 
-PCM_PLUGIN_LIST="copy linear route mulaw alaw adpcm rate plug multi shm file null empty share meter hooks lfloat ladspa dmix dshare dsnoop asym iec958 softvol extplug ioplug mmap_emul"
+PCM_PLUGIN_LIST="copy linear route mulaw alaw adpcm rate plug multi shm file null empty share meter hooks lfloat ladspa dmix dshare dsnoop asym iec958 softvol softamp extplug ioplug mmap_emul"
 
 build_pcm_plugin="no"
 for t in $PCM_PLUGIN_LIST; do
@@ -464,6 +464,7 @@ AM_CONDITIONAL(BUILD_PCM_PLUGIN_ASYM, te
 AM_CONDITIONAL(BUILD_PCM_PLUGIN_ASYM, test x$build_pcm_asym = xyes)
 AM_CONDITIONAL(BUILD_PCM_PLUGIN_IEC958, test x$build_pcm_iec958 = xyes)
 AM_CONDITIONAL(BUILD_PCM_PLUGIN_SOFTVOL, test x$build_pcm_softvol = xyes)
+AM_CONDITIONAL(BUILD_PCM_PLUGIN_SOFTAMP, test x$build_pcm_softamp = xyes)
 AM_CONDITIONAL(BUILD_PCM_PLUGIN_EXTPLUG, test x$build_pcm_extplug = xyes)
 AM_CONDITIONAL(BUILD_PCM_PLUGIN_IOPLUG, test x$build_pcm_ioplug = xyes)
 AM_CONDITIONAL(BUILD_PCM_PLUGIN_MMAP_EMUL, test x$build_pcm_mmap_emul = xyes)
doc/doxygen.cfg +1 -0
diff -r dc32d9f00649 -r 1164919ed312 doc/doxygen.cfg
@@ -69,6 +69,7 @@ INPUT            = index.doxygen \
 		   ../src/pcm/pcm_asym.c \
 		   ../src/pcm/pcm_iec958.c \
 		   ../src/pcm/pcm_softvol.c \
+		   ../src/pcm/pcm_softamp.c \
 		   ../src/pcm/pcm_extplug.c \
 		   ../src/pcm/pcm_ioplug.c \
 		   ../src/pcm/pcm_misc.c \
include/pcm.h +2 -0
diff -r dc32d9f00649 -r 1164919ed312 include/pcm.h
@@ -358,6 +358,8 @@ enum _snd_pcm_type {
 	SND_PCM_TYPE_IEC958,
 	/** Soft volume plugin */
 	SND_PCM_TYPE_SOFTVOL,
+	/** Soft amp plugin */
+	SND_PCM_TYPE_SOFTAMP,
 	/** External I/O plugin */
 	SND_PCM_TYPE_IOPLUG,
 	/** External filter plugin */
src/pcm/Makefile.am +3 -0
diff -r dc32d9f00649 -r 1164919ed312 src/pcm/Makefile.am
@@ -93,6 +93,9 @@ if BUILD_PCM_PLUGIN_SOFTVOL
 if BUILD_PCM_PLUGIN_SOFTVOL
 libpcm_la_SOURCES += pcm_softvol.c
 endif
+if BUILD_PCM_PLUGIN_SOFTAMP
+libpcm_la_SOURCES += pcm_softamp.c
+endif
 if BUILD_PCM_PLUGIN_EXTPLUG
 libpcm_la_SOURCES += pcm_extplug.c
 endif
src/pcm/pcm.c +3 -2
diff -r dc32d9f00649 -r 1164919ed312 src/pcm/pcm.c
@@ -1561,7 +1561,8 @@ static const char *snd_pcm_type_names[] 
 	PCMTYPE(JACK),
         PCMTYPE(DSNOOP),
         PCMTYPE(IEC958),
-	PCMTYPE(SOFTVOL),
+        PCMTYPE(SOFTVOL),
+        PCMTYPE(SOFTAMP),
         PCMTYPE(IOPLUG),
         PCMTYPE(EXTPLUG),
 };
@@ -1983,7 +1984,7 @@ static char *build_in_pcms[] = {
 static char *build_in_pcms[] = {
 	"adpcm", "alaw", "copy", "dmix", "file", "hooks", "hw", "ladspa", "lfloat",
 	"linear", "meter", "mulaw", "multi", "null", "empty", "plug", "rate", "route", "share",
-	"shm", "dsnoop", "dshare", "asym", "iec958", "softvol", "mmap_emul",
+	"shm", "dsnoop", "dshare", "asym", "iec958", "softvol", "softamp", "mmap_emul",
 	NULL
 };
 
src/pcm/pcm_softamp.c new file +625 -0

625 lines not on this page · raw message

src/pcm/pcm_symbols.c +1 -0
diff -r dc32d9f00649 -r 1164919ed312 src/pcm/pcm_symbols.c
@@ -47,6 +47,7 @@ extern const char *_snd_module_pcm_asym;
 extern const char *_snd_module_pcm_asym;
 extern const char *_snd_module_pcm_iec958;
 extern const char *_snd_module_pcm_softvol;
+extern const char *_snd_module_pcm_softamp;
 extern const char *_snd_module_pcm_extplug;
 extern const char *_snd_module_pcm_ioplug;
 extern const char *_snd_module_pcm_mmap_emul;

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#1 lore raw

At Wed, 01 Aug 2007 15:58:56 +0400,

Quoted 14 lines · Stas Sergeev

Hi.

Most of the modern built-in cards do not have an internal amplifier. This makes it difficult to use them with those cheap small passive speakers that were in a heavy use 15 years ago when the cards had an amplifier builtin.
I wrote a simple software amplifier plugin, it is attached. Of course you trade a sound quality, but whoever uses the passive speakers, have already made his choice anyway.

Quoted 4 lines

Would it be possible to apply such a patch to the repository?

Did you try the recent softvol plugin?
It supports already amplifier (> 0dB), not only attenuation.

thanks,

Takashi

#2 lore raw

Hello.

Quoted 1 line · Takashi Iwai

Did you try the recent softvol plugin?

Yep, I tried it for the whole day with alsa-lib-1.0.14, trying to feed it with the max_dB value to no avail.

Quoted 1 line

It supports already amplifier (> 0dB), not only attenuation.

Oh, it does so only in hg, not in 1.0.14, now I see.
Well, it seems to me that my plugin gives a way better quality (doing sine amplification, while yours probably does linear), but then yes, there is no point for the new plugin indeed.