Android/Linux音频架构开发ALSA-篇3

关注微信公众号:【快乐程序猿】查看更多篇章

要讲ALSA的结构的话就不得不说他的核心结构体snd_card,我们的大部分设备操作都是基于snd_card展开的,而且声卡驱动创建的第一步就是创建一个声卡snd_card结构体,所以我们从此处展开讲解。

1、snd_card结构定义


struct snd_card {
  int number;      /* number of soundcard (index to
                snd_cards) */

  char id[16];      /* id string of this card */
  char driver[16];    /* driver name */
  char shortname[32];    /* short name of this soundcard */
  char longname[80];    /* name of this soundcard */
  char irq_descr[32];    /* Interrupt description */
  char mixername[80];    /* mixer name */
  char components[128];    /* card components delimited with
                space */
  struct module *module;    /* top-level module */

  void *private_data;    /* private data for soundcard */
  void (*private_free) (struct snd_card *card); /* callback for freeing of
                private data */
  struct list_head devices;  /* devices */

  struct device ctl_dev;    /* control device */
  unsigned int last_numid;  /* last used numeric ID */
  struct rw_semaphore controls_rwsem;  /* controls list lock */
  rwlock_t ctl_files_rwlock;  /* ctl_files list lock */
  int controls_count;    /* count of all controls */
  int user_ctl_count;    /* count of all user controls */
  struct list_head controls;  /* all controls for this card */
  struct list_head ctl_files;  /* active control files */

  struct snd_info_entry *proc_root;  /* root for soundcard specific files */
  struct snd_info_entry *proc_id;  /* the card id */
  struct proc_dir_entry *proc_root_link;  /* number link to real id */

  struct list_head files_list;  /* all files associated to this card */
  struct snd_shutdown_f_ops *s_f_ops; /* file operations in the shutdown
                state */
  spinlock_t files_lock;    /* lock the files for this card */
  int shutdown;      /* this card is going down */
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值