MCPcopy Create free account
hub / github.com/Panzerschrek/Chasm-Reverse / LoadSound

Function LoadSound

PanzerChasm/sound/sounds_loader.cpp:138–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136} // namespace
137
138ISoundDataConstPtr LoadSound( const char* file_path, Vfs& vfs )
139{
140 Vfs::FileContent file_content= vfs.ReadFile( file_path );
141 if( file_content.empty() )
142 {
143 Log::Warning( "Can not load \"", file_path, "\"" );
144 return nullptr;
145 }
146
147 const char* const extension= ExtractExtension( file_path );
148
149 if( std::strcmp( extension, "WAV" ) == 0 ||
150 std::strcmp( extension, "wav" ) == 0 )
151 {
152 return ISoundDataConstPtr( new WavSoundData( file_content ) );
153 }
154 else // *.SFX, *.PCM, *.RAW files
155 return ISoundDataConstPtr( new RawPCMSoundData( std::move( file_content ) ) );
156
157 return nullptr;
158}
159
160ISoundDataConstPtr LoadRawMonsterSound( const Vfs::FileContent& raw_sound_data )
161{

Callers 3

SoundEngineMethod · 0.85
SetMapMethod · 0.85
PlayOneTimeSoundMethod · 0.85

Calls 2

ExtractExtensionFunction · 0.85
ReadFileMethod · 0.80

Tested by

no test coverage detected