-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array index is out of range #7
Comments
I found the same issue, I found that it is tied to seeking (changing the Time/Position property) and then decoding, but tend to be kinda random - seeking directly to problematic position from the beginning won't trigger it. Most reliable way to reproduce this is seeking backwards and decoding a few hundred/thousand samples forwards. It tends to throw the exception sooner or later. When used in application, I noticed it sometimes doesn't throw an exception, but instead produces silence or glitchy audio. Here's the code I used to trigger the error: `
|
Was anyone able to find a fix for this? |
After toying with the Position getter, it appears that in my case this issue only happens when I tried to seek backward from the "max loaded Position". For example, if the playback is at Position 10 and I tried to seek to Position 15, it plays fine. But if I take the Position back to anything below 15, the audio starts glitching out (and exceptions are thrown) until the playback gets above 15; in which the audio starts to play fine again. As for now, my workaround is by disposing the old MpegFile instance and read samples from a new one whenever a backward seek is done to ensure the "max loaded Position" gets reset. public void SeekTo (long position)
{
long _position = position * sizeof(float) * mpegFile.Channels;
if (_position < mpegFile.Position)
{
mpegFile.Dispose();
mpegFile = new MpegFile(filePath);
}
mpegFile.Position = _position;
} Although it's not a really viable solution as it does unneeded operations, but at least it works for my case until this problem is fixed. |
I found the same issue, It seems to be related to mp3 files. |
I'm getting:
after loading a mpeg stream into mpegfile and calling read samples with a float[]. I'm not sure what's going on in the dequantize function so I'm at a loss on how to fix this. I'd love your help!
The text was updated successfully, but these errors were encountered: