Sound

Questions about deployment and use of Air Manager Instruments

Moderators: russ, Ralph

Message
Author
User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Sound

#11 Post by Sling »

Perhaps something like this.

Code: Select all


local sound_active = false
mysound = sound_add("SLAP.wav")

function new_speed(speed)

speed = var_cap(speed, 0, 170)
        
    if speed > 20 and speed < 60 and not sound_active then
        sound_loop(mysound)
        sound_active = true            
    elseif (speed <= 20 or speed >= 60) and sound_active then
        sound_stop(mysound)
        sound_active = false
    end
end

-------------------
-- Bus subscribe --
-------------------

fsx_variable_subscribe("AIRSPEED INDICATED", "knots", new_speed)

Last edited by Sling on Fri Jan 22, 2021 3:56 pm, edited 1 time in total.

maak_pk
Posts: 27
Joined: Sun Dec 13, 2020 11:37 am
Location: Pakistan

Re: Sound

#12 Post by maak_pk »

Thanks it will work will try it and will let you know
Great full
regards
Maak

User avatar
Ralph
Posts: 7915
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Sound

#13 Post by Ralph »

You can do a sound_loop once when you're at that speed. You'll need to set a variable once the loop has started, and set that same variable to a different value when you're outside that zone.

User avatar
Ralph
Posts: 7915
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Sound

#14 Post by Ralph »

I'm too late :lol:

maak_pk
Posts: 27
Joined: Sun Dec 13, 2020 11:37 am
Location: Pakistan

Re: Sound

#15 Post by maak_pk »

Thanks alot still

Post Reply