Codechange: Implement SoundLoader interface and cache loaded sounds in memory.

Sounds are loaded into memory on first use, using the SoundLoader interface to support format conversion. Sounds are retained in memory to avoid reloading every time a sound is played.

This deduplicates WAV header parsing between NewGRF and baseset sounds, and will allow different audio formats to be supported.
This commit is contained in:
Peter Nelson
2023-11-27 18:39:57 +00:00
committed by Peter Nelson
parent 7e8bcf44f7
commit ce5279a8dc
13 changed files with 339 additions and 179 deletions
+1
View File
@@ -7914,6 +7914,7 @@ static void LoadGRFSound(size_t offs, SoundEntry *sound)
/* Sound is present in the NewGRF. */
sound->file = _cur.file;
sound->file_offset = offs;
sound->source = SoundSource::NewGRF;
sound->grf_container_ver = _cur.file->GetContainerVersion();
}
}