MusicChunk: add method ReadData()
This commit is contained in:
parent
4beedec3ad
commit
f59f17013d
|
@ -127,6 +127,10 @@ struct MusicChunk : MusicChunkInfo {
|
||||||
* @return true if the chunk is full
|
* @return true if the chunk is full
|
||||||
*/
|
*/
|
||||||
bool Expand(AudioFormat af, size_t length) noexcept;
|
bool Expand(AudioFormat af, size_t length) noexcept;
|
||||||
|
|
||||||
|
std::span<const std::byte> ReadData() const noexcept {
|
||||||
|
return {data, length};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(MusicChunk) == CHUNK_SIZE, "Wrong size");
|
static_assert(sizeof(MusicChunk) == CHUNK_SIZE, "Wrong size");
|
||||||
|
|
|
@ -122,7 +122,7 @@ AudioOutputSource::GetChunkData(const MusicChunk &chunk,
|
||||||
assert(!chunk.IsEmpty());
|
assert(!chunk.IsEmpty());
|
||||||
assert(chunk.CheckFormat(in_audio_format));
|
assert(chunk.CheckFormat(in_audio_format));
|
||||||
|
|
||||||
std::span<const std::byte> data(chunk.data, chunk.length);
|
auto data = chunk.ReadData();
|
||||||
|
|
||||||
assert(data.size() % in_audio_format.GetFrameSize() == 0);
|
assert(data.size() % in_audio_format.GetFrameSize() == 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue