summaryrefslogtreecommitdiff
path: root/src/MusicChunk.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-28 17:10:12 +0100
committerMax Kellermann <max@duempel.org>2013-10-28 17:10:12 +0100
commitde1261ba28fbf88a31fda1483578130030a464d5 (patch)
treec69c2f2f2b15193fd6a249e7a8d97637026d0eda /src/MusicChunk.cxx
parent5ee5a89a7f4e765be0a059bc8e66c16c443484b6 (diff)
MusicChunk: return WritableBuffer
Diffstat (limited to 'src/MusicChunk.cxx')
-rw-r--r--src/MusicChunk.cxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/MusicChunk.cxx b/src/MusicChunk.cxx
index 1d6081a9e..2d20ac7ac 100644
--- a/src/MusicChunk.cxx
+++ b/src/MusicChunk.cxx
@@ -39,10 +39,9 @@ music_chunk::CheckFormat(const AudioFormat other_format) const
}
#endif
-void *
+WritableBuffer<void>
music_chunk::Write(const AudioFormat af,
- float data_time, uint16_t _bit_rate,
- size_t *max_length_r)
+ float data_time, uint16_t _bit_rate)
{
assert(CheckFormat(af));
assert(length == 0 || audio_format.IsValid());
@@ -58,14 +57,13 @@ music_chunk::Write(const AudioFormat af,
const size_t frame_size = af.GetFrameSize();
size_t num_frames = (sizeof(data) - length) / frame_size;
if (num_frames == 0)
- return nullptr;
+ return WritableBuffer<void>::Null();
#ifndef NDEBUG
audio_format = af;
#endif
- *max_length_r = num_frames * frame_size;
- return data + length;
+ return { data + length, num_frames * frame_size };
}
bool