From 8f6c03d93af6501c960360c77fd7540380e535dc Mon Sep 17 00:00:00 2001 From: waker Date: Sun, 12 Dec 2010 20:36:37 +0100 Subject: added softvolume for all supported output formats; moved softvolume from output plugins to streamer --- plugins/alsa/alsa.c | 43 +------------------------------------------ 1 file changed, 1 insertion(+), 42 deletions(-) (limited to 'plugins/alsa') 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 -- cgit v1.2.3