[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] WebGL 1.0 ratified and released



I guess I don't understand your problem.

OpenAL (and hence, under this suggestion, WebAL) is written in C. 
JavaScript would only have to make teeny-tiny "start this sound playing"
commands...so its actual execution time isn't an issue.

> In some idea world where JavaScript is multi-threaded and runs only 10%
> slower than C++ even on cell phones controlling audio at an OpenAL level
> is
> exactly what I would want. Give me low-level access and get out of my way.
> But we're not in that ideal world. JavaScript is still 10-20x slower than
> C++ in most cases, it's single threaded by design and will get frozen
> whenever the browser is frozen (alerts and other events) at least in
> browsers and that's not going to change anytime soon and it has to run on
> underpowered hardware. Hence the need to move all the real audio
> processing
> to C++ and just provide an interface for JavaScript to manipulate it.

I think you imagine OpenAL to be a much lower level API than it really is!

You say "attach this sound data to this object - and position the object
at this point in 3D space - now play the sound"...and OpenAL gets on with
it and it tells you when it's done.  Stuff like stereo positioning, range
attenuation, doppler and mixing are all dealt with down in the OpenAL
(C/C++) code level...or even in hardware if you have a sound chip that can
do that.

It's roughly analogous to the WebGL operation of binding a vertex buffer
(only this is a sound buffer), pushing a transform into a uniform matrix
and calling "drawElements"...and it takes about the same amount of time.

It takes all of 5 lines of code to start a sound playing...the performance
of JavaScript is irrelevant.

> Sure, the Audio Data API is in the spirit of OpenAL and there are some
> great
> demos but I've yet to see any real apps (ie, games that use lots
> of simultaneous sounds with 3d effects, echo, low and high pass filters,
> and
> dynamic music + physics (even 2d) plus A.I and run on an iPhone or Android
> phone. Hence the need for the Web Audio API.

I haven't seen those kinds of thing running on a phone - but according to
Wikipedia:

Doom 3, Enemy Territory: Quake Wars, Wolfenstein, Quake 4, Prey, Unreal
II: The Awakening, Unreal Tournament 2003, Unreal Tournament 2004, Unreal
Tournament 3, Postal², "Bioshock", America's Army, Battlefield 2,
Battlefield 2142, Freedom Fighters, Hitman, Psychonauts, Colin McRae:
DiRT, Penumbra: Black Plague, Race Driver: GRID, Colin McRae: Dirt 2, Wurm
Online, Kane & Lynch: Dead Men, Kane & Lynch 2: Dog Days, S.T.A.L.K.E.R.,
Osmos, FlightGear, War§ow, and Warzone 2100

...all use OpenAL - and most of those were pretty successful.  Where I
work, we use it in serious simulation used for training Navy Seals and
such.

Some of those games are old enough that they were running on computers
with about the same CPU horsepower as a modern phone...so I don't see a
problem in principle.

> (sorry, this discussion doesn't belong on the WebGL mailing list. If you
> want to influence the direction of audio in the browser join the Web Audio
> Incubator Group. http://www.w3.org/2005/Incubator/audio/charter)

...the question was asked...I answered it.

  -- Steve



-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------