Name cleaning for hwdep and timer API

This commit is contained in:
Abramo Bagnara 2001-03-29 11:18:16 +00:00
parent 08232943a2
commit ee6d9f1bbd
5 changed files with 45 additions and 45 deletions

View file

@ -8,16 +8,16 @@
/** HwDep information container */
typedef struct _snd_hwdep_info snd_hwdep_info_t;
typedef enum _snd_hwdep_type {
SND_HWDEP_TYPE_OPL2 = SNDRV_HWDEP_TYPE_OPL2,
SND_HWDEP_TYPE_OPL3 = SNDRV_HWDEP_TYPE_OPL3,
SND_HWDEP_TYPE_OPL4 = SNDRV_HWDEP_TYPE_OPL4,
SND_HWDEP_TYPE_SB16CSP = SNDRV_HWDEP_TYPE_SB16CSP,
SND_HWDEP_TYPE_EMU10K1 = SNDRV_HWDEP_TYPE_EMU10K1,
SND_HWDEP_TYPE_YSS225 = SNDRV_HWDEP_TYPE_YSS225,
SND_HWDEP_TYPE_ICS2115 = SNDRV_HWDEP_TYPE_ICS2115,
SND_HWDEP_TYPE_LAST = SNDRV_HWDEP_TYPE_LAST,
} snd_hwdep_type_t;
typedef enum _snd_hwdep_iface {
SND_HWDEP_IFACE_OPL2 = SNDRV_HWDEP_IFACE_OPL2,
SND_HWDEP_IFACE_OPL3 = SNDRV_HWDEP_IFACE_OPL3,
SND_HWDEP_IFACE_OPL4 = SNDRV_HWDEP_IFACE_OPL4,
SND_HWDEP_IFACE_SB16CSP = SNDRV_HWDEP_IFACE_SB16CSP,
SND_HWDEP_IFACE_EMU10K1 = SNDRV_HWDEP_IFACE_EMU10K1,
SND_HWDEP_IFACE_YSS225 = SNDRV_HWDEP_IFACE_YSS225,
SND_HWDEP_IFACE_ICS2115 = SNDRV_HWDEP_IFACE_ICS2115,
SND_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_LAST,
} snd_hwdep_iface_t;
#define SND_HWDEP_OPEN_READ (O_RDONLY)
#define SND_HWDEP_OPEN_WRITE (O_WRONLY)

View file

@ -16,7 +16,7 @@ const char *snd_hwdep_info_get_id(const snd_hwdep_info_t *obj);
const char *snd_hwdep_info_get_name(const snd_hwdep_info_t *obj);
snd_hwdep_type_t snd_hwdep_info_get_type(const snd_hwdep_info_t *obj);
snd_hwdep_iface_t snd_hwdep_info_get_iface(const snd_hwdep_info_t *obj);
void snd_hwdep_info_set_device(snd_hwdep_info_t *obj, unsigned int val);

View file

@ -12,22 +12,22 @@ typedef struct sndrv_timer_params snd_timer_params_t;
typedef struct sndrv_timer_status snd_timer_status_t;
typedef struct sndrv_timer_read snd_timer_read_t;
typedef enum _snd_timer_type {
SND_TIMER_TYPE_NONE = SNDRV_TIMER_TYPE_NONE,
SND_TIMER_TYPE_SLAVE = SNDRV_TIMER_TYPE_SLAVE,
SND_TIMER_TYPE_GLOBAL = SNDRV_TIMER_TYPE_GLOBAL,
SND_TIMER_TYPE_CARD = SNDRV_TIMER_TYPE_CARD,
SND_TIMER_TYPE_PCM = SNDRV_TIMER_TYPE_PCM,
SND_TIMER_TYPE_LAST = SNDRV_TIMER_TYPE_LAST,
} snd_timer_type_t;
typedef enum _snd_timer_class {
SND_TIMER_CLASS_NONE = SNDRV_TIMER_CLASS_NONE,
SND_TIMER_CLASS_SLAVE = SNDRV_TIMER_CLASS_SLAVE,
SND_TIMER_CLASS_GLOBAL = SNDRV_TIMER_CLASS_GLOBAL,
SND_TIMER_CLASS_CARD = SNDRV_TIMER_CLASS_CARD,
SND_TIMER_CLASS_PCM = SNDRV_TIMER_CLASS_PCM,
SND_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_LAST,
} snd_timer_class_t;
typedef enum _snd_timer_slave_type {
SND_TIMER_STYPE_NONE = SNDRV_TIMER_STYPE_NONE,
SND_TIMER_STYPE_APPLICATION = SNDRV_TIMER_STYPE_APPLICATION,
SND_TIMER_STYPE_SEQUENCER = SNDRV_TIMER_STYPE_SEQUENCER,
SND_TIMER_STYPE_OSS_SEQUENCER = SNDRV_TIMER_STYPE_OSS_SEQUENCER,
SND_TIMER_STYPE_LAST = SNDRV_TIMER_STYPE_LAST,
} snd_timer_slave_type_t;
typedef enum _snd_timer_slave_class {
SND_TIMER_SCLASS_NONE = SNDRV_TIMER_SCLASS_NONE,
SND_TIMER_SCLASS_APPLICATION = SNDRV_TIMER_SCLASS_APPLICATION,
SND_TIMER_SCLASS_SEQUENCER = SNDRV_TIMER_SCLASS_SEQUENCER,
SND_TIMER_SCLASS_OSS_SEQUENCER = SNDRV_TIMER_SCLASS_OSS_SEQUENCER,
SND_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_LAST,
} snd_timer_slave_class_t;
#define SND_TIMER_GLOBAL_SYSTEM SNDRV_TIMER_GLOBAL_SYSTEM
#define SND_TIMER_GLOBAL_RTC SNDRV_TIMER_GLOBAL_RTC

View file

@ -70,10 +70,10 @@ const char *snd_hwdep_info_get_name(const snd_hwdep_info_t *obj)
return obj->name;
}
snd_hwdep_type_t snd_hwdep_info_get_type(const snd_hwdep_info_t *obj)
snd_hwdep_iface_t snd_hwdep_info_get_iface(const snd_hwdep_info_t *obj)
{
assert(obj);
return snd_int_to_enum(obj->type);
return snd_int_to_enum(obj->iface);
}
void snd_hwdep_info_set_device(snd_hwdep_info_t *obj, unsigned int val)

View file

@ -50,8 +50,8 @@ void read_loop(void *handle, int master_ticks, int timeout)
int main(int argc, char *argv[])
{
int idx, err;
int type = SND_TIMER_TYPE_GLOBAL;
int stype = SND_TIMER_TYPE_NONE;
int class = SND_TIMER_CLASS_GLOBAL;
int sclass = SND_TIMER_CLASS_NONE;
int card = 0;
int device = SND_TIMER_GLOBAL_SYSTEM;
int subdevice = 0;
@ -63,10 +63,10 @@ int main(int argc, char *argv[])
idx = 1;
while (idx < argc) {
if (!strncmp(argv[idx], "type=", 5)) {
type = atoi(argv[idx]+5);
} else if (!strncmp(argv[idx], "stype=", 6)) {
stype = atoi(argv[idx]+6);
if (!strncmp(argv[idx], "class=", 5)) {
class = atoi(argv[idx]+5);
} else if (!strncmp(argv[idx], "sclass=", 6)) {
sclass = atoi(argv[idx]+6);
} else if (!strncmp(argv[idx], "card=", 5)) {
card = atoi(argv[idx]+5);
} else if (!strncmp(argv[idx], "device=", 7)) {
@ -78,8 +78,8 @@ int main(int argc, char *argv[])
}
idx++;
}
if (type == SND_TIMER_TYPE_SLAVE && stype == SND_TIMER_STYPE_NONE) {
fprintf(stderr, "sync_type is not set\n");
if (class == SND_TIMER_CLASS_SLAVE && sclass == SND_TIMER_SCLASS_NONE) {
fprintf(stderr, "slave class is not set\n");
exit(0);
}
if ((err = snd_timer_open(&handle))<0) {
@ -88,22 +88,22 @@ int main(int argc, char *argv[])
}
if (list) {
bzero(&sel.id, sizeof(sel.id));
sel.id.type = -1;
sel.id.class = -1;
while (1) {
if ((err = snd_timer_next_device(handle, &sel.id)) < 0) {
fprintf(stderr, "timer next device error: %s\n", snd_strerror(err));
break;
}
if (sel.id.type < 0)
if (sel.id.class < 0)
break;
printf("Timer device: type %i, stype %i, card %i, device %i, subdevice %i\n",
sel.id.type, sel.id.stype, sel.id.card, sel.id.device, sel.id.subdevice);
printf("Timer device: class %i, sclass %i, card %i, device %i, subdevice %i\n",
sel.id.class, sel.id.sclass, sel.id.card, sel.id.device, sel.id.subdevice);
}
}
printf("Using timer type %i, slave type %i, card %i, device %i, subdevice %i\n", type, stype, card, device, subdevice);
printf("Using timer class %i, slave class %i, card %i, device %i, subdevice %i\n", class, sclass, card, device, subdevice);
bzero(&sel, sizeof(sel));
sel.id.type = type;
sel.id.stype = stype;
sel.id.class = class;
sel.id.sclass = sclass;
sel.id.card = card;
sel.id.device = device;
sel.id.subdevice = subdevice;
@ -111,7 +111,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "timer select %i (%s)\n", err, snd_strerror(err));
exit(0);
}
if (type != SND_TIMER_TYPE_SLAVE) {
if (class != SND_TIMER_CLASS_SLAVE) {
if ((err = snd_timer_info(handle, &info)) < 0) {
fprintf(stderr, "timer info %i (%s)\n", err, snd_strerror(err));
exit(0);
@ -138,7 +138,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "timer start %i (%s)\n", err, snd_strerror(err));
exit(0);
}
read_loop(handle, 25, type == SND_TIMER_TYPE_SLAVE ? 10000 : 1);
read_loop(handle, 25, class == SND_TIMER_CLASS_SLAVE ? 10000 : 1);
show_status(handle);
snd_timer_close(handle);
return 0;