MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / getIndex

Function getIndex

TheForceEngine/TFE_Asset/vocAsset.cpp:85–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83 }
84
85 s32 getIndex(const char* name)
86 {
87 VocMap::iterator iVoc = s_vocAssets.find(name);
88 if (iVoc != s_vocAssets.end())
89 {
90 return (s32)iVoc->second->id;
91 }
92
93 // It doesn't exist yet, try to load the font.
94 if (!loadSoundFile(name))
95 {
96 return -1;
97 }
98
99 SoundBuffer* voc = new SoundBuffer;
100 if (!parseVoc(voc))
101 {
102 delete voc;
103 return -1;
104 }
105
106 s_vocAssets[name] = voc;
107 voc->id = (u32)s_vocAssetList.size();
108 s_vocAssetList.push_back(voc);
109 return (s32)voc->id;
110 }
111
112 SoundBuffer* getFromIndex(s32 index)
113 {

Callers

nothing calls this directly

Calls 5

loadSoundFileFunction · 0.85
parseVocFunction · 0.85
push_backMethod · 0.80
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected