//------------------------------------------------------------------------// bool MusicManager::LoadSegment(ScriptNode* pNode) { FN("MusicManager::LoadSegment()"); // We use string ids in this scripting system if(pNode->GetDataType() != Script::STRING) return Error::Handle("No id found for sound identifier"); // Make sure the segment ID doesn't already exist ISegmentMap::iterator itr = m_SegmentMap.find(pNode->GetString()); if(itr != m_SegmentMap.end()) return true; SegmentInit init; ScriptNode* pChildNode = pNode->GetChild(); init.m_pDLS = m_pCurrentDLS; while(pChildNode) { if(MUSMGR_STRCMP(pChildNode->GetName(), "FileName") == 0) init.m_sFileName = pChildNode->GetString(); else if(MUSMGR_STRCMP(pChildNode->GetName(), "Looping") == 0) init.m_bLooping = pChildNode->GetBool(); else if(MUSMGR_STRCMP(pChildNode->GetName(), "Music") == 0) init.m_bMusic = pChildNode->GetBool(); else if(MUSMGR_STRCMP(pChildNode->GetName(), "DLS") == 0) { IDLSMap::iterator itr = m_DLSMap.find(pChildNode->GetString()); if(itr != m_DLSMap.end()) init.m_pDLS = itr->second; } pChildNode = pChildNode->GetSibling(); } ISegment* pSegment; if(!AudioMgr()->CreateSegment(pSegment)) return false; if(!pSegment->Init(init)) return false; // Insert the segment into the map m_SegmentMap.insert(make_pair(pNode->GetString(), pSegment)); return true; }