//! only used internally, locked in caller's scope size_t CSound::GetWaveId(const std::string& path, bool hardFail) { if (sources.empty()) return 0; const size_t id = SoundBuffer::GetId(path); return (id == 0) ? LoadALBuffer(path, hardFail) : id; }
ALuint COpenALSound::GetWaveId(const string& path, bool _hardFail) { map<string, ALuint>::const_iterator it = soundMap.find(path); if (it != soundMap.end()) { return it->second; } hardFail = _hardFail; const ALuint buffer = LoadALBuffer(path); soundMap[path] = buffer; return buffer; }
ALuint COpenALSound::GetWaveId(const string& path) { int count = 0; ALuint buffer; for (vector<string>::iterator it = LoadedFiles.begin(); it != LoadedFiles.end(); it++,count++) { if (*it == path) return Buffers.at(count); } buffer = LoadALBuffer(path); Buffers.push_back(buffer); LoadedFiles.push_back(path); return buffer; }