Jump to content


Photo

SG Audio DLL


  • Please log in to reply
134 replies to this topic

#1 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 20 April 2011 - 01:37 AM

Posted Image

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)
The only reasons why you wouldn't need it (Cons / preference mismatch):
  • You like working with ugly interfaces (let's face it, this DLL might be one of the best things you've found this week B) )
  • 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.

  • 8

#2 Aragon

Aragon

    GMC Member

  • GMC Member
  • 142 posts

Posted 20 April 2011 - 07:58 AM

I think I gonna use it, because of the license
  • 0

#3 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 20 April 2011 - 07:40 PM

I have made a more complex sample (based on FPS tutorial's 6th source file) with music and 3D sound effects.
It should hopefully show how easy it is to use my DLL.

http://www.box.net/shared/ng2tspnsmr
  • 0

#4 dantehavenaar

dantehavenaar

    GMC Member

  • New Member
  • 14 posts

Posted 23 April 2011 - 05:35 PM

I don't know what I'm doing wrong.
When I start the game the following error occured:
ERROR in
action number 1
of Other Event: Game Start
for object obj_menu_controler:

Error defining an external function.

If you will download it:
Game

It's Dutch but I think you don't have problems with it because there is nothing to read. :rolleyes:
  • 0

#5 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 23 April 2011 - 06:12 PM

There's no SGAudio.dll in the folder where I found the other DLLs.
  • 0

#6 dantehavenaar

dantehavenaar

    GMC Member

  • New Member
  • 14 posts

Posted 23 April 2011 - 06:32 PM

Stupid me :wub:
  • 0

#7 DFortun81

DFortun81

    The Fortunate One

  • GMC Member
  • 899 posts
  • Version:GM:Studio

Posted 23 April 2011 - 09:03 PM

There seems to be a bit of a hiccup when booting the DLL up, not by much of course, but it's noticeable.

Edit: Although, if I may, I'd like to see a function where you could load a song and declare on its destruction that a separate song be looped instead. A lot of good games of our time have used a system like this where the introduction of the song would play and after it was completed, it would loop the "LOOP" section of the song - which was a completely different file and trimmed to loop seamlessly. Make this functionality and I'll use this DLL.

Edited by DFortun81, 23 April 2011 - 09:09 PM.

  • 0

dia_rpg_builder.png
Navigate to my personal website by clicking the image above.


#8 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 23 April 2011 - 09:49 PM

There seems to be a bit of a hiccup when booting the DLL up, not by much of course, but it's noticeable.

Probably something that OpenAL/the underlying API does on its own. My initialization code is quite small.

Edit: Although, if I may, I'd like to see a function where you could load a song and declare on its destruction that a separate song be looped instead. A lot of good games of our time have used a system like this where the introduction of the song would play and after it was completed, it would loop the "LOOP" section of the song - which was a completely different file and trimmed to loop seamlessly. Make this functionality and I'll use this DLL.

Hmm, this might be a bit hard to do. But I'll try to figure something out.
  • 0

#9 Jake Armstrong

Jake Armstrong

    GMC Member

  • GMC Member
  • 497 posts
  • Version:GM8.1

Posted 24 April 2011 - 05:01 AM

Things I'd like to see (assuming you can't do them already...):
Being able to change the names of the two OpenAL dlls!
Setting sound position (so many seconds in, etc.)!
Setting sound frequency?
Being able to set pan without setting up a sound position?
  • 0

A star pathfinding extension (fast, variable cost tiles, multi-tile objects): http://gmc.yoyogames...howtopic=570621

Multiple mice extension http://gmc.yoyogames...howtopic=575963
extension to check if game is in focus (vs. being alt tabbed, etc.): http://gmc.yoyogames...howtopic=549073


#10 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 24 April 2011 - 12:31 PM

I added sga_GetPlayOffset/sga_SetPlayOffset/sga_SetPitch...
and sga_SetPanning (should definitely work for mono sounds).
But for other things - they are very hard to do, impossible without hacking and it's hard to see the practical purpose. So could you explain why there's a need for such features like panning and changing names of those DLLs?
  • 0

#11 Bleed

Bleed

    Chevalier

  • GMC Member
  • 749 posts
  • Version:GM:Studio

Posted 24 April 2011 - 12:56 PM

This has potential and i was looking to replace my old sound dll, but unfortunately i can't seem to make it work, nor do i have the time to look for answers or fixes, since it claimed it was simple to use, if only it had a help file of sorts explaining what each call does in depth (eg, sga_CreateFX(filename,flag).....what flag???). Not all of us are sound gurus.
Proper respect for the clearly hard work you've put into this project, but it'll be appreciated if you'd made a help file for this.


  • 0

#12 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1969 posts
  • Version:GM:Studio

Posted 24 April 2011 - 01:22 PM

I'm not using your dll at this time, as I have coded my own using irrKlang. But, I have a few suggestions to make it better, which would allow features to be added nicely.

I see you just added the get/set "offset" functions. If that is referring to the play position(how far into the track) the song is it, then that is a good thing you probably must have.

My recommendation would be to make this an extension. You would stick your OpenAL wrapper into the extension, but the OpenAL dlls would still have to be in the executable directory for it to work. Then, you add more functionality using GM's scripting. For example, I have two objects, that are completely created through GM code. I have enabled "loop points" and GM "callbacks" in this manner. For the loop points, when a sound is played with loop points, I create an instance of the loop point object. In the step event, it checks(through the dll call) the sound playing position, and if it past the loop point, it sets the play position back to the beginning loop point. Then, when you want to stop the sound, in the same stopping script for stopping any looping sound, you add a check with each object(loop point object) if my sound pointer is the same, destroy it, and stop the sound(with dll call). This way, the sound stops looping, and the controlling object gets destroyed.

The "callback" one works similar. You supply is with either a GM script you want executed, or you could be versatile and use a string to execute(which could execute a script with different arguments, or whatever code you put in the string). The object you create in its step even simply checks if the sound is done playing, and when it is, executes the specified sting/function. Then of course you destroy that object instance. In this manner, you can fire an event, for example to start looping a different sound, or really whatever the game designer needs.

The other reason I recommend an extension is not only because you can add gml functionality to accessing your dll, but because it is simply easier overall to use. I like using extension for even my simplest dlls because I only have to add the extension, and the functions show up in GM's code completion, including the named arguments you used in the extension creator. You can also integrate help files, and if the dll is not wrapping another dll(like in this case yours is) you don't have to worry about putting the dll in anywhere, because GM loads it up as part of the extension.

If you are interested, I am willing to give you the source to my extension, including the C++ and the gml. The irrKlang API does more things for you than OpenAL does, but I don't think that is going to be an issue. I'd think since you already have OpenAL up and running, you would more likely be interested in how I integrated it with gml calls, adding functionality like I recommended above. If you want it, either post it here, or PM me.
  • 0

My KBInput system is now on the marketplace here.  It wraps up nice and tight GMStudio's input system into a few function calls making a user configurable input system that works the same regardless of what inputs the player has chosen including keyboard, mouse buttons, and gamepad/joysticks using DInput/XInput.  The support forum topic for it is here.


#13 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 24 April 2011 - 02:05 PM

This has potential and i was looking to replace my old sound dll, but unfortunately i can't seem to make it work, nor do i have the time to look for answers or fixes, since it claimed it was simple to use, if only it had a help file of sorts explaining what each call does in depth (eg, sga_CreateFX(filename,flag).....what flag???). Not all of us are sound gurus.
Proper respect for the clearly hard work you've put into this project, but it'll be appreciated if you'd made a help file for this.

If you don't want to use per-group volume control, just set the flag to 0. I think I explained this in the first post. If not, I'm going to fix this soon.

kburkhart84:
Thank you for the suggestions.
I will probably some day create an extension for this DLL.
But I don't think it would be useful to use automatically created objects for callbacks here. There are many reasons for this but the most important are - they can easily make everything slower for object-heavy games and they can pollute the debug window's instance list. So if I'm going to implement something like this, I'd rather use pure scripts.
Also thanks for the offer to see your source code but I think I will be able to handle this on my own.
  • 0

#14 Jake Armstrong

Jake Armstrong

    GMC Member

  • GMC Member
  • 497 posts
  • Version:GM8.1

Posted 24 April 2011 - 02:20 PM

I'm going to test with 8.1, this looks like it can do everything I want now. Thanks for making it!

As for the .dll name changing, it's obviously not essential, but I like to be able to call it Sound.dll or something just so less tech savy people playing my game aren't all like "What is an OpenAL?".
  • 0

A star pathfinding extension (fast, variable cost tiles, multi-tile objects): http://gmc.yoyogames...howtopic=570621

Multiple mice extension http://gmc.yoyogames...howtopic=575963
extension to check if game is in focus (vs. being alt tabbed, etc.): http://gmc.yoyogames...howtopic=549073


#15 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 24 April 2011 - 02:31 PM

As for the .dll name changing, it's obviously not essential, but I like to be able to call it Sound.dll or something just so less tech savy people playing my game aren't all like "What is an OpenAL?".

Ah. In that case, you could just put those DLLs in a "SoundLibraries" directory or something like that and change the DLL path in sga_Init. That should answer their question. :)
  • 0

#16 Jake Armstrong

Jake Armstrong

    GMC Member

  • GMC Member
  • 497 posts
  • Version:GM8.1

Posted 24 April 2011 - 02:41 PM

Thanks! And it definitely works with 8.1 :P
  • 0

A star pathfinding extension (fast, variable cost tiles, multi-tile objects): http://gmc.yoyogames...howtopic=570621

Multiple mice extension http://gmc.yoyogames...howtopic=575963
extension to check if game is in focus (vs. being alt tabbed, etc.): http://gmc.yoyogames...howtopic=549073


#17 Bleed

Bleed

    Chevalier

  • GMC Member
  • 749 posts
  • Version:GM:Studio

Posted 24 April 2011 - 02:43 PM

Still wont play, i have a .ogg mono sound file at 44100 hz. The file seem to load properly with no errors, but just cant hear anything playing.
  • 0

#18 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 24 April 2011 - 02:53 PM

Still wont play, i have a .ogg mono sound file at 44100 hz. The file seem to load properly with no errors, but just cant hear anything playing.

If you could send me the file, I'd check if there's a bug in the streaming code or if the file is not supported (there are many ogg codecs and I'm not sure if all of them can be read by this DLL).
  • 0

#19 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1969 posts
  • Version:GM:Studio

Posted 24 April 2011 - 03:27 PM


This has potential and i was looking to replace my old sound dll, but unfortunately i can't seem to make it work, nor do i have the time to look for answers or fixes, since it claimed it was simple to use, if only it had a help file of sorts explaining what each call does in depth (eg, sga_CreateFX(filename,flag).....what flag???). Not all of us are sound gurus.
Proper respect for the clearly hard work you've put into this project, but it'll be appreciated if you'd made a help file for this.

If you don't want to use per-group volume control, just set the flag to 0. I think I explained this in the first post. If not, I'm going to fix this soon.

kburkhart84:
Thank you for the suggestions.
I will probably some day create an extension for this DLL.
But I don't think it would be useful to use automatically created objects for callbacks here. There are many reasons for this but the most important are - they can easily make everything slower for object-heavy games and they can pollute the debug window's instance list. So if I'm going to implement something like this, I'd rather use pure scripts.
Also thanks for the offer to see your source code but I think I will be able to handle this on my own.


The things I'm doing I'm not sure if they can be done with scripts alone, unless the developer himself has objects calling those scripts. I've never had a problem with it though, simply because the objects don't get "names" like normal objects do, since you define them through code only. I can see it being an issue with too many objects at once though. The other thing is that you probably in most cases wouldn't have too many sounds needing callbacks, and probably only one sound using the loop points, so I don't think the amount of objects is an issue, even in an object heavy game. But I can see your point of view here. I just don't see an easy way to get automation for the "callbacks" or "loop points" without adding objects.

If you come up with one, let me know, so I can use it.
  • 0

My KBInput system is now on the marketplace here.  It wraps up nice and tight GMStudio's input system into a few function calls making a user configurable input system that works the same regardless of what inputs the player has chosen including keyboard, mouse buttons, and gamepad/joysticks using DInput/XInput.  The support forum topic for it is here.


#20 Jaycliff

Jaycliff

    GMC Member

  • New Member
  • 8 posts

Posted 25 April 2011 - 01:33 PM

Hello snake5 thanks for making this openAL dll! I tried it and it works. I have one suggestion though

Currently when you play a sound (a sound fx type) repeatedly, the sound itself gets 'restarted' and not being layered (GM's built-in sound system layers ('chorus') sounds when repeatedly played). In other words, the sound isn't 'multishot'. It would be nice if you add a 'multishot' option for soundfx types (In the old GM 5.3a that option is called 'buffers') I hope you would consider this ^_^

Oh and by the way, your dll works with the old GM 5.3a - great! B-)
  • 0

#21 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 25 April 2011 - 04:26 PM

If you come up with one, let me know, so I can use it.

I have an idea, so I'll probably write it down soon and update the library.

Currently when you play a sound (a sound fx type) repeatedly, the sound itself gets 'restarted' and not being layered (GM's built-in sound system layers ('chorus') sounds when repeatedly played). In other words, the sound isn't 'multishot'. It would be nice if you add a 'multishot' option for soundfx types (In the old GM 5.3a that option is called 'buffers') I hope you would consider this

Since it's possible to implement this feature in scripts with the existing system, I'll probably write them quite soon.
  • 0

#22 grugin

grugin

    GMC Member

  • GMC Member
  • 127 posts

Posted 26 April 2011 - 09:07 AM

Thank you, a great alternative to the supersound dll ! It works really well with gm 8.1 ! Cool, the sound is coming back :)
  • 0

#23 Dom83

Dom83

    GMC Member

  • GMC Member
  • 138 posts

Posted 27 April 2011 - 09:59 PM

Hi, I have this error just running the sg audio test kit : alcOpenDevice failed - default device could not be opened. Do you want to continue without sound ?
I thought your dll was just not compatible with GM8.1 but I read it is. I wonder what is the problem then. My audio card is an E-Mu 0404 (which sure works) and I am running WinXP Pro.
  • 0

#24 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 28 April 2011 - 04:23 AM

Dom83:
That should be only the case when the sound card does not support any kind of audio output. But I'll check my code - perhaps I haven't written it in the right way for this to be true. The other possibility is a bug in OpenAL though so let's hope I've made the mistake. :D

P.S. To those who requested different features, I have to say that I've unfortunately had lots of work to do and I haven't been able to implement many of those features in any way. I didn't forget about them and will try to make at least some of those as soon as finish adding important updates to my engine.

Edited by snake5, 28 April 2011 - 04:27 AM.

  • 0

#25 Bleed

Bleed

    Chevalier

  • GMC Member
  • 749 posts
  • Version:GM:Studio

Posted 29 April 2011 - 06:03 PM

Waiting anxiously on that bug fix mr. snake Posted Image

Edited by Bleed, 29 April 2011 - 06:09 PM.

  • 0

#26 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 30 April 2011 - 01:03 AM

Waiting anxiously on that bug fix mr. snake Posted Image

Fixed it now. Playing, at least. I don't exclude the possibility of having some problems with timing but everything should be +/- OK now.
You can get the DLL in the newest version of the SDK.

To those who want to update their DLLs: don't take them from the test kits/samples. They aren't updated in those archives. The only way to get the newest version is to download the SDK. Shouldn't be much of a problem since SDK is the smallest of all those downloads anyway. :)

Edited by snake5, 30 April 2011 - 01:03 AM.

  • 0

#27 Dom83

Dom83

    GMC Member

  • GMC Member
  • 138 posts

Posted 30 April 2011 - 01:23 AM

Wow you were quick to update it. It works for me now. ;)

edit : Er, in deed SGATest.exe with the updated dll now works, but in GM it still telling me the error message, even for your SGATest.gmk . I copied the updated dll though. How come ?

Edited by Dom83, 30 April 2011 - 02:01 AM.

  • 0

#28 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 30 April 2011 - 04:14 AM

Dom83, do you have all the DLLs together with the .exe / Game Maker source file? This is the only possible difference I can think of at the moment.
  • 0

#29 Dom83

Dom83

    GMC Member

  • GMC Member
  • 138 posts

Posted 30 April 2011 - 07:46 PM

Yes, I even copied the SGATest.gmk in the same folder as SGATest.exe . SGATest.exe works, SGATest.gmk gives me an error message... :mellow: I deleted all the scripts in SGATest.gmk and imported the updated gml, in case you updated it, but the error message keeps displaying.

edit : I noticed something strrange, if I create an exe then this exe works, but the editable still doesn't... :blink:
  • 0

#30 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 01 May 2011 - 06:07 AM

It's probably a GM 8.1 bug then.
Setting the correct path to DLL manually (changing the "nm" variable in sga_Init) before everything else could help with testing.

P.S. Anyone knows where could I report bugs?

Edited by snake5, 01 May 2011 - 06:07 AM.

  • 0

#31 Dom83

Dom83

    GMC Member

  • GMC Member
  • 138 posts

Posted 01 May 2011 - 01:54 PM

I included your dlls to my game as ressources and told it to put them in temp folder, then I changed paths in script to
temp_directory + "\SGAudio.dll"
But no change, I still have the error though when I create an exe it works.

To report bugs : http://bugs.yoyogame.../login_page.php but it seems that I am the only one having this problem so they may not be able to recreate this bug.
  • 0

#32 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 01 May 2011 - 03:19 PM

I think you should still report it, with all the specific data about your software configuration - someone has to start looking into it and it looks like we cannot do anything from here. :(
  • 0

#33 thomasderoo

thomasderoo

    GMC Member

  • New Member
  • 54 posts

Posted 18 May 2011 - 07:44 AM

saved my ass right there,

I was using fmod when i found out i needed a license to sell anything i make with it. i found this and im sooo happy :). it works almost the same so porting was not a big problem :)

thank you,
  • 0

#34 thomasderoo

thomasderoo

    GMC Member

  • New Member
  • 54 posts

Posted 20 May 2011 - 09:37 AM

and also, all of the dlls can be placed in an external folder. with fmod, the fmodex.dll needs to be in the working directory, else it wouldnt work. thats just one more reason to use this instead of fmod
  • 0

#35 Jaycliff

Jaycliff

    GMC Member

  • New Member
  • 8 posts

Posted 30 May 2011 - 04:43 AM

This dll will completely replace the default gm sound system if it features sound effects like reverb, chorus, multishot sounds, etc. :)
  • 0

#36 DackR

DackR

    GMC Member

  • New Member
  • 7 posts

Posted 01 June 2011 - 12:15 AM

Big thanks to snake5 for making and compiling this DLL package. I've been able to map a lot of the functions I was using with SuperSound over to SG Audio.

I've started using your module since there are yet issues with GM8.1 and SS, I haven't come across any problems with SG Audio in GM 8.1. Though, I haven't been able to mirror the full functionality of SuperSound yet.

It would be great if you added more functions to return the current audio settings for an emitter (other than GetVol, GetType, IsPlaying, GetPlayOffset -- which are great). Matching functions for all of the 'Set' commands (like GetPanning, IsLooping, GetPitch, etc) would be a great way for those still using SuperSound to make the switch easier. Maybe I'll even post my GML that maps the SG Audio Functions with the matching 'SS_' function. Soo...If you make an updated version, I'll help to ease the transition for other SuperSound users. :)

Just a thought.


Oh- one more thing. I got an error message stating that 'alut.dll' cannot be found. (I even got this error after downloading your SDK.) To fix it, I grabbed the dll from the latest FreeSL package... I'm sure it's available elsewhere as well. Just wanted to make sure you were aware... Thanks again.

Edited by DackR, 01 June 2011 - 12:39 AM.

  • 0

#37 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 01 June 2011 - 01:35 AM

This dll will completely replace the default gm sound system if it features sound effects like reverb, chorus, multishot sounds, etc.

Multishot is planned to be a part of the SG Audio Utility Toolkit scripts. I could probably implement effects like reverb and the low pass filter some day but I can't guarantee that it will happen anytime soon.

It would be great if you added more functions to return the current audio settings for an emitter

There's a good reason why I haven't done that. Panning is a cheap hack and is not guaranteed to work in every situation. It works by setting 3D data with special algorithms that emulate panning. Due to the current limitations of OpenAL, I couldn't implement it naturally. Therefore, the returned panning value can be misleading. I didn't implement IsLooping because this helps the developer to develop a healthy habit of making sure that the sound is initialized properly. Though if I find a situation where checking if looping is enabled actually helps, I will implement it. It's similar with GetPitch in the way that pitch is usually controlled by something else and that thing is usually correlated to the pitch of the sound and thus there's usually no need to retrieve the same data from the DLL. That's a lot of assumptions but they all come from my experience. :D

I made this DLL specifically with games in mind - they use everything OpenAL has to offer, they don't care about panning, they have high volume control requirements and sound management is supposed to be simple. That means three things: 1) if someone wants to make a music player out of this DLL, there's probably a better one for that kind of work out there; 2) true panning will not be implemented at least until the developers of OpenAL decide that it's necessary; 3) this DLL will probably never be a perfect replacement for the SuperSound DLL.

I got an error message stating that 'alut.dll' cannot be found.

There's something seriously wrong. I removed ALUT a long time ago and I have never linked my DLL to the DLL version of that library. And Dependency Viewer doesn't show any links to alut.dll here. Is there any chance that the error came from something else? (including any specialized versions of OpenAL renderers you might have installed..)
  • 0

#38 DackR

DackR

    GMC Member

  • New Member
  • 7 posts

Posted 01 June 2011 - 04:00 AM

I got an error message stating that 'alut.dll' cannot be found.

There's something seriously wrong. I removed ALUT a long time ago and I have never linked my DLL to the DLL version of that library. And Dependency Viewer doesn't show any links to alut.dll here. Is there any chance that the error came from something else? (including any specialized versions of OpenAL renderers you might have installed..)


Thanks for the quick response. I found the problem. Looks like I had another version of OpenAL.dll installed in the windows\system32 folder and it was taking control. I removed it and now I don't need alut.dll. ;) Sorry to alarm you for nothing.

About the emitter state return functions: I'm glad you've thought this out so well. :) I'm sure if anyone 'really' needed those functions, they could manage it in their own code. I completely agree, no need to implement features that will only serve to mislead or confuse.

I have no further suggestions, only my complements!

Cheers!

Edited by DackR, 01 June 2011 - 04:09 AM.

  • 0

#39 Tkachov

Tkachov

    GMC Member

  • GMC Member
  • 22 posts

Posted 13 June 2011 - 03:29 PM

Hello =)
I've found this dll today, 'cos I've searched to an alternative for supersound.dll. I've added it to my game, and it works great...
But I need to change playing position (really, I just write position to a file and then load it; and music must begin from this position).
I've tried to use sga_SetPlayOffset() script, but instead playing music it just looping one small (about one second duration) piece of music.

This code loop beginning of music:
//LoopTrack(filename, pos);
sga_TrackPlay(global.music, argument0, 1, 0);
if(argument_count>1){sga_SetPlayOffset(global.music,argument1);}

This code loop small piece, that begin at <pos>:
//LoopTrack(filename, pos);
sga_TrackPlay(global.music, argument0, 1, 0);
sga_Stop(global.music);
if(argument_count>1){sga_SetPlayOffset(global.music,argument1);}
sga_Play(global.music);

So, how should I use this script to run sound from specific position?

Edited by Tkachov, 13 June 2011 - 04:08 PM.

  • 0

#40 Bleed

Bleed

    Chevalier

  • GMC Member
  • 749 posts
  • Version:GM:Studio

Posted 13 June 2011 - 06:46 PM

So i did another test and came up with a few more issues:
-First of all, cpu ussage when using the dll increases by at least 4%, it skyrockets to +15-20% when playing a sound, its probably OpenAL's fault, so not sure you have much control over that, it could just be for small length files only.
-Second the sga_SetGroupVol(master_team0,vol) doesn't work.

Tested on 7SP1,P4 3.0 and GM8.0

P.S : The bug i reported seems to have been fixed, awesome work on that.

Good work on developing this dll i really like it, good alternative over Super Sound that stopped receiving updates a long time ago, and it still had some crucial bugs in it.
  • 0

#41 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 14 June 2011 - 09:19 AM

I'll check CPU usage after some time. It shouldn't be a problem though since that's not a really big increase. I think the same increase will happen if you play 10 sounds instead of one. In that case, it's just the sound mixer doing its job. If you get 100% CPU usage and stuttering sounds, that might be a better reason to investigate.

And about that second problem... are you sure you're using it correctly? It's quite simple to make a mistake with group flags in which case something definitely isn't going to sound right.
  • 0

#42 Bleed

Bleed

    Chevalier

  • GMC Member
  • 749 posts
  • Version:GM:Studio

Posted 14 June 2011 - 01:58 PM

I use it like this:

my_fx = sga_CreateFX(sound_path,0);
sga_SetGroupVol(0,0.5);
Flag 0 is the master flag that controls volume for all sounds right?


Well cpu utilization might not be a problem for p4 and later but since i'm developing games targeted for older computers, it might get noticeable on them.

I'll check CPU usage after some time. It shouldn't be a problem though since that's not a really big increase. I think the same increase will happen if you play 10 sounds instead of one. In that case, it's just the sound mixer doing its job. If you get 100% CPU usage and stuttering sounds, that might be a better reason to investigate.

And about that second problem... are you sure you're using it correctly? It's quite simple to make a mistake with group flags in which case something definitely isn't going to sound right.


  • 0

#43 Tkachov

Tkachov

    GMC Member

  • GMC Member
  • 22 posts

Posted 14 June 2011 - 03:17 PM

You've ignored me. <_<

There are some question about sga_SetPlayOffset();
I'm trying to use it, and instead playing whole track from specified position it playing small piece of this track.
(You can view code examples on previous page.)
  • 0

#44 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 17 June 2011 - 02:52 PM

sga_SetGroupVol(0,0.5);

Found the bug, thanks. Will be fixed and uploaded soon. You can work around that and add your own master volume group for now.

You've ignored me.

Sorry, didn't notice your post. Looking at it now.

I'm trying to use it, and instead playing whole track from specified position it playing small piece of this track.

It's quite possible that there are bugs (more than one) in those offset functions. I'll try to fix them soon.

There is a problem though. I cannot work on the bugs at the moment because I'm trying to start selling software and the faster I succeed, the faster I can get back to fixing all these bugs.
In case you're interested, you'll find more info about the tool that I'm going to sell here: http://cragegames.co...exture-designer
  • 0

#45 Tkachov

Tkachov

    GMC Member

  • GMC Member
  • 22 posts

Posted 19 June 2011 - 02:20 AM

OK, I'm waiting for updates.
  • 0

#46 grugin

grugin

    GMC Member

  • GMC Member
  • 127 posts

Posted 22 June 2011 - 08:55 AM

Hello, there is a way to add a reverb effect on one sound or a group ? Thanks in advance !
  • 0

#47 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 24184 posts
  • Version:GM:Studio

Posted 22 June 2011 - 09:21 AM

Great dll this and replaces the obsolete (and sadly missed) Supersound dll. It's great that it is 8.1 compatible too! May I make a feature request? Can you add pitch change capabilities as that is a great way to add variety and doppler effects to sounds. Anyway, good work and I hope your venture into selling software works out and you can dedicate a little more time to this great dll.
  • 0

lz6lxdC.pngd7ZQQ3F.gifFlvJzyf.png

40799.png


#48 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 23 June 2011 - 08:37 AM

Pitch change might not be possible to implement with pure OpenAL but Doppler effects and Reverb seem to be quite possible.
  • 0

#49 qwertybub3

qwertybub3

    GMC Member

  • GMC Member
  • 8 posts

Posted 05 July 2011 - 02:53 AM

How do I use sga_IsPlaying ?

Whenever I try to use it the game hogs the CPU.

Edited by qwertybub3, 06 July 2011 - 03:07 AM.

  • 0

#50 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 08 July 2011 - 10:53 PM

You can try to use it less often. It shouldn't really do that though.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users