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

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