Skip to content

Commit 536b640

Browse files
authored
Merge pull request #3456 from musicinmybrain/dr_wav-0.14
Update dr_wav to 0.14, adapting to API changes
2 parents 14f9507 + 9eada22 commit 536b640

4 files changed

Lines changed: 331 additions & 140 deletions

File tree

src/decoder_drwav.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,21 @@ drwav_bool32 seek_func(void* userdata, int offset, drwav_seek_origin origin) {
5252
return DRWAV_TRUE;
5353
}
5454

55+
drwav_bool32 tell_func(void* userdata, drwav_int64* cursor) {
56+
auto* f = reinterpret_cast<Filesystem_Stream::InputStream*>(userdata);
57+
58+
*cursor = f->GetPosition();
59+
60+
return DRWAV_TRUE;
61+
}
62+
5563
bool DrWavDecoder::Open(Filesystem_Stream::InputStream stream_) {
5664
this->stream = std::move(stream_);
65+
#if DRWAV_VERSION_MINOR < 14
5766
init = drwav_init_ex(&handle, read_func, seek_func, nullptr, &this->stream, nullptr, DRWAV_SEQUENTIAL, nullptr) == DRWAV_TRUE;
67+
#else
68+
init = drwav_init_ex(&handle, read_func, seek_func, tell_func, nullptr, &this->stream, nullptr, DRWAV_SEQUENTIAL, nullptr) == DRWAV_TRUE;
69+
#endif
5870
return init;
5971
}
6072

0 commit comments

Comments
 (0)