Advertisement
Guest User

Lua Sound System Example

a guest
May 20th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.82 KB | None | 0 0
  1. dofile(LockOn_Options.script_path.."command_defs.lua")
  2.  
  3. local dev       = GetSelf()
  4.  
  5. local dt = 0.024
  6. make_default_activity(dt)
  7.  
  8. local cockpitVolume = get_option_value("sound.cockpit","local")
  9. if cockpitVolume == nil then
  10.     cockpitVolume = 0
  11. end
  12. local headphonesVolume = get_option_value("sound.headphones","local")
  13. if headphonesVolume == nil then
  14.     headphonesVolume = 0
  15. end
  16. local worldVolume = get_option_value("sound.world","local")
  17. if worldVolume == nil then
  18.     worldVolume = 0
  19. end
  20. local cockpitGain = (cockpitVolume + 100.0) /100.0
  21. local headphonesGain = (headphonesVolume + 100.0) /100.0
  22. local worldGain = (worldVolume + 100.0) /100.0
  23.  
  24. -----------------------------
  25. -- Key Commands to Monitor --
  26. -----------------------------
  27. dev:listen_command(Keys.iCommandPlaneEject)
  28.  
  29.  
  30. ---------------------------------
  31. -- SOUND PARAMETERS (from dll) --
  32. ---------------------------------
  33.  
  34. -- Gain/Pitch Parameters
  35. local MISSILE_TONE_VOLUME = get_param_handle("MISSILE_TONE_VOLUME")
  36. local THREAT_VOLUME = get_param_handle("THREAT_VOLUME")
  37. local INTERCOM_VOLUME = get_param_handle("INTERCOM_VOLUME")
  38. local TACAN_VOLUME = get_param_handle("TACAN_VOLUME")
  39. local ILS_VOLUME = get_param_handle("ILS_VOLUME")
  40.  
  41. local PRESSURIZATION_VOLUME = get_param_handle("PRESSURIZATION_VOLUME")
  42. local HEARING_VOLUME = get_param_handle("HEARING_VOLUME")
  43. local AFTERBURNER_VOLUME = get_param_handle("AFTERBURNER_VOLUME")
  44.  
  45. local ENGINE_1_VOLUME = get_param_handle("ENGINE_1_VOLUME")
  46. local ENGINE_2_VOLUME = get_param_handle("ENGINE_2_VOLUME")
  47. local ENGINE_3_VOLUME = get_param_handle("ENGINE_3_VOLUME")
  48. local ENGINE_1_PITCH = get_param_handle("ENGINE_1_PITCH")
  49. local ENGINE_2_PITCH = get_param_handle("ENGINE_2_PITCH")
  50. local ENGINE_3_PITCH = get_param_handle("ENGINE_3_PITCH")
  51.  
  52. -- Sound Trigger Parameters
  53. -- valid data if > -999
  54. -- Value of 0 means stop
  55. -- Any other value (besides -999) means play
  56. local SOUND_THROTTLE_IDLE_CUTOFF = get_param_handle("SOUND_THROTTLE_IDLE_CUTOFF")
  57. local SOUND_THROTTLE_DETENT_1 = get_param_handle("SOUND_THROTTLE_DETENT_1")
  58. local SOUND_THROTTLE_DETENT_2 = get_param_handle("SOUND_THROTTLE_DETENT_2")
  59. local SOUND_THROTTLE_AB_STAGE = get_param_handle("SOUND_THROTTLE_AB_STAGE")
  60.  
  61. local SOUND_AFTERBURNER_IN = get_param_handle("SOUND_AFTERBURNER_IN")
  62. local SOUND_AFTERBURNER_START_IN = get_param_handle("SOUND_AFTERBURNER_START_IN")
  63.  
  64. local SOUND_CANOPY_OPEN_LOOP = get_param_handle("SOUND_CANOPY_OPEN_LOOP")
  65. local SOUND_CANOPY_CLOSE_LOOP = get_param_handle("SOUND_CANOPY_CLOSE_LOOP")
  66. local SOUND_CANOPY_OPEN = get_param_handle("SOUND_CANOPY_OPEN")
  67. local SOUND_CANOPY_CLOSE = get_param_handle("SOUND_CANOPY_CLOSE")
  68.  
  69. local SOUND_SEAT_ADJUSTMENT_UP_LOOP = get_param_handle("SOUND_SEAT_ADJUSTMENT_UP_LOOP")
  70. local SOUND_SEAT_ADJUSTMENT_DOWN_LOOP = get_param_handle("SOUND_SEAT_ADJUSTMENT_DOWN_LOOP")
  71.  
  72. local SOUND_VM_PULLUP = get_param_handle("SOUND_VM_PULLUP")
  73. local SOUND_VM_ALTITUDE = get_param_handle("SOUND_VM_ALTITUDE")
  74. local SOUND_VM_WARNING = get_param_handle("SOUND_VM_WARNING")
  75. local SOUND_VM_JAMMER = get_param_handle("SOUND_VM_JAMMER")
  76. local SOUND_VM_COUNTER = get_param_handle("SOUND_VM_COUNTER")
  77. local SOUND_VM_CHAFF_FLARE = get_param_handle("SOUND_VM_CHAFF_FLARE")
  78. local SOUND_VM_LOW = get_param_handle("SOUND_VM_LOW")
  79. local SOUND_VM_OUT = get_param_handle("SOUND_VM_OUT")
  80. local SOUND_VM_LOCK = get_param_handle("SOUND_VM_LOCK")
  81. local SOUND_VM_CAUTION = get_param_handle("SOUND_VM_CAUTION")
  82. local SOUND_VM_BINGO = get_param_handle("SOUND_VM_BINGO")
  83. local SOUND_VM_DATA = get_param_handle("SOUND_VM_DATA")
  84. local SOUND_VM_IFF = get_param_handle("SOUND_VM_IFF")
  85.  
  86. local SOUND_VMS_TEST = get_param_handle("SOUND_VMS_TEST")
  87.  
  88. local SOUND_LANDING_GEAR_WARNING_HORN = get_param_handle("SOUND_LANDING_GEAR_WARNING_HORN")
  89. local SOUND_LOW_SPEED_WARNING_TONE = get_param_handle("SOUND_LOW_SPEED_WARNING_TONE")
  90.  
  91. local SOUND_BATTERY = get_param_handle("SOUND_BATTERY")
  92. local SOUND_DEPRESSURIZATION = get_param_handle("SOUND_DEPRESSURIZATION")
  93.  
  94. local SOUND_DEPRESSURIZATION = get_param_handle("SOUND_DEPRESSURIZATION")
  95.  
  96. local SOUND_JFS_LOOP = get_param_handle("SOUND_JFS_LOOP")
  97.  
  98. --From other LUA systems
  99. local SOUND_MAGSWITCH_OUT = get_param_handle("SOUND_MAGSWITCH_OUT")
  100.  
  101. --------------------------
  102.  
  103. function createInternal(sound_host, sdef_name)
  104.     return sound_host:create_sound("Aircrafts/F-16/Internal/" .. sdef_name)
  105. end
  106.  
  107. function createExternal(sound_host, sdef_name)
  108.     return sound_host:create_sound("Aircrafts/F-16/External/" .. sdef_name)
  109. end
  110.  
  111. function createInternalLoop(sound_host, start_sound_length, sdef_name_start, sdef_name_loop, sdef_name_end)
  112.     start_length_ = start_sound_length or 0
  113.    
  114.     if sdef_name_start then
  115.         sound_start_ = createInternal(sound_host, sdef_name_start)
  116.     else
  117.         sound_start_ = nil
  118.     end
  119.    
  120.     sound_loop_ = createInternal(sound_host, sdef_name_loop)
  121.    
  122.     if sdef_name_end then
  123.         sound_end_ = createInternal(sound_host, sdef_name_end)
  124.     else
  125.         sound_end_ = nil
  126.     end
  127.    
  128.     return {
  129.         startLength = start_length_,
  130.         timePlaying = 0,
  131.         isPlaying = false,
  132.         sound_start = sound_start_,
  133.         sound_loop = sound_loop_,
  134.         sound_end = sound_end_,
  135.     }
  136. end
  137.  
  138. function createExternalLoop(sound_host, start_sound_length, sdef_name_start, sdef_name_loop, sdef_name_end)
  139.     start_length_ = start_sound_length or 0
  140.    
  141.     if sdef_name_start then
  142.         sound_start_ = createExternal(sound_host, sdef_name_start)
  143.     else
  144.         sound_start_ = nil
  145.     end
  146.    
  147.     sound_loop_ = createExternal(sound_host, sdef_name_loop)
  148.    
  149.     if sdef_name_end then
  150.         sound_end_ = createExternal(sound_host, sdef_name_end)
  151.     else
  152.         sound_end_ = nil
  153.     end
  154.    
  155.     return {
  156.         startLength = start_length_,
  157.         timePlaying = 0,
  158.         isPlaying = false,
  159.         sound_start = sound_start_,
  160.         sound_loop = sound_loop_,
  161.         sound_end = sound_end_,
  162.     }
  163. end
  164.    
  165. function post_initialize() 
  166.     if create_sound_host ~= nil then
  167.         ext_sh                          = create_sound_host("EXTERNAL_AIRCRAFT","3D",0,0,0)
  168.         cpt_mech_sh                     = create_sound_host("COCKPIT_MECHANICAL","2D",0,0,0)
  169.         cpt_sys_sh                      = create_sound_host("COCKPIT_SYSTEMS","2D",0,0,0)
  170.         intercom_sh                     = create_sound_host("COCKPIT_INTERCOM","2D",0,0,0)
  171.         cpt_eng_sh                      = create_sound_host("COCKPIT_ENGINE","2D",0,0,0)
  172.        
  173.         sound_EjectLever                = createInternal(cpt_mech_sh, "EjectLever")
  174.         sound_ThrottleIdleCutoff        = createInternal(cpt_mech_sh, "ThrottleDetent2")
  175.         sound_ThrottleDetent1           = createInternal(cpt_mech_sh, "ThrottleDetent1")
  176.         sound_ThrottleDetent2           = createInternal(cpt_mech_sh, "ThrottleDetent2")
  177.         sound_ThrottleABStage           = createInternal(cpt_mech_sh, "ThrottleABStage")
  178.        
  179.         sound_AfterburnerStartIn        = createInternal(cpt_eng_sh, "AfterburnerStart_In")
  180.         sound_AfterburnerIn             = createInternalLoop(cpt_eng_sh, nil, nil, "Afterburner_In")
  181.        
  182.         sound_Engine1In                 = createInternalLoop(cpt_eng_sh, nil, nil, "Engine1In")
  183.         sound_Engine2In                 = createInternalLoop(cpt_eng_sh, nil, nil, "Engine2In")
  184.         sound_Engine3In                 = createInternalLoop(cpt_eng_sh, nil, nil, "Engine3In")
  185.        
  186.         sound_JFSIn                     = createInternalLoop(cpt_mech_sh, 27.000, "JFSStart_In", "JFSLoop_In", "JFSEnd_In")
  187.            
  188.         sound_CanopyOpenLoop            = createInternalLoop(cpt_mech_sh, 0.7041, "CanopyOpenStart", "CanopyOpenLoop", "CanopyOpenEnd")
  189.         sound_CanopyCloseLoop           = createInternalLoop(cpt_mech_sh, 1.1459, "CanopyCloseStart", "CanopyCloseLoop", "CanopyCloseEnd")
  190.         sound_CanopyClose               = createInternal(cpt_mech_sh, "CanopyClose")
  191.         sound_CanopyOpen                = createInternal(cpt_mech_sh, "CanopyOpen")
  192.        
  193.         sound_SeatAdjustmentUpLoop      = createInternalLoop(cpt_mech_sh, nil, nil, "SeatAdjustmentUp", "SeatAdjustmentUpEnd")
  194.         sound_SeatAdjustmentDownLoop    = createInternalLoop(cpt_mech_sh, nil, nil, "SeatAdjustmentDown", "SeatAdjustmentDownEnd")
  195.            
  196.         sound_MagswitchOut              = createInternal(cpt_mech_sh, "MagswitchOut")
  197.            
  198.        
  199.         sound_PULLUP                    = createInternal(intercom_sh, "PULLUP")
  200.         sound_ALTITUDE                  = createInternal(intercom_sh, "ALTITUDE")
  201.         sound_WARNING                   = createInternal(intercom_sh, "WARNING")
  202.         sound_JAMMER                    = createInternal(intercom_sh, "JAMMER")
  203.         sound_COUNTER                   = createInternal(intercom_sh, "COUNTER")
  204.         sound_CHAFF_FLARE               = createInternal(intercom_sh, "CHAFF_FLARE")
  205.         sound_LOW                       = createInternal(intercom_sh, "LOW")
  206.         sound_OUT                       = createInternal(intercom_sh, "OUT")
  207.         sound_LOCK                      = createInternal(intercom_sh, "LOCK")
  208.         sound_CAUTION                   = createInternal(intercom_sh, "CAUTION")
  209.         sound_BINGO                     = createInternal(intercom_sh, "BINGO")
  210.         sound_DATA                      = createInternal(intercom_sh, "DATA")
  211.         sound_IFF                       = createInternal(intercom_sh, "IFF")
  212.        
  213.         sound_VMSTest                   = createInternalLoop(intercom_sh, nil, nil, "VMSTest")
  214.        
  215.         sound_LandingGearWarningHorn    = createInternalLoop(intercom_sh, nil, nil, "LandingGearWarningHorn")
  216.         sound_LowSpeedWarningTone       = createInternalLoop(intercom_sh, nil, nil, "LowSpeedWarningTone")
  217.        
  218.         sound_Battery                   = createInternalLoop(cpt_sys_sh, nil, nil, "Battery")
  219.         sound_Pressurization            = createInternalLoop(cpt_sys_sh, nil, nil, "Pressurization")       
  220.         sound_Depressurization          = createInternal(cpt_mech_sh, "Depressurization")
  221.     end
  222.    
  223.     SOUND_THROTTLE_IDLE_CUTOFF:set(-999)
  224.     SOUND_THROTTLE_DETENT_1:set(-999)
  225.     SOUND_THROTTLE_DETENT_2:set(-999)
  226.     SOUND_THROTTLE_AB_STAGE:set(-999)
  227.    
  228.     SOUND_AFTERBURNER_IN:set(-999)
  229.     SOUND_AFTERBURNER_START_IN:set(-999)
  230.    
  231.     SOUND_CANOPY_OPEN_LOOP:set(-999)
  232.     SOUND_CANOPY_CLOSE_LOOP:set(-999)
  233.     SOUND_CANOPY_OPEN:set(-999)
  234.     SOUND_CANOPY_CLOSE:set(-999)
  235.    
  236.     SOUND_SEAT_ADJUSTMENT_UP_LOOP:set(-999)
  237.     SOUND_SEAT_ADJUSTMENT_DOWN_LOOP:set(-999)
  238.    
  239.     SOUND_VM_PULLUP:set(-999)
  240.     SOUND_VM_ALTITUDE:set(-999)
  241.     SOUND_VM_WARNING:set(-999)
  242.     SOUND_VM_JAMMER:set(-999)
  243.     SOUND_VM_COUNTER:set(-999)
  244.     SOUND_VM_CHAFF_FLARE:set(-999)
  245.     SOUND_VM_LOW:set(-999)
  246.     SOUND_VM_OUT:set(-999)
  247.     SOUND_VM_LOCK:set(-999)
  248.     SOUND_VM_CAUTION:set(-999)
  249.     SOUND_VM_BINGO:set(-999)
  250.     SOUND_VM_DATA:set(-999)
  251.     SOUND_VM_IFF:set(-999)
  252.    
  253.     SOUND_VMS_TEST:set(-999)
  254.    
  255.     SOUND_LANDING_GEAR_WARNING_HORN:set(-999)
  256.     SOUND_LOW_SPEED_WARNING_TONE:set(-999)
  257.    
  258.     SOUND_BATTERY:set(-999)
  259.    
  260.     SOUND_JFS_LOOP:set(-999)
  261.    
  262.     SOUND_MAGSWITCH_OUT:set(-999)
  263.  
  264. end
  265.  
  266. function updateSoundParameters(sound, pitch, gain, lowpass)
  267.     if sound then
  268.         sound:update(pitch, gain, lowpass)
  269.     end
  270. end
  271.  
  272. function stopSound(sound)  
  273.     if sound and sound:is_playing() then
  274.         sound:stop()       
  275.     end
  276. end
  277.  
  278. function playSoundOnce(sound)
  279.     if sound then
  280.         if sound:is_playing() then
  281.             sound:stop()
  282.         end    
  283.         sound:play_once()
  284.     end
  285. end
  286.  
  287. function stopLoopSound(loopSound, playEndSound)
  288.     stopSound(loopSound.sound_start)
  289.     stopSound(loopSound.sound_loop)
  290.     loopSound.isPlaying = false
  291.     loopSound.timePlaying = 0
  292.     if playEndSound then
  293.         playSoundOnce(loopSound.sound_end)
  294.     end
  295. end
  296.  
  297. function updateLoopSoundParameters(loopSound, pitch, gain, lowpass)
  298.     updateSoundParameters(loopSound.sound_start, pitch, gain, lowpass)
  299.     updateSoundParameters(loopSound.sound_loop, pitch, gain, lowpass)
  300.     updateSoundParameters(loopSound.sound_end, pitch, gain, lowpass)
  301. end
  302.  
  303. function playSoundOnceFromParam(param, sound)
  304.     if param:get() > -999 then
  305.         if sound then
  306.             if sound:is_playing() then
  307.                 sound:stop()
  308.             end
  309.             if param:get() ~= 0 then
  310.                 sound:play_once()              
  311.             end
  312.         end
  313.         param:set(-999)
  314.     end
  315. end
  316.  
  317. function playLoopingSound(loopSound)
  318.     loopSound.sound_loop:play_continue()
  319. end
  320.  
  321. function playLoopingSoundFromParam(param, loopSound)
  322.     if param == nil then
  323.         loopSound.sound_loop:play_continue()
  324.         return
  325.     end
  326.  
  327.     if param:get() > -999 then
  328.         if loopSound then
  329.             if param:get() == 0 and loopSound.isPlaying then
  330.                 --Stop command given
  331.                 stopLoopSound(loopSound, true)
  332.             elseif param:get() ~= 0 then
  333.                 --Play command given
  334.                 if loopSound.isPlaying then
  335.                     -- first stop if playing
  336.                     stopLoopSound(loopSound)
  337.                 end
  338.                
  339.                 if loopSound.sound_start then
  340.                     loopSound.sound_start:play_once()
  341.                 else
  342.                     loopSound.sound_loop:play_continue()
  343.                 end
  344.                 loopSound.isPlaying = true
  345.  
  346.             end
  347.         end
  348.         param:set(-999)
  349.     else
  350.         --no sound command given, manage start/looping sound
  351.         if loopSound.isPlaying then
  352.             loopSound.timePlaying = loopSound.timePlaying + dt
  353.            
  354.             if loopSound.sound_start and loopSound.sound_start:is_playing() then
  355.                 if loopSound.timePlaying > (loopSound.startLength - dt) then                   
  356.                     loopSound.sound_loop:play_continue()
  357.                 end
  358.                 if loopSound.timePlaying > loopSound.startLength then
  359.                     loopSound.sound_start:stop()
  360.                     loopSound.sound_loop:play_continue()
  361.                 end
  362.             else
  363.                 loopSound.sound_loop:play_continue()
  364.             end
  365.         end
  366.     end
  367. end
  368.  
  369.  
  370. function update()
  371.     local intercomGain = (INTERCOM_VOLUME:get() * INTERCOM_VOLUME:get()) * headphonesGain
  372.     local pressurizationGain = PRESSURIZATION_VOLUME:get() * cockpitGain
  373.     local afterburnerGain = AFTERBURNER_VOLUME:get() * cockpitGain 
  374.     local engine1Gain = ENGINE_1_VOLUME:get() * cockpitGain
  375.     local engine2Gain = ENGINE_2_VOLUME:get() * cockpitGain
  376.     local engine3Gain = ENGINE_3_VOLUME:get() * cockpitGain
  377.    
  378.     -- Mechanical Sounds
  379.     playSoundOnceFromParam(SOUND_THROTTLE_IDLE_CUTOFF, sound_ThrottleIdleCutoff)
  380.     playSoundOnceFromParam(SOUND_THROTTLE_DETENT_1, sound_ThrottleDetent1)
  381.     playSoundOnceFromParam(SOUND_THROTTLE_DETENT_2, sound_ThrottleDetent2)
  382.     playSoundOnceFromParam(SOUND_THROTTLE_AB_STAGE, sound_ThrottleABStage)
  383.    
  384.     playLoopingSoundFromParam(SOUND_CANOPY_OPEN_LOOP, sound_CanopyOpenLoop)
  385.     playLoopingSoundFromParam(SOUND_CANOPY_CLOSE_LOOP, sound_CanopyCloseLoop)
  386.     playSoundOnceFromParam(SOUND_CANOPY_OPEN, sound_CanopyOpen)
  387.     playSoundOnceFromParam(SOUND_CANOPY_CLOSE, sound_CanopyClose)
  388.    
  389.     playLoopingSoundFromParam(SOUND_SEAT_ADJUSTMENT_UP_LOOP, sound_SeatAdjustmentUpLoop)
  390.     playLoopingSoundFromParam(SOUND_SEAT_ADJUSTMENT_DOWN_LOOP, sound_SeatAdjustmentDownLoop)
  391.    
  392.     playSoundOnceFromParam(SOUND_MAGSWITCH_OUT, sound_MagswitchOut)
  393.            
  394.     -- Warning Sounds
  395.    
  396.     -- Voice Messages
  397.     playSoundOnceFromParam(SOUND_VM_PULLUP, sound_PULLUP)
  398.     playSoundOnceFromParam(SOUND_VM_ALTITUDE, sound_ALTITUDE)
  399.     playSoundOnceFromParam(SOUND_VM_WARNING, sound_WARNING)
  400.     playSoundOnceFromParam(SOUND_VM_JAMMER, sound_JAMMER)
  401.     playSoundOnceFromParam(SOUND_VM_COUNTER, sound_COUNTER)
  402.     playSoundOnceFromParam(SOUND_VM_CHAFF_FLARE, sound_CHAFF_FLARE)
  403.     playSoundOnceFromParam(SOUND_VM_LOW, sound_LOW)
  404.     playSoundOnceFromParam(SOUND_VM_OUT, sound_OUT)
  405.     playSoundOnceFromParam(SOUND_VM_LOCK, sound_LOCK)
  406.     playSoundOnceFromParam(SOUND_VM_CAUTION, sound_CAUTION)
  407.     playSoundOnceFromParam(SOUND_VM_BINGO, sound_BINGO)
  408.     playSoundOnceFromParam(SOUND_VM_DATA, sound_DATA)
  409.     playSoundOnceFromParam(SOUND_VM_IFF, sound_IFF)
  410.    
  411.     -- VMS Test
  412.     playLoopingSoundFromParam(SOUND_VMS_TEST, sound_VMSTest)
  413.    
  414.     -- Audio Tones
  415.     playLoopingSoundFromParam(SOUND_LANDING_GEAR_WARNING_HORN, sound_LandingGearWarningHorn)
  416.     playLoopingSoundFromParam(SOUND_LOW_SPEED_WARNING_TONE, sound_LowSpeedWarningTone)
  417.    
  418.     -- Cockpit Systems 
  419.     playLoopingSoundFromParam(SOUND_BATTERY, sound_Battery)
  420.     playLoopingSound(sound_Pressurization)
  421.     playSoundOnceFromParam(SOUND_DEPRESSURIZATION, sound_Depressurization)
  422.    
  423.     -- Engine  
  424.     playSoundOnceFromParam(SOUND_AFTERBURNER_START_IN, sound_AfterburnerStartIn)
  425.     playLoopingSoundFromParam(SOUND_AFTERBURNER_IN, sound_AfterburnerIn)
  426.     playLoopingSound(sound_Engine1In)
  427.     playLoopingSound(sound_Engine2In)
  428.     playLoopingSound(sound_Engine3In)
  429.    
  430.     -- JFS
  431.     playLoopingSoundFromParam(SOUND_JFS_LOOP, sound_JFSIn)
  432.        
  433.     -- update volumes  
  434.     updateSoundParameters(sound_EjectLever, nil, cockpitGain, nil)
  435.     updateSoundParameters(sound_ThrottleIdleCutoff, nil, cockpitGain, nil)
  436.     updateSoundParameters(sound_ThrottleDetent1, nil, cockpitGain, nil)
  437.     updateSoundParameters(sound_ThrottleDetent2, nil, cockpitGain, nil)
  438.     updateSoundParameters(sound_ThrottleABStage, nil, cockpitGain, nil)
  439.     updateSoundParameters(sound_CanopyClose, nil, cockpitGain, nil)
  440.     updateSoundParameters(sound_CanopyOpen, nil, cockpitGain, nil)
  441.     updateSoundParameters(sound_MagswitchOut, nil, cockpitGain, nil)
  442.    
  443.     updateLoopSoundParameters(sound_Battery, nil, cockpitGain, nil)    
  444.     updateLoopSoundParameters(sound_CanopyOpenLoop, nil, cockpitGain, nil)
  445.     updateLoopSoundParameters(sound_CanopyCloseLoop, nil, cockpitGain, nil)
  446.     updateLoopSoundParameters(sound_SeatAdjustmentUpLoop, nil, cockpitGain, nil)
  447.     updateLoopSoundParameters(sound_SeatAdjustmentDownLoop, nil, cockpitGain, nil)
  448.    
  449.     updateLoopSoundParameters(sound_Pressurization, nil, pressurizationGain, nil)
  450.     updateSoundParameters(sound_Depressurization, nil, pressurizationGain, nil)
  451.    
  452.     updateSoundParameters(sound_AfterburnerStartIn, nil, cockpitGain, nil)
  453.     updateLoopSoundParameters(sound_AfterburnerIn, nil, afterburnerGain, nil)
  454.    
  455.     updateLoopSoundParameters(sound_Engine1In, ENGINE_1_PITCH:get(), engine1Gain, nil)
  456.     updateLoopSoundParameters(sound_Engine2In, ENGINE_2_PITCH:get(), engine2Gain, nil)
  457.     updateLoopSoundParameters(sound_Engine3In, ENGINE_3_PITCH:get(), engine3Gain, nil)
  458.        
  459.     updateSoundParameters(sound_PULLUP, nil, intercomGain, nil)
  460.     updateSoundParameters(sound_ALTITUDE, nil, intercomGain, nil)
  461.     updateSoundParameters(sound_WARNING, nil, intercomGain, nil)
  462.     updateSoundParameters(sound_JAMMER, nil, intercomGain, nil)
  463.     updateSoundParameters(sound_COUNTER, nil, intercomGain, nil)
  464.     updateSoundParameters(sound_CHAFF_FLARE, nil, intercomGain, nil)
  465.     updateSoundParameters(sound_LOW, nil, intercomGain, nil)
  466.     updateSoundParameters(sound_OUT, nil, intercomGain, nil)
  467.     updateSoundParameters(sound_LOCK, nil, intercomGain, nil)
  468.     updateSoundParameters(sound_CAUTION, nil, intercomGain, nil)
  469.     updateSoundParameters(sound_BINGO, nil, intercomGain, nil)
  470.     updateSoundParameters(sound_DATA, nil, intercomGain, nil)
  471.     updateSoundParameters(sound_IFF, nil, intercomGain, nil)
  472.    
  473.     updateLoopSoundParameters(sound_VMSTest, nil, intercomGain, nil)
  474.     updateLoopSoundParameters(sound_LandingGearWarningHorn, nil, intercomGain, nil)
  475.     updateLoopSoundParameters(sound_LowSpeedWarningTone, nil, intercomGain, nil)   
  476. end
  477.  
  478.  
  479. function SetCommand(command,value)
  480.     if command == Keys.iCommandPlaneEject then
  481.         playSoundOnce(sound_EjectLever)
  482.     end
  483. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement