版本
menu_open
警告:系统已根据您所用大版本 (2019.1.11.7296) 自动跳转至最新文档。若想访问特定版本的文档,请从 Audiokinetic Launcher 下载离线文档,并在 Wwise 设计程序中勾选 Offline Documentation 选项。
link
Wwise SDK 2019.1.11
AkSyncCaller.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 // AkSyncLoader.h
29 
30 /// \file
31 /// Class for synchronous calls of asynchronous models
32 
33 #ifndef _AK_SYNC_CALLER_H_
34 #define _AK_SYNC_CALLER_H_
35 
36 #include <AK/Tools/Common/AkPlatformFuncs.h>
37 
38 namespace AK
39 {
40  namespace SoundEngine
41  {
42  /// AkSyncLoader: Init to create a sync event, call the asynchronous method, passing
43  /// it the address of this object as the cookie, then call Wait.
44  class AkSyncCaller
45  {
46  public:
47  /// Initialize.
48  AKRESULT Init()
49  {
50  if ( AKPLATFORM::AkCreateEvent( m_hEvent ) != AK_Success )
51  {
52  AKASSERT( !"Could not create synchronization event" );
53  return AK_Fail;
54  }
55  return AK_Success;
56  }
57 
58  /// Wait until the async function calls its callback.
59  AKRESULT Wait( AKRESULT in_eResult )
60  {
61  if ( in_eResult != AK_Success )
62  {
63  AKPLATFORM::AkDestroyEvent( m_hEvent );
64  return in_eResult;
65  }
66 
67  // Task queueing successful. Block until completion.
68  AKPLATFORM::AkWaitForEvent( m_hEvent );
69  AKPLATFORM::AkDestroyEvent( m_hEvent );
70 
71  return m_eResult;
72  }
73 
74  /// Call this from callback to release blocked thread.
75  inline void Done() { AKPLATFORM::AkSignalEvent( m_hEvent ); }
76 
77  AKRESULT m_eResult; ///< Operation result
78 
79  private:
80  AkEvent m_hEvent; ///< Sync event
81  };
82  }
83 }
84 
85 #endif // _AK_SYNC_CALLER_H_
AKRESULT Init()
Initialize.
Definition: AkSyncCaller.h:48
Audiokinetic namespace
void Done()
Call this from callback to release blocked thread.
Definition: AkSyncCaller.h:75
void AkWaitForEvent(AkEvent &in_event)
Platform Independent Helper
Definition: AkPlatformFuncs.h:98
void AkDestroyEvent(AkEvent &io_event)
Platform Independent Helper
Definition: AkPlatformFuncs.h:78
AKRESULT AkCreateEvent(AkEvent &out_event)
Platform Independent Helper
Definition: AkPlatformFuncs.h:55
AKRESULT m_eResult
Operation result
Definition: AkSyncCaller.h:77
void AkSignalEvent(const AkEvent &in_event)
Platform Independent Helper
Definition: AkPlatformFuncs.h:109
AKRESULT Wait(AKRESULT in_eResult)
Wait until the async function calls its callback.
Definition: AkSyncCaller.h:59

此页面对您是否有帮助?

需要技术支持?

仍有疑问?或者问题?需要更多信息?欢迎联系我们,我们可以提供帮助!

查看我们的“技术支持”页面

介绍一下自己的项目。我们会竭力为您提供帮助。

来注册自己的项目,我们帮您快速入门,不带任何附加条件!

开始 Wwise 之旅