Skip to content

Commit a1a95f0

Browse files
committed
fix(sound): boarding complete and welcome onboard announcements play simultaneously (#10549)
- Split welcomeonboard onto separate SOUND_WELCOME_ONBOARD local variable - Add delay timer in BoardingSounds to trigger welcome announcement after boarding complete
1 parent 96a9d9e commit a1a95f0

File tree

3 files changed

+31
-2
lines changed
  • .github
  • fbw-a32nx/src/base/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/sound
  • fbw-common/src/wasm/systems/systems/src/payload

3 files changed

+31
-2
lines changed

.github/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,3 +1881,4 @@
18811881
1. [EFB] Restructured APIs and made Navigraph Auth a reusable component - @MicahBCode (Mischa Binder)
18821882
1. [ECAM] Added F units to CRZ and COND pages for Cabin temps. Currently tied to kg/lbs option in EFB -Patrick Macken (@PatM on Discord)
18831883
1. [A32NX/FCU] Fixed bug where the FCU selected altitude would immediately switch to 1000s on selecting the 1000ft inteval knob - @elliot747 (Elliot)
1884+
1. [Sounds] Fixed boarding complete and welcome onboard announcements playing simultaneously by adding a delay between them - @Ditoo29 (dito29 on Discord)

fbw-a32nx/src/base/flybywire-aircraft-a320-neo/SimObjects/AirPlanes/FlyByWire_A320_NEO/sound/sound.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2183,7 +2183,7 @@
21832183
<WwiseRTPC LocalVar="A32NX_SOUND_ANNOUNCEMENTS_ENABLED" Units="number" Index="0" RTPCName="LOCALVAR_A32NX_ANNOUNCEMENT_TOGGLE" />
21842184
</Sound>
21852185

2186-
<Sound WwiseEvent="welcomeonboard" WwiseData="true" NodeName="SOUND_FWD_GALLEY" ConeHeading="180" CancelConeHeadingWhenInside="false" Continuous="false" LocalVar="A32NX_SOUND_BOARDING_COMPLETE">
2186+
<Sound WwiseEvent="welcomeonboard" WwiseData="true" NodeName="SOUND_FWD_GALLEY" ConeHeading="180" CancelConeHeadingWhenInside="false" Continuous="false" LocalVar="A32NX_SOUND_WELCOME_ONBOARD">
21872187
<Range LowerBound="1" />
21882188
<Requires LocalVar="A32NX_CIDS_IS_POWERED">
21892189
<Range LowerBound="1" />

fbw-common/src/wasm/systems/systems/src/payload/mod.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,23 +664,33 @@ pub struct BoardingSounds {
664664
pax_deboard_id: VariableIdentifier,
665665
pax_complete_id: VariableIdentifier,
666666
pax_ambience_id: VariableIdentifier,
667+
pax_welcome_id: VariableIdentifier,
667668

668669
pax_boarding: bool,
669670
pax_deboarding: bool,
670671
pax_complete: bool,
671672
pax_ambience: bool,
673+
pax_welcome: bool,
674+
675+
welcome_timer: Duration,
672676
}
673677
impl BoardingSounds {
678+
// Set a timer for 10 seconds between "Boarding Completed" and "Welcome Onboard"
679+
const BOARDING_COMPLETE_WELCOME_DELAY: Duration = Duration::from_secs(10);
680+
674681
pub fn new(context: &mut InitContext) -> Self {
675682
BoardingSounds {
676683
pax_board_id: context.get_identifier("SOUND_PAX_BOARDING".to_owned()),
677684
pax_deboard_id: context.get_identifier("SOUND_PAX_DEBOARDING".to_owned()),
678685
pax_complete_id: context.get_identifier("SOUND_BOARDING_COMPLETE".to_owned()),
679686
pax_ambience_id: context.get_identifier("SOUND_PAX_AMBIENCE".to_owned()),
687+
pax_welcome_id: context.get_identifier("SOUND_WELCOME_ONBOARD".to_owned()),
680688
pax_boarding: false,
681689
pax_deboarding: false,
682690
pax_complete: false,
683691
pax_ambience: false,
692+
pax_welcome: false,
693+
welcome_timer: Duration::ZERO,
684694
}
685695
}
686696

@@ -709,13 +719,27 @@ impl BoardingSounds {
709719
}
710720

711721
pub fn play_sound_pax_complete(&mut self, playing: bool) {
722+
if playing && !self.pax_complete {
723+
self.welcome_timer = Duration::from_millis(1);
724+
self.pax_welcome = false;
725+
}
712726
self.pax_complete = playing;
713727
}
714728

715729
pub fn play_sound_pax_ambience(&mut self, playing: bool) {
716730
self.pax_ambience = playing;
717731
}
718732

733+
pub fn update_welcome(&mut self, delta: Duration) {
734+
if self.welcome_timer > Duration::ZERO && !self.pax_welcome {
735+
self.welcome_timer += delta;
736+
if self.welcome_timer >= Self::BOARDING_COMPLETE_WELCOME_DELAY {
737+
self.pax_welcome = true;
738+
self.welcome_timer = Duration::ZERO;
739+
}
740+
}
741+
}
742+
719743
pub fn stop_boarding_sounds(&mut self) {
720744
self.pax_boarding = false;
721745
self.pax_deboarding = false;
@@ -728,6 +752,7 @@ impl SimulationElement for BoardingSounds {
728752
writer.write(&self.pax_deboard_id, self.pax_deboarding);
729753
writer.write(&self.pax_complete_id, self.pax_complete);
730754
writer.write(&self.pax_ambience_id, self.pax_ambience);
755+
writer.write(&self.pax_welcome_id, self.pax_welcome);
731756
}
732757
}
733758

@@ -962,6 +987,7 @@ impl<const P: usize, const G: usize, const C: usize> PayloadManager<P, G, C> {
962987
if !self.is_boarding_allowed() {
963988
self.reset_time();
964989
self.stop_boarding_sounds();
990+
self.boarding_sounds.update_welcome(delta_time);
965991
return;
966992
}
967993
let ms_delay = if self.board_rate() == BoardingRate::Instant {
@@ -979,6 +1005,7 @@ impl<const P: usize, const G: usize, const C: usize> PayloadManager<P, G, C> {
9791005
self.update_cargo_tick();
9801006
}
9811007
self.update_boarding_sounds();
1008+
self.boarding_sounds.update_welcome(delta_time);
9821009
if self.is_fully_loaded() {
9831010
self.emit_stop_boarding();
9841011
}
@@ -989,7 +1016,8 @@ impl<const P: usize, const G: usize, const C: usize> PayloadManager<P, G, C> {
9891016
&mut self.passenger_deck,
9901017
&mut self.cargo_deck,
9911018
&mut self.boarding_sounds,
992-
)
1019+
);
1020+
self.boarding_sounds.update_welcome(delta_time);
9931021
}
9941022
}
9951023
}

0 commit comments

Comments
 (0)