aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/seq.h6
-rw-r--r--src/seq/seq.c72
-rw-r--r--src/seq/seq_hw.c2
3 files changed, 79 insertions, 1 deletions
diff --git a/include/seq.h b/include/seq.h
index 9ebbaf24..a5dda5c3 100644
--- a/include/seq.h
+++ b/include/seq.h
@@ -259,6 +259,9 @@ int snd_seq_port_info_get_synth_voices(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_read_use(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_write_use(const snd_seq_port_info_t *info);
int snd_seq_port_info_get_port_specified(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_timestamping(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_timestamp_real(const snd_seq_port_info_t *info);
+int snd_seq_port_info_get_timestamp_queue(const snd_seq_port_info_t *info);
void snd_seq_port_info_set_client(snd_seq_port_info_t *info, int client);
void snd_seq_port_info_set_port(snd_seq_port_info_t *info, int port);
@@ -270,6 +273,9 @@ void snd_seq_port_info_set_midi_channels(snd_seq_port_info_t *info, int channels
void snd_seq_port_info_set_midi_voices(snd_seq_port_info_t *info, int voices);
void snd_seq_port_info_set_synth_voices(snd_seq_port_info_t *info, int voices);
void snd_seq_port_info_set_port_specified(snd_seq_port_info_t *info, int val);
+void snd_seq_port_info_set_timestamping(snd_seq_port_info_t *info, int enable);
+void snd_seq_port_info_set_timestamp_real(snd_seq_port_info_t *info, int realtime);
+void snd_seq_port_info_set_timestamp_queue(snd_seq_port_info_t *info, int queue);
int snd_seq_create_port(snd_seq_t *handle, snd_seq_port_info_t *info);
int snd_seq_delete_port(snd_seq_t *handle, int port);
diff --git a/src/seq/seq.c b/src/seq/seq.c
index 9c5f24dc..40a43ba4 100644
--- a/src/seq/seq.c
+++ b/src/seq/seq.c
@@ -1061,6 +1061,39 @@ int snd_seq_port_info_get_port_specified(const snd_seq_port_info_t *info)
}
/**
+ * \brief Get the time-stamping mode of the given port in a port_info container
+ * \param info port_info container
+ * \return 1 if the port updates timestamps of incoming events
+ */
+int snd_seq_port_info_get_port_timestamping(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return (info->flags & SNDRV_SEQ_PORT_FLG_TIMESTAMP) ? 1 : 0;
+}
+
+/**
+ * \brief Get whether the time-stamping of the given port is real-time mode
+ * \param info port_info container
+ * \return 1 if the time-stamping is in the real-time mode
+ */
+int snd_seq_port_info_get_port_timestamp_real(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return (info->flags & SNDRV_SEQ_PORT_FLG_TIME_REAL) ? 1 : 0;
+}
+
+/**
+ * \brief Get the queue id to update timestamps
+ * \param info port_info container
+ * \return the queue id to get the timestamps
+ */
+int snd_seq_port_info_get_port_timestamp_queue(const snd_seq_port_info_t *info)
+{
+ assert(info);
+ return info->time_queue;
+}
+
+/**
* \brief Set the client id of a port_info container
* \param info port_info container
* \param client client id
@@ -1173,6 +1206,45 @@ void snd_seq_port_info_set_port_specified(snd_seq_port_info_t *info, int val)
info->flags &= ~SNDRV_SEQ_PORT_FLG_GIVEN_PORT;
}
+/**
+ * \brief Set the time-stamping mode of the given port
+ * \param info port_info container
+ * \param enable non-zero if updating the timestamps of incoming events
+ */
+void snd_seq_port_info_set_port_timestamping(snd_seq_port_info_t *info, int enable)
+{
+ assert(info);
+ if (enable)
+ info->flags |= SNDRV_SEQ_PORT_FLG_TIMESTAMP;
+ else
+ info->flags &= ~SNDRV_SEQ_PORT_FLG_TIMESTAMP;
+}
+
+/**
+ * \brief Set whether the timestime is updated in the real-time mode
+ * \param info port_info container
+ * \param enable non-zero if updating the timestamps in real-time mode
+ */
+void snd_seq_port_info_set_port_timestamp_real(snd_seq_port_info_t *info, int enable)
+{
+ assert(info);
+ if (enable)
+ info->flags |= SNDRV_SEQ_PORT_FLG_TIME_REAL;
+ else
+ info->flags &= ~SNDRV_SEQ_PORT_FLG_TIME_REAL;
+}
+
+/**
+ * \brief Set the queue id for timestamping
+ * \param info port_info container
+ * \param queue the queue id to get timestamps
+ */
+void snd_seq_port_info_set_port_timestamp_queue(snd_seq_port_info_t *info, int queue)
+{
+ assert(info);
+ info->time_queue = queue;
+}
+
/**
* \brief create a sequencer port on the current client
diff --git a/src/seq/seq_hw.c b/src/seq/seq_hw.c
index 8f121422..6e9b70cb 100644
--- a/src/seq/seq_hw.c
+++ b/src/seq/seq_hw.c
@@ -31,7 +31,7 @@ const char *_snd_module_seq_hw = "";
#define SNDRV_FILE_SEQ "/dev/snd/seq"
#define SNDRV_FILE_ALOADSEQ "/dev/aloadSEQ"
-#define SNDRV_SEQ_VERSION_MAX SNDRV_PROTOCOL_VERSION(1, 0, 0)
+#define SNDRV_SEQ_VERSION_MAX SNDRV_PROTOCOL_VERSION(1, 0, 1)
typedef struct {
int fd;