Version

menu_open
Target Platform(s):
Wwise SDK 2024.1.0
AkWinSoundEngine.h
Go to the documentation of this file.
1 /*******************************************************************************
2 The content of this file includes portions of the AUDIOKINETIC Wwise Technology
3 released in source code form as part of the SDK installer package.
4 
5 Commercial License Usage
6 
7 Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
8 may use this file in accordance with the end user license agreement provided
9 with the software or, alternatively, in accordance with the terms contained in a
10 written agreement between you and Audiokinetic Inc.
11 
12 Apache License Usage
13 
14 Alternatively, this file may be used under the Apache License, Version 2.0 (the
15 "Apache License"); you may not use this file except in compliance with the
16 Apache License. You may obtain a copy of the Apache License at
17 http://www.apache.org/licenses/LICENSE-2.0.
18 
19 Unless required by applicable law or agreed to in writing, software distributed
20 under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
21 OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
22 the specific language governing permissions and limitations under the License.
23 
24  Copyright (c) 2024 Audiokinetic Inc.
25 *******************************************************************************/
26 
27 // AkWinSoundEngine.h
28 
29 /// \file
30 /// Main Sound Engine interface, specific WIN32.
31 
32 #ifndef _AK_WIN_SOUND_ENGINE_H_
33 #define _AK_WIN_SOUND_ENGINE_H_
34 
37 
38 /// Platform specific initialization settings
39 /// \sa AK::SoundEngine::Init
40 /// \sa AK::SoundEngine::GetDefaultPlatformInitSettings
41 
43 {
44  // Threading configuration
45  AkThreadProperties threadLEngine; ///< Lower engine threading properties
46  AkThreadProperties threadOutputMgr; ///< Ouput thread threading properties
47  AkThreadProperties threadBankManager; ///< Bank manager threading properties (its default priority is AK_THREAD_PRIORITY_NORMAL)
48  AkThreadProperties threadMonitor; ///< Monitor threading properties (its default priority is AK_THREAD_PRIORITY_ABOVENORMAL). This parameter is not used in Release build.
49 
50  // Audio render configuration
51  AkUInt16 uNumRefillsInVoice; ///< Number of refill buffers in voice buffer. 2 == double-buffered, defaults to 4.
52 
53  AkUInt32 uSampleRate; ///< Sampling Rate. Default is 48000 Hz. Use 24000hz for low quality. Any positive reasonable sample rate is supported. However be careful setting a custom value. Using an odd or really low sample rate may result in malfunctionning sound engine.
54 
55  bool bEnableAvxSupport; ///< Enables run-time detection of AVX and AVX2 SIMD support in the engine and plug-ins.
56 
57  AkUInt32 uMaxSystemAudioObjects; ///< Dictates how many Microsoft Spatial Sound dynamic objects will be reserved by the System sink. On Windows, other running processes will be prevented from reserving these objects. Set to 0 to disable the use of System Audio Objects. Default is 128.
58 };
59 
60 struct IMMDevice;
61 
62 namespace AK
63 {
64  /// Finds the device ID for particular Audio Endpoint.
65  /// \note CoInitialize must have been called for the calling thread. See Microsoft's documentation about CoInitialize for more details.
66  /// \return A device ID to use with AkPlatformInitSettings.idAudioDevice
67  AK_EXTERNAPIFUNC( AkUInt32, GetDeviceID ) (IMMDevice* in_pDevice);
68 
69  /// Finds an audio endpoint that matches the token in the device name or device ID and returns an ID.
70  /// This is a helper function that searches in the device ID (as returned by IMMDevice->GetId) and
71  /// in the property PKEY_Device_FriendlyName. The token parameter is case-sensitive. If you need to do matching on different conditions, use IMMDeviceEnumerator directly and AK::GetDeviceID.
72  /// \return The device ID as returned by IMMDevice->GetId, hashed by AK::SoundEngine::GetIDFromName()
73  AK_EXTERNAPIFUNC( AkUInt32, GetDeviceIDFromName )(wchar_t* in_szToken);
74 
75  /// Get the user-friendly name for the specified device. Call repeatedly with index starting at 0 and increasing to get all available devices, including disabled and unplugged devices, until the returned string is null and out_uDeviceID is AK_INVALID_DEVICE_ID.
76  /// The number of indexable devices for the given uDeviceStateMask can be fetched by calling AK::SoundEngine::GetWindowsDeviceCount().
77  /// You can also get the default device information by specifying index=-1. The default device is the one with a green checkmark in the Audio Playback Device panel in Windows.
78  /// The returned out_uDeviceID parameter is the Device ID to use with Wwise. Use it to specify the main device in AkPlatformInitSettings.idAudioDevice.
79  /// \return The name of the device at the "index" specified. The pointer is valid until the next call to GetWindowsDeviceName.
81  AkInt32 index, ///< Index of the device in the array. -1 to get information on the default device.
82  AkUInt32 &out_uDeviceID, ///< Device ID for Wwise. This is the same as what is returned from AK::GetDeviceID and AK::GetDeviceIDFromName. Use it to specify the main device in AkPlatformInitSettings.idAudioDevice.
83  AkAudioDeviceState uDeviceStateMask = AkDeviceState_All ///< Optional bitmask used to filter the device based on their state.
84  );
85 
86  /// Get the number of Audio Endpoints available for the specified device state mask.
87  /// \return The number of Audio Endpoints available for the specified device state mask.
89  AkAudioDeviceState uDeviceStateMask = AkDeviceState_All ///< Optional bitmask used to filter the device based on their state.
90  );
91 
92  /// Get the Audio Endpoint for the specified device index. Call repeatedly with index starting at 0 and increasing to get all available devices, including disabled and unplugged devices, until the false is returned.
93  /// You can also get the default device information by specifying index=-1. The default device is the one with a green checkmark in the Audio Playback Device panel in Windows.
94  /// The returned out_uDeviceID parameter is the Device ID to use with Wwise. Use it to specify the main device in AkPlatformInitSettings.idAudioDevice.
95  /// The returned out_ppDevice is a pointer to a pointer variable to which the method writes the address of the IMMDevice. out_ppDevice is optional; if it is null, then no action is taken.
96  /// If the method returns false, *out_ppDevice is null and out_uDeviceID is AK_INVALID_DEVICE_ID. If the method successed, *out_ppDevice will be a counted reference to the interface, and the caller is responsible for releasing the interface when it is no longer needed, by calling Release(), or encapsulating the device in a COM Smart Pointer.
97  /// \return Whether or not a device was found at the given index.
99  AkInt32 in_index, ///< Index of the device in the array. -1 to get information on the default device.
100  AkUInt32& out_uDeviceID, ///< Device ID for Wwise. This is the same as what is returned from AK::GetDeviceID and AK::GetDeviceIDFromName. Use it to specify the main device in AkPlatformInitSettings.idAudioDevice.
101  IMMDevice** out_ppDevice, ///< pointer to a pointer variable to which the method writes the address of the IMMDevice in question.
102  AkAudioDeviceState uDeviceStateMask = AkDeviceState_All ///< Optional bitmask used to filter the device based on their state.
103  );
104 
105 };
106 
107 #endif //_AK_WIN_SOUND_ENGINE_H_
uint16_t AkUInt16
Unsigned 16-bit integer.
Definition of data structures for AkAudioObject.
AkUInt32 uMaxSystemAudioObjects
Dictates how many Microsoft Spatial Sound dynamic objects will be reserved by the System sink....
#define AK_EXTERNAPIFUNC(_type, _name)
AKSOUNDENGINE_API AkUInt32 GetDeviceID(IMMDevice *in_pDevice)
@ AkDeviceState_All
Includes audio devices in all states.
Definition: AkTypes.h:240
AKSOUNDENGINE_API bool GetWindowsDevice(AkInt32 in_index, AkUInt32 &out_uDeviceID, IMMDevice **out_ppDevice, AkAudioDeviceState uDeviceStateMask=AkDeviceState_All)
AkThreadProperties threadMonitor
Monitor threading properties (its default priority is AK_THREAD_PRIORITY_ABOVENORMAL)....
AkThreadProperties threadLEngine
Lower engine threading properties.
int32_t AkInt32
Signed 32-bit integer.
AkUInt16 uNumRefillsInVoice
Number of refill buffers in voice buffer. Defaults to 4.
AkThreadProperties threadOutputMgr
Ouput thread threading properties.
AKSOUNDENGINE_API const wchar_t * GetWindowsDeviceName(AkInt32 index, AkUInt32 &out_uDeviceID, AkAudioDeviceState uDeviceStateMask=AkDeviceState_All)
AKSOUNDENGINE_API AkUInt32 GetDeviceIDFromName(wchar_t *in_szToken)
AkAudioDeviceState
Definition: AkTypes.h:232
uint32_t AkUInt32
Unsigned 32-bit integer.
bool bEnableAvxSupport
Enables run-time detection of AVX and AVX2 SIMD support in the engine and plug-ins.
AkUInt32 uSampleRate
Sampling Rate. Set to 0 to get the native sample rate. Default value is 0.
AkThreadProperties threadBankManager
Bank manager threading properties (its default priority is AK_THREAD_PRIORITY_NORMAL)
AKSOUNDENGINE_API AkUInt32 GetWindowsDeviceCount(AkAudioDeviceState uDeviceStateMask=AkDeviceState_All)

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise