Commit graph

787 commits

Author SHA1 Message Date
Eric Rosenbaum
f8fa66403d
Merge pull request #115 from LLK/bugfix/catch-adpcm-decode-error
Catch ADPCM decode error, and use an empty sound
2019-01-14 15:52:57 -05:00
Eric Rosenbaum
aee73d97a5 Remove unnecessary promise wrappers 2019-01-14 15:37:02 -05:00
Eric Rosenbaum
29b2e7ebc7 Catch ADPCM decode error, and use an empty sound 2019-01-10 16:52:43 -05:00
Paul Kaplan
9a2332e56b
Merge pull request #114 from LLK/bugfix/handle-broken-sounds
Handle empty and unusually formatted sounds that caused crashes
2019-01-08 13:05:05 -05:00
Eric Rosenbaum
195be39c6e Remove stray comment 2019-01-08 12:40:32 -05:00
Eric Rosenbaum
db1c89fa34 Prevent error due to LIST chunks 2019-01-08 12:11:53 -05:00
Eric Rosenbaum
6f32a0bec7 Handle empty sounds 2019-01-08 11:28:40 -05:00
Eric Rosenbaum
0ee5fb95c3
Merge pull request #105 from mzgoddard/loop-optimizations
ADPCM Loop Optimizations
2018-10-23 16:25:15 -04:00
Eric Rosenbaum
468aa9bf6f
Merge pull request #104 from mzgoddard/js-optimizations
ADPCM JS Optimizations
2018-10-23 16:24:55 -04:00
Andrew Sliwinski
0f8d1ecd21
Merge pull request #106 from mzgoddard/bump-wcli
Bump wcli
2018-10-23 12:27:57 -04:00
Michael "Z" Goddard
41ab77b5a0
bump webpack-cli 2018-10-23 10:33:53 -04: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
Michael "Z" Goddard
5c2f2ca97b
reuse ArrayBufferStream parent internal objects
The extracted children can refer to their parent typed array views and
buffer to keep from needing to make memory copies that take a lot of
time to create and memory to use. As well some time can be saved by
using the same Uint8Array for reading Uint8 values and strings.
2018-10-22 17:12:04 -04:00
Michael "Z" Goddard
7e61890c1b
Merge pull request #100 from mzgoddard/todo-remove-this
remove `@todo` remove this items in AudioEngine
2018-06-25 16:24:44 -04:00
Michael "Z" Goddard
6ec307eca2
remove @todo remove this items in AudioEngine 2018-06-25 15:58:33 -04:00
Eric Rosenbaum
59ff2ad927
Merge pull request #101 from mzgoddard/clipless-firefox
schedule stop DECAY in the future for firefox
2018-06-25 15:39:17 -04:00
Eric Rosenbaum
e165850301
Merge pull request #99 from mzgoddard/docs
add missing docs: SoundPlayer, AudioEngine, Effect.name
2018-06-25 15:15:04 -04:00
Michael "Z" Goddard
e01a32a83d
use AudioEngine.currentTime and DECAY_WAIT in PanEffect, etc 2018-06-25 14:27:21 -04:00
Michael "Z" Goddard
ee73fd7a8a
rename DECAY_* constants to DECAY_WAIT and DECAY_DURATION 2018-06-25 14:01:15 -04:00
Michael "Z" Goddard
fb355abb7d
schedule stop DECAY in the future for firefox
Firefox at this time cannot smoothly schedule audio parameter changes
to happen immediately. Immediately scheduled changes clip when firefox
tries to catch up. Smoothly fading out a sound immediately instead of
clipping the end of the sound, in firefox at this time clips the sound
between where the fade out starts and where firefox catches up and
finishes the scheduled fade.
2018-06-25 13:15:19 -04:00
Michael "Z" Goddard
97e2996090
add missing docs: SoundPlayer, AudioEngine, Effect.name 2018-06-22 14:43:37 -04:00
Mx Corey Frang
a79684a720
Merge pull request #98 from gnarf/soundbank-effectchain
Soundbank effectchain
2018-06-21 16:58:56 -04:00
Michael "Z" Goddard
018d4fc01e add AudioEngine.createEffectChain 2018-06-21 16:56:11 -04:00
Corey Frang
c8f3510713 Better order of stop/connect/play 2018-06-21 16:56:11 -04:00
Corey Frang
ea6093835c mv GreenPlayer.js SoundPlayer.js 2018-06-21 16:56:11 -04:00
Corey Frang
45a7d1abef rm AudioPlayer and SoundPlayer 2018-06-21 16:56:11 -04:00
Michael "Z" Goddard
c12a1a4766 comment SoundBank and EffectChain 2018-06-21 16:56:11 -04:00
Michael "Z" Goddard
7cef4e60a8 pass main EffectChain to SoundBank from Engine.createBank 2018-06-21 16:56:11 -04:00
Michael "Z" Goddard
5177dd5c85 add SoundPlayers to SoundBank
- SoundBank may not create SoundPlayers (but it can call .take if need)
- All SoundPlayers SoundBank plays are given to it
2018-06-21 16:56:11 -04:00
Michael "Z" Goddard
d40564d61a make EffectChain standalone
- EffectChain knows of audioEngine so it can create Effects
- EffectChain connects to the target specified by .connect(target)
- EffectChain can connect to other Effects or EffectChains
- EffectChain can clone itself and connect to the original's target
- Add EffectChain.update to mirror Effects API
- Use deepest setting first in setEffectsFromTarget
2018-06-21 16:56:10 -04:00
Corey Frang
f5c219ceb3 First Draft SoundBank + EffectChain 2018-06-21 16:56:10 -04:00
Michael "Z" Goddard
444aba7f76
Merge pull request #95 from gnarf/tests
Tests for GreenPlayer
2018-06-21 16:04:18 -04:00
Michael "Z" Goddard
ed0ef8e4dc
add docblock to AudioEngine.currentTime 2018-06-21 16:01:37 -04:00
Corey Frang
741817ad62
No need to set isPlaying here 2018-06-21 16:01:37 -04:00
Corey Frang
aa77d8d376
Add tests for play debounce 2018-06-21 16:01:37 -04:00
Corey Frang
e2da92fae7
cleanup tests a bit 2018-06-21 16:01:37 -04:00
Corey Frang
2bd946423b
remove rest of async/await in tests 2018-06-21 16:01:37 -04:00
Corey Frang
cdd35b5296
convert async/await to promise chain 2018-06-21 16:01:36 -04:00
Corey Frang
1d5d6bfbb2
Feedback from review fixes 2018-06-21 16:01:36 -04:00
Corey Frang
c62adcab3b
dispose taken sound player after it fades 2018-06-21 16:01:36 -04:00
Corey Frang
7f2b9786ee
Fix broken tests (mock change for effects and plan audioengine) 2018-06-21 16:01:36 -04:00
Corey Frang
5b693f6708
move take to stop, play is always green / non effected until stopped 2018-06-21 16:01:36 -04:00
Corey Frang
2c4edf288f
update test to work with new isPlaying problem 2018-06-21 16:01:36 -04:00
Corey Frang
8110885a62
add a play while playing test 2018-06-21 16:01:36 -04:00
Corey Frang
18cb9787ae
wip: greenplayer tests 2018-06-21 16:01:35 -04:00
Eric Rosenbaum
7dd6d557bb
Merge pull request #89 from LLK/green-audio-player
Green audio player
2018-06-21 15:37:55 -04:00
Michael "Z" Goddard
2126761dc3
use AudioContext.currentTime + DECAY_TIME to debounce sound start
Debounce when the sound starts to keep from playing many copies of the
same sound layered on itself. Use AudioEngine's currentTime in seconds
plus some value in milliseconds to make sure the sound has a chance to
start before starting a second playback.
2018-06-21 14:26:04 -04:00
Michael "Z" Goddard
331f083f5a
add GreenPlayer.isStarting promise
Self-resolving promise removes itself once it resolves. While it is on
a player the player may consider itself to not yet have the time to
actually start sound playback. While playback has not started, the
player can shortcut out of starting playback.
2018-06-18 14:47:38 -04:00
Andrew Sliwinski
094face1be
Update TRADEMARK 2018-06-18 13:12:40 -04:00