#include <queue-info.h>
#include <queue-status.h>
#include <queue-tempo.h>
-#include <queue-timer-data-alsa.h>
-#include <queue-timer.h>
#include <queue-timer-alsa.h>
#include <user-client.h>
"alsaseq_queue_tempo_get_skew";
"alsaseq_queue_tempo_set_skew";
- "alsaseq_queue_timer_get_type";
- "alsaseq_queue_timer_new";
- "alsaseq_queue_timer_get_alsa_data";
- "alsaseq_queue_timer_set_alsa_data";
-
- "alsaseq_queue_timer_data_alsa_get_type";
- "alsaseq_queue_timer_data_alsa_get_device_id";
- "alsaseq_queue_timer_data_alsa_set_device_id";
- "alsaseq_queue_timer_data_alsa_get_resolution";
- "alsaseq_queue_timer_data_alsa_set_resolution";
-
"alsaseq_remove_filter_get_type";
"alsaseq_remove_filter_new_with_dest_addr";
"alsaseq_remove_filter_new_with_note_channel";
'queue-info.c',
'queue-status.c',
'queue-tempo.c',
- 'queue-timer.c',
- 'queue-timer-data-alsa.c',
'remove-filter.c',
'event-cntr.c',
'queue-timer-common.c',
'queue-info.h',
'queue-status.h',
'queue-tempo.h',
- 'queue-timer.h',
- 'queue-timer-data-alsa.h',
'remove-filter.h',
'event-cntr.h',
'queue-timer-common.h',
+++ /dev/null
-// SPDX-License-Identifier: LGPL-3.0-or-later
-#include "privates.h"
-
-/**
- * ALSASeqQueueTimerDataAlsa:
- * A boxed object to represent data of queue timer in the case of ALSATimer.
- *
- * A [struct@QueueTimerDataAlsa] is a boxed object to represent data of queue timer in the case of
- * ALSATimer. The instance of object is one of data properties in queue timer.
- */
-ALSASeqQueueTimerDataAlsa *seq_queue_timer_data_alsa_copy(const ALSASeqQueueTimerDataAlsa *self)
-{
-#ifdef g_memdup2
- return g_memdup2(self, sizeof(*self));
-#else
- // GLib v2.68 deprecated g_memdup() with concern about overflow by narrow conversion from size_t to
- // unsigned int however it's safe in the local case.
- gpointer ptr = g_malloc(sizeof(*self));
- memcpy(ptr, self, sizeof(*self));
- return ptr;
-#endif
-}
-
-G_DEFINE_BOXED_TYPE(ALSASeqQueueTimerDataAlsa, alsaseq_queue_timer_data_alsa, seq_queue_timer_data_alsa_copy, g_free)
-
-/**
- * alsaseq_queue_timer_data_alsa_get_device_id:
- * @self: A [struct@QueueTimerDataAlsa].
- * @device_id: (out)(transfer none): A [struct@ALSATimer.DeviceId].
- *
- * Refer to the device identifier of timer which drives the queue.
- */
-void alsaseq_queue_timer_data_alsa_get_device_id(const ALSASeqQueueTimerDataAlsa *self,
- const ALSATimerDeviceId **device_id)
-{
- *device_id = (ALSATimerDeviceId *)&self->device_id;
-}
-
-/**
- * alsaseq_queue_timer_data_alsa_set_device_id:
- * @self: A [struct@QueueTimerDataAlsa].
- * @device_id: A [struct@ALSATimer.DeviceId].
- *
- * Copy the device identifier of timer which drives the queue.
- */
-void alsaseq_queue_timer_data_alsa_set_device_id(ALSASeqQueueTimerDataAlsa *self,
- const ALSATimerDeviceId *device_id)
-{
- self->device_id = *(struct snd_timer_id *)device_id;
-}
-
-/**
- * alsaseq_queue_timer_data_alsa_get_resolution:
- * @self: A [struct@QueueTimerDataAlsa].
- * @resolution: (out): The resolution of timer.
- *
- * Get the resolution of timer which drives the queue.
- */
-void alsaseq_queue_timer_data_alsa_get_resolution(const ALSASeqQueueTimerDataAlsa *self,
- guint *resolution)
-{
- *resolution = self->resolution;
-}
-
-/**
- * alsaseq_queue_timer_data_alsa_set_resolution:
- * @self: A [struct@QueueTimerDataAlsa].
- * @resolution: The resolution of timer.
- *
- * Set the resolution of timer which drives the queue.
- */
-void alsaseq_queue_timer_data_alsa_set_resolution(ALSASeqQueueTimerDataAlsa *self,
- guint resolution)
-{
- self->resolution = resolution;
-}
+++ /dev/null
-// SPDX-License-Identifier: LGPL-3.0-or-later
-#ifndef __ALSA_GOBJECT_ALSASEQ_QUEUE_TIMER_DATA_ALSA_H__
-#define __ALSA_GOBJECT_ALSASEQ_QUEUE_TIMER_DATA_ALSA_H__
-
-#include <alsaseq.h>
-#include <alsatimer.h>
-
-G_BEGIN_DECLS
-
-#define ALSASEQ_TYPE_QUEUE_TIMER_DATA_ALSA (alsaseq_queue_time_data_alsa_get_type())
-
-// This structure should be the same layout as 'struct snd_seq_queue_timer.u.alsa'
-typedef struct {
- /*< private >*/
- ALSATimerDeviceId device_id;
- unsigned int resolution;
-} ALSASeqQueueTimerDataAlsa;
-
-GType alsaseq_queue_timer_data_alsa_get_type() G_GNUC_CONST;
-
-void alsaseq_queue_timer_data_alsa_get_device_id(const ALSASeqQueueTimerDataAlsa *self,
- const ALSATimerDeviceId **device_id);
-void alsaseq_queue_timer_data_alsa_set_device_id(ALSASeqQueueTimerDataAlsa *self,
- const ALSATimerDeviceId *device_id);
-
-void alsaseq_queue_timer_data_alsa_get_resolution(const ALSASeqQueueTimerDataAlsa *self,
- guint *resolution);
-void alsaseq_queue_timer_data_alsa_set_resolution(ALSASeqQueueTimerDataAlsa *self,
- guint resolution);
-G_END_DECLS
-
-#endif
+++ /dev/null
-// SPDX-License-Identifier: LGPL-3.0-or-later
-#include "privates.h"
-
-/**
- * ALSASeqQueueTimer:
- * A GObject-derived object to represent timer for queue.
- *
- * A [class@QueueTimer] is a GObject-derived object to represent the information of timer which
- * drives the queue.
- *
- * The object wraps `struct snd_seq_queue_timer` in UAPI of Linux sound subsystem.
- */
-typedef struct {
- struct snd_seq_queue_timer timer;
-} ALSASeqQueueTimerPrivate;
-G_DEFINE_TYPE_WITH_PRIVATE(ALSASeqQueueTimer, alsaseq_queue_timer, G_TYPE_OBJECT)
-
-enum seq_queue_timer_prop_type {
- SEQ_QUEUE_TIMER_PROP_QUEUE_ID = 1,
- SEQ_QUEUE_TIMER_PROP_TIMER_TYPE,
- SEQ_QUEUE_TIMER_PROP_COUNT,
-};
-static GParamSpec *seq_queue_timer_props[SEQ_QUEUE_TIMER_PROP_COUNT] = { NULL, };
-
-static void seq_queue_timer_get_property(GObject *obj, guint id, GValue *val,
- GParamSpec *spec)
-{
- ALSASeqQueueTimer *self = ALSASEQ_QUEUE_TIMER(obj);
- ALSASeqQueueTimerPrivate *priv =
- alsaseq_queue_timer_get_instance_private(self);
-
- switch (id) {
- case SEQ_QUEUE_TIMER_PROP_QUEUE_ID:
- g_value_set_int(val, priv->timer.queue);
- break;
- case SEQ_QUEUE_TIMER_PROP_TIMER_TYPE:
- g_value_set_enum(val, (ALSASeqQueueTimerType)priv->timer.type);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, id, spec);
- break;
- }
-}
-
-static void alsaseq_queue_timer_class_init(ALSASeqQueueTimerClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
-
- gobject_class->get_property = seq_queue_timer_get_property;
-
- seq_queue_timer_props[SEQ_QUEUE_TIMER_PROP_QUEUE_ID] =
- g_param_spec_uchar("queue-id", "queue-id",
- "The numerical ID of queue, except for one of "
- "ALSASeqSpecificClientId.",
- 0, G_MAXUINT8,
- 0,
- G_PARAM_READABLE);
-
- seq_queue_timer_props[SEQ_QUEUE_TIMER_PROP_TIMER_TYPE] =
- g_param_spec_enum("type", "type",
- "The type of timer for the queue, one of "
- "ALSASeqQueueTimerType.",
- ALSASEQ_TYPE_QUEUE_TIMER_TYPE,
- ALSASEQ_QUEUE_TIMER_TYPE_ALSA,
- G_PARAM_READABLE);
-
- g_object_class_install_properties(gobject_class,
- SEQ_QUEUE_TIMER_PROP_COUNT,
- seq_queue_timer_props);
-}
-
-static void alsaseq_queue_timer_init(ALSASeqQueueTimer *self)
-{
- return;
-}
-
-/**
- * alsaseq_queue_timer_new:
- *
- * Allocate and return an instance of [class@QueueTimer].
- *
- * Returns: An instance of [class@QueueTimer].
- */
-ALSASeqQueueTimer *alsaseq_queue_timer_new()
-{
- return g_object_new(ALSASEQ_TYPE_QUEUE_TIMER, NULL);
-}
-
-/**
- * alsaseq_queue_timer_get_alsa_data:
- * @self: A [class@QueueTimer].
- * @data: (out)(transfer none): A [struct@QueueTimerDataAlsa].
- *
- * Refer to the data of timer for queue in the case that the device in ALSATimer drives the timer.
- */
-void alsaseq_queue_timer_get_alsa_data(ALSASeqQueueTimer *self,
- const ALSASeqQueueTimerDataAlsa **data)
-{
- ALSASeqQueueTimerPrivate *priv;
-
- g_return_if_fail(ALSASEQ_IS_QUEUE_TIMER(self));
- priv = alsaseq_queue_timer_get_instance_private(self);
-
- g_return_if_fail(data != NULL);
-
- *data = (const ALSASeqQueueTimerDataAlsa *)&priv->timer.u.alsa;
-}
-
-/**
- * alsaseq_queue_timer_set_alsa_data:
- * @self: A [class@QueueTimer].
- * @data: A [struct@QueueTimerDataAlsa].
- *
- * Set the data of timer for queue in the case that the device in ALSATimer drives the timer.
- */
-void alsaseq_queue_timer_set_alsa_data(ALSASeqQueueTimer *self,
- const ALSASeqQueueTimerDataAlsa *data)
-{
- ALSASeqQueueTimerPrivate *priv;
-
- g_return_if_fail(ALSASEQ_IS_QUEUE_TIMER(self));
- priv = alsaseq_queue_timer_get_instance_private(self);
-
- g_return_if_fail(data != NULL);
-
- priv->timer.type = SNDRV_SEQ_TIMER_ALSA;
- priv->timer.u.alsa.id = data->device_id;
- priv->timer.u.alsa.resolution = data->resolution;
-}
-
-void seq_queue_timer_refer_private(ALSASeqQueueTimer *self,
- struct snd_seq_queue_timer **timer)
-{
- ALSASeqQueueTimerPrivate *priv =
- alsaseq_queue_timer_get_instance_private(self);
-
- *timer = &priv->timer;
-}
+++ /dev/null
-// SPDX-License-Identifier: LGPL-3.0-or-later
-#ifndef __ALSA_GOBJECT_ALSASEQ_QUEUE_TIMER_H__
-#define __ALSA_GOBJECT_ALSASEQ_QUEUE_TIMER_H__
-
-#include <alsaseq.h>
-
-G_BEGIN_DECLS
-
-#define ALSASEQ_TYPE_QUEUE_TIMER (alsaseq_queue_timer_get_type())
-
-G_DECLARE_DERIVABLE_TYPE(ALSASeqQueueTimer, alsaseq_queue_timer, ALSASEQ, QUEUE_TIMER, GObject);
-
-struct _ALSASeqQueueTimerClass {
- GObjectClass parent_class;
-};
-
-ALSASeqQueueTimer *alsaseq_queue_timer_new();
-
-void alsaseq_queue_timer_get_alsa_data(ALSASeqQueueTimer *self,
- const ALSASeqQueueTimerDataAlsa **data);
-void alsaseq_queue_timer_set_alsa_data(ALSASeqQueueTimer *self,
- const ALSASeqQueueTimerDataAlsa *data);
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-#!/usr/bin/env python3
-
-from sys import exit
-from errno import ENXIO
-
-from helper import test
-
-import gi
-gi.require_version('ALSASeq', '0.0')
-from gi.repository import ALSASeq
-
-target = ALSASeq.QueueTimer()
-props = (
- 'queue-id',
- 'type',
-)
-
-methods = (
- 'new',
- 'get_alsa_data',
- 'set_alsa_data',
-)
-
-signals = ()
-
-if not test(target, props, methods, signals):
- exit(ENXIO)
'alsaseq-queue-info',
'alsaseq-queue-status',
'alsaseq-queue-tempo',
- 'alsaseq-queue-timer',
'alsaseq-queue-timer-alsa',
'alsaseq-event-cntr',
],