///////////////////////////////////////////////////////
| 186 | |
| 187 | //////////////////////////////////////////////////////////// |
| 188 | std::uint64_t SoundFileReaderWav::read(std::int16_t* samples, std::uint64_t maxCount) |
| 189 | { |
| 190 | assert(m_decoder && "wav decoder not initialized. Call SoundFileReaderWav::open() to initialize it."); |
| 191 | |
| 192 | std::uint64_t framesRead{}; |
| 193 | |
| 194 | if (const ma_result result = ma_decoder_read_pcm_frames(&*m_decoder, samples, maxCount / m_channelCount, &framesRead); |
| 195 | result != MA_SUCCESS) |
| 196 | err() << "Failed to read from wav sound stream: " << ma_result_description(result) << std::endl; |
| 197 | |
| 198 | return framesRead * m_channelCount; |
| 199 | } |
| 200 | |
| 201 | } // namespace sf::priv |