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

8 years ago
9 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. #include "AppConfig.h"
  32. #define JUCE_CORE_INCLUDE_OBJC_HELPERS 1
  33. #define JUCE_CORE_INCLUDE_COM_SMART_PTR 1
  34. #define JUCE_CORE_INCLUDE_JNI_HELPERS 1
  35. #define JUCE_CORE_INCLUDE_NATIVE_HEADERS 1
  36. #define JUCE_EVENTS_INCLUDE_WIN32_MESSAGE_WINDOW 1
  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_ASIO
  60. /* This is very frustrating - we only need to use a handful of definitions from
  61. a couple of the header files in Steinberg's ASIO SDK, and it'd be easy to copy
  62. about 30 lines of code into this cpp file to create a fully stand-alone ASIO
  63. implementation...
  64. ..unfortunately that would break Steinberg's license agreement for use of
  65. their SDK, so I'm not allowed to do this.
  66. This means that anyone who wants to use JUCE's ASIO abilities will have to:
  67. 1) Agree to Steinberg's licensing terms and download the ASIO SDK
  68. (see http://www.steinberg.net/en/company/developers.html).
  69. 2) Enable this code with a global definition #define JUCE_ASIO 1.
  70. 3) Make sure that your header search path contains the iasiodrv.h file that
  71. comes with the SDK. (Only about a handful of the SDK header files are actually
  72. needed - so to simplify things, you could just copy these into your JUCE directory).
  73. */
  74. #include <iasiodrv.h>
  75. #endif
  76. //==============================================================================
  77. #elif JUCE_LINUX
  78. #if JUCE_ALSA
  79. /* Got an include error here? If so, you've either not got ALSA installed, or you've
  80. not got your paths set up correctly to find its header files.
  81. The package you need to install to get ASLA support is "libasound2-dev".
  82. If you don't have the ALSA library and don't want to build Juce with audio support,
  83. just set the JUCE_ALSA flag to 0.
  84. */
  85. #include <alsa/asoundlib.h>
  86. #endif
  87. #if JUCE_JACK
  88. /* Got an include error here? If so, you've either not got jack-audio-connection-kit
  89. installed, or you've not got your paths set up correctly to find its header files.
  90. The package you need to install to get JACK support is "libjack-dev".
  91. If you don't have the jack-audio-connection-kit library and don't want to build
  92. Juce with low latency audio support, just set the JUCE_JACK flag to 0.
  93. */
  94. #include <jack/jack.h>
  95. #endif
  96. #undef SIZEOF
  97. //==============================================================================
  98. #elif JUCE_ANDROID
  99. #if JUCE_USE_ANDROID_OPENSLES
  100. #include <SLES/OpenSLES.h>
  101. #include <SLES/OpenSLES_Android.h>
  102. #include <SLES/OpenSLES_AndroidConfiguration.h>
  103. #endif
  104. #endif
  105. namespace juce
  106. {
  107. #include "audio_io/juce_AudioDeviceManager.cpp"
  108. #include "audio_io/juce_AudioIODevice.cpp"
  109. #include "audio_io/juce_AudioIODeviceType.cpp"
  110. #include "midi_io/juce_MidiMessageCollector.cpp"
  111. #include "midi_io/juce_MidiOutput.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. //==============================================================================
  120. #elif JUCE_IOS
  121. #include "native/juce_ios_Audio.cpp"
  122. #include "native/juce_mac_CoreMidi.cpp"
  123. //==============================================================================
  124. #elif JUCE_WINDOWS
  125. #if JUCE_WASAPI
  126. #include "native/juce_win32_WASAPI.cpp"
  127. #endif
  128. #if JUCE_DIRECTSOUND
  129. #include "native/juce_win32_DirectSound.cpp"
  130. #endif
  131. #include "native/juce_win32_Midi.cpp"
  132. #if JUCE_ASIO
  133. #include "native/juce_win32_ASIO.cpp"
  134. #endif
  135. //==============================================================================
  136. #elif JUCE_LINUX
  137. #if JUCE_ALSA
  138. #include "native/juce_linux_ALSA.cpp"
  139. #endif
  140. #include "native/juce_linux_Midi.cpp"
  141. #if JUCE_JACK
  142. #include "native/juce_linux_JackAudio.cpp"
  143. #endif
  144. //==============================================================================
  145. #elif JUCE_ANDROID
  146. #include "native/juce_android_Audio.cpp"
  147. #include "native/juce_android_Midi.cpp"
  148. #if JUCE_USE_ANDROID_OPENSLES
  149. #include "native/juce_android_OpenSL.cpp"
  150. #endif
  151. #endif
  152. #if ! JUCE_SYSTEMAUDIOVOL_IMPLEMENTED
  153. // None of these methods are available. (On Windows you might need to enable WASAPI for this)
  154. float JUCE_CALLTYPE SystemAudioVolume::getGain() { jassertfalse; return 0.0f; }
  155. bool JUCE_CALLTYPE SystemAudioVolume::setGain (float) { jassertfalse; return false; }
  156. bool JUCE_CALLTYPE SystemAudioVolume::isMuted() { jassertfalse; return false; }
  157. bool JUCE_CALLTYPE SystemAudioVolume::setMuted (bool) { jassertfalse; return false; }
  158. #endif
  159. }