midi-communications-macos 0.6.0 → 0.7.0

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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.version +6 -0
  3. data/.yardoc/checksums +9 -0
  4. data/.yardoc/complete +0 -0
  5. data/.yardoc/object_types +0 -0
  6. data/.yardoc/objects/root.dat +0 -0
  7. data/.yardoc/proxy_types +0 -0
  8. data/.yardopts +6 -0
  9. data/LICENSE +159 -668
  10. data/README.md +6 -13
  11. data/doc/MIDICommunicationsMacOS/API/CF.html +124 -0
  12. data/doc/MIDICommunicationsMacOS/API/HostTime.html +124 -0
  13. data/doc/MIDICommunicationsMacOS/API/MIDIPacket.html +137 -0
  14. data/doc/MIDICommunicationsMacOS/API/MIDIPacketList.html +137 -0
  15. data/doc/MIDICommunicationsMacOS/API/MIDISysexSendRequest.html +137 -0
  16. data/doc/MIDICommunicationsMacOS/API.html +912 -0
  17. data/doc/MIDICommunicationsMacOS/Destination.html +1983 -0
  18. data/doc/MIDICommunicationsMacOS/Device.html +1102 -0
  19. data/doc/MIDICommunicationsMacOS/Endpoint.html +1665 -0
  20. data/doc/MIDICommunicationsMacOS/Entity.html +971 -0
  21. data/doc/MIDICommunicationsMacOS/Source.html +1784 -0
  22. data/doc/MIDICommunicationsMacOS/TypeConversion.html +393 -0
  23. data/doc/MIDICommunicationsMacOS.html +214 -0
  24. data/doc/_index.html +250 -0
  25. data/doc/class_list.html +54 -0
  26. data/doc/css/common.css +1 -0
  27. data/doc/css/full_list.css +58 -0
  28. data/doc/css/style.css +503 -0
  29. data/doc/file.README.html +275 -0
  30. data/doc/file_list.html +59 -0
  31. data/doc/frames.html +22 -0
  32. data/doc/index.html +275 -0
  33. data/doc/js/app.js +344 -0
  34. data/doc/js/full_list.js +242 -0
  35. data/doc/js/jquery.js +4 -0
  36. data/doc/method_list.html +542 -0
  37. data/doc/top-level-namespace.html +110 -0
  38. data/lib/midi-communications-macos/api.rb +7 -1
  39. data/lib/midi-communications-macos/destination.rb +86 -20
  40. data/lib/midi-communications-macos/device.rb +52 -18
  41. data/lib/midi-communications-macos/endpoint.rb +31 -5
  42. data/lib/midi-communications-macos/entity.rb +20 -6
  43. data/lib/midi-communications-macos/source.rb +79 -19
  44. data/lib/midi-communications-macos/type_conversion.rb +11 -4
  45. data/lib/midi-communications-macos/version.rb +4 -0
  46. data/lib/midi-communications-macos.rb +39 -1
  47. data/midi-communications-macos.gemspec +14 -10
  48. metadata +84 -4
@@ -0,0 +1,1102 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: MIDICommunicationsMacOS::Device
8
+
9
+ &mdash; MIDI Communications macOS API
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "MIDICommunicationsMacOS::Device";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (D)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../MIDICommunicationsMacOS.html" title="MIDICommunicationsMacOS (module)">MIDICommunicationsMacOS</a></span></span>
41
+ &raquo;
42
+ <span class="title">Device</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: MIDICommunicationsMacOS::Device
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">MIDICommunicationsMacOS::Device</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/midi-communications-macos/device.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+ <p>Represents a physical or virtual MIDI device.</p>
105
+
106
+ <p>A MIDI device may have multiple logically distinct sub-components. For example,
107
+ one device may encompass a MIDI synthesizer and a pair of MIDI ports, both
108
+ addressable via a USB port. Each such element of a device is called an <span class='object_link'><a href="Entity.html" title="MIDICommunicationsMacOS::Entity (class)">Entity</a></span>.</p>
109
+
110
+ <p>Devices contain <span class='object_link'><a href="Entity.html" title="MIDICommunicationsMacOS::Entity (class)">entities</a></span>, which in turn contain <span class='object_link'><a href="Endpoint.html" title="MIDICommunicationsMacOS::Endpoint (module)">endpoints</a></span>
111
+ (<span class='object_link'><a href="Source.html" title="MIDICommunicationsMacOS::Source (class)">sources</a></span> and <span class='object_link'><a href="Destination.html" title="MIDICommunicationsMacOS::Destination (class)">destinations</a></span>).</p>
112
+
113
+
114
+ </div>
115
+ </div>
116
+ <div class="tags">
117
+
118
+ <div class="examples">
119
+ <h4 class="tag_title">Examples:</h4>
120
+
121
+
122
+ <h5 class="example_title"><div class='inline'><p>List all devices</p>
123
+ </div></h5>
124
+
125
+ <pre class="example code"><code><span class='const'><span class='object_link'><a href="../MIDICommunicationsMacOS.html" title="MIDICommunicationsMacOS (module)">MIDICommunicationsMacOS</a></span></span><span class='op'>::</span><span class='const'>Device</span><span class='period'>.</span><span class='id identifier rubyid_all'><span class='object_link'><a href="#all-class_method" title="MIDICommunicationsMacOS::Device.all (method)">all</a></span></span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_device'>device</span><span class='op'>|</span>
126
+ <span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_device'>device</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span>
127
+ <span class='kw'>end</span></code></pre>
128
+
129
+ </div>
130
+
131
+
132
+ <p class="tag_title">See Also:</p>
133
+ <ul class="see">
134
+
135
+ <li><a href="https://developer.apple.com/documentation/coremidi/midideviceref" target="_parent" title="https://developer.apple.com/documentation/coremidi/midideviceref">https://developer.apple.com/documentation/coremidi/midideviceref</a></li>
136
+
137
+ </ul>
138
+
139
+ </div>
140
+
141
+
142
+
143
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
144
+ <ul class="summary">
145
+
146
+ <li class="public ">
147
+ <span class="summary_signature">
148
+
149
+ <a href="#entities-instance_method" title="#entities (instance method)">#<strong>entities</strong> &#x21d2; Array&lt;Entity&gt; </a>
150
+
151
+
152
+
153
+ </span>
154
+
155
+
156
+
157
+
158
+ <span class="note title readonly">readonly</span>
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+ <span class="summary_desc"><div class='inline'><p>The device&#39;s entities.</p>
169
+ </div></span>
170
+
171
+ </li>
172
+
173
+
174
+ <li class="public ">
175
+ <span class="summary_signature">
176
+
177
+ <a href="#id-instance_method" title="#id (instance method)">#<strong>id</strong> &#x21d2; Integer </a>
178
+
179
+
180
+
181
+ </span>
182
+
183
+
184
+
185
+
186
+ <span class="note title readonly">readonly</span>
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+ <span class="summary_desc"><div class='inline'><p>Unique numeric ID.</p>
197
+ </div></span>
198
+
199
+ </li>
200
+
201
+
202
+ <li class="public ">
203
+ <span class="summary_signature">
204
+
205
+ <a href="#name-instance_method" title="#name (instance method)">#<strong>name</strong> &#x21d2; Object </a>
206
+
207
+
208
+
209
+ </span>
210
+
211
+
212
+
213
+
214
+ <span class="note title readonly">readonly</span>
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+ <span class="summary_desc"><div class='inline'></div></span>
225
+
226
+ </li>
227
+
228
+
229
+ </ul>
230
+
231
+
232
+
233
+
234
+
235
+ <h2>
236
+ Class Method Summary
237
+ <small><a href="#" class="summary_toggle">collapse</a></small>
238
+ </h2>
239
+
240
+ <ul class="summary">
241
+
242
+ <li class="public ">
243
+ <span class="summary_signature">
244
+
245
+ <a href="#all-class_method" title="all (class method)">.<strong>all</strong>(options = {}) &#x21d2; Array&lt;Device&gt; </a>
246
+
247
+
248
+
249
+ </span>
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+ <span class="summary_desc"><div class='inline'><p>Returns all available MIDI devices.</p>
260
+ </div></span>
261
+
262
+ </li>
263
+
264
+
265
+ <li class="public ">
266
+ <span class="summary_signature">
267
+
268
+ <a href="#populated%3F-class_method" title="populated? (class method)">.<strong>populated?</strong> &#x21d2; Boolean </a>
269
+
270
+
271
+
272
+ </span>
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+ <span class="summary_desc"><div class='inline'><p>Has the device list been populated?.</p>
283
+ </div></span>
284
+
285
+ </li>
286
+
287
+
288
+ <li class="public ">
289
+ <span class="summary_signature">
290
+
291
+ <a href="#refresh-class_method" title="refresh (class method)">.<strong>refresh</strong> &#x21d2; Array&lt;Device&gt; </a>
292
+
293
+
294
+
295
+ </span>
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+
305
+ <span class="summary_desc"><div class='inline'><p>Clears the device cache.</p>
306
+ </div></span>
307
+
308
+ </li>
309
+
310
+
311
+ </ul>
312
+
313
+ <h2>
314
+ Instance Method Summary
315
+ <small><a href="#" class="summary_toggle">collapse</a></small>
316
+ </h2>
317
+
318
+ <ul class="summary">
319
+
320
+ <li class="public ">
321
+ <span class="summary_signature">
322
+
323
+ <a href="#endpoints-instance_method" title="#endpoints (instance method)">#<strong>endpoints</strong> &#x21d2; Hash{Symbol =&gt; Array&lt;Endpoint&gt;} </a>
324
+
325
+
326
+
327
+ </span>
328
+
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+
337
+ <span class="summary_desc"><div class='inline'><p>Returns all endpoints for this device, grouped by type.</p>
338
+ </div></span>
339
+
340
+ </li>
341
+
342
+
343
+ <li class="public ">
344
+ <span class="summary_signature">
345
+
346
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(id, device_pointer, include_offline: false) &#x21d2; Device </a>
347
+
348
+
349
+
350
+ </span>
351
+
352
+
353
+ <span class="note title constructor">constructor</span>
354
+
355
+
356
+
357
+
358
+
359
+ <span class="private note title">private</span>
360
+
361
+
362
+ <span class="summary_desc"><div class='inline'><p>Creates a new Device wrapper.</p>
363
+ </div></span>
364
+
365
+ </li>
366
+
367
+
368
+ <li class="public ">
369
+ <span class="summary_signature">
370
+
371
+ <a href="#populate_endpoint_ids-instance_method" title="#populate_endpoint_ids (instance method)">#<strong>populate_endpoint_ids</strong>(last_id) &#x21d2; Integer </a>
372
+
373
+
374
+
375
+ </span>
376
+
377
+
378
+
379
+
380
+
381
+
382
+
383
+
384
+
385
+ <span class="summary_desc"><div class='inline'><p>Assign all of this Device&#39;s endpoints an consecutive local id.</p>
386
+ </div></span>
387
+
388
+ </li>
389
+
390
+
391
+ </ul>
392
+
393
+
394
+ <div id="constructor_details" class="method_details_list">
395
+ <h2>Constructor Details</h2>
396
+
397
+ <div class="method_details first">
398
+ <h3 class="signature first" id="initialize-instance_method">
399
+
400
+ #<strong>initialize</strong>(id, device_pointer, include_offline: false) &#x21d2; <tt><span class='object_link'><a href="" title="MIDICommunicationsMacOS::Device (class)">Device</a></span></tt>
401
+
402
+
403
+
404
+
405
+
406
+ </h3><div class="docstring">
407
+ <div class="discussion">
408
+ <p class="note private">
409
+ <strong>This method is part of a private API.</strong>
410
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
411
+ </p>
412
+ <p>Creates a new Device wrapper.</p>
413
+
414
+
415
+ </div>
416
+ </div>
417
+ <div class="tags">
418
+ <p class="tag_title">Parameters:</p>
419
+ <ul class="param">
420
+
421
+ <li>
422
+
423
+ <span class='name'>id</span>
424
+
425
+
426
+ <span class='type'>(<tt>Integer</tt>)</span>
427
+
428
+
429
+
430
+ &mdash;
431
+ <div class='inline'><p>the device ID</p>
432
+ </div>
433
+
434
+ </li>
435
+
436
+ <li>
437
+
438
+ <span class='name'>device_pointer</span>
439
+
440
+
441
+ <span class='type'>(<tt>FFI::Pointer</tt>)</span>
442
+
443
+
444
+
445
+ &mdash;
446
+ <div class='inline'><p>pointer to the Core MIDI device</p>
447
+ </div>
448
+
449
+ </li>
450
+
451
+ <li>
452
+
453
+ <span class='name'>include_offline</span>
454
+
455
+
456
+ <span class='type'>(<tt>Boolean</tt>)</span>
457
+
458
+
459
+ <em class="default">(defaults to: <tt>false</tt>)</em>
460
+
461
+
462
+ &mdash;
463
+ <div class='inline'><p>whether to include offline entities</p>
464
+ </div>
465
+
466
+ </li>
467
+
468
+ </ul>
469
+
470
+
471
+ </div><table class="source_code">
472
+ <tr>
473
+ <td>
474
+ <pre class="lines">
475
+
476
+
477
+ 36
478
+ 37
479
+ 38
480
+ 39
481
+ 40
482
+ 41</pre>
483
+ </td>
484
+ <td>
485
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-macos/device.rb', line 36</span>
486
+
487
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='id identifier rubyid_device_pointer'>device_pointer</span><span class='comma'>,</span> <span class='label'>include_offline:</span> <span class='kw'>false</span><span class='rparen'>)</span>
488
+ <span class='ivar'>@id</span> <span class='op'>=</span> <span class='id identifier rubyid_id'>id</span>
489
+ <span class='ivar'>@resource</span> <span class='op'>=</span> <span class='id identifier rubyid_device_pointer'>device_pointer</span>
490
+ <span class='ivar'>@entities</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
491
+ <span class='id identifier rubyid_populate'>populate</span><span class='lparen'>(</span><span class='label'>include_offline:</span> <span class='id identifier rubyid_include_offline'>include_offline</span><span class='rparen'>)</span>
492
+ <span class='kw'>end</span></pre>
493
+ </td>
494
+ </tr>
495
+ </table>
496
+ </div>
497
+
498
+ </div>
499
+
500
+ <div id="instance_attr_details" class="attr_details">
501
+ <h2>Instance Attribute Details</h2>
502
+
503
+
504
+ <span id=""></span>
505
+ <div class="method_details first">
506
+ <h3 class="signature first" id="entities-instance_method">
507
+
508
+ #<strong>entities</strong> &#x21d2; <tt>Array&lt;<span class='object_link'><a href="Entity.html" title="MIDICommunicationsMacOS::Entity (class)">Entity</a></span>&gt;</tt> <span class="extras">(readonly)</span>
509
+
510
+
511
+
512
+
513
+
514
+ </h3><div class="docstring">
515
+ <div class="discussion">
516
+ <p>Returns the device&#39;s entities.</p>
517
+
518
+
519
+ </div>
520
+ </div>
521
+ <div class="tags">
522
+
523
+ <p class="tag_title">Returns:</p>
524
+ <ul class="return">
525
+
526
+ <li>
527
+
528
+
529
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Entity.html" title="MIDICommunicationsMacOS::Entity (class)">Entity</a></span>&gt;</tt>)</span>
530
+
531
+
532
+
533
+ &mdash;
534
+ <div class='inline'><p>the device&#39;s entities</p>
535
+ </div>
536
+
537
+ </li>
538
+
539
+ </ul>
540
+
541
+ </div><table class="source_code">
542
+ <tr>
543
+ <td>
544
+ <pre class="lines">
545
+
546
+
547
+ 26
548
+ 27
549
+ 28</pre>
550
+ </td>
551
+ <td>
552
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-macos/device.rb', line 26</span>
553
+
554
+ <span class='kw'>def</span> <span class='id identifier rubyid_entities'>entities</span>
555
+ <span class='ivar'>@entities</span>
556
+ <span class='kw'>end</span></pre>
557
+ </td>
558
+ </tr>
559
+ </table>
560
+ </div>
561
+
562
+
563
+ <span id=""></span>
564
+ <div class="method_details ">
565
+ <h3 class="signature " id="id-instance_method">
566
+
567
+ #<strong>id</strong> &#x21d2; <tt>Integer</tt> <span class="extras">(readonly)</span>
568
+
569
+
570
+
571
+
572
+
573
+ </h3><div class="docstring">
574
+ <div class="discussion">
575
+ <p>Returns unique numeric ID.</p>
576
+
577
+
578
+ </div>
579
+ </div>
580
+ <div class="tags">
581
+
582
+ <p class="tag_title">Returns:</p>
583
+ <ul class="return">
584
+
585
+ <li>
586
+
587
+
588
+ <span class='type'>(<tt>Integer</tt>)</span>
589
+
590
+
591
+
592
+ &mdash;
593
+ <div class='inline'><p>unique numeric ID</p>
594
+ </div>
595
+
596
+ </li>
597
+
598
+ </ul>
599
+
600
+ </div><table class="source_code">
601
+ <tr>
602
+ <td>
603
+ <pre class="lines">
604
+
605
+
606
+ 26
607
+ 27
608
+ 28</pre>
609
+ </td>
610
+ <td>
611
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-macos/device.rb', line 26</span>
612
+
613
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:entities</span><span class='comma'>,</span>
614
+ <span class='symbol'>:id</span><span class='comma'>,</span>
615
+ <span class='symbol'>:name</span></pre>
616
+ </td>
617
+ </tr>
618
+ </table>
619
+ </div>
620
+
621
+
622
+ <span id=""></span>
623
+ <div class="method_details ">
624
+ <h3 class="signature " id="name-instance_method">
625
+
626
+ #<strong>name</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
627
+
628
+
629
+
630
+
631
+
632
+ </h3><div class="docstring">
633
+ <div class="discussion">
634
+
635
+
636
+ </div>
637
+ </div>
638
+ <div class="tags">
639
+
640
+
641
+ </div><table class="source_code">
642
+ <tr>
643
+ <td>
644
+ <pre class="lines">
645
+
646
+
647
+ 26
648
+ 27
649
+ 28</pre>
650
+ </td>
651
+ <td>
652
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-macos/device.rb', line 26</span>
653
+
654
+ <span class='id identifier rubyid_attr_reader'>attr_reader</span> <span class='symbol'>:entities</span><span class='comma'>,</span>
655
+ <span class='symbol'>:id</span><span class='comma'>,</span>
656
+ <span class='symbol'>:name</span></pre>
657
+ </td>
658
+ </tr>
659
+ </table>
660
+ </div>
661
+
662
+ </div>
663
+
664
+
665
+ <div id="class_method_details" class="method_details_list">
666
+ <h2>Class Method Details</h2>
667
+
668
+
669
+ <div class="method_details first">
670
+ <h3 class="signature first" id="all-class_method">
671
+
672
+ .<strong>all</strong>(options = {}) &#x21d2; <tt>Array&lt;<span class='object_link'><a href="" title="MIDICommunicationsMacOS::Device (class)">Device</a></span>&gt;</tt>
673
+
674
+
675
+
676
+
677
+
678
+ </h3><div class="docstring">
679
+ <div class="discussion">
680
+ <p>Returns all available MIDI devices.</p>
681
+
682
+ <p>Devices are cached by default. Use <code>cache: false</code> to refresh, or call
683
+ <span class='object_link'><a href="#refresh-class_method" title="MIDICommunicationsMacOS::Device.refresh (method)">refresh</a></span> to clear the cache.</p>
684
+
685
+
686
+ </div>
687
+ </div>
688
+ <div class="tags">
689
+
690
+ <div class="examples">
691
+ <h4 class="tag_title">Examples:</h4>
692
+
693
+
694
+ <pre class="example code"><code><span class='id identifier rubyid_devices'>devices</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../MIDICommunicationsMacOS.html" title="MIDICommunicationsMacOS (module)">MIDICommunicationsMacOS</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="MIDICommunicationsMacOS::Device (class)">Device</a></span></span><span class='period'>.</span><span class='id identifier rubyid_all'>all</span>
695
+ <span class='id identifier rubyid_devices'>devices</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_d'>d</span><span class='op'>|</span> <span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_d'>d</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='rbrace'>}</span></code></pre>
696
+
697
+ </div>
698
+ <p class="tag_title">Parameters:</p>
699
+ <ul class="param">
700
+
701
+ <li>
702
+
703
+ <span class='name'>options</span>
704
+
705
+
706
+ <span class='type'>(<tt>Hash</tt>)</span>
707
+
708
+
709
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
710
+
711
+
712
+ &mdash;
713
+ <div class='inline'><p>options for device selection</p>
714
+ </div>
715
+
716
+ </li>
717
+
718
+ </ul>
719
+
720
+
721
+
722
+
723
+ <p class="tag_title">Options Hash (<tt>options</tt>):</p>
724
+ <ul class="option">
725
+
726
+ <li>
727
+ <span class="name">:cache</span>
728
+ <span class="type">(<tt>Boolean</tt>)</span>
729
+ <span class="default">
730
+
731
+ &mdash; default:
732
+ <tt>true</tt>
733
+
734
+ </span>
735
+
736
+ &mdash; <div class='inline'><p>whether to use cached devices</p>
737
+ </div>
738
+
739
+ </li>
740
+
741
+ <li>
742
+ <span class="name">:include_offline</span>
743
+ <span class="type">(<tt>Boolean</tt>)</span>
744
+ <span class="default">
745
+
746
+ &mdash; default:
747
+ <tt>false</tt>
748
+
749
+ </span>
750
+
751
+ &mdash; <div class='inline'><p>include offline devices</p>
752
+ </div>
753
+
754
+ </li>
755
+
756
+ </ul>
757
+
758
+
759
+ <p class="tag_title">Returns:</p>
760
+ <ul class="return">
761
+
762
+ <li>
763
+
764
+
765
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="" title="MIDICommunicationsMacOS::Device (class)">Device</a></span>&gt;</tt>)</span>
766
+
767
+
768
+
769
+ &mdash;
770
+ <div class='inline'><p>all available devices</p>
771
+ </div>
772
+
773
+ </li>
774
+
775
+ </ul>
776
+
777
+ </div><table class="source_code">
778
+ <tr>
779
+ <td>
780
+ <pre class="lines">
781
+
782
+
783
+ 77
784
+ 78
785
+ 79
786
+ 80
787
+ 81
788
+ 82
789
+ 83
790
+ 84
791
+ 85
792
+ 86
793
+ 87
794
+ 88
795
+ 89
796
+ 90
797
+ 91</pre>
798
+ </td>
799
+ <td>
800
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-macos/device.rb', line 77</span>
801
+
802
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_all'>all</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
803
+ <span class='id identifier rubyid_use_cache'>use_cache</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:cache</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='kw'>true</span>
804
+ <span class='id identifier rubyid_include_offline'>include_offline</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:include_offline</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='kw'>false</span>
805
+ <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_populated?'>populated?</span> <span class='op'>||</span> <span class='op'>!</span><span class='id identifier rubyid_use_cache'>use_cache</span>
806
+ <span class='ivar'>@devices</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
807
+ <span class='id identifier rubyid_counter'>counter</span> <span class='op'>=</span> <span class='int'>0</span>
808
+ <span class='kw'>while</span> <span class='op'>!</span><span class='lparen'>(</span><span class='id identifier rubyid_device_pointer'>device_pointer</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="API.html" title="MIDICommunicationsMacOS::API (module)">API</a></span></span><span class='period'>.</span><span class='const'>MIDIGetDevice</span><span class='lparen'>(</span><span class='id identifier rubyid_counter'>counter</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_null?'>null?</span>
809
+ <span class='id identifier rubyid_device'>device</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_counter'>counter</span><span class='comma'>,</span> <span class='id identifier rubyid_device_pointer'>device_pointer</span><span class='comma'>,</span> <span class='label'>include_offline:</span> <span class='id identifier rubyid_include_offline'>include_offline</span><span class='rparen'>)</span>
810
+ <span class='ivar'>@devices</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_device'>device</span>
811
+ <span class='id identifier rubyid_counter'>counter</span> <span class='op'>+=</span> <span class='int'>1</span>
812
+ <span class='kw'>end</span>
813
+ <span class='id identifier rubyid_populate_endpoint_ids'>populate_endpoint_ids</span>
814
+ <span class='kw'>end</span>
815
+ <span class='ivar'>@devices</span>
816
+ <span class='kw'>end</span></pre>
817
+ </td>
818
+ </tr>
819
+ </table>
820
+ </div>
821
+
822
+ <div class="method_details ">
823
+ <h3 class="signature " id="populated?-class_method">
824
+
825
+ .<strong>populated?</strong> &#x21d2; <tt>Boolean</tt>
826
+
827
+
828
+
829
+
830
+
831
+ </h3><div class="docstring">
832
+ <div class="discussion">
833
+ <p>Has the device list been populated?</p>
834
+
835
+
836
+ </div>
837
+ </div>
838
+ <div class="tags">
839
+
840
+ <p class="tag_title">Returns:</p>
841
+ <ul class="return">
842
+
843
+ <li>
844
+
845
+
846
+ <span class='type'>(<tt>Boolean</tt>)</span>
847
+
848
+
849
+
850
+ </li>
851
+
852
+ </ul>
853
+
854
+ </div><table class="source_code">
855
+ <tr>
856
+ <td>
857
+ <pre class="lines">
858
+
859
+
860
+ 105
861
+ 106
862
+ 107</pre>
863
+ </td>
864
+ <td>
865
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-macos/device.rb', line 105</span>
866
+
867
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_populated?'>populated?</span>
868
+ <span class='kw'>defined?</span><span class='lparen'>(</span><span class='ivar'>@devices</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='ivar'>@devices</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='ivar'>@devices</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
869
+ <span class='kw'>end</span></pre>
870
+ </td>
871
+ </tr>
872
+ </table>
873
+ </div>
874
+
875
+ <div class="method_details ">
876
+ <h3 class="signature " id="refresh-class_method">
877
+
878
+ .<strong>refresh</strong> &#x21d2; <tt>Array&lt;<span class='object_link'><a href="" title="MIDICommunicationsMacOS::Device (class)">Device</a></span>&gt;</tt>
879
+
880
+
881
+
882
+
883
+
884
+ </h3><div class="docstring">
885
+ <div class="discussion">
886
+ <p>Clears the device cache.</p>
887
+
888
+ <p>Call this when MIDI devices are plugged in or unplugged while the
889
+ program is running, then call <span class='object_link'><a href="#all-class_method" title="MIDICommunicationsMacOS::Device.all (method)">all</a></span> to get the updated list.</p>
890
+
891
+
892
+ </div>
893
+ </div>
894
+ <div class="tags">
895
+
896
+ <p class="tag_title">Returns:</p>
897
+ <ul class="return">
898
+
899
+ <li>
900
+
901
+
902
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="" title="MIDICommunicationsMacOS::Device (class)">Device</a></span>&gt;</tt>)</span>
903
+
904
+
905
+
906
+ &mdash;
907
+ <div class='inline'><p>the cleared cache (empty array)</p>
908
+ </div>
909
+
910
+ </li>
911
+
912
+ </ul>
913
+
914
+ </div><table class="source_code">
915
+ <tr>
916
+ <td>
917
+ <pre class="lines">
918
+
919
+
920
+ 99
921
+ 100
922
+ 101
923
+ 102</pre>
924
+ </td>
925
+ <td>
926
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-macos/device.rb', line 99</span>
927
+
928
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_refresh'>refresh</span>
929
+ <span class='ivar'>@devices</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
930
+ <span class='ivar'>@devices</span>
931
+ <span class='kw'>end</span></pre>
932
+ </td>
933
+ </tr>
934
+ </table>
935
+ </div>
936
+
937
+ </div>
938
+
939
+ <div id="instance_method_details" class="method_details_list">
940
+ <h2>Instance Method Details</h2>
941
+
942
+
943
+ <div class="method_details first">
944
+ <h3 class="signature first" id="endpoints-instance_method">
945
+
946
+ #<strong>endpoints</strong> &#x21d2; <tt>Hash{Symbol =&gt; Array&lt;<span class='object_link'><a href="Endpoint.html" title="MIDICommunicationsMacOS::Endpoint (module)">Endpoint</a></span>&gt;}</tt>
947
+
948
+
949
+
950
+
951
+
952
+ </h3><div class="docstring">
953
+ <div class="discussion">
954
+ <p>Returns all endpoints for this device, grouped by type.</p>
955
+
956
+
957
+ </div>
958
+ </div>
959
+ <div class="tags">
960
+
961
+ <p class="tag_title">Returns:</p>
962
+ <ul class="return">
963
+
964
+ <li>
965
+
966
+
967
+ <span class='type'>(<tt>Hash{Symbol =&gt; Array&lt;<span class='object_link'><a href="Endpoint.html" title="MIDICommunicationsMacOS::Endpoint (module)">Endpoint</a></span>&gt;}</tt>)</span>
968
+
969
+
970
+
971
+ &mdash;
972
+ <div class='inline'><p>hash with :source and :destination keys</p>
973
+ </div>
974
+
975
+ </li>
976
+
977
+ </ul>
978
+
979
+ </div><table class="source_code">
980
+ <tr>
981
+ <td>
982
+ <pre class="lines">
983
+
984
+
985
+ 46
986
+ 47
987
+ 48
988
+ 49
989
+ 50
990
+ 51
991
+ 52
992
+ 53</pre>
993
+ </td>
994
+ <td>
995
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-macos/device.rb', line 46</span>
996
+
997
+ <span class='kw'>def</span> <span class='id identifier rubyid_endpoints'>endpoints</span>
998
+ <span class='id identifier rubyid_endpoints'>endpoints</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='label'>source:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='label'>destination:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='rbrace'>}</span>
999
+ <span class='id identifier rubyid_endpoints'>endpoints</span><span class='period'>.</span><span class='id identifier rubyid_each_key'>each_key</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span>
1000
+ <span class='id identifier rubyid_endpoint_group'>endpoint_group</span> <span class='op'>=</span> <span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_entity'>entity</span><span class='op'>|</span> <span class='id identifier rubyid_entity'>entity</span><span class='period'>.</span><span class='id identifier rubyid_endpoints'>endpoints</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span>
1001
+ <span class='id identifier rubyid_endpoints'>endpoints</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>+=</span> <span class='id identifier rubyid_endpoint_group'>endpoint_group</span>
1002
+ <span class='kw'>end</span>
1003
+ <span class='id identifier rubyid_endpoints'>endpoints</span>
1004
+ <span class='kw'>end</span></pre>
1005
+ </td>
1006
+ </tr>
1007
+ </table>
1008
+ </div>
1009
+
1010
+ <div class="method_details ">
1011
+ <h3 class="signature " id="populate_endpoint_ids-instance_method">
1012
+
1013
+ #<strong>populate_endpoint_ids</strong>(last_id) &#x21d2; <tt>Integer</tt>
1014
+
1015
+
1016
+
1017
+
1018
+
1019
+ </h3><div class="docstring">
1020
+ <div class="discussion">
1021
+ <p>Assign all of this Device&#39;s endpoints an consecutive local id</p>
1022
+
1023
+
1024
+ </div>
1025
+ </div>
1026
+ <div class="tags">
1027
+ <p class="tag_title">Parameters:</p>
1028
+ <ul class="param">
1029
+
1030
+ <li>
1031
+
1032
+ <span class='name'>last_id</span>
1033
+
1034
+
1035
+ <span class='type'>(<tt>Integer</tt>)</span>
1036
+
1037
+
1038
+
1039
+ &mdash;
1040
+ <div class='inline'><p>The highest already used endpoint ID</p>
1041
+ </div>
1042
+
1043
+ </li>
1044
+
1045
+ </ul>
1046
+
1047
+ <p class="tag_title">Returns:</p>
1048
+ <ul class="return">
1049
+
1050
+ <li>
1051
+
1052
+
1053
+ <span class='type'>(<tt>Integer</tt>)</span>
1054
+
1055
+
1056
+
1057
+ &mdash;
1058
+ <div class='inline'><p>The highest used endpoint ID after populating this device&#39;s endpoints</p>
1059
+ </div>
1060
+
1061
+ </li>
1062
+
1063
+ </ul>
1064
+
1065
+ </div><table class="source_code">
1066
+ <tr>
1067
+ <td>
1068
+ <pre class="lines">
1069
+
1070
+
1071
+ 58
1072
+ 59
1073
+ 60
1074
+ 61
1075
+ 62</pre>
1076
+ </td>
1077
+ <td>
1078
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-macos/device.rb', line 58</span>
1079
+
1080
+ <span class='kw'>def</span> <span class='id identifier rubyid_populate_endpoint_ids'>populate_endpoint_ids</span><span class='lparen'>(</span><span class='id identifier rubyid_last_id'>last_id</span><span class='rparen'>)</span>
1081
+ <span class='id identifier rubyid_id'>id</span> <span class='op'>=</span> <span class='int'>0</span>
1082
+ <span class='id identifier rubyid_entities'>entities</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_entity'>entity</span><span class='op'>|</span> <span class='id identifier rubyid_id'>id</span> <span class='op'>+=</span> <span class='id identifier rubyid_entity'>entity</span><span class='period'>.</span><span class='id identifier rubyid_populate_endpoint_ids'>populate_endpoint_ids</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span> <span class='op'>+</span> <span class='id identifier rubyid_last_id'>last_id</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
1083
+ <span class='id identifier rubyid_id'>id</span>
1084
+ <span class='kw'>end</span></pre>
1085
+ </td>
1086
+ </tr>
1087
+ </table>
1088
+ </div>
1089
+
1090
+ </div>
1091
+
1092
+ </div>
1093
+
1094
+ <div id="footer">
1095
+ Generated on Tue Nov 25 11:37:07 2025 by
1096
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1097
+ 0.9.37 (ruby-3.4.7).
1098
+ </div>
1099
+
1100
+ </div>
1101
+ </body>
1102
+ </html>