MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / openSoundFile

Function openSoundFile

plugins/sound/SoundManager.cpp:29–49  ·  view source on GitHub ↗

Load the given file, trying different extensions (first OGG, then WAV) as fallback

Source from the content-addressed store, hash-verified

27
28// Load the given file, trying different extensions (first OGG, then WAV) as fallback
29ArchiveFilePtr openSoundFile(const std::string& fileName)
30{
31 // Try to open the file as it is
32 auto file = GlobalFileSystem().openFile(fileName);
33
34 if (file)
35 {
36 // File found, play it
37 return file;
38 }
39
40 file = GlobalFileSystem().openFile(os::replaceExtension(fileName, ".ogg"));
41
42 if (file)
43 {
44 return file;
45 }
46
47 // Try to open the file with .wav extension
48 return GlobalFileSystem().openFile(os::replaceExtension(fileName, ".wav"));
49}
50
51}
52

Callers 2

playSoundMethod · 0.85
getSoundFileDurationMethod · 0.85

Calls 2

replaceExtensionFunction · 0.85
openFileMethod · 0.45

Tested by

no test coverage detected