VFmodEvent* RPG_VisionEffectHelper::PlayFmodSoundEvent(VString const& eventGroupName, VString const& eventName, hkvVec3 const& position /*= hkvVec3(0.0f,0.0f,0.0f)*/, int flags/*=VFMOD_FLAG_NONE*/) { VASSERT(!eventGroupName.IsEmpty()); // Name of the event group, relative to the event project VASSERT(!eventName.IsEmpty()); // name of the event, relative to the parent event-group VString const& eventProjectPath = RPG_GameManager::s_instance.GetFmodEventProject(); VASSERT_MSG(!eventProjectPath.IsEmpty(), "Please ensure that GameManager::FMOD_EVENT_PROJECT points to a valid FMOD project file."); #if (defined _DEBUG) && !(RPG_FMOD_SUPPRESS_NONNULL_ASSERTS) // @for testing only: validate the project filename FMOD::EventProject* pEventProject = VFmodManager::GlobalManager().LoadEventProject(eventProjectPath.AsChar()); VASSERT_MSG(pEventProject, eventProjectPath.AsChar()); #endif // load event group VFmodEventGroup *pEventGroup = VFmodManager::GlobalManager().LoadEventGroup(eventProjectPath.AsChar(), eventGroupName.AsChar()); #if !(RPG_FMOD_SUPPRESS_NONNULL_ASSERTS) VASSERT_MSG(pEventGroup && pEventGroup->IsValid(), eventGroupName.AsChar()); #endif if (pEventGroup && pEventGroup->IsValid()) { // create event instance VFmodEvent *pEvent = pEventGroup->CreateEvent(eventName.AsChar(), position, flags); VASSERT_MSG(pEvent && pEvent->IsValid(), eventName.AsChar()); return pEvent; } return NULL; }
bool RPG_VisionEffectHelper::LoadFmodEventGroup(VString const& eventGroupName) { VString const& eventProjectPath = RPG_GameManager::s_instance.GetFmodEventProject(); VASSERT_MSG(!eventProjectPath.IsEmpty(), "Please ensure that GameManager::FMOD_EVENT_PROJECT points to a valid FMOD project file."); VFmodEventGroup *pEventGroup = VFmodManager::GlobalManager().LoadEventGroup(eventProjectPath.AsChar(), eventGroupName.AsChar()); VASSERT_MSG(pEventGroup && pEventGroup->IsValid(), eventGroupName.AsChar()); return pEventGroup->IsValid(); }