WMA Reader bug with 6 channels files



I’m starting using WMA reader and I noticed that for instance, if you try to read 65536 samples of a 6 channels WMA file, the read will never succeed (endless loop as bufferStart gets superior to bufferEnd and not every samples have been read), as the read function assumes that the buffer size should be a multiple of 2 (number of bytes for 16 bits) x number of channels.
A power of two is quite common for I/O, so I guess it would make sense to do the appropriate re-buffering and then allow something similar to the other AudioFormat readers



well changing the following code at the end of the while loop in the readSample() function,

bufferStart += numToDo * stride; startOffsetInDestBuffer += numToDo; numSamples -= numToDo; currentPosition += numToDo;

into this one:

bufferStart += numToDo * stride; if(bufferEnd - bufferStart < stride) bufferStart = bufferEnd; startOffsetInDestBuffer += numToDo; numSamples -= numToDo; currentPosition += numToDo;

should do the job


…almost, still something messing out in the playback result, will check that on tuesday.


Jules, I fixed a few issues in this WindowsMediaReader, I sent you the file.


… and by the way, I used the 5.1 WMA/WMV samples from this website to do my tests: