Howto:Add cabin announcements

From FlightGear wiki
Jump to navigation Jump to search

This howto is inspired by Liam's A340-600 Cabin Announcements

Get the sounds

Note: always check the license that sound files are distributed under, before using them. Contact the original author if in doubt.

You have to get the sound files you may like for your cabin announcements. There are lots of them in the internet. I have used many taken from an add on to other flight simulator called FSPassengers. They seem to be free, and you have different options, in different languages. I have taken these sounds for my cabin announcements:

crew1_welcomeonboard.wav
crew2_safetyaboard.wav
crew3_climbingdevice.wav
crew4_levelautobelt.wav
crew4_levelbelt.wav
crew5_fastenwind.wav
crew6_descent.wav
crew6_descentautobelt.wav
crew7_beforeland.wav
crew8_afterland.wav
crew9_atgate
crew_0failproblem.wav
crew_playmovie.wav
crew_preparetakeoff.wav
crew_servedrink.wav
crew_servehotfood.wav
crew_servesandwich.wav

The sound folder

Once you have chosen the sounds you would like to add to your FlightGear plane, just copy them to the Sounds folder inside your aircraft folder. Lets suppose, that you are adding sounds to your 737-300. The folder would be, for example, Aircraft/737-300/Sounds

Now you have to change a file inside that folder. It is the file that controls the sounds of your aircraft. It name can be, for example, 737-sound.xml In this file you have the sounds for the engine of your plane, and so on.

You have to add a section like the following for each of the cabin sounds you have to add. For example, for the welcome sound you create an item called <welcome>:

<welcome>
	<name>welcome</name>
	<path>Aircraft/737-300/Sounds/crew1_welcomeonboard.wav</path>
	<mode>once</mode>
	<condition>
		<property>controls/switches/welcome</property>
	</condition>
	<volume>
		<property>sim/sound/Evolume</property>
	</volume>
	<position>
		<x>0.00</x>
		<y>0.00</y>
		<z>-0.00</z>
	</position>
	<reference-dist>10.0</reference-dist>
	<max-dist>100.0</max-dist>
</welcome>

Do this, changing the names, for each of the sounds you want to add. Put the right name for the path where you have copied the sounds.

The menu bar and the sound

You want the Menu Bar of your aircraft to have to option for cabin announcements. You have to go to the main folder of your aircarft, for example /Aircraft/737-300.

There you find a set file, like 737-300-set.xml. You have to browse this file looking for the menu bar settings:

<menubar>
...
...
</menubar>

Inside these settings you have to add a new item, like this:

<item>
	<label>Announcements</label>
	<binding>
		<command>nasal</command>
		<script>
			var mal = gui.Dialog.new("/sim/gui/dialogs/Boeing747/menu/dialog", "Aircraft/737-300/Dialogs/announcements-dialog.xml"); mal.open();
		</script>
	</binding>
</item>

There is still other thing to do inside this -set.xml file. You have to look for the sound options. They may look like this:

<sound>
	<path>Aircraft/737-300/Sounds/737-sound.xml</path>
	<switch type = "bool"></switch>
</sound>

You have to add the Esound line, so it will look like this:

<sound>
	<path>Aircraft/737-300/Sounds/737-sound.xml</path>
	<switch type = "bool"></switch>
	<Evolume>1</Evolume>
</sound>

The Dialogs

Next step is to use, or create, a folder inside the aircraft, called Dialogs. For example: /Aircraft/737-300/Dialogs

Inside this folder, you have to create a file called anouncemnts-dialog.xml

The file must have a content like this:

<?xml version="1.0"?>
<PropertyList>
 <name>Cabin Announcements</name>
 <layout>vbox</layout>
 <text>
   <label>Cabin Announcements</label>
 </text>
 <hrule/>
 <group>
   <layout>vbox</layout>
   <halign>center</halign>
   <text>
     <label>To hear more clearly, change to an interior view.</label>
   </text>
   <checkbox>
     <halign>left</halign>
     <label>Welcome</label>
     <property>/controls/switches/welcome</property>
     <binding>
       <command>property-toggle</command>
       <property>/controls/switches/welcome</property>
     </binding>
   </checkbox>
 </group>
 <hrule/>
 <group>
   <layout>hbox</layout>
   <empty><stretch>true</stretch></empty>
   <button>
     <legend>Close</legend>
     <default>true</default>
     <key>Esc</key>
     <binding>
       <command>dialog-close</command>
     </binding>
   </button>
   <empty><stretch>true</stretch></empty>
 </group>
</PropertyList>

This file has only one <checkbox> for only one sound (the welcome sound). But you have to do checkboxes for each of the sounds you want to add, changing its labels. For example:

   <checkbox>
     <halign>left</halign>
     <label>Safety Briefing</label>
     <property>/controls/switches/safety</property>
     <binding>
       <command>property-toggle</command>
       <property>/controls/switches/safety</property>
     </binding>
   </checkbox>
   <checkbox>
     <halign>left</halign>
     <label>Prepare for Takeoff</label>
     <property>/controls/switches/preparetakeoff</property>
     <binding>
       <command>property-toggle</command>
       <property>/controls/switches/preparetakeoff</property>
     </binding>
   </checkbox>

And so on, for each sound.

The Nasal file

The last step, is to do a minor change in the system.nas file. This file is in the Nasal folder of your aircraft.

You only have to add this line, at the beginning of the file:

var engine_dialog = gui.Dialog.new("Aircraft/737-300/Dialogs/announcements-dialog.xml");

That is it. In the menu of your plane, you sould find now the announcements. I hope you enjoy.