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
8.6KB

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