1
0
Fork 0
A320-family/Nasal/Panels/acp.nas

103 lines
2.8 KiB
Text
Raw Normal View History

2019-10-14 16:48:35 +00:00
# A3XX Audio Control Panel
# merspieler
############################
# Copyright (c) merspieler #
############################
# NOTE: This is just temporary until FG allows a full implementation of the audio system.
2020-05-21 19:37:27 +00:00
var vhf1_capt_recive = props.globals.initNode("/controls/audio/acp[0]/vhf1-recive", 1, "BOOL");
var vhf2_capt_recive = props.globals.initNode("/controls/audio/acp[0]/vhf2-recive", 1, "BOOL");
var vhf1_capt_volume = props.globals.initNode("/controls/audio/acp[0]/vhf1-volume", 1, "DOUBLE");
var vhf2_capt_volume = props.globals.initNode("/controls/audio/acp[0]/vhf2-volume", 1, "DOUBLE");
2019-10-14 16:48:35 +00:00
2020-05-21 19:37:27 +00:00
var vhf1_fo_recive = props.globals.initNode("/controls/audio/acp[1]/vhf1-recive", 1, "BOOL");
var vhf2_fo_recive = props.globals.initNode("/controls/audio/acp[1]/vhf2-recive", 1, "BOOL");
var vhf1_fo_volume = props.globals.initNode("/controls/audio/acp[1]/vhf1-volume", 1, "DOUBLE");
var vhf2_fo_volume = props.globals.initNode("/controls/audio/acp[1]/vhf2-volume", 1, "DOUBLE");
2019-10-14 16:48:35 +00:00
2020-02-07 16:10:54 +00:00
var com1_volume = props.globals.getNode("instrumentation/comm[0]/volume");
var com2_volume = props.globals.getNode("instrumentation/comm[1]/volume");
2019-10-14 16:48:35 +00:00
var init = func() {
2020-05-21 19:37:27 +00:00
vhf1_capt_recive.setValue(1);
vhf2_capt_recive.setValue(1);
vhf1_capt_volume.setValue(1);
vhf2_capt_volume.setValue(0.8);
vhf1_fo_recive.setValue(1);
vhf2_fo_recive.setValue(1);
vhf1_fo_volume.setValue(0.8);
vhf2_fo_volume.setValue(1);
2019-10-14 16:48:35 +00:00
}
2020-05-21 19:37:27 +00:00
var update_com1 = func() {
if (acconfig.foViewNode.getValue() == 1) {
2020-05-21 19:37:27 +00:00
if (vhf1_fo_recive.getValue()) {
com1_volume.setValue(vhf1_fo_volume.getValue());
2019-10-14 16:48:35 +00:00
} else {
com1_volume.setValue(0);
}
2020-05-21 19:37:27 +00:00
} else {
if (vhf1_capt_recive.getValue()) {
com1_volume.setValue(vhf1_capt_volume.getValue());
} else {
com1_volume.setValue(0);
}
}
}
var update_com2 = func() {
if (acconfig.foViewNode.getValue() == 1) {
2020-05-21 19:37:27 +00:00
if (vhf2_fo_recive.getValue()) {
com2_volume.setValue(vhf2_fo_volume.getValue());
} else {
com2_volume.setValue(0);
}
} else {
if (vhf2_capt_recive.getValue()) {
com2_volume.setValue(vhf2_capt_volume.getValue());
2019-10-14 16:48:35 +00:00
} else {
com2_volume.setValue(0);
}
}
}
setlistener("/controls/audio/acp[0]/vhf1-recive", func {
2020-05-21 19:37:27 +00:00
update_com1();
2019-10-14 16:48:35 +00:00
});
setlistener("/controls/audio/acp[0]/vhf1-volume", func {
2020-05-21 19:37:27 +00:00
update_com1();
2019-10-14 16:48:35 +00:00
});
setlistener("/controls/audio/acp[0]/vhf2-recive", func {
2020-05-21 19:37:27 +00:00
update_com2();
2019-10-14 16:48:35 +00:00
});
setlistener("/controls/audio/acp[0]/vhf2-volume", func {
2020-05-21 19:37:27 +00:00
update_com2();
});
setlistener("/controls/audio/acp[1]/vhf1-recive", func {
update_com1();
});
setlistener("/controls/audio/acp[1]/vhf1-volume", func {
update_com1();
});
setlistener("/controls/audio/acp[1]/vhf2-recive", func {
update_com2();
2019-10-14 16:48:35 +00:00
});
2020-05-21 19:37:27 +00:00
setlistener("/controls/audio/acp[1]/vhf2-volume", func {
update_com2();
});
setlistener("/systems/acconfig/options/fo-view", func {
update_com1();
update_com2();
});