3 Oct 21:07
Re: ECMAScript API docs, and a sound suggestion
Andy Turner <turner <at> mikomi.org>
2005-10-03 19:07:21 GMT
2005-10-03 19:07:21 GMT
On Mon, Oct 03, 2005 at 01:34:42PM -0400, Andrew Plotkin wrote: > I do not like your audio API. Having methods that are both getters and > setters -- bleah. Since Javascript supports object fields which are > dynamic (like "nickname", above) we should do it that way: > > val = audio.url; > audio.url = newval; I agree. > I don't think we need play(float) to start a sound in the middle. However, > we *do* need a way to start a sound playing in "repeat forever" mode. > (Background music.) Make this another attribute? I don't imagine they'll be any call for sounds that may be both repeat forever and play once. > Games frequently need to blast out multiple instances of a sound -- > possibly overlapping. Your audio object can't do that. A game *can* create > multiple audio objects with the same URL. Is that sufficient, or do we > want to avoid the overhead cost of setting the URL and alt on each one? > > (A way to avoid that would be to have just one audio object, and then > audio.play() returns an *audio instance* object. The latter would have a > stop() method; the former would not. This is not necessarily the right > way, just a way. We could also just have a clone() method.) When I was reading the paragraph before this one, this is exactly what came to my mind. I think i prefer the audio instance style. I'd also suggest that instances should not have a play method. -- -- Andy <turner <at> mikomi.org> ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl
RSS Feed