WMA Reader bug with 6 channels files


#1

Hello

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

Thanks,
Cheers


#2

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


#3

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


#4

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


#5

… and by the way, I used the 5.1 WMA/WMV samples from this website to do my tests:
http://www.diatonis.com/surround_sound_music.html