"alsaseq_user_client_get_type";
"alsaseq_user_client_new";
"alsaseq_user_client_open";
+ "alsaseq_user_client_get_protocol_version";
"alsaseq_user_client_set_info";
"alsaseq_user_client_get_info";
"alsaseq_user_client_create_port";
struct _ALSASeqUserClientPrivate {
int fd;
int client_id;
+ guint16 proto_ver_triplet[3];
};
G_DEFINE_TYPE_WITH_PRIVATE(ALSASeqUserClient, alsaseq_user_client, G_TYPE_OBJECT)
{
ALSASeqUserClientPrivate *priv;
char *devnode;
+ int proto_ver;
g_return_if_fail(ALSASEQ_IS_USER_CLIENT(self));
priv = alsaseq_user_client_get_instance_private(self);
close(priv->fd);
priv->fd = -1;
}
+
+ // Remember the version of protocol currently used.
+ if (ioctl(priv->fd, SNDRV_SEQ_IOCTL_PVERSION, &proto_ver) < 0) {
+ generate_error(error, errno);
+ close(priv->fd);
+ priv->fd = -1;
+ return;
+ }
+
+ priv->proto_ver_triplet[0] = SNDRV_PROTOCOL_MAJOR(proto_ver);
+ priv->proto_ver_triplet[1] = SNDRV_PROTOCOL_MINOR(proto_ver);
+ priv->proto_ver_triplet[2] = SNDRV_PROTOCOL_MICRO(proto_ver);
+}
+
+/**
+ * alsaseq_user_client_get_protocol_version:
+ * @self: A #ALSASeqUserClient.
+ * @proto_ver_triplet: (array fixed-size=3)(out)(transfer none): The version of
+ * protocol currently used.
+ * @error: A #GError.
+ *
+ * Get the version of sequencer protocol currently used. The version is
+ * represented as the array with three elements; major, minor, and micro version
+ * in the order. The length of major version is 16 bit, the length of minor
+ * and micro version is 8 bit each.
+ */
+void alsaseq_user_client_get_protocol_version(ALSASeqUserClient *self,
+ const guint16 *proto_ver_triplet[3],
+ GError **error)
+{
+ ALSASeqUserClientPrivate *priv;
+
+ g_return_if_fail(ALSASEQ_IS_USER_CLIENT(self));
+ priv = alsaseq_user_client_get_instance_private(self);
+
+ if (priv->fd < 0) {
+ generate_error(error, ENXIO);
+ return;
+ }
+
+ *proto_ver_triplet = (const guint16 *)priv->proto_ver_triplet;
}
/**
void alsaseq_user_client_open(ALSASeqUserClient *self, gint open_flag,
GError **error);
+void alsaseq_user_client_get_protocol_version(ALSASeqUserClient *self,
+ const guint16 *proto_ver_triplet[3],
+ GError **error);
+
void alsaseq_user_client_set_info(ALSASeqUserClient *self,
ALSASeqClientInfo *client_info,
GError **error);