OpenShot Audio Library | OpenShotAudio 0.4.0

Loading...
Searching...
No Matches
juce_AudioIODeviceType.cpp
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
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 namespace juce
24{
25
26AudioIODeviceType::AudioIODeviceType (const String& name)
27 : typeName (name)
28{
29}
30
31AudioIODeviceType::~AudioIODeviceType()
32{
33}
34
35//==============================================================================
36 void AudioIODeviceType::addListener (Listener* l) { listeners.add (l); }
37 void AudioIODeviceType::removeListener (Listener* l) { listeners.remove (l); }
38
39 void AudioIODeviceType::callDeviceChangeListeners()
40{
41 listeners.call ([] (Listener& l) { l.audioDeviceListChanged(); });
42}
43
44//==============================================================================
45#if JUCE_MAC
46 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_CoreAudio() { return new CoreAudioClasses::CoreAudioIODeviceType(); }
47#else
48 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_CoreAudio() { return nullptr; }
49#endif
50
51#if JUCE_IOS
52 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_iOSAudio() { return new iOSAudioIODeviceType(); }
53#else
54 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_iOSAudio() { return nullptr; }
55#endif
56
57#if JUCE_WINDOWS && JUCE_WASAPI
58 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_WASAPI (WASAPIDeviceMode deviceMode)
59 {
60 auto windowsVersion = SystemStats::getOperatingSystemType();
61
62 if (windowsVersion < SystemStats::WinVista
63 || (WasapiClasses::isLowLatencyMode (deviceMode) && windowsVersion < SystemStats::Windows10))
64 return nullptr;
65
66 return new WasapiClasses::WASAPIAudioIODeviceType (deviceMode);
67 }
68
69 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_WASAPI (bool exclusiveMode)
70 {
71 return createAudioIODeviceType_WASAPI (exclusiveMode ? WASAPIDeviceMode::exclusive
72 : WASAPIDeviceMode::shared);
73 }
74#else
75 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_WASAPI (WASAPIDeviceMode) { return nullptr; }
76 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_WASAPI (bool) { return nullptr; }
77#endif
78
79#if JUCE_WINDOWS && JUCE_DIRECTSOUND
80 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_DirectSound() { return new DSoundAudioIODeviceType(); }
81#else
82 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_DirectSound() { return nullptr; }
83#endif
84
85#if JUCE_WINDOWS && JUCE_ASIO
86 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_ASIO() { return new ASIOAudioIODeviceType(); }
87#else
88 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_ASIO() { return nullptr; }
89#endif
90
91#if (JUCE_LINUX || JUCE_BSD) && JUCE_ALSA
92 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_ALSA() { return createAudioIODeviceType_ALSA_PCMDevices(); }
93#else
94 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_ALSA() { return nullptr; }
95#endif
96
97#if (JUCE_LINUX || JUCE_BSD) && JUCE_JACK
98 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_JACK() { return new JackAudioIODeviceType(); }
99#else
100 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_JACK() { return nullptr; }
101#endif
102
103#if JUCE_LINUX && JUCE_BELA
104 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_Bela() { return new BelaAudioIODeviceType(); }
105#else
106 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_Bela() { return nullptr; }
107#endif
108
109#if JUCE_ANDROID
110 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_Android()
111 {
112 #if JUCE_USE_ANDROID_OBOE
113 if (isOboeAvailable())
114 return nullptr;
115 #endif
116
117 #if JUCE_USE_ANDROID_OPENSLES
118 if (isOpenSLAvailable())
119 return nullptr;
120 #endif
121
122 return new AndroidAudioIODeviceType();
123 }
124#else
125 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_Android() { return nullptr; }
126#endif
127
128#if JUCE_ANDROID && JUCE_USE_ANDROID_OPENSLES
129 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_OpenSLES()
130 {
131 return isOpenSLAvailable() ? new OpenSLAudioDeviceType() : nullptr;
132 }
133#else
134 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_OpenSLES() { return nullptr; }
135#endif
136
137#if JUCE_ANDROID && JUCE_USE_ANDROID_OBOE
138 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_Oboe()
139 {
140 return isOboeAvailable() ? new OboeAudioIODeviceType() : nullptr;
141 }
142#else
143 AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_Oboe() { return nullptr; }
144#endif
145
146} // namespace juce
juce::AudioIODeviceType::Listener
Definition juce_AudioIODeviceType.h:126
juce::AudioIODeviceType::Listener::audioDeviceListChanged
virtual void audioDeviceListChanged()=0
juce::AudioIODeviceType
Definition juce_AudioIODeviceType.h:62