Home   Help Search Login Register  

Author Topic: Custom sound with Button Control  (Read 2864 times)

0 Members and 1 Guest are viewing this topic.

Offline Ext3rmin4tor

  • Members
  • *
Custom sound with Button Control
« on: 19 Jul 2011, 19:44:59 »
I have a keypad created with dialogs, and I want to add a custom sound to play when the button is pressed. In what path do I have to put the .ogg file and what filepath should I enter in the class definition for that button?
How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!

Offline Pirin

  • Members
  • *
Re: Custom sound with Button Control
« Reply #1 on: 19 Jul 2011, 20:32:52 »
From the tutorial about dialogs on this site you use soundEnter, soundPush and soundClick for that kind of thing.

The Biki also has an example with a sound file listed:

Code: [Select]
soundPush[] = { "buttonpushed.ogg", 0.1, 1 };
Note: Sounds are usually defined in the following convention: { "file.ogg", volume, pitch }, Volume ranges from 0.0 to 1.0. Pitch is a floating point number ranging from 0.0 to 4.0. 2.0 doubles the pitch (makes it higher), 0.5 halfs the pitch (makes it deeper) and 1.0 is normal.

Pretty sure the sound files would be in the root mission folder unless you reference them from another folder as any other resource.


Offline Ext3rmin4tor

  • Members
  • *
Re: Custom sound with Button Control
« Reply #2 on: 19 Jul 2011, 22:30:13 »
That sound is an internal ArmA sound (no more available in ArmA 2), the problem is I don't know what I have to put in the button class variable for the sound, I tried to put the path of the file and it doesn't work, I tried to define the sound in Description.ext and put the class name and it doesn't work.

Maybe I'm using a wrong path for the sound file, I tried to put it in missionFolder/Sound (where missionFolder is the folder of my mission). Do you know if that's correct?
« Last Edit: 19 Jul 2011, 22:32:14 by Ext3rmin4tor »
How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!

Offline Pirin

  • Members
  • *
Re: Custom sound with Button Control
« Reply #3 on: 20 Jul 2011, 01:46:11 »
Since it's directly asking for a file name and not a class, you might try sound/buttonpush.ogg or whatever you have it named as.  Possibly /sound/buttonpush.ogg, I'll have to try it later. :)

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Custom sound with Button Control
« Reply #4 on: 20 Jul 2011, 13:19:01 »
Weell....I checked out my own Code Pad script, and there I seem to have decided to simply use a playSound in the action= area, as such:

Code: [Select]
action = "Keypad_num = Keypad_num +1;num=format [""%1%2"",(ctrlText 999),""#""];ctrlSetText [999,num];playsound ""buttonnum"""
The playsound being the last thing there, and the actual sound being defined in the description.ext as per usual. It's for ArmA, but it should work unchanged in Arma 2 (if not, I think I have an Arma 2-ified version on my HD): CodePad by Wolfrug & Blanco.

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Ext3rmin4tor

  • Members
  • *
Re: Custom sound with Button Control
« Reply #5 on: 20 Jul 2011, 21:01:54 »
Ok, thanks, I had thought about that too, if it's the only way i'll do it.
How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!