@@ -84,10 +84,15 @@ bool Sample::load() | |||||
return false; | return false; | ||||
} | } | ||||
// Fix for misinformation using libsndfile | |||||
if (info.frames % info.channels) | |||||
--info.frames; | |||||
const ssize_t r = ad_read(handle, rbuffer, info.frames); | const ssize_t r = ad_read(handle, rbuffer, info.frames); | ||||
if (r+1 < info.frames) | |||||
if (r != info.frames) | |||||
{ | { | ||||
carla_stderr2("sfzero::Sample::load() - failed to read complete file: " P_SSIZE " vs " P_INT64, r, info.frames); | |||||
if (r != 0) | |||||
carla_stderr2("sfzero::Sample::load() - failed to read complete file: " P_SSIZE " vs " P_INT64, r, info.frames); | |||||
ad_close(handle); | ad_close(handle); | ||||
return false; | return false; | ||||
} | } | ||||
@@ -199,6 +199,10 @@ public: | |||||
if (fFileNfo.frames == 0) | if (fFileNfo.frames == 0) | ||||
carla_stderr("L: filename \"%s\" has 0 frames", filename); | carla_stderr("L: filename \"%s\" has 0 frames", filename); | ||||
// Fix for misinformation using libsndfile | |||||
if (fFileNfo.frames % fFileNfo.channels) | |||||
--fFileNfo.frames; | |||||
if ((fFileNfo.channels == 1 || fFileNfo.channels == 2) && fFileNfo.frames > 0) | if ((fFileNfo.channels == 1 || fFileNfo.channels == 2) && fFileNfo.frames > 0) | ||||
{ | { | ||||
// valid | // valid | ||||
@@ -350,7 +350,8 @@ public: | |||||
carla_zeroStruct(midiEvent); | carla_zeroStruct(midiEvent); | ||||
tmpSize = needle - dataRead; | tmpSize = needle - dataRead; | ||||
CARLA_SAFE_ASSERT_RETURN(tmpSize > 0 && tmpSize < 24,); | |||||
CARLA_SAFE_ASSERT_RETURN(tmpSize > 0,); | |||||
CARLA_SAFE_ASSERT_RETURN(tmpSize < 24,); | |||||
std::strncpy(tmpBuf, dataRead, static_cast<size_t>(tmpSize)); | std::strncpy(tmpBuf, dataRead, static_cast<size_t>(tmpSize)); | ||||
tmpBuf[tmpSize] = '\0'; | tmpBuf[tmpSize] = '\0'; | ||||