summaryrefslogtreecommitdiff
path: root/plugins/alsa
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2010-12-12 20:36:37 +0100
committerGravatar waker <wakeroid@gmail.com>2010-12-12 20:36:37 +0100
commit8f6c03d93af6501c960360c77fd7540380e535dc (patch)
tree4d56f6fbf9dd14bbc219aac4bd435389d20ddb4b /plugins/alsa
parenta2589162ebec9956ea0c7308194bdc27b8a3868b (diff)
added softvolume for all supported output formats; moved softvolume from output plugins to streamer
Diffstat (limited to 'plugins/alsa')
-rw-r--r--plugins/alsa/alsa.c43
1 files changed, 1 insertions, 42 deletions
diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c
index 755981fa..68981512 100644
--- a/plugins/alsa/alsa.c
+++ b/plugins/alsa/alsa.c
@@ -615,48 +615,7 @@ palsa_thread (void *context) {
static int
palsa_callback (char *stream, int len) {
- int bytesread = deadbeef->streamer_read (stream, len);
-
-// FIXME: move volume control to streamer_read for copy optimization
-#if 0
- int16_t vol[4];
- vol[0] = volume_get_amp () * 255; // that will be extra 8 bits
- // pack 4 times
- vol[1] = vol[2] = vol[3] = vol[0];
-
- // apply volume with mmx
- __asm__ volatile(
- " mov %0, %%ecx\n\t"
- " shr $4, %%ecx\n\t"
- " mov %1, %%eax\n\t"
- " movq %2, %mm1\n\t"
- "1:\n\t"
- " movq [%%eax], %mm0\n\t"
- " movq %mm0, %mm2\n\t"
- " movq %mm0, %mm3\n\t"
- " pmullw %mm1, %mm2\n\t"
- " pmulhw %mm1, %mm3\n\t"
- " psrlw $8, %mm2\n\t" // discard lowest 8 bits
- " psllw $8, %mm3\n\t" // shift left 8 lsbs of hiwords
- " por %mm3, %mm2\n\t" // OR them together
- " movq %mm3, [%%eax]\n\t" // load back to memory
- " add $8, %%eax\n\t"
- " dec %%ecx\n\t"
- " jnz 1b\n\t"
- :
- : "r"(len), "r"(stream), "r"(vol)
- : "%ecx", "%eax"
- );
-
-#else
- if (plugin.fmt.bps == 16) {
- int16_t ivolume = deadbeef->volume_get_amp () * 1000;
- for (int i = 0; i < bytesread/2; i++) {
- ((int16_t*)stream)[i] = (int16_t)(((int32_t)(((int16_t*)stream)[i])) * ivolume / 1000);
- }
- }
-#endif
- return bytesread;
+ return deadbeef->streamer_read (stream, len);
}
static int