[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] WebGL 1.0 ratified and released
On Tue, Mar 8, 2011 at 12:10 PM, <email@example.com>
> correct time. That's the problem. Being a few ms off for triggering an
> explosion is fine. Being a few ms off for triggering an instrument is a
> song is the different between music and noise.
If you have enough memory, you grab the entire audio buffer and hand it to
OpenAL and say "play this - tell me when it's nearly done". If you don't
have enough RAM then streaming is just about the one thing that the
<audio> tag is really good for - so just use that instead.
If it's really considered likely that people would want note-by-note music
synthesis then we should layer a MIDIfile player onto the thing...that
would be a useful addition for super-low-memory/bandwidth music - but it's
far from essential. But no amount of fancy API will help you if you
really need to choose which notes to play right at the instant when they
That's just not a typical modern "use case"...proof of which is that
L-O-N-G list of games that use OpenAL.
That is not proof at all. Almost all of those games survive on OpenAL because they are written in performant C/C++ using high priority threads.
That's precisely why I think we should use an audio API that's popular
amongst game writers - and not try to invent one to solve problems that
don't actually exist.
What's neat about OpenAL is that you can attach an engine sound to a car -
drive the car around the virtual world, passing the exact same world-space
4x4 matrix to OpenAL as you do to OpenGL and with a couple of lines of
getting louder as it comes closer, having that cool doppler shift as it
drives past...all with just a handful of lines of code.
Yes, and as soon as you want to filter the sound so it sounds like you are under water, or add reverb so it sounds like you are in a cathedral or add echo so it sounds like you are in a tunnel you have to do real time audio processing on high priority threads in optimized C++
This is why nearly all of the companies you mentioned don't use OpenAL directly, they use it by purchasing FMOD which is a high level API that provides these features.
If you have the right hardware/drivers, you can even do 5.1 surround-sound
or (with headphones) get synthetic 3D audio.