Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > irrKlang
Volume seems wrong

bk-
Registered User
Quote
2011-06-04 03:04:34

Im trying to play a footstep sound. However, it has to be played at a lower volume for the player that i control than for other players round me.

So what i did is this:



void PlayerSounds::updateFootsteps(GameSession* session,
GamePlayerMovement* movement,
GPGroundInfo* groundInfo)
if (mFootsteps)
{
if (mFootsteps->isFinished())
{
mFootsteps->drop();
mFootsteps = NULL;
}
else
{
mFootsteps->setPosition(SoundManager::irrVec(groundInfo->getFloorPosition()));
return;
}
}

assert(!mFootsteps);
ISoundSource* stepSound = Core::soundResources()->getFootsteps(groundInfo->getFeetMaterialType(), mStepsIndex);
mStepsIndex = (mStepsIndex + 1) % 2;

mFootsteps = SoundManager::system()->play3D(stepSound, SoundManager::irrVec(groundInfo->getFloorPosition()), false, false, true, false);

if (mPlayer.getIsManagedHere())
mFootsteps->setVolume(0.3f);
else
mFootsteps->setVolume(1.0f);
}


Note that SoundManager::system == ISoundEngine.

It appears that occasionally (well once every 2 - 3 seconds) the volume is changing. Note that at this stage, im not even testing with multiple players so it always sets the volume at 0.3.
Is there a better way to handle this, am i doing it wrong or what?


niko
Moderator
Quote
2011-06-04 07:34:47

You could try and see if it gets better if you start the sound paused, then set the volume and then unpause the sound. Could help.


bk-
Registered User
Quote
2011-06-06 00:03:31

Thanks, this seems to help indeed.

I have another question though.
If I drop an ISound instance, is its memory freed or do you recycle sounds. It seems a bit strange to me that a new ISound is allocated for each sound to be played.

For instance when i want to play 10 sounds simultaneously at the same position i have to allocate 10 sounds, update the 10 sound's positions (even though they all have the same position) while only their sources (may) be different.

I would expect that I could use 1 instance of ISound and have it play, for instance: 10 sounds. Thus ISound keeps a list internally playing sounds.
Then when i set the position on this ISound, the position is set for all these sources.

The current system is somewhat cumbersome when u want to track a lot of sounds, and i find it akward that i have to drop and reallocate a new sound for every trackable sound, unless of course that irrklang recycles them internally.

regards,
bk


niko
Moderator
Quote
2011-06-06 18:30:18

Memory is freed as soon as the ISound object isn't needed anymore, in most cases that is when you stop and drop it. Independently of this, sound buffers are also shared between these, so a ISound object is usually only a few bytes (like 50 bytes or similar) in size. C++ has no problems creating and deallocating these at high frequencies, it works like that.


dex2015
Registered User
Quote
2015-03-25 12:48:17

I know, wrong part of forum, but how to achieve this (player/footsteps sounds) in CopperCube/CopperLicht?


niko
Moderator
Quote
2015-03-26 05:41:13

In CopperCube, that's much higher level, you would just play the sound with the position and/or volume.


crackyourspeaker
Registered User
Quote
2015-06-23 21:25:24

is there an easier way to add footstep sounds to your player.. i tred add a sound with the behavior of when pressing a key which is w for walking forward but good lord that didn't work.. all that did was it playing the sound rapidly like a machine gun lol


erik
Registered User
Quote
2015-06-24 15:31:23

Crackyourspeaker: If you want footstep sounds in CopperCube, I think this should be easier. Niko mentioned that he'll add support for it in a free update. Maybe you could ask him about it. Otherwise you could also do a bit of scripting and add it yourself.


crackyourspeaker
Registered User
Quote
2015-06-26 01:15:52

yea if only I knew how to script.. I have no clue where to even start when It comes to that.. so frustrating but thanks, I need a developer to come to my house like seriously


niko
Moderator
Quote
2015-06-26 08:22:44

Hi crachyourspeaker, I think I'll post a simple plugin for playing footstep sounds in the next weeks. What target are you using this for?


crackyourspeaker
Registered User
Quote
2015-06-26 11:38:01

oh that would be great thanks, im using the FPS.. currently working on a horror game. I will be buying coppercube tomorrow so after months of trying out other engines, coppercube is by far the best.


pittie
Registered User
Quote
2015-08-29 06:39:02

wrote:
Hi crachyourspeaker, I think I'll post a simple plugin for playing footstep sounds in the next weeks. What target are you using this for?


Hello,

are there any news about the plugin?

I have the play steps sounds problem too (Windows exe).

Regards
Pittie


niko
Moderator
Quote
2015-08-30 16:59:14

No, sorry, not yet. :/


svartvatten
Guest
Quote
2016-02-01 23:14:04

I am after the same as Crackyourspeaker. I would be glad if it would soon be possible to make these footsteps heard :-)


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "I?ternational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact