CSDLMixerProjectLoader::CSDLMixerProjectLoader(const string& sAssetsPath, IAudioSystemEditor* pAudioSystemImpl) : m_pAudioSystemImpl(pAudioSystemImpl) { _finddata_t fd; ICryPak* pCryPak = gEnv->pCryPak; intptr_t handle = pCryPak->FindFirst(sAssetsPath + "/*.*", &fd); if (handle != -1) { do { const string name = fd.name; if (name != "." && name != ".." && !name.empty()) { if (name.find(".wav") != string::npos || name.find(".ogg") != string::npos /*|| name.find(".mp3") != string::npos*/) { // Create the event with the same name as the file m_pAudioSystemImpl->CreateControl(SControlDef(name, eSDLMT_EVENT)); } } } while (pCryPak->FindNext(handle, &fd) >= 0); pCryPak->FindClose(handle); } }
TConnectionPtr CAudioSystemEditor_wwise::CreateConnectionFromXMLNode(XmlNodeRef pNode, EACEControlType eATLControlType) { if (pNode) { const string sTag = pNode->getTag(); TImplControlType type = TagToType(sTag); if (type != AUDIO_IMPL_INVALID_TYPE) { string sName = pNode->getAttr("wwise_name"); string sLocalised = pNode->getAttr("wwise_localised"); bool bLocalised = (sLocalised.compareNoCase("true") == 0); // If control not found, create a placeholder. // We want to keep that connection even if it's not in the middleware. // The user could be using the engine without the wwise project IAudioSystemControl* pControl = GetControlByName(sName, bLocalised); if (pControl == nullptr) { pControl = CreateControl(SControlDef(sName, type)); if (pControl) { pControl->SetPlaceholder(true); pControl->SetLocalised(bLocalised); } } // If it's a switch we actually connect to one of the states within the switch if (type == eWCT_WWISE_SWITCH_GROUP || type == eWCT_WWISE_GAME_STATE_GROUP) { if (pNode->getChildCount() == 1) { pNode = pNode->getChild(0); if (pNode) { string sChildName = pNode->getAttr("wwise_name"); IAudioSystemControl* pChildControl = GetControlByName(sChildName, false, pControl); if (pChildControl == nullptr) { pChildControl = CreateControl(SControlDef(sChildName, type == eWCT_WWISE_SWITCH_GROUP ? eWCT_WWISE_SWITCH : eWCT_WWISE_GAME_STATE, false, pControl)); } pControl = pChildControl; } } else { CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_ERROR, "Audio Controls Editor (Wwise): Error reading connection to Wwise control %s", sName); } } if (pControl) { pControl->SetConnected(true); ++m_connectionsByID[pControl->GetId()]; if (type == eWCT_WWISE_RTPC) { switch (eATLControlType) { case EACEControlType::eACET_RTPC: { TRtpcConnectionPtr pConnection = std::make_shared<CRtpcConnection>(pControl->GetId()); float mult = 1.0f; float shift = 0.0f; if (pNode->haveAttr("atl_mult")) { const string sProperty = pNode->getAttr("atl_mult"); mult = (float)std::atof(sProperty.c_str()); } if (pNode->haveAttr("atl_shift")) { const string sProperty = pNode->getAttr("atl_shift"); shift = (float)std::atof(sProperty.c_str()); } pConnection->fMult = mult; pConnection->fShift = shift; return pConnection; } case EACEControlType::eACET_SWITCH_STATE: { TStateConnectionPtr pConnection = std::make_shared<CStateToRtpcConnection>(pControl->GetId()); float value = 0.0f; if (pNode->haveAttr("atl_mult")) { const string sProperty = pNode->getAttr("wwise_value"); value = (float)std::atof(sProperty.c_str()); } pConnection->fValue = value; return pConnection; } } } else { return std::make_shared<IAudioConnection>(pControl->GetId()); } } } } return nullptr; }