leadwerks.audio
BlitzMax Forums/BlitzMax Programming/leadwerks.audio
| ||
I have been messing around with audio, and I wrote a new sound API that bypasses the BRL audio driver class. This is a compact API that is very close to OpenAL, but it is much easier to use, with automatic initialization and hardware checks. Features: -3D spatialization -Doppler effect -EAX hardware effects that are easy to use http://leadwerks.com/mod/leadwerks.mod/audio.mod The position, velocity, and matrix commands accept a byte pointer, so you can pass a float array, float pointer, or an object and it will all work. Usage: Local sound:TSound Local source:TSource sound=TSound.Load("FlashlightSwitch.wav") source=TSource.Create(sound,1) source.play() SetListenerMatrix([1.0,0.0,0.0,0.0, 0.0,1.0,0.0,0.0, 0.0,0.0,1.0,0.0, 0.0,0.0,0.0,1.0]) Delay 2000 source.pause() source.play() To turn on EAX, do this: EAXEffect EAX_SEWERPIPE You can check to see if EAX is supported with EAXSupported(). |
| ||
thanks, I managed to download the individual files and create the directories myself..but out of curiosity how do you download directories? |
| ||
You don't via a browser, unless they're compressed. If you can connect via FTP then you can easily. |
| ||
Try this URL instead http://leadwerks.com/mod/leadwerks.mod/audio.mod/ |
| ||
Looks interesting. Sorry for my ignorance, but what exactly is wrong with the BRL audio driver? Are you going to make this cross-platform? And shouldn't you call it something other than audio.mod? Btw, Google Code hosts open source code for free and provides subversion and wiki, it's in their faq here. |
| ||
It is cross-platform. The problem with BRL's audio driver is it isn't written with 3D in mind, and it is rather bulky. It also does annoying things like attach the loop mode to the LoadSound command. I also really like EAX. |
| ||
Is there any support for streaming ogg sounds from disk or even better streaming oggs from memory without unpacking? And shouldn't you call it something other than audio.mod? Why? It's in the Leadwerks namespace, so what does it matter what the module is called? |
| ||
*shakes head* Somebody takes the time to write a module and is nice enough to release it for free and their thanks is being kicked in the teeth because somebody feels the name isn't up to perceived standards. I effing love this community. |
| ||
> what does it matter what the module is called? Because it can be confused with BRL's audio.mod. GaryV, it's got nothing to do with 'perceived standards' and I don't consider it a 'kick in the teeth' by any stretch of the imagination. No further comment here. |
| ||
Thanks, having a look at this now. Also, I don't see how leadworks.audio could possibly be confused with brl.audio. It's an entirely different namespace! |
| ||
what exactly is wrong with the BRL audio driver? Nothing at all. |
| ||
"Nothing at all." Well.. when I first used Blitzmax a year ago, the sound fx were out of sync, stuttered, etc. On ALL of my test machines, so I wrote my own Bass wrapper. Has things changed that the audio drivers are much more stable? |
| ||
Has things changed that the audio drivers are much more stable? BRL.Audio is a generic module. It doesn't do anything apart from hand off to a particular audio driver, through a standard interface. So you use whichever audio driver suits you, and your own code doesn't have to change. There are audio drivers for openAL, whatever the Win32 DX audio thing is called, FreeAudio, FMOD, irrKlang, and I think MaxMod works as a driver too(?). Each to their own, of course. That's why we have a choice :-) |
| ||
In the next months we can still wait for a LINUX port of the bass.dll. So, not really free..but perfekt (as win32 and mac are supported). What Leadwerks is going to share is very nice, why not include that in the bm modules? jm2c |
| ||
Thanks for this Josh :) |
| ||
The module underwent some heavy revision and is now ready for game use. I just finished up a pretty big lesson on the sound system in our engine. It's in C++, but it's basically the same as BMX, and it is mostly just an explanation of this audio module. In BMX you don't need to free the sources, as they will be managed automatically. Article: http://www.leadwerks.com/files/Tutorials/CPP/Introduction_To_Sound.pdf Video: http://www.leadwerks.com/files/Tutorials/CPP/Introduction_To_Sound.wmv Files: http://www.leadwerks.com/files/Tutorials/CPP/Introduction_To_Sound_Files.zip |
| ||
Many thanks for this josh. Don't want to lower the tone, but my brain's taking another day off. How on earth do you set the listener position? In the docs it says... ------------------------- TListener listener=CreateListener(); PositionEntity(listener,Vec3(0,0,-2)); ------------------------- Which is fine, but there's no TListener type in the mod. Would I be right in thinking it has to be set with the listener matrix? if so, what are the settings for rotate and positione within that matrix? Thanks. |
| ||
The SetListenerMatrix() does this. Whatever 3D engine you are using should have 4x4 matrices stored for objects. |
| ||
Hi Josh, thanks for replying. I'm not using a 3d engine for this, I'm just evaluating the audio mods avaliable for Max. I'm generating a grid (800*600) with some random sound files loaded at various locations. I use keys to walk a player position around the grid. To set the listener position and rotation in your old engine (openalex) this was the code... ----------------- PositionListener x, 0, z RotateListener xrot, yrot, zrot ----------------- I can't find any equavalent commands in the new leadwerks.mod posted at the beginning of this thread. I did notice someone mention on the leadwerks site they had a problem in createlistener(camera) in audio.mod. The problem was solved but it made me think that the version of audio.mod they have is different to the one posted above. There's no 'CreateListener' or 'Entity' commands in the audio.mod posted above, should there be? |
| ||
Those are engine commands. You will need to figure out the 4x4 matrix yourself. There is code on this forum to do this. |
| ||
OK I'm with you. The problem for me stemmed from this. Set a sounds position in 3d space (easy) MySound.setposition([x, y, z]) Set the sounds range (easy) MySound.setrange 50 Play the sound (easy) MySound.Play() Set the listener position and rotation (wt*!!!) SetListenerMatrix([1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0]) :D Just presumed from your older code (OpenAlEX) there would be an easier way of doing this. Fair enough. (heads off looking forward to an afternoon of reading matrix code and banging head off wall) |
| ||
Download link is broken! |
| ||
Download link is broken! You sound surprised. The last post in the thread is over a year old. |
| ||
Nevertheless, that module sounds great, and I wanna have it! |
| ||
I had a copy of it -- you can get it for (for the time being) http://www.xlsior.org/temp/leadwerks.audio.mod.zip (Note that that one is compiled with GCC 4.4.1, which is a different version than used by stock Blitzmax -- you may need to recompile the mod on your own computer for it to work properly for you) |
| ||
You do rule, thanks!!! |