参照元†
- FIXME: 現在の再生位置、録音位置を取得する。
- struct snd_pcm_substream *substream
- struct snd_pcm_runtime *runtime
返り値†
- snd_pcm_uframes_t
- 現在の再生、録音位置を返す。
オーバーランあるいはアンダーランの場合は SNDRV_PCM_POS_XRUN を返す。
static snd_pcm_uframes_t
snd_pcm_update_hw_ptr_pos(struct snd_pcm_substream *substream,
struct snd_pcm_runtime *runtime)
{
snd_pcm_uframes_t pos;
pos = substream->ops->pointer(substream);
- ドライバから現在の再生、録音位置を取得する。
- substream->ops は snd_pcm_ops 型
if (pos == SNDRV_PCM_POS_XRUN)
return pos; /* XRUN */
- オーバーラン or アンダーランの場合は、呼び出し元にもオーバーラン or アンダーランを知らせる。
if (pos >= runtime->buffer_size) {
- バッファサイズを超えた位置が返ってきた場合は、
エラーメッセージを出し、位置を 0 に修正する。
if (printk_ratelimit()) {
char name[16];
pcm_debug_name(substream, name, sizeof(name));
snd_printd(KERN_ERR "BUG: %s, pos = 0x%lx, "
"buffer size = 0x%lx, period size = 0x%lx\n",
name, pos, runtime->buffer_size,
runtime->period_size);
}
pos = 0;
}
pos -= pos % runtime->min_align;
return pos;
}
コメント†