| 10 | namespace engine::audio { |
| 11 | namespace { |
| 12 | |
| 13 | class ReadOnlyMemoryStreamBuffer final : public std::streambuf { |
| 14 | public: |
| 15 | explicit ReadOnlyMemoryStreamBuffer(std::string_view data) { |
| 16 | // std::streambuf::setg takes char*, but this input stream only reads from the buffer. |
| 17 | auto * begin = const_cast<char *>(data.data()); |
| 18 | setg(begin, begin, begin + data.size()); |
| 19 | } |
| 20 | |
| 21 | protected: |
| 22 | pos_type seekoff(off_type offset, std::ios_base::seekdir dir, std::ios_base::openmode which) override { |