summaryrefslogtreecommitdiff
path: root/src/MusicChunk.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-08-03 21:00:50 +0200
committerMax Kellermann <max@duempel.org>2013-08-03 21:37:56 +0200
commitd1e7b4e38136f9342aad76c685a13adf0e69f869 (patch)
tree49643b937ddfe735511b566a71398da5a945d7aa /src/MusicChunk.cxx
parent67f591a9ce60651da41afc499bd9a22e25314e35 (diff)
audio_format: convert to C++
Diffstat (limited to 'src/MusicChunk.cxx')
-rw-r--r--src/MusicChunk.cxx21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/MusicChunk.cxx b/src/MusicChunk.cxx
index 55d2f7f30..fb9019988 100644
--- a/src/MusicChunk.cxx
+++ b/src/MusicChunk.cxx
@@ -19,7 +19,7 @@
#include "config.h"
#include "MusicChunk.hxx"
-#include "audio_format.h"
+#include "AudioFormat.hxx"
#include "Tag.hxx"
#include <assert.h>
@@ -31,22 +31,21 @@ music_chunk::~music_chunk()
#ifndef NDEBUG
bool
-music_chunk::CheckFormat(const struct audio_format &other_format) const
+music_chunk::CheckFormat(const AudioFormat other_format) const
{
- assert(audio_format_valid(&other_format));
+ assert(other_format.IsValid());
- return length == 0 ||
- audio_format_equals(&audio_format, &other_format);
+ return length == 0 || audio_format == other_format;
}
#endif
void *
-music_chunk::Write(const struct audio_format &af,
+music_chunk::Write(const AudioFormat af,
float data_time, uint16_t _bit_rate,
size_t *max_length_r)
{
assert(CheckFormat(af));
- assert(length == 0 || audio_format_valid(&audio_format));
+ assert(length == 0 || audio_format.IsValid());
if (length == 0) {
/* if the chunk is empty, nobody has set bitRate and
@@ -56,7 +55,7 @@ music_chunk::Write(const struct audio_format &af,
times = data_time;
}
- const size_t frame_size = audio_format_frame_size(&af);
+ const size_t frame_size = af.GetFrameSize();
size_t num_frames = (sizeof(data) - length) / frame_size;
if (num_frames == 0)
return NULL;
@@ -70,12 +69,12 @@ music_chunk::Write(const struct audio_format &af,
}
bool
-music_chunk::Expand(const struct audio_format &af, size_t _length)
+music_chunk::Expand(const AudioFormat af, size_t _length)
{
- const size_t frame_size = audio_format_frame_size(&af);
+ const size_t frame_size = af.GetFrameSize();
assert(length + _length <= sizeof(data));
- assert(audio_format_equals(&audio_format, &af));
+ assert(audio_format == af);
length += _length;