The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

261 lines
9.3KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. The code included in this file is provided under the terms of the ISC license
  8. http://www.isc.org/downloads/software-support-policy/isc-license. Permission
  9. To use, copy, modify, and/or distribute this software for any purpose with or
  10. without fee is hereby granted provided that the above copyright notice and
  11. this permission notice appear in all copies.
  12. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  13. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  14. DISCLAIMED.
  15. ==============================================================================
  16. */
  17. #ifdef JUCE_AUDIO_DEVICES_H_INCLUDED
  18. /* When you add this cpp file to your project, you mustn't include it in a file where you've
  19. already included any other headers - just put it inside a file on its own, possibly with your config
  20. flags preceding it, but don't include anything else. That also includes avoiding any automatic prefix
  21. header files that the compiler may be using.
  22. */
  23. #error "Incorrect use of JUCE cpp file"
  24. #endif
  25. #define JUCE_CORE_INCLUDE_OBJC_HELPERS 1
  26. #define JUCE_CORE_INCLUDE_COM_SMART_PTR 1
  27. #define JUCE_CORE_INCLUDE_JNI_HELPERS 1
  28. #define JUCE_CORE_INCLUDE_NATIVE_HEADERS 1
  29. #define JUCE_EVENTS_INCLUDE_WIN32_MESSAGE_WINDOW 1
  30. #ifndef JUCE_USE_WINRT_MIDI
  31. #define JUCE_USE_WINRT_MIDI 0
  32. #endif
  33. #if JUCE_USE_WINRT_MIDI
  34. #define JUCE_EVENTS_INCLUDE_WINRT_WRAPPER 1
  35. #endif
  36. #include "juce_audio_devices.h"
  37. #include "native/juce_MidiDataConcatenator.h"
  38. #include "midi_io/ump/juce_UMPProtocols.h"
  39. #include "midi_io/ump/juce_UMPUtils.h"
  40. #include "midi_io/ump/juce_UMPacket.h"
  41. #include "midi_io/ump/juce_UMPSysEx7.h"
  42. #include "midi_io/ump/juce_UMPView.h"
  43. #include "midi_io/ump/juce_UMPIterator.h"
  44. #include "midi_io/ump/juce_UMPackets.h"
  45. #include "midi_io/ump/juce_UMPFactory.h"
  46. #include "midi_io/ump/juce_UMPConversion.h"
  47. #include "midi_io/ump/juce_UMPMidi1ToBytestreamTranslator.h"
  48. #include "midi_io/ump/juce_UMPMidi1ToMidi2DefaultTranslator.h"
  49. #include "midi_io/ump/juce_UMPConverters.h"
  50. #include "midi_io/ump/juce_UMPDispatcher.h"
  51. #include "midi_io/ump/juce_UMPReceiver.h"
  52. #include "midi_io/ump/juce_UMPBytestreamInputHandler.h"
  53. #include "midi_io/ump/juce_UMPU32InputHandler.h"
  54. #include "midi_io/ump/juce_UMPUtils.cpp"
  55. #include "midi_io/ump/juce_UMPView.cpp"
  56. #include "midi_io/ump/juce_UMPSysEx7.cpp"
  57. #include "midi_io/ump/juce_UMPMidi1ToMidi2DefaultTranslator.cpp"
  58. #include "midi_io/ump/juce_UMPTests.cpp"
  59. namespace juce
  60. {
  61. namespace ump = universal_midi_packets;
  62. }
  63. //==============================================================================
  64. #if JUCE_MAC
  65. #define Point CarbonDummyPointName
  66. #define Component CarbonDummyCompName
  67. #import <CoreAudio/AudioHardware.h>
  68. #import <CoreMIDI/MIDIServices.h>
  69. #import <AudioToolbox/AudioServices.h>
  70. #undef Point
  71. #undef Component
  72. #include "native/juce_mac_CoreAudio.cpp"
  73. #include "native/juce_mac_CoreMidi.mm"
  74. #elif JUCE_IOS
  75. #import <AudioToolbox/AudioToolbox.h>
  76. #import <AVFoundation/AVFoundation.h>
  77. #import <CoreMIDI/MIDIServices.h>
  78. #if TARGET_OS_SIMULATOR
  79. #import <CoreMIDI/MIDINetworkSession.h>
  80. #endif
  81. #include "native/juce_ios_Audio.cpp"
  82. #include "native/juce_mac_CoreMidi.mm"
  83. //==============================================================================
  84. #elif JUCE_WINDOWS
  85. #if JUCE_WASAPI
  86. #include <mmreg.h>
  87. #include "native/juce_win32_WASAPI.cpp"
  88. #endif
  89. #if JUCE_DIRECTSOUND
  90. #include "native/juce_win32_DirectSound.cpp"
  91. #endif
  92. #if JUCE_USE_WINRT_MIDI && (JUCE_MSVC || JUCE_CLANG)
  93. /* If you cannot find any of the header files below then you are probably
  94. attempting to use the Windows 10 Bluetooth Low Energy API. For this to work you
  95. need to install version 10.0.14393.0 of the Windows Standalone SDK and you may
  96. need to add the path to the WinRT headers to your build system. This path should
  97. have the form "C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\winrt".
  98. Also please note that Microsoft's Bluetooth MIDI stack has multiple issues, so
  99. this API is EXPERIMENTAL - use at your own risk!
  100. */
  101. #include <windows.devices.h>
  102. #include <windows.devices.midi.h>
  103. #include <windows.devices.enumeration.h>
  104. JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4265)
  105. #include <wrl/event.h>
  106. JUCE_END_IGNORE_WARNINGS_MSVC
  107. JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4467)
  108. #include <robuffer.h>
  109. JUCE_END_IGNORE_WARNINGS_MSVC
  110. #endif
  111. #include "native/juce_win32_Midi.cpp"
  112. #if JUCE_ASIO
  113. /* This is very frustrating - we only need to use a handful of definitions from
  114. a couple of the header files in Steinberg's ASIO SDK, and it'd be easy to copy
  115. about 30 lines of code into this cpp file to create a fully stand-alone ASIO
  116. implementation...
  117. ..unfortunately that would break Steinberg's license agreement for use of
  118. their SDK, so I'm not allowed to do this.
  119. This means that anyone who wants to use JUCE's ASIO abilities will have to:
  120. 1) Agree to Steinberg's licensing terms and download the ASIO SDK
  121. (see http://www.steinberg.net/en/company/developers.html).
  122. 2) Enable this code with a global definition #define JUCE_ASIO 1.
  123. 3) Make sure that your header search path contains the iasiodrv.h file that
  124. comes with the SDK. (Only about a handful of the SDK header files are actually
  125. needed - so to simplify things, you could just copy these into your JUCE directory).
  126. */
  127. #include <iasiodrv.h>
  128. #include "native/juce_win32_ASIO.cpp"
  129. #endif
  130. //==============================================================================
  131. #elif JUCE_LINUX || JUCE_BSD
  132. #if JUCE_ALSA
  133. /* Got an include error here? If so, you've either not got ALSA installed, or you've
  134. not got your paths set up correctly to find its header files.
  135. The package you need to install to get ASLA support is "libasound2-dev".
  136. If you don't have the ALSA library and don't want to build JUCE with audio support,
  137. just set the JUCE_ALSA flag to 0.
  138. */
  139. #include <alsa/asoundlib.h>
  140. #include "native/juce_linux_ALSA.cpp"
  141. #endif
  142. #if JUCE_JACK
  143. /* Got an include error here? If so, you've either not got jack-audio-connection-kit
  144. installed, or you've not got your paths set up correctly to find its header files.
  145. The package you need to install to get JACK support is "libjack-dev".
  146. If you don't have the jack-audio-connection-kit library and don't want to build
  147. JUCE with low latency audio support, just set the JUCE_JACK flag to 0.
  148. */
  149. #include <jack/jack.h>
  150. #include "native/juce_linux_JackAudio.cpp"
  151. #endif
  152. #if (JUCE_LINUX && JUCE_BELA)
  153. /* Got an include error here? If so, you've either not got the bela headers
  154. installed, or you've not got your paths set up correctly to find its header
  155. files.
  156. */
  157. #include <Bela.h>
  158. #include <Midi.h>
  159. #include "native/juce_linux_Bela.cpp"
  160. #endif
  161. #undef SIZEOF
  162. #if ! JUCE_BELA
  163. #include "native/juce_linux_Midi.cpp"
  164. #endif
  165. //==============================================================================
  166. #elif JUCE_ANDROID
  167. #include "native/juce_android_Audio.cpp"
  168. #include "native/juce_android_Midi.cpp"
  169. #if JUCE_USE_ANDROID_OPENSLES || JUCE_USE_ANDROID_OBOE
  170. #include "native/juce_android_HighPerformanceAudioHelpers.h"
  171. #if JUCE_USE_ANDROID_OPENSLES
  172. #include <SLES/OpenSLES.h>
  173. #include <SLES/OpenSLES_Android.h>
  174. #include <SLES/OpenSLES_AndroidConfiguration.h>
  175. #include "native/juce_android_OpenSL.cpp"
  176. #endif
  177. #if JUCE_USE_ANDROID_OBOE
  178. #if JUCE_USE_ANDROID_OPENSLES
  179. #error "Oboe cannot be enabled at the same time as openSL! Please disable JUCE_USE_ANDROID_OPENSLES"
  180. #endif
  181. JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wunused-parameter",
  182. "-Wzero-as-null-pointer-constant",
  183. "-Winconsistent-missing-destructor-override",
  184. "-Wshadow-field-in-constructor",
  185. "-Wshadow-field")
  186. #include <oboe/Oboe.h>
  187. JUCE_END_IGNORE_WARNINGS_GCC_LIKE
  188. #include "native/juce_android_Oboe.cpp"
  189. #endif
  190. #endif
  191. #endif
  192. #if ! JUCE_SYSTEMAUDIOVOL_IMPLEMENTED
  193. namespace juce
  194. {
  195. // None of these methods are available. (On Windows you might need to enable WASAPI for this)
  196. float JUCE_CALLTYPE SystemAudioVolume::getGain() { jassertfalse; return 0.0f; }
  197. bool JUCE_CALLTYPE SystemAudioVolume::setGain (float) { jassertfalse; return false; }
  198. bool JUCE_CALLTYPE SystemAudioVolume::isMuted() { jassertfalse; return false; }
  199. bool JUCE_CALLTYPE SystemAudioVolume::setMuted (bool) { jassertfalse; return false; }
  200. }
  201. #endif
  202. #include "audio_io/juce_AudioDeviceManager.cpp"
  203. #include "audio_io/juce_AudioIODevice.cpp"
  204. #include "audio_io/juce_AudioIODeviceType.cpp"
  205. #include "midi_io/juce_MidiMessageCollector.cpp"
  206. #include "midi_io/juce_MidiDevices.cpp"
  207. #include "sources/juce_AudioSourcePlayer.cpp"
  208. #include "sources/juce_AudioTransportSource.cpp"