| 1700 | } |
| 1701 | |
| 1702 | void 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 | |
| 1745 | void LoadBoxes() |
| 1746 | { |