[alsa-devel] snd_pcm_multi_rewind
Raymond Yau
superquad.vortex2 at gmail.com
Tue Aug 24 05:56:56 CEST 2010
why the pos array can be assigned dimension by multi->slaves_count ?
does sizeof(pos) return the correct size ?
why input parameter "frames" can be modified ?
frames = f;
static snd_pcm_sframes_t snd_pcm_multi_rewind(snd_pcm_t *pcm,
snd_pcm_uframes_t frames)
{
snd_pcm_multi_t *multi = pcm->private_data;
unsigned int i;
snd_pcm_uframes_t pos[multi->slaves_count];
memset(pos, 0, sizeof(pos));
for (i = 0; i < multi->slaves_count; ++i) {
snd_pcm_t *slave_i = multi->slaves[i].pcm;
snd_pcm_sframes_t f = snd_pcm_rewind(slave_i, frames);
if (f < 0)
return f;
pos[i] = f;
frames = f;
}
/* Realign the pointers */
for (i = 0; i < multi->slaves_count; ++i) {
snd_pcm_t *slave_i = multi->slaves[i].pcm;
snd_pcm_uframes_t f = pos[i] - frames;
snd_pcm_sframes_t result;
if (f > 0) {
result = INTERNAL(snd_pcm_forward)(slave_i, f);
if (result < 0)
return result;
if ((snd_pcm_uframes_t)result != f)
return -EIO;
}
}
return frames;
}
More information about the Alsa-devel
mailing list