AudioSystemEditor_wwise.cpp 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AudioSystemEditor_wwise.h>
  9. #include <AzCore/Math/Crc.h>
  10. #include <AzCore/std/smart_ptr/make_shared.h>
  11. #include <AzCore/std/string/conversions.h>
  12. #include <AzCore/StringFunc/StringFunc.h>
  13. #include <AzCore/Utils/Utils.h>
  14. #include <ACETypes.h>
  15. #include <AudioSystemControl_wwise.h>
  16. #include <Common_wwise.h>
  17. #include <QDir>
  18. void InitWwiseResources()
  19. {
  20. Q_INIT_RESOURCE(EditorWwise);
  21. }
  22. namespace AudioControls
  23. {
  24. //-------------------------------------------------------------------------------------------//
  25. TImplControlType TagToType(const AZStd::string_view tag)
  26. {
  27. if (tag == Audio::WwiseXmlTags::WwiseEventTag)
  28. {
  29. return eWCT_WWISE_EVENT;
  30. }
  31. else if (tag == Audio::WwiseXmlTags::WwiseRtpcTag)
  32. {
  33. return eWCT_WWISE_RTPC;
  34. }
  35. else if (tag == Audio::WwiseXmlTags::WwiseAuxBusTag)
  36. {
  37. return eWCT_WWISE_AUX_BUS;
  38. }
  39. else if (tag == Audio::WwiseXmlTags::WwiseFileTag)
  40. {
  41. return eWCT_WWISE_SOUND_BANK;
  42. }
  43. else if (tag == Audio::WwiseXmlTags::WwiseSwitchTag)
  44. {
  45. return eWCT_WWISE_SWITCH_GROUP;
  46. }
  47. else if (tag == Audio::WwiseXmlTags::WwiseStateTag)
  48. {
  49. return eWCT_WWISE_GAME_STATE_GROUP;
  50. }
  51. return eWCT_INVALID;
  52. }
  53. //-------------------------------------------------------------------------------------------//
  54. const AZStd::string_view TypeToTag(const TImplControlType type)
  55. {
  56. switch (type)
  57. {
  58. case eWCT_WWISE_EVENT:
  59. return Audio::WwiseXmlTags::WwiseEventTag;
  60. case eWCT_WWISE_RTPC:
  61. return Audio::WwiseXmlTags::WwiseRtpcTag;
  62. case eWCT_WWISE_SWITCH:
  63. return Audio::WwiseXmlTags::WwiseValueTag;
  64. case eWCT_WWISE_AUX_BUS:
  65. return Audio::WwiseXmlTags::WwiseAuxBusTag;
  66. case eWCT_WWISE_SOUND_BANK:
  67. return Audio::WwiseXmlTags::WwiseFileTag;
  68. case eWCT_WWISE_GAME_STATE:
  69. return Audio::WwiseXmlTags::WwiseValueTag;
  70. case eWCT_WWISE_SWITCH_GROUP:
  71. return Audio::WwiseXmlTags::WwiseSwitchTag;
  72. case eWCT_WWISE_GAME_STATE_GROUP:
  73. return Audio::WwiseXmlTags::WwiseStateTag;
  74. }
  75. return "";
  76. }
  77. //-------------------------------------------------------------------------------------------//
  78. CAudioSystemEditor_wwise::CAudioSystemEditor_wwise()
  79. {
  80. InitWwiseResources();
  81. }
  82. //-------------------------------------------------------------------------------------------//
  83. void CAudioSystemEditor_wwise::Reload()
  84. {
  85. // set all the controls as placeholder as we don't know if
  86. // any of them have been removed but still have connections to them
  87. for (const auto& idControlPair : m_controls)
  88. {
  89. TControlPtr control = idControlPair.second;
  90. if (control)
  91. {
  92. control->SetPlaceholder(true);
  93. }
  94. }
  95. // reload data
  96. m_loader.Load(this);
  97. m_connectionsByID.clear();
  98. UpdateConnectedStatus();
  99. }
  100. //-------------------------------------------------------------------------------------------//
  101. IAudioSystemControl* CAudioSystemEditor_wwise::CreateControl(const SControlDef& controlDefinition)
  102. {
  103. AZStd::string fullName = controlDefinition.m_name;
  104. IAudioSystemControl* parent = controlDefinition.m_parentControl;
  105. if (parent)
  106. {
  107. AZ::StringFunc::Path::Join(controlDefinition.m_parentControl->GetName().c_str(), fullName.c_str(), fullName);
  108. }
  109. if (!controlDefinition.m_path.empty())
  110. {
  111. AZ::StringFunc::Path::Join(controlDefinition.m_path.c_str(), fullName.c_str(), fullName);
  112. }
  113. CID id = GetID(fullName);
  114. IAudioSystemControl* control = GetControl(id);
  115. if (control)
  116. {
  117. if (control->IsPlaceholder())
  118. {
  119. control->SetPlaceholder(false);
  120. if (parent && parent->IsPlaceholder())
  121. {
  122. parent->SetPlaceholder(false);
  123. }
  124. }
  125. return control;
  126. }
  127. else
  128. {
  129. TControlPtr newControl = AZStd::make_shared<IAudioSystemControl_wwise>(controlDefinition.m_name, id, controlDefinition.m_type);
  130. if (!parent)
  131. {
  132. parent = &m_rootControl;
  133. }
  134. parent->AddChild(newControl.get());
  135. newControl->SetParent(parent);
  136. newControl->SetLocalized(controlDefinition.m_isLocalized);
  137. m_controls[id] = newControl;
  138. return newControl.get();
  139. }
  140. }
  141. //-------------------------------------------------------------------------------------------//
  142. IAudioSystemControl* CAudioSystemEditor_wwise::GetControl(CID id) const
  143. {
  144. if (id != ACE_INVALID_CID)
  145. {
  146. auto it = m_controls.find(id);
  147. if (it != m_controls.end())
  148. {
  149. return it->second.get();
  150. }
  151. }
  152. return nullptr;
  153. }
  154. //-------------------------------------------------------------------------------------------//
  155. IAudioSystemControl* CAudioSystemEditor_wwise::GetControlByName(AZStd::string name, bool isLocalized, IAudioSystemControl* parent) const
  156. {
  157. if (parent)
  158. {
  159. AZ::StringFunc::Path::Join(parent->GetName().c_str(), name.c_str(), name);
  160. }
  161. if (isLocalized)
  162. {
  163. AZ::StringFunc::Path::Join(m_loader.GetLocalizationFolder().c_str(), name.c_str(), name);
  164. }
  165. return GetControl(GetID(name));
  166. }
  167. //-------------------------------------------------------------------------------------------//
  168. TConnectionPtr CAudioSystemEditor_wwise::CreateConnectionToControl(EACEControlType atlControlType, IAudioSystemControl* middlewareControl)
  169. {
  170. if (middlewareControl)
  171. {
  172. middlewareControl->SetConnected(true);
  173. ++m_connectionsByID[middlewareControl->GetId()];
  174. if (middlewareControl->GetType() == eWCT_WWISE_RTPC)
  175. {
  176. switch (atlControlType)
  177. {
  178. case EACEControlType::eACET_RTPC:
  179. {
  180. return AZStd::make_shared<CRtpcConnection>(middlewareControl->GetId());
  181. }
  182. case EACEControlType::eACET_SWITCH_STATE:
  183. {
  184. return AZStd::make_shared<CStateToRtpcConnection>(middlewareControl->GetId());
  185. }
  186. }
  187. }
  188. return AZStd::make_shared<IAudioConnection>(middlewareControl->GetId());
  189. }
  190. return nullptr;
  191. }
  192. //-------------------------------------------------------------------------------------------//
  193. TConnectionPtr CAudioSystemEditor_wwise::CreateConnectionFromXMLNode(AZ::rapidxml::xml_node<char>* node, EACEControlType atlControlType)
  194. {
  195. if (node)
  196. {
  197. AZStd::string_view element(node->name());
  198. TImplControlType type = TagToType(element);
  199. if (type != AUDIO_IMPL_INVALID_TYPE)
  200. {
  201. AZStd::string name;
  202. AZStd::string_view localized;
  203. if (auto nameAttr = node->first_attribute(Audio::WwiseXmlTags::WwiseNameAttribute, 0, false);
  204. nameAttr != nullptr)
  205. {
  206. name = nameAttr->value();
  207. }
  208. if (auto localizedAttr = node->first_attribute(Audio::WwiseXmlTags::WwiseLocalizedAttribute, 0, false);
  209. localizedAttr != nullptr)
  210. {
  211. localized = localizedAttr->value();
  212. }
  213. bool isLocalized = AZ::StringFunc::Equal(localized, "true");
  214. // If the control wasn't found, create a placeholder.
  215. // We want to see that connection even if it's not in the middleware.
  216. // User could be viewing the editor without a middleware project.
  217. IAudioSystemControl* control = GetControlByName(name, isLocalized);
  218. if (!control)
  219. {
  220. control = CreateControl(SControlDef(name, type));
  221. if (control)
  222. {
  223. control->SetPlaceholder(true);
  224. control->SetLocalized(isLocalized);
  225. }
  226. }
  227. // If it's a switch we connect to one of the states within the switch
  228. if (type == eWCT_WWISE_SWITCH_GROUP || type == eWCT_WWISE_GAME_STATE_GROUP)
  229. {
  230. if (auto childNode = node->first_node();
  231. childNode != nullptr)
  232. {
  233. AZStd::string childName;
  234. if (auto childNameAttr = childNode->first_attribute(Audio::WwiseXmlTags::WwiseNameAttribute, 0, false);
  235. childNameAttr != nullptr)
  236. {
  237. childName = childNameAttr->value();
  238. }
  239. IAudioSystemControl* childControl = GetControlByName(childName, false, control);
  240. if (!childControl)
  241. {
  242. childControl = CreateControl(SControlDef(
  243. childName, type == eWCT_WWISE_SWITCH_GROUP ? eWCT_WWISE_SWITCH : eWCT_WWISE_GAME_STATE, false, control));
  244. }
  245. control = childControl;
  246. }
  247. }
  248. if (control)
  249. {
  250. control->SetConnected(true);
  251. ++m_connectionsByID[control->GetId()];
  252. if (type == eWCT_WWISE_RTPC)
  253. {
  254. switch (atlControlType)
  255. {
  256. case EACEControlType::eACET_RTPC:
  257. {
  258. TRtpcConnectionPtr connection = AZStd::make_shared<CRtpcConnection>(control->GetId());
  259. float mult = 1.0f;
  260. float shift = 0.0f;
  261. if (auto multAttr = node->first_attribute(Audio::WwiseXmlTags::WwiseMutiplierAttribute, 0, false);
  262. multAttr != nullptr)
  263. {
  264. mult = AZStd::stof(AZStd::string(multAttr->value()));
  265. }
  266. if (auto shiftAttr = node->first_attribute(Audio::WwiseXmlTags::WwiseShiftAttribute, 0, false);
  267. shiftAttr != nullptr)
  268. {
  269. shift = AZStd::stof(AZStd::string(shiftAttr->value()));
  270. }
  271. connection->m_mult = mult;
  272. connection->m_shift = shift;
  273. return connection;
  274. }
  275. case EACEControlType::eACET_SWITCH_STATE:
  276. {
  277. TStateConnectionPtr connection = AZStd::make_shared<CStateToRtpcConnection>(control->GetId());
  278. float value = 0.0f;
  279. if (auto valueAttr = node->first_attribute(Audio::WwiseXmlTags::WwiseValueAttribute, 0, false);
  280. valueAttr != nullptr)
  281. {
  282. value = AZStd::stof(AZStd::string(valueAttr->value()));
  283. }
  284. connection->m_value = value;
  285. return connection;
  286. }
  287. case EACEControlType::eACET_ENVIRONMENT:
  288. {
  289. return AZStd::make_shared<IAudioConnection>(control->GetId());
  290. }
  291. }
  292. }
  293. else
  294. {
  295. return AZStd::make_shared<IAudioConnection>(control->GetId());
  296. }
  297. }
  298. }
  299. }
  300. return nullptr;
  301. }
  302. //-------------------------------------------------------------------------------------------//
  303. AZ::rapidxml::xml_node<char>* CAudioSystemEditor_wwise::CreateXMLNodeFromConnection(const TConnectionPtr connection, const EACEControlType atlControlType)
  304. {
  305. const IAudioSystemControl* control = GetControl(connection->GetID());
  306. if (control)
  307. {
  308. XmlAllocator& xmlAllocator(AudioControls::s_xmlAllocator);
  309. switch (control->GetType())
  310. {
  311. case AudioControls::eWCT_WWISE_SWITCH:
  312. [[fallthrough]];
  313. case AudioControls::eWCT_WWISE_SWITCH_GROUP:
  314. [[fallthrough]];
  315. case AudioControls::eWCT_WWISE_GAME_STATE:
  316. [[fallthrough]];
  317. case AudioControls::eWCT_WWISE_GAME_STATE_GROUP:
  318. {
  319. const IAudioSystemControl* parent = control->GetParent();
  320. if (parent)
  321. {
  322. AZStd::string_view parentType = TypeToTag(parent->GetType());
  323. auto switchNode = xmlAllocator.allocate_node(
  324. AZ::rapidxml::node_element,
  325. xmlAllocator.allocate_string(parentType.data())
  326. );
  327. auto switchNameAttr = xmlAllocator.allocate_attribute(
  328. Audio::WwiseXmlTags::WwiseNameAttribute,
  329. xmlAllocator.allocate_string(parent->GetName().c_str())
  330. );
  331. auto stateNode = xmlAllocator.allocate_node(
  332. AZ::rapidxml::node_element,
  333. Audio::WwiseXmlTags::WwiseValueTag
  334. );
  335. auto stateNameAttr = xmlAllocator.allocate_attribute(
  336. Audio::WwiseXmlTags::WwiseNameAttribute,
  337. xmlAllocator.allocate_string(control->GetName().c_str())
  338. );
  339. switchNode->append_attribute(switchNameAttr);
  340. stateNode->append_attribute(stateNameAttr);
  341. switchNode->append_node(stateNode);
  342. return switchNode;
  343. }
  344. break;
  345. }
  346. case AudioControls::eWCT_WWISE_RTPC:
  347. {
  348. auto connectionNode = xmlAllocator.allocate_node(
  349. AZ::rapidxml::node_element,
  350. xmlAllocator.allocate_string(TypeToTag(control->GetType()).data())
  351. );
  352. auto nameAttr = xmlAllocator.allocate_attribute(
  353. Audio::WwiseXmlTags::WwiseNameAttribute,
  354. xmlAllocator.allocate_string(control->GetName().c_str())
  355. );
  356. connectionNode->append_attribute(nameAttr);
  357. if (atlControlType == eACET_RTPC)
  358. {
  359. AZStd::shared_ptr<const CRtpcConnection> rtpcConnection = AZStd::static_pointer_cast<const CRtpcConnection>(connection);
  360. if (rtpcConnection->m_mult != 1.f)
  361. {
  362. auto multAttr = xmlAllocator.allocate_attribute(
  363. Audio::WwiseXmlTags::WwiseMutiplierAttribute,
  364. xmlAllocator.allocate_string(AZStd::to_string(rtpcConnection->m_mult).c_str())
  365. );
  366. connectionNode->append_attribute(multAttr);
  367. }
  368. if (rtpcConnection->m_shift != 0.f)
  369. {
  370. auto shiftAttr = xmlAllocator.allocate_attribute(
  371. Audio::WwiseXmlTags::WwiseShiftAttribute,
  372. xmlAllocator.allocate_string(AZStd::to_string(rtpcConnection->m_shift).c_str())
  373. );
  374. connectionNode->append_attribute(shiftAttr);
  375. }
  376. }
  377. else if (atlControlType == eACET_SWITCH_STATE)
  378. {
  379. AZStd::shared_ptr<const CStateToRtpcConnection> stateConnection = AZStd::static_pointer_cast<const CStateToRtpcConnection>(connection);
  380. auto valueAttr = xmlAllocator.allocate_attribute(
  381. Audio::WwiseXmlTags::WwiseValueAttribute,
  382. xmlAllocator.allocate_string(AZStd::to_string(stateConnection->m_value).c_str())
  383. );
  384. connectionNode->append_attribute(valueAttr);
  385. }
  386. return connectionNode;
  387. }
  388. case AudioControls::eWCT_WWISE_EVENT:
  389. [[fallthrough]];
  390. case AudioControls::eWCT_WWISE_AUX_BUS:
  391. {
  392. auto connectionNode = xmlAllocator.allocate_node(
  393. AZ::rapidxml::node_element,
  394. xmlAllocator.allocate_string(TypeToTag(control->GetType()).data())
  395. );
  396. auto nameAttr = xmlAllocator.allocate_attribute(
  397. Audio::WwiseXmlTags::WwiseNameAttribute,
  398. xmlAllocator.allocate_string(control->GetName().c_str())
  399. );
  400. connectionNode->append_attribute(nameAttr);
  401. return connectionNode;
  402. }
  403. case AudioControls::eWCT_WWISE_SOUND_BANK:
  404. {
  405. auto connectionNode = xmlAllocator.allocate_node(
  406. AZ::rapidxml::node_element,
  407. xmlAllocator.allocate_string(TypeToTag(control->GetType()).data())
  408. );
  409. auto nameAttr = xmlAllocator.allocate_attribute(
  410. Audio::WwiseXmlTags::WwiseNameAttribute,
  411. xmlAllocator.allocate_string(control->GetName().c_str())
  412. );
  413. connectionNode->append_attribute(nameAttr);
  414. if (control->IsLocalized())
  415. {
  416. auto locAttr = xmlAllocator.allocate_attribute(
  417. Audio::WwiseXmlTags::WwiseLocalizedAttribute,
  418. xmlAllocator.allocate_string("true")
  419. );
  420. connectionNode->append_attribute(locAttr);
  421. }
  422. return connectionNode;
  423. }
  424. }
  425. }
  426. return nullptr;
  427. }
  428. //-------------------------------------------------------------------------------------------//
  429. const AZStd::string_view CAudioSystemEditor_wwise::GetTypeIcon(TImplControlType type) const
  430. {
  431. switch (type)
  432. {
  433. case eWCT_WWISE_EVENT:
  434. return ":/Editor/WwiseIcons/event_nor.svg";
  435. case eWCT_WWISE_RTPC:
  436. return ":/Editor/WwiseIcons/gameparameter_nor.svg";
  437. case eWCT_WWISE_SWITCH:
  438. return ":/Editor/WwiseIcons/switch_nor.svg";
  439. case eWCT_WWISE_AUX_BUS:
  440. return ":/Editor/WwiseIcons/auxbus_nor.svg";
  441. case eWCT_WWISE_SOUND_BANK:
  442. return ":/Editor/WwiseIcons/soundbank_nor.svg";
  443. case eWCT_WWISE_GAME_STATE:
  444. return ":/Editor/WwiseIcons/state_nor.svg";
  445. case eWCT_WWISE_SWITCH_GROUP:
  446. return ":/Editor/WwiseIcons/switchgroup_nor.svg";
  447. case eWCT_WWISE_GAME_STATE_GROUP:
  448. return ":/Editor/WwiseIcons/stategroup_nor.svg";
  449. default:
  450. // should make a "default"/empty icon...
  451. return ":/Editor/WwiseIcons/switchgroup_nor.svg";
  452. }
  453. }
  454. const AZStd::string_view CAudioSystemEditor_wwise::GetTypeIconSelected(TImplControlType type) const
  455. {
  456. switch (type)
  457. {
  458. case eWCT_WWISE_EVENT:
  459. return ":/Editor/WwiseIcons/event_nor_hover.svg";
  460. case eWCT_WWISE_RTPC:
  461. return ":/Editor/WwiseIcons/gameparameter_nor_hover.svg";
  462. case eWCT_WWISE_SWITCH:
  463. return ":/Editor/WwiseIcons/switch_nor_hover.svg";
  464. case eWCT_WWISE_AUX_BUS:
  465. return ":/Editor/WwiseIcons/auxbus_nor_hover.svg";
  466. case eWCT_WWISE_SOUND_BANK:
  467. return ":/Editor/WwiseIcons/soundbank_nor_hover.svg";
  468. case eWCT_WWISE_GAME_STATE:
  469. return ":/Editor/WwiseIcons/state_nor_hover.svg";
  470. case eWCT_WWISE_SWITCH_GROUP:
  471. return ":/Editor/WwiseIcons/switchgroup_nor_hover.svg";
  472. case eWCT_WWISE_GAME_STATE_GROUP:
  473. return ":/Editor/WwiseIcons/stategroup_nor_hover.svg";
  474. default:
  475. // should make a "default"/empty icon...
  476. return ":/Editor/WwiseIcons/switchgroup_nor_hover.svg";
  477. }
  478. }
  479. //-------------------------------------------------------------------------------------------//
  480. EACEControlType CAudioSystemEditor_wwise::ImplTypeToATLType(TImplControlType type) const
  481. {
  482. switch (type)
  483. {
  484. case eWCT_WWISE_EVENT:
  485. return eACET_TRIGGER;
  486. case eWCT_WWISE_RTPC:
  487. return eACET_RTPC;
  488. case eWCT_WWISE_SWITCH:
  489. case eWCT_WWISE_GAME_STATE:
  490. return eACET_SWITCH_STATE;
  491. case eWCT_WWISE_AUX_BUS:
  492. return eACET_ENVIRONMENT;
  493. case eWCT_WWISE_SOUND_BANK:
  494. return eACET_PRELOAD;
  495. case eWCT_WWISE_GAME_STATE_GROUP:
  496. case eWCT_WWISE_SWITCH_GROUP:
  497. return eACET_SWITCH;
  498. }
  499. return eACET_NUM_TYPES;
  500. }
  501. //-------------------------------------------------------------------------------------------//
  502. TImplControlTypeMask CAudioSystemEditor_wwise::GetCompatibleTypes(EACEControlType atlControlType) const
  503. {
  504. switch (atlControlType)
  505. {
  506. case eACET_TRIGGER:
  507. return eWCT_WWISE_EVENT;
  508. case eACET_RTPC:
  509. return eWCT_WWISE_RTPC;
  510. case eACET_SWITCH:
  511. return (eWCT_WWISE_SWITCH | eWCT_WWISE_GAME_STATE);
  512. case eACET_SWITCH_STATE:
  513. return (eWCT_WWISE_SWITCH | eWCT_WWISE_GAME_STATE | eWCT_WWISE_RTPC);
  514. case eACET_ENVIRONMENT:
  515. return (eWCT_WWISE_AUX_BUS | eWCT_WWISE_RTPC);
  516. case eACET_PRELOAD:
  517. return eWCT_WWISE_SOUND_BANK;
  518. }
  519. return AUDIO_IMPL_INVALID_TYPE;
  520. }
  521. //-------------------------------------------------------------------------------------------//
  522. CID CAudioSystemEditor_wwise::GetID(const AZStd::string_view name) const
  523. {
  524. return Audio::AudioStringToID<CID>(name.data());
  525. }
  526. //-------------------------------------------------------------------------------------------//
  527. AZStd::string CAudioSystemEditor_wwise::GetName() const
  528. {
  529. return "Wwise";
  530. }
  531. //-------------------------------------------------------------------------------------------//
  532. void CAudioSystemEditor_wwise::UpdateConnectedStatus()
  533. {
  534. for (const auto& idCountPair : m_connectionsByID)
  535. {
  536. if (idCountPair.second > 0)
  537. {
  538. IAudioSystemControl* control = GetControl(idCountPair.first);
  539. if (control)
  540. {
  541. control->SetConnected(true);
  542. }
  543. }
  544. }
  545. }
  546. //-------------------------------------------------------------------------------------------//
  547. void CAudioSystemEditor_wwise::ConnectionRemoved(IAudioSystemControl* control)
  548. {
  549. int connectionCount = m_connectionsByID[control->GetId()] - 1;
  550. if (connectionCount <= 0)
  551. {
  552. connectionCount = 0;
  553. control->SetConnected(false);
  554. }
  555. m_connectionsByID[control->GetId()] = connectionCount;
  556. }
  557. //-------------------------------------------------------------------------------------------//
  558. AZ::IO::FixedMaxPath CAudioSystemEditor_wwise::GetDataPath() const
  559. {
  560. auto projectPath = AZ::IO::FixedMaxPath{ AZ::Utils::GetProjectPath() };
  561. return (projectPath / "sounds" / "wwise_project");
  562. }
  563. } // namespace AudioControls