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.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.version +6 -0
- data/.yardoc/checksums +8 -0
- data/.yardoc/complete +0 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/.yardopts +8 -0
- data/Gemfile +3 -0
- data/LICENSE +165 -0
- data/README.md +176 -0
- data/Rakefile +13 -0
- data/doc/MIDICommunicationsWindows/API/MIDIHdr.html +144 -0
- data/doc/MIDICommunicationsWindows/API/MIDIInCaps.html +142 -0
- data/doc/MIDICommunicationsWindows/API/MIDIOutCaps.html +140 -0
- data/doc/MIDICommunicationsWindows/API/MSG.html +143 -0
- data/doc/MIDICommunicationsWindows/API.html +981 -0
- data/doc/MIDICommunicationsWindows/Device/ClassMethods.html +365 -0
- data/doc/MIDICommunicationsWindows/Device/InstanceMethods.html +1096 -0
- data/doc/MIDICommunicationsWindows/Device.html +988 -0
- data/doc/MIDICommunicationsWindows/Error.html +438 -0
- data/doc/MIDICommunicationsWindows/Input.html +1554 -0
- data/doc/MIDICommunicationsWindows/Message.html +700 -0
- data/doc/MIDICommunicationsWindows/Output.html +1697 -0
- data/doc/MIDICommunicationsWindows/TypeConversion.html +369 -0
- data/doc/MIDICommunicationsWindows.html +210 -0
- data/doc/_index.html +262 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +206 -0
- data/doc/css/style.css +1089 -0
- data/doc/file.README.html +240 -0
- data/doc/file.testing-on-windows.html +253 -0
- data/doc/file_list.html +64 -0
- data/doc/frames.html +22 -0
- data/doc/index.html +240 -0
- data/doc/js/app.js +801 -0
- data/doc/js/full_list.js +334 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +382 -0
- data/doc/top-level-namespace.html +112 -0
- data/docs/testing-on-windows.md +222 -0
- data/examples/input.rb +27 -0
- data/examples/list_ports.rb +17 -0
- data/examples/output.rb +22 -0
- data/examples/sysex_output.rb +15 -0
- data/lib/midi-communications-windows/api.rb +340 -0
- data/lib/midi-communications-windows/device.rb +310 -0
- data/lib/midi-communications-windows/input.rb +486 -0
- data/lib/midi-communications-windows/message.rb +133 -0
- data/lib/midi-communications-windows/output.rb +206 -0
- data/lib/midi-communications-windows/type_conversion.rb +20 -0
- data/lib/midi-communications-windows/version.rb +4 -0
- data/lib/midi-communications-windows.rb +76 -0
- data/midi-communications-windows.gemspec +32 -0
- metadata +220 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: d7c6d6e900a9daa9c9a95c48a2c5b68b97bf02cd35694a0a5110cbe5ac9f1f9b
|
|
4
|
+
data.tar.gz: b2135a883c9648f77e6dbe99a5f1b25941c595f39c28dba3a5968d85f6b4d598
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 294cfb3185f4fb694d5769fb43643260632772e9e7eea8be47691b5be92f65a64e51bf5f31b087a85a7e780d98532eca59a7311dec5d1b477cbc375b4836c884
|
|
7
|
+
data.tar.gz: bd6e9bc0bf14f7607d7d014f45e833311c874f56e58082c16bc7191030d050f8a33b4e7817b80dc8c92baa161f9c45754969b2ae837f2d37170a0a44193a2f8e
|
data/.gitignore
ADDED
data/.version
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Configuración de versión para midi-communications-windows
|
|
2
|
+
GEM_NAME="midi-communications-windows"
|
|
3
|
+
MODULE_NAME="MIDICommunicationsWindows"
|
|
4
|
+
VERSION_FILE="lib/midi-communications-windows/version.rb"
|
|
5
|
+
GEMSPEC_FILE="midi-communications-windows.gemspec"
|
|
6
|
+
TEST_COMMAND="bundle exec rake test"
|
data/.yardoc/checksums
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
lib/midi-communications-windows.rb 30d820176659ee7ae703f6b02354e7674b3c1f5d
|
|
2
|
+
lib/midi-communications-windows/api.rb ed16c89b3a2e85a37aed43962db414995a50294d
|
|
3
|
+
lib/midi-communications-windows/input.rb 36e58891d1c604dd4b2f333382a4010660d47868
|
|
4
|
+
lib/midi-communications-windows/device.rb 9f151193d144c298c064592ee21d44111f968d01
|
|
5
|
+
lib/midi-communications-windows/output.rb 3069d46892268c529d999363bd05fac891e5f4fc
|
|
6
|
+
lib/midi-communications-windows/message.rb 2390946620b244ec12a6b373e003304ef9c29e4d
|
|
7
|
+
lib/midi-communications-windows/version.rb 3dbf5650d0b320f6164b3791f859d2551162dc0a
|
|
8
|
+
lib/midi-communications-windows/type_conversion.rb dae7dc5109d955f4693920fa173f5c143dcb7bf1
|
data/.yardoc/complete
ADDED
|
File without changes
|
|
Binary file
|
|
Binary file
|
data/.yardoc/proxy_types
ADDED
|
Binary file
|
data/.yardopts
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
data/README.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# MIDI Communications Windows Layer
|
|
2
|
+
|
|
3
|
+
[](https://www.ruby-lang.org/)
|
|
4
|
+
[](https://www.gnu.org/licenses/lgpl-3.0.html)
|
|
5
|
+
|
|
6
|
+
**Realtime MIDI IO with Ruby for Windows.**
|
|
7
|
+
|
|
8
|
+
Access the [Windows Multimedia (WinMM) MIDI API](https://learn.microsoft.com/en-us/windows/win32/multimedia/midi-reference) with Ruby.
|
|
9
|
+
|
|
10
|
+
This library is part of a suite of Ruby libraries for MIDI:
|
|
11
|
+
|
|
12
|
+
| Function | Library |
|
|
13
|
+
| --- | --- |
|
|
14
|
+
| MIDI Events representation | [MIDI Events](https://github.com/javier-sy/midi-events) |
|
|
15
|
+
| MIDI Data parsing | [MIDI Parser](https://github.com/javier-sy/midi-parser) |
|
|
16
|
+
| MIDI communication with Instruments and Control Surfaces | [MIDI Communications](https://github.com/javier-sy/midi-communications) |
|
|
17
|
+
| Low level MIDI interface to MacOS | [MIDI Communications MacOS Layer](https://github.com/javier-sy/midi-communications-macos) |
|
|
18
|
+
| Low level MIDI interface to Windows | [MIDI Communications Windows Layer](https://github.com/javier-sy/midi-communications-windows) (this library) |
|
|
19
|
+
| Low level MIDI interface to Linux | **TO DO** (by now [MIDI Communications](https://github.com/javier-sy/midi-communications) uses [alsa-rawmidi](http://github.com/arirusso/alsa-rawmidi)) |
|
|
20
|
+
| Low level MIDI interface to JRuby | **TO DO** (by now [MIDI Communications](https://github.com/javier-sy/midi-communications) uses [midi-jruby](http://github.com/arirusso/midi-jruby)) |
|
|
21
|
+
|
|
22
|
+
## Status
|
|
23
|
+
|
|
24
|
+
**Early.** Everything is written and has been exercised end to end on Windows 11
|
|
25
|
+
25H2 against system loopback endpoints: enumeration, short messages in both
|
|
26
|
+
directions, System Exclusive in both directions including a message larger than
|
|
27
|
+
the whole buffer queue, twenty open/close cycles, and the error path. What has
|
|
28
|
+
not been exercised is anything needing real hardware — a physical interface slow
|
|
29
|
+
enough to make `Output`'s System Exclusive wait mean something, and a port
|
|
30
|
+
appearing or disappearing while the program runs.
|
|
31
|
+
|
|
32
|
+
The version stays in the 0.0.x series because that was a virtual machine with no
|
|
33
|
+
MIDI hardware in it, not because anything is known to be missing. It will not be
|
|
34
|
+
published to RubyGems until a physical MIDI interface has closed the items
|
|
35
|
+
[`docs/testing-on-windows.md`](docs/testing-on-windows.md) lists as untestable
|
|
36
|
+
without one.
|
|
37
|
+
|
|
38
|
+
That document is also how to rebuild the test environment: it is the procedure
|
|
39
|
+
these measurements were taken with, including how to make two ports collide in
|
|
40
|
+
WinMM's 31 characters of name.
|
|
41
|
+
|
|
42
|
+
### One thing worth knowing before you use it
|
|
43
|
+
|
|
44
|
+
`Input#gets` **waits**. It does not return an empty array when nothing has
|
|
45
|
+
arrived; it blocks until something does, and then returns everything that
|
|
46
|
+
accumulated. Calling it on a quiet port looks exactly like a hung program. That
|
|
47
|
+
is deliberate — `Musa::Clock::InputMidiClock` reads in a loop with no delay of
|
|
48
|
+
its own and relies on it — but it will surprise anyone arriving from an API that
|
|
49
|
+
polls.
|
|
50
|
+
|
|
51
|
+
## Requirements
|
|
52
|
+
|
|
53
|
+
* [ffi](http://github.com/ffi/ffi)
|
|
54
|
+
|
|
55
|
+
Nothing else. `winmm.dll` is part of Windows, so this gem binds a library that
|
|
56
|
+
is already on the machine and ships no compiled artifact of its own.
|
|
57
|
+
|
|
58
|
+
### Which versions of Windows
|
|
59
|
+
|
|
60
|
+
**By construction, old ones.** Everything this gem calls is the oldest MIDI API
|
|
61
|
+
Windows has — `midiInOpen`, `midiOutShortMsg`, `midiOutLongMsg` and their
|
|
62
|
+
neighbours — plus three functions for a thread's message queue, `GetMessageW`,
|
|
63
|
+
`PeekMessageW` and `PostThreadMessageW`. All of it, the Unicode entry points
|
|
64
|
+
included, dates from the NT era. Nothing here calls Windows MIDI Services, which
|
|
65
|
+
means nothing here needs Windows 11.
|
|
66
|
+
|
|
67
|
+
What changes on an older system is not whether the gem works but what the
|
|
68
|
+
platform gives it. Before Windows MIDI Services a MIDI port is **exclusive** —
|
|
69
|
+
one program at a time — and there are no system loopback endpoints, so routing
|
|
70
|
+
MIDI between applications on one machine needs a third-party driver such as
|
|
71
|
+
loopMIDI. The same code, a poorer platform.
|
|
72
|
+
|
|
73
|
+
A 32-bit Ruby should also be fine: the two size checks that only hold on 64-bit
|
|
74
|
+
Windows are guarded, and the two that are checked everywhere describe structures
|
|
75
|
+
whose layout does not depend on the word size.
|
|
76
|
+
|
|
77
|
+
**None of which has been run.** The only system this has ever executed on is
|
|
78
|
+
Windows 11 25H2, in a virtual machine, on an x64 Ruby under ARM emulation. The
|
|
79
|
+
paragraphs above say what the code asks of Windows, not what has been observed;
|
|
80
|
+
treat them as a reason to expect it to work rather than as a report that it does.
|
|
81
|
+
|
|
82
|
+
Where the floor actually sits is a question about Ruby, not about this gem:
|
|
83
|
+
RubyInstaller recommends Windows 10 or 11 and publishes no hard cutoff.
|
|
84
|
+
|
|
85
|
+
## Installation
|
|
86
|
+
|
|
87
|
+
If you're using Bundler, add this line to your application's Gemfile:
|
|
88
|
+
|
|
89
|
+
`gem "midi-communications-windows"`
|
|
90
|
+
|
|
91
|
+
Otherwise
|
|
92
|
+
|
|
93
|
+
`gem install midi-communications-windows`
|
|
94
|
+
|
|
95
|
+
## Documentation
|
|
96
|
+
|
|
97
|
+
[rdoc](http://rubydoc.info/github/javier-sy/midi-communications-windows)
|
|
98
|
+
|
|
99
|
+
## Why WinMM and not one of the newer Windows MIDI APIs
|
|
100
|
+
|
|
101
|
+
Windows has three MIDI APIs a program could reach for, and as of February 2026
|
|
102
|
+
the oldest is the right one for Ruby.
|
|
103
|
+
|
|
104
|
+
**Windows MIDI Services** became generally available in Windows 11 in February
|
|
105
|
+
2026, replacing the MIDI stack underneath. Rather than retiring the older APIs,
|
|
106
|
+
Microsoft reconnected them to the new service, so a WinMM client needs nothing
|
|
107
|
+
installed to reach what the new stack provides — including the loopback
|
|
108
|
+
endpoints the system now creates itself, which is what previously required a
|
|
109
|
+
third-party driver.
|
|
110
|
+
|
|
111
|
+
Multi-client access arrives the same way, but **per endpoint, not per API**.
|
|
112
|
+
Measured on Windows 11 25H2 through this library: two clients opened the same
|
|
113
|
+
loopback input at once and both received every message, while a second open of
|
|
114
|
+
the classic `wdmaud` software synthesiser was refused with "The specified device
|
|
115
|
+
is already in use". Endpoints carried by the new transports are shared;
|
|
116
|
+
endpoints still on the old drivers are exclusive, as they always were. On
|
|
117
|
+
Windows 10 there is no Windows MIDI Services at all.
|
|
118
|
+
|
|
119
|
+
**The Windows MIDI Services App SDK** offers MIDI 2.0 and UMP, neither of which
|
|
120
|
+
this library needs: `midi-communications` and MusaDSL are MIDI 1.0 throughout.
|
|
121
|
+
It is published only as WinRT, and Microsoft's guidance is that other languages
|
|
122
|
+
obtain a WinRT projection from their toolchain. Ruby has none.
|
|
123
|
+
|
|
124
|
+
**WinRT `Windows.Devices.Midi`** is, under the new stack, another compatibility
|
|
125
|
+
layer onto the same service. It offers what WinMM offers, in exchange for
|
|
126
|
+
hand-written COM.
|
|
127
|
+
|
|
128
|
+
## Differences from the macOS layer
|
|
129
|
+
|
|
130
|
+
The two libraries implement the same contract over platforms that do not have
|
|
131
|
+
the same shape. Where they differ, they differ because the platforms do:
|
|
132
|
+
|
|
133
|
+
* **`manufacturer` and `model` are `nil`.** WinMM reports `wMid` and `wPid`,
|
|
134
|
+
numeric codes from a manufacturer registry that stopped being maintained in
|
|
135
|
+
the 1990s and that class-compliant USB devices almost all answer with
|
|
136
|
+
Microsoft's. Core MIDI reports real strings. Inventing text from the codes
|
|
137
|
+
would describe the code table, not the hardware.
|
|
138
|
+
* **`display_name` is the port name.** On macOS it is composed as
|
|
139
|
+
"manufacturer model (name)", which here would be a name wrapped in the
|
|
140
|
+
punctuation of two absent fields.
|
|
141
|
+
* **Port ids are unique within a direction, not across both.** A WinMM port is
|
|
142
|
+
identified by its index among inputs or among outputs, and that index is what
|
|
143
|
+
is passed to `midiInOpen`. Core MIDI numbers endpoints of both directions from
|
|
144
|
+
one counter. Input 0 and output 0 are both valid here, and unrelated.
|
|
145
|
+
* **Port names are truncated to 31 characters, and do not identify a port.**
|
|
146
|
+
That is all WinMM stores, and it drops the rest silently. Two loopback
|
|
147
|
+
endpoints whose names differed only past character 31 came back identical in
|
|
148
|
+
every field of `MIDIINCAPSW` — same name, same `wMid`, same `wPid`, same
|
|
149
|
+
`wTechnology` — distinguishable only by index. Core MIDI names are neither
|
|
150
|
+
truncated nor, in practice, ambiguous.
|
|
151
|
+
* **Enumeration is not cached, but wrappers are reused.** The macOS layer reads
|
|
152
|
+
the device list once and keeps it, so a device plugged in later is never seen.
|
|
153
|
+
Here WinMM is asked on every call, and a port still present comes back as the
|
|
154
|
+
same object it was before, so opening a port and then reading from it works
|
|
155
|
+
whether or not the caller kept the reference.
|
|
156
|
+
* **There is no packet-list parsing.** Core MIDI delivers a list of packets that
|
|
157
|
+
has to be walked; WinMM delivers one complete short message at a time, with
|
|
158
|
+
running status already resolved by the driver.
|
|
159
|
+
|
|
160
|
+
## Relationship to midi-winmm
|
|
161
|
+
|
|
162
|
+
This library is **not** derived from [midi-winmm](http://github.com/arirusso/midi-winmm),
|
|
163
|
+
which was written in 2011 for 32-bit Ruby. Windows is LLP64: on a 64-bit Ruby,
|
|
164
|
+
`unsigned long` is 32 bits while a `HANDLE` is 64, so that library's
|
|
165
|
+
`typedef :ulong, :HANDLE` truncates every handle it obtains. It also reads port
|
|
166
|
+
names through the ANSI entry points, which mangle any name that is not ASCII.
|
|
167
|
+
Both are addressed here by construction; see the notes in
|
|
168
|
+
`lib/midi-communications-windows/api.rb`.
|
|
169
|
+
|
|
170
|
+
## Author
|
|
171
|
+
|
|
172
|
+
* [Javier Sánchez Yeste](https://github.com/javier-sy)
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
[MIDI Communications Windows Layer](https://github.com/javier-sy/midi-communications-windows) Copyright (c) 2026 [Javier Sánchez Yeste](https://yeste.studio), licensed under LGPL 3.0 License
|
data/Rakefile
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
$LOAD_PATH.prepend __dir__
|
|
2
|
+
$LOAD_PATH.prepend File.join(__dir__, 'lib')
|
|
3
|
+
|
|
4
|
+
require 'rake'
|
|
5
|
+
require 'rake/testtask'
|
|
6
|
+
|
|
7
|
+
Rake::TestTask.new(:test) do |t|
|
|
8
|
+
t.libs << 'test'
|
|
9
|
+
t.test_files = FileList['test/**/*_test.rb']
|
|
10
|
+
t.verbose = true
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
task default: [:test]
|
|
@@ -0,0 +1,144 @@
|
|
|
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: MIDICommunicationsWindows::API::MIDIHdr
|
|
8
|
+
|
|
9
|
+
— 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::API::MIDIHdr";
|
|
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 (M)</a> »
|
|
42
|
+
<span class='title'><span class='object_link'><a href="../../MIDICommunicationsWindows.html" title="MIDICommunicationsWindows (module)">MIDICommunicationsWindows</a></span></span> » <span class='title'><span class='object_link'><a href="../API.html" title="MIDICommunicationsWindows::API (module)">API</a></span></span>
|
|
43
|
+
»
|
|
44
|
+
<span class="title">MIDIHdr</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>Class: MIDICommunicationsWindows::API::MIDIHdr
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
<span class="private note title">Private</span>
|
|
68
|
+
</h1>
|
|
69
|
+
<div class="box_info">
|
|
70
|
+
|
|
71
|
+
<dl>
|
|
72
|
+
<dt>Inherits:</dt>
|
|
73
|
+
<dd>
|
|
74
|
+
<span class="inheritName">FFI::Struct</span>
|
|
75
|
+
|
|
76
|
+
<ul class="fullTree">
|
|
77
|
+
<li>Object</li>
|
|
78
|
+
|
|
79
|
+
<li class="next">FFI::Struct</li>
|
|
80
|
+
|
|
81
|
+
<li class="next">MIDICommunicationsWindows::API::MIDIHdr</li>
|
|
82
|
+
|
|
83
|
+
</ul>
|
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
|
85
|
+
|
|
86
|
+
</dd>
|
|
87
|
+
</dl>
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
<dl>
|
|
100
|
+
<dt>Defined in:</dt>
|
|
101
|
+
<dd>lib/midi-communications-windows/api.rb
|
|
102
|
+
</dd>
|
|
103
|
+
</dl>
|
|
104
|
+
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<h2>Overview</h2><div class="docstring">
|
|
108
|
+
<div class="discussion">
|
|
109
|
+
<p class="note private">
|
|
110
|
+
<strong>This class is part of a private API.</strong>
|
|
111
|
+
You should avoid using this class if possible, as it may be removed or be changed in the future.
|
|
112
|
+
</p>
|
|
113
|
+
<p>A buffer handed to WinMM, used for System Exclusive in both directions.</p>
|
|
114
|
+
<p><code>dwReserved</code> really is an array of eight pointer-sized words. Declaring it
|
|
115
|
+
as a single word makes the structure too short, and WinMM writes past the
|
|
116
|
+
end of it. This layout measures 120 bytes on 64-bit Windows, which is what
|
|
117
|
+
WinMM there expects.</p>
|
|
118
|
+
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
<div class="tags">
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
<div id="footer">
|
|
137
|
+
Generated on Sun Sep 6 21:20:52 2026 by
|
|
138
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
139
|
+
0.9.45 (ruby-3.4.7).
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
</div>
|
|
143
|
+
</body>
|
|
144
|
+
</html>
|