Version
menu_open
link
Wwise SDK 2019.1.11
AkCommunication.h
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 /// \file
29 /// The main communication interface (between the in-game sound engine and
30 /// authoring tool).
31 /// \sa
32 /// - \ref initialization_comm
33 /// - \ref termination_comm
34 
35 #ifndef _AK_COMMUNICATION_H
36 #define _AK_COMMUNICATION_H
37 
38 #include <AK/SoundEngine/Common/AkTypes.h>
39 #include <AK/SoundEngine/Common/AkMemoryMgr.h>
40 #include <AK/Tools/Common/AkPlatformFuncs.h>
41 
42 #define AK_COMM_SETTINGS_MAX_STRING_SIZE 64
43 
44 /// Platform-independent initialization settings of communication module between the Wwise sound engine
45 /// and authoring tool.
46 /// \sa
47 /// - AK::Comm::Init()
49 {
51  {
52  szAppNetworkName[0] = 0;
53  }
54  AkUInt32 uPoolSize; ///< Size of the communication pool, in bytes.
55 #if defined(AK_USE_NX_HTCS)
56  AkThreadProperties threadProperties; ///< Communication & Connection threading properties (its default priority is AK_THREAD_PRIORITY_ABOVENORMAL)
57 #endif
58 
59  /// Ports used for communication between the Wwise authoring application and your game.
60  /// All of these ports are opened in the game when Wwise communication is enabled.
61  /// When using HIO type communication, the ports are in fact channels and they must be 3
62  /// consecutives channels in the order they are defined in the Port structure.
63  ///
64  /// \sa
65  /// - \ref initialization_comm_ports
66  /// - AK::Comm::GetDefaultInitSettings()
67  /// - AK::Comm::Init()
68  struct Ports
69  {
70  /// Constructor
72  : uDiscoveryBroadcast( AK_COMM_DEFAULT_DISCOVERY_PORT )
73 #if defined( AK_COMM_NO_DYNAMIC_PORTS )
74  , uCommand( AK_COMM_DEFAULT_DISCOVERY_PORT + 1 )
75  , uNotification( AK_COMM_DEFAULT_DISCOVERY_PORT + 2 )
76 #else
77  , uCommand( 0 )
78  , uNotification( 0 )
79 #endif
80  {
81  }
82 
83  /// This is where the authoring application broadcasts "Game Discovery" requests
84  /// to discover games running on the network. Default value: 24024.
85  ///
86  /// \warning Unlike the other ports in this structure, this port cannot be dynamic
87  /// (cannot be set to 0). Refer to \ref initialization_comm_ports_discovery_broadcast
88  /// for more details.
90 
91  /// Used by the "command" channel.
92  /// \remark Set to 0 to request a dynamic/ephemeral port.
93  AkUInt16 uCommand;
94 
95  /// Used by the "notification" channel.
96  /// \remark Set to 0 to request a dynamic/ephemeral port.
97  AkUInt16 uNotification;
98  };
99 
100  /// Ports used for communication between the Wwise authoring application and your game.
101  /// \sa
102  /// - \ref initialization_comm
103  /// - AkCommSettings::Ports
104  /// - AK::Comm::Init()
106 
107  /// Tells if the base console communication library should be initialized.
108  /// If set to false, the game should load/initialize the console's communication library prior to calling this function.
109  /// Set to false only if your game already use sockets before the sound engine initialization.
110  /// Some consoles have critical requirements for initialization, see \ref initialization_comm_console_lib
112 
113  /// Optional name that will be displayed over network remote connection of Wwise.
114  /// It must be a NULL terminated string.
115  char szAppNetworkName[AK_COMM_SETTINGS_MAX_STRING_SIZE];
116 };
117 
118 namespace AK
119 {
120  namespace Comm
121  {
122  ///////////////////////////////////////////////////////////////////////
123  /// @name Initialization
124  //@{
125 
126  /// Initializes the communication module. When this is called, and AK::SoundEngine::RenderAudio()
127  /// is called periodically, you may use the authoring tool to connect to the sound engine.
128  ///
129  /// \warning This function must be called after the sound engine and memory manager have
130  /// been properly initialized.
131  ///
132  ///
133  /// \remark The AkCommSettings structure should be initialized with
134  /// AK::Comm::GetDefaultInitSettings(). You can then change some of the parameters
135  /// before calling this function.
136  ///
137  /// \return
138  /// - AK_Success if initialization was successful.
139  /// - AK_InvalidParameter if one of the settings is invalid.
140  /// - AK_InsufficientMemory if the specified pool size is too small for initialization.
141  /// - AK_Fail for other errors.
142  ///
143  /// \sa
144  /// - \ref initialization_comm
145  /// - AK::Comm::GetDefaultInitSettings()
146  /// - AkCommSettings::Ports
147  AK_EXTERNAPIFUNC( AKRESULT, Init )(
148  const AkCommSettings & in_settings///< Initialization settings.
149  );
150 
151  /// Gets the last error from the OS-specific communication library.
152  /// \return The system error code. Check the code in the platform manufacturer documentation for details about the error.
153  AK_EXTERNAPIFUNC(AkInt32, GetLastError());
154 
155  /// Gets the communication module's default initialization settings values.
156  /// \sa
157  /// - \ref initialization_comm
158  /// - AK::Comm::Init()
159  AK_EXTERNAPIFUNC( void, GetDefaultInitSettings )(
160  AkCommSettings & out_settings ///< Returned default initialization settings.
161  );
162 
163  /// Terminates the communication module.
164  /// \warning This function must be called before the memory manager is terminated.
165  /// \sa
166  /// - \ref termination_comm
167  AK_EXTERNAPIFUNC( void, Term )();
168 
169  /// Terminates and reinitialize the communication module using current settings.
170  ///
171  /// \return
172  /// - AK_Success if initialization was successful.
173  /// - AK_InvalidParameter if one of the settings is invalid.
174  /// - AK_InsufficientMemory if the specified pool size is too small for initialization.
175  /// - AK_Fail for other errors.
176  ///
177  /// \sa
178  /// - \ref AK::SoundEngine::iOS::WakeupFromSuspend()
179  AK_EXTERNAPIFUNC( AKRESULT, Reset )();
180 
181 
182  /// Get the initialization settings currently in use by the CommunicationSystem
183  ///
184  /// \return
185  /// - AK_Success if initialization was successful.
186  AK_EXTERNAPIFUNC( const AkCommSettings&, GetCurrentSettings )();
187 
188  //@}
189  }
190 }
191 
192 #endif // _AK_COMMUNICATION_H
Audiokinetic namespace.
char szAppNetworkName[AK_COMM_SETTINGS_MAX_STRING_SIZE]
Definition: AkCommunication.h:115
AKSOUNDENGINE_API AKRESULT Reset()
AKSOUNDENGINE_API AKRESULT Init(const AkCommSettings &in_settings)
AKSOUNDENGINE_API AkInt32 GetLastError()
AKSOUNDENGINE_API const AkCommSettings & GetCurrentSettings()
AKSOUNDENGINE_API void Term()
AKSOUNDENGINE_API void GetDefaultInitSettings(AkCommSettings &out_settings)
AkUInt16 uDiscoveryBroadcast
Definition: AkCommunication.h:89
Ports()
Constructor.
Definition: AkCommunication.h:71
bool bInitSystemLib
Definition: AkCommunication.h:111
AkUInt32 uPoolSize
Size of the communication pool, in bytes.
Definition: AkCommunication.h:54
AkUInt16 uNotification
Definition: AkCommunication.h:97

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