2000-07-28 20:21:12 +00:00
|
|
|
/*
|
|
|
|
|
* Control Interface - local header file
|
|
|
|
|
* Copyright (c) 2000 by Jaroslav Kysela <perex@suse.cz>
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU Library General Public License as
|
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU Library General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2001-01-01 15:15:41 +00:00
|
|
|
#include "local.h"
|
2000-08-11 19:28:43 +00:00
|
|
|
#include "list.h"
|
|
|
|
|
|
2001-02-06 23:48:10 +00:00
|
|
|
typedef struct _snd_ctl_ops {
|
2000-09-11 15:49:10 +00:00
|
|
|
int (*close)(snd_ctl_t *handle);
|
2000-09-24 09:57:26 +00:00
|
|
|
int (*poll_descriptor)(snd_ctl_t *handle);
|
2001-02-07 15:13:15 +00:00
|
|
|
int (*hw_info)(snd_ctl_t *handle, snd_ctl_card_info_t *info);
|
|
|
|
|
int (*clist)(snd_ctl_t *handle, snd_ctl_element_list_t *list);
|
|
|
|
|
int (*cinfo)(snd_ctl_t *handle, snd_ctl_element_info_t *info);
|
|
|
|
|
int (*cread)(snd_ctl_t *handle, snd_ctl_element_t *control);
|
|
|
|
|
int (*cwrite)(snd_ctl_t *handle, snd_ctl_element_t *control);
|
2000-11-30 19:17:55 +00:00
|
|
|
int (*hwdep_next_device)(snd_ctl_t *handle, int *device);
|
2000-09-11 15:49:10 +00:00
|
|
|
int (*hwdep_info)(snd_ctl_t *handle, snd_hwdep_info_t * info);
|
2000-11-30 19:17:55 +00:00
|
|
|
int (*pcm_next_device)(snd_ctl_t *handle, int *device);
|
2000-09-11 15:49:10 +00:00
|
|
|
int (*pcm_info)(snd_ctl_t *handle, snd_pcm_info_t * info);
|
|
|
|
|
int (*pcm_prefer_subdevice)(snd_ctl_t *handle, int subdev);
|
2000-11-30 19:17:55 +00:00
|
|
|
int (*rawmidi_next_device)(snd_ctl_t *handle, int *device);
|
2000-09-11 15:49:10 +00:00
|
|
|
int (*rawmidi_info)(snd_ctl_t *handle, snd_rawmidi_info_t * info);
|
2000-10-30 12:15:18 +00:00
|
|
|
int (*rawmidi_prefer_subdevice)(snd_ctl_t *handle, int subdev);
|
2000-09-11 15:49:10 +00:00
|
|
|
int (*read)(snd_ctl_t *handle, snd_ctl_event_t *event);
|
2000-11-20 20:10:46 +00:00
|
|
|
} snd_ctl_ops_t;
|
2000-09-11 15:49:10 +00:00
|
|
|
|
|
|
|
|
|
2000-11-20 20:10:46 +00:00
|
|
|
struct _snd_ctl {
|
2000-10-14 10:31:34 +00:00
|
|
|
char *name;
|
2000-09-11 15:49:10 +00:00
|
|
|
snd_ctl_type_t type;
|
2000-11-20 20:10:46 +00:00
|
|
|
snd_ctl_ops_t *ops;
|
2000-09-11 15:49:10 +00:00
|
|
|
void *private;
|
2000-08-11 19:28:43 +00:00
|
|
|
int hcount;
|
|
|
|
|
int herr;
|
|
|
|
|
struct list_head hlist; /* list of all controls */
|
|
|
|
|
void *hroot; /* root of controls */
|
|
|
|
|
void *hroot_new; /* new croot */
|
2001-02-06 23:48:10 +00:00
|
|
|
snd_ctl_hsort_t hsort;
|
|
|
|
|
snd_ctl_hcallback_rebuild_t callback_rebuild;
|
2000-07-28 20:21:12 +00:00
|
|
|
void *callback_rebuild_private_data;
|
2001-02-06 23:48:10 +00:00
|
|
|
snd_ctl_hcallback_add_t callback_add;
|
2000-07-28 20:21:12 +00:00
|
|
|
void *callback_add_private_data;
|
|
|
|
|
};
|
2000-11-20 20:10:46 +00:00
|
|
|
|
2001-02-06 23:48:10 +00:00
|
|
|
struct _snd_ctl_callbacks {
|
|
|
|
|
void *private_data; /* may be used by an application */
|
|
|
|
|
void (*rebuild) (snd_ctl_t *handle, void *private_data);
|
2001-02-07 15:13:15 +00:00
|
|
|
void (*value) (snd_ctl_t *handle, void *private_data, snd_ctl_element_id_t * id);
|
|
|
|
|
void (*change) (snd_ctl_t *handle, void *private_data, snd_ctl_element_id_t * id);
|
|
|
|
|
void (*add) (snd_ctl_t *handle, void *private_data, snd_ctl_element_id_t * id);
|
|
|
|
|
void (*remove) (snd_ctl_t *handle, void *private_data, snd_ctl_element_id_t * id);
|
2001-02-06 23:48:10 +00:00
|
|
|
void *reserved[58]; /* reserved for the future use - must be NULL!!! */
|
|
|
|
|
};
|
|
|
|
|
|
2001-02-07 15:13:15 +00:00
|
|
|
struct _snd_hctl_element_list {
|
2001-02-06 23:48:10 +00:00
|
|
|
unsigned int offset; /* W: first control ID to get */
|
|
|
|
|
unsigned int space; /* W: count of control IDs to get */
|
|
|
|
|
unsigned int used; /* R: count of available (set) controls */
|
|
|
|
|
unsigned int count; /* R: count of all available controls */
|
2001-02-07 15:13:15 +00:00
|
|
|
snd_ctl_element_id_t *pids; /* W: IDs */
|
2001-02-06 23:48:10 +00:00
|
|
|
};
|
|
|
|
|
|
2001-02-07 15:13:15 +00:00
|
|
|
struct _snd_hctl_element {
|
|
|
|
|
snd_ctl_element_id_t id; /* must be always on top */
|
|
|
|
|
struct list_head list; /* links for list of all helems */
|
2001-02-06 23:48:10 +00:00
|
|
|
int change: 1, /* structure change */
|
|
|
|
|
value: 1; /* value change */
|
|
|
|
|
/* event callbacks */
|
2001-02-07 15:13:15 +00:00
|
|
|
snd_hctl_element_callback_t callback_change;
|
|
|
|
|
snd_hctl_element_callback_t callback_value;
|
|
|
|
|
snd_hctl_element_callback_t callback_remove;
|
2001-02-06 23:48:10 +00:00
|
|
|
/* private data */
|
|
|
|
|
void *private_data;
|
2001-02-07 15:13:15 +00:00
|
|
|
snd_hctl_element_private_free_t private_free;
|
2001-02-06 23:48:10 +00:00
|
|
|
/* links */
|
|
|
|
|
snd_ctl_t *handle; /* associated handle */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card);
|
|
|
|
|
int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *socket, const char *sname);
|