Add tones, including a launch countdown sequence.

This commit is contained in:
Anna Rose 2021-08-29 17:26:56 -04:00
parent 9623a4a869
commit 2601db8fd4
3 changed files with 39 additions and 1 deletions

View File

@ -1,6 +1,7 @@
RunOncePath("lib/throttle").
RunOncePath("lib/navigation").
RunOncePath("lib/navball").
RunOncePath("lib/sound").
// Calculate the direction to lock during ascent.
function getClampedDir {
@ -43,9 +44,10 @@ function Launch {
// Countdowns are cute.
print "Initiating automated launch sequence.".
PlayCountdown().
from { local x is 5. } until x = 0 step { set x to x - 1. } do {
print "..." + x.
wait 0.5.
wait 1.0.
}
// staging logic. Stage as many times as needed until we finish ascent.

32
lib/sound.ks Normal file
View File

@ -0,0 +1,32 @@
// An informational tone.
function InfoTone {
local v is GetVoice(0).
set v:VOLUME to 0.75.
set v:WAVE to "sine".
set v:ATTACK to 0.1.
set v:DECAY to 0.05.
set v:SUSTAIN to 0.7.
set v:RELEASE to 0.25.
v:Play(Note("C4", 1, 0.75)).
}
function PlayCountdown {
local v is GetVoice(0).
set v:VOLUME to 0.9.
set v:WAVE to "sine".
set v:ATTACK to 0.05.
set v:DECAY to 0.001.
set v:SUSTAIN to 0.7.
set v:RELEASE to 0.05.
local notes is List(
Note("E4", 1, 0.25),
Note("E4", 1, 0.25),
Note("E4", 1, 0.25),
Note("E4", 1, 0.25),
Note("B5", 1, 0.45)
).
v:Play(notes).
}

View File

@ -11,6 +11,7 @@
RunOncePath("/lib/systems").
RunOncePath("/lib/ui").
RunOncePath("/lib/sound").
ClearGuis().
@ -38,6 +39,9 @@ function preLaunch {
// turn on generator and fuel flow
enableLaunchpadFlow().
InfoTone().
wait 2.
local duration is options["Spool-up Time"]:TEXT:ToNumber().
lock THROTTLE to 0.
stage.