├── .gitignore ├── LICENSE ├── README.md ├── inc └── mmddk.h ├── legacyExports.def ├── newExports.def ├── src ├── Common.hpp ├── Loader.cpp ├── Loader.hpp ├── OmniMIDI.cpp ├── OmniMIDI.hpp ├── Utils.cpp ├── Utils.hpp ├── WMMEntry.cpp ├── WinMM.cpp └── WinMM.hpp └── xmake.lua /.gitignore: -------------------------------------------------------------------------------- 1 | # Xmake cache 2 | .xmake/ 3 | build/ 4 | 5 | # MacOS Cache 6 | .DS_Store 7 | 8 | # VSCode 9 | .vscode/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |
4 | A group of functions, that allows you to bypass the Windows Multimedia API, thus getting rid of the lag caused by its slow buffer system. 5 |

6 | 7 | # F.A.Q. 8 | 9 | ## What does this do? 10 | Windows Multimedia Wrapper (as the name says), wraps around the default multimedia library in Windows, **winmm.dll**, and allows users to circumvent the extremely slow buffer that Microsoft has set in Windows 8.1 and Windows 10, when using the **midiOutShortMsg** call. 11 | 12 | ## Why did they make the function slower? 13 | I have no idea really.
14 | Aside from making it slower, the output latency *(MIDI app -> MIDI driver)* also got worse, since the function seems to make some useless checks on the message, which adds overhead.
15 | I don't know if it's for safety purposes, or they just did something wrong in the function itself. 16 | 17 | ## Was the patch really necessary? 18 | For me and other people, it was.
19 | I really like Black MIDIs, which is a genre of music characterised by its extreme note arts and melodies.
20 | Performance when playing them were okay, when using Windows XP/Vista/7, but Microsoft decided to **ruin** them on 8.x/10, so we had to find a way around it.
21 | The first iteration of the *"wrapper"* was literally just **copying winmm.dll from Windows 7**, and using it on Windows 8.x. That worked fine on everything, until Microsoft decided to make that *impossible* on Windows 10. Everytime an app tries to load 7's winmm.dll on 10, it'd just throw an error, complaining about a missing ordinal.
22 | For Windows 10, the second iteration was using **ReactOS' winmm.dll** on Windows 10. That also worked fine, aside from minor issues with the *timeGetTime* function (Which I fixed in later releases of the file).
23 | Then, I decided to work on a *wrapper*, which would import the functions from the **real** Windows Multimedia library *(Allowing users to use both Microsoft GS and MIDI input devices)*, while also getting rid of the lag caused by some weird overhead in **midiOutShortMsg** *(When using my MIDI driver, that is ;P)*.
24 | Long story short, it was a success. Everything works like it should, and people are happy. 25 | 26 | # Known bugs 27 | ## Windows Multimedia Wrapper stock patch 28 | - None, as far as I know. 29 | 30 | ## Windows Multimedia Wrapper DAW patch 31 | - None, as far as I know. 32 | 33 | # License 34 | See [LICENSE](LICENSE). 35 | -------------------------------------------------------------------------------- /inc/mmddk.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1998, Luiz Otavio L. Zorzella 3 | * 1999, Eric Pouech 4 | * 5 | * Purpose: multimedia declarations (external to WINMM & MMSYSTEM DLLs 6 | * for other DLLs (MCI, drivers...)) 7 | * 8 | * This library is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License as published by the Free Software Foundation; either 11 | * version 2.1 of the License, or (at your option) any later version. 12 | * 13 | * This library is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * Lesser General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public 19 | * License along with this library; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 21 | */ 22 | #ifndef __MMDDK_H 23 | #define __MMDDK_H 24 | 25 | #include 26 | #include 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | #define MAX_MIDIINDRV (16) 33 | /* For now I'm making 16 the maximum number of midi devices one can 34 | * have. This should be more than enough for everybody. But as a purist, 35 | * I intend to make it unbounded in the future, as soon as I figure 36 | * a good way to do so. 37 | */ 38 | #define MAX_MIDIOUTDRV (16) 39 | 40 | /* ================================== 41 | * Multimedia DDK compatible part 42 | * ================================== */ 43 | 44 | #include 45 | 46 | #define DRVM_INIT 100 47 | #define DRVM_EXIT 101 48 | #define DRVM_DISABLE 102 49 | #define DRVM_ENABLE 103 50 | 51 | /* messages that have IOCTL format 52 | * dw1 = NULL or handle 53 | * dw2 = NULL or ptr to DRVM_IOCTL_DATA 54 | * return is MMRESULT 55 | */ 56 | #define DRVM_IOCTL 0x100 57 | #define DRVM_ADD_THRU (DRVM_IOCTL+1) 58 | #define DRVM_REMOVE_THRU (DRVM_IOCTL+2) 59 | #define DRVM_IOCTL_LAST (DRVM_IOCTL+5) 60 | typedef struct { 61 | DWORD dwSize; /* size of this structure */ 62 | DWORD dwCmd; /* IOCTL command code, 0x80000000 and above reserved for system */ 63 | } DRVM_IOCTL_DATA, *LPDRVM_IOCTL_DATA; 64 | 65 | /* command code ranges for dwCmd field of DRVM_IOCTL message 66 | * - codes from 0 to 0x7FFFFFFF are user defined 67 | * - codes from 0x80000000 to 0xFFFFFFFF are reserved for future definition by microsoft 68 | */ 69 | #define DRVM_IOCTL_CMD_USER __MSABI_LONG(0x00000000) 70 | #define DRVM_IOCTL_CMD_SYSTEM __MSABI_LONG(0x80000000) 71 | 72 | #define DRVM_MAPPER 0x2000 73 | #define DRVM_USER 0x4000 74 | #define DRVM_MAPPER_STATUS (DRVM_MAPPER+0) 75 | #define DRVM_MAPPER_RECONFIGURE (DRVM_MAPPER+1) 76 | #define DRVM_MAPPER_PREFERRED_GET (DRVM_MAPPER+21) 77 | #define DRVM_MAPPER_CONSOLEVOICECOM_GET (DRVM_MAPPER+23) 78 | 79 | #define DRV_QUERYDRVENTRY (DRV_RESERVED + 1) 80 | #define DRV_QUERYDEVNODE (DRV_RESERVED + 2) 81 | #define DRV_QUERYNAME (DRV_RESERVED + 3) 82 | #define DRV_QUERYDRIVERIDS (DRV_RESERVED + 4) 83 | #define DRV_QUERYMAPPABLE (DRV_RESERVED + 5) 84 | #define DRV_QUERYMODULE (DRV_RESERVED + 9) 85 | #define DRV_PNPINSTALL (DRV_RESERVED + 11) 86 | #define DRV_QUERYDEVICEINTERFACE (DRV_RESERVED + 12) 87 | #define DRV_QUERYDEVICEINTERFACESIZE (DRV_RESERVED + 13) 88 | #define DRV_QUERYSTRINGID (DRV_RESERVED + 14) 89 | #define DRV_QUERYSTRINGIDSIZE (DRV_RESERVED + 15) 90 | #define DRV_QUERYIDFROMSTRINGID (DRV_RESERVED + 16) 91 | #define DRV_QUERYFUNCTIONINSTANCEID (DRV_RESERVED + 17) 92 | #define DRV_QUERYFUNCTIONINSTANCEIDSIZE (DRV_RESERVED + 18) 93 | 94 | #define DRVM_MAPPER_PREFERRED_FLAGS_PREFERREDONLY 0x00000001 95 | 96 | #define WODM_INIT DRVM_INIT 97 | #define WODM_GETNUMDEVS 3 98 | #define WODM_GETDEVCAPS 4 99 | #define WODM_OPEN 5 100 | #define WODM_CLOSE 6 101 | #define WODM_PREPARE 7 102 | #define WODM_UNPREPARE 8 103 | #define WODM_WRITE 9 104 | #define WODM_PAUSE 10 105 | #define WODM_RESTART 11 106 | #define WODM_RESET 12 107 | #define WODM_GETPOS 13 108 | #define WODM_GETPITCH 14 109 | #define WODM_SETPITCH 15 110 | #define WODM_GETVOLUME 16 111 | #define WODM_SETVOLUME 17 112 | #define WODM_GETPLAYBACKRATE 18 113 | #define WODM_SETPLAYBACKRATE 19 114 | #define WODM_BREAKLOOP 20 115 | #define WODM_PREFERRED 21 116 | 117 | #define WODM_MAPPER_STATUS (DRVM_MAPPER_STATUS + 0) 118 | #define WAVEOUT_MAPPER_STATUS_DEVICE 0 119 | #define WAVEOUT_MAPPER_STATUS_MAPPED 1 120 | #define WAVEOUT_MAPPER_STATUS_FORMAT 2 121 | 122 | #define WODM_BUSY 21 123 | 124 | #define WIDM_INIT DRVM_INIT 125 | #define WIDM_GETNUMDEVS 50 126 | #define WIDM_GETDEVCAPS 51 127 | #define WIDM_OPEN 52 128 | #define WIDM_CLOSE 53 129 | #define WIDM_PREPARE 54 130 | #define WIDM_UNPREPARE 55 131 | #define WIDM_ADDBUFFER 56 132 | #define WIDM_START 57 133 | #define WIDM_STOP 58 134 | #define WIDM_RESET 59 135 | #define WIDM_GETPOS 60 136 | #define WIDM_PREFERRED 61 137 | #define WIDM_MAPPER_STATUS (DRVM_MAPPER_STATUS + 0) 138 | #define WAVEIN_MAPPER_STATUS_DEVICE 0 139 | #define WAVEIN_MAPPER_STATUS_MAPPED 1 140 | #define WAVEIN_MAPPER_STATUS_FORMAT 2 141 | 142 | #define MODM_INIT DRVM_INIT 143 | #define MODM_GETNUMDEVS 1 144 | #define MODM_GETDEVCAPS 2 145 | #define MODM_OPEN 3 146 | #define MODM_CLOSE 4 147 | #define MODM_PREPARE 5 148 | #define MODM_UNPREPARE 6 149 | #define MODM_DATA 7 150 | #define MODM_LONGDATA 8 151 | #define MODM_RESET 9 152 | #define MODM_GETVOLUME 10 153 | #define MODM_SETVOLUME 11 154 | #define MODM_CACHEPATCHES 12 155 | #define MODM_CACHEDRUMPATCHES 13 156 | 157 | #if (WINVER >= 0x400) 158 | #define MODM_STRMDATA 14 159 | #define MODM_GETPOS 17 160 | #define MODM_PAUSE 18 161 | #define MODM_RESTART 19 162 | #define MODM_STOP 20 163 | #define MODM_PROPERTIES 21 164 | #define MODM_PREFERRED 22 165 | #define MODM_RECONFIGURE (0x4000+0x0768) 166 | #endif 167 | 168 | #define MIDM_INIT DRVM_INIT 169 | #define MIDM_GETNUMDEVS 53 170 | #define MIDM_GETDEVCAPS 54 171 | #define MIDM_OPEN 55 172 | #define MIDM_CLOSE 56 173 | #define MIDM_PREPARE 57 174 | #define MIDM_UNPREPARE 58 175 | #define MIDM_ADDBUFFER 59 176 | #define MIDM_START 60 177 | #define MIDM_STOP 61 178 | #define MIDM_RESET 62 179 | 180 | 181 | #define AUXM_INIT DRVM_INIT 182 | #define AUXDM_GETNUMDEVS 3 183 | #define AUXDM_GETDEVCAPS 4 184 | #define AUXDM_GETVOLUME 5 185 | #define AUXDM_SETVOLUME 6 186 | 187 | #define MXDM_INIT DRVM_INIT 188 | #define MXDM_USER DRVM_USER 189 | #define MXDM_MAPPER DRVM_MAPPER 190 | 191 | #define MXDM_GETNUMDEVS 1 192 | #define MXDM_GETDEVCAPS 2 193 | #define MXDM_OPEN 3 194 | #define MXDM_CLOSE 4 195 | #define MXDM_GETLINEINFO 5 196 | #define MXDM_GETLINECONTROLS 6 197 | #define MXDM_GETCONTROLDETAILS 7 198 | #define MXDM_SETCONTROLDETAILS 8 199 | 200 | /* pre-defined joystick types */ 201 | #define JOY_HW_NONE 0 202 | #define JOY_HW_CUSTOM 1 203 | #define JOY_HW_2A_2B_GENERIC 2 204 | #define JOY_HW_2A_4B_GENERIC 3 205 | #define JOY_HW_2B_GAMEPAD 4 206 | #define JOY_HW_2B_FLIGHTYOKE 5 207 | #define JOY_HW_2B_FLIGHTYOKETHROTTLE 6 208 | #define JOY_HW_3A_2B_GENERIC 7 209 | #define JOY_HW_3A_4B_GENERIC 8 210 | #define JOY_HW_4B_GAMEPAD 9 211 | #define JOY_HW_4B_FLIGHTYOKE 10 212 | #define JOY_HW_4B_FLIGHTYOKETHROTTLE 11 213 | #define JOY_HW_LASTENTRY 12 214 | 215 | /* calibration flags */ 216 | #define JOY_ISCAL_XY __MSABI_LONG(0x00000001) /* XY are calibrated */ 217 | #define JOY_ISCAL_Z __MSABI_LONG(0x00000002) /* Z is calibrated */ 218 | #define JOY_ISCAL_R __MSABI_LONG(0x00000004) /* R is calibrated */ 219 | #define JOY_ISCAL_U __MSABI_LONG(0x00000008) /* U is calibrated */ 220 | #define JOY_ISCAL_V __MSABI_LONG(0x00000010) /* V is calibrated */ 221 | #define JOY_ISCAL_POV __MSABI_LONG(0x00000020) /* POV is calibrated */ 222 | 223 | /* point of view constants */ 224 | #define JOY_POV_NUMDIRS 4 225 | #define JOY_POVVAL_FORWARD 0 226 | #define JOY_POVVAL_BACKWARD 1 227 | #define JOY_POVVAL_LEFT 2 228 | #define JOY_POVVAL_RIGHT 3 229 | 230 | /* Specific settings for joystick hardware */ 231 | #define JOY_HWS_HASZ __MSABI_LONG(0x00000001) /* has Z info? */ 232 | #define JOY_HWS_HASPOV __MSABI_LONG(0x00000002) /* point of view hat present */ 233 | #define JOY_HWS_POVISBUTTONCOMBOS __MSABI_LONG(0x00000004) /* pov done through combo of buttons */ 234 | #define JOY_HWS_POVISPOLL __MSABI_LONG(0x00000008) /* pov done through polling */ 235 | #define JOY_HWS_ISYOKE __MSABI_LONG(0x00000010) /* joystick is a flight yoke */ 236 | #define JOY_HWS_ISGAMEPAD __MSABI_LONG(0x00000020) /* joystick is a game pad */ 237 | #define JOY_HWS_ISCARCTRL __MSABI_LONG(0x00000040) /* joystick is a car controller */ 238 | /* X defaults to J1 X axis */ 239 | #define JOY_HWS_XISJ1Y __MSABI_LONG(0x00000080) /* X is on J1 Y axis */ 240 | #define JOY_HWS_XISJ2X __MSABI_LONG(0x00000100) /* X is on J2 X axis */ 241 | #define JOY_HWS_XISJ2Y __MSABI_LONG(0x00000200) /* X is on J2 Y axis */ 242 | /* Y defaults to J1 Y axis */ 243 | #define JOY_HWS_YISJ1X __MSABI_LONG(0x00000400) /* Y is on J1 X axis */ 244 | #define JOY_HWS_YISJ2X __MSABI_LONG(0x00000800) /* Y is on J2 X axis */ 245 | #define JOY_HWS_YISJ2Y __MSABI_LONG(0x00001000) /* Y is on J2 Y axis */ 246 | /* Z defaults to J2 Y axis */ 247 | #define JOY_HWS_ZISJ1X __MSABI_LONG(0x00002000) /* Z is on J1 X axis */ 248 | #define JOY_HWS_ZISJ1Y __MSABI_LONG(0x00004000) /* Z is on J1 Y axis */ 249 | #define JOY_HWS_ZISJ2X __MSABI_LONG(0x00008000) /* Z is on J2 X axis */ 250 | /* POV defaults to J2 Y axis, if it is not button based */ 251 | #define JOY_HWS_POVISJ1X __MSABI_LONG(0x00010000) /* pov done through J1 X axis */ 252 | #define JOY_HWS_POVISJ1Y __MSABI_LONG(0x00020000) /* pov done through J1 Y axis */ 253 | #define JOY_HWS_POVISJ2X __MSABI_LONG(0x00040000) /* pov done through J2 X axis */ 254 | /* R defaults to J2 X axis */ 255 | #define JOY_HWS_HASR __MSABI_LONG(0x00080000) /* has R (4th axis) info */ 256 | #define JOY_HWS_RISJ1X __MSABI_LONG(0x00100000) /* R done through J1 X axis */ 257 | #define JOY_HWS_RISJ1Y __MSABI_LONG(0x00200000) /* R done through J1 Y axis */ 258 | #define JOY_HWS_RISJ2Y __MSABI_LONG(0x00400000) /* R done through J2 X axis */ 259 | /* U & V for future hardware */ 260 | #define JOY_HWS_HASU __MSABI_LONG(0x00800000) /* has U (5th axis) info */ 261 | #define JOY_HWS_HASV __MSABI_LONG(0x01000000) /* has V (6th axis) info */ 262 | 263 | /* Usage settings */ 264 | #define JOY_US_HASRUDDER __MSABI_LONG(0x00000001) /* joystick configured with rudder */ 265 | #define JOY_US_PRESENT __MSABI_LONG(0x00000002) /* is joystick actually present? */ 266 | #define JOY_US_ISOEM __MSABI_LONG(0x00000004) /* joystick is an OEM defined type */ 267 | 268 | 269 | /* struct for storing x,y, z, and rudder values */ 270 | typedef struct joypos_tag { 271 | DWORD dwX; 272 | DWORD dwY; 273 | DWORD dwZ; 274 | DWORD dwR; 275 | DWORD dwU; 276 | DWORD dwV; 277 | } JOYPOS, *LPJOYPOS; 278 | 279 | /* struct for storing ranges */ 280 | typedef struct joyrange_tag { 281 | JOYPOS jpMin; 282 | JOYPOS jpMax; 283 | JOYPOS jpCenter; 284 | } JOYRANGE, *LPJOYRANGE; 285 | 286 | typedef struct joyreguservalues_tag { 287 | DWORD dwTimeOut; /* value at which to timeout joystick polling */ 288 | JOYRANGE jrvRanges; /* range of values app wants returned for axes */ 289 | JOYPOS jpDeadZone; /* area around center to be considered 290 | as "dead". specified as a percentage 291 | (0-100). Only X & Y handled by system driver */ 292 | } JOYREGUSERVALUES, *LPJOYREGUSERVALUES; 293 | 294 | typedef struct joyreghwsettings_tag { 295 | DWORD dwFlags; 296 | DWORD dwNumButtons; /* number of buttons */ 297 | } JOYREGHWSETTINGS, *LPJOYHWSETTINGS; 298 | 299 | /* range of values returned by the hardware (filled in by calibration) */ 300 | typedef struct joyreghwvalues_tag { 301 | JOYRANGE jrvHardware; /* values returned by hardware */ 302 | DWORD dwPOVValues[JOY_POV_NUMDIRS];/* POV values returned by hardware */ 303 | DWORD dwCalFlags; /* what has been calibrated */ 304 | } JOYREGHWVALUES, *LPJOYREGHWVALUES; 305 | 306 | /* hardware configuration */ 307 | typedef struct joyreghwconfig_tag { 308 | JOYREGHWSETTINGS hws; /* hardware settings */ 309 | DWORD dwUsageSettings;/* usage settings */ 310 | JOYREGHWVALUES hwv; /* values returned by hardware */ 311 | DWORD dwType; /* type of joystick */ 312 | DWORD dwReserved; /* reserved for OEM drivers */ 313 | } JOYREGHWCONFIG, *LPJOYREGHWCONFIG; 314 | 315 | /* joystick calibration info structure */ 316 | typedef struct joycalibrate_tag { 317 | UINT wXbase; 318 | UINT wXdelta; 319 | UINT wYbase; 320 | UINT wYdelta; 321 | UINT wZbase; 322 | UINT wZdelta; 323 | } JOYCALIBRATE; 324 | typedef JOYCALIBRATE *LPJOYCALIBRATE; 325 | 326 | /* prototype for joystick message function */ 327 | typedef UINT(CALLBACK * JOYDEVMSGPROC)(DWORD dwID, UINT uMessage, LPARAM lParam1, LPARAM lParam2); 328 | typedef JOYDEVMSGPROC *LPJOYDEVMSGPROC; 329 | 330 | /* messages sent to joystick driver's DriverProc() function */ 331 | #define JDD_GETNUMDEVS (DRV_RESERVED + 0x0001) 332 | #define JDD_GETDEVCAPS (DRV_RESERVED + 0x0002) 333 | #define JDD_GETPOS (DRV_RESERVED + 0x0101) 334 | #define JDD_SETCALIBRATION (DRV_RESERVED + 0x0102) 335 | #define JDD_CONFIGCHANGED (DRV_RESERVED + 0x0103) 336 | #define JDD_GETPOSEX (DRV_RESERVED + 0x0104) 337 | 338 | #define MCI_MAX_DEVICE_TYPE_LENGTH 80 339 | 340 | #define MCI_FALSE (MCI_STRING_OFFSET + 19) 341 | #define MCI_TRUE (MCI_STRING_OFFSET + 20) 342 | 343 | #define MCI_FORMAT_RETURN_BASE MCI_FORMAT_MILLISECONDS_S 344 | #define MCI_FORMAT_MILLISECONDS_S (MCI_STRING_OFFSET + 21) 345 | #define MCI_FORMAT_HMS_S (MCI_STRING_OFFSET + 22) 346 | #define MCI_FORMAT_MSF_S (MCI_STRING_OFFSET + 23) 347 | #define MCI_FORMAT_FRAMES_S (MCI_STRING_OFFSET + 24) 348 | #define MCI_FORMAT_SMPTE_24_S (MCI_STRING_OFFSET + 25) 349 | #define MCI_FORMAT_SMPTE_25_S (MCI_STRING_OFFSET + 26) 350 | #define MCI_FORMAT_SMPTE_30_S (MCI_STRING_OFFSET + 27) 351 | #define MCI_FORMAT_SMPTE_30DROP_S (MCI_STRING_OFFSET + 28) 352 | #define MCI_FORMAT_BYTES_S (MCI_STRING_OFFSET + 29) 353 | #define MCI_FORMAT_SAMPLES_S (MCI_STRING_OFFSET + 30) 354 | #define MCI_FORMAT_TMSF_S (MCI_STRING_OFFSET + 31) 355 | 356 | #define MCI_VD_FORMAT_TRACK_S (MCI_VD_OFFSET + 5) 357 | 358 | #define WAVE_FORMAT_PCM_S (MCI_WAVE_OFFSET + 0) 359 | #define WAVE_MAPPER_S (MCI_WAVE_OFFSET + 1) 360 | 361 | #define MCI_SEQ_MAPPER_S (MCI_SEQ_OFFSET + 5) 362 | #define MCI_SEQ_FILE_S (MCI_SEQ_OFFSET + 6) 363 | #define MCI_SEQ_MIDI_S (MCI_SEQ_OFFSET + 7) 364 | #define MCI_SEQ_SMPTE_S (MCI_SEQ_OFFSET + 8) 365 | #define MCI_SEQ_FORMAT_SONGPTR_S (MCI_SEQ_OFFSET + 9) 366 | #define MCI_SEQ_NONE_S (MCI_SEQ_OFFSET + 10) 367 | #define MIDIMAPPER_S (MCI_SEQ_OFFSET + 11) 368 | 369 | #define MCI_RESOURCE_RETURNED 0x00010000 /* resource ID */ 370 | #define MCI_COLONIZED3_RETURN 0x00020000 /* colonized ID, 3 bytes data */ 371 | #define MCI_COLONIZED4_RETURN 0x00040000 /* colonized ID, 4 bytes data */ 372 | #define MCI_INTEGER_RETURNED 0x00080000 /* integer conversion needed */ 373 | #define MCI_RESOURCE_DRIVER 0x00100000 /* driver owns returned resource */ 374 | 375 | #define MCI_NO_COMMAND_TABLE 0xFFFF 376 | 377 | #define MCI_COMMAND_HEAD 0 378 | #define MCI_STRING 1 379 | #define MCI_INTEGER 2 380 | #define MCI_END_COMMAND 3 381 | #define MCI_RETURN 4 382 | #define MCI_FLAG 5 383 | #define MCI_END_COMMAND_LIST 6 384 | #define MCI_RECT 7 385 | #define MCI_CONSTANT 8 386 | #define MCI_END_CONSTANT 9 387 | #define MCI_HWND 10 388 | #define MCI_HPAL 11 389 | #define MCI_HDC 12 390 | 391 | #ifdef _WIN64 392 | #define MCI_INTEGER64 13 393 | #endif /* _WIN64 */ 394 | 395 | #define MAKEMCIRESOURCE(wRet, wRes) MAKELRESULT((wRet), (wRes)) 396 | 397 | typedef struct { 398 | HWAVE hWave; 399 | LPWAVEFORMATEX lpFormat; 400 | DWORD_PTR dwCallback; 401 | DWORD_PTR dwInstance; 402 | UINT uMappedDeviceID; 403 | DWORD_PTR dnDevNode; 404 | } WAVEOPENDESC, *LPWAVEOPENDESC; 405 | 406 | typedef struct { 407 | DWORD dwStreamID; 408 | WORD wDeviceID; 409 | } MIDIOPENSTRMID; 410 | 411 | typedef struct { 412 | HMIDI hMidi; 413 | DWORD_PTR dwCallback; 414 | DWORD_PTR dwInstance; 415 | DWORD_PTR dnDevNode; 416 | DWORD cIds; 417 | MIDIOPENSTRMID rgIds; 418 | } MIDIOPENDESC, *LPMIDIOPENDESC; 419 | 420 | typedef struct tMIXEROPENDESC 421 | { 422 | HMIXEROBJ hmx; 423 | LPVOID pReserved0; 424 | DWORD_PTR dwCallback; 425 | DWORD_PTR dwInstance; 426 | DWORD_PTR dnDevNode; 427 | } MIXEROPENDESC, *LPMIXEROPENDESC; 428 | 429 | typedef struct { 430 | UINT wDeviceID; /* device ID */ 431 | LPSTR lpstrParams; /* parameter string for entry in SYSTEM.INI */ 432 | UINT wCustomCommandTable; /* custom command table (0xFFFF if none) * filled in by the driver */ 433 | UINT wType; /* driver type (filled in by the driver) */ 434 | } MCI_OPEN_DRIVER_PARMSA, *LPMCI_OPEN_DRIVER_PARMSA; 435 | 436 | typedef struct { 437 | UINT wDeviceID; /* device ID */ 438 | LPWSTR lpstrParams; /* parameter string for entry in SYSTEM.INI */ 439 | UINT wCustomCommandTable; /* custom command table (0xFFFF if none) * filled in by the driver */ 440 | UINT wType; /* driver type (filled in by the driver) */ 441 | } MCI_OPEN_DRIVER_PARMSW, *LPMCI_OPEN_DRIVER_PARMSW; 442 | 443 | #ifndef _MMHPP 444 | DWORD_PTR WINAPI mciGetDriverData(UINT uDeviceID); 445 | BOOL WINAPI mciSetDriverData(UINT uDeviceID, DWORD_PTR dwData); 446 | UINT WINAPI mciDriverYield(UINT uDeviceID); 447 | #ifndef _MCIAPI_H_ 448 | BOOL WINAPI mciDriverNotify(HWND hwndCallback, UINT uDeviceID, 449 | UINT uStatus); 450 | UINT WINAPI mciLoadCommandResource(HINSTANCE hInstance, 451 | LPCWSTR lpResName, UINT uType); 452 | #endif 453 | BOOL WINAPI mciFreeCommandResource(UINT uTable); 454 | #endif 455 | 456 | #define DCB_NULL 0x0000 457 | #define DCB_WINDOW 0x0001 /* dwCallback is a HWND */ 458 | #define DCB_TASK 0x0002 /* dwCallback is a HTASK */ 459 | #define DCB_FUNCTION 0x0003 /* dwCallback is a FARPROC */ 460 | #define DCB_EVENT 0x0005 /* dwCallback is an EVENT Handler */ 461 | #define DCB_TYPEMASK 0x0007 462 | #define DCB_NOSWITCH 0x0008 /* don't switch stacks for callback */ 463 | 464 | #ifndef _MMHPP 465 | BOOL APIENTRY DriverCallback(DWORD_PTR dwCallback, DWORD dwFlags, 466 | HDRVR hDevice, DWORD dwMsg, DWORD_PTR dwUser, DWORD_PTR dwParam1, DWORD_PTR dwParam2); 467 | #endif 468 | 469 | typedef VOID(*LPTASKCALLBACK)(DWORD_PTR dwInst); 470 | 471 | #define TASKERR_NOTASKSUPPORT 1 472 | #define TASKERR_OUTOFMEMORY 2 473 | 474 | #ifndef _MMHPP 475 | UINT WINAPI mmTaskCreate(LPTASKCALLBACK, HANDLE*, DWORD_PTR); 476 | VOID WINAPI mmTaskBlock(DWORD); 477 | BOOL WINAPI mmTaskSignal(DWORD); 478 | VOID WINAPI mmTaskYield(VOID); 479 | DWORD WINAPI mmGetCurrentTask(VOID); 480 | BOOL WINAPI mciExecute(LPCSTR); 481 | #endif 482 | 483 | #include 484 | 485 | #ifdef __cplusplus 486 | } 487 | #endif 488 | 489 | #endif /* __MMDDK_H */ -------------------------------------------------------------------------------- /legacyExports.def: -------------------------------------------------------------------------------- 1 | LIBRARY winmm.dll 2 | 3 | EXPORTS 4 | mmsystemGetVersion = WINMM_mmsystemGetVersion 5 | CloseDriver = WINMM_CloseDriver 6 | DefDriverProc = WINMM_DefDriverProc 7 | DriverCallback = WINMM_DriverCallback 8 | DrvGetModuleHandle = WINMM_DrvGetModuleHandle 9 | GetDriverModuleHandle = WINMM_GetDriverModuleHandle 10 | OpenDriver = WINMM_OpenDriver 11 | PlaySound = WINMM_PlaySound 12 | PlaySoundStub = WINMM_PlaySoundA @2 NONAME 13 | PlaySoundA = WINMM_PlaySoundA 14 | PlaySoundW = WINMM_PlaySoundW 15 | SendDriverMessage = WINMM_SendDriverMessage 16 | auxGetDevCapsA = WINMM_auxGetDevCapsA 17 | auxGetDevCapsW = WINMM_auxGetDevCapsW 18 | auxGetNumDevs = WINMM_auxGetNumDevs 19 | auxGetVolume = WINMM_auxGetVolume 20 | auxOutMessage = WINMM_auxOutMessage 21 | auxSetVolume = WINMM_auxSetVolume 22 | joyConfigChanged = WINMM_joyConfigChanged 23 | joyGetDevCapsA = WINMM_joyGetDevCapsA 24 | joyGetDevCapsW = WINMM_joyGetDevCapsW 25 | joyGetNumDevs = WINMM_joyGetNumDevs 26 | joyGetPos = WINMM_joyGetPos 27 | joyGetPosEx = WINMM_joyGetPosEx 28 | joyGetThreshold = WINMM_joyGetThreshold 29 | joyReleaseCapture = WINMM_joyReleaseCapture 30 | joySetCapture = WINMM_joySetCapture 31 | joySetThreshold = WINMM_joySetThreshold 32 | mciDriverNotify = WINMM_mciDriverNotify 33 | mciDriverYield = WINMM_mciDriverYield 34 | mciExecute = WINMM_mciExecute 35 | mciFreeCommandResource = WINMM_mciFreeCommandResource 36 | mciGetCreatorTask = WINMM_mciGetCreatorTask 37 | mciGetDeviceIDA = WINMM_mciGetDeviceIDA 38 | mciGetDeviceIDFromElementIDA = WINMM_mciGetDeviceIDFromElementIDA 39 | mciGetDeviceIDFromElementIDW = WINMM_mciGetDeviceIDFromElementIDW 40 | mciGetDeviceIDW = WINMM_mciGetDeviceIDW 41 | mciGetDriverData = WINMM_mciGetDriverData 42 | mciGetErrorStringA = WINMM_mciGetErrorStringA 43 | mciGetErrorStringW = WINMM_mciGetErrorStringW 44 | mciGetYieldProc = WINMM_mciGetYieldProc 45 | mciLoadCommandResource = WINMM_mciLoadCommandResource 46 | mciSendCommandA = WINMM_mciSendCommandA 47 | mciSendCommandW = WINMM_mciSendCommandW 48 | mciSendStringA = WINMM_mciSendStringA 49 | mciSendStringW = WINMM_mciSendStringW 50 | mciSetDriverData = WINMM_mciSetDriverData 51 | mciSetYieldProc = WINMM_mciSetYieldProc 52 | midiConnect = WINMM_midiConnect 53 | midiDisconnect = WINMM_midiDisconnect 54 | midiInAddBuffer = WINMM_midiInAddBuffer 55 | midiInClose = WINMM_midiInClose 56 | midiInGetDevCapsA = WINMM_midiInGetDevCapsA 57 | midiInGetDevCapsW = WINMM_midiInGetDevCapsW 58 | midiInGetErrorTextA = WINMM_midiInGetErrorTextA 59 | midiInGetErrorTextW = WINMM_midiInGetErrorTextW 60 | midiInGetID = WINMM_midiInGetID 61 | midiInGetNumDevs = WINMM_midiInGetNumDevs 62 | midiInMessage = WINMM_midiInMessage 63 | midiInOpen = WINMM_midiInOpen 64 | midiInPrepareHeader = WINMM_midiInPrepareHeader 65 | midiInReset = WINMM_midiInReset 66 | midiInStart = WINMM_midiInStart 67 | midiInStop = WINMM_midiInStop 68 | midiInUnprepareHeader = WINMM_midiInUnprepareHeader 69 | midiOutCacheDrumPatches = WRP_midiOutCacheDrumPatches 70 | midiOutCachePatches = WRP_midiOutCachePatches 71 | midiOutClose = WRP_midiOutClose 72 | midiOutGetDevCapsA = WRP_midiOutGetDevCapsA 73 | midiOutGetDevCapsW = WRP_midiOutGetDevCapsW 74 | midiOutGetErrorTextA = WINMM_midiOutGetErrorTextA 75 | midiOutGetErrorTextW = WINMM_midiOutGetErrorTextW 76 | midiOutGetID = WRP_midiOutGetID 77 | midiOutGetNumDevs = WRP_midiOutGetNumDevs 78 | midiOutGetVolume = WRP_midiOutGetVolume 79 | midiOutLongMsg = WRP_midiOutLongMsg 80 | midiOutMessage = WRP_midiOutMessage 81 | midiOutOpen = WRP_midiOutOpen 82 | midiOutPrepareHeader = WRP_midiOutPrepareHeader 83 | midiOutReset = WRP_midiOutReset 84 | midiOutSetVolume = WRP_midiOutSetVolume 85 | midiOutShortMsg = WRP_midiOutShortMsg 86 | midiOutUnprepareHeader = WRP_midiOutUnprepareHeader 87 | midiStreamClose = WRP_midiStreamClose 88 | midiStreamOpen = WRP_midiStreamOpen 89 | midiStreamOut = WRP_midiStreamOut 90 | midiStreamPause = WRP_midiStreamPause 91 | midiStreamPosition = WRP_midiStreamPosition 92 | midiStreamProperty = WRP_midiStreamProperty 93 | midiStreamRestart = WRP_midiStreamRestart 94 | midiStreamStop = WRP_midiStreamStop 95 | mixerClose = WINMM_mixerClose 96 | mixerGetControlDetailsA = WINMM_mixerGetControlDetailsA 97 | mixerGetControlDetailsW = WINMM_mixerGetControlDetailsW 98 | mixerGetDevCapsA = WINMM_mixerGetDevCapsA 99 | mixerGetDevCapsW = WINMM_mixerGetDevCapsW 100 | mixerGetID = WINMM_mixerGetID 101 | mixerGetLineControlsA = WINMM_mixerGetLineControlsA 102 | mixerGetLineControlsW = WINMM_mixerGetLineControlsW 103 | mixerGetLineInfoA = WINMM_mixerGetLineInfoA 104 | mixerGetLineInfoW = WINMM_mixerGetLineInfoW 105 | mixerGetNumDevs = WRP_mixerGetNumDevs 106 | mixerMessage = WINMM_mixerMessage 107 | mixerOpen = WINMM_mixerOpen 108 | mixerSetControlDetails = WINMM_mixerSetControlDetails 109 | mmGetCurrentTask = WINMM_mmGetCurrentTask 110 | mmTaskBlock = WINMM_mmTaskBlock 111 | mmTaskCreate = WINMM_mmTaskCreate 112 | mmTaskSignal = WINMM_mmTaskSignal 113 | mmTaskYield = WINMM_mmTaskYield 114 | mmioAdvance = WINMM_mmioAdvance 115 | mmioAscend = WINMM_mmioAscend 116 | mmioClose = WINMM_mmioClose 117 | mmioCreateChunk = WINMM_mmioCreateChunk 118 | mmioDescend = WINMM_mmioDescend 119 | mmioFlush = WINMM_mmioFlush 120 | mmioGetInfo = WINMM_mmioGetInfo 121 | mmioInstallIOProcA = WINMM_mmioInstallIOProcA 122 | mmioInstallIOProcW = WINMM_mmioInstallIOProcW 123 | mmioOpenA = WINMM_mmioOpenA 124 | mmioOpenW = WINMM_mmioOpenW 125 | mmioRead = WINMM_mmioRead 126 | mmioRenameA = WINMM_mmioRenameA 127 | mmioRenameW = WINMM_mmioRenameW 128 | mmioSeek = WINMM_mmioSeek 129 | mmioSendMessage = WINMM_mmioSendMessage 130 | mmioSetBuffer = WINMM_mmioSetBuffer 131 | mmioSetInfo = WINMM_mmioSetInfo 132 | mmioStringToFOURCCA = WINMM_mmioStringToFOURCCA 133 | mmioStringToFOURCCW = WINMM_mmioStringToFOURCCW 134 | mmioWrite = WINMM_mmioWrite 135 | sndPlaySoundA = WINMM_sndPlaySoundA 136 | sndPlaySoundW = WINMM_sndPlaySoundW 137 | timeBeginPeriod = WINMM_timeBeginPeriod 138 | timeEndPeriod = WINMM_timeEndPeriod 139 | timeGetDevCaps = WINMM_timeGetDevCaps 140 | timeGetSystemTime = WINMM_timeGetSystemTime 141 | timeGetTime = WINMM_timeGetTime 142 | timeKillEvent = WINMM_timeKillEvent 143 | timeSetEvent = WINMM_timeSetEvent 144 | waveInAddBuffer = WINMM_waveInAddBuffer 145 | waveInClose = WINMM_waveInClose 146 | waveInGetDevCapsA = WINMM_waveInGetDevCapsA 147 | waveInGetDevCapsW = WINMM_waveInGetDevCapsW 148 | waveInGetErrorTextA = WINMM_waveInGetErrorTextA 149 | waveInGetErrorTextW = WINMM_waveInGetErrorTextW 150 | waveInGetID = WINMM_waveInGetID 151 | waveInGetNumDevs = WRP_waveInGetNumDevs 152 | waveInGetPosition = WINMM_waveInGetPosition 153 | waveInMessage = WINMM_waveInMessage 154 | waveInOpen = WINMM_waveInOpen 155 | waveInPrepareHeader = WINMM_waveInPrepareHeader 156 | waveInReset = WINMM_waveInReset 157 | waveInStart = WINMM_waveInStart 158 | waveInStop = WINMM_waveInStop 159 | waveInUnprepareHeader = WINMM_waveInUnprepareHeader 160 | waveOutBreakLoop = WINMM_waveOutBreakLoop 161 | waveOutClose = WINMM_waveOutClose 162 | waveOutGetDevCapsA = WINMM_waveOutGetDevCapsA 163 | waveOutGetDevCapsW = WINMM_waveOutGetDevCapsW 164 | waveOutGetErrorTextA = WINMM_waveOutGetErrorTextA 165 | waveOutGetErrorTextW = WINMM_waveOutGetErrorTextW 166 | waveOutGetID = WINMM_waveOutGetID 167 | waveOutGetNumDevs = WINMM_waveOutGetNumDevs 168 | waveOutGetPitch = WINMM_waveOutGetPitch 169 | waveOutGetPlaybackRate = WINMM_waveOutGetPlaybackRate 170 | waveOutGetPosition = WINMM_waveOutGetPosition 171 | waveOutGetVolume = WINMM_waveOutGetVolume 172 | waveOutMessage = WINMM_waveOutMessage 173 | waveOutOpen = WINMM_waveOutOpen 174 | waveOutPause = WINMM_waveOutPause 175 | waveOutPrepareHeader = WINMM_waveOutPrepareHeader 176 | waveOutReset = WINMM_waveOutReset 177 | waveOutRestart = WINMM_waveOutRestart 178 | waveOutSetPitch = WINMM_waveOutSetPitch 179 | waveOutSetPlaybackRate = WINMM_waveOutSetPlaybackRate 180 | waveOutSetVolume = WINMM_waveOutSetVolume 181 | waveOutUnprepareHeader = WINMM_waveOutUnprepareHeader 182 | waveOutWrite = WINMM_waveOutWrite 183 | 184 | aux32Message = WINMM_aux32Message 185 | joy32Message = WINMM_joy32Message 186 | mci32Message = WINMM_mci32Message 187 | wid32Message = WINMM_wid32Message 188 | mid32Message = WINMM_mid32Message 189 | mod32Message = WINMM_mod32Message 190 | mxd32Message = WINMM_mxd32Message 191 | tid32Message = WINMM_tid32Message 192 | wid32Message = WINMM_wid32Message 193 | wod32Message = WINMM_wod32Message -------------------------------------------------------------------------------- /newExports.def: -------------------------------------------------------------------------------- 1 | LIBRARY winmm.dll 2 | 3 | EXPORTS 4 | mmsystemGetVersion = WINMM_mmsystemGetVersion 5 | CloseDriver = WINMM_CloseDriver 6 | DefDriverProc = WINMM_DefDriverProc 7 | DriverCallback = WINMM_DriverCallback 8 | DrvGetModuleHandle = WINMM_DrvGetModuleHandle 9 | GetDriverModuleHandle = WINMM_GetDriverModuleHandle 10 | OpenDriver = WINMM_OpenDriver 11 | PlaySound = WINMM_PlaySound 12 | PlaySoundStub = WINMM_PlaySoundA @2 NONAME 13 | PlaySoundA = WINMM_PlaySoundA 14 | PlaySoundW = WINMM_PlaySoundW 15 | SendDriverMessage = WINMM_SendDriverMessage 16 | auxGetDevCapsA = WINMM_auxGetDevCapsA 17 | auxGetDevCapsW = WINMM_auxGetDevCapsW 18 | auxGetNumDevs = WINMM_auxGetNumDevs 19 | auxGetVolume = WINMM_auxGetVolume 20 | auxOutMessage = WINMM_auxOutMessage 21 | auxSetVolume = WINMM_auxSetVolume 22 | joyConfigChanged = WINMM_joyConfigChanged 23 | joyGetDevCapsA = WINMM_joyGetDevCapsA 24 | joyGetDevCapsW = WINMM_joyGetDevCapsW 25 | joyGetNumDevs = WINMM_joyGetNumDevs 26 | joyGetPos = WINMM_joyGetPos 27 | joyGetPosEx = WINMM_joyGetPosEx 28 | joyGetThreshold = WINMM_joyGetThreshold 29 | joyReleaseCapture = WINMM_joyReleaseCapture 30 | joySetCapture = WINMM_joySetCapture 31 | joySetThreshold = WINMM_joySetThreshold 32 | mciDriverNotify = WINMM_mciDriverNotify 33 | mciDriverYield = WINMM_mciDriverYield 34 | mciExecute = WINMM_mciExecute 35 | mciFreeCommandResource = WINMM_mciFreeCommandResource 36 | mciGetCreatorTask = WINMM_mciGetCreatorTask 37 | mciGetDeviceIDA = WINMM_mciGetDeviceIDA 38 | mciGetDeviceIDFromElementIDA = WINMM_mciGetDeviceIDFromElementIDA 39 | mciGetDeviceIDFromElementIDW = WINMM_mciGetDeviceIDFromElementIDW 40 | mciGetDeviceIDW = WINMM_mciGetDeviceIDW 41 | mciGetDriverData = WINMM_mciGetDriverData 42 | mciGetErrorStringA = WINMM_mciGetErrorStringA 43 | mciGetErrorStringW = WINMM_mciGetErrorStringW 44 | mciGetYieldProc = WINMM_mciGetYieldProc 45 | mciLoadCommandResource = WINMM_mciLoadCommandResource 46 | mciSendCommandA = WINMM_mciSendCommandA 47 | mciSendCommandW = WINMM_mciSendCommandW 48 | mciSendStringA = WINMM_mciSendStringA 49 | mciSendStringW = WINMM_mciSendStringW 50 | mciSetDriverData = WINMM_mciSetDriverData 51 | mciSetYieldProc = WINMM_mciSetYieldProc 52 | midiConnect = WINMM_midiConnect 53 | midiDisconnect = WINMM_midiDisconnect 54 | midiInAddBuffer = WINMM_midiInAddBuffer 55 | midiInClose = WINMM_midiInClose 56 | midiInGetDevCapsA = WINMM_midiInGetDevCapsA 57 | midiInGetDevCapsW = WINMM_midiInGetDevCapsW 58 | midiInGetErrorTextA = WINMM_midiInGetErrorTextA 59 | midiInGetErrorTextW = WINMM_midiInGetErrorTextW 60 | midiInGetID = WINMM_midiInGetID 61 | midiInGetNumDevs = WINMM_midiInGetNumDevs 62 | midiInMessage = WINMM_midiInMessage 63 | midiInOpen = WINMM_midiInOpen 64 | midiInPrepareHeader = WINMM_midiInPrepareHeader 65 | midiInReset = WINMM_midiInReset 66 | midiInStart = WINMM_midiInStart 67 | midiInStop = WINMM_midiInStop 68 | midiInUnprepareHeader = WINMM_midiInUnprepareHeader 69 | midiOutCacheDrumPatches = WRP_midiOutCacheDrumPatches 70 | midiOutCachePatches = WRP_midiOutCachePatches 71 | midiOutClose = WRP_midiOutClose 72 | midiOutGetDevCapsA = WRP_midiOutGetDevCapsA 73 | midiOutGetDevCapsW = WRP_midiOutGetDevCapsW 74 | midiOutGetErrorTextA = WINMM_midiOutGetErrorTextA 75 | midiOutGetErrorTextW = WINMM_midiOutGetErrorTextW 76 | midiOutGetID = WRP_midiOutGetID 77 | midiOutGetNumDevs = WRP_midiOutGetNumDevs 78 | midiOutGetVolume = WRP_midiOutGetVolume 79 | midiOutLongMsg = WRP_midiOutLongMsg 80 | midiOutMessage = WRP_midiOutMessage 81 | midiOutOpen = WRP_midiOutOpen 82 | midiOutPrepareHeader = WRP_midiOutPrepareHeader 83 | midiOutReset = WRP_midiOutReset 84 | midiOutSetVolume = WRP_midiOutSetVolume 85 | midiOutShortMsg = WRP_midiOutShortMsg 86 | midiOutUnprepareHeader = WRP_midiOutUnprepareHeader 87 | midiStreamClose = WRP_midiStreamClose 88 | midiStreamOpen = WRP_midiStreamOpen 89 | midiStreamOut = WRP_midiStreamOut 90 | midiStreamPause = WRP_midiStreamPause 91 | midiStreamPosition = WRP_midiStreamPosition 92 | midiStreamProperty = WRP_midiStreamProperty 93 | midiStreamRestart = WRP_midiStreamRestart 94 | midiStreamStop = WRP_midiStreamStop 95 | mixerClose = WINMM_mixerClose 96 | mixerGetControlDetailsA = WINMM_mixerGetControlDetailsA 97 | mixerGetControlDetailsW = WINMM_mixerGetControlDetailsW 98 | mixerGetDevCapsA = WINMM_mixerGetDevCapsA 99 | mixerGetDevCapsW = WINMM_mixerGetDevCapsW 100 | mixerGetID = WINMM_mixerGetID 101 | mixerGetLineControlsA = WINMM_mixerGetLineControlsA 102 | mixerGetLineControlsW = WINMM_mixerGetLineControlsW 103 | mixerGetLineInfoA = WINMM_mixerGetLineInfoA 104 | mixerGetLineInfoW = WINMM_mixerGetLineInfoW 105 | mixerGetNumDevs = WINMM_mixerGetNumDevs 106 | mixerMessage = WINMM_mixerMessage 107 | mixerOpen = WINMM_mixerOpen 108 | mixerSetControlDetails = WINMM_mixerSetControlDetails 109 | mmGetCurrentTask = WINMM_mmGetCurrentTask 110 | mmTaskBlock = WINMM_mmTaskBlock 111 | mmTaskCreate = WINMM_mmTaskCreate 112 | mmTaskSignal = WINMM_mmTaskSignal 113 | mmTaskYield = WINMM_mmTaskYield 114 | mmioAdvance = WINMM_mmioAdvance 115 | mmioAscend = WINMM_mmioAscend 116 | mmioClose = WINMM_mmioClose 117 | mmioCreateChunk = WINMM_mmioCreateChunk 118 | mmioDescend = WINMM_mmioDescend 119 | mmioFlush = WINMM_mmioFlush 120 | mmioGetInfo = WINMM_mmioGetInfo 121 | mmioInstallIOProcA = WINMM_mmioInstallIOProcA 122 | mmioInstallIOProcW = WINMM_mmioInstallIOProcW 123 | mmioOpenA = WINMM_mmioOpenA 124 | mmioOpenW = WINMM_mmioOpenW 125 | mmioRead = WINMM_mmioRead 126 | mmioRenameA = WINMM_mmioRenameA 127 | mmioRenameW = WINMM_mmioRenameW 128 | mmioSeek = WINMM_mmioSeek 129 | mmioSendMessage = WINMM_mmioSendMessage 130 | mmioSetBuffer = WINMM_mmioSetBuffer 131 | mmioSetInfo = WINMM_mmioSetInfo 132 | mmioStringToFOURCCA = WINMM_mmioStringToFOURCCA 133 | mmioStringToFOURCCW = WINMM_mmioStringToFOURCCW 134 | mmioWrite = WINMM_mmioWrite 135 | sndPlaySoundA = WINMM_sndPlaySoundA 136 | sndPlaySoundW = WINMM_sndPlaySoundW 137 | timeBeginPeriod = WINMM_timeBeginPeriod 138 | timeEndPeriod = WINMM_timeEndPeriod 139 | timeGetDevCaps = WINMM_timeGetDevCaps 140 | timeGetSystemTime = WINMM_timeGetSystemTime 141 | timeGetTime = WINMM_timeGetTime 142 | timeKillEvent = WINMM_timeKillEvent 143 | timeSetEvent = WINMM_timeSetEvent 144 | waveInAddBuffer = WINMM_waveInAddBuffer 145 | waveInClose = WINMM_waveInClose 146 | waveInGetDevCapsA = WINMM_waveInGetDevCapsA 147 | waveInGetDevCapsW = WINMM_waveInGetDevCapsW 148 | waveInGetErrorTextA = WINMM_waveInGetErrorTextA 149 | waveInGetErrorTextW = WINMM_waveInGetErrorTextW 150 | waveInGetID = WINMM_waveInGetID 151 | waveInGetNumDevs = WINMM_waveInGetNumDevs 152 | waveInGetPosition = WINMM_waveInGetPosition 153 | waveInMessage = WINMM_waveInMessage 154 | waveInOpen = WINMM_waveInOpen 155 | waveInPrepareHeader = WINMM_waveInPrepareHeader 156 | waveInReset = WINMM_waveInReset 157 | waveInStart = WINMM_waveInStart 158 | waveInStop = WINMM_waveInStop 159 | waveInUnprepareHeader = WINMM_waveInUnprepareHeader 160 | waveOutBreakLoop = WINMM_waveOutBreakLoop 161 | waveOutClose = WINMM_waveOutClose 162 | waveOutGetDevCapsA = WINMM_waveOutGetDevCapsA 163 | waveOutGetDevCapsW = WINMM_waveOutGetDevCapsW 164 | waveOutGetErrorTextA = WINMM_waveOutGetErrorTextA 165 | waveOutGetErrorTextW = WINMM_waveOutGetErrorTextW 166 | waveOutGetID = WINMM_waveOutGetID 167 | waveOutGetNumDevs = WINMM_waveOutGetNumDevs 168 | waveOutGetPitch = WINMM_waveOutGetPitch 169 | waveOutGetPlaybackRate = WINMM_waveOutGetPlaybackRate 170 | waveOutGetPosition = WINMM_waveOutGetPosition 171 | waveOutGetVolume = WINMM_waveOutGetVolume 172 | waveOutMessage = WINMM_waveOutMessage 173 | waveOutOpen = WINMM_waveOutOpen 174 | waveOutPause = WINMM_waveOutPause 175 | waveOutPrepareHeader = WINMM_waveOutPrepareHeader 176 | waveOutReset = WINMM_waveOutReset 177 | waveOutRestart = WINMM_waveOutRestart 178 | waveOutSetPitch = WINMM_waveOutSetPitch 179 | waveOutSetPlaybackRate = WINMM_waveOutSetPlaybackRate 180 | waveOutSetVolume = WINMM_waveOutSetVolume 181 | waveOutUnprepareHeader = WINMM_waveOutUnprepareHeader 182 | waveOutWrite = WINMM_waveOutWrite -------------------------------------------------------------------------------- /src/Common.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | OmniMIDI v15+ (Rewrite) for Win32/Linux 4 | 5 | This file contains the required code to run the driver under both Windows and Linux 6 | 7 | */ 8 | 9 | #ifndef _COMMON_H 10 | #define _COMMON_H 11 | 12 | #define MAX_PATH_LONG 32767 13 | #define RANGE(variable, minv, maxv) ((variable) >= minv && (value) <= maxv) 14 | 15 | #ifdef _WIN64 16 | #define EXPORT 17 | #define APICALL 18 | #else 19 | #define EXPORT 20 | #define APICALL __stdcall 21 | #endif 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #endif -------------------------------------------------------------------------------- /src/Loader.cpp: -------------------------------------------------------------------------------- 1 | #include "Loader.hpp" 2 | 3 | #ifndef PURE_WRAPPER 4 | bool OmniMIDI::Loader::LoadKDMAPIModule() { 5 | auto ptr = (LibImport*)OMLibImports; 6 | 7 | if (!KDMAPILib) 8 | KDMAPILib = new Lib("OmniMIDI", &ptr, OMLibImportsSize); 9 | 10 | if (KDMAPILib->LoadLib()) { 11 | return true; 12 | } 13 | 14 | return false; 15 | } 16 | 17 | bool OmniMIDI::Loader::FreeKDMAPIModule() { 18 | if (KDMAPILib->UnloadLib()) { 19 | delete KDMAPILib; 20 | KDMAPILib = nullptr; 21 | return true; 22 | } 23 | 24 | return false; 25 | } 26 | 27 | bool OmniMIDI::Loader::IsKDMAPILoaded() { 28 | return KDMAPILib->IsOnline(); 29 | } 30 | #endif 31 | 32 | bool OmniMIDI::Loader::LoadWinMMModule() { 33 | Funcs Utils; 34 | char SysDir[MAX_PATH] = { 0 }; 35 | 36 | auto ptr = (LibImport*)WMMBaseLibImps; 37 | auto bptr = (LibImport*)WinMMLibImports; 38 | 39 | if (Utils.GetFolderPath(FIDs::LibGeneric, SysDir, sizeof(SysDir))) { 40 | if (WMMBaseLib == nullptr) { 41 | WMMBaseLib = new Lib("winmmbase", &ptr, WMMBaseLibImpSize); 42 | 43 | if (!WMMBaseLib->LoadLib(SysDir)) { 44 | delete WMMBaseLib; 45 | WMMBaseLib = new Lib("winmm", &ptr, WMMBaseLibImpSize); 46 | 47 | if (WMMBaseLib->LoadLib(SysDir)) { 48 | return true; 49 | } 50 | else return false; 51 | } 52 | } 53 | 54 | if (WinMMLib == nullptr) { 55 | WinMMLib = new Lib("winmm", &bptr, WinMMLibImportsSize); 56 | 57 | if (WinMMLib->LoadLib(SysDir)) { 58 | return true; 59 | } 60 | else return false; 61 | } 62 | } 63 | 64 | return true; 65 | } 66 | 67 | bool OmniMIDI::Loader::FreeWinMMModule() { 68 | if (WinMMLib != nullptr) 69 | { 70 | if (WinMMLib->UnloadLib()) { 71 | delete WinMMLib; 72 | WinMMLib = nullptr; 73 | } 74 | else return false; 75 | } 76 | 77 | if (WMMBaseLib != nullptr) { 78 | if (WMMBaseLib->UnloadLib()) { 79 | delete WMMBaseLib; 80 | WMMBaseLib = nullptr; 81 | } 82 | else return false; 83 | } 84 | 85 | return true; 86 | } -------------------------------------------------------------------------------- /src/Loader.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _LOADER_HPP 2 | #define _LOADER_HPP 3 | 4 | #pragma once 5 | 6 | #include "Common.hpp" 7 | #include "OmniMIDI.hpp" 8 | #include "WinMM.hpp" 9 | #include "Utils.hpp" 10 | 11 | #ifndef _M_IX86 12 | #define WINMMIMPORTS 177 13 | #else 14 | #define WINMMIMPORTS 186 15 | #endif 16 | 17 | typedef struct { 18 | #ifdef _M_IX86 19 | char gap0[0x3C]; 20 | #else 21 | char gap0[0x50]; 22 | #endif 23 | MMRESULT(WINAPI* modMessage)(UINT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR); 24 | } midi_device_internal_vtbl_t; 25 | 26 | typedef struct { 27 | midi_device_internal_vtbl_t* vtbl; 28 | UINT id; 29 | #ifdef _M_IX86 30 | char gapC[4]; 31 | #endif 32 | DWORD_PTR user_ptr; 33 | } midi_device_internal_t; 34 | 35 | using namespace OMShared; 36 | 37 | namespace OmniMIDI { 38 | class Loader { 39 | protected: 40 | #ifndef PURE_WRAPPER 41 | Lib* KDMAPILib = nullptr; 42 | LibImport OMLibImports[16] = { 43 | ImpFunc(modMessage), 44 | ImpFunc(IsKDMAPIAvailable), 45 | ImpFunc(InitializeKDMAPIStream), 46 | ImpFunc(TerminateKDMAPIStream), 47 | ImpFunc(ResetKDMAPIStream), 48 | ImpFunc(SendDirectData), 49 | ImpFunc(SendDirectDataNoBuf), 50 | ImpFunc(SendDirectLongData), 51 | ImpFunc(SendDirectLongDataNoBuf), 52 | ImpFunc(PrepareLongData), 53 | ImpFunc(UnprepareLongData), 54 | ImpFunc(InitializeCallbackFeatures), 55 | ImpFunc(RunCallbackFunction), 56 | ImpFunc(SendCustomEvent), 57 | ImpFunc(DriverSettings), 58 | ImpFunc(timeGetTime64) 59 | }; 60 | size_t OMLibImportsSize = sizeof(OMLibImports) / sizeof(OMLibImports[0]); 61 | #endif 62 | 63 | Lib* WMMBaseLib = nullptr; 64 | LibImport WMMBaseLibImps[WINMMIMPORTS] = { 65 | ImpMMFunc(CloseDriver), 66 | ImpMMFunc(DefDriverProc), 67 | ImpMMFunc(DriverCallback), 68 | ImpMMFunc(DrvGetModuleHandle), 69 | ImpMMFunc(GetDriverModuleHandle), 70 | ImpMMFunc(OpenDriver), 71 | ImpMMFunc(PlaySound), 72 | ImpMMFunc(PlaySoundA), 73 | ImpMMFunc(PlaySoundW), 74 | ImpMMFunc(SendDriverMessage), 75 | ImpMMFunc(auxGetDevCapsA), 76 | ImpMMFunc(auxGetDevCapsW), 77 | ImpMMFunc(auxGetNumDevs), 78 | ImpMMFunc(auxGetVolume), 79 | ImpMMFunc(auxOutMessage), 80 | ImpMMFunc(auxSetVolume), 81 | ImpMMFunc(joyConfigChanged), 82 | ImpMMFunc(joyGetDevCapsA), 83 | ImpMMFunc(joyGetDevCapsW), 84 | ImpMMFunc(joyGetNumDevs), 85 | ImpMMFunc(joyGetPos), 86 | ImpMMFunc(joyGetPosEx), 87 | ImpMMFunc(joyGetThreshold), 88 | ImpMMFunc(joyReleaseCapture), 89 | ImpMMFunc(joySetCapture), 90 | ImpMMFunc(joySetThreshold), 91 | ImpMMFunc(mciDriverNotify), 92 | ImpMMFunc(mciDriverYield), 93 | ImpMMFunc(mciExecute), 94 | ImpMMFunc(mciFreeCommandResource), 95 | ImpMMFunc(mciGetCreatorTask), 96 | ImpMMFunc(mciGetDeviceIDA), 97 | ImpMMFunc(mciGetDeviceIDFromElementIDA), 98 | ImpMMFunc(mciGetDeviceIDFromElementIDW), 99 | ImpMMFunc(mciGetDeviceIDW), 100 | ImpMMFunc(mciGetDriverData), 101 | ImpMMFunc(mciGetErrorStringA), 102 | ImpMMFunc(mciGetErrorStringW), 103 | ImpMMFunc(mciGetYieldProc), 104 | ImpMMFunc(mciLoadCommandResource), 105 | ImpMMFunc(mciSendCommandA), 106 | ImpMMFunc(mciSendCommandW), 107 | ImpMMFunc(mciSendStringA), 108 | ImpMMFunc(mciSendStringW), 109 | ImpMMFunc(mciSetDriverData), 110 | ImpMMFunc(mciSetYieldProc), 111 | ImpMMFunc(midiConnect), 112 | ImpMMFunc(midiDisconnect), 113 | ImpMMFunc(midiInAddBuffer), 114 | ImpMMFunc(midiInClose), 115 | ImpMMFunc(midiInGetDevCapsA), 116 | ImpMMFunc(midiInGetDevCapsW), 117 | ImpMMFunc(midiInGetErrorTextA), 118 | ImpMMFunc(midiInGetErrorTextW), 119 | ImpMMFunc(midiInGetID), 120 | ImpMMFunc(midiInGetNumDevs), 121 | ImpMMFunc(midiInMessage), 122 | ImpMMFunc(midiInOpen), 123 | ImpMMFunc(midiInPrepareHeader), 124 | ImpMMFunc(midiInReset), 125 | ImpMMFunc(midiInStart), 126 | ImpMMFunc(midiInStop), 127 | ImpMMFunc(midiInUnprepareHeader), 128 | ImpMMFunc(midiOutCacheDrumPatches), 129 | ImpMMFunc(midiOutCachePatches), 130 | ImpMMFunc(midiOutClose), 131 | ImpMMFunc(midiOutGetDevCapsA), 132 | ImpMMFunc(midiOutGetDevCapsW), 133 | ImpMMFunc(midiOutGetErrorTextA), 134 | ImpMMFunc(midiOutGetErrorTextW), 135 | ImpMMFunc(midiOutGetID), 136 | ImpMMFunc(midiOutGetNumDevs), 137 | ImpMMFunc(midiOutGetVolume), 138 | ImpMMFunc(midiOutLongMsg), 139 | ImpMMFunc(midiOutMessage), 140 | ImpMMFunc(midiOutOpen), 141 | ImpMMFunc(midiOutPrepareHeader), 142 | ImpMMFunc(midiOutReset), 143 | ImpMMFunc(midiOutSetVolume), 144 | ImpMMFunc(midiOutShortMsg), 145 | ImpMMFunc(midiOutUnprepareHeader), 146 | ImpMMFunc(midiStreamClose), 147 | ImpMMFunc(midiStreamOpen), 148 | ImpMMFunc(midiStreamOut), 149 | ImpMMFunc(midiStreamPause), 150 | ImpMMFunc(midiStreamPosition), 151 | ImpMMFunc(midiStreamProperty), 152 | ImpMMFunc(midiStreamRestart), 153 | ImpMMFunc(midiStreamStop), 154 | ImpMMFunc(mixerClose), 155 | ImpMMFunc(mixerGetControlDetailsA), 156 | ImpMMFunc(mixerGetControlDetailsW), 157 | ImpMMFunc(mixerGetDevCapsA), 158 | ImpMMFunc(mixerGetDevCapsW), 159 | ImpMMFunc(mixerGetID), 160 | ImpMMFunc(mixerGetLineControlsA), 161 | ImpMMFunc(mixerGetLineControlsW), 162 | ImpMMFunc(mixerGetLineInfoA), 163 | ImpMMFunc(mixerGetLineInfoW), 164 | ImpMMFunc(mixerGetNumDevs), 165 | ImpMMFunc(mixerMessage), 166 | ImpMMFunc(mixerOpen), 167 | ImpMMFunc(mixerSetControlDetails), 168 | ImpMMFunc(mmGetCurrentTask), 169 | ImpMMFunc(mmTaskBlock), 170 | ImpMMFunc(mmTaskCreate), 171 | ImpMMFunc(mmTaskSignal), 172 | ImpMMFunc(mmTaskYield), 173 | ImpMMFunc(mmioAdvance), 174 | ImpMMFunc(mmioAscend), 175 | ImpMMFunc(mmioClose), 176 | ImpMMFunc(mmioCreateChunk), 177 | ImpMMFunc(mmioDescend), 178 | ImpMMFunc(mmioFlush), 179 | ImpMMFunc(mmioGetInfo), 180 | ImpMMFunc(mmioInstallIOProcA), 181 | ImpMMFunc(mmioInstallIOProcW), 182 | ImpMMFunc(mmioOpenA), 183 | ImpMMFunc(mmioOpenW), 184 | ImpMMFunc(mmioRead), 185 | ImpMMFunc(mmioRenameA), 186 | ImpMMFunc(mmioRenameW), 187 | ImpMMFunc(mmioSeek), 188 | ImpMMFunc(mmioSendMessage), 189 | ImpMMFunc(mmioSetBuffer), 190 | ImpMMFunc(mmioSetInfo), 191 | ImpMMFunc(mmioStringToFOURCCA), 192 | ImpMMFunc(mmioStringToFOURCCW), 193 | ImpMMFunc(mmioWrite), 194 | ImpMMFunc(sndPlaySoundA), 195 | ImpMMFunc(sndPlaySoundW), 196 | ImpMMFunc(waveInAddBuffer), 197 | ImpMMFunc(waveInClose), 198 | ImpMMFunc(waveInGetDevCapsA), 199 | ImpMMFunc(waveInGetDevCapsW), 200 | ImpMMFunc(waveInGetErrorTextA), 201 | ImpMMFunc(waveInGetErrorTextW), 202 | ImpMMFunc(waveInGetID), 203 | ImpMMFunc(waveInGetNumDevs), 204 | ImpMMFunc(waveInGetPosition), 205 | ImpMMFunc(waveInMessage), 206 | ImpMMFunc(waveInOpen), 207 | ImpMMFunc(waveInPrepareHeader), 208 | ImpMMFunc(waveInReset), 209 | ImpMMFunc(waveInStart), 210 | ImpMMFunc(waveInStop), 211 | ImpMMFunc(waveInUnprepareHeader), 212 | ImpMMFunc(waveOutBreakLoop), 213 | ImpMMFunc(waveOutClose), 214 | ImpMMFunc(waveOutGetDevCapsA), 215 | ImpMMFunc(waveOutGetDevCapsW), 216 | ImpMMFunc(waveOutGetErrorTextA), 217 | ImpMMFunc(waveOutGetErrorTextW), 218 | ImpMMFunc(waveOutGetID), 219 | ImpMMFunc(waveOutGetNumDevs), 220 | ImpMMFunc(waveOutGetPitch), 221 | ImpMMFunc(waveOutGetPlaybackRate), 222 | ImpMMFunc(waveOutGetPosition), 223 | ImpMMFunc(waveOutGetVolume), 224 | ImpMMFunc(waveOutMessage), 225 | ImpMMFunc(waveOutOpen), 226 | ImpMMFunc(waveOutPause), 227 | ImpMMFunc(waveOutPrepareHeader), 228 | ImpMMFunc(waveOutReset), 229 | ImpMMFunc(waveOutRestart), 230 | ImpMMFunc(waveOutSetPitch), 231 | ImpMMFunc(waveOutSetPlaybackRate), 232 | ImpMMFunc(waveOutSetVolume), 233 | ImpMMFunc(waveOutUnprepareHeader), 234 | ImpMMFunc(waveOutWrite), 235 | ImpMMFunc(timeBeginPeriod), 236 | ImpMMFunc(timeEndPeriod), 237 | ImpMMFunc(timeGetDevCaps), 238 | ImpMMFunc(timeGetSystemTime), 239 | ImpMMFunc(timeGetTime), 240 | ImpMMFunc(timeKillEvent), 241 | ImpMMFunc(timeSetEvent), 242 | 243 | #ifdef _M_IX86 244 | ImpMMFunc(aux32Message), 245 | ImpMMFunc(joy32Message), 246 | ImpMMFunc(mci32Message), 247 | ImpMMFunc(mid32Message), 248 | ImpMMFunc(mod32Message), 249 | ImpMMFunc(mxd32Message), 250 | ImpMMFunc(tid32Message), 251 | ImpMMFunc(wid32Message), 252 | ImpMMFunc(wod32Message) 253 | #endif 254 | }; 255 | size_t WMMBaseLibImpSize = sizeof(WMMBaseLibImps) / sizeof(WMMBaseLibImps[0]); 256 | 257 | Lib* WinMMLib = nullptr; 258 | LibImport WinMMLibImports[7] = { 259 | ImpMMFunc(timeBeginPeriod), 260 | ImpMMFunc(timeEndPeriod), 261 | ImpMMFunc(timeGetDevCaps), 262 | ImpMMFunc(timeGetSystemTime), 263 | ImpMMFunc(timeGetTime), 264 | ImpMMFunc(timeKillEvent), 265 | ImpMMFunc(timeSetEvent) 266 | }; 267 | size_t WinMMLibImportsSize = sizeof(WinMMLibImports) / sizeof(WinMMLibImports[0]); 268 | 269 | public: 270 | #ifndef PURE_WRAPPER 271 | bool LoadKDMAPIModule(); 272 | bool FreeKDMAPIModule(); 273 | bool IsKDMAPILoaded(); 274 | #endif 275 | 276 | bool LoadWinMMModule(); 277 | bool FreeWinMMModule(); 278 | }; 279 | } 280 | 281 | #endif -------------------------------------------------------------------------------- /src/OmniMIDI.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | OmniMIDI v15+ (Rewrite) for Windows NT 4 | 5 | This file contains the required code to run the driver under Windows 7 SP1 and later. 6 | This file is useful only if you want to compile the driver under Windows, it's not needed for Linux/macOS porting. 7 | 8 | */ 9 | 10 | #include "OmniMIDI.hpp" 11 | 12 | int (WINAPI* IsKDMAPIAvailable)() = 0; 13 | int (WINAPI* InitializeKDMAPIStream)() = 0; 14 | int (WINAPI* TerminateKDMAPIStream)() = 0; 15 | void (WINAPI* ResetKDMAPIStream)() = 0; 16 | void (WINAPI* SendDirectData)(unsigned int) = 0; 17 | void (WINAPI* SendDirectDataNoBuf)(unsigned int) = 0; 18 | unsigned int (WINAPI* SendDirectLongData)(void*, unsigned int) = 0; 19 | unsigned int (WINAPI* SendDirectLongDataNoBuf)(void*, unsigned int) = 0; 20 | unsigned int (WINAPI* PrepareLongData)(MIDIHDR*, unsigned int) = 0; 21 | unsigned int (WINAPI* UnprepareLongData)(MIDIHDR*, unsigned int) = 0; 22 | int (WINAPI* InitializeCallbackFeatures)(HMIDI*, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD) = 0; 23 | void (WINAPI* RunCallbackFunction)(DWORD, DWORD_PTR, DWORD_PTR) = 0; 24 | int (WINAPI* SendCustomEvent)(unsigned int, unsigned int, unsigned int) = 0; 25 | int (WINAPI* DriverSettings)(unsigned int, unsigned int, void*, unsigned int) = 0; 26 | unsigned long long (WINAPI* timeGetTime64)() = 0; 27 | unsigned int (WINAPI* modMessage)(unsigned int, unsigned int, DWORD_PTR, DWORD_PTR, DWORD_PTR) = 0; -------------------------------------------------------------------------------- /src/OmniMIDI.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | OmniMIDI v15+ (Rewrite) for Windows NT 4 | 5 | This file contains the required code to run the driver under Windows 7 SP1 and later. 6 | This file is useful only if you want to compile the driver under Windows, it's not needed for Linux/macOS porting. 7 | 8 | */ 9 | 10 | #ifndef _OMNIMIDI_HPP 11 | #define _OMNIMIDI_HPP 12 | 13 | #pragma once 14 | 15 | #include 16 | 17 | extern int (WINAPI* IsKDMAPIAvailable)(); 18 | extern int (WINAPI* InitializeKDMAPIStream)(); 19 | extern int (WINAPI* TerminateKDMAPIStream)(); 20 | extern void (WINAPI* ResetKDMAPIStream)(); 21 | extern void (WINAPI* SendDirectData)(unsigned int); 22 | extern void (WINAPI* SendDirectDataNoBuf)(unsigned int); 23 | extern unsigned int (WINAPI* SendDirectLongData)(void*, unsigned int); 24 | extern unsigned int (WINAPI* SendDirectLongDataNoBuf)(void*, unsigned int); 25 | extern unsigned int (WINAPI* PrepareLongData)(MIDIHDR*, unsigned int); 26 | extern unsigned int (WINAPI* UnprepareLongData)(MIDIHDR*, unsigned int); 27 | extern int (WINAPI* InitializeCallbackFeatures)(HMIDI*, DWORD_PTR, DWORD_PTR, DWORD_PTR, DWORD); 28 | extern void (WINAPI* RunCallbackFunction)(DWORD, DWORD_PTR, DWORD_PTR); 29 | extern int (WINAPI* SendCustomEvent)(unsigned int, unsigned int, unsigned int); 30 | extern int (WINAPI* DriverSettings)(unsigned int, unsigned int, void*, unsigned int); 31 | extern unsigned long long (WINAPI* timeGetTime64)(); 32 | extern unsigned int (WINAPI* modMessage)(unsigned int, unsigned int, DWORD_PTR, DWORD_PTR, DWORD_PTR); 33 | 34 | #endif -------------------------------------------------------------------------------- /src/Utils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | OmniMIDI v15+ (Rewrite) for Windows NT 4 | 5 | This file contains the required code to run the driver under Windows 7 SP1 and later. 6 | 7 | */ 8 | 9 | #include "Utils.hpp" 10 | 11 | OMShared::Lib::Lib(const char* pName, LibImport** pFuncs, size_t pFuncsCount) { 12 | Name = pName; 13 | 14 | if (pFuncs != nullptr) 15 | Funcs = *pFuncs; 16 | 17 | FuncsCount = pFuncsCount; 18 | } 19 | 20 | OMShared::Lib::~Lib() { 21 | UnloadLib(); 22 | } 23 | 24 | bool OMShared::Lib::GetLibPath(char* outPath) { 25 | OMShared::Funcs Utils; 26 | char buf[MAX_PATH_LONG] = { 0 }; 27 | int printStatus = 0; 28 | bool skip = false; 29 | bool gotLib = false; 30 | 31 | if (outPath == nullptr) 32 | return false; 33 | 34 | if (!skip && !Utils.DoesFileExist(outPath)) { 35 | if (Utils.GetFolderPath(OMShared::FIDs::LibGeneric, buf, MAX_PATH_LONG)) { 36 | printStatus = snprintf(outPath, MAX_PATH_LONG, "%s/" LIBEXP(TYPE), buf, Name); 37 | 38 | if (printStatus == -1) 39 | skip = true; 40 | 41 | if (!skip && !Utils.DoesFileExist(outPath)) { 42 | if (Utils.GetFolderPath(OMShared::FIDs::UserFolder, buf, MAX_PATH_LONG)) { 43 | printStatus = snprintf(outPath, MAX_PATH_LONG, "%s/OmniMIDI/SupportLibraries/" LIBEXP(TYPE), buf, Name); 44 | 45 | if (printStatus == -1) 46 | skip = true; 47 | 48 | if (!skip) 49 | gotLib = Utils.DoesFileExist(outPath); 50 | } 51 | } 52 | else gotLib = true; 53 | } 54 | } 55 | else gotLib = true; 56 | 57 | return gotLib; 58 | } 59 | 60 | bool OMShared::Lib::LoadLib(char* CustomPath) { 61 | char* libPath = nullptr; 62 | 63 | if (Funcs == nullptr || FuncsCount == 0) 64 | return true; 65 | 66 | if (Library == nullptr) { 67 | OMShared::Funcs Utils; 68 | 69 | Initialized = false; 70 | 71 | if (CustomPath != nullptr) { 72 | libPath = new char[MAX_PATH_LONG] { 0 }; 73 | snprintf(libPath, MAX_PATH_LONG, "%s/%s", CustomPath, Name); 74 | } 75 | 76 | Library = loadLib(libPath == nullptr ? Name : libPath); 77 | if (Library == nullptr) { 78 | if (libPath == nullptr) 79 | libPath = new char[MAX_PATH_LONG] { 0 }; 80 | 81 | if (GetLibPath(libPath)) 82 | Library = loadLib(libPath); 83 | } 84 | } 85 | 86 | if (Library != nullptr) { 87 | for (size_t i = 0; i < FuncsCount; i++) 88 | Funcs[i].SetPtr(Library, Funcs[i].GetName()); 89 | 90 | Initialized = true; 91 | } 92 | 93 | if (libPath != nullptr) 94 | delete[] libPath; 95 | 96 | return Initialized; 97 | } 98 | 99 | bool OMShared::Lib::UnloadLib() { 100 | if (Funcs == nullptr || FuncsCount == 0) 101 | return true; 102 | 103 | if (Library != nullptr) { 104 | if (AppSelfHosted) 105 | { 106 | AppSelfHosted = false; 107 | } 108 | else freeLib(Library); 109 | 110 | Library = nullptr; 111 | } 112 | 113 | LoadFailed = false; 114 | Initialized = false; 115 | return true; 116 | } 117 | 118 | OMShared::Funcs::Funcs() { 119 | #ifdef _WIN32 120 | // There is no equivalent to this in Linux/macOS 121 | ntdll = getLib("ntdll"); 122 | 123 | if (!ntdll) { 124 | LL = true; 125 | ntdll = loadLib("ntdll"); 126 | } 127 | 128 | assert(ntdll != 0); 129 | if (!ntdll) 130 | return; 131 | 132 | auto v1 = (unsigned int (WINAPI*)(unsigned char, signed long long*))getAddr(ntdll, "NtDelayExecution"); 133 | assert(v1 != 0); 134 | 135 | if (v1 == nullptr) 136 | return; 137 | 138 | pNtDelayExecution = v1; 139 | 140 | auto v2 = (unsigned int (WINAPI*)(signed long long*))getAddr(ntdll, "NtQuerySystemTime"); 141 | assert(v2 != 0); 142 | 143 | if (v2 == nullptr) 144 | return; 145 | 146 | pNtQuerySystemTime = v2; 147 | #endif 148 | } 149 | 150 | OMShared::Funcs::~Funcs() { 151 | #ifdef _WIN32 152 | if (LL) { 153 | if (!freeLib(ntdll)) 154 | exit(GetLastError()); 155 | 156 | ntdll = nullptr; 157 | } 158 | #endif 159 | } 160 | 161 | unsigned int OMShared::Funcs::MicroSleep(signed long long v) { 162 | if (!v) 163 | return 0; 164 | 165 | #ifdef _WIN32 166 | return pNtDelayExecution(0, &v); 167 | #else 168 | return usleep((useconds_t)((v / 10) * -1)); 169 | #endif 170 | } 171 | 172 | unsigned int OMShared::Funcs::QuerySystemTime(signed long long* v) { 173 | #ifdef _WIN32 174 | return pNtQuerySystemTime(v); 175 | #else 176 | struct timeval tnow; 177 | gettimeofday(&tnow, 0); 178 | *v = tnow.tv_sec * (unsigned long long)10000000 + (((369 * 365 + 89) * (unsigned long long)86400) * 10000000); 179 | *v += tnow.tv_usec * 10; 180 | return 0; 181 | #endif 182 | } 183 | 184 | bool OMShared::Funcs::GetFolderPath(const FIDs FolderID, char* path, size_t szPath) { 185 | #ifdef _WIN32 186 | #ifndef _WINXP 187 | GUID id = GUID_NULL; 188 | 189 | switch (FolderID) { 190 | case CurrentDirectory: 191 | case LibGeneric: 192 | id = FOLDERID_System; 193 | break; 194 | case UserFolder: 195 | id = FOLDERID_Profile; 196 | break; 197 | default: 198 | break; 199 | } 200 | 201 | if (id != GUID_NULL) { 202 | PWSTR Dir; 203 | HRESULT SGKFP = SHGetKnownFolderPath(id, 0, NULL, &Dir); 204 | bool succ = SUCCEEDED(SGKFP); 205 | 206 | if (succ) 207 | wcstombs(path, Dir, szPath); 208 | 209 | CoTaskMemFree((LPVOID)Dir); 210 | 211 | return succ; 212 | } 213 | #else 214 | int csidl = 0; 215 | 216 | switch (FolderID) { 217 | case CurrentDirectory: 218 | case LibGeneric: 219 | csidl = CSIDL_SYSTEM; 220 | break; 221 | case UserFolder: 222 | csidl = CSIDL_PROFILE; 223 | break; 224 | default: 225 | break; 226 | } 227 | 228 | return !(bool)SHGetFolderPathA(nullptr, csidl, NULL, SHGFP_TYPE_CURRENT, path); 229 | #endif 230 | #else 231 | const char* envPath = nullptr; 232 | 233 | switch (FolderID) { 234 | case LibGeneric: 235 | envPath = "/usr/bin"; 236 | case UserFolder: 237 | envPath = std::getenv("HOME"); 238 | break; 239 | case CurrentDirectory: 240 | return getcwd(path, szPath) != 0; 241 | default: 242 | break; 243 | } 244 | 245 | if (envPath != nullptr) { 246 | strncpy(path, envPath, strlen(envPath)); 247 | return true; 248 | } 249 | #endif 250 | 251 | return false; 252 | } 253 | 254 | #ifdef _WIN32 255 | wchar_t* OMShared::Funcs::GetUTF16(char* utf8) { 256 | wchar_t* buf = nullptr; 257 | 258 | int cc = 0; 259 | // get length (cc) of the new widechar excluding the \0 terminator first 260 | if ((cc = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, NULL, 0)) > 0) 261 | { 262 | // convert 263 | buf = new wchar_t[cc]; 264 | if (buf) { 265 | if (!MultiByteToWideChar(CP_UTF8, 0, utf8, -1, buf, cc)) { 266 | delete[] buf; 267 | buf = nullptr; 268 | } 269 | } 270 | } 271 | 272 | return buf; 273 | } 274 | #endif 275 | 276 | bool OMShared::Funcs::DoesFileExist(std::string filePath) { 277 | bool exists = false; 278 | #ifdef _WIN32 279 | // I SURE LOVE UTF-16!!!!!!!!!! 280 | const char* fPath = filePath.c_str(); 281 | wchar_t* fwPath = GetUTF16((char*)fPath); 282 | 283 | if (fwPath != nullptr) { 284 | if (GetFileAttributesW(fwPath) != INVALID_FILE_ATTRIBUTES) 285 | exists = true; 286 | } 287 | 288 | if (fwPath != nullptr) 289 | delete[] fwPath; 290 | 291 | return exists; 292 | #else 293 | std::ifstream fileCheck(filePath); 294 | 295 | exists = fileCheck.good(); 296 | if (exists) 297 | fileCheck.close(); 298 | 299 | return exists; 300 | #endif 301 | } -------------------------------------------------------------------------------- /src/Utils.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | OmniMIDI v15+ (Rewrite) for Windows NT 4 | 5 | This file contains the required code to run the driver under Windows 7 SP1 and later. 6 | 7 | */ 8 | 9 | #pragma once 10 | 11 | #ifndef _UTILS_H 12 | #define _UTILS_H 13 | 14 | #include 15 | #include 16 | #include 17 | #include "Common.hpp" 18 | 19 | #define ImpFunc(f) LibImport((void**)&(f), #f) 20 | #define ImpMMFunc(f) LibImport((void**)&(MM##f), #f) 21 | 22 | #ifdef _WIN32 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | #define loadLib LoadLibraryA 31 | #define getError GetLastError 32 | #define freeLib(x) FreeLibrary((HMODULE)x) 33 | #define getLib GetModuleHandleA 34 | #define getAddr(x, y) GetProcAddress((HMODULE)x, y) 35 | #define TYPE %s 36 | #define TYPENO TYPE 37 | #else 38 | #include 39 | #include 40 | #include 41 | 42 | #define loadLib(l) dlopen(l, RTLD_NOW) 43 | #define getError() 0 44 | #define freeLib dlclose 45 | #define getLib() 0 46 | #define getLibErr() dlerror 47 | #define getAddr dlsym 48 | #define TYPE lib%s.so 49 | #define TYPENO lib%s 50 | #endif 51 | 52 | #define STREXP(X) #X 53 | #define LIBEXP(X) STREXP(X) 54 | 55 | namespace OMShared { 56 | enum FIDs { 57 | CurrentDirectory, 58 | LibGeneric, 59 | UserFolder 60 | }; 61 | 62 | class LibImport 63 | { 64 | protected: 65 | void** funcptr = nullptr; 66 | const char* funcname = nullptr; 67 | 68 | public: 69 | LibImport(void** pptr, const char* pfuncname) { 70 | funcptr = pptr; 71 | *(funcptr) = nullptr; 72 | funcname = pfuncname; 73 | } 74 | 75 | ~LibImport() { 76 | *(funcptr) = nullptr; 77 | } 78 | 79 | void* GetPtr() { return *(funcptr); } 80 | const char* GetName() { return funcname; } 81 | bool LoadFailed() { return funcptr == nullptr || (funcptr != nullptr && *(funcptr) == nullptr); } 82 | 83 | bool SetPtr(void* lib = nullptr, const char* ptrname = nullptr) { 84 | void* ptr = nullptr; 85 | 86 | if (lib == nullptr && ptrname == nullptr) 87 | { 88 | if (funcptr) 89 | *(funcptr) = nullptr; 90 | 91 | return true; 92 | } 93 | 94 | if (lib == nullptr) 95 | return false; 96 | 97 | ptr = (void*)getAddr(lib, ptrname); 98 | 99 | if (!ptr) { 100 | return false; 101 | } 102 | 103 | if (ptr != *(funcptr)) 104 | *(funcptr) = ptr; 105 | 106 | return true; 107 | } 108 | }; 109 | 110 | class Lib { 111 | protected: 112 | const char* Name; 113 | void* Library = nullptr; 114 | bool Initialized = false; 115 | bool LoadFailed = false; 116 | bool AppSelfHosted = false; 117 | 118 | LibImport* Funcs = nullptr; 119 | size_t FuncsCount = 0; 120 | 121 | public: 122 | void* Ptr() { return Library; } 123 | bool IsOnline() { return (Library != nullptr && Initialized && !LoadFailed); } 124 | 125 | Lib(const char* pName, LibImport** pFuncs = nullptr, size_t pFuncsCount = 0); 126 | ~Lib(); 127 | 128 | bool GetLibPath(char* outPath = nullptr); 129 | bool LoadLib(char* CustomPath = nullptr); 130 | bool UnloadLib(); 131 | }; 132 | 133 | class Funcs { 134 | #ifdef _WIN32 135 | private: 136 | void* ntdll = nullptr; 137 | bool LL = false; 138 | unsigned int (WINAPI* pNtDelayExecution)(unsigned char, signed long long*) = nullptr; 139 | unsigned int (WINAPI* pNtQuerySystemTime)(signed long long*) = nullptr; 140 | #endif 141 | 142 | public: 143 | Funcs(); 144 | ~Funcs(); 145 | 146 | unsigned int MicroSleep(signed long long v); 147 | unsigned int QuerySystemTime(signed long long* v); 148 | 149 | #ifdef _WIN32 150 | wchar_t* GetUTF16(char* utf8); 151 | #endif 152 | 153 | bool GetFolderPath(const FIDs fID, char* folderPath, size_t szFolderPath); 154 | bool DoesFileExist(std::string filePath); 155 | }; 156 | } 157 | 158 | #endif -------------------------------------------------------------------------------- /src/WMMEntry.cpp: -------------------------------------------------------------------------------- 1 | // WINMMWRP 2 | 3 | #include "Common.hpp" 4 | #include "Loader.hpp" 5 | 6 | #define OMID 0 7 | #define DEVICEOVERRIDE uDeviceID != MIDI_MAPPER &&uDeviceID != 0 ? uDeviceID - 1 : uDeviceID 8 | #define OMCHECK hMidiOut == (HMIDIOUT)OMDummy 9 | #define OMCHECKS hStream == (HMIDISTRM)OMDummy 10 | 11 | typedef unsigned int (*mM)(unsigned int, unsigned int, DWORD_PTR, DWORD_PTR, DWORD_PTR); 12 | 13 | static OmniMIDI::Loader *ldr = nullptr; 14 | static DWORD_PTR OMUser = 0; 15 | static HMIDI OMDummy = (HMIDI)0x10001; 16 | 17 | extern "C" { 18 | EXPORT BOOL APIENTRY DllMain(HMODULE hModule, 19 | DWORD ul_reason_for_call, 20 | LPVOID lpReserved) 21 | { 22 | switch (ul_reason_for_call) 23 | { 24 | case DLL_PROCESS_ATTACH: 25 | case DLL_THREAD_ATTACH: 26 | if (ldr == nullptr) 27 | { 28 | ldr = new OmniMIDI::Loader; 29 | 30 | if (ldr->LoadWinMMModule()) 31 | { 32 | return TRUE; 33 | } 34 | } 35 | break; 36 | 37 | case DLL_THREAD_DETACH: 38 | case DLL_PROCESS_DETACH: 39 | break; 40 | } 41 | 42 | return FALSE; 43 | } 44 | 45 | EXPORT LRESULT WINAPI WRP_DefDriverProc(DWORD_PTR dwDId, HDRVR drv, UINT msg, LONG lP1, LONG lP2) 46 | { 47 | return MMDefDriverProc(dwDId, drv, msg, lP1, lP2); 48 | } 49 | 50 | EXPORT UINT WINAPI WRP_midiOutGetNumDevs() 51 | { 52 | #ifndef PURE_WRAPPER 53 | auto n = MMmidiOutGetNumDevs() + 1; 54 | return n; 55 | #else 56 | return MMmidiOutGetNumDevs(); 57 | #endif 58 | } 59 | 60 | EXPORT MMRESULT WINAPI WRP_midiOutGetDevCapsW(UINT_PTR uDeviceID, LPMIDIOUTCAPSW lpCaps, UINT uSize) 61 | { 62 | #ifndef PURE_WRAPPER 63 | memset(lpCaps, 0, fmin(uSize, sizeof(MIDIOUTCAPSW))); 64 | 65 | if (uDeviceID == OMID) 66 | { 67 | MIDIOUTCAPSW myCaps; 68 | 69 | if (!lpCaps || uSize != sizeof(MIDIOUTCAPSW)) 70 | return MMSYSERR_INVALPARAM; 71 | 72 | // Assign values 73 | myCaps.wMid = 0xFFFF; 74 | myCaps.wPid = 0xFFFF; 75 | 76 | wcsncpy(myCaps.szPname, L"KDMAPI", MAXPNAMELEN); 77 | 78 | myCaps.wVoices = 0xFFFF; 79 | myCaps.wNotes = 0xFFFF; 80 | myCaps.wTechnology = MOD_SYNTH; 81 | myCaps.wChannelMask = 0; 82 | 83 | // Add MIDICAPS_STREAM, since we won't be able to let WinMM handle the stream functions 84 | myCaps.dwSupport = MIDICAPS_STREAM; 85 | 86 | // Copy values to pointer, and return 0 87 | memcpy(lpCaps, &myCaps, fmin(uSize, sizeof(myCaps))); 88 | 89 | return MMSYSERR_NOERROR; 90 | } 91 | 92 | auto v = DEVICEOVERRIDE; 93 | #else 94 | auto v = uDeviceID; 95 | #endif 96 | 97 | auto r = MMmidiOutGetDevCapsW(v, lpCaps, uSize); 98 | return r; 99 | } 100 | 101 | EXPORT MMRESULT WINAPI WRP_midiOutGetDevCapsA(UINT_PTR uDeviceID, LPMIDIOUTCAPSA lpCaps, UINT uSize) 102 | { 103 | MIDIOUTCAPSA myCaps; 104 | MIDIOUTCAPSW myCapsW; 105 | UINT ret; 106 | 107 | if (!lpCaps || uSize != sizeof(MIDIOUTCAPSA)) 108 | return MMSYSERR_INVALPARAM; 109 | 110 | // Parse settings from OmniMIDI 111 | ret = WRP_midiOutGetDevCapsW(uDeviceID, &myCapsW, sizeof(MIDIOUTCAPSW)); 112 | 113 | if (ret == MMSYSERR_NOERROR) 114 | { 115 | // Assign values 116 | myCaps.wMid = myCapsW.wMid; 117 | myCaps.wPid = myCapsW.wPid; 118 | myCaps.wVoices = myCapsW.wVoices; 119 | myCaps.wNotes = myCapsW.wNotes; 120 | myCaps.wTechnology = myCapsW.wTechnology; 121 | myCaps.wChannelMask = myCapsW.wChannelMask; 122 | myCaps.dwSupport = myCapsW.dwSupport; 123 | 124 | // Convert wchar_t* to char* 125 | wcstombs(myCaps.szPname, myCapsW.szPname, MAXPNAMELEN); 126 | 127 | // Copy values to pointer, and return 0 128 | memcpy(lpCaps, &myCaps, fmin(uSize, sizeof(myCaps))); 129 | } 130 | 131 | return ret; 132 | } 133 | 134 | EXPORT MMRESULT WINAPI WRP_midiOutOpen(LPHMIDIOUT lphmo, UINT uDeviceID, DWORD_PTR dwCallback, DWORD_PTR dwCallbackInstance, DWORD dwFlags) 135 | { 136 | #ifndef PURE_WRAPPER 137 | if (uDeviceID == OMID) 138 | { 139 | if (ldr->LoadKDMAPIModule()) 140 | { 141 | MessageBoxA(NULL, "Success.", "KDMAPI", MB_SYSTEMMODAL | MB_ICONWARNING); 142 | 143 | if (*lphmo == (HMIDIOUT)OMDummy) 144 | return MMSYSERR_ALLOCATED; 145 | 146 | *lphmo = (HMIDIOUT)OMDummy; 147 | 148 | // Setup the Callback (If there's one) - NEEDED FOR VANBASCO! 149 | if (!InitializeCallbackFeatures((HMIDI *)(*lphmo), dwCallback, dwCallbackInstance, reinterpret_cast(&OMUser), dwFlags)) 150 | { 151 | MessageBoxA(NULL, "ICF failed!", "KDMAPI ERROR", MB_SYSTEMMODAL | MB_ICONERROR); 152 | return MMSYSERR_INVALPARAM; 153 | } 154 | 155 | // Close any stream, just to be safe 156 | TerminateKDMAPIStream(); 157 | 158 | // Initialize MIDI out 159 | if (!InitializeKDMAPIStream()) 160 | return MMSYSERR_ERROR; 161 | 162 | DriverSettings(0xFFFFF, NULL, NULL, NULL); 163 | 164 | RunCallbackFunction(MM_MOM_OPEN, 0, 0); 165 | 166 | return MMSYSERR_NOERROR; 167 | } 168 | else 169 | return MMSYSERR_NOMEM; 170 | } 171 | 172 | return MMmidiOutOpen(lphmo, DEVICEOVERRIDE, dwCallback, dwCallbackInstance, dwFlags); 173 | #else 174 | return MMmidiOutOpen(lphmo, uDeviceID, dwCallback, dwCallbackInstance, dwFlags); 175 | #endif 176 | } 177 | 178 | EXPORT MMRESULT WINAPI WRP_midiOutClose(HMIDIOUT hMidiOut) 179 | { 180 | #ifndef PURE_WRAPPER 181 | if (OMCHECK) 182 | { 183 | if (ldr->IsKDMAPILoaded()) 184 | { 185 | if (!TerminateKDMAPIStream()) 186 | return MMSYSERR_NOMEM; 187 | 188 | DriverSettings(0xFFFFE, NULL, NULL, NULL); 189 | 190 | RunCallbackFunction(MM_MOM_CLOSE, 0, 0); 191 | 192 | hMidiOut = (HMIDIOUT)0; 193 | 194 | if (!ldr->FreeKDMAPIModule()) 195 | { 196 | #ifdef _DEBUG 197 | throw; 198 | #endif 199 | 200 | return MMSYSERR_NOMEM; 201 | } 202 | } 203 | 204 | return MMSYSERR_NOERROR; 205 | } 206 | #endif 207 | 208 | return MMmidiOutClose(hMidiOut); 209 | } 210 | 211 | EXPORT MMRESULT WINAPI WRP_midiOutReset(HMIDIOUT hMidiOut) 212 | { 213 | #ifndef PURE_WRAPPER 214 | if (OMCHECK) 215 | { 216 | ResetKDMAPIStream(); 217 | return MMSYSERR_NOERROR; 218 | } 219 | #endif 220 | 221 | return MMmidiOutReset(hMidiOut); 222 | } 223 | 224 | EXPORT MMRESULT WINAPI WRP_midiOutPrepareHeader(HMIDIOUT hMidiOut, LPMIDIHDR lpMidiOutHdr, UINT uSize) 225 | { 226 | #ifndef PURE_WRAPPER 227 | if (OMCHECK) 228 | PrepareLongData(lpMidiOutHdr, uSize); 229 | #endif 230 | 231 | return MMmidiOutPrepareHeader(hMidiOut, lpMidiOutHdr, uSize); 232 | } 233 | 234 | EXPORT MMRESULT WINAPI WRP_midiOutUnprepareHeader(HMIDIOUT hMidiOut, LPMIDIHDR lpMidiOutHdr, UINT uSize) 235 | { 236 | #ifndef PURE_WRAPPER 237 | if (OMCHECK) 238 | UnprepareLongData(lpMidiOutHdr, uSize); 239 | #endif 240 | 241 | return MMmidiOutUnprepareHeader(hMidiOut, lpMidiOutHdr, uSize); 242 | } 243 | 244 | EXPORT MMRESULT WINAPI WRP_midiOutShortMsg(HMIDIOUT hMidiOut, DWORD dwMsg) 245 | { 246 | #ifndef PURE_WRAPPER 247 | if (OMCHECK) 248 | { 249 | SendDirectData(dwMsg); 250 | return MMSYSERR_NOERROR; 251 | } 252 | #endif 253 | 254 | auto dev = (midi_device_internal_t *)hMidiOut; 255 | return dev->vtbl->modMessage(dev->id, MODM_DATA, dev->user_ptr, (DWORD_PTR)dwMsg, 0); 256 | } 257 | 258 | EXPORT MMRESULT WINAPI WRP_midiOutLongMsg(HMIDIOUT hMidiOut, LPMIDIHDR lpMidiOutHdr, UINT uSize) 259 | { 260 | #ifndef PURE_WRAPPER 261 | if (OMCHECK) 262 | { 263 | // Forward the buffer to KDMAPI 264 | MMRESULT Ret = SendDirectLongData(lpMidiOutHdr, uSize); 265 | 266 | // Inform the app that the driver successfully received the long message (Required for vanBasco to work), and return the MMRESULT 267 | RunCallbackFunction(MM_MOM_DONE, (DWORD_PTR)hMidiOut, (DWORD_PTR)lpMidiOutHdr); 268 | 269 | return Ret; 270 | } 271 | #endif 272 | 273 | return MMmidiOutLongMsg(hMidiOut, lpMidiOutHdr, uSize); 274 | } 275 | 276 | EXPORT MMRESULT WINAPI WRP_midiOutMessage(HMIDIOUT hMidiOut, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2) 277 | { 278 | #ifndef PURE_WRAPPER 279 | if (OMCHECK) 280 | return MMSYSERR_NOERROR; 281 | #endif 282 | 283 | return MMmidiOutMessage(hMidiOut, uMsg, dw1, dw2); 284 | } 285 | 286 | EXPORT MMRESULT WINAPI WRP_midiOutSetVolume(HMIDIOUT hMidiOut, DWORD dwVolume) 287 | { 288 | #ifndef PURE_WRAPPER 289 | if (OMCHECK) 290 | return modMessage(0, MODM_SETVOLUME, OMUser, dwVolume, 0); 291 | #endif 292 | 293 | return MMmidiOutSetVolume(hMidiOut, dwVolume); 294 | } 295 | 296 | EXPORT MMRESULT WINAPI WRP_midiOutGetVolume(HMIDIOUT hMidiOut, LPDWORD lpdwVolume) 297 | { 298 | #ifndef PURE_WRAPPER 299 | if (OMCHECK) 300 | return modMessage(0, MODM_GETVOLUME, OMUser, (DWORD_PTR)lpdwVolume, 0); 301 | #endif 302 | 303 | return MMmidiOutGetVolume(hMidiOut, lpdwVolume); 304 | } 305 | 306 | EXPORT MMRESULT WINAPI WRP_midiOutGetID(HMIDIOUT hMidiOut, LPUINT puDeviceID) 307 | { 308 | #ifndef PURE_WRAPPER 309 | UINT Dummy = 0; 310 | MMRESULT ret = MMmidiOutGetID(hMidiOut, &Dummy); 311 | if (ret == MMSYSERR_NOERROR) 312 | { 313 | switch (Dummy) 314 | { 315 | 316 | case MIDI_MAPPER: 317 | *puDeviceID = MIDI_MAPPER; 318 | break; 319 | default: 320 | *puDeviceID = Dummy - 1; 321 | break; 322 | } 323 | } 324 | return ret; 325 | #else 326 | return MMmidiOutGetID(hMidiOut, puDeviceID); 327 | #endif 328 | } 329 | 330 | EXPORT MMRESULT WINAPI WRP_midiOutCachePatches(HMIDIOUT hMidiOut, UINT wPatch, LPWORD lpPatchArray, UINT wFlags) 331 | { 332 | #ifndef PURE_WRAPPER 333 | if (OMCHECK) 334 | return MMSYSERR_NOERROR; 335 | #endif 336 | 337 | return MMmidiOutCachePatches(hMidiOut, wPatch, lpPatchArray, wFlags); 338 | } 339 | 340 | EXPORT MMRESULT WINAPI WRP_midiOutCacheDrumPatches(HMIDIOUT hMidiOut, UINT wPatch, LPWORD lpKeyArray, UINT wFlags) 341 | { 342 | #ifndef PURE_WRAPPER 343 | if (OMCHECK) 344 | return MMSYSERR_NOERROR; 345 | #endif 346 | 347 | return MMmidiOutCacheDrumPatches(hMidiOut, wPatch, lpKeyArray, wFlags); 348 | } 349 | 350 | EXPORT MMRESULT WINAPI WRP_midiStreamOpen(LPHMIDISTRM lphStream, LPUINT puDeviceID, DWORD cMidi, DWORD_PTR dwCallback, DWORD_PTR dwCallbackInstance, DWORD fdwOpen) 351 | { 352 | #ifndef PURE_WRAPPER 353 | if (puDeviceID == OMID) 354 | { 355 | if (*lphStream == (HMIDISTRM)OMDummy) 356 | return MMSYSERR_ALLOCATED; 357 | 358 | *lphStream = (HMIDISTRM)OMDummy; 359 | 360 | // Setup the Callback (If there's one) - NEEDED FOR VANBASCO! 361 | if (!InitializeCallbackFeatures((HMIDI *)(*lphStream), dwCallback, dwCallbackInstance, reinterpret_cast(&OMUser), fdwOpen | MIDI_IO_COOKED)) 362 | { 363 | MessageBoxA(NULL, "ICF failed!", "KDMAPI ERROR", MB_SYSTEMMODAL | MB_ICONERROR); 364 | return MMSYSERR_INVALPARAM; 365 | } 366 | 367 | // Close any stream, just to be safe 368 | TerminateKDMAPIStream(); 369 | 370 | // Initialize MIDI out 371 | if (!InitializeKDMAPIStream()) 372 | return MMSYSERR_ERROR; 373 | 374 | RunCallbackFunction(MM_MOM_OPEN, 0, 0); 375 | 376 | return MMSYSERR_NOERROR; 377 | } 378 | #endif 379 | 380 | return MMmidiStreamOpen(lphStream, puDeviceID, cMidi, dwCallback, dwCallbackInstance, fdwOpen); 381 | } 382 | 383 | EXPORT MMRESULT WINAPI WRP_midiStreamClose(HMIDISTRM hStream) 384 | { 385 | #ifndef PURE_WRAPPER 386 | if (OMCHECKS) 387 | { 388 | if (!TerminateKDMAPIStream()) 389 | return MMSYSERR_NOMEM; 390 | 391 | RunCallbackFunction(MM_MOM_CLOSE, 0, 0); 392 | hStream = (HMIDISTRM)0; 393 | 394 | return MMSYSERR_NOERROR; 395 | } 396 | #endif 397 | 398 | return MMmidiStreamClose(hStream); 399 | } 400 | 401 | EXPORT MMRESULT WINAPI WRP_midiStreamOut(HMIDISTRM hStream, LPMIDIHDR lpMidiOutHdr, UINT uSize) 402 | { 403 | #ifndef PURE_WRAPPER 404 | if (OMCHECKS) 405 | return modMessage(0, MODM_STRMDATA, OMUser, (DWORD_PTR)lpMidiOutHdr, (DWORD_PTR)uSize); 406 | #endif 407 | 408 | return MMmidiStreamOut(hStream, lpMidiOutHdr, uSize); 409 | } 410 | 411 | EXPORT MMRESULT WINAPI WRP_midiStreamPause(HMIDISTRM hStream) 412 | { 413 | #ifndef PURE_WRAPPER 414 | if (OMCHECKS) 415 | return modMessage(0, MODM_PAUSE, OMUser, 0, 0); 416 | #endif 417 | 418 | return MMmidiStreamPause(hStream); 419 | } 420 | 421 | EXPORT MMRESULT WINAPI WRP_midiStreamRestart(HMIDISTRM hStream) 422 | { 423 | #ifndef PURE_WRAPPER 424 | if (OMCHECKS) 425 | return modMessage(0, MODM_RESTART, OMUser, 0, 0); 426 | #endif 427 | 428 | return MMmidiStreamRestart(hStream); 429 | } 430 | 431 | EXPORT MMRESULT WINAPI WRP_midiStreamStop(HMIDISTRM hStream) 432 | { 433 | #ifndef PURE_WRAPPER 434 | if (OMCHECKS) 435 | return modMessage(0, MODM_STOP, OMUser, 0, 0); 436 | #endif 437 | 438 | return MMmidiStreamStop(hStream); 439 | } 440 | 441 | EXPORT MMRESULT WINAPI WRP_midiStreamProperty(HMIDISTRM hStream, LPBYTE lppropdata, DWORD dwProperty) 442 | { 443 | #ifndef PURE_WRAPPER 444 | if (OMCHECKS) 445 | return modMessage(0, MODM_PROPERTIES, OMUser, (DWORD_PTR)lppropdata, (DWORD)dwProperty); 446 | #endif 447 | 448 | return MMmidiStreamProperty(hStream, lppropdata, dwProperty); 449 | } 450 | 451 | EXPORT MMRESULT WINAPI WRP_midiStreamPosition(HMIDISTRM hStream, LPMMTIME pmmt, UINT cbmmt) 452 | { 453 | #ifndef PURE_WRAPPER 454 | if (OMCHECKS) 455 | return modMessage(0, MODM_GETPOS, OMUser, (DWORD_PTR)pmmt, (DWORD)cbmmt); 456 | #endif 457 | 458 | return MMmidiStreamPosition(hStream, pmmt, cbmmt); 459 | } 460 | 461 | EXPORT DWORD WINAPI WRP_mixerGetNumDevs() 462 | { 463 | #ifdef CODPATCH 464 | DWORD ret = MMmixerGetNumDevs(); 465 | return ret > 15 ? 15 : ret; 466 | #else 467 | return MMmixerGetNumDevs(); 468 | #endif 469 | } 470 | 471 | EXPORT DWORD WINAPI WRP_waveInGetNumDevs() 472 | { 473 | #ifdef CODPATCH 474 | DWORD ret = MMwaveInGetNumDevs(); 475 | return ret > 15 ? 15 : ret; 476 | #else 477 | return MMwaveInGetNumDevs(); 478 | #endif 479 | } 480 | } -------------------------------------------------------------------------------- /src/WinMM.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | OmniMIDI v15+ (Rewrite) for Windows NT 4 | 5 | This file contains the required code to run the driver under Windows 7 SP1 and later. 6 | This file is useful only if you want to compile the driver under Windows, it's not needed for Linux/macOS porting. 7 | 8 | */ 9 | 10 | #include "WinMM.hpp" 11 | 12 | // MIDI out stuff 13 | MMRESULT(WINAPI* MMmidiStreamClose)(HMIDISTRM) = 0; 14 | MMRESULT(WINAPI* MMmidiStreamOpen)(LPHMIDISTRM, LPUINT, DWORD, DWORD_PTR, DWORD_PTR, DWORD) = 0; 15 | MMRESULT(WINAPI* MMmidiStreamOut)(HMIDISTRM, LPMIDIHDR, UINT) = 0; 16 | MMRESULT(WINAPI* MMmidiStreamPause)(HMIDISTRM) = 0; 17 | MMRESULT(WINAPI* MMmidiStreamPosition)(HMIDISTRM, LPMMTIME, UINT) = 0; 18 | MMRESULT(WINAPI* MMmidiStreamProperty)(HMIDISTRM, LPBYTE, DWORD) = 0; 19 | MMRESULT(WINAPI* MMmidiStreamRestart)(HMIDISTRM) = 0; 20 | MMRESULT(WINAPI* MMmidiStreamStop)(HMIDISTRM) = 0; 21 | MMRESULT(WINAPI* MMmidiOutCacheDrumPatches)(HMIDIOUT, UINT, LPWORD, UINT) = 0; 22 | MMRESULT(WINAPI* MMmidiOutCachePatches)(HMIDIOUT, UINT, LPWORD, UINT) = 0; 23 | MMRESULT(WINAPI* MMmidiOutClose)(HMIDIOUT) = 0; 24 | MMRESULT(WINAPI* MMmidiOutGetDevCapsA)(UINT_PTR, LPMIDIOUTCAPSA, UINT) = 0; 25 | MMRESULT(WINAPI* MMmidiOutGetDevCapsW)(UINT_PTR, LPMIDIOUTCAPSW, UINT) = 0; 26 | MMRESULT(WINAPI* MMmidiOutGetErrorTextA)(MMRESULT, LPSTR, UINT) = 0; 27 | MMRESULT(WINAPI* MMmidiOutGetErrorTextW)(MMRESULT, LPWSTR, UINT) = 0; 28 | MMRESULT(WINAPI* MMmidiOutGetID)(HMIDIOUT, LPUINT) = 0; 29 | MMRESULT(WINAPI* MMmidiOutGetVolume)(HMIDIOUT, LPDWORD) = 0; 30 | MMRESULT(WINAPI* MMmidiOutLongMsg)(HMIDIOUT, LPMIDIHDR, UINT) = 0; 31 | MMRESULT(WINAPI* MMmidiOutMessage)(HMIDIOUT, UINT, DWORD_PTR, DWORD_PTR) = 0; 32 | MMRESULT(WINAPI* MMmidiOutOpen)(LPHMIDIOUT, UINT, DWORD_PTR, DWORD_PTR, DWORD) = 0; 33 | MMRESULT(WINAPI* MMmidiOutPrepareHeader)(HMIDIOUT, LPMIDIHDR, UINT) = 0; 34 | MMRESULT(WINAPI* MMmidiOutReset)(HMIDIOUT) = 0; 35 | MMRESULT(WINAPI* MMmidiOutSetVolume)(HMIDIOUT, DWORD) = 0; 36 | MMRESULT(WINAPI* MMmidiOutShortMsg)(HMIDIOUT, DWORD) = 0; 37 | MMRESULT(WINAPI* MMmidiOutUnprepareHeader)(HMIDIOUT, LPMIDIHDR, UINT) = 0; 38 | UINT(WINAPI* MMmidiOutGetNumDevs)() = 0; 39 | // MIDI out stuff 40 | 41 | // MIDI in stuff 42 | MMRESULT(WINAPI* MMmidiConnect)(HMIDI, HMIDIOUT, LPVOID) = 0; 43 | MMRESULT(WINAPI* MMmidiDisconnect)(HMIDI, HMIDIOUT, LPVOID) = 0; 44 | MMRESULT(WINAPI* MMmidiInAddBuffer)(HMIDIIN, LPMIDIHDR, UINT) = 0; 45 | MMRESULT(WINAPI* MMmidiInClose)(HMIDIIN) = 0; 46 | MMRESULT(WINAPI* MMmidiInGetDevCapsA)(UINT_PTR, LPMIDIINCAPSA, UINT) = 0; 47 | MMRESULT(WINAPI* MMmidiInGetDevCapsW)(UINT_PTR, LPMIDIINCAPSW, UINT) = 0; 48 | MMRESULT(WINAPI* MMmidiInGetErrorTextA)(MMRESULT, LPSTR, UINT) = 0; 49 | MMRESULT(WINAPI* MMmidiInGetErrorTextW)(MMRESULT, LPWSTR, UINT) = 0; 50 | MMRESULT(WINAPI* MMmidiInGetID)(HMIDIIN, LPUINT) = 0; 51 | MMRESULT(WINAPI* MMmidiInMessage)(HMIDIIN, UINT, DWORD_PTR, DWORD_PTR) = 0; 52 | MMRESULT(WINAPI* MMmidiInOpen)(LPHMIDIIN, UINT, DWORD_PTR, DWORD_PTR, DWORD) = 0; 53 | MMRESULT(WINAPI* MMmidiInPrepareHeader)(HMIDIIN, LPMIDIHDR, UINT) = 0; 54 | MMRESULT(WINAPI* MMmidiInReset)(HMIDIIN) = 0; 55 | MMRESULT(WINAPI* MMmidiInStart)(HMIDIIN) = 0; 56 | MMRESULT(WINAPI* MMmidiInStop)(HMIDIIN) = 0; 57 | MMRESULT(WINAPI* MMmidiInUnprepareHeader)(HMIDIIN, LPMIDIHDR, UINT) = 0; 58 | UINT(WINAPI* MMmidiInGetNumDevs)() = 0; 59 | // MIDI in stuff 60 | 61 | // Time related stuff 62 | DWORD(WINAPI* MMtimeGetTime)() = 0; 63 | MMRESULT(WINAPI* MMtimeBeginPeriod)(UINT) = 0; 64 | MMRESULT(WINAPI* MMtimeEndPeriod)(UINT) = 0; 65 | MMRESULT(WINAPI* MMtimeGetDevCaps)(LPTIMECAPS, UINT) = 0; 66 | MMRESULT(WINAPI* MMtimeGetSystemTime)(LPMMTIME, UINT) = 0; 67 | MMRESULT(WINAPI* MMtimeKillEvent)(UINT) = 0; 68 | MMRESULT(WINAPI* MMtimeSetEvent)(UINT, UINT, LPTIMECALLBACK, DWORD_PTR, UINT) = 0; 69 | // Time related stuff 70 | 71 | // Driver stuff 72 | 73 | HDRVR(WINAPI* MMOpenDriver)(_In_ LPCWSTR, _In_ LPCWSTR, _In_ LPARAM) = 0; 74 | LRESULT(WINAPI* MMCloseDriver)(_In_ HDRVR, _In_ LPARAM, _In_ LPARAM) = 0; 75 | LRESULT(WINAPI* MMSendDriverMessage)(_In_ HDRVR, _In_ UINT, _Inout_ LPARAM, _Inout_ LPARAM) = 0; 76 | BOOL(WINAPI* MMmmDrvInstall)(LPCSTR, LPCSTR, BOOL) = 0; 77 | DWORD(WINAPI* MMmmGetCurrentTask)() = 0; 78 | HMODULE(WINAPI* MMDrvGetModuleHandle)(_In_ HDRVR) = 0; 79 | HMODULE(WINAPI* MMGetDriverModuleHandle)(_In_ HDRVR) = 0; 80 | LRESULT(WINAPI* MMDefDriverProc)(DWORD_PTR, HDRVR, UINT, LONG, LONG) = 0; 81 | LRESULT(WINAPI* MMDriverCallback)(DWORD, DWORD, HDRVR, DWORD, DWORD, DWORD, DWORD) = 0; 82 | // Driver stuff 83 | 84 | // Game-related stuff 85 | MMRESULT(WINAPI* MMjoyConfigChanged)(DWORD) = 0; 86 | MMRESULT(WINAPI* MMjoyGetDevCapsA)(UINT, LPJOYCAPSA, UINT) = 0; 87 | MMRESULT(WINAPI* MMjoyGetDevCapsW)(UINT, LPJOYCAPSW, UINT) = 0; 88 | MMRESULT(WINAPI* MMjoyGetPos)(UINT, LPJOYINFO) = 0; 89 | MMRESULT(WINAPI* MMjoyGetPosEx)(UINT, LPJOYINFOEX) = 0; 90 | MMRESULT(WINAPI* MMjoyGetThreshold)(UINT, LPUINT) = 0; 91 | MMRESULT(WINAPI* MMjoySetThreshold)(UINT, UINT) = 0; 92 | MMRESULT(WINAPI* MMjoyReleaseCapture)(UINT) = 0; 93 | MMRESULT(WINAPI* MMjoySetCapture)(HWND, UINT, UINT, BOOL) = 0; 94 | UINT(WINAPI* MMjoyGetNumDevs)() = 0; 95 | // Game related stuff 96 | 97 | // MCI stuff 98 | BOOL(WINAPI* MMmciDriverNotify)(HWND, UINT, UINT) = 0; 99 | BOOL(WINAPI* MMmciExecute)(LPCSTR) = 0; 100 | BOOL(WINAPI* MMmciFreeCommandResource)(UINT) = 0; 101 | BOOL(WINAPI* MMmciGetErrorStringA)(DWORD, LPTSTR, UINT) = 0; 102 | BOOL(WINAPI* MMmciGetErrorStringW)(DWORD, LPWSTR, UINT) = 0; 103 | BOOL(WINAPI* MMmciSetDriverData)(UINT, DWORD) = 0; 104 | DWORD(WINAPI* MMmciGetDriverData)(UINT) = 0; 105 | HANDLE(WINAPI* MMmciGetCreatorTask)(MCIDEVICEID) = 0; 106 | MCIDEVICEID(WINAPI* MMmciGetDeviceIDA)(LPCTSTR) = 0; 107 | MCIDEVICEID(WINAPI* MMmciGetDeviceIDFromElementIDA)(DWORD, LPCTSTR) = 0; 108 | MCIDEVICEID(WINAPI* MMmciGetDeviceIDFromElementIDW)(DWORD, LPCWSTR) = 0; 109 | MCIDEVICEID(WINAPI* MMmciGetDeviceIDW)(LPCWSTR) = 0; 110 | MCIERROR(WINAPI* MMmciSendCommandA)(MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR) = 0; 111 | MCIERROR(WINAPI* MMmciSendCommandW)(MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR) = 0; 112 | MCIERROR(WINAPI* MMmciSendStringA)(LPCTSTR, LPTSTR, UINT, HANDLE) = 0; 113 | MCIERROR(WINAPI* MMmciSendStringW)(LPCWSTR, LPWSTR, UINT, HANDLE) = 0; 114 | UINT(WINAPI* MMmciDriverYield)(UINT) = 0; 115 | UINT(WINAPI* MMmciLoadCommandResource)(HINSTANCE, LPCWSTR, UINT) = 0; 116 | UINT(WINAPI* MMmciSetYieldProc)(MCIDEVICEID, YIELDPROC, DWORD) = 0; 117 | YIELDPROC(WINAPI* MMmciGetYieldProc)(MCIDEVICEID, LPDWORD) = 0; 118 | // MCI stuff 119 | 120 | // Mixer stuff 121 | DWORD(WINAPI* MMmixerMessage)(HMIXER, UINT, DWORD_PTR, DWORD_PTR) = 0; 122 | MMRESULT(WINAPI* MMmixerClose)(HMIXER) = 0; 123 | MMRESULT(WINAPI* MMmixerGetControlDetailsA)(HMIXEROBJ, LPMIXERCONTROLDETAILS, DWORD) = 0; 124 | MMRESULT(WINAPI* MMmixerGetControlDetailsW)(HMIXEROBJ, LPMIXERCONTROLDETAILS, DWORD) = 0; 125 | MMRESULT(WINAPI* MMmixerGetDevCapsA)(UINT_PTR, LPMIXERCAPSA, UINT) = 0; 126 | MMRESULT(WINAPI* MMmixerGetDevCapsW)(UINT_PTR, LPMIXERCAPSW, UINT) = 0; 127 | MMRESULT(WINAPI* MMmixerGetID)(HMIXEROBJ, UINT FAR*, DWORD) = 0; 128 | MMRESULT(WINAPI* MMmixerGetLineControlsA)(HMIXEROBJ, LPMIXERLINECONTROLSA, DWORD) = 0; 129 | MMRESULT(WINAPI* MMmixerGetLineControlsW)(HMIXEROBJ, LPMIXERLINECONTROLSW, DWORD) = 0; 130 | MMRESULT(WINAPI* MMmixerGetLineInfoA)(HMIXEROBJ, LPMIXERLINEA, DWORD) = 0; 131 | MMRESULT(WINAPI* MMmixerGetLineInfoW)(HMIXEROBJ, LPMIXERLINEW, DWORD) = 0; 132 | MMRESULT(WINAPI* MMmixerOpen)(LPHMIXER, UINT, DWORD_PTR, DWORD_PTR, DWORD) = 0; 133 | MMRESULT(WINAPI* MMmixerSetControlDetails)(HMIXEROBJ, LPMIXERCONTROLDETAILS, DWORD) = 0; 134 | UINT(WINAPI* MMmixerGetNumDevs)() = 0; 135 | // Mixer stuff 136 | 137 | // MMIO stuff 138 | FOURCC(WINAPI* MMmmioStringToFOURCCA)(LPCTSTR, UINT) = 0; 139 | FOURCC(WINAPI* MMmmioStringToFOURCCW)(LPCWSTR, UINT) = 0; 140 | LONG(WINAPI* MMmmioRead)(HMMIO, HPSTR, LONG) = 0; 141 | LONG(WINAPI* MMmmioSeek)(HMMIO, LONG, INT) = 0; 142 | LONG(WINAPI* MMmmioWrite)(HMMIO, char _huge*, LONG) = 0; 143 | LPMMIOPROC(WINAPI* MMmmioInstallIOProcA)(FOURCC, LPMMIOPROC, DWORD) = 0; 144 | LPMMIOPROC(WINAPI* MMmmioInstallIOProcW)(FOURCC, LPMMIOPROC, DWORD) = 0; 145 | LRESULT(WINAPI* MMmmioSendMessage)(HMMIO, UINT, LPARAM, LPARAM) = 0; 146 | MMRESULT(WINAPI* MMmmioAdvance)(HMMIO, LPMMIOINFO, UINT) = 0; 147 | MMRESULT(WINAPI* MMmmioAscend)(HMMIO, LPMMCKINFO, UINT) = 0; 148 | MMRESULT(WINAPI* MMmmioClose)(HMMIO, UINT) = 0; 149 | MMRESULT(WINAPI* MMmmioCreateChunk)(HMMIO, LPMMCKINFO, UINT) = 0; 150 | MMRESULT(WINAPI* MMmmioDescend)(HMMIO, LPMMCKINFO, const MMCKINFO*, UINT) = 0; 151 | MMRESULT(WINAPI* MMmmioFlush)(HMMIO, UINT) = 0; 152 | MMRESULT(WINAPI* MMmmioGetInfo)(HMMIO, LPMMIOINFO, UINT) = 0; 153 | MMRESULT(WINAPI* MMmmioOpenA)(LPTSTR, LPMMIOINFO, DWORD) = 0; 154 | MMRESULT(WINAPI* MMmmioOpenW)(LPWSTR, LPMMIOINFO, DWORD) = 0; 155 | MMRESULT(WINAPI* MMmmioRenameA)(LPCTSTR, LPCTSTR, const LPMMIOINFO, DWORD) = 0; 156 | MMRESULT(WINAPI* MMmmioRenameW)(LPCWSTR, LPCWSTR, const LPMMIOINFO, DWORD) = 0; 157 | MMRESULT(WINAPI* MMmmioSetBuffer)(HMMIO, LPSTR, LONG, UINT) = 0; 158 | MMRESULT(WINAPI* MMmmioSetInfo)(HMMIO, LPMMIOINFO, UINT) = 0; 159 | // MMIO stuff 160 | 161 | // MM stuff 162 | BOOL(WINAPI* MMmmTaskSignal)(DWORD) = 0; 163 | UINT(WINAPI* MMmmTaskCreate)(LPTASKCALLBACK, HANDLE, DWORD_PTR) = 0; 164 | VOID(WINAPI* MMmmTaskBlock)(DWORD) = 0; 165 | VOID(WINAPI* MMmmTaskYield)() = 0; 166 | // MM stuff 167 | 168 | // PlaySound stuff 169 | BOOL(WINAPI* MMPlaySound)(LPCSTR, HMODULE, DWORD) = 0; 170 | BOOL(WINAPI* MMPlaySoundA)(LPCTSTR, HMODULE, DWORD) = 0; 171 | BOOL(WINAPI* MMPlaySoundW)(LPCWSTR, HMODULE, DWORD) = 0; 172 | BOOL(WINAPI* MMsndPlaySound)(LPCSTR, UINT) = 0; 173 | BOOL(WINAPI* MMsndPlaySoundA)(LPCTSTR, UINT) = 0; 174 | BOOL(WINAPI* MMsndPlaySoundW)(LPCWSTR, UINT) = 0; 175 | // PlaySound stuff 176 | 177 | // Aux stuff 178 | DWORD(WINAPI* MMauxOutMessage)(UINT, UINT, DWORD_PTR, DWORD_PTR) = 0; 179 | MMRESULT(WINAPI* MMauxGetDevCapsA)(UINT_PTR, LPAUXCAPSA, UINT) = 0; 180 | MMRESULT(WINAPI* MMauxGetDevCapsW)(UINT_PTR, LPAUXCAPSW, UINT) = 0; 181 | MMRESULT(WINAPI* MMauxGetVolume)(UINT, LPDWORD) = 0; 182 | MMRESULT(WINAPI* MMauxSetVolume)(UINT, DWORD) = 0; 183 | UINT(WINAPI* MMauxGetNumDevs)() = 0; 184 | // Aux stuff 185 | 186 | // Wave out stuff 187 | DWORD(WINAPI* MMwaveOutMessage)(HWAVEOUT, UINT, DWORD_PTR, DWORD_PTR) = 0; 188 | MMRESULT(WINAPI* MMwaveOutAddBuffer)(HWAVEOUT, LPWAVEHDR, UINT) = 0; 189 | MMRESULT(WINAPI* MMwaveOutBreakLoop)(HWAVEOUT) = 0; 190 | MMRESULT(WINAPI* MMwaveOutClose)(HWAVEOUT) = 0; 191 | MMRESULT(WINAPI* MMwaveOutGetDevCapsA)(UINT_PTR, LPWAVEOUTCAPSA, UINT) = 0; 192 | MMRESULT(WINAPI* MMwaveOutGetDevCapsW)(UINT_PTR, LPWAVEOUTCAPSW, UINT) = 0; 193 | MMRESULT(WINAPI* MMwaveOutGetErrorTextA)(MMRESULT, LPTSTR, UINT) = 0; 194 | MMRESULT(WINAPI* MMwaveOutGetErrorTextW)(MMRESULT, LPWSTR, UINT) = 0; 195 | MMRESULT(WINAPI* MMwaveOutGetID)(HWAVEOUT, LPUINT) = 0; 196 | MMRESULT(WINAPI* MMwaveOutGetPitch)(HWAVEOUT, LPDWORD) = 0; 197 | MMRESULT(WINAPI* MMwaveOutGetPlaybackRate)(HWAVEOUT, LPDWORD) = 0; 198 | MMRESULT(WINAPI* MMwaveOutGetPosition)(HWAVEOUT, LPMMTIME, UINT) = 0; 199 | MMRESULT(WINAPI* MMwaveOutGetVolume)(HWAVEOUT, LPDWORD) = 0; 200 | MMRESULT(WINAPI* MMwaveOutOpen)(LPHWAVEOUT, UINT, LPCWAVEFORMATEX, DWORD_PTR, DWORD_PTR, DWORD) = 0; 201 | MMRESULT(WINAPI* MMwaveOutPrepareHeader)(HWAVEOUT, LPWAVEHDR, UINT) = 0; 202 | MMRESULT(WINAPI* MMwaveOutReset)(HWAVEOUT) = 0; 203 | MMRESULT(WINAPI* MMwaveOutRestart)(HWAVEOUT) = 0; 204 | MMRESULT(WINAPI* MMwaveOutPause)(HWAVEOUT) = 0; 205 | MMRESULT(WINAPI* MMwaveOutSetPitch)(HWAVEOUT, DWORD) = 0; 206 | MMRESULT(WINAPI* MMwaveOutSetPlaybackRate)(HWAVEOUT, DWORD) = 0; 207 | MMRESULT(WINAPI* MMwaveOutSetVolume)(HWAVEOUT, DWORD) = 0; 208 | MMRESULT(WINAPI* MMwaveOutStart)(HWAVEOUT) = 0; 209 | MMRESULT(WINAPI* MMwaveOutStop)(HWAVEOUT) = 0; 210 | MMRESULT(WINAPI* MMwaveOutUnprepareHeader)(HWAVEOUT, LPWAVEHDR, UINT) = 0; 211 | MMRESULT(WINAPI* MMwaveOutWrite)(HWAVEOUT, LPWAVEHDR, UINT) = 0; 212 | UINT(WINAPI* MMwaveOutGetNumDevs)() = 0; 213 | // Wave out stuff 214 | 215 | // Wave in stuff 216 | DWORD(WINAPI* MMwaveInMessage)(HWAVEIN, UINT, DWORD_PTR, DWORD_PTR) = 0; 217 | MMRESULT(WINAPI* MMwaveInAddBuffer)(HWAVEIN, LPWAVEHDR, UINT) = 0; 218 | MMRESULT(WINAPI* MMwaveInClose)(HWAVEIN) = 0; 219 | MMRESULT(WINAPI* MMwaveInGetDevCapsA)(UINT_PTR, LPWAVEINCAPSA, UINT) = 0; 220 | MMRESULT(WINAPI* MMwaveInGetDevCapsW)(UINT_PTR, LPWAVEINCAPSW, UINT) = 0; 221 | MMRESULT(WINAPI* MMwaveInGetErrorTextA)(MMRESULT, LPTSTR, UINT) = 0; 222 | MMRESULT(WINAPI* MMwaveInGetErrorTextW)(MMRESULT, LPWSTR, UINT) = 0; 223 | MMRESULT(WINAPI* MMwaveInGetID)(HWAVEIN, LPUINT) = 0; 224 | MMRESULT(WINAPI* MMwaveInGetPosition)(HWAVEIN, LPMMTIME, UINT) = 0; 225 | MMRESULT(WINAPI* MMwaveInOpen)(LPHWAVEIN, UINT, LPCWAVEFORMATEX, DWORD_PTR, DWORD_PTR, DWORD) = 0; 226 | MMRESULT(WINAPI* MMwaveInPrepareHeader)(HWAVEIN, LPWAVEHDR, UINT) = 0; 227 | MMRESULT(WINAPI* MMwaveInReset)(HWAVEIN) = 0; 228 | MMRESULT(WINAPI* MMwaveInStart)(HWAVEIN) = 0; 229 | MMRESULT(WINAPI* MMwaveInStop)(HWAVEIN) = 0; 230 | MMRESULT(WINAPI* MMwaveInUnprepareHeader)(HWAVEIN, LPWAVEHDR, UINT) = 0; 231 | UINT(WINAPI* MMwaveInGetNumDevs)() = 0; 232 | // Wave in stuff 233 | 234 | #ifdef _M_IX86 235 | // Legacy 16-bit functions 236 | MMRESULT(WINAPI* MMaux32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR) = 0; 237 | MMRESULT(WINAPI* MMjoy32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR) = 0; 238 | MMRESULT(WINAPI* MMmci32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR) = 0; 239 | MMRESULT(WINAPI* MMmid32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR) = 0; 240 | MMRESULT(WINAPI* MMmod32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR) = 0; 241 | MMRESULT(WINAPI* MMmxd32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR) = 0; 242 | MMRESULT(WINAPI* MMtid32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR) = 0; 243 | MMRESULT(WINAPI* MMwid32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR) = 0; 244 | MMRESULT(WINAPI* MMwod32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR) = 0; 245 | // Legacy 16-bit functions 246 | #endif 247 | 248 | extern "C" { 249 | EXPORT HDRVR WINAPI WINMM_OpenDriver(LPCWSTR lpDN, LPCWSTR lpSN, LPARAM lp) { 250 | return MMOpenDriver(lpDN, lpSN, lp); 251 | } 252 | 253 | EXPORT LRESULT WINAPI WINMM_CloseDriver(HDRVR drv, LPARAM lP1, LPARAM lP2) { 254 | return MMCloseDriver(drv, lP1, lP2); 255 | } 256 | 257 | EXPORT LRESULT WINAPI WINMM_SendDriverMessage(HDRVR drv, UINT msg, LPARAM lP1, LPARAM lP2) { 258 | return MMSendDriverMessage(drv, msg, lP1, lP2); 259 | } 260 | 261 | EXPORT DWORD WINAPI WINMM_mmGetCurrentTask() { 262 | return MMmmGetCurrentTask(); 263 | } 264 | 265 | EXPORT HMODULE WINAPI WINMM_DrvGetModuleHandle(HDRVR drv) { 266 | return MMDrvGetModuleHandle(drv); 267 | } 268 | 269 | EXPORT HMODULE WINAPI WINMM_GetDriverModuleHandle(HDRVR drv) { 270 | return MMGetDriverModuleHandle(drv); 271 | } 272 | 273 | EXPORT LRESULT WINAPI WINMM_DefDriverProc(DWORD_PTR dwDId, HDRVR drv, UINT msg, LONG lP1, LONG lP2) { 274 | return MMDefDriverProc(dwDId, drv, msg, lP1, lP2); 275 | } 276 | 277 | EXPORT LRESULT WINAPI WINMM_DriverCallback(DWORD dwC, DWORD dwF, HDRVR drv, DWORD msg, DWORD dwU, DWORD dwP1, DWORD dwP2) { 278 | return MMDriverCallback(dwC, dwF, drv, msg, dwU, dwP1, dwP2); 279 | } 280 | 281 | EXPORT MMRESULT WINAPI WINMM_midiOutGetErrorTextA(MMRESULT err, LPSTR pszT, UINT cchT) { 282 | return MMmidiOutGetErrorTextA(err, pszT, cchT); 283 | } 284 | 285 | EXPORT MMRESULT WINAPI WINMM_midiOutGetErrorTextW(MMRESULT err, LPWSTR pszT, UINT cchT) { 286 | return MMmidiOutGetErrorTextW(err, pszT, cchT); 287 | } 288 | 289 | EXPORT MMRESULT WINAPI WINMM_midiConnect(HMIDI hS, HMIDIOUT hM, LPVOID lpV) { 290 | return MMmidiConnect(hS, hM, lpV); 291 | } 292 | 293 | EXPORT MMRESULT WINAPI WINMM_midiDisconnect(HMIDI hS, HMIDIOUT hM, LPVOID lpV) { 294 | return MMmidiDisconnect(hS, hM, lpV); 295 | } 296 | 297 | EXPORT MMRESULT WINAPI WINMM_midiInAddBuffer(HMIDIIN hM, LPMIDIHDR buf, UINT bufsize) { 298 | return MMmidiInAddBuffer(hM, buf, bufsize); 299 | } 300 | 301 | EXPORT MMRESULT WINAPI WINMM_midiInPrepareHeader(HMIDIIN hM, LPMIDIHDR buf, UINT bufsize) { 302 | return MMmidiInPrepareHeader(hM, buf, bufsize); 303 | } 304 | 305 | EXPORT MMRESULT WINAPI WINMM_midiInUnprepareHeader(HMIDIIN hM, LPMIDIHDR buf, UINT bufsize) { 306 | return MMmidiInPrepareHeader(hM, buf, bufsize); 307 | } 308 | 309 | EXPORT UINT WINAPI WINMM_midiOutGetNumDevs() { 310 | int v = MMmidiOutGetNumDevs(); 311 | return v; 312 | } 313 | 314 | EXPORT MMRESULT WINAPI WINMM_midiOutGetDevCapsW(UINT_PTR uDeviceID, LPMIDIOUTCAPSW lpCaps, UINT uSize) { 315 | return MMmidiOutGetDevCapsW(uDeviceID, lpCaps, uSize); 316 | } 317 | 318 | EXPORT MMRESULT WINAPI WINMM_midiOutGetDevCapsA(UINT_PTR uDeviceID, LPMIDIOUTCAPSA lpCaps, UINT uSize) { 319 | return MMmidiOutGetDevCapsA(uDeviceID, lpCaps, uSize); 320 | } 321 | 322 | EXPORT MMRESULT WINAPI WINMM_midiOutShortMsg(HMIDIOUT hMidiOut, DWORD dwMsg) { 323 | return MMmidiOutShortMsg(hMidiOut, dwMsg); 324 | } 325 | 326 | EXPORT MMRESULT WINAPI WINMM_midiOutOpen(LPHMIDIOUT lphmo, UINT uDeviceID, DWORD_PTR dwCallback, DWORD_PTR dwCallbackInstance, DWORD dwFlags) { 327 | return MMmidiOutOpen(lphmo, uDeviceID, dwCallback, dwCallbackInstance, dwFlags); 328 | } 329 | 330 | EXPORT MMRESULT WINAPI WINMM_midiOutClose(HMIDIOUT hMidiOut) { 331 | return MMmidiOutClose(hMidiOut); 332 | } 333 | 334 | EXPORT MMRESULT WINAPI WINMM_midiOutReset(HMIDIOUT hMidiOut) { 335 | return MMmidiOutReset(hMidiOut); 336 | } 337 | 338 | EXPORT MMRESULT WINAPI WINMM_midiOutPrepareHeader(HMIDIOUT hMidiOut, LPMIDIHDR lpMidiOutHdr, UINT uSize) { 339 | return MMmidiOutPrepareHeader(hMidiOut, lpMidiOutHdr, uSize); 340 | } 341 | 342 | EXPORT MMRESULT WINAPI WINMM_midiOutUnprepareHeader(HMIDIOUT hMidiOut, LPMIDIHDR lpMidiOutHdr, UINT uSize) { 343 | return MMmidiOutUnprepareHeader(hMidiOut, lpMidiOutHdr, uSize); 344 | } 345 | 346 | EXPORT MMRESULT WINAPI WINMM_midiOutLongMsg(HMIDIOUT hMidiOut, LPMIDIHDR lpMidiOutHdr, UINT uSize) { 347 | return MMmidiOutLongMsg(hMidiOut, lpMidiOutHdr, uSize); 348 | } 349 | 350 | EXPORT MMRESULT WINAPI WINMM_midiOutMessage(HMIDIOUT hMidiOut, UINT uMsg, DWORD_PTR dw1, DWORD_PTR dw2) { 351 | return MMmidiOutMessage(hMidiOut, uMsg, dw1, dw2); 352 | } 353 | 354 | EXPORT MMRESULT WINAPI WINMM_midiOutSetVolume(HMIDIOUT hMidiOut, DWORD dwVolume) { 355 | return MMmidiOutSetVolume(hMidiOut, dwVolume); 356 | } 357 | 358 | EXPORT MMRESULT WINAPI WINMM_midiOutGetVolume(HMIDIOUT hMidiOut, LPDWORD lpdwVolume) { 359 | return MMmidiOutGetVolume(hMidiOut, lpdwVolume); 360 | } 361 | 362 | EXPORT MMRESULT WINAPI WINMM_midiOutGetID(HMIDIOUT hMidiOut, LPUINT puDeviceID) { 363 | return MMmidiOutGetID(hMidiOut, puDeviceID); 364 | } 365 | 366 | EXPORT MMRESULT WINAPI WINMM_midiStreamOpen(LPHMIDISTRM lphStream, LPUINT puDeviceID, DWORD cMidi, DWORD_PTR dwCallback, DWORD_PTR dwCallbackInstance, DWORD fdwOpen) { 367 | return MMmidiStreamOpen(lphStream, puDeviceID, cMidi, dwCallback, dwCallbackInstance, fdwOpen); 368 | } 369 | 370 | EXPORT MMRESULT WINAPI WINMM_midiStreamClose(HMIDISTRM hStream) { 371 | return MMmidiStreamClose(hStream); 372 | } 373 | 374 | EXPORT MMRESULT WINAPI WINMM_midiStreamOut(HMIDISTRM hStream, LPMIDIHDR lpMidiOutHdr, UINT uSize) { 375 | return MMmidiStreamOut(hStream, lpMidiOutHdr, uSize); 376 | } 377 | 378 | EXPORT MMRESULT WINAPI WINMM_midiStreamPause(HMIDISTRM hStream) { 379 | return MMmidiStreamPause(hStream); 380 | } 381 | 382 | EXPORT MMRESULT WINAPI WINMM_midiStreamRestart(HMIDISTRM hStream) { 383 | return MMmidiStreamRestart(hStream); 384 | } 385 | 386 | EXPORT MMRESULT WINAPI WINMM_midiStreamStop(HMIDISTRM hStream) { 387 | return MMmidiStreamStop(hStream); 388 | } 389 | 390 | EXPORT MMRESULT WINAPI WINMM_midiStreamProperty(HMIDISTRM hStream, LPBYTE lppropdata, DWORD dwProperty) { 391 | return MMmidiStreamProperty(hStream, lppropdata, dwProperty); 392 | } 393 | 394 | EXPORT MMRESULT WINAPI WINMM_midiStreamPosition(HMIDISTRM hStream, LPMMTIME pmmt, UINT cbmmt) { 395 | return MMmidiStreamPosition(hStream, pmmt, cbmmt); 396 | } 397 | 398 | EXPORT MMRESULT WINAPI WINMM_midiOutCachePatches(HMIDIOUT hMidiOut, UINT wPatch, LPWORD lpPatchArray, UINT wFlags) { 399 | return MMmidiOutCachePatches(hMidiOut, wPatch, lpPatchArray, wFlags); 400 | } 401 | 402 | EXPORT MMRESULT WINAPI WINMM_midiOutCacheDrumPatches(HMIDIOUT hMidiOut, UINT wPatch, LPWORD lpKeyArray, UINT wFlags) { 403 | return MMmidiOutCacheDrumPatches(hMidiOut, wPatch, lpKeyArray, wFlags); 404 | } 405 | 406 | EXPORT UINT WINAPI WINMM_mmsystemGetVersion(void) { 407 | // Dummy, not needed 408 | return 0x0600U; 409 | } 410 | 411 | EXPORT MMRESULT WINAPI WINMM_midiInOpen(LPHMIDIIN lphM, UINT uDID, DWORD_PTR dwC, DWORD_PTR dwCI, DWORD dwF) { 412 | return MMmidiInOpen(lphM, uDID, dwC, dwCI, dwF); 413 | } 414 | 415 | EXPORT MMRESULT WINAPI WINMM_midiInStart(HMIDIIN hM) { 416 | return MMmidiInStart(hM); 417 | } 418 | 419 | EXPORT MMRESULT WINAPI WINMM_midiInReset(HMIDIIN hM) { 420 | return MMmidiInReset(hM); 421 | } 422 | 423 | EXPORT MMRESULT WINAPI WINMM_midiInStop(HMIDIIN hM) { 424 | return MMmidiInStop(hM); 425 | } 426 | 427 | EXPORT MMRESULT WINAPI WINMM_midiInClose(HMIDIIN hM) { 428 | return MMmidiInClose(hM); 429 | } 430 | 431 | EXPORT MMRESULT WINAPI WINMM_midiInGetID(HMIDIIN hM, LPUINT lpU) { 432 | return MMmidiInGetID(hM, lpU); 433 | } 434 | 435 | EXPORT MMRESULT WINAPI WINMM_midiInGetDevCapsA(UINT_PTR uP, LPMIDIINCAPSA LPMIC, UINT u) { 436 | return MMmidiInGetDevCapsA(uP, LPMIC, u); 437 | } 438 | 439 | EXPORT MMRESULT WINAPI WINMM_midiInGetDevCapsW(UINT_PTR uP, LPMIDIINCAPSW LPMIC, UINT u) { 440 | return MMmidiInGetDevCapsW(uP, LPMIC, u); 441 | } 442 | 443 | EXPORT MMRESULT WINAPI WINMM_midiInGetErrorTextA(MMRESULT mmr, LPSTR str, UINT u) { 444 | return MMmidiInGetErrorTextA(mmr, str, u); 445 | } 446 | 447 | EXPORT MMRESULT WINAPI WINMM_midiInGetErrorTextW(MMRESULT mmr, LPWSTR str, UINT u) { 448 | return MMmidiInGetErrorTextW(mmr, str, u); 449 | } 450 | 451 | EXPORT MMRESULT WINAPI WINMM_midiInMessage(HMIDIIN hM, UINT u, DWORD_PTR dwP1, DWORD_PTR dwP2) { 452 | return MMmidiInMessage(hM, u, dwP1, dwP2); 453 | } 454 | 455 | EXPORT UINT WINAPI WINMM_midiInGetNumDevs() { 456 | return MMmidiInGetNumDevs(); 457 | } 458 | 459 | EXPORT MMRESULT WINAPI WINMM_joyConfigChanged(DWORD dwF) { 460 | return MMjoyConfigChanged(dwF); 461 | } 462 | 463 | EXPORT MMRESULT WINAPI WINMM_joyGetDevCapsA(UINT uDID, LPJOYCAPSA LPJC, UINT size) { 464 | return MMjoyGetDevCapsA(uDID, LPJC, size); 465 | } 466 | 467 | EXPORT MMRESULT WINAPI WINMM_joyGetDevCapsW(UINT uDID, LPJOYCAPSW LPJC, UINT size) { 468 | return MMjoyGetDevCapsW(uDID, LPJC, size); 469 | } 470 | 471 | EXPORT MMRESULT WINAPI WINMM_joyGetPos(UINT uDID, LPJOYINFO LPJI) { 472 | return MMjoyGetPos(uDID, LPJI); 473 | } 474 | 475 | EXPORT MMRESULT WINAPI WINMM_joyGetPosEx(UINT uDID, LPJOYINFOEX LPJI) { 476 | return MMjoyGetPosEx(uDID, LPJI); 477 | } 478 | 479 | EXPORT MMRESULT WINAPI WINMM_joyGetThreshold(UINT uDID, LPUINT val) { 480 | return MMjoyGetThreshold(uDID, val); 481 | } 482 | 483 | EXPORT MMRESULT WINAPI WINMM_joySetThreshold(UINT uDID, UINT val) { 484 | return MMjoySetThreshold(uDID, val); 485 | } 486 | 487 | EXPORT MMRESULT WINAPI WINMM_joyReleaseCapture(UINT uDID) { 488 | return MMjoyReleaseCapture(uDID); 489 | } 490 | 491 | EXPORT MMRESULT WINAPI WINMM_joySetCapture(HWND h, UINT uDID, UINT uP, BOOL fC) { 492 | return MMjoySetCapture(h, uDID, uP, fC); 493 | } 494 | 495 | EXPORT UINT WINAPI WINMM_joyGetNumDevs() { 496 | return MMjoyGetNumDevs(); 497 | } 498 | 499 | EXPORT BOOL WINAPI WINMM_mciDriverNotify(HWND hC, UINT wDID, UINT uS) { 500 | return MMmciDriverNotify(hC, wDID, uS); 501 | } 502 | 503 | EXPORT BOOL WINAPI WINMM_mciExecute(LPCSTR pC) { 504 | return MMmciExecute(pC); 505 | } 506 | 507 | EXPORT UINT WINAPI WINMM_mciLoadCommandResource(HINSTANCE hI, LPCWSTR lpRN, UINT wT) { 508 | return MMmciLoadCommandResource(hI, lpRN, wT); 509 | } 510 | 511 | EXPORT BOOL WINAPI WINMM_mciFreeCommandResource(UINT wT) { 512 | return MMmciFreeCommandResource(wT); 513 | } 514 | 515 | EXPORT BOOL WINAPI WINMM_mciGetErrorStringA(DWORD MCIE, LPTSTR pT, UINT cT) { 516 | return MMmciGetErrorStringA(MCIE, pT, cT); 517 | } 518 | 519 | EXPORT BOOL WINAPI WINMM_mciGetErrorStringW(DWORD MCIE, LPWSTR pT, UINT cT) { 520 | return MMmciGetErrorStringW(MCIE, pT, cT); 521 | } 522 | 523 | EXPORT BOOL WINAPI WINMM_mciSetDriverData(UINT wDID, DWORD dwD) { 524 | return MMmciSetDriverData(wDID, dwD); 525 | } 526 | 527 | EXPORT BOOL WINAPI WINMM_mciGetDriverData(UINT wDID) { 528 | return MMmciGetDriverData(wDID); 529 | } 530 | 531 | EXPORT HANDLE WINAPI WINMM_mciGetCreatorTask(MCIDEVICEID IDD) { 532 | return MMmciGetCreatorTask(IDD); 533 | } 534 | 535 | EXPORT MCIDEVICEID WINAPI WINMM_mciGetDeviceIDA(LPCTSTR pszD) { 536 | return MMmciGetDeviceIDA(pszD); 537 | } 538 | 539 | EXPORT MCIDEVICEID WINAPI WINMM_mciGetDeviceIDW(LPCWSTR pszD) { 540 | return MMmciGetDeviceIDW(pszD); 541 | } 542 | 543 | EXPORT MCIDEVICEID WINAPI WINMM_mciGetDeviceIDFromElementIDA(DWORD dwEID, LPCTSTR pszD) { 544 | return MMmciGetDeviceIDFromElementIDA(dwEID, pszD); 545 | } 546 | 547 | EXPORT MCIDEVICEID WINAPI WINMM_mciGetDeviceIDFromElementIDW(DWORD dwEID, LPCWSTR pszD) { 548 | return MMmciGetDeviceIDFromElementIDW(dwEID, pszD); 549 | } 550 | 551 | EXPORT MCIERROR WINAPI WINMM_mciSendCommandA(MCIDEVICEID uDID, UINT msg, DWORD_PTR dwP1, DWORD_PTR dwP2) { 552 | return MMmciSendCommandA(uDID, msg, dwP1, dwP2); 553 | } 554 | 555 | EXPORT MCIERROR WINAPI WINMM_mciSendCommandW(MCIDEVICEID uDID, UINT msg, DWORD_PTR dwP1, DWORD_PTR dwP2) { 556 | return MMmciSendCommandW(uDID, msg, dwP1, dwP2); 557 | } 558 | 559 | EXPORT MCIERROR WINAPI WINMM_mciSendStringA(LPCTSTR lpszC, LPTSTR lpszR, UINT cchR, HANDLE hC) { 560 | return MMmciSendStringA(lpszC, lpszR, cchR, hC); 561 | } 562 | 563 | EXPORT MCIERROR WINAPI WINMM_mciSendStringW(LPCWSTR lpszC, LPWSTR lpszR, UINT cchR, HANDLE hC) { 564 | return MMmciSendStringW(lpszC, lpszR, cchR, hC); 565 | } 566 | 567 | EXPORT UINT WINAPI WINMM_mciDriverYield(MCIDEVICEID wDID) { 568 | return MMmciDriverYield(wDID); 569 | } 570 | 571 | EXPORT UINT WINAPI WINMM_mciSetYieldProc(MCIDEVICEID wDID, YIELDPROC fpYP, DWORD dwYD) { 572 | return MMmciSetYieldProc(wDID, fpYP, dwYD); 573 | } 574 | 575 | EXPORT YIELDPROC WINAPI WINMM_mciGetYieldProc(MCIDEVICEID wDID, LPDWORD lpdwYD) { 576 | return MMmciGetYieldProc(wDID, lpdwYD); 577 | } 578 | 579 | EXPORT DWORD WINAPI WINMM_mixerMessage(HMIXER dID, UINT msg, DWORD_PTR dwP1, DWORD_PTR dwP2) { 580 | return MMmixerMessage(dID, msg, dwP1, dwP2); 581 | } 582 | 583 | EXPORT MMRESULT WINAPI WINMM_mixerClose(HMIXER dID) { 584 | return MMmixerClose(dID); 585 | } 586 | 587 | EXPORT MMRESULT WINAPI WINMM_mixerGetLineInfoA(HMIXEROBJ dIDO, LPMIXERLINEA LPML, DWORD size) { 588 | return MMmixerGetLineInfoA(dIDO, LPML, size); 589 | } 590 | 591 | EXPORT MMRESULT WINAPI WINMM_mixerGetLineInfoW(HMIXEROBJ dIDO, LPMIXERLINEW LPML, DWORD size) { 592 | return MMmixerGetLineInfoW(dIDO, LPML, size); 593 | } 594 | 595 | EXPORT MMRESULT WINAPI WINMM_mixerGetLineControlsA(HMIXEROBJ dIDO, LPMIXERLINECONTROLSA LPMLC, DWORD size) { 596 | return MMmixerGetLineControlsA(dIDO, LPMLC, size); 597 | } 598 | 599 | EXPORT MMRESULT WINAPI WINMM_mixerGetLineControlsW(HMIXEROBJ dIDO, LPMIXERLINECONTROLSW LPMLC, DWORD size) { 600 | return MMmixerGetLineControlsW(dIDO, LPMLC, size); 601 | } 602 | 603 | EXPORT MMRESULT WINAPI WINMM_mixerSetControlDetails(HMIXEROBJ dIDO, LPMIXERCONTROLDETAILS LPMCD, DWORD size) { 604 | return MMmixerSetControlDetails(dIDO, LPMCD, size); 605 | } 606 | 607 | EXPORT MMRESULT WINAPI WINMM_mixerGetControlDetailsA(HMIXEROBJ dIDO, LPMIXERCONTROLDETAILS LPMCD, DWORD size) { 608 | return MMmixerGetControlDetailsA(dIDO, LPMCD, size); 609 | } 610 | 611 | EXPORT MMRESULT WINAPI WINMM_mixerGetControlDetailsW(HMIXEROBJ dIDO, LPMIXERCONTROLDETAILS LPMCD, DWORD size) { 612 | return MMmixerGetControlDetailsW(dIDO, LPMCD, size); 613 | } 614 | 615 | EXPORT MMRESULT WINAPI WINMM_mixerGetDevCapsA(UINT_PTR uDID, LPMIXERCAPSA LPMC, UINT size) { 616 | return MMmixerGetDevCapsA(uDID, LPMC, size); 617 | } 618 | 619 | EXPORT MMRESULT WINAPI WINMM_mixerGetDevCapsW(UINT_PTR uDID, LPMIXERCAPSW LPMC, UINT size) { 620 | return MMmixerGetDevCapsW(uDID, LPMC, size); 621 | } 622 | 623 | EXPORT MMRESULT WINAPI WINMM_mixerGetID(HMIXEROBJ dIDO, UINT* puMxId, DWORD fdwld) { 624 | return MMmixerGetID(dIDO, puMxId, fdwld); 625 | } 626 | 627 | EXPORT MMRESULT WINAPI WINMM_mixerOpen(LPHMIXER lpdID, UINT uMxId, DWORD_PTR dwC, DWORD_PTR dwI, DWORD fdwO) { 628 | return MMmixerOpen(lpdID, uMxId, dwC, dwI, fdwO); 629 | } 630 | 631 | EXPORT UINT WINAPI WINMM_mixerGetNumDevs() { 632 | return MMmixerGetNumDevs(); 633 | } 634 | 635 | EXPORT FOURCC WINAPI WINMM_mmioStringToFOURCCA(LPCTSTR sz, UINT f) { 636 | return MMmmioStringToFOURCCA(sz, f); 637 | } 638 | 639 | EXPORT FOURCC WINAPI WINMM_mmioStringToFOURCCW(LPCWSTR sz, UINT f) { 640 | return MMmmioStringToFOURCCW(sz, f); 641 | } 642 | 643 | EXPORT LONG WINAPI WINMM_mmioRead(HMMIO hm, HPSTR pch, LONG cch) { 644 | return MMmmioRead(hm, pch, cch); 645 | } 646 | 647 | EXPORT LONG WINAPI WINMM_mmioSeek(HMMIO hm, LONG lO, INT iO) { 648 | return MMmmioSeek(hm, lO, iO); 649 | } 650 | 651 | EXPORT LONG WINAPI WINMM_mmioWrite(HMMIO hm, char* pch, LONG cch) { 652 | return MMmmioWrite(hm, pch, cch); 653 | } 654 | 655 | EXPORT LPMMIOPROC WINAPI WINMM_mmioInstallIOProcA(FOURCC fccIOP, LPMMIOPROC pIOP, DWORD dwF) { 656 | return MMmmioInstallIOProcA(fccIOP, pIOP, dwF); 657 | } 658 | 659 | EXPORT LPMMIOPROC WINAPI WINMM_mmioInstallIOProcW(FOURCC fccIOP, LPMMIOPROC pIOP, DWORD dwF) { 660 | return MMmmioInstallIOProcW(fccIOP, pIOP, dwF); 661 | } 662 | 663 | EXPORT LRESULT WINAPI WINMM_mmioSendMessage(HMMIO hm, UINT msg, LPARAM lP1, LPARAM lP2) { 664 | return MMmmioSendMessage(hm, msg, lP1, lP2); 665 | } 666 | 667 | EXPORT MMRESULT WINAPI WINMM_mmioAdvance(HMMIO hm, LPMMIOINFO pmmioi, UINT fuA) { 668 | return MMmmioAdvance(hm, pmmioi, fuA); 669 | } 670 | 671 | EXPORT MMRESULT WINAPI WINMM_mmioAscend(HMMIO hm, LPMMCKINFO pmmcki, UINT fuA) { 672 | return MMmmioAscend(hm, pmmcki, fuA); 673 | } 674 | 675 | EXPORT MMRESULT WINAPI WINMM_mmioClose(HMMIO hm, UINT fuC) { 676 | return MMmmioClose(hm, fuC); 677 | } 678 | 679 | EXPORT MMRESULT WINAPI WINMM_mmioCreateChunk(HMMIO hm, LPMMCKINFO pmmcki, UINT fuC) { 680 | return MMmmioCreateChunk(hm, pmmcki, fuC); 681 | } 682 | 683 | EXPORT MMRESULT WINAPI WINMM_mmioDescend(HMMIO hm, LPMMCKINFO pmmcki, const MMCKINFO* pmmckiP, UINT fuD) { 684 | return MMmmioDescend(hm, pmmcki, pmmckiP, fuD); 685 | } 686 | 687 | EXPORT MMRESULT WINAPI WINMM_mmioFlush(HMMIO hm, UINT fuF) { 688 | return MMmmioFlush(hm, fuF); 689 | } 690 | 691 | EXPORT MMRESULT WINAPI WINMM_mmioGetInfo(HMMIO hm, LPMMIOINFO pmmioi, UINT fuI) { 692 | return MMmmioGetInfo(hm, pmmioi, fuI); 693 | } 694 | 695 | EXPORT MMRESULT WINAPI WINMM_mmioSetInfo(HMMIO hm, const LPMMIOINFO pmmioi, UINT fuI) { 696 | return MMmmioSetInfo(hm, pmmioi, fuI); 697 | } 698 | 699 | EXPORT MMRESULT WINAPI WINMM_mmioOpenA(LPTSTR pszFN, LPMMIOINFO pmmioi, DWORD fdwO) { 700 | return MMmmioOpenA(pszFN, pmmioi, fdwO); 701 | } 702 | 703 | EXPORT MMRESULT WINAPI WINMM_mmioOpenW(LPWSTR pszFN, LPMMIOINFO pmmioi, DWORD fdwO) { 704 | return MMmmioOpenW(pszFN, pmmioi, fdwO); 705 | } 706 | 707 | EXPORT MMRESULT WINAPI WINMM_mmioRenameA(LPCTSTR pszFN, LPCTSTR pszNFN, const LPMMIOINFO pmmioi, DWORD fdwR) { 708 | return MMmmioRenameA(pszFN, pszNFN, pmmioi, fdwR); 709 | } 710 | 711 | EXPORT MMRESULT WINAPI WINMM_mmioRenameW(LPCWSTR pszFN, LPCWSTR pszNFN, const LPMMIOINFO pmmioi, DWORD fdwR) { 712 | return MMmmioRenameW(pszFN, pszNFN, pmmioi, fdwR); 713 | } 714 | 715 | EXPORT MMRESULT WINAPI WINMM_mmioSetBuffer(HMMIO hm, LPSTR pchB, LONG cchB, UINT fuB) { 716 | return MMmmioSetBuffer(hm, pchB, cchB, fuB); 717 | } 718 | 719 | EXPORT BOOL WINAPI WINMM_mmTaskSignal(DWORD undef) { 720 | return MMmmTaskSignal(undef); 721 | } 722 | 723 | EXPORT UINT WINAPI WINMM_mmTaskCreate(LPTASKCALLBACK undef1, HANDLE undef2, DWORD_PTR undef3) { 724 | return MMmmTaskCreate(undef1, undef2, undef3); 725 | } 726 | 727 | EXPORT VOID WINAPI WINMM_mmTaskBlock(DWORD undef) { 728 | return MMmmTaskBlock(undef); 729 | } 730 | 731 | EXPORT VOID WINAPI WINMM_mmTaskYield() { 732 | MMmmTaskYield(); 733 | } 734 | 735 | EXPORT BOOL WINAPI WINMM_PlaySound(LPCSTR pszS, HMODULE hmod, DWORD fdwS) { 736 | return MMPlaySound(pszS, hmod, fdwS); 737 | } 738 | 739 | EXPORT BOOL WINAPI WINMM_PlaySoundA(LPCTSTR pszS, HMODULE hmod, DWORD fdwS) { 740 | return MMPlaySoundA(pszS, hmod, fdwS); 741 | } 742 | 743 | EXPORT BOOL WINAPI WINMM_PlaySoundW(LPCWSTR pszS, HMODULE hmod, DWORD fdwS) { 744 | return MMPlaySoundW(pszS, hmod, fdwS); 745 | } 746 | 747 | EXPORT BOOL WINAPI WINMM_sndPlaySoundA(LPCTSTR pszS, DWORD fuS) { 748 | return MMsndPlaySoundA(pszS, fuS); 749 | } 750 | 751 | EXPORT BOOL WINAPI WINMM_sndPlaySoundW(LPCWSTR pszS, DWORD fuS) { 752 | return MMsndPlaySoundW(pszS, fuS); 753 | } 754 | 755 | EXPORT DWORD WINAPI WINMM_auxOutMessage(UINT uDID, UINT msg, DWORD_PTR dwP1, DWORD_PTR dwP2) { 756 | return MMauxOutMessage(uDID, msg, dwP1, dwP2); 757 | } 758 | 759 | EXPORT MMRESULT WINAPI WINMM_auxGetDevCapsA(UINT_PTR uDID, LPAUXCAPSA pac, UINT cbac) { 760 | return MMauxGetDevCapsA(uDID, pac, cbac); 761 | } 762 | 763 | EXPORT MMRESULT WINAPI WINMM_auxGetDevCapsW(UINT_PTR uDID, LPAUXCAPSW pac, UINT cbac) { 764 | return MMauxGetDevCapsW(uDID, pac, cbac); 765 | } 766 | 767 | EXPORT MMRESULT WINAPI WINMM_auxGetVolume(UINT uDID, LPDWORD lpV) { 768 | return MMauxGetVolume(uDID, lpV); 769 | } 770 | 771 | EXPORT MMRESULT WINAPI WINMM_auxSetVolume(UINT uDID, DWORD V) { 772 | return MMauxSetVolume(uDID, V); 773 | } 774 | 775 | EXPORT UINT WINAPI WINMM_auxGetNumDevs() { 776 | return MMauxGetNumDevs(); 777 | } 778 | 779 | EXPORT DWORD WINAPI WINMM_waveOutMessage(HWAVEOUT hw, UINT msg, DWORD_PTR dwP1, DWORD_PTR dwP2) { 780 | return MMwaveOutMessage(hw, msg, dwP1, dwP2); 781 | } 782 | 783 | EXPORT MMRESULT WINAPI WINMM_waveOutAddBuffer(HWAVEOUT hw, LPWAVEHDR pch, UINT cch) { 784 | return MMwaveOutAddBuffer(hw, pch, cch); 785 | } 786 | 787 | EXPORT MMRESULT WINAPI WINMM_waveOutBreakLoop(HWAVEOUT hw) { 788 | return MMwaveOutBreakLoop(hw); 789 | } 790 | 791 | EXPORT MMRESULT WINAPI WINMM_waveOutClose(HWAVEOUT hw) { 792 | return MMwaveOutClose(hw); 793 | } 794 | 795 | EXPORT MMRESULT WINAPI WINMM_waveOutGetDevCapsA(UINT_PTR uDID, LPWAVEOUTCAPSA LPWOT, UINT size) { 796 | return MMwaveOutGetDevCapsA(uDID, LPWOT, size); 797 | } 798 | 799 | EXPORT MMRESULT WINAPI WINMM_waveOutGetDevCapsW(UINT_PTR uDID, LPWAVEOUTCAPSW LPWOT, UINT size) { 800 | return MMwaveOutGetDevCapsW(uDID, LPWOT, size); 801 | } 802 | 803 | EXPORT MMRESULT WINAPI WINMM_waveOutGetErrorTextA(MMRESULT err, LPTSTR pszT, UINT cchT) { 804 | return MMwaveOutGetErrorTextA(err, pszT, cchT); 805 | } 806 | 807 | EXPORT MMRESULT WINAPI WINMM_waveOutGetErrorTextW(MMRESULT err, LPWSTR pszT, UINT cchT) { 808 | return MMwaveOutGetErrorTextW(err, pszT, cchT); 809 | } 810 | 811 | EXPORT MMRESULT WINAPI WINMM_waveOutGetID(HWAVEOUT hw, LPUINT puDID) { 812 | return MMwaveOutGetID(hw, puDID); 813 | } 814 | 815 | EXPORT MMRESULT WINAPI WINMM_waveOutSetPitch(HWAVEOUT hw, DWORD P) { 816 | return MMwaveOutSetPitch(hw, P); 817 | } 818 | 819 | EXPORT MMRESULT WINAPI WINMM_waveOutGetPitch(HWAVEOUT hw, LPDWORD pP) { 820 | return MMwaveOutGetPitch(hw, pP); 821 | } 822 | 823 | EXPORT MMRESULT WINAPI WINMM_waveOutSetPlaybackRate(HWAVEOUT hw, DWORD PR) { 824 | return MMwaveOutSetPlaybackRate(hw, PR); 825 | } 826 | 827 | EXPORT MMRESULT WINAPI WINMM_waveOutGetPlaybackRate(HWAVEOUT hw, LPDWORD pPR) { 828 | return MMwaveOutGetPlaybackRate(hw, pPR); 829 | } 830 | 831 | EXPORT MMRESULT WINAPI WINMM_waveOutGetPosition(HWAVEOUT hw, LPMMTIME pmmt, UINT cbmmt) { 832 | return MMwaveOutGetPosition(hw, pmmt, cbmmt); 833 | } 834 | 835 | EXPORT MMRESULT WINAPI WINMM_waveOutSetVolume(HWAVEOUT hw, DWORD V) { 836 | return MMwaveOutSetVolume(hw, V); 837 | } 838 | 839 | EXPORT MMRESULT WINAPI WINMM_waveOutGetVolume(HWAVEOUT hw, LPDWORD pV) { 840 | return MMwaveOutGetVolume(hw, pV); 841 | } 842 | 843 | EXPORT MMRESULT WINAPI WINMM_waveOutOpen(LPHWAVEOUT lphw, UINT uDID, LPCWAVEFORMATEX LPWFEX, DWORD_PTR dwC, DWORD_PTR dwI, DWORD fdwO) { 844 | return MMwaveOutOpen(lphw, uDID, LPWFEX, dwC, dwI, fdwO); 845 | } 846 | 847 | EXPORT MMRESULT WINAPI WINMM_waveOutPrepareHeader(HWAVEOUT hw, LPWAVEHDR pchB, UINT cchB) { 848 | return MMwaveOutPrepareHeader(hw, pchB, cchB); 849 | } 850 | 851 | EXPORT MMRESULT WINAPI WINMM_waveOutUnprepareHeader(HWAVEOUT hw, LPWAVEHDR pchB, UINT cchB) { 852 | return MMwaveOutUnprepareHeader(hw, pchB, cchB); 853 | } 854 | 855 | EXPORT MMRESULT WINAPI WINMM_waveOutWrite(HWAVEOUT hw, LPWAVEHDR pchB, UINT cchB) { 856 | return MMwaveOutWrite(hw, pchB, cchB); 857 | } 858 | 859 | EXPORT MMRESULT WINAPI WINMM_waveOutReset(HWAVEOUT hw) { 860 | return MMwaveOutReset(hw); 861 | } 862 | 863 | EXPORT MMRESULT WINAPI WINMM_waveOutRestart(HWAVEOUT hw) { 864 | return MMwaveOutRestart(hw); 865 | } 866 | 867 | EXPORT MMRESULT WINAPI WINMM_waveOutPause(HWAVEOUT hw) { 868 | return MMwaveOutPause(hw); 869 | } 870 | 871 | EXPORT MMRESULT WINAPI WINMM_waveOutStart(HWAVEOUT hw) { 872 | return MMwaveOutStart(hw); 873 | } 874 | 875 | EXPORT MMRESULT WINAPI WINMM_waveOutStop(HWAVEOUT hw) { 876 | return MMwaveOutStop(hw); 877 | } 878 | 879 | EXPORT UINT WINAPI WINMM_waveOutGetNumDevs() { 880 | return MMwaveOutGetNumDevs(); 881 | } 882 | 883 | EXPORT DWORD WINAPI WINMM_waveInMessage(HWAVEIN hw, UINT msg, DWORD_PTR dwP1, DWORD_PTR dwP2) { 884 | return MMwaveInMessage(hw, msg, dwP1, dwP2); 885 | } 886 | 887 | EXPORT MMRESULT WINAPI WINMM_waveInAddBuffer(HWAVEIN hw, LPWAVEHDR pch, UINT cch) { 888 | return MMwaveInAddBuffer(hw, pch, cch); 889 | } 890 | 891 | EXPORT MMRESULT WINAPI WINMM_waveInClose(HWAVEIN hw) { 892 | return MMwaveInClose(hw); 893 | } 894 | 895 | EXPORT MMRESULT WINAPI WINMM_waveInGetDevCapsA(UINT_PTR uDID, LPWAVEINCAPSA LPWOT, UINT size) { 896 | return MMwaveInGetDevCapsA(uDID, LPWOT, size); 897 | } 898 | 899 | EXPORT MMRESULT WINAPI WINMM_waveInGetDevCapsW(UINT_PTR uDID, LPWAVEINCAPSW LPWOT, UINT size) { 900 | return MMwaveInGetDevCapsW(uDID, LPWOT, size); 901 | } 902 | 903 | EXPORT MMRESULT WINAPI WINMM_waveInGetErrorTextA(MMRESULT err, LPTSTR pszT, UINT cchT) { 904 | return MMwaveInGetErrorTextA(err, pszT, cchT); 905 | } 906 | 907 | EXPORT MMRESULT WINAPI WINMM_waveInGetErrorTextW(MMRESULT err, LPWSTR pszT, UINT cchT) { 908 | return MMwaveInGetErrorTextW(err, pszT, cchT); 909 | } 910 | 911 | EXPORT MMRESULT WINAPI WINMM_waveInGetID(HWAVEIN hw, LPUINT puDID) { 912 | return MMwaveInGetID(hw, puDID); 913 | } 914 | 915 | EXPORT MMRESULT WINAPI WINMM_waveInGetPosition(HWAVEIN hw, LPMMTIME pmmt, UINT cbmmt) { 916 | return MMwaveInGetPosition(hw, pmmt, cbmmt); 917 | } 918 | 919 | EXPORT MMRESULT WINAPI WINMM_waveInOpen(LPHWAVEIN lphw, UINT uDID, LPCWAVEFORMATEX LPWFEX, DWORD_PTR dwC, DWORD_PTR dwI, DWORD fdwO) { 920 | return MMwaveInOpen(lphw, uDID, LPWFEX, dwC, dwI, fdwO); 921 | } 922 | 923 | EXPORT MMRESULT WINAPI WINMM_waveInPrepareHeader(HWAVEIN hw, LPWAVEHDR pchB, UINT cchB) { 924 | return MMwaveInPrepareHeader(hw, pchB, cchB); 925 | } 926 | 927 | EXPORT MMRESULT WINAPI WINMM_waveInUnprepareHeader(HWAVEIN hw, LPWAVEHDR pchB, UINT cchB) { 928 | return MMwaveInUnprepareHeader(hw, pchB, cchB); 929 | } 930 | 931 | EXPORT MMRESULT WINAPI WINMM_waveInReset(HWAVEIN hw) { 932 | return MMwaveInReset(hw); 933 | } 934 | 935 | EXPORT MMRESULT WINAPI WINMM_waveInStart(HWAVEIN hw) { 936 | return MMwaveInStart(hw); 937 | } 938 | 939 | EXPORT MMRESULT WINAPI WINMM_waveInStop(HWAVEIN hw) { 940 | return MMwaveInStop(hw); 941 | } 942 | 943 | EXPORT UINT WINAPI WINMM_waveInGetNumDevs() { 944 | return MMwaveInGetNumDevs(); 945 | } 946 | 947 | EXPORT DWORD WINAPI WINMM_timeGetTime() { 948 | return MMtimeGetTime(); 949 | } 950 | 951 | EXPORT MMRESULT WINAPI WINMM_timeGetDevCaps(LPTIMECAPS ptc, UINT cbtc) { 952 | return MMtimeGetDevCaps(ptc, cbtc); 953 | } 954 | 955 | EXPORT MMRESULT WINAPI WINMM_timeSetEvent(UINT uDelay, UINT uResolution, LPTIMECALLBACK lpTimeProc, DWORD_PTR dwUser, UINT fuEvent) { 956 | return MMtimeSetEvent(uDelay, uResolution, lpTimeProc, dwUser, fuEvent); 957 | } 958 | 959 | EXPORT MMRESULT WINAPI WINMM_timeKillEvent(UINT uTimerID) { 960 | return MMtimeKillEvent(uTimerID); 961 | } 962 | 963 | EXPORT MMRESULT WINAPI WINMM_timeGetSystemTime(LPMMTIME pmmt, UINT cbmmt) { 964 | return MMtimeGetSystemTime(pmmt, cbmmt); 965 | } 966 | 967 | EXPORT MMRESULT WINAPI WINMM_timeBeginPeriod(UINT uPeriod) { 968 | return MMtimeBeginPeriod(uPeriod); 969 | } 970 | 971 | EXPORT MMRESULT WINAPI WINMM_timeEndPeriod(UINT uPeriod) { 972 | return MMtimeEndPeriod(uPeriod); 973 | } 974 | 975 | #ifdef _M_IX86 976 | EXPORT MMRESULT WINAPI WINMM_aux32Message(UINT_PTR uDeviceID, UINT uMsg, DWORD_PTR Handle, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { 977 | return MMaux32Message(uDeviceID, uMsg, Handle, dwParam1, dwParam2); 978 | } 979 | 980 | EXPORT MMRESULT WINAPI WINMM_joy32Message(UINT_PTR uDeviceID, UINT uMsg, DWORD_PTR Handle, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { 981 | return MMjoy32Message(uDeviceID, uMsg, Handle, dwParam1, dwParam2); 982 | } 983 | 984 | EXPORT MMRESULT WINAPI WINMM_mci32Message(UINT_PTR uDeviceID, UINT uMsg, DWORD_PTR Handle, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { 985 | return MMmci32Message(uDeviceID, uMsg, Handle, dwParam1, dwParam2); 986 | } 987 | 988 | EXPORT MMRESULT WINAPI WINMM_mid32Message(UINT_PTR uDeviceID, UINT uMsg, DWORD_PTR Handle, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { 989 | return MMmid32Message(uDeviceID, uMsg, Handle, dwParam1, dwParam2); 990 | } 991 | 992 | EXPORT MMRESULT WINAPI WINMM_mod32Message(UINT_PTR uDeviceID, UINT uMsg, DWORD_PTR Handle, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { 993 | return MMmod32Message(uDeviceID, uMsg, Handle, dwParam1, dwParam2); 994 | } 995 | 996 | EXPORT MMRESULT WINAPI WINMM_mxd32Message(UINT_PTR uDeviceID, UINT uMsg, DWORD_PTR Handle, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { 997 | return MMmxd32Message(uDeviceID, uMsg, Handle, dwParam1, dwParam2); 998 | } 999 | 1000 | EXPORT MMRESULT WINAPI WINMM_tid32Message(UINT_PTR uDeviceID, UINT uMsg, DWORD_PTR Handle, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { 1001 | return MMtid32Message(uDeviceID, uMsg, Handle, dwParam1, dwParam2); 1002 | } 1003 | 1004 | EXPORT MMRESULT WINAPI WINMM_wid32Message(UINT_PTR uDeviceID, UINT uMsg, DWORD_PTR hMidi, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { 1005 | return MMwid32Message(uDeviceID, uMsg, hMidi, dwParam1, dwParam2); 1006 | } 1007 | 1008 | EXPORT MMRESULT WINAPI WINMM_wod32Message(UINT_PTR uDeviceID, UINT uMsg, DWORD_PTR hMidi, DWORD_PTR dwParam1, DWORD_PTR dwParam2) { 1009 | return MMwod32Message(uDeviceID, uMsg, hMidi, dwParam1, dwParam2); 1010 | } 1011 | #endif 1012 | } -------------------------------------------------------------------------------- /src/WinMM.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | OmniMIDI v15+ (Rewrite) for Windows NT 4 | 5 | This file contains the required code to run the driver under Windows 7 SP1 and later. 6 | This file is useful only if you want to compile the driver under Windows, it's not needed for Linux/macOS porting. 7 | 8 | */ 9 | 10 | #ifndef _MMHPP 11 | #define _MMHPP 12 | 13 | #pragma once 14 | 15 | #define MIDI_IO_PACKED 0x00000000L // Legacy mode, used by most MIDI apps 16 | #define MIDI_IO_COOKED 0x00000002L // Stream mode, used by some old MIDI apps (Such as GZDoom) 17 | 18 | #include "Common.hpp" 19 | #include "mmddk.h" 20 | 21 | // MIDI out stuff 22 | extern MMRESULT(WINAPI* MMmidiStreamClose)(HMIDISTRM); 23 | extern MMRESULT(WINAPI* MMmidiStreamOpen)(LPHMIDISTRM, LPUINT, DWORD, DWORD_PTR, DWORD_PTR, DWORD); 24 | extern MMRESULT(WINAPI* MMmidiStreamOut)(HMIDISTRM, LPMIDIHDR, UINT); 25 | extern MMRESULT(WINAPI* MMmidiStreamPause)(HMIDISTRM); 26 | extern MMRESULT(WINAPI* MMmidiStreamPosition)(HMIDISTRM, LPMMTIME, UINT); 27 | extern MMRESULT(WINAPI* MMmidiStreamProperty)(HMIDISTRM, LPBYTE, DWORD); 28 | extern MMRESULT(WINAPI* MMmidiStreamRestart)(HMIDISTRM); 29 | extern MMRESULT(WINAPI* MMmidiStreamStop)(HMIDISTRM); 30 | extern MMRESULT(WINAPI* MMmidiOutCacheDrumPatches)(HMIDIOUT, UINT, LPWORD, UINT); 31 | extern MMRESULT(WINAPI* MMmidiOutCachePatches)(HMIDIOUT, UINT, LPWORD, UINT); 32 | extern MMRESULT(WINAPI* MMmidiOutClose)(HMIDIOUT); 33 | extern MMRESULT(WINAPI* MMmidiOutGetDevCapsA)(UINT_PTR, LPMIDIOUTCAPSA, UINT); 34 | extern MMRESULT(WINAPI* MMmidiOutGetDevCapsW)(UINT_PTR, LPMIDIOUTCAPSW, UINT); 35 | extern MMRESULT(WINAPI* MMmidiOutGetErrorTextA)(MMRESULT, LPSTR, UINT); 36 | extern MMRESULT(WINAPI* MMmidiOutGetErrorTextW)(MMRESULT, LPWSTR, UINT); 37 | extern MMRESULT(WINAPI* MMmidiOutGetID)(HMIDIOUT, LPUINT); 38 | extern MMRESULT(WINAPI* MMmidiOutGetVolume)(HMIDIOUT, LPDWORD); 39 | extern MMRESULT(WINAPI* MMmidiOutLongMsg)(HMIDIOUT, LPMIDIHDR, UINT); 40 | extern MMRESULT(WINAPI* MMmidiOutMessage)(HMIDIOUT, UINT, DWORD_PTR, DWORD_PTR); 41 | extern MMRESULT(WINAPI* MMmidiOutOpen)(LPHMIDIOUT, UINT, DWORD_PTR, DWORD_PTR, DWORD); 42 | extern MMRESULT(WINAPI* MMmidiOutPrepareHeader)(HMIDIOUT, LPMIDIHDR, UINT); 43 | extern MMRESULT(WINAPI* MMmidiOutReset)(HMIDIOUT); 44 | extern MMRESULT(WINAPI* MMmidiOutSetVolume)(HMIDIOUT, DWORD); 45 | extern MMRESULT(WINAPI* MMmidiOutShortMsg)(HMIDIOUT, DWORD); 46 | extern MMRESULT(WINAPI* MMmidiOutUnprepareHeader)(HMIDIOUT, LPMIDIHDR, UINT); 47 | extern UINT(WINAPI* MMmidiOutGetNumDevs)(); 48 | // MIDI out stuff 49 | 50 | // MIDI in stuff 51 | extern MMRESULT(WINAPI* MMmidiConnect)(HMIDI, HMIDIOUT, LPVOID); 52 | extern MMRESULT(WINAPI* MMmidiDisconnect)(HMIDI, HMIDIOUT, LPVOID); 53 | extern MMRESULT(WINAPI* MMmidiInAddBuffer)(HMIDIIN, LPMIDIHDR, UINT); 54 | extern MMRESULT(WINAPI* MMmidiInClose)(HMIDIIN); 55 | extern MMRESULT(WINAPI* MMmidiInGetDevCapsA)(UINT_PTR, LPMIDIINCAPSA, UINT); 56 | extern MMRESULT(WINAPI* MMmidiInGetDevCapsW)(UINT_PTR, LPMIDIINCAPSW, UINT); 57 | extern MMRESULT(WINAPI* MMmidiInGetErrorTextA)(MMRESULT, LPSTR, UINT); 58 | extern MMRESULT(WINAPI* MMmidiInGetErrorTextW)(MMRESULT, LPWSTR, UINT); 59 | extern MMRESULT(WINAPI* MMmidiInGetID)(HMIDIIN, LPUINT); 60 | extern MMRESULT(WINAPI* MMmidiInMessage)(HMIDIIN, UINT, DWORD_PTR, DWORD_PTR); 61 | extern MMRESULT(WINAPI* MMmidiInOpen)(LPHMIDIIN, UINT, DWORD_PTR, DWORD_PTR, DWORD); 62 | extern MMRESULT(WINAPI* MMmidiInPrepareHeader)(HMIDIIN, LPMIDIHDR, UINT); 63 | extern MMRESULT(WINAPI* MMmidiInReset)(HMIDIIN); 64 | extern MMRESULT(WINAPI* MMmidiInStart)(HMIDIIN); 65 | extern MMRESULT(WINAPI* MMmidiInStop)(HMIDIIN); 66 | extern MMRESULT(WINAPI* MMmidiInUnprepareHeader)(HMIDIIN, LPMIDIHDR, UINT); 67 | extern UINT(WINAPI* MMmidiInGetNumDevs)(); 68 | // MIDI in stuff 69 | 70 | // Time related stuff 71 | extern DWORD(WINAPI* MMtimeGetTime)(); 72 | extern MMRESULT(WINAPI* MMtimeBeginPeriod)(UINT); 73 | extern MMRESULT(WINAPI* MMtimeEndPeriod)(UINT); 74 | extern MMRESULT(WINAPI* MMtimeGetDevCaps)(LPTIMECAPS, UINT); 75 | extern MMRESULT(WINAPI* MMtimeGetSystemTime)(LPMMTIME, UINT); 76 | extern MMRESULT(WINAPI* MMtimeKillEvent)(UINT); 77 | extern MMRESULT(WINAPI* MMtimeSetEvent)(UINT, UINT, LPTIMECALLBACK, DWORD_PTR, UINT); 78 | // Time related stuff 79 | 80 | // Driver stuff 81 | 82 | extern HDRVR(WINAPI* MMOpenDriver)(_In_ LPCWSTR, _In_ LPCWSTR, _In_ LPARAM); 83 | extern LRESULT(WINAPI* MMCloseDriver)(_In_ HDRVR, _In_ LPARAM, _In_ LPARAM); 84 | extern LRESULT(WINAPI* MMSendDriverMessage)(_In_ HDRVR, _In_ UINT, _Inout_ LPARAM, _Inout_ LPARAM); 85 | extern BOOL(WINAPI* MMmmDrvInstall)(LPCSTR, LPCSTR, BOOL); 86 | extern DWORD(WINAPI* MMmmGetCurrentTask)(); 87 | extern HMODULE(WINAPI* MMDrvGetModuleHandle)(_In_ HDRVR); 88 | extern HMODULE(WINAPI* MMGetDriverModuleHandle)(_In_ HDRVR); 89 | extern LRESULT(WINAPI* MMDefDriverProc)(DWORD_PTR, HDRVR, UINT, LONG, LONG); 90 | extern LRESULT(WINAPI* MMDriverCallback)(DWORD, DWORD, HDRVR, DWORD, DWORD, DWORD, DWORD); 91 | // Driver stuff 92 | 93 | // Game-related stuff 94 | extern MMRESULT(WINAPI* MMjoyConfigChanged)(DWORD); 95 | extern MMRESULT(WINAPI* MMjoyGetDevCapsA)(UINT, LPJOYCAPSA, UINT); 96 | extern MMRESULT(WINAPI* MMjoyGetDevCapsW)(UINT, LPJOYCAPSW, UINT); 97 | extern MMRESULT(WINAPI* MMjoyGetPos)(UINT, LPJOYINFO); 98 | extern MMRESULT(WINAPI* MMjoyGetPosEx)(UINT, LPJOYINFOEX); 99 | extern MMRESULT(WINAPI* MMjoyGetThreshold)(UINT, LPUINT); 100 | extern MMRESULT(WINAPI* MMjoySetThreshold)(UINT, UINT); 101 | extern MMRESULT(WINAPI* MMjoyReleaseCapture)(UINT); 102 | extern MMRESULT(WINAPI* MMjoySetCapture)(HWND, UINT, UINT, BOOL); 103 | extern UINT(WINAPI* MMjoyGetNumDevs)(); 104 | // Game related stuff 105 | 106 | // MCI stuff 107 | extern BOOL(WINAPI* MMmciDriverNotify)(HWND, UINT, UINT); 108 | extern BOOL(WINAPI* MMmciExecute)(LPCSTR); 109 | extern BOOL(WINAPI* MMmciFreeCommandResource)(UINT); 110 | extern BOOL(WINAPI* MMmciGetErrorStringA)(DWORD, LPTSTR, UINT); 111 | extern BOOL(WINAPI* MMmciGetErrorStringW)(DWORD, LPWSTR, UINT); 112 | extern BOOL(WINAPI* MMmciSetDriverData)(UINT, DWORD); 113 | extern DWORD(WINAPI* MMmciGetDriverData)(UINT); 114 | extern HANDLE(WINAPI* MMmciGetCreatorTask)(MCIDEVICEID); 115 | extern MCIDEVICEID(WINAPI* MMmciGetDeviceIDA)(LPCTSTR); 116 | extern MCIDEVICEID(WINAPI* MMmciGetDeviceIDFromElementIDA)(DWORD, LPCTSTR); 117 | extern MCIDEVICEID(WINAPI* MMmciGetDeviceIDFromElementIDW)(DWORD, LPCWSTR); 118 | extern MCIDEVICEID(WINAPI* MMmciGetDeviceIDW)(LPCWSTR); 119 | extern MCIERROR(WINAPI* MMmciSendCommandA)(MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR); 120 | extern MCIERROR(WINAPI* MMmciSendCommandW)(MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR); 121 | extern MCIERROR(WINAPI* MMmciSendStringA)(LPCTSTR, LPTSTR, UINT, HANDLE); 122 | extern MCIERROR(WINAPI* MMmciSendStringW)(LPCWSTR, LPWSTR, UINT, HANDLE); 123 | extern UINT(WINAPI* MMmciDriverYield)(UINT); 124 | extern UINT(WINAPI* MMmciLoadCommandResource)(HINSTANCE, LPCWSTR, UINT); 125 | extern UINT(WINAPI* MMmciSetYieldProc)(MCIDEVICEID, YIELDPROC, DWORD); 126 | extern YIELDPROC(WINAPI* MMmciGetYieldProc)(MCIDEVICEID, LPDWORD); 127 | // MCI stuff 128 | 129 | // Mixer stuff 130 | extern DWORD(WINAPI* MMmixerMessage)(HMIXER, UINT, DWORD_PTR, DWORD_PTR); 131 | extern MMRESULT(WINAPI* MMmixerClose)(HMIXER); 132 | extern MMRESULT(WINAPI* MMmixerGetControlDetailsA)(HMIXEROBJ, LPMIXERCONTROLDETAILS, DWORD); 133 | extern MMRESULT(WINAPI* MMmixerGetControlDetailsW)(HMIXEROBJ, LPMIXERCONTROLDETAILS, DWORD); 134 | extern MMRESULT(WINAPI* MMmixerGetDevCapsA)(UINT_PTR, LPMIXERCAPSA, UINT); 135 | extern MMRESULT(WINAPI* MMmixerGetDevCapsW)(UINT_PTR, LPMIXERCAPSW, UINT); 136 | extern MMRESULT(WINAPI* MMmixerGetID)(HMIXEROBJ, UINT FAR*, DWORD); 137 | extern MMRESULT(WINAPI* MMmixerGetLineControlsA)(HMIXEROBJ, LPMIXERLINECONTROLSA, DWORD); 138 | extern MMRESULT(WINAPI* MMmixerGetLineControlsW)(HMIXEROBJ, LPMIXERLINECONTROLSW, DWORD); 139 | extern MMRESULT(WINAPI* MMmixerGetLineInfoA)(HMIXEROBJ, LPMIXERLINEA, DWORD); 140 | extern MMRESULT(WINAPI* MMmixerGetLineInfoW)(HMIXEROBJ, LPMIXERLINEW, DWORD); 141 | extern MMRESULT(WINAPI* MMmixerOpen)(LPHMIXER, UINT, DWORD_PTR, DWORD_PTR, DWORD); 142 | extern MMRESULT(WINAPI* MMmixerSetControlDetails)(HMIXEROBJ, LPMIXERCONTROLDETAILS, DWORD); 143 | extern UINT(WINAPI* MMmixerGetNumDevs)(); 144 | // Mixer stuff 145 | 146 | // MMIO stuff 147 | extern FOURCC(WINAPI* MMmmioStringToFOURCCA)(LPCTSTR, UINT); 148 | extern FOURCC(WINAPI* MMmmioStringToFOURCCW)(LPCWSTR, UINT); 149 | extern LONG(WINAPI* MMmmioRead)(HMMIO, HPSTR, LONG); 150 | extern LONG(WINAPI* MMmmioSeek)(HMMIO, LONG, INT); 151 | extern LONG(WINAPI* MMmmioWrite)(HMMIO, char _huge*, LONG); 152 | extern LPMMIOPROC(WINAPI* MMmmioInstallIOProcA)(FOURCC, LPMMIOPROC, DWORD); 153 | extern LPMMIOPROC(WINAPI* MMmmioInstallIOProcW)(FOURCC, LPMMIOPROC, DWORD); 154 | extern LRESULT(WINAPI* MMmmioSendMessage)(HMMIO, UINT, LPARAM, LPARAM); 155 | extern MMRESULT(WINAPI* MMmmioAdvance)(HMMIO, LPMMIOINFO, UINT); 156 | extern MMRESULT(WINAPI* MMmmioAscend)(HMMIO, LPMMCKINFO, UINT); 157 | extern MMRESULT(WINAPI* MMmmioClose)(HMMIO, UINT); 158 | extern MMRESULT(WINAPI* MMmmioCreateChunk)(HMMIO, LPMMCKINFO, UINT); 159 | extern MMRESULT(WINAPI* MMmmioDescend)(HMMIO, LPMMCKINFO, const MMCKINFO*, UINT); 160 | extern MMRESULT(WINAPI* MMmmioFlush)(HMMIO, UINT); 161 | extern MMRESULT(WINAPI* MMmmioGetInfo)(HMMIO, LPMMIOINFO, UINT); 162 | extern MMRESULT(WINAPI* MMmmioOpenA)(LPTSTR, LPMMIOINFO, DWORD); 163 | extern MMRESULT(WINAPI* MMmmioOpenW)(LPWSTR, LPMMIOINFO, DWORD); 164 | extern MMRESULT(WINAPI* MMmmioRenameA)(LPCTSTR, LPCTSTR, const LPMMIOINFO, DWORD); 165 | extern MMRESULT(WINAPI* MMmmioRenameW)(LPCWSTR, LPCWSTR, const LPMMIOINFO, DWORD); 166 | extern MMRESULT(WINAPI* MMmmioSetBuffer)(HMMIO, LPSTR, LONG, UINT); 167 | extern MMRESULT(WINAPI* MMmmioSetInfo)(HMMIO, LPMMIOINFO, UINT); 168 | // MMIO stuff 169 | 170 | // MM stuff 171 | extern BOOL(WINAPI* MMmmTaskSignal)(DWORD); 172 | extern UINT(WINAPI* MMmmTaskCreate)(LPTASKCALLBACK, HANDLE, DWORD_PTR); 173 | extern VOID(WINAPI* MMmmTaskBlock)(DWORD); 174 | extern VOID(WINAPI* MMmmTaskYield)(); 175 | // MM stuff 176 | 177 | // PlaySound stuff 178 | extern BOOL(WINAPI* MMPlaySound)(LPCSTR, HMODULE, DWORD); 179 | extern BOOL(WINAPI* MMPlaySoundA)(LPCTSTR, HMODULE, DWORD); 180 | extern BOOL(WINAPI* MMPlaySoundW)(LPCWSTR, HMODULE, DWORD); 181 | extern BOOL(WINAPI* MMsndPlaySoundA)(LPCTSTR, UINT); 182 | extern BOOL(WINAPI* MMsndPlaySoundW)(LPCWSTR, UINT); 183 | // PlaySound stuff 184 | 185 | // Aux stuff 186 | extern DWORD(WINAPI* MMauxOutMessage)(UINT, UINT, DWORD_PTR, DWORD_PTR); 187 | extern MMRESULT(WINAPI* MMauxGetDevCapsA)(UINT_PTR, LPAUXCAPSA, UINT); 188 | extern MMRESULT(WINAPI* MMauxGetDevCapsW)(UINT_PTR, LPAUXCAPSW, UINT); 189 | extern MMRESULT(WINAPI* MMauxGetVolume)(UINT, LPDWORD); 190 | extern MMRESULT(WINAPI* MMauxSetVolume)(UINT, DWORD); 191 | extern UINT(WINAPI* MMauxGetNumDevs)(); 192 | // Aux stuff 193 | 194 | // Wave out stuff 195 | extern DWORD(WINAPI* MMwaveOutMessage)(HWAVEOUT, UINT, DWORD_PTR, DWORD_PTR); 196 | extern MMRESULT(WINAPI* MMwaveOutAddBuffer)(HWAVEOUT, LPWAVEHDR, UINT); 197 | extern MMRESULT(WINAPI* MMwaveOutBreakLoop)(HWAVEOUT); 198 | extern MMRESULT(WINAPI* MMwaveOutClose)(HWAVEOUT); 199 | extern MMRESULT(WINAPI* MMwaveOutGetDevCapsA)(UINT_PTR, LPWAVEOUTCAPSA, UINT); 200 | extern MMRESULT(WINAPI* MMwaveOutGetDevCapsW)(UINT_PTR, LPWAVEOUTCAPSW, UINT); 201 | extern MMRESULT(WINAPI* MMwaveOutGetErrorTextA)(MMRESULT, LPTSTR, UINT); 202 | extern MMRESULT(WINAPI* MMwaveOutGetErrorTextW)(MMRESULT, LPWSTR, UINT); 203 | extern MMRESULT(WINAPI* MMwaveOutGetID)(HWAVEOUT, LPUINT); 204 | extern MMRESULT(WINAPI* MMwaveOutGetPitch)(HWAVEOUT, LPDWORD); 205 | extern MMRESULT(WINAPI* MMwaveOutGetPlaybackRate)(HWAVEOUT, LPDWORD); 206 | extern MMRESULT(WINAPI* MMwaveOutGetPosition)(HWAVEOUT, LPMMTIME, UINT); 207 | extern MMRESULT(WINAPI* MMwaveOutGetVolume)(HWAVEOUT, LPDWORD); 208 | extern MMRESULT(WINAPI* MMwaveOutOpen)(LPHWAVEOUT, UINT, LPCWAVEFORMATEX, DWORD_PTR, DWORD_PTR, DWORD); 209 | extern MMRESULT(WINAPI* MMwaveOutPrepareHeader)(HWAVEOUT, LPWAVEHDR, UINT); 210 | extern MMRESULT(WINAPI* MMwaveOutReset)(HWAVEOUT); 211 | extern MMRESULT(WINAPI* MMwaveOutRestart)(HWAVEOUT); 212 | extern MMRESULT(WINAPI* MMwaveOutPause)(HWAVEOUT); 213 | extern MMRESULT(WINAPI* MMwaveOutSetPitch)(HWAVEOUT, DWORD); 214 | extern MMRESULT(WINAPI* MMwaveOutSetPlaybackRate)(HWAVEOUT, DWORD); 215 | extern MMRESULT(WINAPI* MMwaveOutSetVolume)(HWAVEOUT, DWORD); 216 | extern MMRESULT(WINAPI* MMwaveOutStart)(HWAVEOUT); 217 | extern MMRESULT(WINAPI* MMwaveOutStop)(HWAVEOUT); 218 | extern MMRESULT(WINAPI* MMwaveOutUnprepareHeader)(HWAVEOUT, LPWAVEHDR, UINT); 219 | extern MMRESULT(WINAPI* MMwaveOutWrite)(HWAVEOUT, LPWAVEHDR, UINT); 220 | extern UINT(WINAPI* MMwaveOutGetNumDevs)(); 221 | // Wave out stuff 222 | 223 | // Wave in stuff 224 | extern DWORD(WINAPI* MMwaveInMessage)(HWAVEIN, UINT, DWORD_PTR, DWORD_PTR); 225 | extern MMRESULT(WINAPI* MMwaveInAddBuffer)(HWAVEIN, LPWAVEHDR, UINT); 226 | extern MMRESULT(WINAPI* MMwaveInClose)(HWAVEIN); 227 | extern MMRESULT(WINAPI* MMwaveInGetDevCapsA)(UINT_PTR, LPWAVEINCAPSA, UINT); 228 | extern MMRESULT(WINAPI* MMwaveInGetDevCapsW)(UINT_PTR, LPWAVEINCAPSW, UINT); 229 | extern MMRESULT(WINAPI* MMwaveInGetErrorTextA)(MMRESULT, LPTSTR, UINT); 230 | extern MMRESULT(WINAPI* MMwaveInGetErrorTextW)(MMRESULT, LPWSTR, UINT); 231 | extern MMRESULT(WINAPI* MMwaveInGetID)(HWAVEIN, LPUINT); 232 | extern MMRESULT(WINAPI* MMwaveInGetPosition)(HWAVEIN, LPMMTIME, UINT); 233 | extern MMRESULT(WINAPI* MMwaveInOpen)(LPHWAVEIN, UINT, LPCWAVEFORMATEX, DWORD_PTR, DWORD_PTR, DWORD); 234 | extern MMRESULT(WINAPI* MMwaveInPrepareHeader)(HWAVEIN, LPWAVEHDR, UINT); 235 | extern MMRESULT(WINAPI* MMwaveInReset)(HWAVEIN); 236 | extern MMRESULT(WINAPI* MMwaveInStart)(HWAVEIN); 237 | extern MMRESULT(WINAPI* MMwaveInStop)(HWAVEIN); 238 | extern MMRESULT(WINAPI* MMwaveInUnprepareHeader)(HWAVEIN, LPWAVEHDR, UINT); 239 | extern UINT(WINAPI* MMwaveInGetNumDevs)(); 240 | extern UINT(WINAPI mmsystemGetVersion)(); 241 | // Wave in stuff 242 | 243 | #ifdef _M_IX86 244 | // Legacy 16-bit functions 245 | extern MMRESULT(WINAPI* MMaux32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR); 246 | extern MMRESULT(WINAPI* MMjoy32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR); 247 | extern MMRESULT(WINAPI* MMmci32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR); 248 | extern MMRESULT(WINAPI* MMmid32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR); 249 | extern MMRESULT(WINAPI* MMmod32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR); 250 | extern MMRESULT(WINAPI* MMmxd32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR); 251 | extern MMRESULT(WINAPI* MMtid32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR); 252 | extern MMRESULT(WINAPI* MMwid32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR); 253 | extern MMRESULT(WINAPI* MMwod32Message)(UINT_PTR, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR); 254 | // Legacy 16-bit functions 255 | #endif 256 | 257 | #endif -------------------------------------------------------------------------------- /xmake.lua: -------------------------------------------------------------------------------- 1 | set_xmakever("2.9.8") 2 | set_project("WinMMWRP") 3 | 4 | set_allowedplats("windows") 5 | set_allowedmodes("debug", "release") 6 | set_allowedarchs("x86", "x86_64", "x64", "arm64") 7 | 8 | add_rules("mode.release", "mode.debug") 9 | set_languages("clatest", "cxxlatest") 10 | set_runtimes("stdc++_static") 11 | 12 | option("purewrapper") 13 | set_default(false) 14 | set_showmenu(true) 15 | add_defines("PURE_WRAPPER") 16 | option_end() 17 | 18 | option("useclang") 19 | set_default("false") 20 | set_showmenu(true) 21 | option_end() 22 | 23 | target("WinMMWRP") 24 | set_kind("shared") 25 | set_basename("winmm") 26 | set_options("purewrapper") 27 | set_options("useclang") 28 | 29 | if is_mode("debug") then 30 | add_defines("DEBUG") 31 | add_defines("_DEBUG") 32 | set_symbols("debug") 33 | set_optimize("none") 34 | else 35 | add_defines("NDEBUG") 36 | set_symbols("hidden") 37 | set_optimize("fastest") 38 | set_strip("all") 39 | end 40 | 41 | if has_config("useclang") then 42 | set_toolchains("clang-cl") 43 | else 44 | set_toolchains("mingw") 45 | end 46 | 47 | add_defines("OMNIMIDI_EXPORTS") 48 | add_ldflags("-j") 49 | add_cxflags("-Wall") 50 | 51 | add_includedirs("inc") 52 | add_files("src/*.cpp") 53 | add_files("*.def") 54 | 55 | if is_plat("windows") then 56 | set_toolchains("mingw") 57 | 58 | -- Remove lib prefix 59 | set_prefixname("") 60 | 61 | add_shflags("-static-libgcc", { force = true }) 62 | add_syslinks("uuid", "shlwapi", "ole32") 63 | add_defines("_WIN32", "_WINXP", "_WIN32_WINNT=0x6000") 64 | 65 | if is_mode("debug") then 66 | add_syslinks("-l:libwinpthread.a") 67 | end 68 | 69 | if is_arch("x86") then 70 | add_shflags("legacyExports.def", { force = true }) 71 | else 72 | add_shflags("newExports.def", { force = true }) 73 | end 74 | else 75 | -- This is Win32 only 76 | remove_files("src/*.cpp") 77 | end 78 | target_end() --------------------------------------------------------------------------------