pcm_mix: implemented 32 bit support
This commit is contained in:
parent
1358428031
commit
300f936228
2
NEWS
2
NEWS
@ -71,7 +71,7 @@ ver 0.16 (20??/??/??)
|
|||||||
* database: eliminated maximum line length
|
* database: eliminated maximum line length
|
||||||
* log: redirect stdout/stderr to /dev/null if syslog is used
|
* log: redirect stdout/stderr to /dev/null if syslog is used
|
||||||
* set the close-on-exec flag on all file descriptors
|
* set the close-on-exec flag on all file descriptors
|
||||||
* pcm_volume: implemented 32 bit support
|
* pcm_volume, pcm_mix: implemented 32 bit support
|
||||||
* obey $(sysconfdir) for default mpd.conf location
|
* obey $(sysconfdir) for default mpd.conf location
|
||||||
* build with large file support by default
|
* build with large file support by default
|
||||||
* require GLib 2.12
|
* require GLib 2.12
|
||||||
|
@ -81,6 +81,23 @@ pcm_add_24(int32_t *buffer1, const int32_t *buffer2,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pcm_add_32(int32_t *buffer1, const int32_t *buffer2,
|
||||||
|
unsigned num_samples, unsigned volume1, unsigned volume2)
|
||||||
|
{
|
||||||
|
while (num_samples > 0) {
|
||||||
|
int64_t sample1 = *buffer1;
|
||||||
|
int64_t sample2 = *buffer2++;
|
||||||
|
|
||||||
|
sample1 = ((sample1 * volume1 + sample2 * volume2) +
|
||||||
|
pcm_volume_dither() + PCM_VOLUME_1 / 2)
|
||||||
|
/ PCM_VOLUME_1;
|
||||||
|
|
||||||
|
*buffer1++ = pcm_range_64(sample1, 32);
|
||||||
|
--num_samples;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pcm_add(void *buffer1, const void *buffer2, size_t size,
|
pcm_add(void *buffer1, const void *buffer2, size_t size,
|
||||||
int vol1, int vol2,
|
int vol1, int vol2,
|
||||||
@ -103,6 +120,12 @@ pcm_add(void *buffer1, const void *buffer2, size_t size,
|
|||||||
size / 4, vol1, vol2);
|
size / 4, vol1, vol2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
pcm_add_32((int32_t*)buffer1,
|
||||||
|
(const int32_t*)buffer2,
|
||||||
|
size / 4, vol1, vol2);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
g_error("%u bits not supported by pcm_add!\n", format->bits);
|
g_error("%u bits not supported by pcm_add!\n", format->bits);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user