Cleaned and fixed plugin ops

This commit is contained in:
Abramo Bagnara 2000-10-22 09:50:20 +00:00
parent 0114f5843f
commit 8a625fd63b
8 changed files with 293 additions and 279 deletions

View file

@ -128,10 +128,10 @@ static void alaw_decode(snd_pcm_channel_area_t *src_areas,
size_t dst_offset,
size_t frames, size_t channels, int putidx)
{
#define PUT_S16_LABELS
#define PUT16_LABELS
#include "plugin_ops.h"
#undef PUT_S16_LABELS
void *put = put_s16_labels[putidx];
#undef PUT16_LABELS
void *put = put16_labels[putidx];
size_t channel;
for (channel = 0; channel < channels; ++channel) {
char *src;
@ -157,9 +157,9 @@ static void alaw_decode(snd_pcm_channel_area_t *src_areas,
while (frames1-- > 0) {
int16_t sample = alaw_to_s16(*src);
goto *put;
#define PUT_S16_END after
#define PUT16_END after
#include "plugin_ops.h"
#undef PUT_S16_END
#undef PUT16_END
after:
src += src_step;
dst += dst_step;
@ -173,10 +173,10 @@ static void alaw_encode(snd_pcm_channel_area_t *src_areas,
size_t dst_offset,
size_t frames, size_t channels, int getidx)
{
#define GET_S16_LABELS
#define GET16_LABELS
#include "plugin_ops.h"
#undef GET_S16_LABELS
void *get = get_s16_labels[getidx];
#undef GET16_LABELS
void *get = get16_labels[getidx];
size_t channel;
int16_t sample = 0;
for (channel = 0; channel < channels; ++channel) {
@ -202,9 +202,9 @@ static void alaw_encode(snd_pcm_channel_area_t *src_areas,
frames1 = frames;
while (frames1-- > 0) {
goto *get;
#define GET_S16_END after
#define GET16_END after
#include "plugin_ops.h"
#undef GET_S16_END
#undef GET16_END
after:
*dst = s16_to_alaw(sample);
src += src_step;
@ -291,18 +291,18 @@ static int snd_pcm_alaw_setup(snd_pcm_t *pcm, snd_pcm_setup_t * setup)
setup->mmap_bytes = 0;
if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
if (alaw->sformat == SND_PCM_SFMT_A_LAW) {
alaw->getput_idx = getput_index(alaw->cformat);
alaw->getput_idx = get_index(alaw->cformat, SND_PCM_SFMT_S16);
alaw->func = alaw_encode;
} else {
alaw->getput_idx = getput_index(alaw->sformat);
alaw->getput_idx = put_index(SND_PCM_SFMT_S16, alaw->sformat);
alaw->func = alaw_decode;
}
} else {
if (alaw->sformat == SND_PCM_SFMT_A_LAW) {
alaw->getput_idx = getput_index(alaw->cformat);
alaw->getput_idx = put_index(SND_PCM_SFMT_S16, alaw->cformat);
alaw->func = alaw_decode;
} else {
alaw->getput_idx = getput_index(alaw->sformat);
alaw->getput_idx = get_index(alaw->sformat, SND_PCM_SFMT_S16);
alaw->func = alaw_encode;
}
}