reflexion 0.3.8.1 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.doc/ext/reflex/control_change_event.cpp +101 -0
- data/.doc/ext/reflex/midi.cpp +16 -0
- data/.doc/ext/reflex/midi_event.cpp +124 -0
- data/.doc/ext/reflex/native.cpp +4 -0
- data/.doc/ext/reflex/view.cpp +41 -1
- data/.doc/ext/reflex/window.cpp +16 -0
- data/ChangeLog.md +7 -0
- data/VERSION +1 -1
- data/ext/reflex/control_change_event.cpp +108 -0
- data/ext/reflex/midi.cpp +21 -3
- data/ext/reflex/midi_event.cpp +132 -0
- data/ext/reflex/native.cpp +4 -0
- data/ext/reflex/view.cpp +49 -4
- data/ext/reflex/window.cpp +22 -4
- data/include/reflex/event.h +89 -0
- data/include/reflex/midi.h +4 -0
- data/include/reflex/ruby/event.h +22 -0
- data/include/reflex/ruby/midi.h +19 -0
- data/include/reflex/ruby/view.h +45 -0
- data/include/reflex/ruby/window.h +18 -0
- data/include/reflex/view.h +6 -2
- data/include/reflex/window.h +4 -0
- data/lib/reflex/midi_event.rb +68 -0
- data/lib/reflex/view.rb +2 -2
- data/lib/reflex.rb +1 -0
- data/reflex.gemspec +3 -3
- data/src/event.cpp +189 -0
- data/src/event.h +11 -0
- data/src/midi.cpp +67 -59
- data/src/view.cpp +38 -0
- data/src/view.h +9 -5
- data/src/window.cpp +81 -6
- data/src/window.h +1 -1
- data/test/test_capture_event.rb +8 -8
- data/test/test_midi_event.rb +93 -0
- data/test/test_view.rb +13 -13
- metadata +23 -14
data/ext/reflex/native.cpp
CHANGED
@@ -21,7 +21,9 @@ void Init_reflex_focus_event ();
|
|
21
21
|
void Init_reflex_key_event ();
|
22
22
|
void Init_reflex_pointer_event ();
|
23
23
|
void Init_reflex_wheel_event ();
|
24
|
+
void Init_reflex_midi_event ();
|
24
25
|
void Init_reflex_note_event ();
|
26
|
+
void Init_reflex_control_change_event ();
|
25
27
|
void Init_reflex_capture_event ();
|
26
28
|
void Init_reflex_timer_event ();
|
27
29
|
void Init_reflex_contact_event ();
|
@@ -75,7 +77,9 @@ extern "C" void
|
|
75
77
|
Init_reflex_key_event();
|
76
78
|
Init_reflex_pointer_event();
|
77
79
|
Init_reflex_wheel_event();
|
80
|
+
Init_reflex_midi_event();
|
78
81
|
Init_reflex_note_event();
|
82
|
+
Init_reflex_control_change_event();
|
79
83
|
Init_reflex_capture_event();
|
80
84
|
Init_reflex_timer_event();
|
81
85
|
Init_reflex_contact_event();
|
data/ext/reflex/view.cpp
CHANGED
@@ -1155,6 +1155,46 @@ RUCY_DEF1(on_wheel, event)
|
|
1155
1155
|
}
|
1156
1156
|
RUCY_END
|
1157
1157
|
|
1158
|
+
static
|
1159
|
+
RUCY_DEF1(on_midi, event)
|
1160
|
+
{
|
1161
|
+
CHECK;
|
1162
|
+
CALL(on_midi(to<Reflex::MIDIEvent*>(event)));
|
1163
|
+
}
|
1164
|
+
RUCY_END
|
1165
|
+
|
1166
|
+
static
|
1167
|
+
RUCY_DEF1(on_note, event)
|
1168
|
+
{
|
1169
|
+
CHECK;
|
1170
|
+
CALL(on_note(to<Reflex::NoteEvent*>(event)));
|
1171
|
+
}
|
1172
|
+
RUCY_END
|
1173
|
+
|
1174
|
+
static
|
1175
|
+
RUCY_DEF1(on_note_on, event)
|
1176
|
+
{
|
1177
|
+
CHECK;
|
1178
|
+
CALL(on_note_on(to<Reflex::NoteEvent*>(event)));
|
1179
|
+
}
|
1180
|
+
RUCY_END
|
1181
|
+
|
1182
|
+
static
|
1183
|
+
RUCY_DEF1(on_note_off, event)
|
1184
|
+
{
|
1185
|
+
CHECK;
|
1186
|
+
CALL(on_note_off(to<Reflex::NoteEvent*>(event)));
|
1187
|
+
}
|
1188
|
+
RUCY_END
|
1189
|
+
|
1190
|
+
static
|
1191
|
+
RUCY_DEF1(on_control_change, event)
|
1192
|
+
{
|
1193
|
+
CHECK;
|
1194
|
+
CALL(on_control_change(to<Reflex::ControlChangeEvent*>(event)));
|
1195
|
+
}
|
1196
|
+
RUCY_END
|
1197
|
+
|
1158
1198
|
static
|
1159
1199
|
RUCY_DEF1(on_capture, event)
|
1160
1200
|
{
|
@@ -1335,9 +1375,14 @@ Init_reflex_view ()
|
|
1335
1375
|
cView.define_method("on_pointer_up", on_pointer_up);
|
1336
1376
|
cView.define_method("on_pointer_move", on_pointer_move);
|
1337
1377
|
cView.define_method("on_pointer_cancel", on_pointer_cancel);
|
1338
|
-
cView.define_method("on_wheel",
|
1339
|
-
cView.define_method("
|
1340
|
-
cView.define_method("
|
1378
|
+
cView.define_method("on_wheel", on_wheel);
|
1379
|
+
cView.define_method("on_midi", on_midi);
|
1380
|
+
cView.define_method("on_note", on_note);
|
1381
|
+
cView.define_method("on_note_on", on_note_on);
|
1382
|
+
cView.define_method("on_note_off", on_note_off);
|
1383
|
+
cView.define_method("on_control_change", on_control_change);
|
1384
|
+
cView.define_method("on_capture", on_capture);
|
1385
|
+
cView.define_method("on_timer", on_timer);
|
1341
1386
|
cView.define_method( "will_contact?", will_contact);
|
1342
1387
|
cView.define_private_method("call_contact!", on_contact);
|
1343
1388
|
cView.define_private_method("call_contact_begin!", on_contact_begin);
|
@@ -1346,7 +1391,7 @@ Init_reflex_view ()
|
|
1346
1391
|
cView.define_const("CAPTURE_NONE", Reflex::View::CAPTURE_NONE);
|
1347
1392
|
cView.define_const("CAPTURE_KEY", Reflex::View::CAPTURE_KEY);
|
1348
1393
|
cView.define_const("CAPTURE_POINTER", Reflex::View::CAPTURE_POINTER);
|
1349
|
-
cView.define_const("
|
1394
|
+
cView.define_const("CAPTURE_MIDI", Reflex::View::CAPTURE_MIDI);
|
1350
1395
|
cView.define_const("CAPTURE_ALL", Reflex::View::CAPTURE_ALL);
|
1351
1396
|
|
1352
1397
|
define_selector_methods<Reflex::View>(cView);
|
data/ext/reflex/window.cpp
CHANGED
@@ -413,6 +413,14 @@ RUCY_DEF1(on_wheel, event)
|
|
413
413
|
}
|
414
414
|
RUCY_END
|
415
415
|
|
416
|
+
static
|
417
|
+
RUCY_DEF1(on_midi, event)
|
418
|
+
{
|
419
|
+
CHECK;
|
420
|
+
CALL(on_midi(to<Reflex::MIDIEvent*>(event)));
|
421
|
+
}
|
422
|
+
RUCY_END
|
423
|
+
|
416
424
|
static
|
417
425
|
RUCY_DEF1(on_note, event)
|
418
426
|
{
|
@@ -437,6 +445,14 @@ RUCY_DEF1(on_note_off, event)
|
|
437
445
|
}
|
438
446
|
RUCY_END
|
439
447
|
|
448
|
+
static
|
449
|
+
RUCY_DEF1(on_control_change, event)
|
450
|
+
{
|
451
|
+
CHECK;
|
452
|
+
CALL(on_control_change(to<Reflex::ControlChangeEvent*>(event)));
|
453
|
+
}
|
454
|
+
RUCY_END
|
455
|
+
|
440
456
|
|
441
457
|
static Class cWindow;
|
442
458
|
|
@@ -489,10 +505,12 @@ Init_reflex_window ()
|
|
489
505
|
cWindow.define_method("on_pointer_up", on_pointer_up);
|
490
506
|
cWindow.define_method("on_pointer_move", on_pointer_move);
|
491
507
|
cWindow.define_method("on_pointer_cancel", on_pointer_cancel);
|
492
|
-
cWindow.define_method("on_wheel",
|
493
|
-
cWindow.define_method("
|
494
|
-
cWindow.define_method("
|
495
|
-
cWindow.define_method("
|
508
|
+
cWindow.define_method("on_wheel", on_wheel);
|
509
|
+
cWindow.define_method("on_midi", on_midi);
|
510
|
+
cWindow.define_method("on_note", on_note);
|
511
|
+
cWindow.define_method("on_note_on", on_note_on);
|
512
|
+
cWindow.define_method("on_note_off", on_note_off);
|
513
|
+
cWindow.define_method("on_control_change", on_control_change);
|
496
514
|
|
497
515
|
cWindow.define_const("ORIENTATION_PORTRAIT", Reflex::Window::FLAG_PORTRAIT);
|
498
516
|
cWindow.define_const("ORIENTATION_LANDSCAPE", Reflex::Window::FLAG_LANDSCAPE);
|
data/include/reflex/event.h
CHANGED
@@ -20,6 +20,7 @@ namespace Reflex
|
|
20
20
|
class Device;
|
21
21
|
class Shape;
|
22
22
|
class View;
|
23
|
+
class MIDI;
|
23
24
|
|
24
25
|
|
25
26
|
class Event
|
@@ -354,6 +355,63 @@ namespace Reflex
|
|
354
355
|
};// WheelEvent
|
355
356
|
|
356
357
|
|
358
|
+
class MIDIEvent : public Event
|
359
|
+
{
|
360
|
+
|
361
|
+
public:
|
362
|
+
|
363
|
+
enum Action
|
364
|
+
{
|
365
|
+
|
366
|
+
ACTION_NONE = 0,
|
367
|
+
|
368
|
+
NOTE_ON,
|
369
|
+
|
370
|
+
NOTE_OFF,
|
371
|
+
|
372
|
+
CONTROL_CHANGE,
|
373
|
+
|
374
|
+
PROGRAM_CHANGE,
|
375
|
+
|
376
|
+
CHANNEL_PRESSURE,
|
377
|
+
|
378
|
+
KEY_PRESSURE,
|
379
|
+
|
380
|
+
PITCH_BEND_CHANGE,
|
381
|
+
|
382
|
+
SYSTEM
|
383
|
+
|
384
|
+
};// Action
|
385
|
+
|
386
|
+
MIDIEvent ();
|
387
|
+
|
388
|
+
MIDIEvent (MIDI* midi, const uchar* bytes, double time);
|
389
|
+
|
390
|
+
MIDIEvent dup () const;
|
391
|
+
|
392
|
+
MIDI* midi () const;
|
393
|
+
|
394
|
+
Action action () const;
|
395
|
+
|
396
|
+
int channel () const;
|
397
|
+
|
398
|
+
uchar data1 () const;
|
399
|
+
|
400
|
+
uchar data2 () const;
|
401
|
+
|
402
|
+
bool is_captured () const;
|
403
|
+
|
404
|
+
struct Data;
|
405
|
+
|
406
|
+
Xot::PSharedImpl<Data> self;
|
407
|
+
|
408
|
+
private:
|
409
|
+
|
410
|
+
MIDIEvent (const MIDIEvent* src);
|
411
|
+
|
412
|
+
};// MIDIEvent
|
413
|
+
|
414
|
+
|
357
415
|
class NoteEvent : public Event
|
358
416
|
{
|
359
417
|
|
@@ -391,6 +449,37 @@ namespace Reflex
|
|
391
449
|
};// NoteEvent
|
392
450
|
|
393
451
|
|
452
|
+
class ControlChangeEvent : public Event
|
453
|
+
{
|
454
|
+
|
455
|
+
public:
|
456
|
+
|
457
|
+
ControlChangeEvent ();
|
458
|
+
|
459
|
+
ControlChangeEvent (
|
460
|
+
int channel, int controller, float value, double time);
|
461
|
+
|
462
|
+
ControlChangeEvent dup () const;
|
463
|
+
|
464
|
+
int channel () const;
|
465
|
+
|
466
|
+
int controller () const;
|
467
|
+
|
468
|
+
float value () const;
|
469
|
+
|
470
|
+
bool is_captured () const;
|
471
|
+
|
472
|
+
struct Data;
|
473
|
+
|
474
|
+
Xot::PSharedImpl<Data> self;
|
475
|
+
|
476
|
+
private:
|
477
|
+
|
478
|
+
ControlChangeEvent (const ControlChangeEvent* src);
|
479
|
+
|
480
|
+
};// ControlChangeEvent
|
481
|
+
|
482
|
+
|
394
483
|
class CaptureEvent : public Event
|
395
484
|
{
|
396
485
|
|
data/include/reflex/midi.h
CHANGED
@@ -30,12 +30,16 @@ namespace Reflex
|
|
30
30
|
|
31
31
|
virtual const char* name () const;
|
32
32
|
|
33
|
+
virtual void on_midi (MIDIEvent* e);
|
34
|
+
|
33
35
|
virtual void on_note (NoteEvent* e);
|
34
36
|
|
35
37
|
virtual void on_note_on (NoteEvent* e);
|
36
38
|
|
37
39
|
virtual void on_note_off (NoteEvent* e);
|
38
40
|
|
41
|
+
virtual void on_control_change (ControlChangeEvent* e);
|
42
|
+
|
39
43
|
virtual operator bool () const;
|
40
44
|
|
41
45
|
static const List& all ();
|
data/include/reflex/ruby/event.h
CHANGED
@@ -29,8 +29,12 @@ RUCY_DECLARE_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::PointerEvent)
|
|
29
29
|
|
30
30
|
RUCY_DECLARE_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::WheelEvent)
|
31
31
|
|
32
|
+
RUCY_DECLARE_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::MIDIEvent)
|
33
|
+
|
32
34
|
RUCY_DECLARE_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::NoteEvent)
|
33
35
|
|
36
|
+
RUCY_DECLARE_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::ControlChangeEvent)
|
37
|
+
|
34
38
|
RUCY_DECLARE_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::CaptureEvent)
|
35
39
|
|
36
40
|
RUCY_DECLARE_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::TimerEvent)
|
@@ -74,9 +78,15 @@ namespace Reflex
|
|
74
78
|
REFLEX_EXPORT Rucy::Class wheel_event_class ();
|
75
79
|
// class Reflex::WheelEvent
|
76
80
|
|
81
|
+
REFLEX_EXPORT Rucy::Class midi_event_class ();
|
82
|
+
// class Reflex::MIDIEvent
|
83
|
+
|
77
84
|
REFLEX_EXPORT Rucy::Class note_event_class ();
|
78
85
|
// class Reflex::NoteEvent
|
79
86
|
|
87
|
+
REFLEX_EXPORT Rucy::Class control_change_event_class ();
|
88
|
+
// class Reflex::ControlChangeEvent
|
89
|
+
|
80
90
|
REFLEX_EXPORT Rucy::Class capture_event_class ();
|
81
91
|
// class Reflex::CaptureEvent
|
82
92
|
|
@@ -157,12 +167,24 @@ namespace Rucy
|
|
157
167
|
return Reflex::wheel_event_class();
|
158
168
|
}
|
159
169
|
|
170
|
+
template <> inline Class
|
171
|
+
get_ruby_class<Reflex::MIDIEvent> ()
|
172
|
+
{
|
173
|
+
return Reflex::midi_event_class();
|
174
|
+
}
|
175
|
+
|
160
176
|
template <> inline Class
|
161
177
|
get_ruby_class<Reflex::NoteEvent> ()
|
162
178
|
{
|
163
179
|
return Reflex::note_event_class();
|
164
180
|
}
|
165
181
|
|
182
|
+
template <> inline Class
|
183
|
+
get_ruby_class<Reflex::ControlChangeEvent> ()
|
184
|
+
{
|
185
|
+
return Reflex::control_change_event_class();
|
186
|
+
}
|
187
|
+
|
166
188
|
template <> inline Class
|
167
189
|
get_ruby_class<Reflex::CaptureEvent> ()
|
168
190
|
{
|
data/include/reflex/ruby/midi.h
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
#include <rucy/class.h>
|
8
8
|
#include <rucy/extension.h>
|
9
9
|
#include <reflex/midi.h>
|
10
|
+
#include <reflex/ruby/event.h>
|
10
11
|
|
11
12
|
|
12
13
|
RUCY_DECLARE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::MIDI)
|
@@ -28,6 +29,15 @@ namespace Reflex
|
|
28
29
|
|
29
30
|
public:
|
30
31
|
|
32
|
+
virtual void on_midi (MIDIEvent* e)
|
33
|
+
{
|
34
|
+
RUCY_SYM(on_midi);
|
35
|
+
if (this->is_overridable())
|
36
|
+
this->value.call(on_midi, Rucy::value(e));
|
37
|
+
else
|
38
|
+
Super::on_midi(e);
|
39
|
+
}
|
40
|
+
|
31
41
|
virtual void on_note (NoteEvent* e)
|
32
42
|
{
|
33
43
|
RUCY_SYM(on_note);
|
@@ -55,6 +65,15 @@ namespace Reflex
|
|
55
65
|
Super::on_note_off(e);
|
56
66
|
}
|
57
67
|
|
68
|
+
virtual void on_control_change (ControlChangeEvent* e)
|
69
|
+
{
|
70
|
+
RUCY_SYM(on_control_change);
|
71
|
+
if (this->is_overridable())
|
72
|
+
this->value.call(on_control_change, Rucy::value(e));
|
73
|
+
else
|
74
|
+
Super::on_control_change(e);
|
75
|
+
}
|
76
|
+
|
58
77
|
};// RubyMIDI
|
59
78
|
|
60
79
|
|
data/include/reflex/ruby/view.h
CHANGED
@@ -230,6 +230,51 @@ namespace Reflex
|
|
230
230
|
Super::on_wheel(e);
|
231
231
|
}
|
232
232
|
|
233
|
+
virtual void on_midi (MIDIEvent* e)
|
234
|
+
{
|
235
|
+
RUCY_SYM(on_midi);
|
236
|
+
if (this->is_overridable())
|
237
|
+
this->value.call(on_midi, Rucy::value(e));
|
238
|
+
else
|
239
|
+
Super::on_midi(e);
|
240
|
+
}
|
241
|
+
|
242
|
+
virtual void on_note (NoteEvent* e)
|
243
|
+
{
|
244
|
+
RUCY_SYM(on_note);
|
245
|
+
if (this->is_overridable())
|
246
|
+
this->value.call(on_note, Rucy::value(e));
|
247
|
+
else
|
248
|
+
Super::on_note(e);
|
249
|
+
}
|
250
|
+
|
251
|
+
virtual void on_note_on (NoteEvent* e)
|
252
|
+
{
|
253
|
+
RUCY_SYM(on_note_on);
|
254
|
+
if (this->is_overridable())
|
255
|
+
this->value.call(on_note_on, Rucy::value(e));
|
256
|
+
else
|
257
|
+
Super::on_note_on(e);
|
258
|
+
}
|
259
|
+
|
260
|
+
virtual void on_note_off (NoteEvent* e)
|
261
|
+
{
|
262
|
+
RUCY_SYM(on_note_off);
|
263
|
+
if (this->is_overridable())
|
264
|
+
this->value.call(on_note_off, Rucy::value(e));
|
265
|
+
else
|
266
|
+
Super::on_note_off(e);
|
267
|
+
}
|
268
|
+
|
269
|
+
virtual void on_control_change (ControlChangeEvent* e)
|
270
|
+
{
|
271
|
+
RUCY_SYM(on_control_change);
|
272
|
+
if (this->is_overridable())
|
273
|
+
this->value.call(on_control_change, Rucy::value(e));
|
274
|
+
else
|
275
|
+
Super::on_control_change(e);
|
276
|
+
}
|
277
|
+
|
233
278
|
virtual void on_capture (CaptureEvent* e)
|
234
279
|
{
|
235
280
|
RUCY_SYM(on_capture);
|
@@ -191,6 +191,15 @@ namespace Reflex
|
|
191
191
|
Super::on_wheel(e);
|
192
192
|
}
|
193
193
|
|
194
|
+
virtual void on_midi (MIDIEvent* e)
|
195
|
+
{
|
196
|
+
RUCY_SYM(on_midi);
|
197
|
+
if (this->is_overridable())
|
198
|
+
this->value.call(on_midi, Rucy::value(e));
|
199
|
+
else
|
200
|
+
Super::on_midi(e);
|
201
|
+
}
|
202
|
+
|
194
203
|
virtual void on_note (NoteEvent* e)
|
195
204
|
{
|
196
205
|
RUCY_SYM(on_note);
|
@@ -218,6 +227,15 @@ namespace Reflex
|
|
218
227
|
Super::on_note_off(e);
|
219
228
|
}
|
220
229
|
|
230
|
+
virtual void on_control_change (ControlChangeEvent* e)
|
231
|
+
{
|
232
|
+
RUCY_SYM(on_control_change);
|
233
|
+
if (this->is_overridable())
|
234
|
+
this->value.call(on_control_change, Rucy::value(e));
|
235
|
+
else
|
236
|
+
Super::on_control_change(e);
|
237
|
+
}
|
238
|
+
|
221
239
|
};// RubyWindow
|
222
240
|
|
223
241
|
|
data/include/reflex/view.h
CHANGED
@@ -82,9 +82,9 @@ namespace Reflex
|
|
82
82
|
|
83
83
|
CAPTURE_POINTER = Xot::bit(1),
|
84
84
|
|
85
|
-
|
85
|
+
CAPTURE_MIDI = Xot::bit(2),
|
86
86
|
|
87
|
-
CAPTURE_ALL = CAPTURE_KEY | CAPTURE_POINTER |
|
87
|
+
CAPTURE_ALL = CAPTURE_KEY | CAPTURE_POINTER | CAPTURE_MIDI,
|
88
88
|
|
89
89
|
};// Capture
|
90
90
|
|
@@ -382,12 +382,16 @@ namespace Reflex
|
|
382
382
|
|
383
383
|
virtual void on_wheel (WheelEvent* e);
|
384
384
|
|
385
|
+
virtual void on_midi (MIDIEvent* e);
|
386
|
+
|
385
387
|
virtual void on_note (NoteEvent* e);
|
386
388
|
|
387
389
|
virtual void on_note_on (NoteEvent* e);
|
388
390
|
|
389
391
|
virtual void on_note_off (NoteEvent* e);
|
390
392
|
|
393
|
+
virtual void on_control_change (ControlChangeEvent* e);
|
394
|
+
|
391
395
|
virtual void on_capture (CaptureEvent* e);
|
392
396
|
|
393
397
|
virtual void on_timer (TimerEvent* e);
|
data/include/reflex/window.h
CHANGED
@@ -135,12 +135,16 @@ namespace Reflex
|
|
135
135
|
|
136
136
|
virtual void on_wheel (WheelEvent* e);
|
137
137
|
|
138
|
+
virtual void on_midi (MIDIEvent* e);
|
139
|
+
|
138
140
|
virtual void on_note (NoteEvent* e);
|
139
141
|
|
140
142
|
virtual void on_note_on (NoteEvent* e);
|
141
143
|
|
142
144
|
virtual void on_note_off (NoteEvent* e);
|
143
145
|
|
146
|
+
virtual void on_control_change (ControlChangeEvent* e);
|
147
|
+
|
144
148
|
operator bool () const;
|
145
149
|
|
146
150
|
bool operator ! () const;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'xot/const_symbol_accessor'
|
2
|
+
require 'reflex/ext'
|
3
|
+
|
4
|
+
|
5
|
+
module Reflex
|
6
|
+
|
7
|
+
|
8
|
+
class MIDIEvent < Event
|
9
|
+
|
10
|
+
alias get_action action
|
11
|
+
|
12
|
+
const_symbol_reader :action, **{
|
13
|
+
none: ACTION_NONE,
|
14
|
+
note_on: NOTE_ON,
|
15
|
+
note_off: NOTE_OFF,
|
16
|
+
control_change: CONTROL_CHANGE,
|
17
|
+
program_change: PROGRAM_CHANGE,
|
18
|
+
channel_pressure: CHANNEL_PRESSURE,
|
19
|
+
key_pressure: KEY_PRESSURE,
|
20
|
+
pitch_bend_change: PITCH_BEND_CHANGE,
|
21
|
+
system: SYSTEM
|
22
|
+
}
|
23
|
+
|
24
|
+
def note_on?()
|
25
|
+
get_action == NOTE_ON
|
26
|
+
end
|
27
|
+
|
28
|
+
def note_off?()
|
29
|
+
get_action == NOTE_OFF
|
30
|
+
end
|
31
|
+
|
32
|
+
def control_change?()
|
33
|
+
get_action == CONTROL_CHANGE
|
34
|
+
end
|
35
|
+
|
36
|
+
alias cc? control_change?
|
37
|
+
|
38
|
+
def program_change?()
|
39
|
+
get_action == PROGRAM_CHANGE
|
40
|
+
end
|
41
|
+
|
42
|
+
alias pc? program_change?
|
43
|
+
|
44
|
+
def channel_pressure?()
|
45
|
+
get_action == CHANNEL_PRESSURE
|
46
|
+
end
|
47
|
+
|
48
|
+
def key_pressure?()
|
49
|
+
get_action == KEY_PRESSURE
|
50
|
+
end
|
51
|
+
|
52
|
+
def pitch_bend_change?()
|
53
|
+
get_action == PITCH_BEND_CHANGE
|
54
|
+
end
|
55
|
+
|
56
|
+
def system?()
|
57
|
+
get_action == SYSTEM
|
58
|
+
end
|
59
|
+
|
60
|
+
def inspect()
|
61
|
+
"#<Reflex::MIDIEvent action:%s channel:%d data:[%d, %d] captured?:%s>" %
|
62
|
+
[action, channel, data1, data2, captured?]
|
63
|
+
end
|
64
|
+
|
65
|
+
end# NoteEvent
|
66
|
+
|
67
|
+
|
68
|
+
end# Reflex
|
data/lib/reflex/view.rb
CHANGED
@@ -49,7 +49,7 @@ module Reflex
|
|
49
49
|
bit_flag_accessor :capture do
|
50
50
|
flag :key, CAPTURE_KEY
|
51
51
|
flag :pointer, CAPTURE_POINTER
|
52
|
-
flag :
|
52
|
+
flag :midi, CAPTURE_MIDI
|
53
53
|
flag :all, CAPTURE_ALL
|
54
54
|
end
|
55
55
|
|
@@ -104,7 +104,7 @@ module Reflex
|
|
104
104
|
if args.empty?
|
105
105
|
not cap.empty?
|
106
106
|
elsif args.include?(:all)
|
107
|
-
cap == [:key, :pointer, :
|
107
|
+
cap == [:key, :pointer, :midi]
|
108
108
|
else
|
109
109
|
args.all? {|type| cap.include? type}
|
110
110
|
end
|
data/lib/reflex.rb
CHANGED
data/reflex.gemspec
CHANGED
@@ -25,9 +25,9 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.platform = Gem::Platform::RUBY
|
26
26
|
s.required_ruby_version = '>= 3.0.0'
|
27
27
|
|
28
|
-
s.add_dependency 'xot', '~> 0.3.
|
29
|
-
s.add_dependency 'rucy', '~> 0.3.
|
30
|
-
s.add_dependency 'rays', '~> 0.3.
|
28
|
+
s.add_dependency 'xot', '~> 0.3.8', '>= 0.3.8'
|
29
|
+
s.add_dependency 'rucy', '~> 0.3.8', '>= 0.3.8'
|
30
|
+
s.add_dependency 'rays', '~> 0.3.8', '>= 0.3.8'
|
31
31
|
|
32
32
|
s.files = `git ls-files`.split $/
|
33
33
|
s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
|