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.

237 lines
8.2KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2016 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of the ISC license
  6. http://www.isc.org/downloads/software-support-policy/isc-license/
  7. Permission to use, copy, modify, and/or distribute this software for any
  8. purpose with or without fee is hereby granted, provided that the above
  9. copyright notice and this permission notice appear in all copies.
  10. THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD
  11. TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  12. FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
  13. OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  14. USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  16. OF THIS SOFTWARE.
  17. -----------------------------------------------------------------------------
  18. To release a closed-source product which uses other parts of JUCE not
  19. licensed under the ISC terms, commercial licenses are available: visit
  20. www.juce.com for more information.
  21. ==============================================================================
  22. */
  23. #ifdef JUCE_AUDIO_DEVICES_H_INCLUDED
  24. /* When you add this cpp file to your project, you mustn't include it in a file where you've
  25. already included any other headers - just put it inside a file on its own, possibly with your config
  26. flags preceding it, but don't include anything else. That also includes avoiding any automatic prefix
  27. header files that the compiler may be using.
  28. */
  29. #error "Incorrect use of JUCE cpp file"
  30. #endif
  31. #define JUCE_CORE_INCLUDE_OBJC_HELPERS 1
  32. #define JUCE_CORE_INCLUDE_COM_SMART_PTR 1
  33. #define JUCE_CORE_INCLUDE_JNI_HELPERS 1
  34. #define JUCE_CORE_INCLUDE_NATIVE_HEADERS 1
  35. #define JUCE_EVENTS_INCLUDE_WIN32_MESSAGE_WINDOW 1
  36. #ifndef JUCE_USE_WINRT_MIDI
  37. #define JUCE_USE_WINRT_MIDI 0
  38. #endif
  39. #if JUCE_USE_WINRT_MIDI
  40. #define JUCE_EVENTS_INCLUDE_WINRT_WRAPPER 1
  41. #endif
  42. #include "juce_audio_devices.h"
  43. //==============================================================================
  44. #if JUCE_MAC
  45. #define Point CarbonDummyPointName
  46. #define Component CarbonDummyCompName
  47. #import <CoreAudio/AudioHardware.h>
  48. #import <CoreMIDI/MIDIServices.h>
  49. #import <AudioToolbox/AudioServices.h>
  50. #undef Point
  51. #undef Component
  52. #elif JUCE_IOS
  53. #import <AudioToolbox/AudioToolbox.h>
  54. #import <AVFoundation/AVFoundation.h>
  55. #import <CoreMIDI/MIDIServices.h>
  56. #if TARGET_OS_SIMULATOR
  57. #import <CoreMIDI/MIDINetworkSession.h>
  58. #endif
  59. //==============================================================================
  60. #elif JUCE_WINDOWS
  61. #if JUCE_WASAPI
  62. #include <mmreg.h>
  63. #endif
  64. #if JUCE_USE_WINRT_MIDI
  65. /* If you cannot find any of the header files below then you are probably
  66. attempting to use the Windows 10 Bluetooth Low Energy API. For this to work you
  67. need to install version 10.0.14393.0 of the Windows Standalone SDK and add the
  68. path to the WinRT headers to your build system. This path should have the form
  69. "C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\winrt".
  70. Also please note that Microsoft's Bluetooth MIDI stack has multiple issues, so
  71. this API is EXPERIMENTAL - use at your own risk!
  72. */
  73. #include <windows.devices.h>
  74. #include <windows.devices.midi.h>
  75. #include <windows.devices.enumeration.h>
  76. #include <wrl/event.h>
  77. #if JUCE_MSVC
  78. #pragma warning (push)
  79. #pragma warning (disable: 4467)
  80. #endif
  81. #include <robuffer.h>
  82. #if JUCE_MSVC
  83. #pragma warning (pop)
  84. #endif
  85. #endif
  86. #if JUCE_ASIO
  87. /* This is very frustrating - we only need to use a handful of definitions from
  88. a couple of the header files in Steinberg's ASIO SDK, and it'd be easy to copy
  89. about 30 lines of code into this cpp file to create a fully stand-alone ASIO
  90. implementation...
  91. ..unfortunately that would break Steinberg's license agreement for use of
  92. their SDK, so I'm not allowed to do this.
  93. This means that anyone who wants to use JUCE's ASIO abilities will have to:
  94. 1) Agree to Steinberg's licensing terms and download the ASIO SDK
  95. (see http://www.steinberg.net/en/company/developers.html).
  96. 2) Enable this code with a global definition #define JUCE_ASIO 1.
  97. 3) Make sure that your header search path contains the iasiodrv.h file that
  98. comes with the SDK. (Only about a handful of the SDK header files are actually
  99. needed - so to simplify things, you could just copy these into your JUCE directory).
  100. */
  101. #include <iasiodrv.h>
  102. #endif
  103. //==============================================================================
  104. #elif JUCE_LINUX
  105. #if JUCE_ALSA
  106. /* Got an include error here? If so, you've either not got ALSA installed, or you've
  107. not got your paths set up correctly to find its header files.
  108. The package you need to install to get ASLA support is "libasound2-dev".
  109. If you don't have the ALSA library and don't want to build Juce with audio support,
  110. just set the JUCE_ALSA flag to 0.
  111. */
  112. #include <alsa/asoundlib.h>
  113. #endif
  114. #if JUCE_JACK
  115. /* Got an include error here? If so, you've either not got jack-audio-connection-kit
  116. installed, or you've not got your paths set up correctly to find its header files.
  117. The package you need to install to get JACK support is "libjack-dev".
  118. If you don't have the jack-audio-connection-kit library and don't want to build
  119. Juce with low latency audio support, just set the JUCE_JACK flag to 0.
  120. */
  121. #include <jack/jack.h>
  122. #endif
  123. #undef SIZEOF
  124. //==============================================================================
  125. #elif JUCE_ANDROID
  126. #if JUCE_USE_ANDROID_OPENSLES
  127. #include <SLES/OpenSLES.h>
  128. #include <SLES/OpenSLES_Android.h>
  129. #include <SLES/OpenSLES_AndroidConfiguration.h>
  130. #endif
  131. #endif
  132. namespace juce
  133. {
  134. #include "audio_io/juce_AudioDeviceManager.cpp"
  135. #include "audio_io/juce_AudioIODevice.cpp"
  136. #include "audio_io/juce_AudioIODeviceType.cpp"
  137. #include "midi_io/juce_MidiMessageCollector.cpp"
  138. #include "midi_io/juce_MidiOutput.cpp"
  139. #include "sources/juce_AudioSourcePlayer.cpp"
  140. #include "sources/juce_AudioTransportSource.cpp"
  141. #include "native/juce_MidiDataConcatenator.h"
  142. //==============================================================================
  143. #if JUCE_MAC
  144. #include "native/juce_mac_CoreAudio.cpp"
  145. #include "native/juce_mac_CoreMidi.cpp"
  146. //==============================================================================
  147. #elif JUCE_IOS
  148. #include "native/juce_ios_Audio.h"
  149. #include "native/juce_ios_Audio.cpp"
  150. #include "native/juce_mac_CoreMidi.cpp"
  151. //==============================================================================
  152. #elif JUCE_WINDOWS
  153. #if JUCE_WASAPI
  154. #include "native/juce_win32_WASAPI.cpp"
  155. #endif
  156. #if JUCE_DIRECTSOUND
  157. #include "native/juce_win32_DirectSound.cpp"
  158. #endif
  159. #include "native/juce_win32_Midi.cpp"
  160. #if JUCE_ASIO
  161. #include "native/juce_win32_ASIO.cpp"
  162. #endif
  163. //==============================================================================
  164. #elif JUCE_LINUX
  165. #if JUCE_ALSA
  166. #include "native/juce_linux_ALSA.cpp"
  167. #endif
  168. #include "native/juce_linux_Midi.cpp"
  169. #if JUCE_JACK
  170. #include "native/juce_linux_JackAudio.cpp"
  171. #endif
  172. //==============================================================================
  173. #elif JUCE_ANDROID
  174. #include "native/juce_android_Audio.cpp"
  175. #include "native/juce_android_Midi.cpp"
  176. #if JUCE_USE_ANDROID_OPENSLES
  177. #include "native/juce_android_OpenSL.cpp"
  178. #endif
  179. #endif
  180. #if ! JUCE_SYSTEMAUDIOVOL_IMPLEMENTED
  181. // None of these methods are available. (On Windows you might need to enable WASAPI for this)
  182. float JUCE_CALLTYPE SystemAudioVolume::getGain() { jassertfalse; return 0.0f; }
  183. bool JUCE_CALLTYPE SystemAudioVolume::setGain (float) { jassertfalse; return false; }
  184. bool JUCE_CALLTYPE SystemAudioVolume::isMuted() { jassertfalse; return false; }
  185. bool JUCE_CALLTYPE SystemAudioVolume::setMuted (bool) { jassertfalse; return false; }
  186. #endif
  187. }