midi-communications-windows 0.0.3

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 (57) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.version +6 -0
  4. data/.yardoc/checksums +8 -0
  5. data/.yardoc/complete +0 -0
  6. data/.yardoc/object_types +0 -0
  7. data/.yardoc/objects/root.dat +0 -0
  8. data/.yardoc/proxy_types +0 -0
  9. data/.yardopts +8 -0
  10. data/Gemfile +3 -0
  11. data/LICENSE +165 -0
  12. data/README.md +176 -0
  13. data/Rakefile +13 -0
  14. data/doc/MIDICommunicationsWindows/API/MIDIHdr.html +144 -0
  15. data/doc/MIDICommunicationsWindows/API/MIDIInCaps.html +142 -0
  16. data/doc/MIDICommunicationsWindows/API/MIDIOutCaps.html +140 -0
  17. data/doc/MIDICommunicationsWindows/API/MSG.html +143 -0
  18. data/doc/MIDICommunicationsWindows/API.html +981 -0
  19. data/doc/MIDICommunicationsWindows/Device/ClassMethods.html +365 -0
  20. data/doc/MIDICommunicationsWindows/Device/InstanceMethods.html +1096 -0
  21. data/doc/MIDICommunicationsWindows/Device.html +988 -0
  22. data/doc/MIDICommunicationsWindows/Error.html +438 -0
  23. data/doc/MIDICommunicationsWindows/Input.html +1554 -0
  24. data/doc/MIDICommunicationsWindows/Message.html +700 -0
  25. data/doc/MIDICommunicationsWindows/Output.html +1697 -0
  26. data/doc/MIDICommunicationsWindows/TypeConversion.html +369 -0
  27. data/doc/MIDICommunicationsWindows.html +210 -0
  28. data/doc/_index.html +262 -0
  29. data/doc/class_list.html +54 -0
  30. data/doc/css/common.css +1 -0
  31. data/doc/css/full_list.css +206 -0
  32. data/doc/css/style.css +1089 -0
  33. data/doc/file.README.html +240 -0
  34. data/doc/file.testing-on-windows.html +253 -0
  35. data/doc/file_list.html +64 -0
  36. data/doc/frames.html +22 -0
  37. data/doc/index.html +240 -0
  38. data/doc/js/app.js +801 -0
  39. data/doc/js/full_list.js +334 -0
  40. data/doc/js/jquery.js +4 -0
  41. data/doc/method_list.html +382 -0
  42. data/doc/top-level-namespace.html +112 -0
  43. data/docs/testing-on-windows.md +222 -0
  44. data/examples/input.rb +27 -0
  45. data/examples/list_ports.rb +17 -0
  46. data/examples/output.rb +22 -0
  47. data/examples/sysex_output.rb +15 -0
  48. data/lib/midi-communications-windows/api.rb +340 -0
  49. data/lib/midi-communications-windows/device.rb +310 -0
  50. data/lib/midi-communications-windows/input.rb +486 -0
  51. data/lib/midi-communications-windows/message.rb +133 -0
  52. data/lib/midi-communications-windows/output.rb +206 -0
  53. data/lib/midi-communications-windows/type_conversion.rb +20 -0
  54. data/lib/midi-communications-windows/version.rb +4 -0
  55. data/lib/midi-communications-windows.rb +76 -0
  56. data/midi-communications-windows.gemspec +32 -0
  57. metadata +220 -0
@@ -0,0 +1,988 @@
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
+ Module: MIDICommunicationsWindows::Device
8
+
9
+ &mdash; MIDI Communications Windows 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 = "MIDICommunicationsWindows::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 id="main_progress" aria-hidden="true"></div>
31
+
32
+ <div class="nav_wrap">
33
+ <iframe id="nav" src="../class_list.html?1"></iframe>
34
+ <div id="resizer"></div>
35
+ </div>
36
+
37
+ <div id="main" tabindex="-1">
38
+ <div id="header">
39
+ <div id="menu">
40
+
41
+ <a href="../_index.html">Index (D)</a> &raquo;
42
+ <span class='title'><span class='object_link'><a href="../MIDICommunicationsWindows.html" title="MIDICommunicationsWindows (module)">MIDICommunicationsWindows</a></span></span>
43
+ &raquo;
44
+ <span class="title">Device</span>
45
+
46
+ </div>
47
+
48
+ <div id="search">
49
+
50
+ <a class="full_list_link" id="class_list_link"
51
+ href="../class_list.html">
52
+
53
+ <svg width="24" height="24">
54
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
55
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
56
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
57
+ </svg>
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <div id="content"><h1>Module: MIDICommunicationsWindows::Device
65
+
66
+
67
+
68
+ </h1>
69
+ <div class="box_info">
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ <dl>
82
+ <dt>Defined in:</dt>
83
+ <dd>lib/midi-communications-windows/device.rb
84
+ </dd>
85
+ </dl>
86
+
87
+ </div>
88
+
89
+ <h2>Overview</h2><div class="docstring">
90
+ <div class="discussion">
91
+ <p>Enumeration of the MIDI ports WinMM offers, and the attributes every port
92
+ has whichever direction it runs in.</p>
93
+ <h2 id="What_a_port_s_identity_is_here__and_what_it_is_not">What a port's identity is here, and what it is not</h2>
94
+ <p>WinMM identifies a port by its <strong>index within its direction</strong>: the same
95
+ integer is passed to <code>midiInGetDevCapsW</code> and to <code>midiInOpen</code>, and there is
96
+ nothing else to identify a port by. So the index is the identity, and
97
+ <span class='object_link'><a href="Device/InstanceMethods.html#id-instance_method" title="MIDICommunicationsWindows::Device::InstanceMethods#id (method)">InstanceMethods#id</a></span> is that index, unmodified.</p>
98
+ <p>This differs from Core MIDI, where endpoints are numbered from a single
99
+ counter shared by sources and destinations, and an input and an output
100
+ therefore never share an id. Here they do: input 0 and output 0 are both
101
+ valid and unrelated. Nothing in <code>midi-communications</code> compares an id across
102
+ directions — <code>Input.all</code> and <code>Output.all</code> each search their own list — and
103
+ shifting the output indices to imitate Core MIDI would replace the real
104
+ identity with an invented one.</p>
105
+ <h2 id="A_port_s_name_does_not_identify_it">A port's name does not identify it</h2>
106
+ <p>WinMM stores 31 characters of a name and silently drops the rest, so two
107
+ ports whose names differ only past that point arrive with the same name.
108
+ Measured: two loopback endpoints created as &quot;Reloj Bitwig ñ prueba de
109
+ longitud&quot; and &quot;Reloj Bitwig ñ prueba de longitud DOS&quot; come back through
110
+ <code>midiInGetDevCapsW</code> identical in every field — same name, same <code>wMid</code>, same
111
+ <code>wPid</code>, same <code>vDriverVersion</code>, same <code>wTechnology</code>. Nothing in the structure
112
+ tells them apart. Only the index does.</p>
113
+ <p>This is not a contrived case: two ports of one interface whose long names
114
+ differ at the end collapse the same way. Windows does have a stable unique
115
+ identifier for each endpoint — the device interface id, which the newer APIs
116
+ expose — but <code>midiInGetDevCapsW</code> does not carry it, so it is not reachable
117
+ from here.</p>
118
+ <p>A consumer matching ports by name should know it may be matching the wrong
119
+ one.</p>
120
+ <h2 id="Manufacturer_and_model_are_nil__deliberately">Manufacturer and model are nil, deliberately</h2>
121
+ <p>WinMM reports <code>wMid</code> and <code>wPid</code>: numeric codes from the MMSYSTEM
122
+ manufacturer registry, which stopped being maintained in the 1990s.
123
+ Measured across every port on a Windows 11 machine — a software synth and
124
+ two loopback endpoints — <code>wMid</code> was 1, Microsoft, every time. <code>wPid</code> was no
125
+ better: 25 for every input and 26 for every output, the same for two
126
+ different devices, so it names a generic class and a direction rather than a
127
+ model. Turning those into text would label every controller on the machine
128
+ as made by Microsoft — a fact about the code table, presented as a fact
129
+ about the hardware.</p>
130
+ <p>So both are nil. A caller filtering by manufacturer finds nothing and can
131
+ see that it found nothing, which is the truthful outcome; a caller offered
132
+ an empty string or an invented name would match, or not match, for reasons
133
+ that are not real.</p>
134
+
135
+ </div>
136
+ </div>
137
+ <div class="tags">
138
+
139
+
140
+ </div><h2>Defined Under Namespace</h2>
141
+ <p class="children">
142
+
143
+
144
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Device/ClassMethods.html" title="MIDICommunicationsWindows::Device::ClassMethods (module)">ClassMethods</a></span>, <span class='object_link'><a href="Device/InstanceMethods.html" title="MIDICommunicationsWindows::Device::InstanceMethods (module)">InstanceMethods</a></span>
145
+
146
+
147
+
148
+
149
+ </p>
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+ <h2>
159
+ Class Method Summary
160
+ <small><a href="#" class="summary_toggle">collapse</a></small>
161
+ </h2>
162
+
163
+ <ul class="summary">
164
+
165
+ <li class="public ">
166
+ <span class="summary_signature">
167
+
168
+ <a href="#all-class_method" title="all (class method)">.<strong>all</strong> &#x21d2; Array&lt;Input, Output&gt; </a>
169
+
170
+
171
+
172
+ </span>
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+ <span class="summary_desc"><div class='inline'><p>Every port, of both directions.</p></div></span>
183
+
184
+ </li>
185
+
186
+
187
+ <li class="public ">
188
+ <span class="summary_signature">
189
+
190
+ <a href="#all_by_type-class_method" title="all_by_type (class method)">.<strong>all_by_type</strong> &#x21d2; Hash{Symbol =&gt; Array&lt;Input&gt;, Array&lt;Output&gt;} </a>
191
+
192
+
193
+
194
+ </span>
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+ <span class="summary_desc"><div class='inline'><p>Every port, grouped by direction.</p></div></span>
205
+
206
+ </li>
207
+
208
+
209
+ <li class="public ">
210
+ <span class="summary_signature">
211
+
212
+ <a href="#enumerate-class_method" title="enumerate (class method)">.<strong>enumerate</strong>(direction, count, klass) &#x21d2; Array&lt;Input&gt;, Array&lt;Output&gt; </a>
213
+
214
+
215
+
216
+ </span>
217
+
218
+
219
+
220
+
221
+
222
+
223
+ <span class="private note title">private</span>
224
+
225
+
226
+ <span class="summary_desc"><div class='inline'><p>Asks WinMM what ports exist, reusing the wrapper for each one that was already there.</p></div></span>
227
+
228
+ </li>
229
+
230
+
231
+ <li class="public ">
232
+ <span class="summary_signature">
233
+
234
+ <a href="#input_name-class_method" title="input_name (class method)">.<strong>input_name</strong>(id) &#x21d2; String </a>
235
+
236
+
237
+
238
+ </span>
239
+
240
+
241
+
242
+
243
+
244
+
245
+ <span class="private note title">private</span>
246
+
247
+
248
+ <span class="summary_desc"><div class='inline'><p>The name of an input port.</p></div></span>
249
+
250
+ </li>
251
+
252
+
253
+ <li class="public ">
254
+ <span class="summary_signature">
255
+
256
+ <a href="#inputs-class_method" title="inputs (class method)">.<strong>inputs</strong> &#x21d2; Array&lt;Input&gt; </a>
257
+
258
+
259
+
260
+ </span>
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+ <span class="summary_desc"><div class='inline'><p>Every input port WinMM offers.</p></div></span>
271
+
272
+ </li>
273
+
274
+
275
+ <li class="public ">
276
+ <span class="summary_signature">
277
+
278
+ <a href="#output_name-class_method" title="output_name (class method)">.<strong>output_name</strong>(id) &#x21d2; String </a>
279
+
280
+
281
+
282
+ </span>
283
+
284
+
285
+
286
+
287
+
288
+
289
+ <span class="private note title">private</span>
290
+
291
+
292
+ <span class="summary_desc"><div class='inline'><p>The name of an output port.</p></div></span>
293
+
294
+ </li>
295
+
296
+
297
+ <li class="public ">
298
+ <span class="summary_signature">
299
+
300
+ <a href="#outputs-class_method" title="outputs (class method)">.<strong>outputs</strong> &#x21d2; Array&lt;Output&gt; </a>
301
+
302
+
303
+
304
+ </span>
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+ <span class="summary_desc"><div class='inline'><p>Every output port WinMM offers.</p></div></span>
315
+
316
+ </li>
317
+
318
+
319
+ <li class="public ">
320
+ <span class="summary_signature">
321
+
322
+ <a href="#port_name-class_method" title="port_name (class method)">.<strong>port_name</strong>(capabilities) &#x21d2; String </a>
323
+
324
+
325
+
326
+ </span>
327
+
328
+
329
+
330
+
331
+
332
+
333
+ <span class="private note title">private</span>
334
+
335
+
336
+ <span class="summary_desc"><div class='inline'><p>Reads <code>szPname</code> out of a capabilities structure.</p></div></span>
337
+
338
+ </li>
339
+
340
+
341
+ </ul>
342
+
343
+
344
+
345
+
346
+
347
+ <div id="class_method_details" class="method_details_list">
348
+ <h2>Class Method Details</h2>
349
+
350
+
351
+ <div class="method_details first">
352
+ <h3 class="signature first" id="all-class_method">
353
+
354
+ .<strong>all</strong> &#x21d2; <tt>Array&lt;<span class='object_link'><a href="Input.html" title="MIDICommunicationsWindows::Input (class)">Input</a></span>, <span class='object_link'><a href="Output.html" title="MIDICommunicationsWindows::Output (class)">Output</a></span>&gt;</tt>
355
+
356
+
357
+
358
+
359
+
360
+ </h3><div class="docstring">
361
+ <div class="discussion">
362
+ <p>Every port, of both directions.</p>
363
+
364
+ </div>
365
+ </div>
366
+ <div class="tags">
367
+
368
+ <p class="tag_title">Returns:</p>
369
+ <ul class="return">
370
+
371
+ <li>
372
+
373
+
374
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Input.html" title="MIDICommunicationsWindows::Input (class)">Input</a></span>, <span class='object_link'><a href="Output.html" title="MIDICommunicationsWindows::Output (class)">Output</a></span>&gt;</tt>)</span>
375
+
376
+
377
+
378
+ </li>
379
+
380
+ </ul>
381
+
382
+ </div><table class="source_code">
383
+ <tr>
384
+ <td>
385
+ <pre class="lines">
386
+
387
+
388
+ 218
389
+ 219
390
+ 220</pre>
391
+ </td>
392
+ <td>
393
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-windows/device.rb', line 218</span>
394
+
395
+ <span class='kw'>def</span> <span class='id identifier rubyid_all'>all</span>
396
+ <span class='id identifier rubyid_all_by_type'>all_by_type</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span>
397
+ <span class='kw'>end</span></pre>
398
+ </td>
399
+ </tr>
400
+ </table>
401
+ </div>
402
+
403
+ <div class="method_details ">
404
+ <h3 class="signature " id="all_by_type-class_method">
405
+
406
+ .<strong>all_by_type</strong> &#x21d2; <tt>Hash{Symbol =&gt; Array&lt;<span class='object_link'><a href="Input.html" title="MIDICommunicationsWindows::Input (class)">Input</a></span>&gt;, Array&lt;<span class='object_link'><a href="Output.html" title="MIDICommunicationsWindows::Output (class)">Output</a></span>&gt;}</tt>
407
+
408
+
409
+
410
+
411
+
412
+ </h3><div class="docstring">
413
+ <div class="discussion">
414
+ <p>Every port, grouped by direction.</p>
415
+ <p>This is the shape <code>midi-communications</code> asks its platform adapters for.</p>
416
+
417
+ </div>
418
+ </div>
419
+ <div class="tags">
420
+
421
+ <div class="examples">
422
+ <h4 class="tag_title">Examples:</h4>
423
+
424
+
425
+ <pre class="example code"><code><span class='const'><span class='object_link'><a href="../MIDICommunicationsWindows.html" title="MIDICommunicationsWindows (module)">MIDICommunicationsWindows</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="MIDICommunicationsWindows::Device (module)">Device</a></span></span><span class='period'>.</span><span class='id identifier rubyid_all_by_type'>all_by_type</span><span class='lbracket'>[</span><span class='symbol'>:output</span><span class='rbracket'>]</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_o'>o</span><span class='op'>|</span> <span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_o'>o</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='rbrace'>}</span></code></pre>
426
+
427
+ </div>
428
+
429
+ <p class="tag_title">Returns:</p>
430
+ <ul class="return">
431
+
432
+ <li>
433
+
434
+
435
+ <span class='type'>(<tt>Hash{Symbol =&gt; Array&lt;<span class='object_link'><a href="Input.html" title="MIDICommunicationsWindows::Input (class)">Input</a></span>&gt;, Array&lt;<span class='object_link'><a href="Output.html" title="MIDICommunicationsWindows::Output (class)">Output</a></span>&gt;}</tt>)</span>
436
+
437
+
438
+
439
+ &mdash;
440
+ <div class='inline'><p>with <code>:input</code> and
441
+ <code>:output</code> keys</p></div>
442
+
443
+ </li>
444
+
445
+ </ul>
446
+
447
+ </div><table class="source_code">
448
+ <tr>
449
+ <td>
450
+ <pre class="lines">
451
+
452
+
453
+ 212
454
+ 213
455
+ 214</pre>
456
+ </td>
457
+ <td>
458
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-windows/device.rb', line 212</span>
459
+
460
+ <span class='kw'>def</span> <span class='id identifier rubyid_all_by_type'>all_by_type</span>
461
+ <span class='lbrace'>{</span> <span class='label'>input:</span> <span class='id identifier rubyid_inputs'>inputs</span><span class='comma'>,</span> <span class='label'>output:</span> <span class='id identifier rubyid_outputs'>outputs</span> <span class='rbrace'>}</span>
462
+ <span class='kw'>end</span></pre>
463
+ </td>
464
+ </tr>
465
+ </table>
466
+ </div>
467
+
468
+ <div class="method_details ">
469
+ <h3 class="signature " id="enumerate-class_method">
470
+
471
+ .<strong>enumerate</strong>(direction, count, klass) &#x21d2; <tt>Array&lt;<span class='object_link'><a href="Input.html" title="MIDICommunicationsWindows::Input (class)">Input</a></span>&gt;</tt>, <tt>Array&lt;<span class='object_link'><a href="Output.html" title="MIDICommunicationsWindows::Output (class)">Output</a></span>&gt;</tt>
472
+
473
+
474
+
475
+
476
+
477
+ </h3><div class="docstring">
478
+ <div class="discussion">
479
+ <p class="note private">
480
+ <strong>This method is part of a private API.</strong>
481
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
482
+ </p>
483
+ <p>Asks WinMM what ports exist, reusing the wrapper for each one that was
484
+ already there.</p>
485
+ <p>The list is read afresh every time, so a port that appeared or went away
486
+ is reflected — but a port that is still present comes back as the object
487
+ it came back as last time. Otherwise <code>Input.first.open</code> and
488
+ <code>Input.first.gets</code> would be two different objects, and the second would
489
+ not be open.</p>
490
+ <p>&quot;Still present&quot; means the same index reporting the same name. The index
491
+ alone is not enough: WinMM renumbers, so index 1 after a device is
492
+ unplugged may be a different port than index 1 before, and handing back a
493
+ wrapper holding a handle to the old one would be worse than making a new
494
+ object.</p>
495
+
496
+ </div>
497
+ </div>
498
+ <div class="tags">
499
+ <p class="tag_title">Parameters:</p>
500
+ <ul class="param">
501
+
502
+ <li>
503
+
504
+ <span class='name'>direction</span>
505
+
506
+
507
+ <span class='type'>(<tt>Symbol</tt>)</span>
508
+
509
+
510
+
511
+ &mdash;
512
+ <div class='inline'><p><code>:input</code> or <code>:output</code></p></div>
513
+
514
+ </li>
515
+
516
+ <li>
517
+
518
+ <span class='name'>count</span>
519
+
520
+
521
+ <span class='type'>(<tt>Integer</tt>)</span>
522
+
523
+
524
+
525
+ &mdash;
526
+ <div class='inline'><p>how many ports WinMM reports for that direction</p></div>
527
+
528
+ </li>
529
+
530
+ <li>
531
+
532
+ <span class='name'>klass</span>
533
+
534
+
535
+ <span class='type'>(<tt>Class</tt>)</span>
536
+
537
+
538
+
539
+ &mdash;
540
+ <div class='inline'><p><span class='object_link'><a href="Input.html" title="MIDICommunicationsWindows::Input (class)">Input</a></span> or <span class='object_link'><a href="Output.html" title="MIDICommunicationsWindows::Output (class)">Output</a></span></p></div>
541
+
542
+ </li>
543
+
544
+ </ul>
545
+
546
+ <p class="tag_title">Returns:</p>
547
+ <ul class="return">
548
+
549
+ <li>
550
+
551
+
552
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Input.html" title="MIDICommunicationsWindows::Input (class)">Input</a></span>&gt;</tt>, <tt>Array&lt;<span class='object_link'><a href="Output.html" title="MIDICommunicationsWindows::Output (class)">Output</a></span>&gt;</tt>)</span>
553
+
554
+
555
+
556
+ </li>
557
+
558
+ </ul>
559
+
560
+ </div><table class="source_code">
561
+ <tr>
562
+ <td>
563
+ <pre class="lines">
564
+
565
+
566
+ 260
567
+ 261
568
+ 262
569
+ 263
570
+ 264
571
+ 265
572
+ 266
573
+ 267
574
+ 268
575
+ 269
576
+ 270
577
+ 271</pre>
578
+ </td>
579
+ <td>
580
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-windows/device.rb', line 260</span>
581
+
582
+ <span class='kw'>def</span> <span class='id identifier rubyid_enumerate'>enumerate</span><span class='lparen'>(</span><span class='id identifier rubyid_direction'>direction</span><span class='comma'>,</span> <span class='id identifier rubyid_count'>count</span><span class='comma'>,</span> <span class='id identifier rubyid_klass'>klass</span><span class='rparen'>)</span>
583
+ <span class='ivar'>@ports_semaphore</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
584
+ <span class='id identifier rubyid_known'>known</span> <span class='op'>=</span> <span class='ivar'>@ports</span><span class='lbracket'>[</span><span class='id identifier rubyid_direction'>direction</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_h'>to_h</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_port'>port</span><span class='op'>|</span> <span class='lbracket'>[</span><span class='id identifier rubyid_port'>port</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='id identifier rubyid_port'>port</span><span class='rbracket'>]</span> <span class='rbrace'>}</span>
585
+
586
+ <span class='ivar'>@ports</span><span class='lbracket'>[</span><span class='id identifier rubyid_direction'>direction</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_count'>count</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_id'>id</span><span class='op'>|</span>
587
+ <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_direction'>direction</span> <span class='op'>==</span> <span class='symbol'>:input</span> <span class='op'>?</span> <span class='id identifier rubyid_input_name'>input_name</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_output_name'>output_name</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
588
+ <span class='id identifier rubyid_previous'>previous</span> <span class='op'>=</span> <span class='id identifier rubyid_known'>known</span><span class='lbracket'>[</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span>
589
+
590
+ <span class='id identifier rubyid_previous'>previous</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_previous'>previous</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>?</span> <span class='id identifier rubyid_previous'>previous</span> <span class='op'>:</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
591
+ <span class='kw'>end</span>
592
+ <span class='kw'>end</span>
593
+ <span class='kw'>end</span></pre>
594
+ </td>
595
+ </tr>
596
+ </table>
597
+ </div>
598
+
599
+ <div class="method_details ">
600
+ <h3 class="signature " id="input_name-class_method">
601
+
602
+ .<strong>input_name</strong>(id) &#x21d2; <tt>String</tt>
603
+
604
+
605
+
606
+
607
+
608
+ </h3><div class="docstring">
609
+ <div class="discussion">
610
+ <p class="note private">
611
+ <strong>This method is part of a private API.</strong>
612
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
613
+ </p>
614
+ <p>The name of an input port.</p>
615
+
616
+ </div>
617
+ </div>
618
+ <div class="tags">
619
+ <p class="tag_title">Parameters:</p>
620
+ <ul class="param">
621
+
622
+ <li>
623
+
624
+ <span class='name'>id</span>
625
+
626
+
627
+ <span class='type'>(<tt>Integer</tt>)</span>
628
+
629
+
630
+
631
+ &mdash;
632
+ <div class='inline'><p>the port's WinMM index</p></div>
633
+
634
+ </li>
635
+
636
+ </ul>
637
+
638
+ <p class="tag_title">Returns:</p>
639
+ <ul class="return">
640
+
641
+ <li>
642
+
643
+
644
+ <span class='type'>(<tt>String</tt>)</span>
645
+
646
+
647
+
648
+ </li>
649
+
650
+ </ul>
651
+
652
+ </div><table class="source_code">
653
+ <tr>
654
+ <td>
655
+ <pre class="lines">
656
+
657
+
658
+ 278
659
+ 279
660
+ 280
661
+ 281
662
+ 282
663
+ 283
664
+ 284
665
+ 285</pre>
666
+ </td>
667
+ <td>
668
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-windows/device.rb', line 278</span>
669
+
670
+ <span class='kw'>def</span> <span class='id identifier rubyid_input_name'>input_name</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
671
+ <span class='id identifier rubyid_capabilities'>capabilities</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="API.html" title="MIDICommunicationsWindows::API (module)">API</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="API/MIDIInCaps.html" title="MIDICommunicationsWindows::API::MIDIInCaps (class)">MIDIInCaps</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
672
+
673
+ <span class='const'><span class='object_link'><a href="API.html" title="MIDICommunicationsWindows::API (module)">API</a></span></span><span class='period'>.</span><span class='id identifier rubyid_check!'><span class='object_link'><a href="API.html#check!-class_method" title="MIDICommunicationsWindows::API.check! (method)">check!</a></span></span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="API.html" title="MIDICommunicationsWindows::API (module)">API</a></span></span><span class='period'>.</span><span class='id identifier rubyid_midiInGetDevCapsW'>midiInGetDevCapsW</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='id identifier rubyid_capabilities'>capabilities</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="API.html" title="MIDICommunicationsWindows::API (module)">API</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="API/MIDIInCaps.html" title="MIDICommunicationsWindows::API::MIDIInCaps (class)">MIDIInCaps</a></span></span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='rparen'>)</span><span class='comma'>,</span>
674
+ <span class='symbol'>:midiInGetDevCapsW</span><span class='comma'>,</span> <span class='symbol'>:input</span><span class='rparen'>)</span>
675
+
676
+ <span class='id identifier rubyid_port_name'>port_name</span><span class='lparen'>(</span><span class='id identifier rubyid_capabilities'>capabilities</span><span class='rparen'>)</span>
677
+ <span class='kw'>end</span></pre>
678
+ </td>
679
+ </tr>
680
+ </table>
681
+ </div>
682
+
683
+ <div class="method_details ">
684
+ <h3 class="signature " id="inputs-class_method">
685
+
686
+ .<strong>inputs</strong> &#x21d2; <tt>Array&lt;<span class='object_link'><a href="Input.html" title="MIDICommunicationsWindows::Input (class)">Input</a></span>&gt;</tt>
687
+
688
+
689
+
690
+
691
+
692
+ </h3><div class="docstring">
693
+ <div class="discussion">
694
+ <p>Every input port WinMM offers.</p>
695
+
696
+ </div>
697
+ </div>
698
+ <div class="tags">
699
+
700
+ <p class="tag_title">Returns:</p>
701
+ <ul class="return">
702
+
703
+ <li>
704
+
705
+
706
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Input.html" title="MIDICommunicationsWindows::Input (class)">Input</a></span>&gt;</tt>)</span>
707
+
708
+
709
+
710
+ </li>
711
+
712
+ </ul>
713
+ <p class="tag_title">Raises:</p>
714
+ <ul class="raise">
715
+
716
+ <li>
717
+
718
+
719
+ <span class='type'>(<tt><span class='object_link'><a href="Error.html" title="MIDICommunicationsWindows::Error (class)">Error</a></span></tt>)</span>
720
+
721
+
722
+
723
+ &mdash;
724
+ <div class='inline'><p>if WinMM refuses to describe a port it has just counted</p></div>
725
+
726
+ </li>
727
+
728
+ </ul>
729
+
730
+ </div><table class="source_code">
731
+ <tr>
732
+ <td>
733
+ <pre class="lines">
734
+
735
+
736
+ 225
737
+ 226
738
+ 227</pre>
739
+ </td>
740
+ <td>
741
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-windows/device.rb', line 225</span>
742
+
743
+ <span class='kw'>def</span> <span class='id identifier rubyid_inputs'>inputs</span>
744
+ <span class='id identifier rubyid_enumerate'>enumerate</span><span class='lparen'>(</span><span class='symbol'>:input</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="API.html" title="MIDICommunicationsWindows::API (module)">API</a></span></span><span class='period'>.</span><span class='id identifier rubyid_midiInGetNumDevs'>midiInGetNumDevs</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Input.html" title="MIDICommunicationsWindows::Input (class)">Input</a></span></span><span class='rparen'>)</span>
745
+ <span class='kw'>end</span></pre>
746
+ </td>
747
+ </tr>
748
+ </table>
749
+ </div>
750
+
751
+ <div class="method_details ">
752
+ <h3 class="signature " id="output_name-class_method">
753
+
754
+ .<strong>output_name</strong>(id) &#x21d2; <tt>String</tt>
755
+
756
+
757
+
758
+
759
+
760
+ </h3><div class="docstring">
761
+ <div class="discussion">
762
+ <p class="note private">
763
+ <strong>This method is part of a private API.</strong>
764
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
765
+ </p>
766
+ <p>The name of an output port.</p>
767
+
768
+ </div>
769
+ </div>
770
+ <div class="tags">
771
+ <p class="tag_title">Parameters:</p>
772
+ <ul class="param">
773
+
774
+ <li>
775
+
776
+ <span class='name'>id</span>
777
+
778
+
779
+ <span class='type'>(<tt>Integer</tt>)</span>
780
+
781
+
782
+
783
+ &mdash;
784
+ <div class='inline'><p>the port's WinMM index</p></div>
785
+
786
+ </li>
787
+
788
+ </ul>
789
+
790
+ <p class="tag_title">Returns:</p>
791
+ <ul class="return">
792
+
793
+ <li>
794
+
795
+
796
+ <span class='type'>(<tt>String</tt>)</span>
797
+
798
+
799
+
800
+ </li>
801
+
802
+ </ul>
803
+
804
+ </div><table class="source_code">
805
+ <tr>
806
+ <td>
807
+ <pre class="lines">
808
+
809
+
810
+ 292
811
+ 293
812
+ 294
813
+ 295
814
+ 296
815
+ 297
816
+ 298
817
+ 299</pre>
818
+ </td>
819
+ <td>
820
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-windows/device.rb', line 292</span>
821
+
822
+ <span class='kw'>def</span> <span class='id identifier rubyid_output_name'>output_name</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
823
+ <span class='id identifier rubyid_capabilities'>capabilities</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="API.html" title="MIDICommunicationsWindows::API (module)">API</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="API/MIDIOutCaps.html" title="MIDICommunicationsWindows::API::MIDIOutCaps (class)">MIDIOutCaps</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
824
+
825
+ <span class='const'><span class='object_link'><a href="API.html" title="MIDICommunicationsWindows::API (module)">API</a></span></span><span class='period'>.</span><span class='id identifier rubyid_check!'><span class='object_link'><a href="API.html#check!-class_method" title="MIDICommunicationsWindows::API.check! (method)">check!</a></span></span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="API.html" title="MIDICommunicationsWindows::API (module)">API</a></span></span><span class='period'>.</span><span class='id identifier rubyid_midiOutGetDevCapsW'>midiOutGetDevCapsW</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='id identifier rubyid_capabilities'>capabilities</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="API.html" title="MIDICommunicationsWindows::API (module)">API</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="API/MIDIOutCaps.html" title="MIDICommunicationsWindows::API::MIDIOutCaps (class)">MIDIOutCaps</a></span></span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='rparen'>)</span><span class='comma'>,</span>
826
+ <span class='symbol'>:midiOutGetDevCapsW</span><span class='comma'>,</span> <span class='symbol'>:output</span><span class='rparen'>)</span>
827
+
828
+ <span class='id identifier rubyid_port_name'>port_name</span><span class='lparen'>(</span><span class='id identifier rubyid_capabilities'>capabilities</span><span class='rparen'>)</span>
829
+ <span class='kw'>end</span></pre>
830
+ </td>
831
+ </tr>
832
+ </table>
833
+ </div>
834
+
835
+ <div class="method_details ">
836
+ <h3 class="signature " id="outputs-class_method">
837
+
838
+ .<strong>outputs</strong> &#x21d2; <tt>Array&lt;<span class='object_link'><a href="Output.html" title="MIDICommunicationsWindows::Output (class)">Output</a></span>&gt;</tt>
839
+
840
+
841
+
842
+
843
+
844
+ </h3><div class="docstring">
845
+ <div class="discussion">
846
+ <p>Every output port WinMM offers.</p>
847
+ <p>Note that this does not include the MIDI Mapper, which WinMM addresses by
848
+ the reserved id <code>-1</code> and does not count among its devices.</p>
849
+
850
+ </div>
851
+ </div>
852
+ <div class="tags">
853
+
854
+ <p class="tag_title">Returns:</p>
855
+ <ul class="return">
856
+
857
+ <li>
858
+
859
+
860
+ <span class='type'>(<tt>Array&lt;<span class='object_link'><a href="Output.html" title="MIDICommunicationsWindows::Output (class)">Output</a></span>&gt;</tt>)</span>
861
+
862
+
863
+
864
+ </li>
865
+
866
+ </ul>
867
+ <p class="tag_title">Raises:</p>
868
+ <ul class="raise">
869
+
870
+ <li>
871
+
872
+
873
+ <span class='type'>(<tt><span class='object_link'><a href="Error.html" title="MIDICommunicationsWindows::Error (class)">Error</a></span></tt>)</span>
874
+
875
+
876
+
877
+ &mdash;
878
+ <div class='inline'><p>if WinMM refuses to describe a port it has just counted</p></div>
879
+
880
+ </li>
881
+
882
+ </ul>
883
+
884
+ </div><table class="source_code">
885
+ <tr>
886
+ <td>
887
+ <pre class="lines">
888
+
889
+
890
+ 236
891
+ 237
892
+ 238</pre>
893
+ </td>
894
+ <td>
895
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-windows/device.rb', line 236</span>
896
+
897
+ <span class='kw'>def</span> <span class='id identifier rubyid_outputs'>outputs</span>
898
+ <span class='id identifier rubyid_enumerate'>enumerate</span><span class='lparen'>(</span><span class='symbol'>:output</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="API.html" title="MIDICommunicationsWindows::API (module)">API</a></span></span><span class='period'>.</span><span class='id identifier rubyid_midiOutGetNumDevs'>midiOutGetNumDevs</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="Output.html" title="MIDICommunicationsWindows::Output (class)">Output</a></span></span><span class='rparen'>)</span>
899
+ <span class='kw'>end</span></pre>
900
+ </td>
901
+ </tr>
902
+ </table>
903
+ </div>
904
+
905
+ <div class="method_details ">
906
+ <h3 class="signature " id="port_name-class_method">
907
+
908
+ .<strong>port_name</strong>(capabilities) &#x21d2; <tt>String</tt>
909
+
910
+
911
+
912
+
913
+
914
+ </h3><div class="docstring">
915
+ <div class="discussion">
916
+ <p class="note private">
917
+ <strong>This method is part of a private API.</strong>
918
+ You should avoid using this method if possible, as it may be removed or be changed in the future.
919
+ </p>
920
+ <p>Reads <code>szPname</code> out of a capabilities structure.</p>
921
+
922
+ </div>
923
+ </div>
924
+ <div class="tags">
925
+ <p class="tag_title">Parameters:</p>
926
+ <ul class="param">
927
+
928
+ <li>
929
+
930
+ <span class='name'>capabilities</span>
931
+
932
+
933
+ <span class='type'>(<tt><span class='object_link'><a href="API/MIDIInCaps.html" title="MIDICommunicationsWindows::API::MIDIInCaps (class)">API::MIDIInCaps</a></span></tt>, <tt><span class='object_link'><a href="API/MIDIOutCaps.html" title="MIDICommunicationsWindows::API::MIDIOutCaps (class)">API::MIDIOutCaps</a></span></tt>)</span>
934
+
935
+
936
+
937
+ </li>
938
+
939
+ </ul>
940
+
941
+ <p class="tag_title">Returns:</p>
942
+ <ul class="return">
943
+
944
+ <li>
945
+
946
+
947
+ <span class='type'>(<tt>String</tt>)</span>
948
+
949
+
950
+
951
+ </li>
952
+
953
+ </ul>
954
+
955
+ </div><table class="source_code">
956
+ <tr>
957
+ <td>
958
+ <pre class="lines">
959
+
960
+
961
+ 306
962
+ 307
963
+ 308</pre>
964
+ </td>
965
+ <td>
966
+ <pre class="code"><span class="info file"># File 'lib/midi-communications-windows/device.rb', line 306</span>
967
+
968
+ <span class='kw'>def</span> <span class='id identifier rubyid_port_name'>port_name</span><span class='lparen'>(</span><span class='id identifier rubyid_capabilities'>capabilities</span><span class='rparen'>)</span>
969
+ <span class='const'><span class='object_link'><a href="API.html" title="MIDICommunicationsWindows::API (module)">API</a></span></span><span class='period'>.</span><span class='id identifier rubyid_read_wide_string'><span class='object_link'><a href="API.html#read_wide_string-class_method" title="MIDICommunicationsWindows::API.read_wide_string (method)">read_wide_string</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_capabilities'>capabilities</span><span class='period'>.</span><span class='id identifier rubyid_to_ptr'>to_ptr</span> <span class='op'>+</span> <span class='id identifier rubyid_capabilities'>capabilities</span><span class='period'>.</span><span class='id identifier rubyid_offset_of'>offset_of</span><span class='lparen'>(</span><span class='symbol'>:szPname</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="API.html" title="MIDICommunicationsWindows::API (module)">API</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="API.html#MAXPNAMELEN-constant" title="MIDICommunicationsWindows::API::MAXPNAMELEN (constant)">MAXPNAMELEN</a></span></span><span class='rparen'>)</span>
970
+ <span class='kw'>end</span></pre>
971
+ </td>
972
+ </tr>
973
+ </table>
974
+ </div>
975
+
976
+ </div>
977
+
978
+ </div>
979
+
980
+ <div id="footer">
981
+ Generated on Sun Sep 6 21:20:52 2026 by
982
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
983
+ 0.9.45 (ruby-3.4.7).
984
+ </div>
985
+
986
+ </div>
987
+ </body>
988
+ </html>