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

10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #if defined (JUCE_AUDIO_DEVICES_H_INCLUDED) && ! JUCE_AMALGAMATED_INCLUDE
  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. // Your project must contain an AppConfig.h file with your project-specific settings in it,
  26. // and your header search path must make it accessible to the module's files.
  27. #include "AppConfig.h"
  28. #include "../juce_core/native/juce_BasicNativeHeaders.h"
  29. #include "juce_audio_devices.h"
  30. //==============================================================================
  31. #if JUCE_MAC
  32. #define Point CarbonDummyPointName
  33. #define Component CarbonDummyCompName
  34. #import <CoreAudio/AudioHardware.h>
  35. #import <CoreMIDI/MIDIServices.h>
  36. #import <DiscRecording/DiscRecording.h>
  37. #import <AudioToolbox/AudioServices.h>
  38. #undef Point
  39. #undef Component
  40. #elif JUCE_IOS
  41. #import <AudioToolbox/AudioToolbox.h>
  42. #import <AVFoundation/AVFoundation.h>
  43. #import <CoreMIDI/MIDIServices.h>
  44. //==============================================================================
  45. #elif JUCE_WINDOWS
  46. #if JUCE_WASAPI
  47. #include <MMReg.h>
  48. #endif
  49. #if JUCE_ASIO
  50. /* This is very frustrating - we only need to use a handful of definitions from
  51. a couple of the header files in Steinberg's ASIO SDK, and it'd be easy to copy
  52. about 30 lines of code into this cpp file to create a fully stand-alone ASIO
  53. implementation...
  54. ..unfortunately that would break Steinberg's license agreement for use of
  55. their SDK, so I'm not allowed to do this.
  56. This means that anyone who wants to use JUCE's ASIO abilities will have to:
  57. 1) Agree to Steinberg's licensing terms and download the ASIO SDK
  58. (see www.steinberg.net/Steinberg/Developers.asp).
  59. 2) Enable this code with a global definition #define JUCE_ASIO 1.
  60. 3) Make sure that your header search path contains the iasiodrv.h file that
  61. comes with the SDK. (Only about a handful of the SDK header files are actually
  62. needed - so to simplify things, you could just copy these into your JUCE directory).
  63. */
  64. #include <iasiodrv.h>
  65. #endif
  66. #if JUCE_USE_CDBURNER
  67. /* You'll need the Platform SDK for these headers - if you don't have it and don't
  68. need to use CD-burning, then you might just want to set the JUCE_USE_CDBURNER flag
  69. to 0, to avoid these includes.
  70. */
  71. #include <imapi.h>
  72. #include <imapierror.h>
  73. #endif
  74. //==============================================================================
  75. #elif JUCE_LINUX
  76. #if JUCE_ALSA
  77. /* Got an include error here? If so, you've either not got ALSA installed, or you've
  78. not got your paths set up correctly to find its header files.
  79. The package you need to install to get ASLA support is "libasound2-dev".
  80. If you don't have the ALSA library and don't want to build Juce with audio support,
  81. just set the JUCE_ALSA flag to 0.
  82. */
  83. #include <alsa/asoundlib.h>
  84. #endif
  85. #if JUCE_JACK
  86. /* Got an include error here? If so, you've either not got jack-audio-connection-kit
  87. installed, or you've not got your paths set up correctly to find its header files.
  88. The package you need to install to get JACK support is "libjack-dev".
  89. If you don't have the jack-audio-connection-kit library and don't want to build
  90. Juce with low latency audio support, just set the JUCE_JACK flag to 0.
  91. */
  92. #include <jack/jack.h>
  93. #endif
  94. #undef SIZEOF
  95. //==============================================================================
  96. #elif JUCE_ANDROID
  97. #if JUCE_USE_ANDROID_OPENSLES
  98. #include <SLES/OpenSLES.h>
  99. #include <SLES/OpenSLES_Android.h>
  100. #include <SLES/OpenSLES_AndroidConfiguration.h>
  101. #endif
  102. #endif
  103. namespace juce
  104. {
  105. #include "audio_io/juce_AudioDeviceManager.cpp"
  106. #include "audio_io/juce_AudioIODevice.cpp"
  107. #include "audio_io/juce_AudioIODeviceType.cpp"
  108. #include "midi_io/juce_MidiMessageCollector.cpp"
  109. #include "midi_io/juce_MidiOutput.cpp"
  110. #include "audio_cd/juce_AudioCDReader.cpp"
  111. #include "sources/juce_AudioSourcePlayer.cpp"
  112. #include "sources/juce_AudioTransportSource.cpp"
  113. #include "native/juce_MidiDataConcatenator.h"
  114. //==============================================================================
  115. #if JUCE_MAC
  116. #include "../juce_core/native/juce_osx_ObjCHelpers.h"
  117. #include "native/juce_mac_CoreAudio.cpp"
  118. #include "native/juce_mac_CoreMidi.cpp"
  119. #if JUCE_USE_CDREADER
  120. #include "native/juce_mac_AudioCDReader.mm"
  121. #endif
  122. #if JUCE_USE_CDBURNER
  123. #include "native/juce_mac_AudioCDBurner.mm"
  124. #endif
  125. //==============================================================================
  126. #elif JUCE_IOS
  127. #include "native/juce_ios_Audio.cpp"
  128. #include "native/juce_mac_CoreMidi.cpp"
  129. //==============================================================================
  130. #elif JUCE_WINDOWS
  131. #include "../juce_core/native/juce_win32_ComSmartPtr.h"
  132. #include "../juce_events/native/juce_win32_HiddenMessageWindow.h"
  133. #if JUCE_WASAPI
  134. #include "native/juce_win32_WASAPI.cpp"
  135. #endif
  136. #if JUCE_DIRECTSOUND
  137. #include "native/juce_win32_DirectSound.cpp"
  138. #endif
  139. #include "native/juce_win32_Midi.cpp"
  140. #if JUCE_ASIO
  141. #include "native/juce_win32_ASIO.cpp"
  142. #endif
  143. #if JUCE_USE_CDREADER
  144. #include "native/juce_win32_AudioCDReader.cpp"
  145. #endif
  146. #if JUCE_USE_CDBURNER
  147. #include "native/juce_win32_AudioCDBurner.cpp"
  148. #endif
  149. //==============================================================================
  150. #elif JUCE_LINUX
  151. #if JUCE_ALSA
  152. #include "native/juce_linux_ALSA.cpp"
  153. #endif
  154. #include "native/juce_linux_Midi.cpp"
  155. #if JUCE_JACK
  156. #include "native/juce_linux_JackAudio.cpp"
  157. #endif
  158. #if JUCE_USE_CDREADER
  159. #include "native/juce_linux_AudioCDReader.cpp"
  160. #endif
  161. //==============================================================================
  162. #elif JUCE_ANDROID
  163. #include "../juce_core/native/juce_android_JNIHelpers.h"
  164. #include "native/juce_android_Audio.cpp"
  165. #include "native/juce_android_Midi.cpp"
  166. #if JUCE_USE_ANDROID_OPENSLES
  167. #include "native/juce_android_OpenSL.cpp"
  168. #endif
  169. #endif
  170. #if ! JUCE_SYSTEMAUDIOVOL_IMPLEMENTED
  171. // None of these methods are available. (On Windows you might need to enable WASAPI for this)
  172. float JUCE_CALLTYPE SystemAudioVolume::getGain() { jassertfalse; return 0.0f; }
  173. bool JUCE_CALLTYPE SystemAudioVolume::setGain (float) { jassertfalse; return false; }
  174. bool JUCE_CALLTYPE SystemAudioVolume::isMuted() { jassertfalse; return false; }
  175. bool JUCE_CALLTYPE SystemAudioVolume::setMuted (bool) { jassertfalse; return false; }
  176. #endif
  177. }