Audio plugin host https://kx.studio/carla
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.

juce_audio_devices.cpp 8.2KB

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