随笔分类 -  ALSA_2

alsa进阶篇
摘要:1 UAC 就是USB audio class,可以通过usb传输audio data UAC作为usb的function,向usb注册function code位于:linux-5.15.11\drivers\usb\gadget\function\f_uac2.c 1 static struct 阅读全文
posted @ 2025-08-15 21:14 Action_er 阅读(53) 评论(0) 推荐(0)
摘要:1 snd_pcm_drain snd_pcm_dain并没有直接call snd_pcm_stop停掉HW static int snd_pcm_drain(struct snd_pcm_substream *substream, struct file *file) { struct snd_c 阅读全文
posted @ 2025-05-28 22:06 Action_er 阅读(15) 评论(0) 推荐(0)
摘要:1 silence size的设置 在snd_pcm_hw_params时设置,设置的目的时防止读旧数据,出现nosie,只有playback才需要 capture不需要,因为capture data都是充足的,只会出现读数据慢的情况,不会读到旧数据。 silence size的设置有一定的要求: 阅读全文
posted @ 2025-05-28 21:53 Action_er 阅读(37) 评论(0) 推荐(0)
摘要:1 snd_pcm_update_hw_ptr0 static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, unsigned int in_interrupt) { struct snd_pcm_runtime *r 阅读全文
posted @ 2025-05-27 23:11 Action_er 阅读(29) 评论(0) 推荐(0)
摘要:1 第一种size static inline snd_pcm_uframes_t snd_pcm_avail(struct snd_pcm_substream *substream) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ret 阅读全文
posted @ 2025-05-27 22:52 Action_er 阅读(13) 评论(0) 推荐(0)
摘要:/* the common loop for read/write data */ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, void *data, bool interleaved, snd_ 阅读全文
posted @ 2025-05-27 22:47 Action_er 阅读(40) 评论(0) 推荐(0)
摘要:1 frame/sample/fs关系 frame = ch num * bit len / 8 bytes sample = bit len / 8 bytes timer = size(bytes)/sample/sample rate s 2 参考代码 pcm_native.c snd_pcm 阅读全文
posted @ 2025-04-23 21:39 Action_er 阅读(33) 评论(0) 推荐(0)
摘要:machine driver的probe函数会调用此api向Alsa注册声卡 1 int snd_soc_register_card(struct snd_soc_card *card) 2 { 3 int i, ret; 4 struct snd_soc_pcm_runtime *rtd; 5 6 阅读全文
posted @ 2023-02-11 14:59 Action_er 阅读(145) 评论(0) 推荐(0)