pcm: pass void pointers to PCM functions

In generic PCM functions allowing all sample formats, pass a void
pointer instead of a char pointer.
This commit is contained in:
Max Kellermann 2009-01-07 19:00:02 +01:00
parent bb01016400
commit 04a2138b33
6 changed files with 11 additions and 12 deletions

View File

@ -117,21 +117,20 @@ pcm_convert_24(const struct audio_format *src_format,
return len;
}
/* outFormat bits must be 16 and channels must be 1 or 2! */
size_t pcm_convert(const struct audio_format *inFormat,
const char *src, size_t src_size,
const void *src, size_t src_size,
const struct audio_format *outFormat,
char *outBuffer,
void *dest,
struct pcm_convert_state *convState)
{
switch (outFormat->bits) {
case 16:
return pcm_convert_16(inFormat, src, src_size,
outFormat, (int16_t*)outBuffer,
outFormat, (int16_t*)dest,
convState);
case 24:
return pcm_convert_24(inFormat, src, src_size,
outFormat, (int32_t*)outBuffer,
outFormat, (int32_t*)dest,
convState);
default:

View File

@ -33,9 +33,9 @@ struct pcm_convert_state {
void pcm_convert_init(struct pcm_convert_state *state);
size_t pcm_convert(const struct audio_format *inFormat,
const char *inBuffer, size_t inSize,
const void *src, size_t src_size,
const struct audio_format *outFormat,
char *outBuffer,
void *dest,
struct pcm_convert_state *convState);
size_t pcm_convert_size(const struct audio_format *inFormat, size_t inSize,

View File

@ -80,7 +80,7 @@ pcm_add_24(int32_t *buffer1, const int32_t *buffer2,
}
static void
pcm_add(char *buffer1, const char *buffer2, size_t size,
pcm_add(void *buffer1, const void *buffer2, size_t size,
int vol1, int vol2,
const struct audio_format *format)
{
@ -107,7 +107,7 @@ pcm_add(char *buffer1, const char *buffer2, size_t size,
}
void
pcm_mix(char *buffer1, const char *buffer2, size_t size,
pcm_mix(void *buffer1, const void *buffer2, size_t size,
const struct audio_format *format, float portion1)
{
int vol1;

View File

@ -24,7 +24,7 @@
struct audio_format;
void
pcm_mix(char *buffer1, const char *buffer2, size_t size,
pcm_mix(void *buffer1, const void *buffer2, size_t size,
const struct audio_format *format, float portion1);
#endif

View File

@ -74,7 +74,7 @@ pcm_volume_change_24(int32_t *buffer, unsigned num_samples, int volume)
}
void
pcm_volume(char *buffer, int bufferSize,
pcm_volume(void *buffer, int bufferSize,
const struct audio_format *format,
int volume)
{

View File

@ -52,7 +52,7 @@ pcm_volume_dither(void)
}
void
pcm_volume(char *buffer, int bufferSize,
pcm_volume(void *buffer, int bufferSize,
const struct audio_format *format,
int volume);