diff --git a/Orbiter/Orbitersdk/samples/SR71R/APU.cpp b/Orbiter/Orbitersdk/samples/SR71R/APU.cpp
index f61bf72..22e2c29 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/APU.cpp
+++ b/Orbiter/Orbitersdk/samples/SR71R/APU.cpp
@@ -39,6 +39,47 @@ void APU::Step(double simt, double simdt, double mjd)
gaugeHydrPress_.SetState((fuelDraw == actualDraw) ? 1.0 : 0.0);
}
+
+ SetSound();
+}
+
+void APU::SetSound()
+{
+ double status = gaugeHydrPress_.GetState();
+ // TODO: NOTE: Startup and shutdown sound aren't 'true', since the status is just 0 and 1.
+ // However, the code supports shutdown and start. When the status shows the actual status, it will work.
+
+ if (HasPower() && swPower_.IsOn() && propulsionControl_) {
+ // If it's starting (See note above)
+ if (status < 1.0 && status > 0.0) {
+ if(!GetBaseVessel()->IsSoundRunning(APU_START_ID)) GetBaseVessel()->PlaySound(APU_START_ID, true, false);
+ }
+ // If it's running
+ else if (status == 1.0) {
+ if (!GetBaseVessel()->IsSoundRunning(APU_RUNNING_ID)) {
+ StopAllSounds();
+ GetBaseVessel()->PlaySound(APU_RUNNING_ID, true, false);
+ }
+ }
+ if(isSoundStopped) isSoundStopped = false;
+ }
+ else {
+ // If it's shutting down (See note above)
+ if (status < 1.0 && status > 0.0) {
+ if (!GetBaseVessel()->IsSoundRunning(APU_SHUTDOWN_ID)) {
+ StopAllSounds();
+ GetBaseVessel()->PlaySound(APU_SHUTDOWN_ID, true, false);
+ }
+ }
+ else {
+ if (!isSoundStopped) { StopAllSounds(); isSoundStopped = true; }
+ }
+ }
+}
+
+void APU::StopAllSounds()
+{
+ for (int i = APU_START_ID; i <= APU_SHUTDOWN_ID; i++) GetBaseVessel()->StopSound(i);
}
double APU::CurrentDraw()
diff --git a/Orbiter/Orbitersdk/samples/SR71R/APU.h b/Orbiter/Orbitersdk/samples/SR71R/APU.h
index 660bc68..1f56fc3 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/APU.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/APU.h
@@ -85,14 +85,21 @@ class APU :
const char* ConfigKey = "APU";
+ bool isSoundStopped = false;
+
bco::VCGauge gaugeHydrPress_{ {bt_mesh::SR71rVC::gaHydPress_id },
bt_mesh::SR71rVC::gaHydPress_location, bt_mesh::SR71rVC::axisHydPress_location,
(300 * RAD),
0.2
};
- bco::VCToggleSwitch swPower_ { bt_mesh::SR71rVC::SwAPUPower_id,
+ bco::VCToggleSwitch swPower_ { bt_mesh::SR71rVC::SwAPUPower_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::SwAPUPower_location,
bt_mesh::SR71rVC::LeftPanelTopRightAxis_location
};
+
+ virtual void SetSound();
+
+ virtual void StopAllSounds();
};
\ No newline at end of file
diff --git a/Orbiter/Orbitersdk/samples/SR71R/AirBrake.cpp b/Orbiter/Orbitersdk/samples/SR71R/AirBrake.cpp
index ebfe528..5024599 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/AirBrake.cpp
+++ b/Orbiter/Orbitersdk/samples/SR71R/AirBrake.cpp
@@ -47,6 +47,22 @@ double AirBrake::GetAirBrakeState()
return animAirBrake_.GetState();
}
+void AirBrake::SetSound()
+{
+ if (animAirBrake_.GetState() > 0.0 && animAirBrake_.GetState() < 0.33) {
+ if (!GetBaseVessel()->IsSoundRunning(AIRBRAKE_ID)) GetBaseVessel()->PlaySound(AIRBRAKE_ID, true, false);
+ }
+ else if (animAirBrake_.GetState() > 0.33 && animAirBrake_.GetState() < 0.66) {
+ if (!GetBaseVessel()->IsSoundRunning(AIRBRAKE_ID)) GetBaseVessel()->PlaySound(AIRBRAKE_ID, true, false);
+ }
+ else if (animAirBrake_.GetState() > 0.66 && animAirBrake_.GetState() < 1.0) {
+ if (!GetBaseVessel()->IsSoundRunning(AIRBRAKE_ID)) GetBaseVessel()->PlaySound(AIRBRAKE_ID, true, false);
+ }
+ else {
+ if (GetBaseVessel()->IsSoundRunning(AIRBRAKE_ID)) GetBaseVessel()->StopSound(AIRBRAKE_ID);
+ }
+}
+
void AirBrake::Step(double simt, double simdt, double mjd)
{
// Note: The animAirBrake can only move if there is hydraulic power, that
@@ -61,7 +77,8 @@ void AirBrake::Step(double simt, double simdt, double mjd)
// Update drag.
dragFactor_ = animAirBrake_.GetState();
-// sprintf(oapiDebugString(), "air brake: %+4.2f", dragFactor_);
+
+ SetSound();
}
bool AirBrake::LoadConfiguration(char* key, FILEHANDLE scn, const char* configLine)
diff --git a/Orbiter/Orbitersdk/samples/SR71R/AirBrake.h b/Orbiter/Orbitersdk/samples/SR71R/AirBrake.h
index 9f774c3..4e53843 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/AirBrake.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/AirBrake.h
@@ -57,7 +57,9 @@ class AirBrake :
double AirBrake::GetAirBrakeState();
private:
- bco::RotarySwitch airBrakeSwitch_;
+ void SetSound();
+
+ bco::RotarySwitch airBrakeSwitch_ { _V(0.0, 0.0, 0.0), 0.0, GetBaseVessel() };
bco::EventTarget eventIncreaseBrake_ { bt_mesh::SR71rVC::ABTargetIncrease_location, 0.01 };
bco::EventTarget eventDecreaseBrake_ { bt_mesh::SR71rVC::ABTargetDecrease_location, 0.01 };
diff --git a/Orbiter/Orbitersdk/samples/SR71R/Avionics.h b/Orbiter/Orbitersdk/samples/SR71R/Avionics.h
index 2f273d0..736df2f 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/Avionics.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/Avionics.h
@@ -115,7 +115,7 @@ class Avionics :
bool IsOverSpeed() const;
- bco::DialSwitch& HeadingSetDial();
+ bco::DialSwitch& HeadingSetDial();
bco::OnOffSwitch& PowerSwitch();
private:
@@ -431,17 +431,20 @@ class Avionics :
bco::TextureVisual txSpeedVel_ { bt_mesh::SR71rVC::SpeedVelocityFlag_verts, bt_mesh::SR71rVC::SpeedVelocityFlag_id};
bco::VCToggleSwitch swPower_ { bt_mesh::SR71rVC::SwAvionics_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::SwAvionics_location,
bt_mesh::SR71rVC::PowerTopRightAxis_location
};
bco::VCRotorSwitch swSelectRadio_ { bt_mesh::SR71rVC::SwNavSelect_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::SwNavSelect_location,
bt_mesh::SR71rVC::SwNavSelectAxis_location,
(117*RAD)
};
bco::VCRotorSwitch swAvionMode_ { bt_mesh::SR71rVC::SwExoSelect_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::SwExoSelect_location,
bt_mesh::SR71rVC::SwExoSelectAxis_location,
(117*RAD)
diff --git a/Orbiter/Orbitersdk/samples/SR71R/Canopy.cpp b/Orbiter/Orbitersdk/samples/SR71R/Canopy.cpp
index bda2963..e7a5b96 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/Canopy.cpp
+++ b/Orbiter/Orbitersdk/samples/SR71R/Canopy.cpp
@@ -33,6 +33,16 @@ bool Canopy::CanopyHasPower()
return HasPower() && swCanopyPower_.IsOn();
}
+void Canopy::SetSound()
+{
+ if (animCanopy_.GetState() > 0.0 && animCanopy_.GetState() < 1.0) {
+ if(!GetBaseVessel()->IsSoundRunning(CANOPY_ID)) GetBaseVessel()->PlaySound(CANOPY_ID, true, false);
+ }
+ else {
+ if (GetBaseVessel()->IsSoundRunning(CANOPY_ID)) GetBaseVessel()->StopSound(CANOPY_ID);
+ }
+}
+
Canopy::Canopy(bco::BaseVessel* vessel, double amps) :
PoweredComponent(vessel, amps, 26.0)
{
@@ -51,6 +61,8 @@ void Canopy::Step(double simt, double simdt, double mjd)
{
animCanopy_.Step(swCanopyOpen_.GetState(), simdt);
}
+
+ SetSound();
}
bool Canopy::LoadConfiguration(char* key, FILEHANDLE scn, const char* configLine)
diff --git a/Orbiter/Orbitersdk/samples/SR71R/Canopy.h b/Orbiter/Orbitersdk/samples/SR71R/Canopy.h
index 9b9ab87..d7a4d26 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/Canopy.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/Canopy.h
@@ -77,17 +77,21 @@ class Canopy : public bco::PoweredComponent
private:
bool CanopyHasPower();
+ void SetSound();
+
const char* ConfigKeyCanopy = "CANOPY";
bco::Animation animCanopy_ { &swCanopyOpen_, 0.2};
UINT idAnim_ { 0 };
bco::VCToggleSwitch swCanopyPower_ { bt_mesh::SR71rVC::SwCanopyPower_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::SwCanopyPower_location,
bt_mesh::SR71rVC::PowerTopRightAxis_location
};
bco::VCToggleSwitch swCanopyOpen_ { bt_mesh::SR71rVC::SwCanopyOpen_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::SwCanopyOpen_location,
bt_mesh::SR71rVC::DoorsRightAxis_location
};
diff --git a/Orbiter/Orbitersdk/samples/SR71R/CargoBayController.cpp b/Orbiter/Orbitersdk/samples/SR71R/CargoBayController.cpp
index 3df38f8..508268f 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/CargoBayController.cpp
+++ b/Orbiter/Orbitersdk/samples/SR71R/CargoBayController.cpp
@@ -34,6 +34,16 @@ bool CargoBayController::CargoBayHasPower()
return HasPower() && swCargoPower_.IsOn();
}
+void CargoBayController::SetSound()
+{
+ if (animCargoBayDoors_.GetState() > 0.0 && animCargoBayDoors_.GetState() < 1.0) {
+ if (!GetBaseVessel()->IsSoundRunning(CARGO_ID)) GetBaseVessel()->PlaySound(CARGO_ID, true, false);
+ }
+ else {
+ if (GetBaseVessel()->IsSoundRunning(CARGO_ID)) GetBaseVessel()->StopSound(CARGO_ID);
+ }
+}
+
CargoBayController::CargoBayController(bco::BaseVessel* vessel, double amps) :
PoweredComponent(vessel, amps, 26.0)
{
@@ -52,6 +62,8 @@ void CargoBayController::Step(double simt, double simdt, double mjd)
{
animCargoBayDoors_.Step(swCargoOpen_.GetState(), simdt);
}
+
+ SetSound();
}
bool CargoBayController::LoadConfiguration(char* key, FILEHANDLE scn, const char* configLine)
diff --git a/Orbiter/Orbitersdk/samples/SR71R/CargoBayController.h b/Orbiter/Orbitersdk/samples/SR71R/CargoBayController.h
index d717dac..9e0aa94 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/CargoBayController.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/CargoBayController.h
@@ -80,6 +80,8 @@ class CargoBayController : public bco::PoweredComponent
private:
bool CargoBayHasPower();
+ void SetSound();
+
const char* ConfigKeyCargo = "CARGOBAY";
bco::Animation animCargoBayDoors_{ &swCargoOpen_, 0.01 };
@@ -87,11 +89,13 @@ class CargoBayController : public bco::PoweredComponent
UINT idCargoAnim_{ 0 };
bco::VCToggleSwitch swCargoPower_ { bt_mesh::SR71rVC::SwCargoPower_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::SwCargoPower_location,
bt_mesh::SR71rVC::PowerTopRightAxis_location
};
bco::VCToggleSwitch swCargoOpen_ { bt_mesh::SR71rVC::SwCargoOpen_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::SwCargoOpen_location,
bt_mesh::SR71rVC::DoorsRightAxis_location
};
diff --git a/Orbiter/Orbitersdk/samples/SR71R/Clock.h b/Orbiter/Orbitersdk/samples/SR71R/Clock.h
index f3b4521..01197e7 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/Clock.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/Clock.h
@@ -46,8 +46,8 @@ class Clock : public bco::Component
const char* ConfigKey = "CLOCK";
- bco::PushButtonSwitch switchResetElapsed_ { bt_mesh::SR71rVC::ClockElapsedReset_location, 0.01 };
- bco::PushButtonSwitch switchStopWatch_ { bt_mesh::SR71rVC::ClockTimerReset_location, 0.01 };
+ bco::PushButtonSwitch switchResetElapsed_ { bt_mesh::SR71rVC::ClockElapsedReset_location, 0.01, GetBaseVessel() };
+ bco::PushButtonSwitch switchStopWatch_ { bt_mesh::SR71rVC::ClockTimerReset_location, 0.01, GetBaseVessel() };
double startElapsedTime_;
double startTimerTime_;
diff --git a/Orbiter/Orbitersdk/samples/SR71R/FlightComputer.h b/Orbiter/Orbitersdk/samples/SR71R/FlightComputer.h
index 7767686..4b9e19c 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/FlightComputer.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/FlightComputer.h
@@ -361,19 +361,19 @@ namespace FC
// Auto pilot panel
bco::TextureVisual visAPMainOn_;
- bco::PushButtonSwitch swAPMain_{ bt_mesh::SR71rVC::SwAPMain_location, 0.01 };
+ bco::PushButtonSwitch swAPMain_{ bt_mesh::SR71rVC::SwAPMain_location, 0.01, GetBaseVessel() };
bco::TextureVisual visAPHeadingOn_;
- bco::PushButtonSwitch swAPHeading_{ bt_mesh::SR71rVC::SwAPHeading_location, 0.01 };
+ bco::PushButtonSwitch swAPHeading_{ bt_mesh::SR71rVC::SwAPHeading_location, 0.01, GetBaseVessel() };
bco::TextureVisual visAPAltitudeOn_;
- bco::PushButtonSwitch swAPHAltitude_{ bt_mesh::SR71rVC::SwAPAltitude_location, 0.01 };
+ bco::PushButtonSwitch swAPHAltitude_{ bt_mesh::SR71rVC::SwAPAltitude_location, 0.01, GetBaseVessel() };
bco::TextureVisual visAPKEASOn_;
- bco::PushButtonSwitch swAPKEAS_{ bt_mesh::SR71rVC::SwAPKEAS_location, 0.01 };
+ bco::PushButtonSwitch swAPKEAS_{ bt_mesh::SR71rVC::SwAPKEAS_location, 0.01, GetBaseVessel() };
bco::TextureVisual visAPMACHOn_;
- bco::PushButtonSwitch swAPMACH_{ bt_mesh::SR71rVC::SwAPMACH_location, 0.01 };
+ bco::PushButtonSwitch swAPMACH_{ bt_mesh::SR71rVC::SwAPMACH_location, 0.01, GetBaseVessel() };
};
diff --git a/Orbiter/Orbitersdk/samples/SR71R/FuelCell.h b/Orbiter/Orbitersdk/samples/SR71R/FuelCell.h
index d3a40c4..c8a2cf6 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/FuelCell.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/FuelCell.h
@@ -108,7 +108,8 @@ class FuelCell :
// Config members:
- bco::VCToggleSwitch swPower_ { bt_mesh::SR71rVC::swFuelCellPower_id,
+ bco::VCToggleSwitch swPower_ { bt_mesh::SR71rVC::swFuelCellPower_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::swFuelCellPower_location,
bt_mesh::SR71rVC::PowerTopRightAxis_location
};
diff --git a/Orbiter/Orbitersdk/samples/SR71R/HUD.h b/Orbiter/Orbitersdk/samples/SR71R/HUD.h
index c3b7417..c28013a 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/HUD.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/HUD.h
@@ -73,6 +73,7 @@ class HUD : public bco::PoweredComponent
bool isInternalTrigger_{ false };
bco::VCRotorSwitch swSelectMode_{ bt_mesh::SR71rVC::SwHUDMode_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::SwHUDMode_location,
bt_mesh::SR71rVC::SwHUDSelectAxis_location,
(120 * RAD)
diff --git a/Orbiter/Orbitersdk/samples/SR71R/HoverEngines.cpp b/Orbiter/Orbitersdk/samples/SR71R/HoverEngines.cpp
index ad6b6e0..620ce93 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/HoverEngines.cpp
+++ b/Orbiter/Orbitersdk/samples/SR71R/HoverEngines.cpp
@@ -36,6 +36,8 @@ void HoverEngines::Step(double simt, double simdt, double mjd)
{
animHoverDoors_.Step(swOpen_.GetState(), simdt);
}
+
+ SetSound();
}
double HoverEngines::CurrentDraw()
@@ -154,6 +156,16 @@ void HoverEngines::EnableHover(bool isEnabled)
}
}
+void HoverEngines::SetSound()
+{
+ if (animHoverDoors_.GetState() > 0.0 && animHoverDoors_.GetState() < 1.0) {
+ if (!GetBaseVessel()->IsSoundRunning(HOVER_DOOR_ID)) GetBaseVessel()->PlaySound(HOVER_DOOR_ID, true, false);
+ }
+ else {
+ if (GetBaseVessel()->IsSoundRunning(HOVER_DOOR_ID)) GetBaseVessel()->StopSound(HOVER_DOOR_ID);
+ }
+}
+
bool HoverEngines::DrawHUD(int mode, const HUDPAINTSPEC* hps, oapi::Sketchpad* skp)
{
if (oapiCockpitMode() != COCKPIT_VIRTUAL) return false;
diff --git a/Orbiter/Orbitersdk/samples/SR71R/HoverEngines.h b/Orbiter/Orbitersdk/samples/SR71R/HoverEngines.h
index e1b8243..e2fb343 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/HoverEngines.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/HoverEngines.h
@@ -45,6 +45,7 @@ class HoverEngines : public bco::PoweredComponent
private:
void EnableHover(bool isEnabled);
+ void SetSound();
THRUSTER_HANDLE hoverThrustHandles_[3];
@@ -54,7 +55,8 @@ class HoverEngines : public bco::PoweredComponent
int hoverMouseId_;
- bco::VCToggleSwitch swOpen_ { bt_mesh::SR71rVC::swHoverDoor_id,
+ bco::VCToggleSwitch swOpen_ { bt_mesh::SR71rVC::swHoverDoor_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::swHoverDoor_location,
bt_mesh::SR71rVC::DoorsRightAxis_location
};
diff --git a/Orbiter/Orbitersdk/samples/SR71R/HydrogenSupply.cpp b/Orbiter/Orbitersdk/samples/SR71R/HydrogenSupply.cpp
index 5407d40..60055d4 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/HydrogenSupply.cpp
+++ b/Orbiter/Orbitersdk/samples/SR71R/HydrogenSupply.cpp
@@ -51,7 +51,8 @@ void HydrogenSupply::Step(double simt, double simdt, double mjd)
if (IsFilling())
{
FillTank(HYDROGEN_FILL_RATE * simdt);
- }
+ GetBaseVessel()->PlaySound(LH2_SUPPLY_ID, true, false);
+ } else if(GetBaseVessel()->IsSoundRunning(LH2_SUPPLY_ID)) GetBaseVessel()->StopSound(LH2_SUPPLY_ID);
}
bool HydrogenSupply::VCRedrawEvent(int id, int event, SURFHANDLE surf)
diff --git a/Orbiter/Orbitersdk/samples/SR71R/HydrogenSupply.h b/Orbiter/Orbitersdk/samples/SR71R/HydrogenSupply.h
index 9fafd5c..5606530 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/HydrogenSupply.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/HydrogenSupply.h
@@ -66,7 +66,7 @@ class HydrogenSupply :
bco::TextureVisual lightSupplyAvailable_;
bco::TextureVisual lightValveOpen_;
- bco::PushButtonSwitch switchValveOpen_ { bt_mesh::SR71rVC::LH2ValveOpenSwitch_location, 0.01 };
+ bco::PushButtonSwitch switchValveOpen_ { bt_mesh::SR71rVC::LH2ValveOpenSwitch_location, 0.01, GetBaseVessel() };
bco::VCGauge gaugeHydro_{ {bt_mesh::SR71rVC::gaHydrogenLevel_id },
bt_mesh::SR71rVC::gaHydrogenLevel_location,
diff --git a/Orbiter/Orbitersdk/samples/SR71R/LandingGear.cpp b/Orbiter/Orbitersdk/samples/SR71R/LandingGear.cpp
index 2ed5f5d..c5214a4 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/LandingGear.cpp
+++ b/Orbiter/Orbitersdk/samples/SR71R/LandingGear.cpp
@@ -36,6 +36,42 @@ bco::OnOffSwitch& LandingGear::LandingGearSwitch()
return landingGearSwitch_;
}
+void LandingGear::SetSound()
+{
+ if (landingGearSwitch_.GetState() == 1.0) {
+ if (animLandingGear_.GetState() < 1.0 && animLandingGear_.GetState() > 0.0) {
+ if (!gearDownSound) {
+ GetBaseVessel()->PlaySound(GEAR_DOWN_ID, false, true);
+ gearUpSound = gearUpLockedSound = gearDownLockedSound = false;
+ gearDownSound = true;
+ }
+ GetBaseVessel()->PlaySound(GEAR_WHINE_ID, true, false);
+ }
+ else if(animLandingGear_.GetState() == 1.0 && !gearDownLockedSound) {
+ GetBaseVessel()->StopSound(GEAR_WHINE_ID);
+ GetBaseVessel()->PlaySound(GEAR_DOWN_LOCKED_ID, false, true);
+ gearDownLockedSound = true;
+ gearDownSound = false;
+ }
+ }
+ else {
+ if (animLandingGear_.GetState() < 1.0 && animLandingGear_.GetState() > 0.0) {
+ if (!gearUpSound) {
+ GetBaseVessel()->PlaySound(GEAR_UP_ID, false, true);
+ gearDownSound = gearUpLockedSound = gearDownLockedSound = false;
+ gearUpSound = true;
+ }
+ GetBaseVessel()->PlaySound(GEAR_WHINE_ID, true, false);
+ }
+ else if (animLandingGear_.GetState() == 0.0 && !gearUpLockedSound) {
+ GetBaseVessel()->StopSound(GEAR_WHINE_ID);
+ GetBaseVessel()->PlaySound(GEAR_UP_LOCKED_ID, false, true);
+ gearUpLockedSound = true;
+ gearUpSound = false;
+ }
+ }
+}
+
void LandingGear::Step(double simt, double simdt, double mjd)
{
// Note: The animLandingGear can only move if there is hydraulic power, that
@@ -47,6 +83,8 @@ void LandingGear::Step(double simt, double simdt, double mjd)
{
animLandingGear_.Step(landingGearSwitch_.GetState(), simdt);
}
+
+ SetSound();
}
bool LandingGear::LoadConfiguration(char* key, FILEHANDLE scn, const char* configLine)
diff --git a/Orbiter/Orbitersdk/samples/SR71R/LandingGear.h b/Orbiter/Orbitersdk/samples/SR71R/LandingGear.h
index 8884456..a3b473f 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/LandingGear.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/LandingGear.h
@@ -59,7 +59,11 @@ class LandingGear : public bco::Component
bco::OnOffSwitch& LandingGearSwitch();
private:
- bco::OnOffSwitch landingGearSwitch_;
+ void SetSound();
+
+ bool gearUpSound = false, gearUpLockedSound = false, gearDownSound = false, gearDownLockedSound = false;
+
+ bco::OnOffSwitch landingGearSwitch_ { _V(0.0, 0.0, 0.0), 0.0, GetBaseVessel()};
bco::EventTarget targetGearDown_ { bt_mesh::SR71rVC::GearLeverDownTarget_location, 0.01 };
bco::EventTarget targetGearUp_ { bt_mesh::SR71rVC::GearLeverUpTarget_location, 0.01 };
diff --git a/Orbiter/Orbitersdk/samples/SR71R/Lights.h b/Orbiter/Orbitersdk/samples/SR71R/Lights.h
index 170c69d..477bb83 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/Lights.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/Lights.h
@@ -68,21 +68,25 @@ class Lights : public bco::PoweredComponent
(90 * RAD), 0.0, 0.1 };
bco::VCToggleSwitch swNav_ { bt_mesh::SR71rVC::SwitchNavLights_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::SwitchNavLights_location,
bt_mesh::SR71rVC::LightsRightAxis_location
};
bco::VCToggleSwitch swBeacon_ { bt_mesh::SR71rVC::SwitchBeaconLights_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::SwitchBeaconLights_location,
bt_mesh::SR71rVC::LightsRightAxis_location
};
bco::VCToggleSwitch swStrobe_ { bt_mesh::SR71rVC::SwitchStrobeLights_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::SwitchStrobeLights_location,
bt_mesh::SR71rVC::LightsRightAxis_location
};
bco::VCToggleSwitch swDock_ { bt_mesh::SR71rVC::SwitchDockLights_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::SwitchDockLights_location,
bt_mesh::SR71rVC::LightsRightAxis_location
};
diff --git a/Orbiter/Orbitersdk/samples/SR71R/NavModes.cpp b/Orbiter/Orbitersdk/samples/SR71R/NavModes.cpp
index b5d8e0d..eeccf20 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/NavModes.cpp
+++ b/Orbiter/Orbitersdk/samples/SR71R/NavModes.cpp
@@ -116,6 +116,8 @@ void NavModes::ToggleMode(int mode)
{
if (HasPower())
{
+ if (GetBaseVessel()->GetNavmodeState(mode)) GetBaseVessel()->PlaySound(AP_OFF_ID, false, true);
+ else GetBaseVessel()->PlaySound(AP_ON_ID, false, true);
GetBaseVessel()->ToggleNavmode(mode);
}
diff --git a/Orbiter/Orbitersdk/samples/SR71R/NavModes.h b/Orbiter/Orbitersdk/samples/SR71R/NavModes.h
index d478824..a4e936d 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/NavModes.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/NavModes.h
@@ -58,12 +58,12 @@ class NavModes : public bco::PoweredComponent
int navMode1_{ 0 };
int navMode2_{ 0 };
- bco::PushButtonSwitch btnKillRotation_ { bt_mesh::SR71rVC::NAVMODE_KILL_ROT_location, 0.01 };
- bco::PushButtonSwitch btnLevelHorizon_ { bt_mesh::SR71rVC::NAVMODE_HORZ_LEVEL_location, 0.01 };
- bco::PushButtonSwitch btnPrograde_ { bt_mesh::SR71rVC::NAVMODE_PRO_GRADE_location, 0.01 };
- bco::PushButtonSwitch btnRetrograde_ { bt_mesh::SR71rVC::NAVMODE_RETRO_GRADE_location, 0.01 };
- bco::PushButtonSwitch btnNormal_ { bt_mesh::SR71rVC::NAVMODE_NORMAL_PLUS_location, 0.01 };
- bco::PushButtonSwitch btnAntiNormal_ { bt_mesh::SR71rVC::NAVMODE_NORMAL_MINUS_location, 0.01 };
+ bco::PushButtonSwitch btnKillRotation_ { bt_mesh::SR71rVC::NAVMODE_KILL_ROT_location, 0.01, GetBaseVessel() };
+ bco::PushButtonSwitch btnLevelHorizon_ { bt_mesh::SR71rVC::NAVMODE_HORZ_LEVEL_location, 0.01, GetBaseVessel() };
+ bco::PushButtonSwitch btnPrograde_ { bt_mesh::SR71rVC::NAVMODE_PRO_GRADE_location, 0.01, GetBaseVessel() };
+ bco::PushButtonSwitch btnRetrograde_ { bt_mesh::SR71rVC::NAVMODE_RETRO_GRADE_location, 0.01, GetBaseVessel() };
+ bco::PushButtonSwitch btnNormal_ { bt_mesh::SR71rVC::NAVMODE_NORMAL_PLUS_location, 0.01, GetBaseVessel() };
+ bco::PushButtonSwitch btnAntiNormal_ { bt_mesh::SR71rVC::NAVMODE_NORMAL_MINUS_location, 0.01, GetBaseVessel() };
bco::TextureVisual visKillRot_;
bco::TextureVisual visHorzLevel_;
diff --git a/Orbiter/Orbitersdk/samples/SR71R/O2Supply.cpp b/Orbiter/Orbitersdk/samples/SR71R/O2Supply.cpp
index 47e54c5..58bd385 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/O2Supply.cpp
+++ b/Orbiter/Orbitersdk/samples/SR71R/O2Supply.cpp
@@ -54,7 +54,29 @@ void O2Supply::Step(double simt, double simdt, double mjd)
if (IsFilling())
{
FillTank(OXYGEN_FILL_RATE * simdt);
+ GetBaseVessel()->PlaySound(LOX_SUPPLY_ID, true, false);
}
+ else if (GetBaseVessel()->IsSoundRunning(LOX_SUPPLY_ID)) GetBaseVessel()->StopSound(LOX_SUPPLY_ID);
+
+ if (GetLevel() == 0.0) {
+ if (!isDepSoundRun_) {
+ GetBaseVessel()->PlaySound(LOX_DEP_ID, false, true);
+ isDepSoundRun_ = true;
+ }
+ }
+ else if (GetLevel() <= 0.05) {
+ if (!isLowSoundRun_) {
+ GetBaseVessel()->PlaySound(LOX_LOW_ID, false, true);
+ isLowSoundRun_ = true;
+ }
+ }
+ else if (GetLevel() == 1.0) {
+ if (!isFullSoundRun_) {
+ GetBaseVessel()->PlaySound(LOX_FULL_ID, false, true);
+ isFullSoundRun_ = true;
+ }
+ }
+ else isDepSoundRun_ = isLowSoundRun_ = isFullSoundRun_ = false;
}
diff --git a/Orbiter/Orbitersdk/samples/SR71R/O2Supply.h b/Orbiter/Orbitersdk/samples/SR71R/O2Supply.h
index 47b6a9c..a721ebb 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/O2Supply.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/O2Supply.h
@@ -71,12 +71,16 @@ class O2Supply : public CryogenicTank,
int areaId_;
int pumpMouseId_;
double prevTime_;
+
+ bool isFullSoundRun_ = false;
+ bool isLowSoundRun_ = false;
+ bool isDepSoundRun_ = false;
const char* ConfigKey = "OXYGEN";
bco::TextureVisual lightSupplyAvailable_;
bco::TextureVisual lightValveOpen_;
- bco::PushButtonSwitch switchValveOpen_ { bt_mesh::SR71rVC::LOXValveOpenSwitch_location, 0.01 };
+ bco::PushButtonSwitch switchValveOpen_ { bt_mesh::SR71rVC::LOXValveOpenSwitch_location, 0.01, GetBaseVessel() };
bco::VCGauge gaugeOxygenLevel_ { {bt_mesh::SR71rVC::gaugeOxygenLevel_id },
bt_mesh::SR71rVC::gaugeOxygenLevel_location,
diff --git a/Orbiter/Orbitersdk/samples/SR71R/PowerSystem.h b/Orbiter/Orbitersdk/samples/SR71R/PowerSystem.h
index afecbfa..2c42224 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/PowerSystem.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/PowerSystem.h
@@ -127,17 +127,20 @@ class PowerSystem : public bco::PoweredComponent,
bco::TextureVisual fuelCellConnectedLight_;
- bco::VCToggleSwitch swPower_ { bt_mesh::SR71rVC::swMainPower_id,
+ bco::VCToggleSwitch swPower_ { bt_mesh::SR71rVC::swMainPower_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::swMainPower_location,
bt_mesh::SR71rVC::PowerTopRightAxis_location
};
- bco::VCToggleSwitch swConnectExternal_ { bt_mesh::SR71rVC::swConnectExternalPower_id,
+ bco::VCToggleSwitch swConnectExternal_ { bt_mesh::SR71rVC::swConnectExternalPower_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::swConnectExternalPower_location,
bt_mesh::SR71rVC::PowerBottomRightAxis_location
};
- bco::VCToggleSwitch swConnectFuelCell_ { bt_mesh::SR71rVC::swConnectFuelCell_id,
+ bco::VCToggleSwitch swConnectFuelCell_ { bt_mesh::SR71rVC::swConnectFuelCell_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::swConnectFuelCell_location,
bt_mesh::SR71rVC::PowerBottomRightAxis_location
};
diff --git a/Orbiter/Orbitersdk/samples/SR71R/PropulsionController.cpp b/Orbiter/Orbitersdk/samples/SR71R/PropulsionController.cpp
index d48b86e..d73509e 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/PropulsionController.cpp
+++ b/Orbiter/Orbitersdk/samples/SR71R/PropulsionController.cpp
@@ -137,10 +137,38 @@ void PropulsionController::Update(double deltaUpdate)
// auto trMain = GetMainFuelLevel() * (PI2 * 0.71111); // 256 deg.
gaFuelMain_.SetState(GetMainFuelLevel());
+ if(GetMainFuelLevel() == 0.0) {
+ if (!isMainDepSoundRun_) {
+ GetBaseVessel()->PlaySound(MAIN_DEP_ID, false, true);
+ isMainDepSoundRun_ = true;
+ }
+ }
+ else if (GetMainFuelLevel() <= 0.05) {
+ if (!isMainLowSoundRun_) {
+ GetBaseVessel()->PlaySound(MAIN_LOW_ID, false, true);
+ isMainLowSoundRun_ = true;
+ }
+ }
+ else isMainDepSoundRun_ = isMainLowSoundRun_ = false;
+
// RCS
// auto trRCS = GetRcsFuelLevel() * (PI2 * 0.733); // 264 deg.
gaFuelRCS_.SetState(GetRcsFuelLevel());
+ if (GetRcsFuelLevel() == 0.0) {
+ if (!isRcsDepSoundRun_) {
+ GetBaseVessel()->PlaySound(RCS_DEP_ID, false, true);
+ isRcsDepSoundRun_ = true;
+ }
+ }
+ else if (GetRcsFuelLevel() <= 0.05) {
+ if (!isRcsLowSoundRun_) {
+ GetBaseVessel()->PlaySound(RCS_LOW_ID, false, true);
+ isRcsLowSoundRun_ = true;
+ }
+ }
+ else isRcsDepSoundRun_ = isRcsLowSoundRun_ = false;
+
vessel->UpdateUIArea(areaId_);
}
@@ -161,21 +189,27 @@ void PropulsionController::HandleTransfer(double deltaUpdate)
{
// Add to main.
auto actualFill = FillMainFuel(FUEL_FILL_RATE * deltaUpdate);
+
if (actualFill <= 0.0)
{
isFilling_ = false;
- }
- }
+ GetBaseVessel()->PlaySound(MAIN_FULL_ID, false, true);
+ } else GetBaseVessel()->PlaySound(FUEL_FLOW_ID, true, false);
+ } else if(GetBaseVessel()->IsSoundRunning(FUEL_FLOW_ID) && !isTransfering_ && !isDumping_)
+ GetBaseVessel()->StopSound(FUEL_FLOW_ID);
if (isDumping_)
{
+ if(!isDumpSoundRun_) { GetBaseVessel()->PlaySound(FUEL_DUMP_ID, false, true); isDumpSoundRun_ = true; }
// Remove from main.
auto actualDump = DrawMainFuel(FUEL_DUMP_RATE * deltaUpdate);
if (actualDump <= 0.0)
{
+ isDumpSoundRun_ = false;
isDumping_ = false;
- }
- }
+ } else GetBaseVessel()->PlaySound(FUEL_FLOW_ID, true, false);
+ } else if (GetBaseVessel()->IsSoundRunning(FUEL_FLOW_ID) && !isTransfering_ && !isFilling_)
+ GetBaseVessel()->StopSound(FUEL_FLOW_ID);
switch (transMode_)
{
@@ -183,6 +217,7 @@ void PropulsionController::HandleTransfer(double deltaUpdate)
if (isTransfering_)
{
+ if (!isMainTransSoundRun_) { GetBaseVessel()->PlaySound(CRS_FED_MAIN_ID, false, true); isMainTransSoundRun_ = true; }
// Move from Main to RCS.
// Get the requested amount to move.
auto transferAmount = FUEL_TRANFER_RATE * deltaUpdate;
@@ -192,9 +227,11 @@ void PropulsionController::HandleTransfer(double deltaUpdate)
if (actual != actualDrawn)
{
+ isMainTransSoundRun_ = isRcsTransSoundRun_ = false;
isTransfering_ = false;
- }
- }
+ } else GetBaseVessel()->PlaySound(FUEL_FLOW_ID, true, false);
+ } else if (GetBaseVessel()->IsSoundRunning(FUEL_FLOW_ID) && !isFilling_ && !isDumping_)
+ GetBaseVessel()->StopSound(FUEL_FLOW_ID);
break;
case TransMode::None:
@@ -202,6 +239,7 @@ void PropulsionController::HandleTransfer(double deltaUpdate)
isFilling_ = false;
isTransfering_ = false;
isDumping_ = false;
+
break;
case TransMode::RCS:
@@ -210,19 +248,22 @@ void PropulsionController::HandleTransfer(double deltaUpdate)
if (isTransfering_)
{
+ if (!isRcsTransSoundRun_) { GetBaseVessel()->PlaySound(CRS_FED_RCS_ID, false, true); isRcsTransSoundRun_ = true; }
// Move from Main to RCS.
// Get the requested amount to move.
auto transferAmount = FUEL_TRANFER_RATE * deltaUpdate;
auto actualDrawn = DrawMainFuel(transferAmount);
auto actual = FillRCSFuel(actualDrawn);
-
if (actual != actualDrawn)
{
+ isMainTransSoundRun_ = isRcsTransSoundRun_ = false;
isTransfering_ = false;
- }
- }
+ GetBaseVessel()->PlaySound(RCS_FULL_ID, false, true);
+ } else GetBaseVessel()->PlaySound(FUEL_FLOW_ID, true, false);
+ } else if (GetBaseVessel()->IsSoundRunning(FUEL_FLOW_ID) && !isFilling_ && !isDumping_)
+ GetBaseVessel()->StopSound(FUEL_FLOW_ID);
// You cannot dump from RCS
break;
diff --git a/Orbiter/Orbitersdk/samples/SR71R/PropulsionController.h b/Orbiter/Orbitersdk/samples/SR71R/PropulsionController.h
index 7f49909..171224a 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/PropulsionController.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/PropulsionController.h
@@ -153,6 +153,14 @@ class PropulsionController : public bco::PoweredComponent
bool isTransfering_;
bool isDumping_;
+ bool isMainTransSoundRun_ = false;
+ bool isRcsTransSoundRun_ = false;
+ bool isDumpSoundRun_ = false;
+ bool isMainDepSoundRun_ = false;
+ bool isMainLowSoundRun_ = false;
+ bool isRcsDepSoundRun_ = false;
+ bool isRcsLowSoundRun_ = false;
+
bco::VCGauge gaFuelFlow_ { {bt_mesh::SR71rVC::gaFuelFlow_id},
@@ -177,19 +185,22 @@ class PropulsionController : public bco::PoweredComponent
};
// Thrust limit
bco::VCToggleSwitch swThrustLimit_ { bt_mesh::SR71rVC::swThrottleLimit_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::swThrottleLimit_location,
bt_mesh::SR71rVC::TopRowSwitchRightAxis_location
};
bco::VCToggleSwitch swSelectTransfer_ { bt_mesh::SR71rVC::swTransferSelect_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::swTransferSelect_location,
bt_mesh::SR71rVC::FuelTransferRightAxis_location
};
bco::TextureVisual visTranferPumpOn_;
- bco::PushButtonSwitch swTransferPump_ { bt_mesh::SR71rVC::FuelTransferSwitch_location, 0.01 };
+ bco::PushButtonSwitch swTransferPump_ { bt_mesh::SR71rVC::FuelTransferSwitch_location, 0.01, GetBaseVessel() };
bco::VCToggleSwitch swDumpFuel_ { bt_mesh::SR71rVC::swDumpFuel_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::swDumpFuel_location,
bt_mesh::SR71rVC::FuelTransferRightAxis_location
};
@@ -197,5 +208,5 @@ class PropulsionController : public bco::PoweredComponent
// Fill
bco::TextureVisual lightFuelSupplyAvailable_;
bco::TextureVisual lightFuelSupplyValveOpen_;
- bco::PushButtonSwitch switchFuelSupplyValveOpen_ { bt_mesh::SR71rVC::FuelValveOpenSwitch_location, 0.01 };
+ bco::PushButtonSwitch switchFuelSupplyValveOpen_ { bt_mesh::SR71rVC::FuelValveOpenSwitch_location, 0.01, GetBaseVessel() };
};
\ No newline at end of file
diff --git a/Orbiter/Orbitersdk/samples/SR71R/RCSSystem.h b/Orbiter/Orbitersdk/samples/SR71R/RCSSystem.h
index cf3955e..36ac445 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/RCSSystem.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/RCSSystem.h
@@ -70,6 +70,7 @@ class RCSSystem : public bco::PoweredComponent
//bco::PushButtonSwitch btnLinear_ {bt_mesh::SR71rVC::RCS_LIN_location, 0.01};
bco::VCRotorSwitch swSelectMode_{ bt_mesh::SR71rVC::SwRCSMode_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::SwRCSMode_location,
bt_mesh::SR71rVC::SwRCSSelectAxis_location,
(90 * RAD)
diff --git a/Orbiter/Orbitersdk/samples/SR71R/RetroEngines.cpp b/Orbiter/Orbitersdk/samples/SR71R/RetroEngines.cpp
index a98cecf..14c3f4f 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/RetroEngines.cpp
+++ b/Orbiter/Orbitersdk/samples/SR71R/RetroEngines.cpp
@@ -37,6 +37,8 @@ void RetroEngines::Step(double simt, double simdt, double mjd)
{
animRetroDoors_.Step(swRetroDoors_.GetState(), simdt);
}
+
+ SetSound();
}
double RetroEngines::CurrentDraw()
@@ -140,6 +142,16 @@ void RetroEngines::EnableRetros(bool isEnabled)
}
}
+void RetroEngines::SetSound()
+{
+ if (animRetroDoors_.GetState() > 0.0 && animRetroDoors_.GetState() < 1.0) {
+ if (!GetBaseVessel()->IsSoundRunning(RETRO_DOOR_ID)) GetBaseVessel()->PlaySound(RETRO_DOOR_ID, true, false);
+ }
+ else {
+ if (GetBaseVessel()->IsSoundRunning(RETRO_DOOR_ID)) GetBaseVessel()->StopSound(RETRO_DOOR_ID);
+ }
+}
+
bool RetroEngines::DrawHUD(int mode, const HUDPAINTSPEC* hps, oapi::Sketchpad* skp)
{
if (oapiCockpitMode() != COCKPIT_VIRTUAL) return false;
diff --git a/Orbiter/Orbitersdk/samples/SR71R/RetroEngines.h b/Orbiter/Orbitersdk/samples/SR71R/RetroEngines.h
index 060574b..c3df47d 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/RetroEngines.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/RetroEngines.h
@@ -46,12 +46,15 @@ class RetroEngines : public bco::PoweredComponent
void EnableRetros(bool isEnabled);
+ void SetSound();
+
THRUSTER_HANDLE retroThrustHandles_[2];
const char* ConfigKey = "RETRO";
- bco::VCToggleSwitch swRetroDoors_ { bt_mesh::SR71rVC::swRetroDoors_id,
+ bco::VCToggleSwitch swRetroDoors_ { bt_mesh::SR71rVC::swRetroDoors_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::swRetroDoors_location,
bt_mesh::SR71rVC::DoorsRightAxis_location
};
diff --git a/Orbiter/Orbitersdk/samples/SR71R/SR71R.sln b/Orbiter/Orbitersdk/samples/SR71R/SR71R.sln
index 4348cd7..760c2f7 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/SR71R.sln
+++ b/Orbiter/Orbitersdk/samples/SR71R/SR71R.sln
@@ -1,14 +1,11 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
+# Visual Studio 15
+VisualStudioVersion = 15.0.28307.136
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SR71R", "SR71R.vcxproj", "{0338DDB6-45BA-459A-A700-49F2F8DB4108}"
EndProject
Global
- GlobalSection(Performance) = preSolution
- HasPerformanceSessions = true
- EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
@@ -23,4 +20,10 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {5D90E21A-C678-48A7-B75C-D501E0D37F46}
+ EndGlobalSection
+ GlobalSection(Performance) = preSolution
+ HasPerformanceSessions = true
+ EndGlobalSection
EndGlobal
diff --git a/Orbiter/Orbitersdk/samples/SR71R/SR71R.vcxproj b/Orbiter/Orbitersdk/samples/SR71R/SR71R.vcxproj
index fb8878e..35c8761 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/SR71R.vcxproj
+++ b/Orbiter/Orbitersdk/samples/SR71R/SR71R.vcxproj
@@ -18,7 +18,7 @@
SAK
SAK
SAK
- 10.0.17763.0
+ 10.0.17134.0
@@ -50,6 +50,7 @@
true
$(ModuleDir)\
$(VCInstallDir)UnitTest\lib;$(LibraryPath)
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(WindowsSdkDir)\include
false
@@ -71,6 +72,7 @@
true
$(ModuleDir)\$(ProjectName).dll
msvcrt.lib;%(IgnoreSpecificDefaultLibraries)
+ orbiter.lib;XRSoundD.lib;orbitersdk.lib;%(AdditionalDependencies)
true
@@ -84,11 +86,12 @@
Level3
Use
- MaxSpeed
+ Disabled
true
true
WIN32;NDEBUG;_WINDOWS;_USRDLL;SR71R_EXPORTS;%(PreprocessorDefinitions)
MultiThreaded
+ false
Windows
@@ -96,6 +99,8 @@
true
true
msvcrt.lib;%(IgnoreSpecificDefaultLibraries)
+ orbiter.lib;XRSound.lib;orbitersdk.lib;%(AdditionalDependencies)
+ Default
call "$(ProjectDir)deploy.bat" $(ProjectDir) $(OrbiterDir)
@@ -145,6 +150,7 @@
+
diff --git a/Orbiter/Orbitersdk/samples/SR71R/SR71R.vcxproj.filters b/Orbiter/Orbitersdk/samples/SR71R/SR71R.vcxproj.filters
index 0f0df7d..7044edc 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/SR71R.vcxproj.filters
+++ b/Orbiter/Orbitersdk/samples/SR71R/SR71R.vcxproj.filters
@@ -225,6 +225,9 @@
bc_orbiter
+
+ Header Files
+
diff --git a/Orbiter/Orbitersdk/samples/SR71R/SR71Vessel_clbk.cpp b/Orbiter/Orbitersdk/samples/SR71R/SR71Vessel_clbk.cpp
index 3db47d0..d9a7bb1 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/SR71Vessel_clbk.cpp
+++ b/Orbiter/Orbitersdk/samples/SR71R/SR71Vessel_clbk.cpp
@@ -61,10 +61,8 @@ void SR71Vessel::clbkSetClassCaps(FILEHANDLE cfg)
SetDockParams(bt_mesh::SR71r::DockingPort_location, _V(0, 1, 0), _V(0, 0, 1));
SetTouchdownPoints(tdvtx_geardown, ntdvtx_geardown);
- SetNosewheelSteering(true);
-
- SetNosewheelSteering(true);
+ SetNosewheelSteering(true);
// Setups:
SetupVesselComponents();
@@ -179,6 +177,8 @@ void SR71Vessel::clbkMFDMode(int mfd, int mode)
void SR71Vessel::clbkPostStep(double simt, double simdt, double mjd)
{
+ isAviPowered = avionics_.CurrentDraw() != 0.0;
+
apu_.Step(simt, simdt, mjd);
avionics_.Step(simt, simdt, mjd);
cargoBayController_.Step(simt, simdt, mjd);
diff --git a/Orbiter/Orbitersdk/samples/SR71R/Shutters.h b/Orbiter/Orbitersdk/samples/SR71R/Shutters.h
index f3c3c70..0fd2d85 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/Shutters.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/Shutters.h
@@ -42,7 +42,8 @@ class Shutters : public bco::Component
const char* ConfigKey = "SHUTTERS";
- bco::VCToggleSwitch swShutters_ { bt_mesh::SR71rVC::swShutter_id,
+ bco::VCToggleSwitch swShutters_ { bt_mesh::SR71rVC::swShutter_id,
+ GetBaseVessel(),
bt_mesh::SR71rVC::swShutter_location,
bt_mesh::SR71rVC::DoorsRightAxis_location
};
diff --git a/Orbiter/Orbitersdk/samples/SR71R/Sound.h b/Orbiter/Orbitersdk/samples/SR71R/Sound.h
new file mode 100644
index 0000000..aa5b0f3
--- /dev/null
+++ b/Orbiter/Orbitersdk/samples/SR71R/Sound.h
@@ -0,0 +1,87 @@
+
+#include "XRSound.h"
+
+typedef enum {
+ // APU
+ APU_START_ID = 0,
+ APU_RUNNING_ID,
+ APU_SHUTDOWN_ID,
+
+ // Hydraulics
+ CANOPY_ID,
+ CARGO_ID,
+ HOVER_DOOR_ID,
+ RETRO_DOOR_ID,
+ AIRBRAKE_ID,
+
+ // Landing gear
+ GEAR_WHINE_ID,
+ GEAR_UP_ID,
+ GEAR_UP_LOCKED_ID,
+ GEAR_DOWN_ID,
+ GEAR_DOWN_LOCKED_ID,
+
+ // Switches
+ SWITCH_ON_ID,
+ SWITCH_OFF_ID,
+
+ // Autopilot
+ AP_ON_ID,
+ AP_OFF_ID,
+
+ // Cross-feed and dump
+ CRS_FED_MAIN_ID,
+ CRS_FED_RCS_ID,
+ FUEL_FLOW_ID,
+ FUEL_DUMP_ID,
+ MAIN_FULL_ID,
+ RCS_FULL_ID,
+
+ // LOX and LH2 supply
+ LOX_SUPPLY_ID,
+ LH2_SUPPLY_ID,
+ LOX_FULL_ID,
+
+ // Warnings
+ MAIN_LOW_ID,
+ MAIN_DEP_ID,
+ RCS_LOW_ID,
+ RCS_DEP_ID,
+ LOX_LOW_ID,
+ LOX_DEP_ID
+} const soundId;
+
+const char* const APU_START_PATH = "XRSound/Default/APU Startup.wav";
+const char* const APU_RUNNING_PATH = "XRSound/Default/APU Run.wav";
+const char* const APU_SHUTDOWN_PATH = "XRSound/Default/APU Shutdown.wav";
+
+const char* const HYDRAULIC_PATH = "XRSound/Default/Hydraulics1.wav";
+
+const char* const GEAR_WHINE_PATH = "XRSound/Default/Gear Whine.wav";
+const char* const GEAR_UP_PATH = "XRSound/Default/Gear Up.wav";
+const char* const GEAR_UP_LOCKED_PATH = "XRSound/Default/Gear Up and Locked.wav";
+const char* const GEAR_DOWN_PATH = "XRSound/Default/Gear Down.wav";
+const char* const GEAR_DOWN_LOCKED_PATH = "XRSound/Default/Gear Down and Locked.wav";
+
+const char* const SWITCH_ON_PATH = "XRSound/Default/SwitchOn1.wav";
+const char* const SWITCH_OFF_PATH = "XRSound/Default/SwitchOff1.wav";
+
+const char* const AP_ON_PATH = "XRSound/Default/Autopilot On.wav";
+const char* const AP_OFF_PATH = "XRSound/Default/Autopilot Off.wav";
+
+const char* const CRS_FED_MAIN_PATH = "XRSound/Default/Cross-Feed Main.wav";
+const char* const CRS_FED_RCS_PATH = "XRSound/Default/Cross-Feed RCS.wav";
+const char* const FUEL_FLOW_PATH = "XRSound/Default/Fuel Flow.wav";
+const char* const FUEL_DUMP_PATH = "XRSound/Default/Warning Fuel Dump.wav";
+const char* const MAIN_FULL_PATH = "XRSound/Default/Main Fuel Tanks Full.wav";
+const char* const RCS_FULL_PATH = "XRSound/Default/RCS Fuel Tanks Full.wav";
+
+const char* const LOX_FULL_PATH = "XRSound/Default/LOX Tanks Full.wav";
+
+const char* const MAIN_LOW_PATH = "XRSound/Default/Warning Main Fuel Low.wav";
+const char* const MAIN_DEP_PATH = "XRSound/Default/Warning Main Fuel Depleted.wav";
+const char* const RCS_LOW_PATH = "XRSound/Default/Warning RCS Fuel Low.wav";
+const char* const RCS_DEP_PATH = "XRSound/Default/Warning RCS Fuel Depleted.wav";
+
+const char* const LOX_LOW_PATH = "XRSound/Default/Warning Oxygen Low.wav";
+const char* const LOX_DEP_PATH = "XRSound/Default/Warning Oxygen Depleted.wav";
\ No newline at end of file
diff --git a/Orbiter/Orbitersdk/samples/SR71R/bc_orbiter/BaseVessel.h b/Orbiter/Orbitersdk/samples/SR71R/bc_orbiter/BaseVessel.h
index bf8ed87..4774322 100644
--- a/Orbiter/Orbitersdk/samples/SR71R/bc_orbiter/BaseVessel.h
+++ b/Orbiter/Orbitersdk/samples/SR71R/bc_orbiter/BaseVessel.h
@@ -21,6 +21,7 @@
#include "EventTarget.h"
#include "Animation.h"
#include "IAnimationState.h"
+#include "../Sound.h"
#include
#include