Mercurial > hg > pub > prymula > com
comparison DPF-Prymula-audioplugins/dpf/distrho/src/travesty/events.h @ 3:84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
author | prymula <prymula76@outlook.com> |
---|---|
date | Mon, 16 Oct 2023 21:53:34 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:cf2cb71d31dd | 3:84e66ea83026 |
---|---|
1 /* | |
2 * travesty, pure C VST3-compatible interface | |
3 * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com> | |
4 * | |
5 * Permission to use, copy, modify, and/or distribute this software for any purpose with | |
6 * or without fee is hereby granted, provided that the above copyright notice and this | |
7 * permission notice appear in all copies. | |
8 * | |
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD | |
10 * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN | |
11 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL | |
12 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER | |
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
15 */ | |
16 | |
17 #pragma once | |
18 | |
19 #include "base.h" | |
20 | |
21 #include "align_push.h" | |
22 | |
23 /** | |
24 * note events | |
25 */ | |
26 | |
27 struct v3_event_note_on { | |
28 int16_t channel; | |
29 int16_t pitch; // MIDI note number | |
30 float tuning; | |
31 float velocity; | |
32 int32_t length; | |
33 int32_t note_id; | |
34 }; | |
35 | |
36 struct v3_event_note_off { | |
37 int16_t channel; | |
38 int16_t pitch; // MIDI note number | |
39 float velocity; | |
40 int32_t note_id; | |
41 float tuning; | |
42 }; | |
43 | |
44 struct v3_event_data { | |
45 uint32_t size; | |
46 uint32_t type; | |
47 const uint8_t* bytes; | |
48 }; | |
49 | |
50 struct v3_event_poly_pressure { | |
51 int16_t channel; | |
52 int16_t pitch; | |
53 float pressure; | |
54 int32_t note_id; | |
55 }; | |
56 | |
57 struct v3_event_chord { | |
58 int16_t root; | |
59 int16_t bass_note; | |
60 int16_t mask; | |
61 uint16_t text_len; | |
62 const int16_t* text; | |
63 }; | |
64 | |
65 struct v3_event_scale { | |
66 int16_t root; | |
67 int16_t mask; | |
68 uint16_t text_len; | |
69 const int16_t* text; | |
70 }; | |
71 | |
72 struct v3_event_legacy_midi_cc_out { | |
73 uint8_t cc_number; | |
74 int8_t channel; | |
75 int8_t value; | |
76 int8_t value2; | |
77 }; | |
78 | |
79 struct v3_event_note_expression_value { | |
80 uint32_t type_id; | |
81 int32_t note_id; | |
82 double value; | |
83 }; | |
84 | |
85 struct v3_event_note_expression_text { | |
86 int32_t note_id; | |
87 uint32_t text_len; | |
88 const int16_t* text; | |
89 }; | |
90 | |
91 /** | |
92 * event | |
93 */ | |
94 | |
95 enum v3_event_flags { | |
96 V3_EVENT_IS_LIVE = 1 << 0 | |
97 }; | |
98 | |
99 enum v3_event_type { | |
100 V3_EVENT_NOTE_ON = 0, | |
101 V3_EVENT_NOTE_OFF = 1, | |
102 V3_EVENT_DATA = 2, | |
103 V3_EVENT_POLY_PRESSURE = 3, | |
104 V3_EVENT_NOTE_EXP_VALUE = 4, | |
105 V3_EVENT_NOTE_EXP_TEXT = 5, | |
106 V3_EVENT_CHORD = 6, | |
107 V3_EVENT_SCALE = 7, | |
108 V3_EVENT_LEGACY_MIDI_CC_OUT = 65535 | |
109 }; | |
110 | |
111 struct v3_event { | |
112 int32_t bus_index; | |
113 int32_t sample_offset; | |
114 double ppq_position; | |
115 uint16_t flags; | |
116 uint16_t type; | |
117 union { | |
118 struct v3_event_note_on note_on; | |
119 struct v3_event_note_off note_off; | |
120 struct v3_event_data data; | |
121 struct v3_event_poly_pressure poly_pressure; | |
122 struct v3_event_chord chord; | |
123 struct v3_event_scale scale; | |
124 struct v3_event_legacy_midi_cc_out midi_cc_out; | |
125 struct v3_event_note_expression_value note_exp_value; | |
126 struct v3_event_note_expression_text note_exp_text; | |
127 }; | |
128 }; | |
129 | |
130 /** | |
131 * event list | |
132 */ | |
133 | |
134 struct v3_event_list { | |
135 #ifndef __cplusplus | |
136 struct v3_funknown; | |
137 #endif | |
138 uint32_t (V3_API* get_event_count)(void* self); | |
139 v3_result (V3_API* get_event)(void* self, int32_t idx, struct v3_event* event); | |
140 v3_result (V3_API* add_event)(void* self, struct v3_event* event); | |
141 }; | |
142 | |
143 static constexpr const v3_tuid v3_event_list_iid = | |
144 V3_ID(0x3A2C4214, 0x346349FE, 0xB2C4F397, 0xB9695A44); | |
145 | |
146 #ifdef __cplusplus | |
147 | |
148 /** | |
149 * C++ variants | |
150 */ | |
151 | |
152 struct v3_event_list_cpp : v3_funknown { | |
153 v3_event_list list; | |
154 }; | |
155 | |
156 #endif | |
157 | |
158 #include "align_pop.h" |