| 149 | } |
| 150 | |
| 151 | Audio::IAudioSource* AudioSampleTable::LoadSample(uint32_t index) const |
| 152 | { |
| 153 | Audio::IAudioSource* result{}; |
| 154 | if (index < _entries.size()) |
| 155 | { |
| 156 | auto& entry = _entries[index]; |
| 157 | if (entry.Asset) |
| 158 | { |
| 159 | auto stream = entry.Asset->GetStream(); |
| 160 | if (stream != nullptr) |
| 161 | { |
| 162 | auto& audioContext = GetContext()->GetAudioContext(); |
| 163 | if (entry.PathIndex) |
| 164 | { |
| 165 | auto originalPosition = stream->GetPosition(); |
| 166 | auto numSounds = stream->ReadValue<uint32_t>(); |
| 167 | stream->SetPosition(originalPosition); |
| 168 | |
| 169 | if (*entry.PathIndex >= numSounds) |
| 170 | { |
| 171 | auto& ui = GetContext()->GetUiContext(); |
| 172 | ui.ShowMessageBox(FormatStringID( |
| 173 | STR_AUDIO_FILE_TRUNCATED, entry.Asset->GetPath().c_str(), *entry.PathIndex, numSounds)); |
| 174 | } |
| 175 | |
| 176 | result = audioContext.CreateStreamFromCSS(std::move(stream), *entry.PathIndex); |
| 177 | } |
| 178 | else |
| 179 | { |
| 180 | result = audioContext.CreateStreamFromWAV(std::move(stream)); |
| 181 | } |
| 182 | } |
| 183 | } |
| 184 | } |
| 185 | return result; |
| 186 | } |
| 187 | |
| 188 | int32_t AudioSampleTable::GetSampleModifier(uint32_t index) const |
| 189 | { |
no test coverage detected