Home   Help Search Login Register  

Author Topic: How to use CfgSFX?  (Read 2401 times)

0 Members and 1 Guest are viewing this topic.

Offline Carl Gustaffa

  • Members
  • *
  • I'm a llama!
How to use CfgSFX?
« on: 02 Jan 2006, 00:13:01 »
Hi

I have managed to play music in my mission I'm currently working (read: messing) with. I figured Cannon Fodder theme might be a cool one :) , so I converted to ogg, added some effects and put it in a trigger -- no problems really.

Then I wanted to make an airstrike alarm when an enemy recog airplane flies into a trigger which also causes the town to shut its lights. Pretty cool effect. But...

When I use the class CfgSounds combined with playSound, I'm not getting any directional clues as of where the alarm is going off. The sound is mono 128kbps ogg, but Audition claims it's in 32bit resolution for some reason. Don't think it's a problem though, since it actually plays when using CfgSounds. I guess this class is for playing a sound, pure and simple (even stereo sounds)?

I looked through some posts but I couldn't really find any info about a class called CfgSFX (or CfgEnvSounds for that matter). I guess CfgSFX is the one I should turn to for sounds that has an origin, but how on earth do I do it? Most tutorials I've seen deals with radio and playsound, and none of the default missions I've un-pbo'ed has any example usage.

Keep in mind I am a total newbie at this :) This class stuff is way over my head, and I have no idea how to interpret it, but a few examples usually put me on the right track.

Anyone have any ideas?

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:How to use CfgSFX?
« Reply #1 on: 02 Jan 2006, 00:53:52 »
Have you read the Music, Sound and Radio tutorial........link available from here?


Planck
I know a little about a lot, and a lot about a little.

Offline Carl Gustaffa

  • Members
  • *
  • I'm a llama!
Re:How to use CfgSFX?
« Reply #2 on: 02 Jan 2006, 02:22:59 »
Hi

The tutorials I've checked (didn't check those labelled 'old') didn't really cover CfgSFX, mainly music, (anonymous) sound, and radio.

But the builtin mission 38StatusQuo.Eden had sortof what I was looking for. I ended up with the following, which gives me directional ques:

Code: [Select]
class CfgSFX
{
   sounds[] = {airraid};
   
   class AirRaid
   {
      name = "AirRaid";
      sounds[]={sound1};
      sound1[]={"AirRaidAlarm.ogg", db-5,1, 1, 1, 1, 1};
      empty[]= {, , , , 1 , 5, 20};
   };
};

I am now able to play this sound by selecting it as a trigger sound within the triggers effect menu. I'm not able to play it using playSound. But, I now have a looping sound. I'll start trying out those '1's and see what happens, but does anyone have a list of what they do? And what's that empty[] stuff all about?


Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:How to use CfgSFX?
« Reply #3 on: 02 Jan 2006, 02:54:54 »
Quote
And what's that empty[] stuff all about?

Good question,......no idea really.

Here is a snippet from the game config....cfgSFX section.

Code: [Select]
class WolfSfx
   {
      sounds[]={"wolf1","wolf2","wolf3"};
      name="$STR_DN_WOLF";
      wolf1[]={"animals\wolf1",0.001,1,0.3,0.1,0.5,5};
      wolf2[]={"animals\wolf2",0.001,1,0.3,0.1,0.5,5};
      wolf3[]={"animals\wolf3",0.001,1,0.3,0.1,0.5,5};
      empty[]={"","","","",0.5,4,50};
   };

   class CrowSfx
   {
      sounds[]={"crow1","crow2","crow3"};
      name="$STR_DN_CROW";
      crow1[]={"animals\crow1_1",0.001,1,0.2,0.1,0.5,5};
      crow2[]={"animals\crow1_2",0.001,1,0.2,0.1,0.5,5};
      crow3[]={"animals\crow1_3",0.001,1,0.2,0.1,0.5,5};
      empty[]={"","","","",2,10,30};
   };


Planck
I know a little about a lot, and a lot about a little.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:How to use CfgSFX?
« Reply #4 on: 05 Jan 2006, 22:06:34 »
Unless I'm mistaken, there is no CfgSFX class within the description.ext.

Bear in mind that there is a difference between a config.cpp and a description.ext (even when configuring sounds).

Unless I'm mistaken, description.ext has only the following sound-related entries:

CfgRadio - Sounds/text via squad radio. Played via 'sideradio'/etc commands
CfgSounds - General sound FX. Played via 'playsound' or 'say' commands / trigger effects menu
CfgMusic - Music; can be stereo. Played via 'playmusic' command / trigger effects menu
CfgEnvSounds - Looping environmental sounds; can be stereo. Played via trigger effects menu

In your case, you want to define your sound under the CfgSounds section. Then you want to play your sound via the "say" command. The 'say' command makes the sound come from a specific object (and thus a position), while the 'playsound', as you discovered, does not. You can use a gamelogic as the source of the 'say' command, if you don't want to use a visible object.

HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re:How to use CfgSFX?
« Reply #5 on: 06 Jan 2006, 10:48:37 »
If you want the sound to belike it's coming from somewhere, use an object, like a bush you've place and have that "Say" the sound.
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline 456820

  • Contributing Member
  • **
Re:How to use CfgSFX?
« Reply #6 on: 06 Jan 2006, 21:06:27 »
one thing with that architect ive noticed with ECP say sounds are alot more quieter if you stand 20metres away in the orignal game you can hear it but with ECP you wouldnt be able to i would use a playsound but make it quieter then normal and add an echo to make it aper its happening far away

Offline Hawkins

  • Former Staff
  • ****
  • Team 2-2
Re:How to use CfgSFX?
« Reply #7 on: 07 Jan 2006, 17:02:14 »
General, there is a CfgSFX within the description.ext. :)

Code: [Select]
class CfgSFX
{
sounds[] = {angrytiger,ape};
class angrytiger
   {
      sounds[]={"tiger1"};
      name="Tiger";
      tiger1[]={"angrytiger.ogg",db,1,1,20,30,40};
      empty[]={"","","","",0.5,4,50};
   };
   class ape
   {
      sounds[]={"ape1"};
      name="Ape";
      ape1[]={"ape.ogg",db,1,1,20,30,40};
      empty[]={"","","","",0.5,4,50};
   };

That's just an example, a WIP SFX config from an old mission I'm tuning. I know this works, I've tested it. One thing I don't know is how
sounds[]={"ape1"};
and
ape1[]={"ape.ogg",db,1,1,20,30,40};
are connected. I tried placing three different ape sounds, within the sounds[] part and then making a seperate entry for them, just like ape1. I reckoned it would randomly select one sound and play it, but it didn't. I tested it quite a few times, and it always played the same sound, the first on the line.
Now, does this mean that we can only use one sound in it, or is the random function here as shitty as it is with other OFP things? If it's not random, then why are there many sounds, for example with the wolf entry, defined in the cpp? How are those played?

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:How to use CfgSFX?
« Reply #8 on: 19 Jan 2006, 08:11:09 »
Stupid email notifications not working...

Anyway, I'd never seen/used cfgSFX in a description.ext, so that's new to me. How do you play sounds configured there? I wonder how it is different from cfgSounds... ???

I'm sure that you are on to something regarding it playing a random sound from the list. I know there is a way to configure it like that in the game config. Here's my hunch:

ape1[]={"ape.ogg",db,1,1,20,30,40};

Now what exactly does everything after the soundfile name DO? I would take a stab in the dark, and guess that some of it has to do with the position the sound comes from (XYZ coordinates relative to the source of the sound), and part of it has to do with the probability that the sound is played.

I'd guess the last 3 are the XYZ, while one of those 1's is the probability. Since 1=100%, if you just copied and pasted that line, changing only the sound file, then ofp would never get to the next sounds (since it plays the 1st sound 100% of the time).

Just a hunch, but the game config works in a similar fashion, so I wouldn't be surprised.

EDIT

I'd guess that the other 1 is the pitch of the sound, like in cfgSounds. The db part likely works like the same part in cfgSounds as well, letting you adjust the volume of the sample.
« Last Edit: 19 Jan 2006, 08:30:00 by General Barron »
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline Hawkins

  • Former Staff
  • ****
  • Team 2-2
Re:How to use CfgSFX?
« Reply #9 on: 19 Jan 2006, 08:22:30 »
The sounds show up in the... umm... was it the effects menu? I can't check since OFP isn't allowed to be installed on my work computer. :P Never knew if there was a command to play them, for example from a script. Gotta look into that.

You might be right about the random and positions. I will check that. I did think the 20,30,40 must be the place where the sound is played. It must be.
You must be right. The game config does indeed work in a similiar fashion. :) Good info Gen. Barron. I will look into this more later today at home.
« Last Edit: 19 Jan 2006, 08:22:54 by Hawkins »

johan_d2

  • Guest
Re:How to use CfgSFX?
« Reply #10 on: 22 Jan 2006, 20:36:38 »
class CfgSFX
{
   access = ReadAndCreate;
   // special
   // sfxfile, vol, frq, probab, min_delay, mid_delay, max_delay
   seagull[]={animals\gulls1,db-30,1, 1, 0.2, 1, 5};

from the commented cppp..

Offline Hawkins

  • Former Staff
  • ****
  • Team 2-2
Re:How to use CfgSFX?
« Reply #11 on: 23 Jan 2006, 08:29:15 »
Quote
There it is...

:)

Good stuff johan_d2!