I’m running into some odd assertion fails when playing an audio file through a VoiceSamplePlayerRef. It seems to happen with around 50% of the .wavs i have tried. In release mode it behaves well and sounds fine but im suspicious of the crash in debug so wanted to raise awareness of it. It is the same assertion failure as this post but seems to be triggered by something else. It was always at the end of the sample regardless of if it was looping or not.
|fatal | cinder::audio::BufferT<float>::copyOffset[156] *** Assertion Failed *** | expression: ( otherFrameOffset + numFrames <= other.getNumFrames() )
I noticed the code block on line 143 in FileMediaFoundation.cpp (“Whoops etc” shown below) was getting called just before the assertion which may or may not be related.
I couldnt understand why some wavs worked and others didnt, it seemed arbitrary, any thoughts ( @rich.e )?
Windows 64x
Latest cinder master branch
mReadBufferPos = 0;
bool endOfFile;
size_t outNumFrames = processNextReadSample( &endOfFile );
if( ! outNumFrames ) {
if( endOfFile ) {
// Whoops, IMFSourceReader::ReadSample() must of reported EOF before we reached the expected number of frames. I've seen this happen with mp3s.
// - so we'll just zero out the remaining frames, so the SourceFile receives the expected number of frames as reported when parsing the header.
mReadBuffer.zero();
outNumFrames = numFramesNeeded - readCount;
}
else {
CI_LOG_W( "Could not read the expected number of samples: " << numFramesNeeded << ", readCount: " << readCount );
break;
}
}