soundtouch-as3 icon indicating copy to clipboard operation
soundtouch-as3 copied to clipboard

StandingWave 2 crashes at end of SoundTouchFilter source

Open also opened this issue 15 years ago • 1 comments

Using StandingWave's AudioSampleHandler class, when the player reaches the end of the source, SoundTouchFilter returns a Sample with a length less than requested. This results in an exception like:

RangeError: Error #1125: The index 3614 is out of range 3614.
    at com.noteflight.standingwave2.output::AudioSampleHandler/handleSampleData()[/Users/ryan/work/standingwave/main/src/com/noteflight/standingwave2/output/AudioSampleHandler.as:164]
    at com.noteflight.standingwave2.output::AudioPlayer/handleSampleData()[/Users/ryan/work/standingwave/main/src/com/noteflight/standingwave2/output/AudioPlayer.as:112]

In StandingWave, the length of an IAudioSource is provided by the frameCount property. SoundTouchFilter returns Number.MAX_VALUE, as the precise frame count is difficult to calculate, and changes when the filter's parameters are adjusted. As a result, AudioSampleHandler/handleSampleData() does not expect the source to ever end, and does not handle the short final sample.

also avatar Jan 31 '10 21:01 also

http://gist.github.com/291245 is a patch for StandingWave 2 that allows it to work with IAudioSources of indeterminate length.

also avatar Jan 31 '10 21:01 also