버전

menu_open
Wwise SDK 2024.1.0
AkStreamMgrModule.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  Copyright (c) 2024 Audiokinetic Inc.
25 *******************************************************************************/
26 
27 /// \file
28 /// Audiokinetic's implementation-specific definitions and factory of
29 /// overridable Stream Manager module.
30 /// Contains the default Stream Manager's implementation-specific interfaces that altogether constitute
31 /// the Low-Level I/O submodule. This submodule needs to be implemented by the game. All I/O requests
32 /// generated by the Stream Manager end up to one of the I/O hooks defined herein.
33 /// Read \ref streamingmanager_lowlevel to learn more about the Low-Level I/O.
34 
35 #ifndef _AK_STREAM_MGR_MODULE_H_
36 #define _AK_STREAM_MGR_MODULE_H_
37 
40 
41 /// \name Audiokinetic Stream Manager's implementation-specific definitions.
42 //@{
43 /// Stream Manager initialization settings.
44 /// \sa
45 /// - AK::IAkStreamMgr
46 /// - AK::StreamMgr::Create()
47 /// - \ref streamingmanager_settings
48 
50 {
51 };
52 
53 /// High-level IO devices initialization settings.
54 /// \sa
55 /// - AK::IAkStreamMgr
56 /// - AK::StreamMgr::CreateDevice()
57 /// - \ref streamingmanager_settings
59 {
60  void * pIOMemory; ///< Pointer for I/O memory allocated by user.
61  ///< Pass NULL if you want memory to be allocated via AK::MemoryMgr::Malign().
62  ///< If specified, uIOMemorySize, uIOMemoryAlignment and ePoolAttributes are ignored.
63  AkUInt32 uIOMemorySize; ///< Size of memory for I/O (for automatic streams). It is passed directly to AK::MemoryMgr::Malign(), after having been rounded down to a multiple of uGranularity.
64  AkUInt32 uIOMemoryAlignment; ///< I/O memory alignment. It is passed directly to AK::MemoryMgr::Malign().
65  AkUInt32 ePoolAttributes; ///< Attributes for I/O memory. Here, specify the allocation type (AkMemType_Device, and so on). It is passed directly to AK::MemoryMgr::Malign().
66  AkUInt32 uGranularity; ///< I/O requests granularity (typical bytes/request).
67  AkThreadProperties threadProperties; ///< Scheduler thread properties.
68  AkReal32 fTargetAutoStmBufferLength; ///< Targetted automatic stream buffer length (ms). When a stream reaches that buffering, it stops being scheduled for I/O except if the scheduler is idle.
69  AkUInt32 uMaxConcurrentIO; ///< Maximum number of transfers that can be sent simultaneously to the Low-Level I/O.
70  bool bUseStreamCache; ///< If true, the device attempts to reuse I/O buffers that have already been streamed from disk. This is particularly useful when streaming small looping sounds. However, there is a small increase in CPU usage when allocating memory, and a slightly larger memory footprint in the StreamManager pool.
71  AkUInt32 uMaxCachePinnedBytes; ///< Maximum number of bytes that can be "pinned" using AK::SoundEngine::PinEventInStreamCache() or AK::IAkStreamMgr::PinFileInCache()
72 };
73 
74 /// File descriptor. File identification for the low-level I/O.
75 /// \sa
76 /// - AK::StreamMgr::IAkLowLevelIOHook
77 /// - AK::StreamMgr::IAkLowLevelIOHook::BatchOpen
78 /// - AK::StreamMgr::IAkLowLevelIOHook::Close
79 struct AkFileDesc
80 {
81  AkInt64 iFileSize = 0; ///< File size in bytes
82  AkUInt64 uSector = 0; ///< Start sector (the sector size is specified by the low-level I/O)
83  ///< \sa
84  ///< - AK::StreamMgr::IAkFileLocationResolver::Open()
85  ///< - AK::StreamMgr::IAkLowLevelIOHook::GetBlockSize()
86  AkFileHandle hFile = AkFileHandle(); ///< File handle/identifier
87  AkDeviceID deviceID = AK_INVALID_DEVICE_ID; ///< Device ID, obtained from CreateDevice() \sa AK::IAkStreamMgr::CreateDevice()
88 };
89 
90 /// Structure for synchronous transfers handshaking with the Low-Level I/O. Used with blocking I/O hooks.
91 /// \sa AK::StreamMgr::IAkLowLevelIOHook
93 {
94  AkUInt64 uFilePosition; ///< File offset where transfer should begin.
95  AkUInt32 uBufferSize; ///< Size of the buffer in which the I/O hook can write to.
96  AkUInt32 uRequestedSize; ///< Exact number of requested bytes for this transfer. Always equal to or smaller than uBufferSize.
97 };
98 
100 
101 /// Callback function prototype definition used for asynchronous I/O transfers between the Stream Manager and the Low-Level IO.
102 /// Notes:
103 /// - If you pass in_eResult of AK_Fail, all streams awaiting for this transfer are marked as invalid and will stop. An "IO error" notification is posted to the capture log.
104 /// - If the transfer was cancelled by the Stream Manager while it was in the Low-Level IO, you must return AK_Success, whether
105 /// you performed the operation or not. The Stream Manager knows that it was cancelled, so it will not try to use it after you call it back.
106 /// \sa
107 /// - AkAsyncIOTransferInfo
108 /// - AK::StreamMgr::IAkLowLevelIOHook
110  AkAsyncIOTransferInfo * in_pTransferInfo, ///< Pointer to the AkAsyncIOTransferInfo structure that was passed to corresponding Read() or Write() call.
111  AKRESULT in_eResult ///< Result of transfer: AK_Success or AK_Fail (streams waiting for this transfer become invalid).
112  );
113 
114 /// Structure for asynchronous transfers handshaking with the Low-Level I/O. Extends AkIOTransferInfo.
115 /// \sa
116 /// - AK::StreamMgr::IAkLowLevelIOHook
117 /// - AkIOTransferInfo
118 /// - AkAIOCallback
120 {
121  void * pBuffer; ///< Buffer for data transfer.
122  AkIOCallback pCallback; ///< Callback function used to notify the high-level device when the transfer is complete.
123  void * pCookie; ///< Reserved. The I/O device uses this cookie to retrieve the owner of the transfer.
124  void * pUserData; ///< Custom user data.
125 };
126 
127 struct AkAsyncFileOpenData;
128 
129 /// Callback signature for the notification of completion of the asynchronous Open operation.
130 /// \sa
131 /// - AkAsyncFileOpenData
132 /// - AK::StreamMgr::IAkLowLevelIOHook::BatchOpen
134  AkAsyncFileOpenData * in_pOpenInfo, ///< Pointer to the AkAsyncFileOpenData structure that was passed to corresponding Open().
135  AKRESULT in_eResult ///< Result of transfer: AK_Success or AK_Fail (streams waiting for this transfer become invalid).
136  );
137 
138 /// Structure used by Low Level IO Hooks (IAkLowLevelIOHook) to pass and retreive information on files to be opened by the IO hook.
139 /// Please refer to AK::StreamMgr::IAkLowLevelIOHook::BatchOpen for more information about the sementics of the Open operation.
140 /// \sa
141 /// - AkFileOpenData
142 /// - AK::StreamMgr::IAkLowLevelIOHook::BatchOpen
144 {
146 
148  : pCallback(NULL)
149  , pCookie(NULL)
150  , pFileDesc(NULL)
151  , pCustomData(NULL)
152  , pszStreamName(NULL)
153  {
154  *(AkFileOpenData*)this = in_copy;
155  }
156 
158  : pCallback(in_copy.pCallback)
159  , pCookie(in_copy.pCookie)
160  , pFileDesc(in_copy.pFileDesc)
161  , pCustomData(NULL)
162  , pszStreamName(NULL)
163  {
164  *(AkFileOpenData*)this = in_copy;
165  }
166 
168  : AkFileOpenData()
169  , pCallback(NULL)
170  , pCookie(NULL)
171  , pFileDesc(NULL)
172  , pCustomData(NULL)
173  , pszStreamName(NULL)
174  {}
175 
176  AkAsyncFileOpenData(const AkOSChar* in_pszFileName, AkOpenMode in_eOpenMode = AK_OpenModeRead, AkFileSystemFlags* in_pFlags = NULL)
177  :AkFileOpenData(in_pszFileName, in_eOpenMode, in_pFlags)
178  , pCallback(NULL)
179  , pCookie(NULL)
180  , pFileDesc(NULL)
181  , pCustomData(NULL)
182  , pszStreamName(NULL)
183  {}
184 
186  :AkFileOpenData(in_idFile, in_eOpenMode, in_pFlags)
187  , pCallback(NULL)
188  , pCookie(NULL)
189  , pFileDesc(NULL)
190  , pCustomData(NULL)
191  , pszStreamName(NULL)
192  {}
193 
194  ///< Functions used to manage optional stream name. The name will be used when sending stream information to the Wwise profiler.
195  AKRESULT SetStreamName(const AkOSChar* in_pszStreamName);
196  const AkOSChar* GetStreamName() const { return pszStreamName; }
197 
198  AkFileOpenCallback pCallback; ///< Callback function used to notify the high-level device when Open is done
199  void* pCookie; ///< Reserved. Pass this unchanged to the callback function. The I/O device uses this cookie to retrieve the owner of the transfer.
200  AkFileDesc* pFileDesc; ///< File Descriptor to fill once the Open operation is complete.
201  void* pCustomData; ///< Convenience pointer for the IO hook implementer. Useful for additional data used in asynchronous implementations, for example.
202 
203 private:
204  AkOSChar* pszStreamName; ///< Display name. If provided, this will be used to set the stream name, which is used for the profiler. This struct is not responsible for the memory.
205 };
206 
207 /// Low-Level I/O requests heuristics.
208 /// Used for asynchronous read requests.
209 /// \sa
210 /// - AK::StreamMgr::IAkLowLevelIOHook::BatchRead()
211 /// - AK::StreamMgr::IAkLowLevelIOHook::BatchWrite()
213 {
214  AkReal32 fDeadline; ///< Operation deadline (ms).
215  AkPriority priority; ///< Operation priority (at the time it was scheduled and sent to the Low-Level I/O). Range is [AK_MIN_PRIORITY,AK_MAX_PRIORITY], inclusively.
216 };
217 
218 
219 //@}
220 
221 namespace AK
222 {
223  /// Audiokinetic Stream Manager's implementation-specific interfaces of the Low-Level IO submodule.
224  namespace StreamMgr
225  {
226  /// Interface for batched deferred low-level I/O transfers.
227  /// This I/O transfer handshaking method is preferred when you want to hook I/O to your own
228  /// I/O streaming technology, and you want to submit multiple I/O requests in one call, so as
229  /// to allow for better opportunities for CPU and I/O performance.
230  /// All operations in this interface will be happening in the device's own thread, separate
231  /// from the main audio thread. Also, it is assumed that all operations are asynchronous although
232  /// immediate resolution is also supported.
233  /// You may queue them into your own system, and even use the heuristics passed down to this
234  /// level for your convenience. Note that the requests are always sent in the order that the
235  /// Stream Manager considers to be the most appropriate. You may receive less than
236  /// AkDeviceSettings::uMaxConcurrentIO at any given time. The number of concurrent transfers
237  /// depends on the number of streams running in the high-level streaming device, and on its
238  /// target buffering length and granularity. Your advantage at this level is to be aware of
239  /// file placement, so you may try to re-order requests in order to minimize seeking on disk.
240  /// Calls to BatchRead()/BatchWrite() should return as soon as possible. You need to call
241  /// AkAsyncIOTransferInfo::pCallback for all individual items in a transfer batch.
242  /// Cancel() is provided in order to inform you that the streaming device will flush this transfer
243  /// upon completion. You may implement it or not. In all cases, you must call the callback.
245  {
246  protected:
247  /// Virtual destructor on interface to avoid warnings.
248  virtual ~IAkLowLevelIOHook(){}
249 
250  public:
251 
252  /// Closes a file.
253  /// The file descriptor should be deleted during this call.
254  /// No other module should have a reference to it at this point.
255  /// \return AK_Success if the file was properly cleaned-up.
256  virtual AKRESULT Close(
257  AkFileDesc * in_pFileDesc ///< File descriptor.
258  ) = 0;
259 
260  /// Returns the block size for the file or its storage device.
261  /// The block size is a constraint for clients
262  /// of the Stream Manager: All reads, writes and position changes need to be a multiple of
263  /// that size.
264  /// \return
265  /// The block size for a specific file or storage device.
266  /// \remarks
267  /// - Some files might be opened with flags that require I/O transfers to be a multiple
268  /// of this size. The stream manager will query this function to resolve calls
269  /// to IAk(Auto)Stream::GetBlockSize( ).
270  /// - Also, AkFileDesc::uSector specifies a number of sectors in multiples of this value.
271  /// - Files/IO devices that do not require byte alignment should return 1.
272  /// - Whether file opening was deferred or not, GetBlockSize() is always called right
273  /// after the first call to Open(), in the client's thread, and is never called again.
274  /// \warning
275  /// Returning 0 is not allowed and will likely make the Stream Manager crash.
276  /// \sa
277  /// - AK::StreamMgr::IAkLowLevelIOHook::BatchOpen()
278  /// - AK::StreamMgr::IAkLowLevelIOHook::BatchRead()
279  /// - AK::StreamMgr::IAkLowLevelIOHook::BatchWrite()
281  AkFileDesc & in_fileDesc ///< File descriptor.
282  ) = 0;
283 
284  /// Returns a description for the streaming device above this low-level hook.
285  /// \remarks For profiling purposes only. The Release configuration of the
286  /// Stream Manager never calls it.
287  virtual void GetDeviceDesc(
288  AkDeviceDesc & out_deviceDesc ///< Device description.
289  ) = 0;
290 
291  /// Returns custom profiling data for the streaming device above this low-level hook.
292  /// As opposed to GetDeviceDesc(), this is called at every monitoring frame.
293  /// You may implement this function in order to display any value you find useful
294  /// in the "Streaming Devices" tab of the Wwise profiler ("Custom Param" column).
295  /// \remarks For profiling purposes only. The Release configuration of the
296  /// Stream Manager never calls it.
297  /// \return A 32-bit unsigned value to display in the Wwise profiler.
298  virtual AkUInt32 GetDeviceData() = 0;
299 
301  {
305  };
306 
307 
308  /// Request to open multiple files (asynchronous).
309  /// \remarks
310  /// - The pCallback within each AkAsyncFileOpenData must be called when completed.
311  /// - It is possible to mix synchronous and asynchronous file opens, as long as all pCallbacks are eventually called.
312  /// - When implementing this function, make sure to process all items even if one fails to be dispatched or to open.
313  /// - Pointers in in_ppItems will stay valid until pCallback is called to signal the operation result.
314  virtual void BatchOpen(
315  AkUInt32 in_uNumFiles, ///< Number of transfers to process
316  AkAsyncFileOpenData** in_ppItems ///< List of files to open. See remarks above.
317  ) = 0;
318 
319  /// Reads multiple data from multiple files (asynchronous).
320  /// \remarks
321  /// - Queue up multiple read requests at once, using the provided array of in_pTransferItems. There will
322  /// be in_uNumTransfers number of items in the array.
323  /// - The pCallback within each BatchIoTransferItem::pTransferInfo must be called when completed.
324  /// - The pointer to each BatchIoTransferItem::pTransferInfo will be valid until the high-level
325  /// device is notified through the callback. However, the array of in_pTransferItems will not be valid.
326  /// - File position passed in each BatchIoTransferItem::pTransferInfo takes the offset of this file relative
327  /// to AkFileDesc::hFile (described with AkFileDesc::uSector). It is computed by the high-level
328  /// device as "pFileDesc->uSector * Block_Size + Stream_Position", where Block_Size is obtained
329  /// via AK::StreamMgr::IAkLowLevelIOHook::GetBlockSize().
330  virtual void BatchRead(
331  AkUInt32 in_uNumTransfers, ///< Number of transfers to process
332  BatchIoTransferItem* in_pTransferItems ///< List of transfer items to process
333  ) = 0;
334 
335  /// Write multiple data to multiple files (asynchronous).
336  /// \remarks
337  /// - Queue up multiple write requests at once, using the provided array of in_pTransferItems. There will
338  /// be in_uNumTransfers number of items in the array.
339  /// - The pCallback within each BatchIoTransferItem::pTransferInfo must be called when completed.
340  /// - The pointer to each BatchIoTransferItem::pTransferInfo will be valid until the high-level
341  /// device is notified through the callback. However, the array of in_pTransferItems will not be valid.
342  /// - File position passed in each BatchIoTransferItem::pTransferInfo takes the offset of this file relative
343  /// to AkFileDesc::hFile (described with AkFileDesc::uSector). It is computed by the high-level
344  /// device as "pFileDesc->uSector * Block_Size + Stream_Position", where Block_Size is obtained
345  /// via AK::StreamMgr::IAkLowLevelIOHook::GetBlockSize().
346  virtual void BatchWrite(
347  AkUInt32 in_uNumTransfers, ///< Number of transfers to process
348  BatchIoTransferItem* in_pTransferItems ///< List of transfer items to process
349  ) = 0;
350 
351  /// This function is called to provide information when file related errors occur. The base paths known by this IO hook should be returned in out_searchedPath.
353  AKRESULT in_result, ///< Result of the open call
354  const AkFileOpenData& in_FileOpen, ///< File name and flags passed to the Open call.
355  AkOSChar* out_searchedPath, ///< Pre-allocated string buffer to be filled with all searched paths searched for the file.
356  AkInt32 in_pathSize ///< The maximum size of the string
357  ) { return AK_NotImplemented; };
358  };
359 
360  /// File location resolver interface. There is one and only one File Location Resolver that is
361  /// registered to the Stream Manager (using AK::StreamMgr::SetFileLocationResolver()). Its purpose
362  /// is to resolve a file name or ID to a streaming device (I/O hook) that can handle the file.
363  /// When your Low-Level I/O submodule uses a single device, you should create a standalone I/O
364  /// hook which implements one of the I/O hooks defined above, as well
365  /// as the File Location Resolver. You then register this object to the Stream Manager as the
366  /// File Location Resolver.
367  /// If you wish to create multiple devices, then you should have a separate object that implements
368  /// AK::StreamMgr::IAkFileLocationResolver and registers to the Stream Manager as such. This object
369  /// will be used to dispatch the file open request to the appropriate device. The strategy you will
370  /// use to select the correct device is up to you to implement.
371  /// There is a built-in mechanism of chaining devices through GetNextPreferredDevice().
372  /// If a device can't open a file GetNextPreferredDevice will be called again to get the next
373  /// device to check.
375  {
376  protected:
377  /// Virtual destructor on interface to avoid warnings.
379 
380  public:
381 
382  /// Determines which device to use to open a file.
383  /// If your File Resolver only handles one device, return AK_NotImplemented and the StreamMgr will use the only device configured.
384  /// If it handles multiple devices, you can base the decision on where to get the file on any kind of heuristic:
385  /// file extension, file name, access rights, CodecID, etc.
386  /// The order in which devices are searched is left to the implementer.
387  /// This function will always be called first with io_idDevice = AK_INVALID_DEVICE_ID.
388  /// \return
389  /// - AK_Success if there is a device to delegate the Open() call to. io_idDevice should be set to the proper AkDeviceID (as returned by AK::StreamMgr::CreateDevice).
390  /// - AK_FileNotFound if all devices have been exhausted.
391  /// - AK_NotImplemented if there is only one device in the system and file resolution is trivial.
392  /// \remark
393  /// This can be called from multiple threads.
395  AkAsyncFileOpenData& in_FileOpen, ///< File name and flags passed to the Open call.
396  AkDeviceID& io_idDevice ///< In: last device used. Out: next device to use to open the file
397  )
398  { return AK_NotImplemented; };
399  };
400 
401  /// \name Audiokinetic implementation-specific Stream Manager factory.
402  //@{
403  /// Stream Manager factory.
404  /// \remarks
405  /// - In order for the Stream Manager to work properly, you also need to create
406  /// at least one streaming device (and implement its I/O hook), and register the
407  /// File Location Resolver with AK::StreamMgr::SetFileLocationResolver().
408  /// - Use AK::StreamMgr::GetDefaultSettings(), then modify the settings you want,
409  /// then feed this function with them.
410  /// \sa
411  /// - AK::IAkStreamMgr
412  /// - AK::StreamMgr::SetFileLocationResolver()
413  /// - AK::StreamMgr::GetDefaultSettings()
415  const AkStreamMgrSettings & in_settings ///< Stream manager initialization settings.
416  );
417 
418  /// Get the default values for the Stream Manager's settings.
419  /// \sa
420  /// - AK::StreamMgr::Create()
421  /// - AkStreamMgrSettings
422  /// - \ref streamingmanager_settings
424  AkStreamMgrSettings & out_settings ///< Returned AkStreamMgrSettings structure with default values.
425  );
426 
427  /// Get the one and only File Location Resolver registered to the Stream Manager.
428  /// \sa
429  /// - AK::StreamMgr::IAkFileLocationResolver
430  /// - AK::StreamMgr::SetFileLocationResolver()
432 
433  /// Register the one and only File Location Resolver to the Stream Manager.
434  /// \sa
435  /// - AK::StreamMgr::IAkFileLocationResolver
437  IAkFileLocationResolver * in_pFileLocationResolver ///< Interface to your File Location Resolver
438  );
439 
440  //@}
441 
442  /// \name Stream Manager: High-level I/O devices management.
443  //@{
444  /// Streaming device creation.
445  /// Creates a high-level device, with specific settings.
446  /// You need to provide the associated low-level I/O hook, implemented on your side.
447  /// \return The device ID. AK_INVALID_DEVICE_ID if there was an error and it could not be created.
448  /// \warning
449  /// - This function is not thread-safe.
450  /// \remarks
451  /// - You may use AK::StreamMgr::GetDefaultDeviceSettings() first to get default values for the
452  /// settings, change those you want, then feed the structure to this function.
453  /// - The returned device ID should be kept by the Low-Level IO, to assign it to file descriptors
454  /// in AK::StreamMgr::IAkLowLevelIOHook::BatchOpen().
455  /// \return
456  /// - AK_Success: Device was added to the system properly
457  /// - AK_InsufficientMemory: Not enough memory to complete the operation
458  /// - AK_InvalidParameter: One of the settings in AkDeviceSettings is out of range. Check asserts or debug console.
459  /// \sa
460  /// - AK::StreamMgr::IAkLowLevelIOHook
461  /// - AK::StreamMgr::GetDefaultDeviceSettings()
462  /// - \ref streamingmanager_settings
464  const AkDeviceSettings & in_settings, ///< Device settings.
465  IAkLowLevelIOHook * in_pLowLevelHook, ///< Associated low-level I/O hook. Pass either a IAkLowLevelIOHook interface, consistent with the type of the scheduler.
466  AkDeviceID& out_idDevice ///< Assigned unique device id to use in all other functions of this interface.
467  );
468  /// Streaming device destruction.
469  /// \return AK_Success if the device was successfully destroyed.
470  /// \warning This function is not thread-safe. No stream should exist for that device when it is destroyed.
472  AkDeviceID in_deviceID ///< Device ID of the device to destroy.
473  );
474 
475  /// Execute pending I/O operations on all created I/O devices.
476  /// This should only be called in single-threaded environments where an I/O device cannot spawn a thread.
477  /// \return AK_Success when called from an appropriate environment, AK_NotCompatible otherwise.
478  /// \sa
479  /// - AK::StreamMgr::CreateDevice()
481 
482  /// Get the default values for the streaming device's settings. Recommended usage
483  /// is to call this function first, then pass the settings to AK::StreamMgr::CreateDevice().
484  /// \sa
485  /// - AK::StreamMgr::CreateDevice()
486  /// - AkDeviceSettings
487  /// - \ref streamingmanager_settings
489  AkDeviceSettings & out_settings ///< Returned AkDeviceSettings structure with default values.
490  );
491  //@}
492 
493  /// \name Language management.
494  //@{
495  /// Set the current language once and only once, here. The language name is stored in a static buffer
496  /// inside the Stream Manager. In order to resolve localized (language-specific) file location,
497  /// AK::StreamMgr::IAkFileLocationResolver implementations query this string. They may use it to
498  /// construct a file path (for e.g. SDK/samples/SoundEngine/Common/AkFileLocationBase.cpp), or to
499  /// find a language-specific file within a look-up table (for e.g. SDK/samples/SoundEngine/Common/AkFilePackageLUT.cpp).
500  /// Pass a valid null-terminated string, without a trailing slash or backslash. Empty strings are accepted.
501  /// You may register for language changes (see RegisterToLanguageChangeNotification()).
502  /// After changing the current language, all observers are notified.
503  /// \return AK_Success if successful (if language string has less than AK_MAX_LANGUAGE_NAME_SIZE characters). AK_Fail otherwise.
504  /// \warning Not multithread safe.
505  /// \sa
506  /// - AK::StreamMgr::GetCurrentLanguage()
507  /// - AK::StreamMgr::AddLanguageChangeObserver()
509  const AkOSChar * in_pszLanguageName ///< Language name.
510  );
511 
512  /// Get the current language. The language name is stored in a static buffer inside the Stream Manager,
513  /// with AK::StreamMgr::SetCurrentLanguage(). In order to resolve localized (language-specific) file location,
514  /// AK::StreamMgr::IAkFileLocationResolver implementations query this string. They may use it to
515  /// construct a file path (for e.g. SDK/samples/SoundEngine/Common/AkFileLocationBase.cpp), or to
516  /// find a language-specific file within a look-up table (for e.g. SDK/samples/SoundEngine/Common/AkFilePackageLUT.cpp).
517  /// \return Current language.
518  /// \sa AK::StreamMgr::SetCurrentLanguage()
520 
521  /// Definition of handlers for language change notifications.
522  /// Called after SetCurrentLanguage() is called.
523  /// \warning Do not call AddLanguageChangeObserver or SetCurrentLanguage from within your handler.
524  /// \warning Not multithread safe.
525  /// \sa
526  /// - AK::StreamMgr::SetCurrentLanguage()
527  /// - AK::StreamMgr::AddLanguageChangeObserver()
529  const AkOSChar * const in_pLanguageName,///< New language name.
530  void * in_pCookie ///< Cookie that was passed to AddLanguageChangeObserver().
531  );
532 
533  /// Register to language change notifications.
534  /// \return AK_Success if successful, AK_Fail otherwise (no memory or no cookie).
535  /// \warning Not multithread safe.
536  /// \sa
537  /// - AK::StreamMgr::SetCurrentLanguage()
538  /// - AK::StreamMgr::RemoveLanguageChangeObserver()
540  AkLanguageChangeHandler in_handler, ///< Callback function.
541  void * in_pCookie ///< Cookie, passed back to AkLanguageChangeHandler. Must set.
542  );
543 
544  /// Unregister to language change notifications. Use the cookie you have passed to
545  /// AddLanguageChangeObserver() to identify the observer.
546  /// \warning Not multithread safe.
547  /// \sa
548  /// - AK::StreamMgr::SetCurrentLanguage()
549  /// - AK::StreamMgr::AddLanguageChangeObserver()
551  void * in_pCookie ///< Cookie that was passed to AddLanguageChangeObserver().
552  );
553 
554  /// \name Stream Manager: Cache management.
555  //@{
556  /// Flush cache of all devices. This function has no effect for devices where
557  /// AkDeviceSettings::bUseStreamCache was set to false (no caching).
558  /// \sa
559  /// - \ref streamingmanager_settings
561 
562  //@}
563  }
564 }
565 
566 #endif //_AK_STREAM_MGR_MODULE_H_
void * pCookie
Reserved. The I/O device uses this cookie to retrieve the owner of the transfer.
AkUInt32 uIOMemoryAlignment
I/O memory alignment. It is passed directly to AK::MemoryMgr::Malign().
AkReal32 fDeadline
Operation deadline (ms).
Definition of data structures for AkAudioObject
virtual void BatchRead(AkUInt32 in_uNumTransfers, BatchIoTransferItem *in_pTransferItems)=0
AKSOUNDENGINE_API AKRESULT DestroyDevice(AkDeviceID in_deviceID)
AKSOUNDENGINE_API AKRESULT SetCurrentLanguage(const AkOSChar *in_pszLanguageName)
virtual AkUInt32 GetDeviceData()=0
AkAsyncFileOpenData(AkFileID in_idFile, AkOpenMode in_eOpenMode=AK_OpenModeRead, AkFileSystemFlags *in_pFlags=NULL)
Functions used to manage optional stream name. The name will be used when sending stream information ...
void(* AkLanguageChangeHandler)(const AkOSChar *const in_pLanguageName, void *in_pCookie)
AkUInt32 uMaxCachePinnedBytes
Maximum number of bytes that can be "pinned" using AK::SoundEngine::PinEventInStreamCache() or AK::IA...
void * pUserData
Custom user data.
AkUInt32 uRequestedSize
Exact number of requested bytes for this transfer. Always equal to or smaller than uBufferSize.
AkAsyncFileOpenData(const AkFileOpenData &in_copy)
#define AK_EXTERNAPIFUNC(_type, _name)
AkUInt32 uMaxConcurrentIO
Maximum number of transfers that can be sent simultaneously to the Low-Level I/O.
AkReal32 fTargetAutoStmBufferLength
Targetted automatic stream buffer length (ms). When a stream reaches that buffering,...
bool bUseStreamCache
If true, the device attempts to reuse I/O buffers that have already been streamed from disk....
AKSOUNDENGINE_API void GetDefaultSettings(AkStreamMgrSettings &out_settings)
AKRESULT
Standard function call result.
Definition: AkTypes.h:134
static const AkDeviceID AK_INVALID_DEVICE_ID
Invalid streaming device ID
Definition: AkTypes.h:106
virtual ~IAkLowLevelIOHook()
Virtual destructor on interface to avoid warnings.
AkAsyncFileOpenData(const AkOSChar *in_pszFileName, AkOpenMode in_eOpenMode=AK_OpenModeRead, AkFileSystemFlags *in_pFlags=NULL)
AkUInt32 AkDeviceID
I/O device ID
Definition: AkTypes.h:78
AkDeviceID deviceID
Device ID, obtained from CreateDevice()
@ AK_OpenModeRead
Read-only access
Definition: IAkStreamMgr.h:74
AkPriority priority
Operation priority (at the time it was scheduled and sent to the Low-Level I/O). Range is [AK_MIN_PRI...
void(* AkIOCallback)(AkAsyncIOTransferInfo *in_pTransferInfo, AKRESULT in_eResult)
char AkOSChar
Generic character string
Definition: AkTypes.h:60
AkUInt32 ePoolAttributes
Attributes for I/O memory. Here, specify the allocation type (AkMemType_Device, and so on)....
#define NULL
Definition: AkTypes.h:46
AkUInt32 uBufferSize
Size of the buffer in which the I/O hook can write to.
float AkReal32
32-bit floating point
FILE * AkFileHandle
File handle
Definition: AkTypes.h:77
int32_t AkInt32
Signed 32-bit integer
void * pBuffer
Buffer for data transfer.
void(* AkFileOpenCallback)(AkAsyncFileOpenData *in_pOpenInfo, AKRESULT in_eResult)
void * pCookie
Reserved. Pass this unchanged to the callback function. The I/O device uses this cookie to retrieve t...
void * pCustomData
Convenience pointer for the IO hook implementer. Useful for additional data used in asynchronous impl...
AkAsyncFileOpenData(const AkAsyncFileOpenData &in_copy)
AkUInt32 AkFileID
Integer-type file identifier
Definition: AkTypes.h:77
AkUInt32 uGranularity
I/O requests granularity (typical bytes/request).
virtual void GetDeviceDesc(AkDeviceDesc &out_deviceDesc)=0
AKSOUNDENGINE_API AKRESULT PerformIO()
AkFileOpenCallback pCallback
Callback function used to notify the high-level device when Open is done
AKRESULT SetStreamName(const AkOSChar *in_pszStreamName)
AkInt8 AkPriority
Priority
Definition: AkTypes.h:67
virtual AKRESULT GetNextPreferredDevice(AkAsyncFileOpenData &in_FileOpen, AkDeviceID &io_idDevice)
AKSOUNDENGINE_API AKRESULT CreateDevice(const AkDeviceSettings &in_settings, IAkLowLevelIOHook *in_pLowLevelHook, AkDeviceID &out_idDevice)
#define AK_CALLBACK(_type, _name)
virtual AKRESULT Close(AkFileDesc *in_pFileDesc)=0
@ AK_NotImplemented
This feature is not implemented.
Definition: AkTypes.h:135
AkUInt64 uSector
File system flags for file descriptors mapping.
virtual AkUInt32 GetBlockSize(AkFileDesc &in_fileDesc)=0
int64_t AkInt64
Signed 64-bit integer
const AkOSChar * GetStreamName() const
AkIOCallback pCallback
Callback function used to notify the high-level device when the transfer is complete.
uint64_t AkUInt64
Unsigned 64-bit integer
AKSOUNDENGINE_API IAkFileLocationResolver * GetFileLocationResolver()
virtual void BatchWrite(AkUInt32 in_uNumTransfers, BatchIoTransferItem *in_pTransferItems)=0
AKSOUNDENGINE_API IAkStreamMgr * Create(const AkStreamMgrSettings &in_settings)
AKSOUNDENGINE_API void FlushAllCaches()
AkOpenMode
File open mode.
Definition: IAkStreamMgr.h:73
Device descriptor.
Definition: IAkStreamMgr.h:124
AKSOUNDENGINE_API void GetDefaultDeviceSettings(AkDeviceSettings &out_settings)
AKSOUNDENGINE_API void SetFileLocationResolver(IAkFileLocationResolver *in_pFileLocationResolver)
uint32_t AkUInt32
Unsigned 32-bit integer
AkFileDesc * pFileDesc
File Descriptor to fill once the Open operation is complete.
virtual void BatchOpen(AkUInt32 in_uNumFiles, AkAsyncFileOpenData **in_ppItems)=0
AKSOUNDENGINE_API void RemoveLanguageChangeObserver(void *in_pCookie)
AKSOUNDENGINE_API AKRESULT AddLanguageChangeObserver(AkLanguageChangeHandler in_handler, void *in_pCookie)
AkUInt64 uFilePosition
File offset where transfer should begin.
virtual ~IAkFileLocationResolver()
Virtual destructor on interface to avoid warnings.
AkUInt32 uIOMemorySize
Size of memory for I/O (for automatic streams). It is passed directly to AK::MemoryMgr::Malign(),...
AkFileHandle hFile
File handle/identifier
virtual AKRESULT OutputSearchedPaths(AKRESULT in_result, const AkFileOpenData &in_FileOpen, AkOSChar *out_searchedPath, AkInt32 in_pathSize)
This function is called to provide information when file related errors occur. The base paths known b...
AkInt64 iFileSize
File size in bytes
AKSOUNDENGINE_API const AkOSChar * GetCurrentLanguage()
AkThreadProperties threadProperties
Scheduler thread properties.

이 페이지가 도움이 되었나요?

지원이 필요하신가요?

질문이 있으신가요? 문제를 겪고 계신가요? 더 많은 정보가 필요하신가요? 저희에게 문의해주시면 도와드리겠습니다!

지원 페이지를 방문해 주세요

작업하는 프로젝트에 대해 알려주세요. 언제든지 도와드릴 준비가 되어 있습니다.

프로젝트를 등록하세요. 아무런 조건이나 의무 사항 없이 빠른 시작을 도와드리겠습니다.

Wwise를 시작해 보세요