Commit graph

11 commits

Author SHA1 Message Date
Christopher Willis-Ford
068aca6136 chore: lint fixes 2023-12-15 14:44:01 -08:00
Michael "Z" Goddard
80820c6ba6
precompute DELTA_TABLE and reorganize decompression loop
There are 1424 possible deltas given 89 steps and 16 codes. We can
quickly compute those and reuse them to save time.

Knowing the exact size of the waveform we can re-author the
decompression loop to take advantage of that. We can place the block
header decompression first in the outer while loop and then place an
inner loop with the 2 samples per block decompression unwrapped. The
first sample reads from the stream and the second uses the other 4 bits.
2018-10-22 17:14:40 -04:00
Michael "Z" Goddard
c12bf02b33
write ADPCM samples directly to the Audio Buffer's channel data
The number of samples in the ADPCM can be known once the data chunk is
extracted and the block size is known. From there the audio buffer can
be created and its channel data passed to the decompress method. A lot
of time is saved by writing to the channel data directly instead of
writing to one array, copying that to another array, and then finally
copying to the channel data. A surprising amount of time is saved by
using one getChannelData call instead of calling to store each sample.
2018-10-22 17:12:05 -04:00
Eric Rosenbaum
0bc892f03d Use “audioContext” to refer to webAudioContext 2017-06-22 10:51:57 -04:00
Eric Rosenbaum
03034dd2f7 Remove dependency on Tone.js 2017-06-20 16:50:02 -04:00
Ray Schamp
ea3c4a47f2 Fix while condition, disable eslint complaint 2017-04-18 18:05:36 -04:00
Ray Schamp
fa879cee9d Fix static getters
Thanks @ericrosenbaum!
2017-04-18 17:59:37 -04:00
Ray Schamp
9874cf006f Update to use ES6 class syntax 2017-04-18 12:22:06 -04:00
Ray Schamp
e50ba400f9 Update syntax for eslint-config-scratch 2017-04-17 11:52:12 -04:00
Ray Schamp
ee8462f53f Pass with eslint --fix 2017-04-17 11:52:12 -04:00
Eric Rosenbaum
c5daccef7c Rename to ADPCMSoundDecoder, and only decode
Scratch Storage now handles asset loading, so this class is now just the decoder
2017-03-22 18:08:44 -04:00
Renamed from src/ADPCMSoundLoader.js (Browse further)