rserota / wad

Web Audio DAW. Use the Web Audio API for dynamic sound synthesis. It's like jQuery for your ears.
MIT License
1.89k stars 160 forks source link

Create a Pause Method #104

Closed frastlin closed 5 years ago

frastlin commented 5 years ago

I would love if there was a quick and easy way to call sound.pause(), then either sound.unpause(), or sound.play() would have the sound resume with its last called settings. I personally like to create a toggle_pause as well. this would be a function that would pause a sound if it is playing and unpause a sound when it is paused. This functionality is very important for audio players and if one has a game with a pause functionality, or another screen or split scene, then pausing a set of sounds, playing other sounds, then unpausing the first sounds is very important.

rserota commented 5 years ago

I just added pause and unpause methods in the version 4.4.0. It only works with audio clips (not oscillators), and you'll probably get strange results if you try to pause/unpause audio clips with lots of effects applied to them. Other than that, it should work pretty well.