[alsa-devel] snd_pcm_multi_rewind
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; }
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
participants (2)
-
Clemens Ladisch
-
Raymond Yau