* snd_pcm_multi_rewind
@ 2010-08-24 3:56 Raymond Yau
2010-08-24 7:35 ` snd_pcm_multi_rewind Clemens Ladisch
0 siblings, 1 reply; 2+ messages in thread
From: Raymond Yau @ 2010-08-24 3:56 UTC (permalink / raw)
To: ALSA Development Mailing List
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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: snd_pcm_multi_rewind
2010-08-24 3:56 snd_pcm_multi_rewind Raymond Yau
@ 2010-08-24 7:35 ` Clemens Ladisch
0 siblings, 0 replies; 2+ messages in thread
From: Clemens Ladisch @ 2010-08-24 7:35 UTC (permalink / raw)
To: ALSA Development Mailing List
Raymond Yau wrote:
> snd_pcm_uframes_t pos[multi->slaves_count];
> why the pos array can be assigned dimension by multi->slaves_count ?
Because the C standard says so.
> does sizeof(pos) return the correct size ?
Yes.
> why input parameter "frames" can be modified ?
>
> frames = f;
Because the C standard says so.
Regards,
Clemens
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-24 7:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-24 3:56 snd_pcm_multi_rewind Raymond Yau
2010-08-24 7:35 ` snd_pcm_multi_rewind Clemens Ladisch
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.