common.bmx 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. ' Copyright (c) 2010-2022 Bruce A Henderson
  2. '
  3. ' Permission is hereby granted, free of charge, to any person obtaining a copy
  4. ' of this software and associated documentation files (the "Software"), to deal
  5. ' in the Software without restriction, including without limitation the rights
  6. ' to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. ' copies of the Software, and to permit persons to whom the Software is
  8. ' furnished to do so, subject to the following conditions:
  9. '
  10. ' The above copyright notice and this permission notice shall be included in
  11. ' all copies or substantial portions of the Software.
  12. '
  13. ' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. ' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. ' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. ' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. ' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. ' OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. ' THE SOFTWARE.
  20. '
  21. SuperStrict
  22. ?macos
  23. Import "-framework CoreMIDI"
  24. Import "-framework CoreFoundation"
  25. Import "-framework CoreAudio"
  26. ?linux
  27. Import "-lasound"
  28. ?win32
  29. Import "-lwinmm"
  30. ?
  31. Import "source.bmx"
  32. Extern
  33. Function bmx_midi_in_create:Byte Ptr(clientName:String, queueSizeLimit:Int, api:Int)
  34. Function bmx_midi_in_openPort(handle:Byte Ptr, portNumber:Int, portName:String)
  35. Function bmx_midi_in_closePort(handle:Byte Ptr)
  36. Function bmx_midi_in_openVirtualPort(handle:Byte Ptr, portName:String)
  37. Function bmx_midi_in_getPortCount:Int(handle:Byte Ptr)
  38. Function bmx_midi_in_getPortName:String(handle:Byte Ptr, portNumber:Int)
  39. Function bmx_midi_in_free(handle:Byte Ptr)
  40. Function bmx_midi_in_getMessage:Byte[](handle:Byte Ptr, timestamp:Double Ptr)
  41. Function bmx_midi_in_ignoreTypes(handle:Byte Ptr, midiSysex:Int, midiTime:Int, midiSense:Int)
  42. Function bmx_midi_in_isPortOpen:Int(handle:Byte Ptr)
  43. Function bmx_midi_in_setBufferSize(handle:Byte Ptr, size:UInt, count:UInt)
  44. Function bmx_midi_out_create:Byte Ptr(clientName:String, api:Int)
  45. Function bmx_midi_out_openPort(handle:Byte Ptr, portNumber:Int, portName:String)
  46. Function bmx_midi_out_closePort(handle:Byte Ptr)
  47. Function bmx_midi_out_openVirtualPort(handle:Byte Ptr, portName:String)
  48. Function bmx_midi_out_getPortCount:Int(handle:Byte Ptr)
  49. Function bmx_midi_out_getPortName:String(handle:Byte Ptr, portNumber:Int)
  50. Function bmx_midi_out_sendMessage(handle:Byte Ptr, message:Byte Ptr, length:Int)
  51. Function bmx_midi_out_free(handle:Byte Ptr)
  52. Function bmx_midi_out_isPortOpen:Int(handle:Byte Ptr)
  53. Function bmx_midi_getVersion:String()
  54. Function bmx_midi_getCompiledApi:Int[]()
  55. End Extern
  56. Rem
  57. bbdoc: Search for a working compiled API.
  58. End Rem
  59. Const API_UNSPECIFIED:Int = 0
  60. Rem
  61. bbdoc: Macintosh OS-X Core Midi API.
  62. End Rem
  63. Const API_MACOSX_CORE:Int = 1
  64. Rem
  65. bbdoc: The Advanced Linux Sound Architecture API.
  66. End Rem
  67. Const API_LINUX_ALSA:Int = 2
  68. Rem
  69. bbdoc: The JACK Low-Latency MIDI Server API.
  70. End Rem
  71. Const API_UNIX_JACK:Int = 3
  72. Rem
  73. bbdoc: The Microsoft Multimedia MIDI API.
  74. End Rem
  75. Const API_WINDOWS_MM:Int = 4
  76. Rem
  77. bbdoc: A compilable but non-functional API.
  78. End Rem
  79. Const RTMIDI_API_RTMIDI_DUMMY:Int = 5
  80. Rem
  81. bbdoc: W3C Web MIDI API.
  82. End Rem
  83. Const WEB_MIDI_API:Int = 6