pipi7817 / as3wavsound

Automatically exported from code.google.com/p/as3wavsound
Other
0 stars 0 forks source link

Odd-length .wav files throw error in constructor #15

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Constructing a WavSound instance with odd-length WAV data throws an exception.

Here is sample code that will reproduce the problem:

var wavLoader:URLLoader = new URLLoader();
wavLoader.dataFormat = URLLoaderDataFormat.BINARY;
wavLoader.load(new URLRequest(
    "http://media.merriam-webster.com/soundc11/b/bootes01.wav"));
wavLoader.addEventListener(Event.COMPLETE, function(evt:*):void {
    var sound:WavSound = new WavSound(wavLoader.data as ByteArray);
});

Expected: the constructor returns and the WavSound object is playable.

Instead: an exception is thrown:

    Error: Error #2030: End of file was encountered.

Original issue reported on code.google.com by JonDis...@gmail.com on 30 Aug 2012 at 5:07

GoogleCodeExporter commented 9 years ago
Found this too.
the problem is in LIST.as around line 56.
I too had a WAV file and at the end of the file, there were only 2 bytes left. 
Four are expected so that causes the error.

Original comment by Archeme...@gmail.com on 23 May 2013 at 11:42