Jump to content


Photo

SG Audio DLL


  • Please log in to reply
114 replies to this topic

#81 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14446 posts
  • Version:GM:Studio

Posted 20 January 2012 - 08:18 PM

For some reason initializing the DLL within the room creation event with GM 8.1.141 crashes the game and prevents it from running.
This only happens with the last GM update, I pointed it out in the official GM updates thread (http://gmc.yoyogames...dpost&p=3893761)



When using a dll, you should have a empty boot room, the first room, drop a dll controller object in it, the object is persistent

On Game Start
InitTheDll()
room_goto_next();

On Game End
FreeTheDll();


this will prevent oddism from happening
  • 0

#82 Hiric

Hiric

    GMC Member

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

Posted 20 January 2012 - 11:16 PM

When using a dll, you should have a empty boot room, the first room, drop a dll controller object in it, the object is persistent

On Game Start
InitTheDll()
room_goto_next();

On Game End
FreeTheDll();


this will prevent oddism from happening

Thanks for answering Icuurd12b42.
I actually have an empty boot room, where I create such controller in the room's create event section code, and it has worked for months, until last GameMaker update.

I rolled back to a previous version and it worked again. With the last version the game crashes as soon as it initializes the DLL. Commenting the DLL initialization and by initialising it on demand (the first time a song is played) solved the problem.
It's pretty weird, I know Posted Image
I feel it depends on the last GM update rather that on the SG Audio DLL

ERRATA: I was wrong. I also commented in the room creation code:
display_set_all(640,480,-1,-1);

which execution was the real reason the new version crashed.

Edited by Hiric, 21 January 2012 - 02:02 AM.

  • 0

#83 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14446 posts
  • Version:GM:Studio

Posted 21 January 2012 - 05:52 AM

It's possible other objects in the boot room are trying to access the DLL before the other object finished setting it up.

The game working condition depending on object0's create to run first before object1. Maybe the last GM patch chages the order somehow.
  • 0

#84 Silver Scratch

Silver Scratch

    GMC Member

  • GMC Member
  • 166 posts
  • Version:GM8

Posted 27 January 2012 - 12:40 AM

Sorry for this nooooob question/error i have. Well I tried using mp3, and wav (i don't usually use ogg) but i get this error (with your DLL) "Uknown file formatt- file cannot be loaded- C:\Documents and Settings\SnacksProfile\My Documents\Music\Music.wav". Does it read only wav and ogg? Cause i get the same error with mp3... Please? Can you also tell me the only formatts it can read?
  • 0

#85 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 18 February 2012 - 10:34 PM

Yes, it can only read uncompressed WAV and OGG formats. Nothing else.

Anyway, the real reason I'm writing is - I've recompiled the DLL with the new version of my engine, as a result, some bugs should be fixed, some should become easier to fix.
The link is the same: http://www.box.com/shared/3tzyqjjp9c

P.S. Sorry for me being away for such a long time, had to sort out lots of things first. :)

Edited by snake5, 18 February 2012 - 10:45 PM.

  • 0

#86 Hiric

Hiric

    GMC Member

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

Posted 20 February 2012 - 01:31 AM

Yes, it can only read uncompressed WAV and OGG formats. Nothing else.

Anyway, the real reason I'm writing is - I've recompiled the DLL with the new version of my engine, as a result, some bugs should be fixed, some should become easier to fix.
The link is the same: http://www.box.com/shared/3tzyqjjp9c

P.S. Sorry for me being away for such a long time, had to sort out lots of things first. :)

YAY! Glad to know you're still working on it.
By the way, I tested the old one countless times and, for the way I used it, worked like a charm once I got how it handled a few things.

What did you exactly fix in this version? Is there something new? (the DLL is 50KB smaller)

Any chance that will be implemented a system that returns a unique ID each time the same sound is played? (so that positional audio can be achieved by panning each specific sound instance)

Thanks for your time!
  • 0

#87 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 20 February 2012 - 06:04 AM

--
NEWS:
> Uploaded the new version which fixes the freezing bug of the latest version.
> Added a SGAudio-Debug.dll which can be used for developers to check if the DLL works by using this one instead of the original. It is recommended to use this version in development to help me find and fix any bugs that could show up. OpenAL error checking is disabled in the original DLL.
---

What did you exactly fix in this version?

A few bugs, also made error output nicer, so, in case OpenAL errors pop up again, I'll know exactly where they are.

Any chance that will be implemented a system that returns a unique ID each time the same sound is played? (so that positional audio can be achieved by panning each specific sound instance)

It's probably a job for Game Maker, not the DLL. It's quite simple to achieve this and I'll probably make a script that does this soon enough (unless someone does it first.. :D ).

Edited by snake5, 20 February 2012 - 06:05 AM.

  • 0

#88 Hiric

Hiric

    GMC Member

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

Posted 25 February 2012 - 04:16 AM

Any chance that will be implemented a system that returns a unique ID each time the same sound is played? (so that positional audio can be achieved by panning each specific sound instance)

It's probably a job for Game Maker, not the DLL. It's quite simple to achieve this and I'll probably make a script that does this soon enough (unless someone does it first.. :D ).

Well, I'm already faking 2D positional audio via scripts. Is there a way to do this with the DLL as well, without allocating/reloading the same file for each instance of the same sound? (thus, without creating 2 different emitters?)

Anyway, I finally got the error that was -seldom, and very randomly- making the DLL crash.

Note that I'm using the DLL only for background music. That is, I play a track at the start of the level, and stop it at the end. No other operations are being done with the DLL in the meanwhile.

BUT

this error has been thrown in the mid of a level, after a few loops of the track.
Note: This does NOT make the game crash, but the music stops abruptly.

Sorry for the screenshot, but using WIN+TAB was the only way to be able to read something.

Can this be of help?
Posted Image

EDIT: Happened again, but after clicking OK on 3 dialog boxes like this that appeared asynchronously in respect of the game, one immediately after the other (that is, I was able to play, but without the music), the music started to loop again.

Edited by Hiric, 29 February 2012 - 10:20 PM.

  • 0

#89 AddictiveGames

AddictiveGames

    GMC Member

  • New Member
  • 7 posts
  • Version:GM:HTML5

Posted 04 March 2012 - 05:24 PM

Hello. I would like to use this DLL since SS download doesn't work with me, and SS extension is bugged. But...
I have never used DLL before with GM, so how do I install this (I know I put the DLL's in game folder)
  • 0

#90 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 08 March 2012 - 08:17 PM

thus, without creating 2 different emitters?

An emitter is an instance of a sound. So you need to address the problem differently. Since using lots of emitters has a high CPU cost, it is advised to make the most out of each emitter.

this error has been thrown in the mid of a level, after a few loops of the track.

This is somewhat unexpected and should only occur under high load. I'll look into it, though. It would really help if you could make an example that triggers the error in a few seconds (using a very small ogg file, for example) and upload it somewhere. That way I should be able to fix it in an hour or so.


I have never used DLL before with GM, so how do I install this

You need to put the DLL in the game folder (where the editable/executable is) and import the scripts. Then you can just follow the examples and call the scripts accordingly.
  • 0

#91 LRG

LRG

    GMC Member

  • GMC Member
  • 687 posts

Posted 27 March 2012 - 07:02 AM

I'm getting an error while trying to load wav files.
I'm using Game Maker 8.1 and this is the code I used to create the sound effects:
ind=sga_CreateFX(working_directory+"\sound\"+file, 1 );

The error I got was:

WAV load error: wrong chunk found


Does this have anything to do with the wav file being compressed instead of uncompressed?
If that is the case, how do I uncompress them (I'm using audacity)?

edit: I think saving wav files as WAV (microsoft) signed 16 bit PCM through Audacity gives the error. Some files load fine while others crashes...
Is it possible to make this work for all WAV files?

Edited by LRG, 27 March 2012 - 07:25 AM.

  • 0

#92 Hiric

Hiric

    GMC Member

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

Posted 27 March 2012 - 06:50 PM

this error has been thrown in the mid of a level, after a few loops of the track.

This is somewhat unexpected and should only occur under high load. I'll look into it, though. It would really help if you could make an example that triggers the error in a few seconds (using a very small ogg file, for example) and upload it somewhere. That way I should be able to fix it in an hour or so.



I... haven't been able to isolate it. It just happens midgame but it's a 40+MB game and probably only happens under heavy load, I can't replicate it in an example since I don't know exactly what to replicate (it's over 1MB of code).

Since I'm pretty sure I'm using the DLL correctly (it happens at a random position in the loop, and I'm 100% sure I don't access any other function of the DLL in the meanwhile), how can I prevent that error from happening? What does it mean?
"High load" is a bit generic. Is it an "out of memory" error? Could you please supply some more detail about the meaning of the error and its nature?
Maybe I am preloading too many SFX at a time?

Since it happens... asynchronously and without my intervention, I really don't know how to replicate it, if not by writing some random code, launching the example and crossing my arms waiting... something Posted Image

Edited by Hiric, 27 March 2012 - 06:52 PM.

  • 0

#93 snake5

snake5

    GMC Member

  • GMC Member
  • 71 posts

Posted 28 March 2012 - 08:18 AM

LRG:
There's lots of WAV formats. Can't support all of them. Compressed WAVs won't work, yes. But there might be some problems related to additional tags found in the file that are not present in the expected order - for example, if there are some tags or something like that added to the file and the chunk is before the WAV data, the reader will fail. It hasn't happened to me so it's hard to tell whose bug it really is. It'd be helpful if you could upload the WAV somewhere so I could use it to test my bugfix.

Hiric:
High load = more apps want to use all of the CPU time. Could happen if you have many DLLs that spawn new threads that don't want to share CPU time too.
  • 0

#94 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14446 posts
  • Version:GM:Studio

Posted 28 March 2012 - 07:25 PM

Open the wav in audacity, resave it. over that last 6 month I got complaints on wav on my end and on GM's end
  • 0

#95 Hiric

Hiric

    GMC Member

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

Posted 28 March 2012 - 09:30 PM

Hiric:
High load = more apps want to use all of the CPU time. Could happen if you have many DLLs that spawn new threads that don't want to share CPU time too.

Well, SG Audio is the only DLL I'm using in my game, if you're not talking about DLLs in general (which I can't control since the game, and the sound system, should be able to run on almost every Windows O.S. regardless of the number of DLLs used.)

Is there a practical way to solve this? Changing process priorities? Does it depend on hardware/drivers? Any idea on how to circumvent the problem?



  • 0

#96 D1g1talAli3n

D1g1talAli3n

    BoyGenius

  • New Member
  • 963 posts
  • Version:GM8

Posted 14 April 2012 - 01:41 PM

I noticed that when playing a sound repeatedly, SG Audio would stop the playing sound and then play it again. (And yes, I did remove the sga_Stop() from sga_PlayFX() ). However natively in GM, the sound would be played over the currently playing sound. This is the effect I want as it is very important for bullet sounds and such. Is there any way to achieve this?
  • 0

#97 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14446 posts
  • Version:GM:Studio

Posted 14 April 2012 - 07:33 PM

I noticed that when playing a sound repeatedly, SG Audio would stop the playing sound and then play it again. (And yes, I did remove the sga_Stop() from sga_PlayFX() ). However natively in GM, the sound would be played over the currently playing sound. This is the effect I want as it is very important for bullet sounds and such. Is there any way to achieve this?


do you reuse 1 emitter or have 1 emitter per sound effect?
  • 0

#98 D1g1talAli3n

D1g1talAli3n

    BoyGenius

  • New Member
  • 963 posts
  • Version:GM8

Posted 15 April 2012 - 04:38 AM


I noticed that when playing a sound repeatedly, SG Audio would stop the playing sound and then play it again. (And yes, I did remove the sga_Stop() from sga_PlayFX() ). However natively in GM, the sound would be played over the currently playing sound. This is the effect I want as it is very important for bullet sounds and such. Is there any way to achieve this?


do you reuse 1 emitter or have 1 emitter per sound effect?

I reuse 1 emitter which is created at the object creation code. Wouldn't creating an emitter every time you play the sound be slow? Bullets will be created at lease 4-6 times per frame.
  • 0

#99 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14446 posts
  • Version:GM:Studio

Posted 15 April 2012 - 04:51 AM

The way I read the interface, would you not need 2 emitters to play 2 sounds at the same time?
  • 0

#100 D1g1talAli3n

D1g1talAli3n

    BoyGenius

  • New Member
  • 963 posts
  • Version:GM8

Posted 15 April 2012 - 05:21 AM

The way I read the interface, would you not need 2 emitters to play 2 sounds at the same time?

Well playing two sounds at the same time isn't exactly my problem. The problem is playing the sound again before it has time to finish playing. For example, say the sound is 5 seconds long, and I play it every 2 seconds. In GM, it plays the entire 5 second sound over and over again every 2 seconds. However in SG Audio, as soon as the sound starts playing the sound that is already playing (due to it being 5 seconds long) (which is the same sound, btw) stops playing to give way to the other.

Is your solution to create and destroy an emitter every time I play the sound? Because that is possible, but I'm not sure if it will have a large performance cost.

On another topic, icuurd12b42, being the creator of GMFMOD, is GMFMOD a better choice for this? (I need 3d sound and the only current sound dlls that support it that I know of are SG Audio and GMFMOD)
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users