Version

menu_open
Wwise SDK 2024.1.4
AkMotionSinkScePadHelpers.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) 2025 Audiokinetic Inc.
25 *******************************************************************************/
26 
27 /// \file
28 
29 #pragma once
30 
32 
33 #include <windef.h> // required for pad_windows_static.h compilation
34 #include <pad.h>
35 
36 // Do a bitwise-OR with the deviceID, when adding the output, to utilize the scePad Haptics ("Advanced") functionality
37 // If unset, the device will use scePad Rumble ("Compatible") functionality
38 #define AKMOTION_SCEPAD_HAPTICS_MODE 0x80000000
39 
40 namespace AK
41 {
42  typedef int(*_akmotionPadGetHandle)(int userId, int type, int index);
43  typedef int(*_akmotionPadGetContainerIdInformation)(int handle, void* pInfo);
44  typedef int(*_akmotionPadGetControllerType)(int handle, void* pControllerType);
45  typedef int(*_akmotionPadSetVibrationMode)(int handle, ScePadVibrationMode mode);
46  typedef int(*_akmotionPadSetVibration)(int handle, const void* pParam);
47  typedef int(*_akmotionPadGetControllerBusType)(int handle, void* pBusType);
48 }
49 
50 // Helper functions to facilitate "loose" linkage with scePad library.
51 // If AkMotion is statically linked into your program, call AKMOTION_STATIC_LINK_SCEPAD_FUNCTIONS anywhere (even pre-init)
52 // If AkMotion is dynamically linked into your program, call AKMOTION_DYNAMIC_LINK_SCEPAD_FUNCTIONS after Init.bnk has been loaded
53 #define AKMOTIONSINK_STATIC_LINK_SCEPAD_FUNCTIONS \
54  struct _AkMotionInitializeScePadFunctionsHelper \
55  { \
56  _AkMotionInitializeScePadFunctionsHelper() \
57  { \
58  AkMotionInitializeScePadFunctions(\
59  (AK::_akmotionPadGetHandle)scePadGetHandle, \
60  (AK::_akmotionPadGetContainerIdInformation)scePadGetContainerIdInformation, \
61  (AK::_akmotionPadGetControllerType)scePadGetControllerType, \
62  (AK::_akmotionPadSetVibrationMode)scePadSetVibrationMode, \
63  (AK::_akmotionPadSetVibration)scePadSetVibration, \
64  (AK::_akmotionPadGetControllerBusType)scePadGetControllerBusType); \
65  } \
66  } AkMotionInitializeScePadFunctionsHelper;
67 
68 #define AKMOTIONSINK_DYNAMIC_LINK_SCEPAD_FUNCTIONS \
69  { \
70  HMODULE _akmotion_Hmod; \
71  if (GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, "AkMotion", &_akmotion_Hmod)) \
72  { \
73  typedef int(*_akmotionPadInitFunc)( \
74  AK::_akmotionPadGetHandle in_pPadGetHandle, \
75  AK::_akmotionPadGetContainerIdInformation in_pPadGetContainerIdInformation, \
76  AK::_akmotionPadGetControllerType in_pPadGetControllerType, \
77  AK::_akmotionPadSetVibrationMode in_pPadSetVibrationMode, \
78  AK::_akmotionPadSetVibration in_pPadSetVibration, \
79  AK::_akmotionPadGetControllerBusType in_pPadGetControllerBusType); \
80  _akmotionPadInitFunc _akmotion_pInitFn = reinterpret_cast<_akmotionPadInitFunc>( reinterpret_cast<void*>( \
81  GetProcAddress(_akmotion_Hmod, "AkMotionInitializeScePadFunctions") \
82  )); \
83  _akmotion_pInitFn( \
84  (AK::_akmotionPadGetHandle)scePadGetHandle, \
85  (AK::_akmotionPadGetContainerIdInformation)scePadGetContainerIdInformation, \
86  (AK::_akmotionPadGetControllerType)scePadGetControllerType, \
87  (AK::_akmotionPadSetVibrationMode)scePadSetVibrationMode, \
88  (AK::_akmotionPadSetVibration)scePadSetVibration, \
89  (AK::_akmotionPadGetControllerBusType)scePadGetControllerBusType); \
90  } \
91  } \
92 
93 
94 #ifdef __cplusplus
95 extern "C" {
96 #endif
98  AK::_akmotionPadGetHandle in_pPadGetHandle,
99  AK::_akmotionPadGetContainerIdInformation in_pPadGetContainerIdInformation,
100  AK::_akmotionPadGetControllerType in_pPadGetControllerType,
101  AK::_akmotionPadSetVibrationMode in_pPadSetVibrationMode,
102  AK::_akmotionPadSetVibration in_pPadSetVibration,
103  AK::_akmotionPadGetControllerBusType in_pPadGetControllerBusType);
104 #ifdef __cplusplus
105 }
106 #endif
Definition of data structures for AkAudioObject.
int(* _akmotionPadGetControllerBusType)(int handle, void *pBusType)
#define AK_DLLEXPORT
int(* _akmotionPadGetHandle)(int userId, int type, int index)
int(* _akmotionPadGetControllerType)(int handle, void *pControllerType)
int(* _akmotionPadGetContainerIdInformation)(int handle, void *pInfo)
int(* _akmotionPadSetVibration)(int handle, const void *pParam)
int(* _akmotionPadSetVibrationMode)(int handle, ScePadVibrationMode mode)
AK_DLLEXPORT void AkMotionInitializeScePadFunctions(AK::_akmotionPadGetHandle in_pPadGetHandle, AK::_akmotionPadGetContainerIdInformation in_pPadGetContainerIdInformation, AK::_akmotionPadGetControllerType in_pPadGetControllerType, AK::_akmotionPadSetVibrationMode in_pPadSetVibrationMode, AK::_akmotionPadSetVibration in_pPadSetVibration, AK::_akmotionPadGetControllerBusType in_pPadGetControllerBusType)

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