This file was originally created for flightgear 0.9.10 I believe, but has not 
worked for a long time now, it was written by Darko Tasovac, we need it to work 
for multiple aircraft if possible using existing sounds available with a 
potential to add more sound files later! It is broken and I do not understand 
why?

#############################################################################
#

# Cockpit sound alerts

#

# Written by Darko Tasovac

# [EMAIL PROTECTED]

# Started 1 Oct 2006.

#############################################################################

#

# put the script in the data/Nasal folder

# Festival must be installed for copilot function!!!!

#

#############################################################################

# Global shared variables

#############################################################################

fg_root = getprop("/sim/fg-root");

alerts = "mk-viii";

sound_dir = sprintf("%s/Sounds/%s", fg_root, alerts);

fileName = "";

copilotVoice = "sim/sound/voices/voice[2]/text";

playSound = 0;

inAir = 0;

gearDown = 0;

next_interval = 0.1;

firstTime80 = 0;

firstTimeV1 = 0;

firstTimeRotate = 0;

#############################################################################

# Reference speed

#############################################################################

V1 = 152; # put the correct value

Vr = 170; # put the correct value

#############################################################################

# Copilot sound alerts 80 knots, V1 and rotation speed

# copilot voice sim/sound/voices/voice[2]/text, festival must be installed

#############################################################################



copilot = func {

v = getprop("/velocities/airspeed-kt");

if (v > Vr){

if (firstTimeRotate == 0){

setprop(copilotVoice,"rotate");

firstTimeRotate = 1;

};


}

else{

if( v > V1){

if(firstTimeV1 == 0){

setprop(copilotVoice,"V1");

firstTimeV1 = 1;

};


}

else{

if (v > 75){

if(firstTime80 == 0){

setprop(copilotVoice,"80 knots");

firstTime80 = 1;

};

};

};

};




settimer(copilot,0.5); # update copilot function

};



################################################################################

# Altitude alerts 10, 20, 30, 40, 50, 100, 200, 300, 400, 500, 1000 feet

# Too-low-terrain alert if gears are up and the agl is below 500ft

################################################################################


altitudeCheck = func {




agl = getprop("/position/altitude-agl-ft");

gearDown = getprop("/controls/gear/gear-down");

if (agl>1000){ inAir = 1;};

if (inAir*gearDown){


if ( agl <= 15 ) {

if(fileName != "altitude-10.wav"){

playSound = 1;

fileName = "altitude-10.wav";

inAir=0;

firstTime80 = 0;

firstTimeV1 = 0;

firstTimeRotate = 0;

}

else{

playSound = 0;

}

}

else {

if (agl <= 22){

if(fileName != "altitude-20.wav"){

playSound = 1;

fileName = "altitude-20.wav";

}

else{

playSound = 0;

}

}

else{

if (agl <= 32){

if(fileName != "altitude-30.wav"){

playSound = 1;

fileName = "altitude-30.wav";}

else{

playSound = 0;

}

}

else{

if (agl <= 42){

if(fileName != "altitude-40.wav"){

playSound = 1;

fileName = "altitude-40.wav";}

else{

playSound = 0;

}

}

else{

if (agl <= 50){

if(fileName != "altitude-50.wav"){

playSound = 1;

fileName = "altitude-50.wav";}

else{

playSound = 0;

}

}

else{

if (agl <= 100){

if(fileName != "altitude-100.wav"){

playSound = 1;

fileName = "altitude-100.wav";}

else{

playSound = 0;

}

}

else{

if (agl <= 200){

if(fileName != "altitude-200.wav"){

playSound = 1;

fileName = "altitude-200.wav";}

else{

playSound = 0;

}

}

else{

if (agl <= 300){

if(fileName != "altitude-300.wav"){

playSound = 1;

fileName = "altitude-300.wav";}

else{

playSound = 0;

}

}

else{

if (agl <= 400){

if(fileName != "altitude-400.wav"){

playSound = 1;

fileName = "altitude-400.wav";}

else{

playSound = 0;

}

}

else{

if (agl <= 500){

if(fileName != "altitude-500.wav"){

playSound = 1;

fileName = "altitude-500.wav";}

else{

playSound = 0;

}

}

else{

if (agl <= 1000){

next_interval = 0.1;

if(fileName != "altitude-1000.wav"){

playSound = 1;

fileName = "altitude-1000.wav";}

else{

playSound = 0;

}

};


};

};

};

};

};

};

};

};

};

};

}; 

#####################################################################################

# activate too low terreain alert at 500ft

#####################################################################################

if(agl<=500){

if (gearDown==0){

if(inAir){

next_interval = 1;

playSound = 1;

fileName = "too-low-terrain.wav"}}};


if(playSound){

tmpl = { path : sound_dir, file : fileName };

fgcommand("play-audio-message", props.Node.new(tmpl) );

playSound = 0;

};

nextCheck();

};





nextCheck = func {

settimer(altitudeCheck, next_interval );

}

#######################################################################################

nextCheck(); # initial start timer

settimer(copilot,0.1); # initial start timer

#############################################################################



A ZIP FILE can be downloaded from here

http://files.ww.com/files/48095.html

for - sound-alerts_nas.nas

Regards, Michelle / Aerotro

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to