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.

241 lines
8.7KB

  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. //==============================================================================
  38. #if JUCE_MAC || JUCE_IOS
  39. #include <juce_audio_basics/midi/ump/juce_UMP.h>
  40. #include "midi_io/ump/juce_UMPBytestreamInputHandler.h"
  41. #include "midi_io/ump/juce_UMPU32InputHandler.h"
  42. #endif
  43. #if JUCE_MAC
  44. #define Point CarbonDummyPointName
  45. #define Component CarbonDummyCompName
  46. #import <CoreAudio/AudioHardware.h>
  47. #import <CoreMIDI/MIDIServices.h>
  48. #import <AudioToolbox/AudioServices.h>
  49. #undef Point
  50. #undef Component
  51. #include "native/juce_mac_CoreAudio.cpp"
  52. #include "native/juce_mac_CoreMidi.mm"
  53. #elif JUCE_IOS
  54. #import <AudioToolbox/AudioToolbox.h>
  55. #import <AVFoundation/AVFoundation.h>
  56. #import <CoreMIDI/MIDIServices.h>
  57. #if TARGET_OS_SIMULATOR
  58. #import <CoreMIDI/MIDINetworkSession.h>
  59. #endif
  60. #include "native/juce_ios_Audio.cpp"
  61. #include "native/juce_mac_CoreMidi.mm"
  62. //==============================================================================
  63. #elif JUCE_WINDOWS
  64. #if JUCE_WASAPI
  65. #include <mmreg.h>
  66. #include "native/juce_win32_WASAPI.cpp"
  67. #endif
  68. #if JUCE_DIRECTSOUND
  69. #include "native/juce_win32_DirectSound.cpp"
  70. #endif
  71. #if JUCE_USE_WINRT_MIDI && (JUCE_MSVC || JUCE_CLANG)
  72. /* If you cannot find any of the header files below then you are probably
  73. attempting to use the Windows 10 Bluetooth Low Energy API. For this to work you
  74. need to install version 10.0.14393.0 of the Windows Standalone SDK and you may
  75. need to add the path to the WinRT headers to your build system. This path should
  76. have the form "C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\winrt".
  77. Also please note that Microsoft's Bluetooth MIDI stack has multiple issues, so
  78. this API is EXPERIMENTAL - use at your own risk!
  79. */
  80. #include <windows.devices.h>
  81. #include <windows.devices.midi.h>
  82. #include <windows.devices.enumeration.h>
  83. JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4265)
  84. #include <wrl/event.h>
  85. JUCE_END_IGNORE_WARNINGS_MSVC
  86. JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4467)
  87. #include <robuffer.h>
  88. JUCE_END_IGNORE_WARNINGS_MSVC
  89. #endif
  90. #include <juce_audio_basics/midi/juce_MidiDataConcatenator.h>
  91. #include "native/juce_win32_Midi.cpp"
  92. #if JUCE_ASIO
  93. /* This is very frustrating - we only need to use a handful of definitions from
  94. a couple of the header files in Steinberg's ASIO SDK, and it'd be easy to copy
  95. about 30 lines of code into this cpp file to create a fully stand-alone ASIO
  96. implementation...
  97. ..unfortunately that would break Steinberg's license agreement for use of
  98. their SDK, so I'm not allowed to do this.
  99. This means that anyone who wants to use JUCE's ASIO abilities will have to:
  100. 1) Agree to Steinberg's licensing terms and download the ASIO SDK
  101. (see http://www.steinberg.net/en/company/developers.html).
  102. 2) Enable this code with a global definition #define JUCE_ASIO 1.
  103. 3) Make sure that your header search path contains the iasiodrv.h file that
  104. comes with the SDK. (Only about a handful of the SDK header files are actually
  105. needed - so to simplify things, you could just copy these into your JUCE directory).
  106. */
  107. #include <iasiodrv.h>
  108. #include "native/juce_win32_ASIO.cpp"
  109. #endif
  110. //==============================================================================
  111. #elif JUCE_LINUX || JUCE_BSD
  112. #if JUCE_ALSA
  113. /* Got an include error here? If so, you've either not got ALSA installed, or you've
  114. not got your paths set up correctly to find its header files.
  115. The package you need to install to get ASLA support is "libasound2-dev".
  116. If you don't have the ALSA library and don't want to build JUCE with audio support,
  117. just set the JUCE_ALSA flag to 0.
  118. */
  119. #include <alsa/asoundlib.h>
  120. #include "native/juce_linux_ALSA.cpp"
  121. #endif
  122. #if JUCE_JACK
  123. /* Got an include error here? If so, you've either not got jack-audio-connection-kit
  124. installed, or you've not got your paths set up correctly to find its header files.
  125. The package you need to install to get JACK support is "libjack-dev".
  126. If you don't have the jack-audio-connection-kit library and don't want to build
  127. JUCE with low latency audio support, just set the JUCE_JACK flag to 0.
  128. */
  129. #include <jack/jack.h>
  130. #include "native/juce_linux_JackAudio.cpp"
  131. #endif
  132. #if (JUCE_LINUX && JUCE_BELA)
  133. /* Got an include error here? If so, you've either not got the bela headers
  134. installed, or you've not got your paths set up correctly to find its header
  135. files.
  136. */
  137. #include <Bela.h>
  138. #include <Midi.h>
  139. #include <juce_audio_basics/midi/juce_MidiDataConcatenator.h>
  140. #include "native/juce_linux_Bela.cpp"
  141. #endif
  142. #undef SIZEOF
  143. #if ! JUCE_BELA
  144. #include <juce_audio_basics/midi/juce_MidiDataConcatenator.h>
  145. #include "native/juce_linux_Midi.cpp"
  146. #endif
  147. //==============================================================================
  148. #elif JUCE_ANDROID
  149. #include "native/juce_android_Audio.cpp"
  150. #include <juce_audio_basics/midi/juce_MidiDataConcatenator.h>
  151. #include "native/juce_android_Midi.cpp"
  152. #if JUCE_USE_ANDROID_OPENSLES || JUCE_USE_ANDROID_OBOE
  153. #include "native/juce_android_HighPerformanceAudioHelpers.h"
  154. #if JUCE_USE_ANDROID_OPENSLES
  155. #include <SLES/OpenSLES.h>
  156. #include <SLES/OpenSLES_Android.h>
  157. #include <SLES/OpenSLES_AndroidConfiguration.h>
  158. #include "native/juce_android_OpenSL.cpp"
  159. #endif
  160. #if JUCE_USE_ANDROID_OBOE
  161. #if JUCE_USE_ANDROID_OPENSLES
  162. #error "Oboe cannot be enabled at the same time as openSL! Please disable JUCE_USE_ANDROID_OPENSLES"
  163. #endif
  164. JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wunused-parameter",
  165. "-Wzero-as-null-pointer-constant",
  166. "-Winconsistent-missing-destructor-override",
  167. "-Wshadow-field-in-constructor",
  168. "-Wshadow-field")
  169. #include <oboe/Oboe.h>
  170. JUCE_END_IGNORE_WARNINGS_GCC_LIKE
  171. #include "native/juce_android_Oboe.cpp"
  172. #endif
  173. #endif
  174. #endif
  175. #if ! JUCE_SYSTEMAUDIOVOL_IMPLEMENTED
  176. namespace juce
  177. {
  178. // None of these methods are available. (On Windows you might need to enable WASAPI for this)
  179. float JUCE_CALLTYPE SystemAudioVolume::getGain() { jassertfalse; return 0.0f; }
  180. bool JUCE_CALLTYPE SystemAudioVolume::setGain (float) { jassertfalse; return false; }
  181. bool JUCE_CALLTYPE SystemAudioVolume::isMuted() { jassertfalse; return false; }
  182. bool JUCE_CALLTYPE SystemAudioVolume::setMuted (bool) { jassertfalse; return false; }
  183. }
  184. #endif
  185. #include "audio_io/juce_AudioDeviceManager.cpp"
  186. #include "audio_io/juce_AudioIODevice.cpp"
  187. #include "audio_io/juce_AudioIODeviceType.cpp"
  188. #include "midi_io/juce_MidiMessageCollector.cpp"
  189. #include "midi_io/juce_MidiDevices.cpp"
  190. #include "sources/juce_AudioSourcePlayer.cpp"
  191. #include "sources/juce_AudioTransportSource.cpp"