asequencer.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Main header file for the ALSA sequencer
  4. * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
  5. * (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz>
  6. */
  7. #ifndef __SOUND_ASEQUENCER_H
  8. #define __SOUND_ASEQUENCER_H
  9. #include <linux/ioctl.h>
  10. #include <sound/asound.h>
  11. #include <uapi/sound/asequencer.h>
  12. /* helper macro */
  13. #define snd_seq_event_bounce_ext_data(ev) ((void*)((char *)(ev)->data.ext.ptr + sizeof(struct snd_seq_event_bounce)))
  14. /*
  15. * type check macros
  16. */
  17. /* result events: 0-4 */
  18. #define snd_seq_ev_is_result_type(ev) ((ev)->type < 5)
  19. /* channel specific events: 5-19 */
  20. #define snd_seq_ev_is_channel_type(ev) ((ev)->type >= 5 && (ev)->type < 20)
  21. /* note events: 5-9 */
  22. #define snd_seq_ev_is_note_type(ev) ((ev)->type >= 5 && (ev)->type < 10)
  23. /* control events: 10-19 */
  24. #define snd_seq_ev_is_control_type(ev) ((ev)->type >= 10 && (ev)->type < 20)
  25. /* queue control events: 30-39 */
  26. #define snd_seq_ev_is_queue_type(ev) ((ev)->type >= 30 && (ev)->type < 40)
  27. /* system status messages */
  28. #define snd_seq_ev_is_message_type(ev) ((ev)->type >= 60 && (ev)->type < 69)
  29. /* sample messages */
  30. #define snd_seq_ev_is_sample_type(ev) ((ev)->type >= 70 && (ev)->type < 79)
  31. /* user-defined messages */
  32. #define snd_seq_ev_is_user_type(ev) ((ev)->type >= 90 && (ev)->type < 99)
  33. /* fixed length events: 0-99 */
  34. #define snd_seq_ev_is_fixed_type(ev) ((ev)->type < 100)
  35. /* variable length events: 130-139 */
  36. #define snd_seq_ev_is_variable_type(ev) ((ev)->type >= 130 && (ev)->type < 140)
  37. /* reserved for kernel */
  38. #define snd_seq_ev_is_reserved(ev) ((ev)->type >= 150)
  39. /* direct dispatched events */
  40. #define snd_seq_ev_is_direct(ev) ((ev)->queue == SNDRV_SEQ_QUEUE_DIRECT)
  41. /*
  42. * macros to check event flags
  43. */
  44. /* prior events */
  45. #define snd_seq_ev_is_prior(ev) (((ev)->flags & SNDRV_SEQ_PRIORITY_MASK) == SNDRV_SEQ_PRIORITY_HIGH)
  46. /* event length type */
  47. #define snd_seq_ev_length_type(ev) ((ev)->flags & SNDRV_SEQ_EVENT_LENGTH_MASK)
  48. #define snd_seq_ev_is_fixed(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_FIXED)
  49. #define snd_seq_ev_is_variable(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
  50. #define snd_seq_ev_is_varusr(ev) (snd_seq_ev_length_type(ev) == SNDRV_SEQ_EVENT_LENGTH_VARUSR)
  51. /* time-stamp type */
  52. #define snd_seq_ev_timestamp_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_STAMP_MASK)
  53. #define snd_seq_ev_is_tick(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_TICK)
  54. #define snd_seq_ev_is_real(ev) (snd_seq_ev_timestamp_type(ev) == SNDRV_SEQ_TIME_STAMP_REAL)
  55. /* time-mode type */
  56. #define snd_seq_ev_timemode_type(ev) ((ev)->flags & SNDRV_SEQ_TIME_MODE_MASK)
  57. #define snd_seq_ev_is_abstime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_ABS)
  58. #define snd_seq_ev_is_reltime(ev) (snd_seq_ev_timemode_type(ev) == SNDRV_SEQ_TIME_MODE_REL)
  59. /* check whether the given event is a UMP event */
  60. #define snd_seq_ev_is_ump(ev) \
  61. (IS_ENABLED(CONFIG_SND_SEQ_UMP) && ((ev)->flags & SNDRV_SEQ_EVENT_UMP))
  62. /* queue sync port */
  63. #define snd_seq_queue_sync_port(q) ((q) + 16)
  64. #endif /* __SOUND_ASEQUENCER_H */