As promised, I've made some progress on the websound extension for Web UI. Right now it supports most of the attributes of the HTML TADS sound tags: src, layer, repeat, volume, sequence, interrupt, and cancel.
Layers are only supported to a limited extent: there are four of them and they all work the same way. This should be mostly right, except for ambient; I need to ask a few clarifying questions of the experts to understand what that one is supposed to do.
Fades are not supported at all. This may be sheer ineptitude on my part but I can't seem to get an mp3 hosted online to start playing instantly, much less perform incremental volume changes on the audio with sub-second precision. Local Web UI play is a different matter and probably could support fades.
The most significant restriction at the moment is that large mp3s don't work well in the browser, when served out of the .t3 file. The session becomes unresponsive until the sound is loaded. This looks like an interpreter or server bottleneck rather than a problem with the sound code. The workaround is to put the mp3s online as separate files, and link to those files directly rather than to internal game resources.
For example:
Code:
#ifdef TADS_INCLUDE_NET
"<sound src=\"http://example.com/mp3/test.mp3\" layer=\"foreground\"/>";
#else
"<sound src=\"res/ogg/test.ogg\" layer=\"foreground\"/>";
#endif
Given all that, if it's still of interest, you can get
the latest websound snapshot. Unpack the files into your project folder and add the websound library to your Makefile at the end of the sources list.
Quote:
## sources
-source tadsnet
-lib system
-lib webui
-lib adv3/adv3web
...
-source myfile
-lib websound
This new module follows the webui conventions and is much less of a hacky abomination than the last version.