Jump to content
RedBelette

createSoundSource and description.ext

Recommended Posts

Hello everyone,

I am currently having difficulty playing SFX sounds in my mission. It does not seem to work.

 

description.ext

class CfgSFX
{
	class Monster_SFX
	{
		name = "Monster scream";
		sound0[] = {"media\sfx\monsterscream1.ogg", 100, 1.0, 1000, 0.2, 0, 15, 30};
		sound1[] = {"media\sfx\monsterscream2.ogg", 100, 1.0, 1000, 0.2, 0, 15, 30};
		sound2[] = {"media\sfx\monsterscream3.ogg", 100, 1.0, 1000, 0.2, 0, 15, 30};
		sound3[] = {"media\sfx\monsterscream4.ogg", 100, 1.0, 1000, 0.2, 0, 15, 30};
		sounds[] = {sound0, sound1, sound2, sound3};
		empty[] = {"", 0, 0, 0, 0, 0, 0, 0};
	};
};

And the code from debug: 

createSoundSource ["Monster_SFX", position player, [], 0];

From the debug console : <NULL-Object>

getarray (missionconfigfile>>"CfgSFX" >>"Monster_SFX">> "sounds")
// Return : ["sound0","sound1","sound2","sound3"]

Do you know what mistake I made?
(The ogg have been tested with CfgSounds successfully)

 

Thanks by advance ;)

  • Like 1

Share this post


Link to post
Share on other sites

I got it to work by also making class CfgVehicles. It then can be selected within a trigger under SFX.

 

Example:

class CfgSFX
	{
	class explosion
		{
		// filename, volume, pitch, distance, probability randomly (0-1), minDelay, midDelay, maxDelay 	Numbers - time to wait before playing next sound (or the same sound in the loop).
		name = "explosion";
		sound0[] = {"snd\explosion.ogg", 25, 1, 400, 1, 0, 0, 15};
		sound1[] = {"snd\explosion.ogg", 25, 1, 400, 1, 0, 0, 15};
		sound2[] = {"snd\explosion.ogg", 25, 1, 400, 1, 0, 0, 15};
		sounds[] = {sound0, sound1, sound2};	
		empty[] = {"", 0, 0, 0, 0, 0, 0, 0};
		};
	
	class fire_burning
		{
		// filename, volume, pitch, distance, probability randomly (0-1), minDelay, midDelay, maxDelay 	Numbers - time to wait before playing next sound (or the same sound in the loop).
		name = "fire_burning";
		sound0[] = {"snd\fire_burning.ogg", 25, 1, 400, 0, 0, 0, 15};
		sound1[] = {"snd\fire_burning.ogg", 25, 1, 400, 0, 0, 0, 15};
		sound2[] = {"snd\fire_burning.ogg", 25, 1, 400, 0, 0, 0, 15};
		sounds[] = {sound0, sound1, sound2};	
		empty[] = {"", 0, 0, 0, 0, 0, 0, 0};
		};

		
	};

class CfgVehicles
	{
	class explosion // class name to be used with createSoundSource
	{
		sound = "explosion"; // reference to CfgSFX class
	};
	
	class fire_burning // class name to be used with createSoundSource
	{
		sound = "fire_burning"; // reference to CfgSFX class
	};
};	

IIRC that was all I did but I might have forgotten something.

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites

I appreciate your intervention, you answered quickly and it's correct;)
Thanks a lot

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×