| 136 | } // namespace |
| 137 | |
| 138 | ISoundDataConstPtr 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 | |
| 160 | ISoundDataConstPtr LoadRawMonsterSound( const Vfs::FileContent& raw_sound_data ) |
| 161 | { |
no test coverage detected