Version

menu_open
Wwise SDK 2023.1.7
AkCommunication.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 /// \file AK/Comm/AkCommunication.h
28 /// The main communication interface (between the in-game sound engine and
29 /// authoring tool).
30 /// \sa
31 /// - \ref initialization_comm
32 /// - \ref termination_comm
33 
34 #ifndef _AK_COMMUNICATION_H
35 #define _AK_COMMUNICATION_H
36 
38 
39 #define AK_COMM_SETTINGS_MAX_STRING_SIZE 64
40 #define AK_COMM_SETTINGS_MAX_URL_SIZE 128
41 
42 /// Platform-independent initialization settings of communication module between the Wwise sound engine
43 /// and authoring tool.
44 /// \sa
45 /// - AK::Comm::Init()
47 {
50  {
51  szAppNetworkName[0] = 0;
52  szCommProxyServerUrl[0] = 0;
53  }
54 
55  /// Ports used for communication between the Wwise authoring application and your game.
56  /// All of these ports are opened in the game when Wwise communication is enabled.
57  ///
58  /// \sa
59  /// - \ref initialization_comm_ports
60  /// - AK::Comm::GetDefaultInitSettings()
61  /// - AK::Comm::Init()
62  struct Ports
63  {
64  /// Constructor
67 #if defined( AK_COMM_NO_DYNAMIC_PORTS )
69 #else
70  , uCommand( 0 )
71 #endif
72  {
73  }
74 
75  /// This is where the authoring application broadcasts "Game Discovery" requests
76  /// to discover games running on the network. Default value: 24024.
77  ///
78  /// \warning Unlike the other port in this structure, this port cannot be dynamic: setting it
79  /// to 0 will disable discovery. Refer to \ref initialization_comm_ports_discovery_broadcast
80  /// for more details.
82 
83  /// Used by the "command" channel.
84  /// \remark Set to 0 to request a dynamic/ephemeral port.
86  };
87 
88  /// Ports used for communication between the Wwise authoring application and your game.
89  /// \sa
90  /// - \ref initialization_comm
91  /// - AkCommSettings::Ports
92  /// - AK::Comm::Init()
94 
95  /// Allows selecting the communication system used to connect remotely the Authoring tool on the device.
97  {
98  AkCommSystem_Socket, /// The recommended default communication system
99  AkCommSystem_HTCS /// HTCS when available only, will default to AkCommSystem_Socket if the HTCS system is not available.
100  };
101 
102  /// Select the device of the communication system.
103  /// By default, connecting to the Authoring tool
104  /// \sa
105  /// - \ref initialization_comm
106  /// - AkCommSettings::AkCommSystem
107  /// - AK::Comm::Init()
109 
110  /// Tells if the base console communication library should be initialized.
111  /// If set to false, the game should load/initialize the console's communication library prior to calling this function.
112  /// Set to false only if your game already use sockets before the sound engine initialization.
113  /// Some consoles have critical requirements for initialization, see \ref initialization_comm_console_lib
115 
116  /// Optional name that will be displayed over network remote connection of Wwise.
117  /// It must be a NULL terminated string.
119 
120  /// Optional URL of Comm proxy server (only applicable for platforms incapable of acting as raw UDP/TCP servers)
122 };
123 
124 namespace AK
125 {
126  namespace Comm
127  {
128  ///////////////////////////////////////////////////////////////////////
129  /// @name Initialization
130  //@{
131 
132  /// Initializes the communication module. When this is called, and AK::SoundEngine::RenderAudio()
133  /// is called periodically, you may use the authoring tool to connect to the sound engine.
134  ///
135  /// \warning This function must be called after the sound engine and memory manager have
136  /// been properly initialized.
137  ///
138  ///
139  /// \remark The AkCommSettings structure should be initialized with
140  /// AK::Comm::GetDefaultInitSettings(). You can then change some of the parameters
141  /// before calling this function.
142  ///
143  /// \return
144  /// - AK_Success if initialization was successful.
145  /// - AK_InvalidParameter if one of the settings is invalid.
146  /// - AK_InsufficientMemory if the specified pool size is too small for initialization.
147  /// - AK_Fail for other errors.
148  ///
149  /// \sa
150  /// - \ref initialization_comm
151  /// - AK::Comm::GetDefaultInitSettings()
152  /// - AkCommSettings::Ports
154  const AkCommSettings & in_settings///< Initialization settings.
155  );
156 
157  /// Gets the last error from the OS-specific communication library.
158  /// \return The system error code. Check the code in the platform manufacturer documentation for details about the error.
160 
161  /// Gets the communication module's default initialization settings values.
162  /// \sa
163  /// - \ref initialization_comm
164  /// - AK::Comm::Init()
166  AkCommSettings & out_settings ///< Returned default initialization settings.
167  );
168 
169  /// Terminates the communication module.
170  /// \warning This function must be called before the memory manager is terminated.
171  /// \sa
172  /// - \ref termination_comm
173  AK_EXTERNAPIFUNC( void, Term )();
174 
175  /// Terminates and reinitialize the communication module using current settings.
176  ///
177  /// \return
178  /// - AK_Success if initialization was successful.
179  /// - AK_InvalidParameter if one of the settings is invalid.
180  /// - AK_InsufficientMemory if the specified pool size is too small for initialization.
181  /// - AK_Fail for other errors.
182  ///
183  /// \sa
184  /// - \ref AK::SoundEngine::iOS::WakeupFromSuspend()
186 
187 
188  /// Get the initialization settings currently in use by the CommunicationSystem
189  ///
190  /// \return
191  /// - AK_Success if initialization was successful.
193 
194 
195  /// Get the port currently in used by the command channel.
196  ///
197  /// \return
198  /// - Port number.
200 
201  //@}
202  }
203 }
204 
205 #endif // _AK_COMMUNICATION_H
char szCommProxyServerUrl[AK_COMM_SETTINGS_MAX_URL_SIZE]
Optional URL of Comm proxy server (only applicable for platforms incapable of acting as raw UDP/TCP s...
uint16_t AkUInt16
Unsigned 16-bit integer.
Audiokinetic namespace.
char szAppNetworkName[AK_COMM_SETTINGS_MAX_STRING_SIZE]
#define AK_EXTERNAPIFUNC(_type, _name)
AKRESULT
Standard function call result.
Definition: AkTypes.h:131
AKSOUNDENGINE_API AKRESULT Reset()
AKSOUNDENGINE_API AKRESULT Init(const AkCommSettings &in_settings)
AKSOUNDENGINE_API AkInt32 GetLastError()
int32_t AkInt32
Signed 32-bit integer.
AKSOUNDENGINE_API const AkCommSettings & GetCurrentSettings()
AKSOUNDENGINE_API void Term()
#define AK_COMM_SETTINGS_MAX_URL_SIZE
AKSOUNDENGINE_API void GetDefaultInitSettings(AkCommSettings &out_settings)
#define AK_COMM_NO_DYNAMIC_PORTS
Platform does not support dynamic/ephemeral ports for communication.
Definition: AkTypes.h:153
AkCommSystem
Allows selecting the communication system used to connect remotely the Authoring tool on the device.
AkCommSystem commSystem
@ AkCommSystem_HTCS
The recommended default communication system.
#define AK_COMM_SETTINGS_MAX_STRING_SIZE
AKSOUNDENGINE_API AkUInt16 GetCommandPort()
#define AK_COMM_DEFAULT_DISCOVERY_PORT
Default discovery port for most platforms using IP sockets for communication.
Definition: AkTypes.h:1253

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