Table of Contents

Target Platform(s):
Wwise SDK 2018.1.11
AkAndroidSoundEngine.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  Version: <VERSION> Build: <BUILDNUMBER>
25  Copyright (c) <COPYRIGHTYEAR> Audiokinetic Inc.
26 *******************************************************************************/
27 
28 // AkAndroidSoundEngine.h
29 
30 /// \file
31 /// Main Sound Engine interface, specific Android.
32 
33 #pragma once
34 
37 #include <SLES/OpenSLES.h>
38 #include "SLES/OpenSLES_Android.h"
39 #include <jni.h>
40 
41 
42 /// Platform specific initialization settings
43 /// \sa AK::SoundEngine::Init
44 /// \sa AK::SoundEngine::GetDefaultPlatformInitSettings
45 /// - \ref soundengine_initialization_advanced_soundengine_using_memory_threshold
47 {
48  // Threading model.
49  AkThreadProperties threadLEngine; ///< Lower engine threading properties
50  AkThreadProperties threadOutputMgr; ///< Ouput thread threading properties
51  AkThreadProperties threadBankManager; ///< Bank manager threading properties (its default priority is AK_THREAD_PRIORITY_NORMAL)
52  AkThreadProperties threadMonitor; ///< Monitor threading properties (its default priority is AK_THREAD_PRIORITY_ABOVENORMAL). This parameter is not used in Release build.
53 
54  // Memory.
55  AkReal32 fLEngineDefaultPoolRatioThreshold; ///< 0.0f to 1.0f value: The percentage of occupied memory where the sound engine should enter in Low memory mode. \ref soundengine_initialization_advanced_soundengine_using_memory_threshold
56  AkUInt32 uLEngineDefaultPoolSize;///< Lower Engine default memory pool size
57 
58  AkUInt32 uSampleRate; ///< Sampling Rate. Set to 0 to get the native sample rate. Default value is 0.
59  AkUInt16 uNumRefillsInVoice; ///< Number of refill buffers in voice buffer. Defaults to 4.
60  AkChannelMask uChannelMask; ///< use AK_SPEAKER_SETUP_STEREO
61  bool bRoundFrameSizeToHWSize;///< Used when hardware-preferred frame size and user-preferred frame size (AkInitSettings.uNumSamplesPerFrame) are not compatible.
62  /// If true (default) the sound engine will initialize to a multiple of the HW setting, close to the user setting.
63  /// If false, the user setting is used as is, regardless of the HW preference (might incur a performance hit).
64 
65  SLObjectItf pSLEngine; ///< OpenSL engine reference for sharing between various audio components.
66  JavaVM* pJavaVM; ///< Active JavaVM for the app, used for internal system calls. Usually provided through the android_app structure given at startup or the NativeActivity. This parameter needs to be set to allow the sound engine initialization.
67  jobject jNativeActivity; ///< NativeActivity instance for this application. Usually provided through the android_app structure, or through other means if your application has an overridden activity.
68  ///< This is optional. However, not providing this object will prevent the background music muting when player start his own music in an external player.
69 };
70 
71 struct AkInitSettings;
72 
73 namespace AK
74 {
75  namespace SoundEngine
76  {
77  /// Get instance of OpenSL created by the sound engine at initialization.
78  /// \return NULL if sound engine is not initialized
79  AK_EXTERNAPIFUNC( SLObjectItf, GetWwiseOpenSLInterface )();
80 
81  /// Gets specific settings for the fast audio path on Android. Call this function after AK::SoundEngine::GetDefaultSettings and AK::SoundEngine::GetPlatformDefaultSettings to modify settings for the fast path.
82  /// in_pfSettings.pJavaVM and in_pfSettings.jNativeActivity must be filled properly prior to calling GetFastPathSettings.
83  /// The fast path constraints are:
84  /// -The sample rate must match the hardware native sample rate
85  /// -The number of samples per frame must be a multiple of the hardware buffer size.
86  /// Not fulfilling these constraints makes the audio hardware less efficient.
87  /// In general, using the fast path means a higher CPU usage. Complex audio designs may not be feasible while using the fast path.
89  };
90 };
AkThreadProperties threadBankManager
Bank manager threading properties (its default priority is AK_THREAD_PRIORITY_NORMAL)
AKRESULT GetFastPathSettings(AkInitSettings &in_settings, AkPlatformInitSettings &in_pfSettings)
SLObjectItf pSLEngine
OpenSL engine reference for sharing between various audio components.
AkUInt32 uSampleRate
Sampling Rate. Set to 0 to get the native sample rate. Default value is 0.
uint16_t AkUInt16
Unsigned 16-bit integer.
Definition: AkTypes.h:78
AkThreadProperties threadLEngine
Lower engine threading properties.
AKRESULT
Standard function call result.
Definition: AkTypes.h:126
Audiokinetic namespace.
#define AK_EXTERNAPIFUNC(__TYPE__, __NAME__)
AkUInt32 AkChannelMask
Channel mask (similar to WAVE_FORMAT_EXTENSIBLE). Bit values are defined in AkSpeakerConfig....
Definition: AkTypes.h:90
AkUInt32 uLEngineDefaultPoolSize
Lower Engine default memory pool size.
AkReal32 fLEngineDefaultPoolRatioThreshold
0.0f to 1.0f value: The percentage of occupied memory where the sound engine should enter in Low memo...
SLObjectItf __cdecl GetWwiseOpenSLInterface()
AkUInt16 uNumRefillsInVoice
Number of refill buffers in voice buffer. Defaults to 4.
JavaVM * pJavaVM
Active JavaVM for the app, used for internal system calls. Usually provided through the android_app s...
AkChannelMask uChannelMask
use AK_SPEAKER_SETUP_STEREO
AkThreadProperties threadOutputMgr
Ouput thread threading properties.
AkThreadProperties threadMonitor
Monitor threading properties (its default priority is AK_THREAD_PRIORITY_ABOVENORMAL)....
uint32_t AkUInt32
Unsigned 32-bit integer.
Definition: AkTypes.h:79
float AkReal32
32-bit floating point
Definition: AkTypes.h:97