
This is a sound system DLL that makes controlling your sounds a simple task.
It is based on OpenAL so it should have no problems running on different versions of Windows or even Mac, if the opportunity to port it presents itself.
Why I think you should use my DLL (Pros):
- A very simple interface
- 3D sound support
- Simplified volume control (through group flags and fading)
- OGG streaming support
- No crazy DLL dependencies (except OpenAL, of course)
- Fresh code - I'm able to add requested features
- Documentation is in script files - you don't have to look too far to know how it works
- Plays sound as every other player (AFAIK, GM did something odd to the sound files)
- You like working with ugly interfaces (let's face it, this DLL might be one of the best things you've found this week
) - You hate WAV/OGG file formats (only these are and will be supported in this audio DLL)
- You cannot afford to put that 1 MB OpenAL redistributable or the OpenAL DLL files in your game's archive
SDK Download (only DLLs and the GML scripts file): http://www.box.net/shared/3tzyqjjp9c
Test kit (GM8 .gmk file, DLLs and one sample track in .ogg): http://www.box.net/shared/0jynnxfjte
Compiled test kit (executable, DLLs and the sample track): http://www.box.net/shared/74rti52x9z
Simplicity
If you need to play music...
e_music = sga_TrackPlay( -1, "music/fight.ogg", 1, 0 );If you need to play a sound effect...
On object creation:
e_fx = sga_CreateFX( "sounds/shot.wav", 0 );On deletion/room end:
sga_DestroyEmitter( e_fx );And when you need to trigger the effect:
sga_PlayFX( e_fx );There are, of course, some tiny details that make this audio DLL good for other kinds of sound effect/music control but this a very simple usage example that almost everyone probably has seen sometime.
The Design
- This is an emitter-based system. Which means that sound files don't get loaded into memory twice and all the emitters can (but shouldn't, due to speed limits of every normal game) play something at the same time.
- To create an emitter, use the appropriate script (sga_CreateEmitter) or one of the simplification functions (sga_Create3DFX, sga_CreateFX), or sga_TrackPlay.
- All emitters should be destroyed (sga_DestroyEmitter) to prevent memory leaks while the game is running but if they aren't, the DLL frees all the data automatically.
- sga_Init and sga_Free must be called on game start and end, respectively.
- Volume is controlled by group bit flags - each group represents a bit, bits are ORed together to influence the final volume of the emitter.
- Every "flag" argument of any script is the bitwise list of groups that influence the emitter. 0 - no groups, 1 - group 1, 2 - group 2, 4 - group 3, 5(1+4) - groups 1 and 3 etc.
- In sga_SetGroupVol and sga_GetGroupVol, group 0 is the master group - it controls the volume of all emitters, bit flag groups start with 1 and end with 32. Therefore this group ID is not equal to x in 1 << x (it is to 1 << (x-1) though).
- sga_TrackPlay is very good for background music / voice acting as it recreates the emitter when necessary.
Licensing
Use it any way you want (commercially or non-commercially), but with some tiny exceptions: it is not allowed is to misrepresent the author of the library and it's not allowed to sell it.
Credit is appreciated but not required.
Version history
1.06 (29/01/2013)- fixed one ogg effect playback bug. Thanks to Gorkiller for reporting it and testing.
1.05 (13/01/2013)- rebuilt the streaming system. Thanks to Ancient Alien and EanFox for help with testing.
1.04 (30/04/2011)- fixed a bug with small OGG files not being played due to their size being smaller or equal to the stream buffer size constant. Thanks for hunting down that one, Bleed!
1.03 - sga_SetPlayOffset/sga_GetPlayOffset/sga_SetPitch/sga_SetPanning and some safety checks to avoid crashing on wrong emitter IDs were added.
1.02 - fixed a bug in sga_SetCamDir where it would hang the game. (to developers of Game Maker: PLEASE FIX EXCEPTION HANDLING!!!)
1.01 - fixed some licensing issues (removed ALUT and thus got rid of its ugly LGPL license), added a new WAV loader that precisely describes what's wrong with the file if an error occurs, I also put the OpenAL DLLs in every archive since they're so small (~550kB uncompressed, ~250kB compressed).
1.00 - initial release.
A bigger sample
A modification of the "fps6" sample that includes some sound effects and some graphical effects that fit the sounds.
You can get it here: http://www.box.net/shared/ng2tspnsmr
If you have any questions, feel free to ask either here or in Twitter. P.S. Due to lack of time, I haven't been using the account for quite some time so you will find more luck with contacting me via the PM system in here.
If you're interested in what I do, check out this website.
Edited by snake5, 29 January 2013 - 07:35 PM.











