Merged pcmfinal branch.

This commit is contained in:
Jaroslav Kysela 2000-11-20 20:10:46 +00:00
parent 3cc2b957fb
commit 41bb7068f2
57 changed files with 5189 additions and 3088 deletions

View file

@ -27,6 +27,7 @@
#include <ctype.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "control_local.h"
#include "asoundlib.h"
#define SND_FILE_CONTROL "/dev/snd/controlC%i"

View file

@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
@ -170,8 +171,16 @@ int snd_ctl_open(snd_ctl_t **ctlp, char *name)
return err;
err = snd_config_searchv(snd_config, &ctl_conf, "ctl", name, 0);
if (err < 0) {
int cardno = snd_card_get_index(name);
return snd_ctl_hw_open(ctlp, name, cardno);
int card;
char socket[256], sname[256];
err = sscanf(name, "hw:%d", &card);
if (err == 1)
return snd_ctl_hw_open(ctlp, NULL, card);
err = sscanf(name, "shm:%256s,%256s", socket, sname);
if (err == 2)
return snd_ctl_shm_open(ctlp, NULL, socket, sname);
ERR("Unknown control %s", name);
return -ENOENT;
}
if (snd_config_type(ctl_conf) != SND_CONFIG_TYPE_COMPOUND)
return -EINVAL;
@ -182,8 +191,6 @@ int snd_ctl_open(snd_ctl_t **ctlp, char *name)
if (err < 0)
return err;
err = snd_config_searchv(snd_config, &type_conf, "ctltype", str, 0);
if (err < 0)
return err;
snd_config_foreach(i, type_conf) {
snd_config_t *n = snd_config_entry(i);
if (strcmp(n->id, "comment") == 0)
@ -215,3 +222,4 @@ int snd_ctl_open(snd_ctl_t **ctlp, char *name)
return -ENXIO;
return open_func(ctlp, name, ctl_conf);
}

View file

@ -140,7 +140,7 @@ static int snd_ctl_hw_read(snd_ctl_t *handle, snd_ctl_event_t *event)
return read(hw->fd, event, sizeof(*event));
}
struct snd_ctl_ops snd_ctl_hw_ops = {
snd_ctl_ops_t snd_ctl_hw_ops = {
close: snd_ctl_hw_close,
poll_descriptor: snd_ctl_hw_poll_descriptor,
hw_info: snd_ctl_hw_hw_info,

View file

@ -23,7 +23,15 @@
#include "asoundlib.h"
#include "list.h"
struct snd_ctl_ops {
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
#define ERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, 0, __VA_ARGS__)
#define SYSERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, errno, __VA_ARGS__)
#else
#define ERR(args...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, 0, ##args)
#define SYSERR(args...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, errno, ##args)
#endif
typedef struct {
int (*close)(snd_ctl_t *handle);
int (*poll_descriptor)(snd_ctl_t *handle);
int (*hw_info)(snd_ctl_t *handle, snd_ctl_hw_info_t *info);
@ -37,13 +45,13 @@ struct snd_ctl_ops {
int (*rawmidi_info)(snd_ctl_t *handle, snd_rawmidi_info_t * info);
int (*rawmidi_prefer_subdevice)(snd_ctl_t *handle, int subdev);
int (*read)(snd_ctl_t *handle, snd_ctl_event_t *event);
};
} snd_ctl_ops_t;
struct snd_ctl {
struct _snd_ctl {
char *name;
snd_ctl_type_t type;
struct snd_ctl_ops *ops;
snd_ctl_ops_t *ops;
void *private;
int hcount;
int herr;
@ -56,3 +64,6 @@ struct snd_ctl {
snd_ctl_hcallback_add_t *callback_add;
void *callback_add_private_data;
};
int snd_ctl_hw_open(snd_ctl_t **handle, char *name, int card);
int snd_ctl_shm_open(snd_ctl_t **handlep, char *name, char *socket, char *sname);

View file

@ -266,7 +266,7 @@ static int snd_ctl_shm_read(snd_ctl_t *ctl, snd_ctl_event_t *event)
return err;
}
struct snd_ctl_ops snd_ctl_shm_ops = {
snd_ctl_ops_t snd_ctl_shm_ops = {
close: snd_ctl_shm_close,
poll_descriptor: snd_ctl_shm_poll_descriptor,
hw_info: snd_ctl_shm_hw_info,