]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Added snd_*_card() functions.
authorJaroslav Kysela <perex@perex.cz>
Fri, 22 Dec 2000 14:03:01 +0000 (14:03 +0000)
committerJaroslav Kysela <perex@perex.cz>
Fri, 22 Dec 2000 14:03:01 +0000 (14:03 +0000)
31 files changed:
aserver/aserver.c
include/aserver.h
include/control.h
include/mixer.h
include/pcm.h
include/rawmidi.h
src/control/control.c
src/control/control_hw.c
src/control/control_local.h
src/control/control_shm.c
src/pcm/pcm.c
src/pcm/pcm_adpcm.c
src/pcm/pcm_alaw.c
src/pcm/pcm_copy.c
src/pcm/pcm_file.c
src/pcm/pcm_hw.c
src/pcm/pcm_linear.c
src/pcm/pcm_local.h
src/pcm/pcm_mulaw.c
src/pcm/pcm_multi.c
src/pcm/pcm_null.c
src/pcm/pcm_plug.c
src/pcm/pcm_plugin.c
src/pcm/pcm_plugin.h
src/pcm/pcm_rate.c
src/pcm/pcm_route.c
src/pcm/pcm_share.c
src/pcm/pcm_shm.c
src/rawmidi/rawmidi.c
src/rawmidi/rawmidi_hw.c
src/rawmidi/rawmidi_local.h

index ebedb059ccfe318978c09a06bcc07e5fc1b15f3c..5752dfd99d95f6f03061873f6d206515f9acafbd 100644 (file)
@@ -373,6 +373,10 @@ int pcm_shm_cmd(client_t *client)
        ctrl->cmd = 0;
        pcm = client->device.pcm.handle;
        switch (cmd) {
+       case SND_PCM_IOCTL_CARD:
+               ctrl->result = 0;
+               ctrl->u.card = snd_pcm_card(pcm);
+               break;
        case SND_PCM_IOCTL_ASYNC:
                ctrl->result = snd_pcm_async(pcm, ctrl->u.async.sig, ctrl->u.async.pid);
                break;
@@ -627,6 +631,9 @@ int ctl_shm_cmd(client_t *client)
        case SND_CTL_IOCTL_CLOSE:
                client->ops->close(client);
                break;
+       case SND_PCM_IOCTL_CARD:
+               ctrl->result = 0;
+               return shm_ack_fd(client, snd_ctl_card(ctl));
        case SND_PCM_IOCTL_POLL_DESCRIPTOR:
                ctrl->result = 0;
                return shm_ack_fd(client, snd_ctl_poll_descriptor(ctl));
index 209f4425d43dc23fceee8c34aeff394d5454dfb1..9b4cc8345ca3fc53c4e0e950b2573dbda06250b1 100644 (file)
 
 #include "../src/pcm/pcm_local.h"
 
-#define SND_PCM_IOCTL_STATE            _IO ('A', 0xf0)
-#define SND_PCM_IOCTL_MMAP             _IO ('A', 0xf1)
-#define SND_PCM_IOCTL_MUNMAP           _IO ('A', 0xf4)
-#define SND_PCM_IOCTL_MMAP_FORWARD     _IO ('A', 0xf7)
-#define SND_PCM_IOCTL_AVAIL_UPDATE     _IO ('A', 0xf8)
-#define SND_PCM_IOCTL_ASYNC            _IO ('A', 0xf9)
-#define SND_PCM_IOCTL_CLOSE            _IO ('A', 0xfa)
-#define SND_PCM_IOCTL_POLL_DESCRIPTOR  _IO ('A', 0xfc)
-#define SND_PCM_IOCTL_SET_AVAIL_MIN    _IO ('A', 0xfd)
+#define SND_PCM_IOCTL_CARD             _IO ('A', 0xf0)
+#define SND_PCM_IOCTL_STATE            _IO ('A', 0xf1)
+#define SND_PCM_IOCTL_MMAP             _IO ('A', 0xf2)
+#define SND_PCM_IOCTL_MUNMAP           _IO ('A', 0xf3)
+#define SND_PCM_IOCTL_MMAP_FORWARD     _IO ('A', 0xf4)
+#define SND_PCM_IOCTL_AVAIL_UPDATE     _IO ('A', 0xf5)
+#define SND_PCM_IOCTL_ASYNC            _IO ('A', 0xf6)
+#define SND_PCM_IOCTL_CLOSE            _IO ('A', 0xf7)
+#define SND_PCM_IOCTL_POLL_DESCRIPTOR  _IO ('A', 0xf8)
+#define SND_PCM_IOCTL_SET_AVAIL_MIN    _IO ('A', 0xf9)
 
 typedef struct {
        long result;
@@ -37,6 +38,7 @@ typedef struct {
        size_t hw_ptr;
        size_t appl_ptr;
        union {
+               int card;
                struct {
                        int sig;
                        pid_t pid;
@@ -71,9 +73,10 @@ typedef struct {
 
 #define PCM_SHM_SIZE sizeof(snd_pcm_shm_ctrl_t)
                
-#define SND_CTL_IOCTL_READ             _IOR('U', 0xf0, snd_ctl_event_t)
-#define SND_CTL_IOCTL_CLOSE            _IO ('U', 0xf1)
-#define SND_CTL_IOCTL_POLL_DESCRIPTOR  _IO ('U', 0xf2)
+#define SND_CTL_IOCTL_CARD             _IO ('U', 0xf0)
+#define SND_CTL_IOCTL_READ             _IOR('U', 0xf1, snd_ctl_event_t)
+#define SND_CTL_IOCTL_CLOSE            _IO ('U', 0xf2)
+#define SND_CTL_IOCTL_POLL_DESCRIPTOR  _IO ('U', 0xf3)
 
 typedef struct {
        int result;
index cd8e0e534a6464f20689fed4d0417bc7215e0270..401bb8ed875585a52d8bd67c754d13465c031d4f 100644 (file)
@@ -42,6 +42,7 @@ int snd_defaults_rawmidi_device(void);
 snd_ctl_type_t snd_ctl_type(snd_ctl_t *handle);
 int snd_ctl_open(snd_ctl_t **handle, char *name);
 int snd_ctl_close(snd_ctl_t *handle);
+int snd_ctl_card(snd_ctl_t *handle);
 int snd_ctl_poll_descriptor(snd_ctl_t *handle);
 int snd_ctl_hw_info(snd_ctl_t *handle, snd_ctl_hw_info_t *info);
 int snd_ctl_clist(snd_ctl_t *handle, snd_control_list_t * list);
index c53de78c5812547f0b24d340ec7a1e0a5280b97a..2382062d3986ac6bb8279bc382416946a4929df9 100644 (file)
@@ -13,6 +13,7 @@ extern "C" {
 
 int snd_mixer_open(snd_mixer_t **handle, char *name);
 int snd_mixer_close(snd_mixer_t *handle);
+int snd_mixer_card(snd_mixer_t *handle);
 int snd_mixer_poll_descriptor(snd_mixer_t *handle);
 
 #ifdef __cplusplus
index c5d49af56fb4a2396092a89a1d210e79cb2d2177..8efc8708fa94ea78fff17f4d825e8734eb72d2ae 100644 (file)
@@ -53,6 +53,7 @@ ssize_t snd_pcm_readv(snd_pcm_t *pcm, const struct iovec *vector, int count);
 
 snd_pcm_type_t snd_pcm_type(snd_pcm_t *pcm);
 int snd_pcm_close(snd_pcm_t *pcm);
+int snd_pcm_card(snd_pcm_t *pcm);
 int snd_pcm_poll_descriptor(snd_pcm_t *pcm);
 int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock);
 int snd_pcm_async(snd_pcm_t *pcm, int sig, pid_t pid);
index f75ef0c28f70196a60ce2ea7dbc638310e8546ee..f1b1bbc0a7b2617363bfb6b7215cf8777104b65c 100644 (file)
@@ -26,6 +26,7 @@ typedef enum _snd_rawmidi_type {
 
 int snd_rawmidi_open(snd_rawmidi_t **handle, char *name, int streams, int mode);
 int snd_rawmidi_close(snd_rawmidi_t *handle);
+int snd_rawmidi_card(snd_rawmidi_t *handle);
 int snd_rawmidi_poll_descriptor(snd_rawmidi_t *handle);
 int snd_rawmidi_nonblock(snd_rawmidi_t *handle, int nonblock);
 int snd_rawmidi_info(snd_rawmidi_t *handle, snd_rawmidi_info_t * info);
index 584fd9461b4056a62f4f821614c44dc6c29f9dd5..7a18e400591706da37d8b3cae8b94844d463362f 100644 (file)
@@ -45,6 +45,12 @@ int snd_ctl_close(snd_ctl_t *ctl)
        return res;
 }
 
+int snd_ctl_card(snd_ctl_t *ctl)
+{
+       assert(ctl);
+       return ctl->ops->card(ctl);
+}
+
 int snd_ctl_poll_descriptor(snd_ctl_t *ctl)
 {
        assert(ctl);
index abc001068778feccccf476f9792de1abc100dc4b..85f80653e600c3ff67eb16b57412c41b228bc4c1 100644 (file)
@@ -48,6 +48,12 @@ static int snd_ctl_hw_close(snd_ctl_t *handle)
        return res;
 }
 
+static int snd_ctl_hw_card(snd_ctl_t *handle)
+{
+       snd_ctl_hw_t *hw = handle->private;
+       return hw->card;
+}
+
 static int snd_ctl_hw_poll_descriptor(snd_ctl_t *handle)
 {
        snd_ctl_hw_t *hw = handle->private;
@@ -166,6 +172,7 @@ static int snd_ctl_hw_read(snd_ctl_t *handle, snd_ctl_event_t *event)
 
 snd_ctl_ops_t snd_ctl_hw_ops = {
        close: snd_ctl_hw_close,
+       card: snd_ctl_hw_card,
        poll_descriptor: snd_ctl_hw_poll_descriptor,
        hw_info: snd_ctl_hw_hw_info,
        clist: snd_ctl_hw_clist,
index 9a13521efe7a65a577fac59fafa24a768286211f..5bd9f197528f96dcc806e39cf2bbaa2e7336678b 100644 (file)
@@ -33,6 +33,7 @@
 
 typedef struct {
        int (*close)(snd_ctl_t *handle);
+       int (*card)(snd_ctl_t *handle);
        int (*poll_descriptor)(snd_ctl_t *handle);
        int (*hw_info)(snd_ctl_t *handle, snd_ctl_hw_info_t *info);
        int (*clist)(snd_ctl_t *handle, snd_control_list_t *list);
index fad8a41a9426c373ea223d074774538a9d340217..e5131d33110a468557875ee0ef91c8bbf75b38fc 100644 (file)
@@ -95,6 +95,18 @@ static int snd_ctl_shm_close(snd_ctl_t *ctl)
        return result;
 }
 
+static int snd_ctl_shm_card(snd_ctl_t *ctl)
+{
+       snd_ctl_shm_t *shm = ctl->private;
+       snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
+       int card, err;
+       ctrl->cmd = SND_CTL_IOCTL_CARD;
+       err = snd_ctl_shm_action_fd(ctl, &card);
+       if (err < 0)
+               return err;
+       return card;
+}
+
 static int snd_ctl_shm_poll_descriptor(snd_ctl_t *ctl)
 {
        snd_ctl_shm_t *shm = ctl->private;
@@ -310,6 +322,7 @@ static int snd_ctl_shm_read(snd_ctl_t *ctl, snd_ctl_event_t *event)
 
 snd_ctl_ops_t snd_ctl_shm_ops = {
        close: snd_ctl_shm_close,
+       card: snd_ctl_shm_card,
        poll_descriptor: snd_ctl_shm_poll_descriptor,
        hw_info: snd_ctl_shm_hw_info,
        clist: snd_ctl_shm_clist,
index bb96a9001f35c33cfcf5bd0412a9fe3f9eacb5f3..d46bbdc4ab9f765cd1a22e4de4e47ed7879d2a78 100644 (file)
@@ -261,6 +261,12 @@ ssize_t snd_pcm_readv(snd_pcm_t *pcm, const struct iovec *vector, int count)
        return snd_pcm_readn(pcm, bufs, vector[0].iov_len);
 }
 
+int snd_pcm_card(snd_pcm_t *pcm)
+{
+       assert(pcm);
+       return pcm->ops->card(pcm->op_arg);
+}
+
 /* FIXME */
 #define snd_pcm_link_descriptor snd_pcm_poll_descriptor
 
index 1830713230bbd9ab0e84275660d6178967495e9a..4c184abb7aad0d8adc6c6f6dd37ee450c91111e8 100644 (file)
@@ -532,6 +532,7 @@ static void snd_pcm_adpcm_dump(snd_pcm_t *pcm, FILE *fp)
 
 snd_pcm_ops_t snd_pcm_adpcm_ops = {
        close: snd_pcm_adpcm_close,
+       card: snd_pcm_plugin_card,
        info: snd_pcm_plugin_info,
        hw_refine: snd_pcm_adpcm_hw_refine,
        hw_params: snd_pcm_adpcm_hw_params,
index 6459b0b54504f20b473a66d27cb164bcfae032c8..8fd845899b8590998349dd77d1fc0b9914fabcac 100644 (file)
@@ -400,6 +400,7 @@ static void snd_pcm_alaw_dump(snd_pcm_t *pcm, FILE *fp)
 
 snd_pcm_ops_t snd_pcm_alaw_ops = {
        close: snd_pcm_plugin_close,
+       card: snd_pcm_plugin_card,
        info: snd_pcm_plugin_info,
        hw_refine: snd_pcm_alaw_hw_refine,
        hw_params: snd_pcm_alaw_hw_params,
index 25773dfa2ee1892aa7570c9ceecb32613c7d70dd..594ead57980be6678a08e37e1d4cdfc0e2aa7458 100644 (file)
@@ -158,6 +158,7 @@ static void snd_pcm_copy_dump(snd_pcm_t *pcm, FILE *fp)
 
 snd_pcm_ops_t snd_pcm_copy_ops = {
        close: snd_pcm_plugin_close,
+       card: snd_pcm_plugin_card,
        info: snd_pcm_plugin_info,
        hw_refine: snd_pcm_copy_hw_refine,
        hw_params: snd_pcm_copy_hw_params,
index 55ca56939fa9165b1b9b35bda947745a8c1e1ebf..4a8014059a54072f8cb4d691c74c2002bb995cdb 100644 (file)
@@ -49,6 +49,12 @@ static int snd_pcm_file_close(snd_pcm_t *pcm)
        return 0;
 }
 
+static int snd_pcm_file_card(snd_pcm_t *pcm)
+{
+       snd_pcm_file_t *file = pcm->private;
+       return snd_pcm_card(file->slave);
+}
+
 static int snd_pcm_file_nonblock(snd_pcm_t *pcm, int nonblock)
 {
        snd_pcm_file_t *file = pcm->private;
@@ -301,6 +307,7 @@ static void snd_pcm_file_dump(snd_pcm_t *pcm, FILE *fp)
 
 snd_pcm_ops_t snd_pcm_file_ops = {
        close: snd_pcm_file_close,
+       card: snd_pcm_file_card,
        info: snd_pcm_file_info,
        hw_refine: snd_pcm_file_hw_refine,
        hw_params: snd_pcm_file_hw_params,
index 63dea446e8db6b1dbcf4d186d60d0f4a9b0be05a..77bf9d94200972da3804a5a27bdb43c8bd31c94e 100644 (file)
@@ -109,6 +109,12 @@ static int snd_pcm_hw_async(snd_pcm_t *pcm, int sig, pid_t pid)
        return 0;
 }
 
+static int snd_pcm_hw_card(snd_pcm_t *pcm)
+{
+       snd_pcm_hw_t *hw = pcm->private;
+       return hw->card;
+}
+
 static int snd_pcm_hw_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
 {
        snd_pcm_hw_t *hw = pcm->private;
@@ -499,6 +505,7 @@ static void snd_pcm_hw_dump(snd_pcm_t *pcm, FILE *fp)
 
 snd_pcm_ops_t snd_pcm_hw_ops = {
        close: snd_pcm_hw_close,
+       card: snd_pcm_hw_card,
        info: snd_pcm_hw_info,
        hw_refine: snd_pcm_hw_hw_refine,
        hw_params: snd_pcm_hw_hw_params,
index 9ecb5252ab8c037ddf79dbbcdd841396e954b1ef..6fb661289b2d4fd7a2fdbb61e1d2b24af21d8244 100644 (file)
@@ -239,6 +239,7 @@ static void snd_pcm_linear_dump(snd_pcm_t *pcm, FILE *fp)
 
 snd_pcm_ops_t snd_pcm_linear_ops = {
        close: snd_pcm_plugin_close,
+       card: snd_pcm_plugin_card,
        info: snd_pcm_plugin_info,
        hw_refine: snd_pcm_linear_hw_refine,
        hw_params: snd_pcm_linear_hw_params,
index 6bfdb70777b22058d6103b2fe1da28bdffbb71dc..5c354ab42a6d2952f66fe0708286452865cb2cc5 100644 (file)
@@ -56,6 +56,7 @@ typedef struct _snd_pcm_channel_info {
 
 typedef struct {
        int (*close)(snd_pcm_t *pcm);
+       int (*card)(snd_pcm_t *pcm);
        int (*nonblock)(snd_pcm_t *pcm, int nonblock);
        int (*async)(snd_pcm_t *pcm, int sig, pid_t pid);
        int (*info)(snd_pcm_t *pcm, snd_pcm_info_t *info);
index ec0642f124909ee3f7ace14c527c7a27d60e732c..55dc7dac417147ca7e21fa0dbbf924e9890ff656 100644 (file)
@@ -417,6 +417,7 @@ static void snd_pcm_mulaw_dump(snd_pcm_t *pcm, FILE *fp)
 
 snd_pcm_ops_t snd_pcm_mulaw_ops = {
        close: snd_pcm_plugin_close,
+       card: snd_pcm_plugin_card,
        info: snd_pcm_plugin_info,
        hw_refine: snd_pcm_mulaw_hw_refine,
        hw_params: snd_pcm_mulaw_hw_params,
index f36dd222b85eee463fe513d14c02ad5225ffa167..c4e5f425972adb03e8af584f43c8b9ebab08f15f 100644 (file)
@@ -67,6 +67,11 @@ static int snd_pcm_multi_close(snd_pcm_t *pcm)
        return ret;
 }
 
+static int snd_pcm_multi_card(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+       return -ENOENT; /* not available */
+}
+
 static int snd_pcm_multi_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
 {
        return 0;
@@ -390,6 +395,7 @@ static void snd_pcm_multi_dump(snd_pcm_t *pcm, FILE *fp)
 
 snd_pcm_ops_t snd_pcm_multi_ops = {
        close: snd_pcm_multi_close,
+       card: snd_pcm_multi_card,
        info: snd_pcm_multi_info,
        hw_refine: snd_pcm_multi_hw_refine,
        hw_params: snd_pcm_multi_hw_params,
index 171a79e4fa62db8fb18548222c10ff4b0218d684..0e3ad1aa0689154422a22dda0e5ea57ebb18c947 100644 (file)
@@ -42,6 +42,11 @@ static int snd_pcm_null_close(snd_pcm_t *pcm)
        return 0;
 }
 
+static int snd_pcm_null_card(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+       return -ENOENT; /* not available */
+}
+
 static int snd_pcm_null_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
 {
        return 0;
@@ -295,6 +300,7 @@ static void snd_pcm_null_dump(snd_pcm_t *pcm, FILE *fp)
 
 snd_pcm_ops_t snd_pcm_null_ops = {
        close: snd_pcm_null_close,
+       card: snd_pcm_null_card,
        info: snd_pcm_null_info,
        hw_refine: snd_pcm_null_hw_refine,
        hw_params: snd_pcm_null_hw_params,
index 0019c6e2546750666ec20f68e39f99ffb812d6cd..1206af6be2203db2ae3b615133b3c7ad818d57b4 100644 (file)
@@ -51,6 +51,12 @@ static int snd_pcm_plug_close(snd_pcm_t *pcm)
        return result;
 }
 
+static int snd_pcm_plug_card(snd_pcm_t *pcm)
+{
+       snd_pcm_plug_t *plug = pcm->private;
+       return snd_pcm_card(plug->slave);
+}
+
 static int snd_pcm_plug_nonblock(snd_pcm_t *pcm, int nonblock)
 {
        snd_pcm_plug_t *plug = pcm->private;
@@ -645,6 +651,7 @@ static void snd_pcm_plug_dump(snd_pcm_t *pcm, FILE *fp)
 
 snd_pcm_ops_t snd_pcm_plug_ops = {
        close: snd_pcm_plug_close,
+       card: snd_pcm_plug_card,
        info: snd_pcm_plug_info,
        hw_refine: snd_pcm_plug_hw_refine,
        hw_params: snd_pcm_plug_hw_params,
index 342cbe27a16543c69f3760e4258e7ed4e1aee1da..f7b5369656499e2bec208e3882bfd1f97fa83a93 100644 (file)
@@ -34,6 +34,12 @@ int snd_pcm_plugin_close(snd_pcm_t *pcm)
        return 0;
 }
 
+int snd_pcm_plugin_card(snd_pcm_t *pcm)
+{
+       snd_pcm_plugin_t *plugin = pcm->private;
+       return snd_pcm_card(plugin->slave);
+}
+
 int snd_pcm_plugin_nonblock(snd_pcm_t *pcm, int nonblock)
 {
        snd_pcm_plugin_t *plugin = pcm->private;
index cf58714ecaa71ffac526d47d1aaca20f4844b982..24e68915366f5cb77038becd389a0a38a02c00a6 100644 (file)
@@ -31,6 +31,7 @@ typedef struct {
 } snd_pcm_plugin_t;    
 
 int snd_pcm_plugin_close(snd_pcm_t *pcm);
+int snd_pcm_plugin_card(snd_pcm_t *pcm);
 int snd_pcm_plugin_nonblock(snd_pcm_t *pcm, int nonblock);
 int snd_pcm_plugin_async(snd_pcm_t *pcm, int sig, pid_t pid);
 int snd_pcm_plugin_info(snd_pcm_t *pcm, snd_pcm_info_t * info);
index ffb9349cc98b3306541d0ccff95f8fccee000ea3..2e091416681768a3d1fc3b8df410ed3174067168 100644 (file)
@@ -511,6 +511,7 @@ static void snd_pcm_rate_dump(snd_pcm_t *pcm, FILE *fp)
 
 snd_pcm_ops_t snd_pcm_rate_ops = {
        close: snd_pcm_rate_close,
+       card: snd_pcm_plugin_card,
        info: snd_pcm_plugin_info,
        hw_refine: snd_pcm_rate_hw_refine,
        hw_params: snd_pcm_rate_hw_params,
index 3aec22a2e5505e3f56130d426693aacd8e61f8bb..ad33740c13ff36cedc4152bf9bdfe781ad5f460a 100644 (file)
@@ -660,6 +660,7 @@ static void snd_pcm_route_dump(snd_pcm_t *pcm, FILE *fp)
 
 snd_pcm_ops_t snd_pcm_route_ops = {
        close: snd_pcm_route_close,
+       card: snd_pcm_plugin_card,
        info: snd_pcm_plugin_info,
        hw_refine: snd_pcm_route_hw_refine,
        hw_params: snd_pcm_route_hw_params,
index 071f59f09c532b49b90af4c9992542b12831df01..ccb3870a96bb12c169c7e787615dd8c0dce8e2f3 100644 (file)
@@ -417,6 +417,11 @@ static void _snd_pcm_share_update(snd_pcm_t *pcm)
        }
 }
 
+static int snd_pcm_share_card(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
+{
+       return -ENOENT; /* not available */
+}
+
 static int snd_pcm_share_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
 {
        return 0;
@@ -1082,6 +1087,7 @@ static void snd_pcm_share_dump(snd_pcm_t *pcm, FILE *fp)
 
 snd_pcm_ops_t snd_pcm_share_ops = {
        close: snd_pcm_share_close,
+       card: snd_pcm_share_card,
        info: snd_pcm_share_info,
        hw_refine: snd_pcm_share_hw_refine,
        hw_params: snd_pcm_share_hw_params,
index c9e730579d8de9669bb2eb34ac4b6bc7ce7e890a..4655a2528248c9a647e23097e90ae726264b4dec 100644 (file)
@@ -116,6 +116,18 @@ static int snd_pcm_shm_action_fd(snd_pcm_t *pcm, int *fd)
        return ctrl->result;
 }
 
+static int snd_pcm_shm_card(snd_pcm_t *pcm)
+{
+       snd_pcm_shm_t *shm = pcm->private;
+       volatile snd_pcm_shm_ctrl_t *ctrl = shm->ctrl;
+       int err;
+       ctrl->cmd = SND_PCM_IOCTL_CARD;
+       err = snd_pcm_shm_action(pcm);
+       if (err < 0)
+               return err;
+       return ctrl->u.card;
+}
+
 static int snd_pcm_shm_nonblock(snd_pcm_t *pcm ATTRIBUTE_UNUSED, int nonblock ATTRIBUTE_UNUSED)
 {
        return 0;
@@ -442,6 +454,7 @@ static void snd_pcm_shm_dump(snd_pcm_t *pcm, FILE *fp)
 
 snd_pcm_ops_t snd_pcm_shm_ops = {
        close: snd_pcm_shm_close,
+       card: snd_pcm_shm_card,
        info: snd_pcm_shm_info,
        hw_refine: snd_pcm_shm_hw_refine,
        hw_params: snd_pcm_shm_hw_params,
index 536098a796d0274c70efedd5ae9d90ee5149bc5b..50d89bdadf7f422a111a82c9f39c709c0c838685 100644 (file)
@@ -41,6 +41,12 @@ int snd_rawmidi_close(snd_rawmidi_t *rmidi)
        return 0;
 }
 
+int snd_rawmidi_card(snd_rawmidi_t *rmidi)
+{
+       assert(rmidi);
+       return rmidi->ops->card(rmidi);
+}
+
 int snd_rawmidi_poll_descriptor(snd_rawmidi_t *rmidi)
 {
        assert(rmidi);
index 8a2590c6d5413c209db7fefe504a65fe78136cb7..a5b5ec95312d76a9befbdaf2363c47df47724e30 100644 (file)
@@ -50,6 +50,12 @@ static int snd_rawmidi_hw_close(snd_rawmidi_t *rmidi)
        return 0;
 }
 
+static int snd_rawmidi_hw_card(snd_rawmidi_t *rmidi)
+{
+       snd_rawmidi_hw_t *hw = rmidi->private;
+       return hw->card;
+}
+
 static int snd_rawmidi_hw_nonblock(snd_rawmidi_t *rmidi, int nonblock)
 {
        snd_rawmidi_hw_t *hw = rmidi->private;
@@ -142,6 +148,7 @@ static ssize_t snd_rawmidi_hw_read(snd_rawmidi_t *rmidi, void *buffer, size_t si
 
 snd_rawmidi_ops_t snd_rawmidi_hw_ops = {
        close: snd_rawmidi_hw_close,
+       card: snd_rawmidi_hw_card,
        nonblock: snd_rawmidi_hw_nonblock,
        info: snd_rawmidi_hw_info,
        params: snd_rawmidi_hw_params,
index 81b303de77c48d8437fcbe72c6bed523ffa301a4..16f7c0370861fd933a32e8fb4ddd56ce8c892d6f 100644 (file)
@@ -36,6 +36,7 @@
 
 typedef struct {
        int (*close)(snd_rawmidi_t *rawmidi);
+       int (*card)(snd_rawmidi_t *rawmidi);
        int (*nonblock)(snd_rawmidi_t *rawmidi, int nonblock);
        int (*info)(snd_rawmidi_t *rawmidi, snd_rawmidi_info_t *info);
        int (*params)(snd_rawmidi_t *rawmidi, snd_rawmidi_params_t *params);