Elevate Engine 1
Loading...
Searching...
No Matches
Elevate::WAAPIClient Class Reference

#include <WAAPIClient.h>

Public Member Functions

virtual ~WAAPIClient ()
 
 WAAPIClient (const WAAPIClient &)=delete
 
WAAPIClientoperator= (const WAAPIClient &)=delete
 
bool Connect ()
 
void Disconnect ()
 

Static Public Member Functions

static WAAPIClientGet ()
 
static bool IsConnected ()
 

Protected Attributes

bool m_isConnected = false
 
std::string m_ip = "127.0.0.1"
 
uint16_t m_port = 8080
 
AK::WwiseAuthoringAPI::Client * m_client
 

Detailed Description

Definition at line 16 of file WAAPIClient.h.

Constructor & Destructor Documentation

◆ ~WAAPIClient()

Elevate::WAAPIClient::~WAAPIClient ( )
virtual

Definition at line 108 of file WAAPIClient.cpp.

109 {
110#if EE_WAAPI_AVAILABLE
111 delete m_client;
112#endif
113 }
AK::WwiseAuthoringAPI::Client * m_client
Definition WAAPIClient.h:48

◆ WAAPIClient()

Elevate::WAAPIClient::WAAPIClient ( const WAAPIClient )
delete

Member Function Documentation

◆ Connect()

bool Elevate::WAAPIClient::Connect ( )

Definition at line 16 of file WAAPIClient.cpp.

17 {
18#if EE_WAAPI_AVAILABLE
19 m_isConnected = m_client->Connect(m_ip.c_str(), m_port);
20 if (!m_isConnected)
21 {
22 EE_CORE_ERROR("Could not connect to WAAPI.");
23 }
24
25 // todo remove this test
26 using namespace AK::WwiseAuthoringAPI;
27 AkJson wwiseInfoJson;
28 if (!m_client->Call(ak::wwise::core::getInfo, AkJson(AkJson::Type::Map), AkJson(AkJson::Type::Map), wwiseInfoJson, 10))
29 {
30 EE_CORE_ERROR("Failed to obtain Wwise Info within 10ms: {}", std::string(wwiseInfoJson["message"].GetVariant()));
31 }
32
33 // todo remove this test
34 // Fetch all of the supported objects via WAAPI
35 // use this as the wwise data source
36 //const AkJson args( AkJson::Map{
37 // { "from", AkJson::Map{ { "ofType", AkJson::Array{
38 // AkVariant("Bus"),
39 // AkVariant("Event"),
40 // AkVariant("SoundBank"),
41 // AkVariant("State"),
42 // AkVariant("Switch"),
43 // AkVariant("SwitchGroup"),
44 // AkVariant("StateGroup"),
45 // } } } }
46 //});
47
48 //const AkJson options(AkJson::Map{
49 // { "return", AkJson::Array{
50 // AkVariant("name"),
51 // AkVariant("id"),
52 // AkVariant("shortId"),
53 // AkVariant("type"),
54 // AkVariant("path"),
55 // } }
56 //});
57
58 //AkJson res;
59 //if (!m_client->Call(ak::wwise::core::object::get, args, options, res, 2000))
60 //{
61 // EE_CORE_ERROR("Failed to fetch all of the objects in the Wwise Project.");
62 //}
63 //else
64 //{
65 // if (res.IsMap() && res.HasKey("return"));
66 // {
67 // auto resArr = res["return"];
68 // for (auto obj : resArr.GetArray())
69 // {
70 // std::string name = obj["name"].GetVariant();
71 // std::string guid = obj["id"].GetVariant();
72 // std::string type = obj["type"].GetVariant();
73 // std::string path = obj["path"].GetVariant();
74 // uint64_t shortId = obj["shortId"].GetVariant();
75 // }
76 // }
77 //}
78
79 return m_isConnected;
80#else
81 return false;
82#endif
83 }

◆ Disconnect()

void Elevate::WAAPIClient::Disconnect ( )

Definition at line 85 of file WAAPIClient.cpp.

86 {
87#if EE_WAAPI_AVAILABLE
88 if (m_client)
89 {
90 m_client->Disconnect();
91 }
92#endif
93 }

◆ Get()

static WAAPIClient & Elevate::WAAPIClient::Get ( )
inlinestatic

Definition at line 21 of file WAAPIClient.h.

22 {
23 static WAAPIClient Instance;
24 return Instance;
25 }
WAAPIClient(const WAAPIClient &)=delete

◆ IsConnected()

bool Elevate::WAAPIClient::IsConnected ( )
static

Definition at line 123 of file WAAPIClient.cpp.

124 {
125#if EE_WAAPI_AVAILABLE
126 return Get().m_isConnected;
127#else
128 return false;
129#endif
130 }
static WAAPIClient & Get()
Definition WAAPIClient.h:21

◆ operator=()

WAAPIClient & Elevate::WAAPIClient::operator= ( const WAAPIClient )
delete

Member Data Documentation

◆ m_client

AK::WwiseAuthoringAPI::Client* Elevate::WAAPIClient::m_client
protected

Definition at line 48 of file WAAPIClient.h.

◆ m_ip

std::string Elevate::WAAPIClient::m_ip = "127.0.0.1"
protected

Definition at line 45 of file WAAPIClient.h.

◆ m_isConnected

bool Elevate::WAAPIClient::m_isConnected = false
protected

Definition at line 42 of file WAAPIClient.h.

◆ m_port

uint16_t Elevate::WAAPIClient::m_port = 8080
protected

Definition at line 46 of file WAAPIClient.h.


The documentation for this class was generated from the following files: