Re: [PATCH 5/6 v2] sound: Add n64 driver
From: Lauri Kasanen <hidden>
Date: 2021-01-11 09:44:02
On Mon, 11 Jan 2021 09:05:04 +0100 Takashi Iwai [off-list ref] wrote:
On Sun, 10 Jan 2021 18:41:46 +0100, Lauri Kasanen wrote:quoted
It was returning nextpos, but the pointer printk was in bytes. 8192 bytes = 2048 frames.OK, then it must be right. Then I suppose that the update of pos should be changed in a different way; it should always point to the previous nextpos. That is, something like: static void n64audio_push(struct n64audio_t *priv, uint8_t irq) { .... if (irq) priv->chan.pos = priv->chan.nextpos; priv->chan.nextpos += count; priv->chan.nextpos %= priv->chan.bufsize; If we use nextpos as the position, it'll lead to the double steps at the first IRQ handling without snd_pcm_period_elapsed() call (the first step missed it), and this may confuse PCM core.
This almost works, speed is correct, but the last part is played twice. I wonder if the first, non-irq push should just push a silent buffer, and not update pos or nextpos at all. - Lauri