MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / LoadSamples

Function LoadSamples

TombEngine/Specific/level.cpp:1702–1743  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1700}
1701
1702void LoadSamples()
1703{
1704 TENLog("Loading samples... ", LogLevel::Info);
1705
1706 int soundMapSize = ReadInt16();
1707 TENLog("Sound map size: " + std::to_string(soundMapSize), LogLevel::Info);
1708
1709 g_Level.SoundMap.resize(soundMapSize);
1710 ReadBytes(g_Level.SoundMap.data(), soundMapSize * sizeof(short));
1711
1712 int sampleInfoCount = ReadCount();
1713 if (!sampleInfoCount)
1714 {
1715 TENLog("No samples were found or loaded.", LogLevel::Warning);
1716 return;
1717 }
1718
1719 TENLog("Sample info count: " + std::to_string(sampleInfoCount), LogLevel::Info);
1720
1721 g_Level.SoundDetails.resize(sampleInfoCount);
1722 ReadBytes(g_Level.SoundDetails.data(), sampleInfoCount * sizeof(SampleInfo));
1723
1724 int sampleCount = ReadCount();
1725 if (sampleCount <= 0)
1726 return;
1727
1728 TENLog("Sample count: " + std::to_string(sampleCount), LogLevel::Info);
1729
1730 std::vector<char> buffer;
1731 buffer.reserve(2 * 1024 * 1024);
1732
1733 for (int i = 0; i < sampleCount; i++)
1734 {
1735 int uncompressedSize = ReadInt32();
1736 int compressedSize = ReadInt32();
1737
1738 buffer.resize(compressedSize);
1739
1740 ReadBytes(buffer.data(), compressedSize);
1741 LoadSample(buffer.data(), compressedSize, uncompressedSize, i);
1742 }
1743}
1744
1745void LoadBoxes()
1746{

Callers 1

LoadLevelFunction · 0.85

Calls 10

TENLogFunction · 0.85
ReadInt16Function · 0.85
to_stringFunction · 0.85
ReadBytesFunction · 0.85
ReadCountFunction · 0.85
ReadInt32Function · 0.85
LoadSampleFunction · 0.85
resizeMethod · 0.45
dataMethod · 0.45
reserveMethod · 0.45

Tested by

no test coverage detected