Jump to content


Photo

Fmod Sound System Engine


  • Please log in to reply
873 replies to this topic

#61 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 28 January 2008 - 11:15 PM

Yay. This is exactly what I was looking for!  :)

Question: Is there any way to add (fading) pan to 3d sounds? I found the "ListenerHearDistanceOnly" script, but it seems like all sounds to the right of the point are immediately sent to right speaker and vice versa. It would be nice if I could make the sounds go from one speaker to the other slower, if you know what I mean?

<{POST_SNAPBACK}>



You cannot pan 3d sounds. The pannning is taken over by the 3d system...

You can pan the group it's playing on...

You can also play with SetListenerPositionExt (replaces the other set listener an hears only distance call) and see if you can tilt the players hears in such a way that you get the desired effect.

You can also try to move the sound (or player) a little deeper on the z axis. I did not try this but I think if you move either the sound or the listenner on a different axis, they will fade smoother. Make sure ListenerHearDistanceOnly is turned off though.

Edited by icuurd12b42, 28 January 2008 - 11:15 PM.

  • 0

#62 Mordi

Mordi

    Maker of Menus

  • New Member
  • 3635 posts

Posted 29 January 2008 - 03:37 PM

Yay. If you set the listener to a minus Z value (For example "-50") you'll get a smooth fade! Nice.

Thanks for the tip. I love it.
  • 0

#63 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 30 January 2008 - 01:33 AM

Yay. If you set the listener to a minus Z value (For example "-50") you'll get a smooth fade! Nice.

Thanks for the tip. I love it.

<{POST_SNAPBACK}>



Cool. And good to know.
  • 0

#64 rinkuhero

rinkuhero

    Paul Eres

  • GMC Member
  • 1792 posts

Posted 20 February 2008 - 11:37 AM

This is a great DLL, thanks for making it. Since my game is shareware I'll have to buy that $100 license; but it's a lot more flexible than supersound.dll (which I used in my last game), so I think it's worth that.

When you use FMODinit(), does the number of sounds you set it to be allowed to play at once matter much? I mean, obviously you don't want it too small, but will setting it to 500 instead of 100 reduce performance or anything?
  • 0

#65 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 20 February 2008 - 02:26 PM

This is a great DLL, thanks for making it. Since my game is shareware I'll have to buy that $100 license; but it's a lot more flexible than supersound.dll (which I used in my last game), so I think it's worth that.

When you use FMODinit(), does the number of sounds you set it to be allowed to play at once matter much? I mean, obviously you don't want it too small, but will setting it to 500 instead of 100 reduce performance or anything?

<{POST_SNAPBACK}>


The demo is set to 500 BTW...

It's the number at which new sounds will stop old one if they have higher priority (defined by the group it's in).

Stopped sounds will not restart.

The number can be high if sounds become inaudible because they are too far, having more than 75 sound instances heard it not recommended for obvious reasons.

It's useful to prevent lower priority looped sound from stopping.

Not much great cost in CPU but it is best to make sure to stop looped effects sounds to prevent the number to go too high. When not heard, the system loops through playing sounds to update the track position, so there will be a bit of overhead. Not much.

The demo AI engine looped sounds stop and end the according to distance to save on the resource.

The player car sound is also looped but with no checking. Change the setting to 5 in the demo and you will see it will stop and will not restart.

It's best for looped sound effects to be stopped. A juke box or radio in the game can let the sound playing because it's always nice to have the music continue while you are away from it even if not audible. Just check if it's playing when the player is again close enough, just in case the system stole it's spot.

But, if you have enough spots, and you know spot theft will never happen, you don't need to check.

Just make sure you code your game so you don't have more than 75 sounds audible at the same time or the system may become unstable (depending on the user's sound card)

Imagine (audible) sound instances are like surfaces for video cards. The more you have, the more likelly the system will start to fail... I tested with 150 audible sound intances... Unbearable to hear and my system became unstable when I quit the game.

Edited by icuurd12b42, 20 February 2008 - 02:34 PM.

  • 0

#66 rinkuhero

rinkuhero

    Paul Eres

  • GMC Member
  • 1792 posts

Posted 20 February 2008 - 06:15 PM

Ah, thanks for the info.

Another question: is there any advantage of having 2d sound over 3d sound? By that I mean, can 2d sound do anything that 3d sound cannot? Or is 2d sound only useful when you don't want the sound's position and volume to vary based on the listener's position?
  • 0

#67 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 20 February 2008 - 06:30 PM

Ah, thanks for the info.

Another question: is there any advantage of having 2d sound over 3d sound? By that I mean, can 2d sound do anything that 3d sound cannot? Or is 2d sound only useful when you don't want the sound's position and volume to vary based on the listener's position?

<{POST_SNAPBACK}>

You should only use 3d if you plan to make the sound player relative. There are enough 2d sound properties to achieve most anything (like panning and fading).

One thing a 3d sound cannot do is panning left and right... Since the 3d sound is already being panned by the 3d system (left and right channels set centered in that sound and output set left and right set relative to the player in the room). So, you can't use any paning function on a 3d sound.


In the demo, add a 3d sound in the last room, where everything is quiet... Use a sound that has a lot of variation between the left and right speaker... and move arround it. You'll see what I mean. Set the Hears direction and get confused even more LOL.

Edited by icuurd12b42, 20 February 2008 - 06:33 PM.

  • 0

#68 rinkuhero

rinkuhero

    Paul Eres

  • GMC Member
  • 1792 posts

Posted 21 February 2008 - 01:32 AM

Thanks again for the info. One thing I wondered is -- you know how some games have a song that has an intro, and then when it repeats, it repeats at a certain point in the song, not all the way from the intro to the song? Example: A 1:20 song with 20 second intro, but when it loops it loops starting at 20 seconds in. Is it possible to do that with this?
  • 0

#69 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 21 February 2008 - 03:26 AM

Thanks again for the info. One thing I wondered is -- you know how some games have a song that has an intro, and then when it repeats, it repeats at a certain point in the song, not all the way from the intro to the song? Example: A 1:20 song with 20 second intro, but when it loops it loops starting at 20 seconds in. Is it possible to do that with this?

<{POST_SNAPBACK}>


Yeah, that is an FMOD feature... I did not implement it in my dll though


You can play once, when the sound is done, restart it paused, set it's position and unpause it. Every subsequent play once would play it from that point...

pseudo code

create
sound = sound add
instance = sound play

step or alarm
if instance is not playing
instance = sound play paused
instance set position
instance unpause


That is why I did not implement it in the DLL as you can easily set it up like that.
FMOD can set the loop repeat start and end position, the repeat count and a few other feature I did not implement since it's actually simple to code it in gm.
  • 0

#70 rinkuhero

rinkuhero

    Paul Eres

  • GMC Member
  • 1792 posts

Posted 22 February 2008 - 06:02 PM

Thanks again!

Another question:

You can use 'FMODSoundSet3dMinMaxDistance' to set the min and the max distance, but is there any way to get the min and the max distance after you set them? I suppose I could just store that data in variables too, but if there is a way to get them that'd save a lot of work.

EDIT: Nevermind, I'm stupid, I just saw FMODSoundGetMaxDist (although there doesn't seem to be a FMODSoundGetMinDist?).

Edited by rinkuhero, 22 February 2008 - 06:04 PM.

  • 0

#71 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 22 February 2008 - 09:01 PM

Thanks again!

Another question:

You can use 'FMODSoundSet3dMinMaxDistance' to set the min and the max distance, but is there any way to get the min and the max distance after you set them? I suppose I could just store that data in variables too, but if there is a way to get them that'd save a lot of work.

EDIT: Nevermind, I'm stupid, I just saw FMODSoundGetMaxDist (although there doesn't seem to be a FMODSoundGetMinDist?).

<{POST_SNAPBACK}>


You don't need the min distance... Think about it for a moment :D. Then scroll a bit to see why...

FMODInstanceGetMaxDist is also available, in case your code changes the instance minmax info for just that instance.

Aren't you glad I thought of everything? :D




















You use max distance to decide to end/start the sound instance. Min is totally useless for that. You can always use a GM variable for min if you really needed it.

Edited by icuurd12b42, 22 February 2008 - 09:02 PM.

  • 0

#72 rinkuhero

rinkuhero

    Paul Eres

  • GMC Member
  • 1792 posts

Posted 02 March 2008 - 08:20 PM

Another question. Can this dll (or the other FMOD dll for that matter) be used with the FMOD Designer?
  • 0

#73 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 02 March 2008 - 09:16 PM

Another question. Can this dll (or the other FMOD dll for that matter) be used with the FMOD Designer?

<{POST_SNAPBACK}>


Not in any way I can think of... Sorry.
  • 0

#74 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 26 March 2008 - 06:38 AM

New! Source Included!

Yes, I decided to add the source for the dll and the encriptor application. All you need is to get a compiler and get FMOD's development package.

Why?
1) I just don't want people in 5 years wondering where to get the DLL if ever I am no longer arround... At least some of you will have the source.

2) Some of you may need extra features not implemented in the dll

Just don't go arround and claim the dll is yours OK :).

Edited by icuurd12b42, 26 March 2008 - 06:42 AM.

  • 0

#75 Fede-lasse

Fede-lasse

    AI Programmer

  • GMC Member
  • 2009 posts
  • Version:Unknown

Posted 28 March 2008 - 08:42 PM

This sytem supports sound blocking to block or fade sounds behind walls (in a 3d sound setup)

:(

- Fede-lasse
  • 0

#76 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 01 April 2008 - 03:03 AM

Now compiled with

FMOD Ex API version: 4.12.07

Adds
FMODSoundGetLength
FMODInstanceSoundGetLength

Edited by icuurd12b42, 03 April 2008 - 04:38 AM.

  • 0

#77 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 03 April 2008 - 04:17 AM

[edit]
this has been resolved in 1.8
[/edit]



This hack is for people who have experienced trouble fast forwarding/rewinding through a MIDI
and find their music stops and the game hangs when you close it.

I have experienced this problem once in all the months using the DLL, it's by all means NOT a show stopper.

But, being the kind of guy I am, I decided to warn you guys about it.

The problem is GM related ONLY. I cannot identify the cause of the hang as it works without any problem in a regular EXE.

THIS IS ONLY IF YOU EXPERIENCED THE PROBLEM FOR SOME MIDI INCLUDED IN YOUR GAME AND USE SetPosition,
DO NOT USE IF YOU DON'T HAVE THE PROBLEM WITH THE MIDI YOU INCLUDED IN YOUR GAME OR DON'T USE SetPosition.
IF YOU ALLOW THE USER TO SELECT A MIDI AND USE SetPosition IN YOUR GAME, YOU SHOULD USE THIS CODE.

troublesome code
//Big skip ahead
	FMODInstanceSetPosition(m_instance,.9); //when at 0, big jump
or
//forward a little while a key is down
	FMODInstanceSetPosition(m_instance,min(FMODInstanceGetPosition(m_instance)+.01,1));

Fix
if(FMODInstanceIsPlaying(m_instance)) 
{
	var p;
	FMODInstanceSetPaused(m_instance,true);
	FMODUpdate();
	//rewind a little
	p = max(FMODInstanceGetPosition(m_instance)-.01,0);
or
	//forward a little
	p = min(FMODInstanceGetPosition(m_instance)+.01,1);

	FMODInstanceStop(m_instance);
	FMODUpdate();
	m_instance = FMODSoundPlay(m_sound,true /*paused*/);
or
	m_instance = FMODSoundLoop(m_sound,true /*paused*/);
or
	m_instance = FMODSoundPlay3d(m_sound, x,y,z, true /*paused*/);
or
	m_instance = FMODSoundLoop3d(m_sound, x,y,z, true /*paused*/);

	FMODUpdate();
	FMODInstanceSetPosition(m_instance,p);
	FMODUpdate();
	FMODInstanceSetPaused(m_instance,false);
	FMODUpdate();
}
YOU MAY ALSO USE THE SEQUENCE IF YOU FORWARD/REWIND THE MIDI BY A LARGE AMOUNT ONCE AND EXPERIENCE THE SAME PROBLEM.

Edited by icuurd12b42, 30 July 2008 - 07:45 AM.

  • 0

#78 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 06 April 2008 - 01:17 AM

UPDATE 1.7

Compiled with FMOD 4.14.00
FIXES
FMOD internal problem with some MIDI files not turning off midi notes (introduced in last FMOD update)

ADDS
FMODInstanceAddEffect
FMODGroupAddEffect
FMODEffectFree

Those can be used to change the effect of a sound instance or sound group to implement such effects like when the player jumps under water or for effect such as in Guitar Hero when you are in Star Power mode. Not to confuse with sound effects which are permanent. Those are dynamic and you can set/remove them at any time while the instance is playing.

Edited by icuurd12b42, 06 April 2008 - 01:22 AM.

  • 0

#79 Droolie

Droolie

    GMC Member

  • New Member
  • 117 posts

Posted 06 April 2008 - 09:06 AM

Hey there! I've got a question.
Can this dll set loop points, like SXMS can?
  • 0

#80 icuurd12b42

icuurd12b42

    Self Formed Sentient

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

Posted 06 April 2008 - 10:46 PM

Hey there! I've got a question.
Can this dll set loop points, like SXMS can?



No, I did not add the feature in it. I could though.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users