OpenShot Audio Library | OpenShotAudio  0.3.2
juce_audio_devices.cpp
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2017 - ROLI Ltd.
6 
7  JUCE is an open source library subject to commercial or open-source
8  licensing.
9 
10  The code included in this file is provided under the terms of the ISC license
11  http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12  To use, copy, modify, and/or distribute this software for any purpose with or
13  without fee is hereby granted provided that the above copyright notice and
14  this permission notice appear in all copies.
15 
16  JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17  EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18  DISCLAIMED.
19 
20  ==============================================================================
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 
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 
38 #ifndef JUCE_USE_WINRT_MIDI
39  #define JUCE_USE_WINRT_MIDI 0
40 #endif
41 
42 #if JUCE_USE_WINRT_MIDI
43  #define JUCE_EVENTS_INCLUDE_WINRT_WRAPPER 1
44 #endif
45 
46 #include "juce_audio_devices.h"
47 
48 //==============================================================================
49 #if JUCE_MAC
50  #define Point CarbonDummyPointName
51  #define Component CarbonDummyCompName
52  #import <CoreAudio/AudioHardware.h>
53  #import <CoreMIDI/MIDIServices.h>
54  #import <AudioToolbox/AudioServices.h>
55  #undef Point
56  #undef Component
57 
58 #elif JUCE_IOS
59  #import <AudioToolbox/AudioToolbox.h>
60  #import <AVFoundation/AVFoundation.h>
61  #import <CoreMIDI/MIDIServices.h>
62 
63  #if TARGET_OS_SIMULATOR
64  #import <CoreMIDI/MIDINetworkSession.h>
65  #endif
66 
67 //==============================================================================
68 #elif JUCE_WINDOWS
69  #if JUCE_WASAPI
70  #include <mmreg.h>
71  #endif
72 
73  #if JUCE_USE_WINRT_MIDI && JUCE_MSVC
74  /* If you cannot find any of the header files below then you are probably
75  attempting to use the Windows 10 Bluetooth Low Energy API. For this to work you
76  need to install version 10.0.14393.0 of the Windows Standalone SDK and you may
77  need to add the path to the WinRT headers to your build system. This path should
78  have the form "C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\winrt".
79 
80  Also please note that Microsoft's Bluetooth MIDI stack has multiple issues, so
81  this API is EXPERIMENTAL - use at your own risk!
82  */
83  #include <windows.devices.h>
84  #include <windows.devices.midi.h>
85  #include <windows.devices.enumeration.h>
86 
87  #pragma warning (push)
88  #pragma warning (disable: 4265)
89  #include <wrl/event.h>
90  #pragma warning (pop)
91 
92  #pragma warning (push)
93  #pragma warning (disable: 4467)
94  #include <robuffer.h>
95  #pragma warning (pop)
96  #endif
97 
98  #if JUCE_ASIO
99  /* This is very frustrating - we only need to use a handful of definitions from
100  a couple of the header files in Steinberg's ASIO SDK, and it'd be easy to copy
101  about 30 lines of code into this cpp file to create a fully stand-alone ASIO
102  implementation...
103 
104  ..unfortunately that would break Steinberg's license agreement for use of
105  their SDK, so I'm not allowed to do this.
106 
107  This means that anyone who wants to use JUCE's ASIO abilities will have to:
108 
109  1) Agree to Steinberg's licensing terms and download the ASIO SDK
110  (see http://www.steinberg.net/en/company/developers.html).
111 
112  2) Enable this code with a global definition #define JUCE_ASIO 1.
113 
114  3) Make sure that your header search path contains the iasiodrv.h file that
115  comes with the SDK. (Only about a handful of the SDK header files are actually
116  needed - so to simplify things, you could just copy these into your JUCE directory).
117  */
118  #include <iasiodrv.h>
119  #endif
120 
121 //==============================================================================
122 #elif JUCE_LINUX
123  #if JUCE_ALSA
124  /* Got an include error here? If so, you've either not got ALSA installed, or you've
125  not got your paths set up correctly to find its header files.
126 
127  The package you need to install to get ASLA support is "libasound2-dev".
128 
129  If you don't have the ALSA library and don't want to build JUCE with audio support,
130  just set the JUCE_ALSA flag to 0.
131  */
132  #include <alsa/asoundlib.h>
133  #endif
134 
135  #if JUCE_JACK
136  /* Got an include error here? If so, you've either not got jack-audio-connection-kit
137  installed, or you've not got your paths set up correctly to find its header files.
138 
139  The package you need to install to get JACK support is "libjack-dev".
140 
141  If you don't have the jack-audio-connection-kit library and don't want to build
142  JUCE with low latency audio support, just set the JUCE_JACK flag to 0.
143  */
144  #include <jack/jack.h>
145  #endif
146 
147  #if JUCE_BELA
148  /* Got an include error here? If so, you've either not got the bela headers
149  installed, or you've not got your paths set up correctly to find its header
150  files.
151  */
152  #include <Bela.h>
153  #include <Midi.h>
154  #endif
155 
156  #undef SIZEOF
157 
158 //==============================================================================
159 #elif JUCE_ANDROID
160 
161  #if JUCE_USE_ANDROID_OPENSLES
162  #include <SLES/OpenSLES.h>
163  #include <SLES/OpenSLES_Android.h>
164  #include <SLES/OpenSLES_AndroidConfiguration.h>
165  #endif
166 
167  #if JUCE_USE_ANDROID_OBOE
168  #if JUCE_USE_ANDROID_OPENSLES
169  #error "Oboe cannot be enabled at the same time as openSL! Please disable JUCE_USE_ANDROID_OPENSLES"
170  #endif
171 
172  #include <oboe/Oboe.h>
173  #endif
174 
175 #endif
176 
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"
184 #include "native/juce_MidiDataConcatenator.h"
185 
186 //==============================================================================
187 #if JUCE_MAC
188  #include "native/juce_mac_CoreAudio.cpp"
189  #include "native/juce_mac_CoreMidi.cpp"
190 
191 //==============================================================================
192 #elif JUCE_IOS
193  #include "native/juce_ios_Audio.cpp"
194  #include "native/juce_mac_CoreMidi.cpp"
195 
196 //==============================================================================
197 #elif JUCE_WINDOWS
198 
199  #if JUCE_WASAPI
200  #include "native/juce_win32_WASAPI.cpp"
201  #endif
202 
203  #if JUCE_DIRECTSOUND
204  #include "native/juce_win32_DirectSound.cpp"
205  #endif
206 
207  #include "native/juce_win32_Midi.cpp"
208 
209  #if JUCE_ASIO
210  #include "native/juce_win32_ASIO.cpp"
211  #endif
212 
213 //==============================================================================
214 #elif JUCE_LINUX
215  #if JUCE_ALSA
216  #include "native/juce_linux_ALSA.cpp"
217  #endif
218 
219  #if JUCE_JACK
220  #include "native/juce_linux_JackAudio.cpp"
221  #endif
222 
223  #if JUCE_BELA
224  #include "native/juce_linux_Bela.cpp"
225  #else
226  #include "native/juce_linux_Midi.cpp"
227  #endif
228 
229 //==============================================================================
230 #elif JUCE_ANDROID
231  #include "native/juce_android_Audio.cpp"
232  #include "native/juce_android_Midi.cpp"
233 
234  #if JUCE_USE_ANDROID_OPENSLES
235  #include "native/juce_android_OpenSL.cpp"
236  #endif
237 
238  #if JUCE_USE_ANDROID_OBOE
239  #include "native/juce_android_Oboe.cpp"
240  #endif
241 #endif
242 
243 #if ! JUCE_SYSTEMAUDIOVOL_IMPLEMENTED
244 namespace juce
245 {
246  // None of these methods are available. (On Windows you might need to enable WASAPI for this)
247  float JUCE_CALLTYPE SystemAudioVolume::getGain() { jassertfalse; return 0.0f; }
248  bool JUCE_CALLTYPE SystemAudioVolume::setGain (float) { jassertfalse; return false; }
249  bool JUCE_CALLTYPE SystemAudioVolume::isMuted() { jassertfalse; return false; }
250  bool JUCE_CALLTYPE SystemAudioVolume::setMuted (bool) { jassertfalse; return false; }
251 }
252 #endif
static bool JUCE_CALLTYPE setMuted(bool shouldBeMuted)
static float JUCE_CALLTYPE getGain()
static bool JUCE_CALLTYPE isMuted()
static bool JUCE_CALLTYPE setGain(float newGain)