1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00
JUCE/modules/juce_audio_devices/juce_audio_devices.h
2025-12-01 10:21:13 +00:00

256 lines
9.6 KiB
C++

/*
==============================================================================
This file is part of the JUCE framework.
Copyright (c) Raw Material Software Limited
JUCE is an open source framework subject to commercial or open source
licensing.
By downloading, installing, or using the JUCE framework, or combining the
JUCE framework with any other source code, object code, content or any other
copyrightable work, you agree to the terms of the JUCE End User Licence
Agreement, and all incorporated terms including the JUCE Privacy Policy and
the JUCE Website Terms of Service, as applicable, which will bind you. If you
do not agree to the terms of these agreements, we will not license the JUCE
framework to you, and you must discontinue the installation or download
process and cease use of the JUCE framework.
JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/
JUCE Privacy Policy: https://juce.com/juce-privacy-policy
JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/
Or:
You may also use this code under the terms of the AGPLv3:
https://www.gnu.org/licenses/agpl-3.0.en.html
THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL
WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.
==============================================================================
*/
/*******************************************************************************
The block below describes the properties of this module, and is read by
the Projucer to automatically generate project code that uses it.
For details about the syntax and how to create or use a module, see the
JUCE Module Format.md file.
BEGIN_JUCE_MODULE_DECLARATION
ID: juce_audio_devices
vendor: juce
version: 8.0.11
name: JUCE audio and MIDI I/O device classes
description: Classes to play and record from audio and MIDI I/O devices
website: http://www.juce.com/juce
license: AGPLv3/Commercial
minimumCppStandard: 17
dependencies: juce_audio_basics, juce_events
OSXFrameworks: CoreAudio CoreMIDI AudioToolbox
iOSFrameworks: CoreAudio CoreMIDI AudioToolbox AVFoundation
linuxPackages: alsa
END_JUCE_MODULE_DECLARATION
*******************************************************************************/
#pragma once
#define JUCE_AUDIO_DEVICES_H_INCLUDED
#include <juce_events/juce_events.h>
#include <juce_audio_basics/juce_audio_basics.h>
#if JUCE_MODULE_AVAILABLE_juce_graphics
#include <juce_graphics/juce_graphics.h>
#endif
//==============================================================================
/** Config: JUCE_USE_WINRT_MIDI
Enables the use of the Windows Runtime API for MIDI, allowing connections
to Bluetooth Low Energy devices on Windows 10 version 1809 (October 2018
Update) and later. If you enable this flag then older versions of Windows
will automatically fall back to using the regular Win32 MIDI API.
You will need version 10.0.14393.0 of the Windows Standalone SDK to compile
and you may need to add the path to the WinRT headers. The path to the
headers will be something similar to
"C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\winrt".
*/
#ifndef JUCE_USE_WINRT_MIDI
#define JUCE_USE_WINRT_MIDI 0
#endif
/** Config: JUCE_USE_WINDOWS_MIDI_SERVICES
Enables the use of Windows MIDI Services, in turn enabling MIDI 2.0 support on
some Windows versions. At time of writing, this only works on the Canary insiders
build of Windows 11, but eventually this will work on the final release of
Windows 10 too.
In order to enable this functionality, your target and minimum Windows SDK
versions must be set to at least 10.0.20348.0.
This functionality depends on the CppWinRT tool and the Windows MIDI Services
NuGet package at build-time. If you're using the Projucer, this will be set up
for you automatically when this flag is enabled. If you're using CMake, you'll
need to pass "NEEDS_WINDOWS_MIDI_SERVICES TRUE" to your juce_add_<target> call.
Currently, the Windows MIDI Services NuGet package is not hosted in the official
repository. In order to allow NuGet and/or Visual Studio to find the package,
you'll need to set up a local repository pointing at a local folder holding the
package. You can do this from the Visual Studio package management UI.
Because this API is implemented using code generated by the CppWinRT tool, it
can only be built by compilers that understand the generated code. MSVC is
most likely to work; some versions of Clang may work but this is not guaranteed.
Even once the Windows MIDI Services are stable and enabled in Windows,
the service won't be usable until the service's SDK package is installed.
Therefore, you will need to ensure that the installer for your software also
installs this SDK package, or informs the user how to install the dependency.
If the SDK is not available, JUCE will fall back to using the older WinRT
API (if enabled) or the Win32 API otherwise. These APIs do not support MIDI 2.0.
*/
#ifndef JUCE_USE_WINDOWS_MIDI_SERVICES
#define JUCE_USE_WINDOWS_MIDI_SERVICES 0
#endif
/** Config: JUCE_ASIO
Enables ASIO audio devices (MS Windows only).
IMPORTANT: Turning this on will cause your program to depend on source files
from the ASIO SDK from Steinberg, so your resulting program must adhere to
the license terms of those files.
By default, this option will use the bundled ASIO headers distributed
alongside JUCE. See the documentation for JUCE_ASIO_USE_EXTERNAL_SDK to
learn how to use a different version of those headers.
*/
#ifndef JUCE_ASIO
#define JUCE_ASIO 0
#endif
/** Config: JUCE_ASIO_USE_EXTERNAL_SDK
The default behaviour of the JUCE_ASIO flag is to include a bundled header
from the ASIO SDK. If you need to supply your own version of this header,
instead of using the bundled one, you can enable this flag. If you do,
then you must also ensure that the file "iasiodrv.h" from the SDK can be
located via your project's header include paths.
The option only has an effect when JUCE_ASIO is also enabled.
*/
#ifndef JUCE_ASIO_USE_EXTERNAL_SDK
#define JUCE_ASIO_USE_EXTERNAL_SDK 0
#endif
/** Config: JUCE_WASAPI
Enables WASAPI audio devices (Windows Vista and above).
*/
#ifndef JUCE_WASAPI
#define JUCE_WASAPI 1
#endif
/** Config: JUCE_DIRECTSOUND
Enables DirectSound audio (MS Windows only).
*/
#ifndef JUCE_DIRECTSOUND
#define JUCE_DIRECTSOUND 1
#endif
/** Config: JUCE_ALSA
Enables ALSA audio devices (Linux only).
*/
#ifndef JUCE_ALSA
#define JUCE_ALSA 1
#endif
/** Config: JUCE_JACK
Enables JACK audio devices.
*/
#ifndef JUCE_JACK
#define JUCE_JACK 0
#endif
/** Config: JUCE_USE_ANDROID_OBOE
Enables Oboe devices (Android only).
*/
#ifndef JUCE_USE_ANDROID_OBOE
#define JUCE_USE_ANDROID_OBOE 1
#endif
/** Config: JUCE_USE_OBOE_STABILIZED_CALLBACK
If JUCE_USE_ANDROID_OBOE is enabled, enabling this will wrap output audio
streams in the oboe::StabilizedCallback class. This class attempts to keep
the CPU spinning to avoid it being scaled down on certain devices.
(Android only).
*/
#ifndef JUCE_USE_ANDROID_OBOE_STABILIZED_CALLBACK
#define JUCE_USE_ANDROID_OBOE_STABILIZED_CALLBACK 0
#endif
/** Config: JUCE_USE_ANDROID_OPENSLES
Enables OpenSLES devices (Android only).
*/
#ifndef JUCE_USE_ANDROID_OPENSLES
#if ! JUCE_USE_ANDROID_OBOE
#define JUCE_USE_ANDROID_OPENSLES 1
#else
#define JUCE_USE_ANDROID_OPENSLES 0
#endif
#endif
/** Config: JUCE_DISABLE_AUDIO_MIXING_WITH_OTHER_APPS
Turning this on gives your app exclusive access to the system's audio
on platforms which support it (currently iOS only).
*/
#ifndef JUCE_DISABLE_AUDIO_MIXING_WITH_OTHER_APPS
#define JUCE_DISABLE_AUDIO_MIXING_WITH_OTHER_APPS 0
#endif
//==============================================================================
#include "midi_io/juce_ScheduledEventThread.h"
#include "midi_io/ump/juce_UMPEndpointId.h"
#include "midi_io/ump/juce_UMPStaticDeviceInfo.h"
#include "midi_io/ump/juce_UMPBlock.h"
#include "midi_io/ump/juce_UMPEndpoint.h"
#include "midi_io/ump/juce_UMPDisconnectionListener.h"
#include "midi_io/ump/juce_UMPInput.h"
#include "midi_io/ump/juce_UMPOutput.h"
#include "midi_io/ump/juce_UMPLegacyVirtualInput.h"
#include "midi_io/ump/juce_UMPLegacyVirtualOutput.h"
#include "midi_io/ump/juce_UMPVirtualEndpoint.h"
#include "midi_io/ump/juce_UMPSession.h"
#include "midi_io/ump/juce_UMPEndpoints.h"
#include "midi_io/juce_MidiDevices.h"
#include "midi_io/juce_MidiMessageCollector.h"
namespace juce
{
/** Available modes for the WASAPI audio device.
Pass one of these to the AudioIODeviceType::createAudioIODeviceType_WASAPI()
method to create a WASAPI AudioIODeviceType object in this mode.
*/
enum class WASAPIDeviceMode
{
shared,
exclusive,
sharedLowLatency
};
}
#include "audio_io/juce_AudioIODevice.h"
#include "audio_io/juce_AudioIODeviceType.h"
#include "audio_io/juce_SystemAudioVolume.h"
#include "sources/juce_AudioSourcePlayer.h"
#include "sources/juce_AudioTransportSource.h"
#include "audio_io/juce_AudioDeviceManager.h"
#if JUCE_IOS
#include "native/juce_Audio_ios.h"
#endif