* Read bytes into a MidiFile::DataBlock. * @param[out] dest DataBlock to copy into * @param length number of bytes to read * @return true if the requested number of bytes were available */
| 156 | * @return true if the requested number of bytes were available |
| 157 | */ |
| 158 | bool ReadDataBlock(MidiFile::DataBlock *dest, size_t length) |
| 159 | { |
| 160 | if (this->IsEnd()) return false; |
| 161 | if (this->buf.size() - this->pos < length) return false; |
| 162 | dest->data.insert(dest->data.end(), std::begin(this->buf) + this->pos, std::begin(this->buf) + this->pos + length); |
| 163 | this->pos += length; |
| 164 | return true; |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * Skip over a number of bytes in the buffer. |