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.4KB

9 years ago
8 years ago
9 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI 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. #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. #include "juce_audio_devices.h"
  31. //==============================================================================
  32. #if JUCE_MAC
  33. #define Point CarbonDummyPointName
  34. #define Component CarbonDummyCompName
  35. #import <CoreAudio/AudioHardware.h>
  36. #import <CoreMIDI/MIDIServices.h>
  37. #import <DiscRecording/DiscRecording.h>
  38. #import <AudioToolbox/AudioServices.h>
  39. #undef Point
  40. #undef Component
  41. #elif JUCE_IOS
  42. #import <AudioToolbox/AudioToolbox.h>
  43. #import <AVFoundation/AVFoundation.h>
  44. #import <CoreMIDI/MIDIServices.h>
  45. //==============================================================================
  46. #elif JUCE_WINDOWS
  47. #if JUCE_WASAPI
  48. #include <MMReg.h>
  49. #endif
  50. #if JUCE_ASIO
  51. /* This is very frustrating - we only need to use a handful of definitions from
  52. a couple of the header files in Steinberg's ASIO SDK, and it'd be easy to copy
  53. about 30 lines of code into this cpp file to create a fully stand-alone ASIO
  54. implementation...
  55. ..unfortunately that would break Steinberg's license agreement for use of
  56. their SDK, so I'm not allowed to do this.
  57. This means that anyone who wants to use JUCE's ASIO abilities will have to:
  58. 1) Agree to Steinberg's licensing terms and download the ASIO SDK
  59. (see http://www.steinberg.net/en/company/developers.html).
  60. 2) Enable this code with a global definition #define JUCE_ASIO 1.
  61. 3) Make sure that your header search path contains the iasiodrv.h file that
  62. comes with the SDK. (Only about a handful of the SDK header files are actually
  63. needed - so to simplify things, you could just copy these into your JUCE directory).
  64. */
  65. #include <iasiodrv.h>
  66. #endif
  67. #if JUCE_USE_CDBURNER
  68. /* You'll need the Platform SDK for these headers - if you don't have it and don't
  69. need to use CD-burning, then you might just want to set the JUCE_USE_CDBURNER flag
  70. to 0, to avoid these includes.
  71. */
  72. #include <imapi.h>
  73. #include <imapierror.h>
  74. #endif
  75. //==============================================================================
  76. #elif JUCE_LINUX
  77. #if JUCE_ALSA
  78. /* Got an include error here? If so, you've either not got ALSA installed, or you've
  79. not got your paths set up correctly to find its header files.
  80. The package you need to install to get ASLA support is "libasound2-dev".
  81. If you don't have the ALSA library and don't want to build Juce with audio support,
  82. just set the JUCE_ALSA flag to 0.
  83. */
  84. #include <alsa/asoundlib.h>
  85. #endif
  86. #if JUCE_JACK
  87. /* Got an include error here? If so, you've either not got jack-audio-connection-kit
  88. installed, or you've not got your paths set up correctly to find its header files.
  89. The package you need to install to get JACK support is "libjack-dev".
  90. If you don't have the jack-audio-connection-kit library and don't want to build
  91. Juce with low latency audio support, just set the JUCE_JACK flag to 0.
  92. */
  93. #include <jack/jack.h>
  94. #endif
  95. #undef SIZEOF
  96. //==============================================================================
  97. #elif JUCE_ANDROID
  98. #if JUCE_USE_ANDROID_OPENSLES
  99. #include <SLES/OpenSLES.h>
  100. #include <SLES/OpenSLES_Android.h>
  101. #include <SLES/OpenSLES_AndroidConfiguration.h>
  102. #endif
  103. #endif
  104. namespace juce
  105. {
  106. #include "audio_io/juce_AudioDeviceManager.cpp"
  107. #include "audio_io/juce_AudioIODevice.cpp"
  108. #include "audio_io/juce_AudioIODeviceType.cpp"
  109. #include "midi_io/juce_MidiMessageCollector.cpp"
  110. #include "midi_io/juce_MidiOutput.cpp"
  111. #include "audio_cd/juce_AudioCDReader.cpp"
  112. #include "sources/juce_AudioSourcePlayer.cpp"
  113. #include "sources/juce_AudioTransportSource.cpp"
  114. #include "native/juce_MidiDataConcatenator.h"
  115. //==============================================================================
  116. #if JUCE_MAC
  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. #if JUCE_WASAPI
  132. #include "native/juce_win32_WASAPI.cpp"
  133. #endif
  134. #if JUCE_DIRECTSOUND
  135. #include "native/juce_win32_DirectSound.cpp"
  136. #endif
  137. #include "native/juce_win32_Midi.cpp"
  138. #if JUCE_ASIO
  139. #include "native/juce_win32_ASIO.cpp"
  140. #endif
  141. #if JUCE_USE_CDREADER
  142. #include "native/juce_win32_AudioCDReader.cpp"
  143. #endif
  144. #if JUCE_USE_CDBURNER
  145. #include "native/juce_win32_AudioCDBurner.cpp"
  146. #endif
  147. //==============================================================================
  148. #elif JUCE_LINUX
  149. #if JUCE_ALSA
  150. #include "native/juce_linux_ALSA.cpp"
  151. #endif
  152. #include "native/juce_linux_Midi.cpp"
  153. #if JUCE_JACK
  154. #include "native/juce_linux_JackAudio.cpp"
  155. #endif
  156. #if JUCE_USE_CDREADER
  157. #include "native/juce_linux_AudioCDReader.cpp"
  158. #endif
  159. //==============================================================================
  160. #elif JUCE_ANDROID
  161. #include "native/juce_android_Audio.cpp"
  162. #include "native/juce_android_Midi.cpp"
  163. #if JUCE_USE_ANDROID_OPENSLES
  164. #include "native/juce_android_OpenSL.cpp"
  165. #endif
  166. #endif
  167. #if ! JUCE_SYSTEMAUDIOVOL_IMPLEMENTED
  168. // None of these methods are available. (On Windows you might need to enable WASAPI for this)
  169. float JUCE_CALLTYPE SystemAudioVolume::getGain() { jassertfalse; return 0.0f; }
  170. bool JUCE_CALLTYPE SystemAudioVolume::setGain (float) { jassertfalse; return false; }
  171. bool JUCE_CALLTYPE SystemAudioVolume::isMuted() { jassertfalse; return false; }
  172. bool JUCE_CALLTYPE SystemAudioVolume::setMuted (bool) { jassertfalse; return false; }
  173. #endif
  174. }