if (ioctl(priv->fd, SNDRV_TIMER_IOCTL_SELECT, &sel) < 0)
generate_error(error, errno);
}
+
+/**
+ * alsatimer_user_instance_attach_as_slave:
+ * @self: A #ALSATimerUserInstance.
+ * @slave_class: The class identifier of master instance, one of
+ * #ALSATimerSlaveClass.
+ * @slave_id: The numerical identifier of master instance.
+ * @error: A #GError.
+ *
+ * Attach the instance to timer device as an slave to another instance indicated
+ * by a pair of slave_class and slave_id. If the slave_class is for application
+ * (=ALSATIMER_SLAVE_CLASS_APPLICATION), the slave_id is for the PID of
+ * application process which owns the instance of timer. If the slave_class is
+ * for ALSA sequencer (=ALSATIMER_SLAVE_CLASS_SEQUENCER), the slave_id is the
+ * numerical ID of queue bound for timer device.
+ */
+void alsatimer_user_instance_attach_as_slave(ALSATimerUserInstance *self,
+ ALSATimerSlaveClass slave_class,
+ int slave_id,
+ GError **error)
+{
+ ALSATimerUserInstancePrivate *priv;
+ struct snd_timer_select sel = {0};
+
+ g_return_if_fail(ALSATIMER_IS_USER_INSTANCE(self));
+ priv = alsatimer_user_instance_get_instance_private(self);
+
+ sel.id.dev_class = SNDRV_TIMER_CLASS_SLAVE;
+ sel.id.dev_sclass = slave_class;
+ sel.id.device = slave_id;
+ if (ioctl(priv->fd, SNDRV_TIMER_IOCTL_SELECT, &sel) < 0)
+ generate_error(error, errno);
+}