Fixed OpenMtpDecoder::Exhausted() and cleaned up a couple compile

warnings.
This commit is contained in:
casey langen 2020-06-25 14:58:06 -07:00
parent 08cc42a9d0
commit 4bde6a33ea

View File

@ -127,8 +127,11 @@ bool OpenMptDecoder::GetBuffer(IBuffer *target) {
target->SetSampleRate(kSampleRate); target->SetSampleRate(kSampleRate);
target->SetSamples(kSamplesPerChannel * kChannels); target->SetSamples(kSamplesPerChannel * kChannels);
int samplesWritten = openmpt_module_read_interleaved_float_stereo( int samplesWritten = (int) openmpt_module_read_interleaved_float_stereo(
this->module, kSampleRate, kSamplesPerChannel, target->BufferPointer()); this->module,
(int32_t) kSampleRate,
(size_t) kSamplesPerChannel,
target->BufferPointer());
if (samplesWritten > 0) { if (samplesWritten > 0) {
target->SetSamples(samplesWritten * kChannels); target->SetSamples(samplesWritten * kChannels);
@ -140,5 +143,8 @@ bool OpenMptDecoder::GetBuffer(IBuffer *target) {
} }
bool OpenMptDecoder::Exhausted() { bool OpenMptDecoder::Exhausted() {
return false; if (this->module) {
return openmpt_module_get_position_seconds(this->module) >= this->GetDuration();
}
return true;
} }