Encapsulated hwdep. Converted all enums to type safety

This commit is contained in:
Abramo Bagnara 2001-02-05 15:44:42 +00:00
parent a83b209df2
commit 5bf23ae9a1
32 changed files with 510 additions and 268 deletions

View file

@ -651,7 +651,7 @@ int snd_config_add(snd_config_t *father, snd_config_t *leaf)
int snd_config_delete(snd_config_t *config)
{
assert(config);
switch (config->type) {
switch (snd_enum_to_int(config->type)) {
case SND_CONFIG_TYPE_COMPOUND:
{
int err;
@ -755,7 +755,7 @@ int snd_config_set(snd_config_t *config, ...)
va_list arg;
va_start(arg, config);
assert(config);
switch (config->type) {
switch (snd_enum_to_int(config->type)) {
case SND_CONFIG_TYPE_INTEGER:
config->u.integer = va_arg(arg, long);
break;
@ -803,7 +803,7 @@ int snd_config_string_get(snd_config_t *config, char **ptr)
int snd_config_get(snd_config_t *config, void *ptr)
{
assert(config && ptr);
switch (config->type) {
switch (snd_enum_to_int(config->type)) {
case SND_CONFIG_TYPE_INTEGER:
* (long*) ptr = config->u.integer;
break;
@ -908,7 +908,7 @@ static int _snd_config_save_leaf(snd_config_t *n, snd_output_t *out,
{
int err;
unsigned int k;
switch (n->type) {
switch (snd_enum_to_int(n->type)) {
case SND_CONFIG_TYPE_INTEGER:
snd_output_printf(out, "%ld", n->u.integer);
break;

View file

@ -1,6 +1,6 @@
EXTRA_LTLIBRARIES=libhwdep.la
libhwdep_la_SOURCES = hwdep.c
libhwdep_la_SOURCES = hwdep.c hwdep_m4.c
all: libhwdep.la

View file

@ -110,7 +110,7 @@ int snd_hwdep_block_mode(snd_hwdep_t *hwdep, int enable)
return 0;
}
int snd_hwdep_info(snd_hwdep_t *hwdep, snd_hwdep_info_t * info)
int snd_hwdep_info(snd_hwdep_t *hwdep, snd_hwdep_info_t *info)
{
if (!hwdep || !info)
return -EINVAL;

86
src/hwdep/hwdep_m4.c Normal file
View file

@ -0,0 +1,86 @@
/*
* Hwdep - Automatically generated functions
* Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
*
*
* 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.
*
*/
#include <errno.h>
#include <assert.h>
#include "local.h"
size_t snd_hwdep_info_sizeof()
{
return sizeof(snd_hwdep_info_t);
}
int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr)
{
assert(ptr);
*ptr = malloc(sizeof(snd_hwdep_info_t));
if (!*ptr)
return -ENOMEM;
return 0;
}
void snd_hwdep_info_free(snd_hwdep_info_t *obj)
{
free(obj);
}
void snd_hwdep_info_copy(snd_hwdep_info_t *dst, const snd_hwdep_info_t *src)
{
assert(dst && src);
*dst = *src;
}
unsigned int snd_hwdep_info_get_device(const snd_hwdep_info_t *obj)
{
assert(obj);
return obj->device;
}
int snd_hwdep_info_get_card(const snd_hwdep_info_t *obj)
{
assert(obj);
return obj->card;
}
const char * snd_hwdep_info_get_id(const snd_hwdep_info_t *obj)
{
assert(obj);
return obj->id;
}
const char * snd_hwdep_info_get_name(const snd_hwdep_info_t *obj)
{
assert(obj);
return obj->name;
}
snd_hwdep_type_t snd_hwdep_info_get_type(const snd_hwdep_info_t *obj)
{
assert(obj);
return snd_int_to_enum(obj->type);
}
void snd_hwdep_info_set_device(snd_hwdep_info_t *obj, unsigned int val)
{
assert(obj);
obj->device = val;
}

View file

@ -83,20 +83,22 @@ int snd_mixer_poll_descriptor(snd_mixer_t *handle)
return snd_ctl_poll_descriptor(handle->ctl_handle);
}
const char *snd_mixer_simple_channel_name(int channel)
const char *snd_mixer_simple_channel_name(snd_mixer_channel_id_t channel)
{
static char *array[6] = {
"Front-Left",
"Front-Right",
"Front-Center",
"Rear-Left",
"Rear-Right",
"Woofer"
static char *array[snd_enum_to_int(SND_MIXER_CHN_LAST) + 1] = {
[SND_MIXER_CHN_FRONT_LEFT] = "Front Left",
[SND_MIXER_CHN_FRONT_RIGHT] = "Front Right",
[SND_MIXER_CHN_FRONT_CENTER] = "Front Center",
[SND_MIXER_CHN_REAR_LEFT] = "Rear Left",
[SND_MIXER_CHN_REAR_RIGHT] = "Rear Right",
[SND_MIXER_CHN_WOOFER] = "Woofer"
};
if (channel < 0 || channel > 5)
char *p;
assert(channel <= SND_MIXER_CHN_LAST);
p = array[snd_enum_to_int(channel)];
if (!p)
return "?";
return array[channel];
return p;
}
int snd_mixer_simple_control_list(snd_mixer_t *handle, snd_mixer_simple_control_list_t *list)

View file

@ -218,14 +218,7 @@ int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2)
int snd_pcm_unlink(snd_pcm_t *pcm)
{
int fd;
switch (pcm->type) {
case SND_PCM_TYPE_HW:
case SND_PCM_TYPE_MULTI:
fd = snd_pcm_poll_descriptor(pcm);
break;
default:
return -ENOSYS;
}
fd = snd_pcm_link_descriptor(pcm);
if (ioctl(fd, SNDRV_PCM_IOCTL_UNLINK) < 0) {
SYSERR("SNDRV_PCM_IOCTL_UNLINK failed");
return -errno;
@ -409,7 +402,7 @@ snd_pcm_format_t snd_pcm_format_value(const char* name)
return format;
}
}
return SND_PCM_FORMAT_NONE;
return SND_PCM_FORMAT_UNKNOWN;
}
const char *snd_pcm_subformat_name(snd_pcm_subformat_t subformat)

View file

@ -600,7 +600,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name,
char *sname = NULL;
int err;
snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_NONE;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
snd_config_foreach(i, conf) {
snd_config_t *n = snd_config_entry(i);
if (strcmp(n->id, "comment") == 0)
@ -625,7 +625,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name,
return -EINVAL;
}
sformat = snd_pcm_format_value(f);
if (sformat == SND_PCM_FORMAT_NONE) {
if (sformat == SND_PCM_FORMAT_UNKNOWN) {
ERR("Unknown sformat");
return -EINVAL;
}
@ -643,7 +643,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, char *name,
ERR("sname is not defined");
return -EINVAL;
}
if (sformat == SND_PCM_FORMAT_NONE) {
if (sformat == SND_PCM_FORMAT_UNKNOWN) {
ERR("sformat is not defined");
return -EINVAL;
}

View file

@ -473,7 +473,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name,
char *sname = NULL;
int err;
snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_NONE;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
snd_config_foreach(i, conf) {
snd_config_t *n = snd_config_entry(i);
if (strcmp(n->id, "comment") == 0)
@ -498,7 +498,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name,
return -EINVAL;
}
sformat = snd_pcm_format_value(f);
if (sformat == SND_PCM_FORMAT_NONE) {
if (sformat == SND_PCM_FORMAT_UNKNOWN) {
ERR("Unknown sformat");
return -EINVAL;
}
@ -516,7 +516,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, char *name,
ERR("sname is not defined");
return -EINVAL;
}
if (sformat == SND_PCM_FORMAT_NONE) {
if (sformat == SND_PCM_FORMAT_UNKNOWN) {
ERR("sformat is not defined");
return -EINVAL;
}

View file

@ -371,7 +371,7 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, char *name,
char *sname = NULL;
int err;
snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_NONE;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
snd_config_foreach(i, conf) {
snd_config_t *n = snd_config_entry(i);
if (strcmp(n->id, "comment") == 0)
@ -396,7 +396,7 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, char *name,
return -EINVAL;
}
sformat = snd_pcm_format_value(f);
if (sformat == SND_PCM_FORMAT_NONE) {
if (sformat == SND_PCM_FORMAT_UNKNOWN) {
ERR("Unknown sformat %s", f);
return err;
}
@ -413,7 +413,7 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, char *name,
ERR("sname is not defined");
return -EINVAL;
}
if (sformat == SND_PCM_FORMAT_NONE) {
if (sformat == SND_PCM_FORMAT_UNKNOWN) {
ERR("sformat is not defined");
return -EINVAL;
}

View file

@ -26,7 +26,7 @@
#define bswap_16 swab16
#define bswap_32 swab32
#define bswap_64 swab64
#define SND_PCM_FORMAT_NONE (-1)
#define SND_PCM_FORMAT_UNKNOWN (-1)
#define snd_enum_to_int(v) (v)
#define snd_int_to_enum(v) (v)
#else
@ -442,7 +442,7 @@ snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_end
width = 3;
break;
default:
return SND_PCM_FORMAT_NONE;
return SND_PCM_FORMAT_UNKNOWN;
}
return snd_int_to_enum(((int(*)[2][2])linear_formats)[width][!!unsignd][!!big_endian]);
}

View file

@ -488,7 +488,7 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name,
char *sname = NULL;
int err;
snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_NONE;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
snd_config_foreach(i, conf) {
snd_config_t *n = snd_config_entry(i);
if (strcmp(n->id, "comment") == 0)
@ -513,7 +513,7 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name,
return -EINVAL;
}
sformat = snd_pcm_format_value(f);
if (sformat == SND_PCM_FORMAT_NONE) {
if (sformat == SND_PCM_FORMAT_UNKNOWN) {
ERR("Unknown sformat");
return -EINVAL;
}
@ -531,7 +531,7 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, char *name,
ERR("sname is not defined");
return -EINVAL;
}
if (sformat == SND_PCM_FORMAT_NONE) {
if (sformat == SND_PCM_FORMAT_UNKNOWN) {
ERR("sformat is not defined");
return -EINVAL;
}

View file

@ -132,7 +132,7 @@ static snd_pcm_format_t snd_pcm_plug_slave_format(snd_pcm_format_t format, const
}
/* Fall through */
default:
return SND_PCM_FORMAT_NONE;
return SND_PCM_FORMAT_UNKNOWN;
}
}
@ -144,7 +144,7 @@ static snd_pcm_format_t snd_pcm_plug_slave_format(snd_pcm_format_t format, const
if (snd_pcm_format_mask_test(format_mask, f))
return f;
}
return SND_PCM_FORMAT_NONE;
return SND_PCM_FORMAT_UNKNOWN;
}
w = snd_pcm_format_width(format);
u = snd_pcm_format_unsigned(format);
@ -158,7 +158,7 @@ static snd_pcm_format_t snd_pcm_plug_slave_format(snd_pcm_format_t format, const
for (sgn = 0; sgn < 2; ++sgn) {
snd_pcm_format_t f;
f = snd_pcm_build_linear_format(w1, u1, e1);
assert(f != SND_PCM_FORMAT_NONE);
assert(f != SND_PCM_FORMAT_UNKNOWN);
if (snd_pcm_format_mask_test(format_mask, f))
return f;
u1 = !u1;
@ -172,7 +172,7 @@ static snd_pcm_format_t snd_pcm_plug_slave_format(snd_pcm_format_t format, const
dw = -8;
}
}
return SND_PCM_FORMAT_NONE;
return SND_PCM_FORMAT_UNKNOWN;
}
#define SND_PCM_FMTBIT_PLUG (SND_PCM_FMTBIT_LINEAR | \
@ -401,9 +401,8 @@ static int snd_pcm_plug_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_
static int snd_pcm_plug_hw_refine_sprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *sparams)
{
snd_pcm_plug_t *plug = pcm->private;
snd_pcm_t *slave = plug->req_slave;
return snd_pcm_hw_params_any(slave, sparams);
_snd_pcm_hw_params_any(sparams);
return 0;
}
static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
@ -436,7 +435,7 @@ static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
f = format;
else {
f = snd_pcm_plug_slave_format(format, sformat_mask);
if (f == SND_PCM_FORMAT_NONE)
if (f == SND_PCM_FORMAT_UNKNOWN)
continue;
}
snd_pcm_format_mask_set(&sfmt_mask, f);
@ -496,7 +495,7 @@ static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
f = format;
else {
f = snd_pcm_plug_slave_format(format, sformat_mask);
if (f == SND_PCM_FORMAT_NONE)
if (f == SND_PCM_FORMAT_UNKNOWN)
continue;
}
snd_pcm_format_mask_set(&fmt_mask, format);

View file

@ -258,7 +258,7 @@ static int snd_pcm_rate_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t *
_snd_pcm_hw_params_any(sparams);
_snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
&saccess_mask);
if (rate->sformat != SND_PCM_FORMAT_NONE) {
if (rate->sformat != SND_PCM_FORMAT_UNKNOWN) {
_snd_pcm_hw_params_set_format(sparams, rate->sformat);
_snd_pcm_hw_params_set_subformat(sparams, SND_PCM_SUBFORMAT_STD);
}
@ -277,7 +277,7 @@ static int snd_pcm_rate_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
SND_PCM_HW_PARBIT_PERIOD_TIME |
SND_PCM_HW_PARBIT_TICK_TIME);
if (rate->sformat == SND_PCM_FORMAT_NONE)
if (rate->sformat == SND_PCM_FORMAT_UNKNOWN)
links |= (SND_PCM_HW_PARBIT_FORMAT |
SND_PCM_HW_PARBIT_SUBFORMAT |
SND_PCM_HW_PARBIT_SAMPLE_BITS |
@ -307,7 +307,7 @@ static int snd_pcm_rate_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
unsigned int links = (SND_PCM_HW_PARBIT_CHANNELS |
SND_PCM_HW_PARBIT_PERIOD_TIME |
SND_PCM_HW_PARBIT_TICK_TIME);
if (rate->sformat == SND_PCM_FORMAT_NONE)
if (rate->sformat == SND_PCM_FORMAT_UNKNOWN)
links |= (SND_PCM_HW_PARBIT_FORMAT |
SND_PCM_HW_PARBIT_SUBFORMAT |
SND_PCM_HW_PARBIT_SAMPLE_BITS |
@ -542,7 +542,7 @@ snd_pcm_sframes_t snd_pcm_rate_slave_frames(snd_pcm_t *pcm, snd_pcm_sframes_t fr
static void snd_pcm_rate_dump(snd_pcm_t *pcm, snd_output_t *out)
{
snd_pcm_rate_t *rate = pcm->private;
if (rate->sformat == SND_PCM_FORMAT_NONE)
if (rate->sformat == SND_PCM_FORMAT_UNKNOWN)
snd_output_printf(out, "Rate conversion PCM (%d)\n",
rate->srate);
else
@ -577,7 +577,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, char *name, snd_pcm_format_t sformat, in
snd_pcm_t *pcm;
snd_pcm_rate_t *rate;
assert(pcmp && slave);
if (sformat != SND_PCM_FORMAT_NONE &&
if (sformat != SND_PCM_FORMAT_UNKNOWN &&
snd_pcm_format_linear(sformat) != 1)
return -EINVAL;
rate = calloc(1, sizeof(snd_pcm_rate_t));
@ -625,7 +625,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, char *name,
char *sname = NULL;
int err;
snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_NONE;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
long srate = -1;
snd_config_foreach(i, conf) {
snd_config_t *n = snd_config_entry(i);
@ -651,7 +651,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, char *name,
return -EINVAL;
}
sformat = snd_pcm_format_value(f);
if (sformat == SND_PCM_FORMAT_NONE) {
if (sformat == SND_PCM_FORMAT_UNKNOWN) {
ERR("Unknown sformat");
return -EINVAL;
}

View file

@ -465,7 +465,7 @@ static int snd_pcm_route_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t
_snd_pcm_hw_params_any(sparams);
_snd_pcm_hw_param_set_mask(sparams, SND_PCM_HW_PARAM_ACCESS,
&saccess_mask);
if (route->sformat != SND_PCM_FORMAT_NONE) {
if (route->sformat != SND_PCM_FORMAT_UNKNOWN) {
_snd_pcm_hw_params_set_format(sparams, route->sformat);
_snd_pcm_hw_params_set_subformat(sparams, SND_PCM_SUBFORMAT_STD);
}
@ -488,7 +488,7 @@ static int snd_pcm_route_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *
SND_PCM_HW_PARBIT_BUFFER_SIZE |
SND_PCM_HW_PARBIT_BUFFER_TIME |
SND_PCM_HW_PARBIT_TICK_TIME);
if (route->sformat == SND_PCM_FORMAT_NONE)
if (route->sformat == SND_PCM_FORMAT_UNKNOWN)
links |= (SND_PCM_HW_PARBIT_FORMAT |
SND_PCM_HW_PARBIT_SUBFORMAT |
SND_PCM_HW_PARBIT_SAMPLE_BITS);
@ -512,7 +512,7 @@ static int snd_pcm_route_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *
SND_PCM_HW_PARBIT_BUFFER_SIZE |
SND_PCM_HW_PARBIT_BUFFER_TIME |
SND_PCM_HW_PARBIT_TICK_TIME);
if (route->sformat == SND_PCM_FORMAT_NONE)
if (route->sformat == SND_PCM_FORMAT_UNKNOWN)
links |= (SND_PCM_HW_PARBIT_FORMAT |
SND_PCM_HW_PARBIT_SUBFORMAT |
SND_PCM_HW_PARBIT_SAMPLE_BITS);
@ -642,7 +642,7 @@ static void snd_pcm_route_dump(snd_pcm_t *pcm, snd_output_t *out)
{
snd_pcm_route_t *route = pcm->private;
unsigned int dst;
if (route->sformat == SND_PCM_FORMAT_NONE)
if (route->sformat == SND_PCM_FORMAT_UNKNOWN)
snd_output_printf(out, "Route conversion PCM\n");
else
snd_output_printf(out, "Route conversion PCM (sformat=%s)\n",
@ -774,7 +774,7 @@ int snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
snd_pcm_route_t *route;
int err;
assert(pcmp && slave && ttable);
if (sformat != SND_PCM_FORMAT_NONE &&
if (sformat != SND_PCM_FORMAT_UNKNOWN &&
snd_pcm_format_linear(sformat) != 1)
return -EINVAL;
route = calloc(1, sizeof(snd_pcm_route_t));
@ -886,7 +886,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
char *sname = NULL;
int err;
snd_pcm_t *spcm;
snd_pcm_format_t sformat = SND_PCM_FORMAT_NONE;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
long schannels = -1;
snd_config_t *tt = NULL;
snd_pcm_route_ttable_entry_t ttable[MAX_CHANNELS*MAX_CHANNELS];
@ -915,7 +915,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, char *name,
return -EINVAL;
}
sformat = snd_pcm_format_value(f);
if (sformat == SND_PCM_FORMAT_NONE) {
if (sformat == SND_PCM_FORMAT_UNKNOWN) {
ERR("Unknown sformat");
return -EINVAL;
}

View file

@ -469,7 +469,7 @@ static int snd_pcm_share_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t
share->channels_count, 0);
if (err < 0)
return err;
if (slave->format != SND_PCM_FORMAT_NONE) {
if (slave->format != SND_PCM_FORMAT_UNKNOWN) {
err = _snd_pcm_hw_params_set_format(params, slave->format);
if (err < 0)
return err;
@ -1371,7 +1371,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
unsigned int channels_count = 0;
long schannels_count = -1;
unsigned int schannel_max = 0;
snd_pcm_format_t sformat = SND_PCM_FORMAT_NONE;
snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
long srate = -1;
snd_config_foreach(i, conf) {
@ -1398,7 +1398,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, char *name, snd_config_t *conf,
return -EINVAL;
}
sformat = snd_pcm_format_value(f);
if (sformat == SND_PCM_FORMAT_NONE) {
if (sformat == SND_PCM_FORMAT_UNKNOWN) {
ERR("Unknown format %s", f);
return -EINVAL;
}

View file

@ -73,7 +73,7 @@ typedef struct {
struct _snd_seq {
char *name;
int type;
snd_seq_type_t type;
int streams;
int mode;
int poll_fd;