Mercurial > hg > svcore
comparison plugin/api/alsa/seq.h @ 1527:710e6250a401 zoom
Merge from default branch
| author | Chris Cannam | 
|---|---|
| date | Mon, 17 Sep 2018 13:51:14 +0100 | 
| parents | 48e9f538e6e9 | 
| children | 
   comparison
  equal
  deleted
  inserted
  replaced
| 1324:d4a28d1479a8 | 1527:710e6250a401 | 
|---|---|
| 46 * \{ | 46 * \{ | 
| 47 */ | 47 */ | 
| 48 | 48 | 
| 49 /* event type macros */ | 49 /* event type macros */ | 
| 50 enum { | 50 enum { | 
| 51 SND_SEQ_EVFLG_RESULT, | 51 SND_SEQ_EVFLG_RESULT, | 
| 52 SND_SEQ_EVFLG_NOTE, | 52 SND_SEQ_EVFLG_NOTE, | 
| 53 SND_SEQ_EVFLG_CONTROL, | 53 SND_SEQ_EVFLG_CONTROL, | 
| 54 SND_SEQ_EVFLG_QUEUE, | 54 SND_SEQ_EVFLG_QUEUE, | 
| 55 SND_SEQ_EVFLG_SYSTEM, | 55 SND_SEQ_EVFLG_SYSTEM, | 
| 56 SND_SEQ_EVFLG_MESSAGE, | 56 SND_SEQ_EVFLG_MESSAGE, | 
| 57 SND_SEQ_EVFLG_CONNECTION, | 57 SND_SEQ_EVFLG_CONNECTION, | 
| 58 SND_SEQ_EVFLG_SAMPLE, | 58 SND_SEQ_EVFLG_SAMPLE, | 
| 59 SND_SEQ_EVFLG_USERS, | 59 SND_SEQ_EVFLG_USERS, | 
| 60 SND_SEQ_EVFLG_INSTR, | 60 SND_SEQ_EVFLG_INSTR, | 
| 61 SND_SEQ_EVFLG_QUOTE, | 61 SND_SEQ_EVFLG_QUOTE, | 
| 62 SND_SEQ_EVFLG_NONE, | 62 SND_SEQ_EVFLG_NONE, | 
| 63 SND_SEQ_EVFLG_RAW, | 63 SND_SEQ_EVFLG_RAW, | 
| 64 SND_SEQ_EVFLG_FIXED, | 64 SND_SEQ_EVFLG_FIXED, | 
| 65 SND_SEQ_EVFLG_VARIABLE, | 65 SND_SEQ_EVFLG_VARIABLE, | 
| 66 SND_SEQ_EVFLG_VARUSR | 66 SND_SEQ_EVFLG_VARUSR | 
| 67 }; | 67 }; | 
| 68 | 68 | 
| 69 enum { | 69 enum { | 
| 70 SND_SEQ_EVFLG_NOTE_ONEARG, | 70 SND_SEQ_EVFLG_NOTE_ONEARG, | 
| 71 SND_SEQ_EVFLG_NOTE_TWOARG | 71 SND_SEQ_EVFLG_NOTE_TWOARG | 
| 72 }; | 72 }; | 
| 73 | 73 | 
| 74 enum { | 74 enum { | 
| 75 SND_SEQ_EVFLG_QUEUE_NOARG, | 75 SND_SEQ_EVFLG_QUEUE_NOARG, | 
| 76 SND_SEQ_EVFLG_QUEUE_TICK, | 76 SND_SEQ_EVFLG_QUEUE_TICK, | 
| 77 SND_SEQ_EVFLG_QUEUE_TIME, | 77 SND_SEQ_EVFLG_QUEUE_TIME, | 
| 78 SND_SEQ_EVFLG_QUEUE_VALUE | 78 SND_SEQ_EVFLG_QUEUE_VALUE | 
| 79 }; | 79 }; | 
| 80 | 80 | 
| 81 /** | 81 /** | 
| 82 * Exported event type table | 82 * Exported event type table | 
| 83 * | 83 * | 
| 84 * This table is referred by snd_seq_ev_is_xxx. | 84 * This table is referred by snd_seq_ev_is_xxx. | 
| 85 */ | 85 */ | 
| 86 extern const unsigned int snd_seq_event_types[]; | 86 extern const unsigned int snd_seq_event_types[]; | 
| 87 | 87 | 
| 88 #define _SND_SEQ_TYPE(x) (1<<(x)) /**< master type - 24bit */ | 88 #define _SND_SEQ_TYPE(x) (1<<(x)) /**< master type - 24bit */ | 
| 89 #define _SND_SEQ_TYPE_OPT(x) ((x)<<24) /**< optional type - 8bit */ | 89 #define _SND_SEQ_TYPE_OPT(x) ((x)<<24) /**< optional type - 8bit */ | 
| 90 | 90 | 
| 91 /** check the event type */ | 91 /** check the event type */ | 
| 92 #define snd_seq_type_check(ev,x) (snd_seq_event_types[(ev)->type] & _SND_SEQ_TYPE(x)) | 92 #define snd_seq_type_check(ev,x) (snd_seq_event_types[(ev)->type] & _SND_SEQ_TYPE(x)) | 
| 93 | 93 | 
| 94 /** event type check: result events */ | 94 /** event type check: result events */ | 
| 95 #define snd_seq_ev_is_result_type(ev) \ | 95 #define snd_seq_ev_is_result_type(ev) \ | 
| 96 snd_seq_type_check(ev, SND_SEQ_EVFLG_RESULT) | 96 snd_seq_type_check(ev, SND_SEQ_EVFLG_RESULT) | 
| 97 /** event type check: note events */ | 97 /** event type check: note events */ | 
| 98 #define snd_seq_ev_is_note_type(ev) \ | 98 #define snd_seq_ev_is_note_type(ev) \ | 
| 99 snd_seq_type_check(ev, SND_SEQ_EVFLG_NOTE) | 99 snd_seq_type_check(ev, SND_SEQ_EVFLG_NOTE) | 
| 100 /** event type check: control events */ | 100 /** event type check: control events */ | 
| 101 #define snd_seq_ev_is_control_type(ev) \ | 101 #define snd_seq_ev_is_control_type(ev) \ | 
| 102 snd_seq_type_check(ev, SND_SEQ_EVFLG_CONTROL) | 102 snd_seq_type_check(ev, SND_SEQ_EVFLG_CONTROL) | 
| 103 /** event type check: channel specific events */ | 103 /** event type check: channel specific events */ | 
| 104 #define snd_seq_ev_is_channel_type(ev) \ | 104 #define snd_seq_ev_is_channel_type(ev) \ | 
| 105 (snd_seq_event_types[(ev)->type] & (_SND_SEQ_TYPE(SND_SEQ_EVFLG_NOTE) | _SND_SEQ_TYPE(SND_SEQ_EVFLG_CONTROL))) | 105 (snd_seq_event_types[(ev)->type] & (_SND_SEQ_TYPE(SND_SEQ_EVFLG_NOTE) | _SND_SEQ_TYPE(SND_SEQ_EVFLG_CONTROL))) | 
| 106 | 106 | 
| 107 /** event type check: queue control events */ | 107 /** event type check: queue control events */ | 
| 108 #define snd_seq_ev_is_queue_type(ev) \ | 108 #define snd_seq_ev_is_queue_type(ev) \ | 
| 109 snd_seq_type_check(ev, SND_SEQ_EVFLG_QUEUE) | 109 snd_seq_type_check(ev, SND_SEQ_EVFLG_QUEUE) | 
| 110 /** event type check: system status messages */ | 110 /** event type check: system status messages */ | 
| 111 #define snd_seq_ev_is_message_type(ev) \ | 111 #define snd_seq_ev_is_message_type(ev) \ | 
| 112 snd_seq_type_check(ev, SND_SEQ_EVFLG_MESSAGE) | 112 snd_seq_type_check(ev, SND_SEQ_EVFLG_MESSAGE) | 
| 113 /** event type check: system status messages */ | 113 /** event type check: system status messages */ | 
| 114 #define snd_seq_ev_is_subscribe_type(ev) \ | 114 #define snd_seq_ev_is_subscribe_type(ev) \ | 
| 115 snd_seq_type_check(ev, SND_SEQ_EVFLG_CONNECTION) | 115 snd_seq_type_check(ev, SND_SEQ_EVFLG_CONNECTION) | 
| 116 /** event type check: sample messages */ | 116 /** event type check: sample messages */ | 
| 117 #define snd_seq_ev_is_sample_type(ev) \ | 117 #define snd_seq_ev_is_sample_type(ev) \ | 
| 118 snd_seq_type_check(ev, SND_SEQ_EVFLG_SAMPLE) | 118 snd_seq_type_check(ev, SND_SEQ_EVFLG_SAMPLE) | 
| 119 /** event type check: user-defined messages */ | 119 /** event type check: user-defined messages */ | 
| 120 #define snd_seq_ev_is_user_type(ev) \ | 120 #define snd_seq_ev_is_user_type(ev) \ | 
| 121 snd_seq_type_check(ev, SND_SEQ_EVFLG_USERS) | 121 snd_seq_type_check(ev, SND_SEQ_EVFLG_USERS) | 
| 122 /** event type check: instrument layer events */ | 122 /** event type check: instrument layer events */ | 
| 123 #define snd_seq_ev_is_instr_type(ev) \ | 123 #define snd_seq_ev_is_instr_type(ev) \ | 
| 124 snd_seq_type_check(ev, SND_SEQ_EVFLG_INSTR) | 124 snd_seq_type_check(ev, SND_SEQ_EVFLG_INSTR) | 
| 125 /** event type check: fixed length events */ | 125 /** event type check: fixed length events */ | 
| 126 #define snd_seq_ev_is_fixed_type(ev) \ | 126 #define snd_seq_ev_is_fixed_type(ev) \ | 
| 127 snd_seq_type_check(ev, SND_SEQ_EVFLG_FIXED) | 127 snd_seq_type_check(ev, SND_SEQ_EVFLG_FIXED) | 
| 128 /** event type check: variable length events */ | 128 /** event type check: variable length events */ | 
| 129 #define snd_seq_ev_is_variable_type(ev) \ | 129 #define snd_seq_ev_is_variable_type(ev) \ | 
| 130 snd_seq_type_check(ev, SND_SEQ_EVFLG_VARIABLE) | 130 snd_seq_type_check(ev, SND_SEQ_EVFLG_VARIABLE) | 
| 131 /** event type check: user pointer events */ | 131 /** event type check: user pointer events */ | 
| 132 #define snd_seq_ev_is_varusr_type(ev) \ | 132 #define snd_seq_ev_is_varusr_type(ev) \ | 
| 133 snd_seq_type_check(ev, SND_SEQ_EVFLG_VARUSR) | 133 snd_seq_type_check(ev, SND_SEQ_EVFLG_VARUSR) | 
| 134 /** event type check: reserved for kernel */ | 134 /** event type check: reserved for kernel */ | 
| 135 #define snd_seq_ev_is_reserved(ev) \ | 135 #define snd_seq_ev_is_reserved(ev) \ | 
| 136 (! snd_seq_event_types[(ev)->type]) | 136 (! snd_seq_event_types[(ev)->type]) | 
| 137 | 137 | 
| 138 /** | 138 /** | 
| 139 * macros to check event flags | 139 * macros to check event flags | 
| 140 */ | 140 */ | 
| 141 /** prior events */ | 141 /** prior events */ | 
| 142 #define snd_seq_ev_is_prior(ev) \ | 142 #define snd_seq_ev_is_prior(ev) \ | 
| 143 (((ev)->flags & SND_SEQ_PRIORITY_MASK) == SND_SEQ_PRIORITY_HIGH) | 143 (((ev)->flags & SND_SEQ_PRIORITY_MASK) == SND_SEQ_PRIORITY_HIGH) | 
| 144 | 144 | 
| 145 /** get the data length type */ | 145 /** get the data length type */ | 
| 146 #define snd_seq_ev_length_type(ev) \ | 146 #define snd_seq_ev_length_type(ev) \ | 
| 147 ((ev)->flags & SND_SEQ_EVENT_LENGTH_MASK) | 147 ((ev)->flags & SND_SEQ_EVENT_LENGTH_MASK) | 
| 148 /** fixed length events */ | 148 /** fixed length events */ | 
| 149 #define snd_seq_ev_is_fixed(ev) \ | 149 #define snd_seq_ev_is_fixed(ev) \ | 
| 150 (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_FIXED) | 150 (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_FIXED) | 
| 151 /** variable length events */ | 151 /** variable length events */ | 
| 152 #define snd_seq_ev_is_variable(ev) \ | 152 #define snd_seq_ev_is_variable(ev) \ | 
| 153 (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARIABLE) | 153 (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARIABLE) | 
| 154 /** variable length on user-space */ | 154 /** variable length on user-space */ | 
| 155 #define snd_seq_ev_is_varusr(ev) \ | 155 #define snd_seq_ev_is_varusr(ev) \ | 
| 156 (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARUSR) | 156 (snd_seq_ev_length_type(ev) == SND_SEQ_EVENT_LENGTH_VARUSR) | 
| 157 | 157 | 
| 158 /** time-stamp type */ | 158 /** time-stamp type */ | 
| 159 #define snd_seq_ev_timestamp_type(ev) \ | 159 #define snd_seq_ev_timestamp_type(ev) \ | 
| 160 ((ev)->flags & SND_SEQ_TIME_STAMP_MASK) | 160 ((ev)->flags & SND_SEQ_TIME_STAMP_MASK) | 
| 161 /** event is in tick time */ | 161 /** event is in tick time */ | 
| 162 #define snd_seq_ev_is_tick(ev) \ | 162 #define snd_seq_ev_is_tick(ev) \ | 
| 163 (snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_TICK) | 163 (snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_TICK) | 
| 164 /** event is in real-time */ | 164 /** event is in real-time */ | 
| 165 #define snd_seq_ev_is_real(ev) \ | 165 #define snd_seq_ev_is_real(ev) \ | 
| 166 (snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_REAL) | 166 (snd_seq_ev_timestamp_type(ev) == SND_SEQ_TIME_STAMP_REAL) | 
| 167 | 167 | 
| 168 /** time-mode type */ | 168 /** time-mode type */ | 
| 169 #define snd_seq_ev_timemode_type(ev) \ | 169 #define snd_seq_ev_timemode_type(ev) \ | 
| 170 ((ev)->flags & SND_SEQ_TIME_MODE_MASK) | 170 ((ev)->flags & SND_SEQ_TIME_MODE_MASK) | 
| 171 /** scheduled in absolute time */ | 171 /** scheduled in absolute time */ | 
| 172 #define snd_seq_ev_is_abstime(ev) \ | 172 #define snd_seq_ev_is_abstime(ev) \ | 
| 173 (snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_ABS) | 173 (snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_ABS) | 
| 174 /** scheduled in relative time */ | 174 /** scheduled in relative time */ | 
| 175 #define snd_seq_ev_is_reltime(ev) \ | 175 #define snd_seq_ev_is_reltime(ev) \ | 
| 176 (snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_REL) | 176 (snd_seq_ev_timemode_type(ev) == SND_SEQ_TIME_MODE_REL) | 
| 177 | 177 | 
| 178 /** direct dispatched events */ | 178 /** direct dispatched events */ | 
| 179 #define snd_seq_ev_is_direct(ev) \ | 179 #define snd_seq_ev_is_direct(ev) \ | 
| 180 ((ev)->queue == SND_SEQ_QUEUE_DIRECT) | 180 ((ev)->queue == SND_SEQ_QUEUE_DIRECT) | 
| 181 | 181 | 
| 182 /** \} */ | 182 /** \} */ | 
| 183 | 183 | 
| 184 #ifdef __cplusplus | 184 #ifdef __cplusplus | 
| 185 } | 185 } | 
