Mr.Rick Posted October 19, 2022 Report Posted October 19, 2022 Hi, when using sound.play, is there a way to stop ALL sounds that have been started using this command without specifing a "ref" ? Cheers
John Dowson Posted October 19, 2022 Report Posted October 19, 2022 No, sorry - you have to store the ref and use that to stop sounds playing. Even killing the lua will not stop the sounds playing... John
Mr.Rick Posted October 19, 2022 Author Report Posted October 19, 2022 1 minute ago, John Dowson said: Even killing the lua will not stop the sounds playing... So I have found out 🙂 No Problems, thanks for your speedy reply John!
Mr.Rick Posted October 19, 2022 Author Report Posted October 19, 2022 sound.play("paxsign.wav",0,-100) I believce this will play the sound in the background, but what happens is nothing is played?
John Dowson Posted October 19, 2022 Report Posted October 19, 2022 5 minutes ago, Snupple said: sound.play("paxsign.wav",0,-100) That is playing with a volume of 100 on sound device 0 - but only when the FS has the focus. I haven't checked this (i.e. using negative numbers)....maybe it only plays when FSUIPC7 has the focus? Can you check this? And does it work with sound.play("paxsign.wav",0,100) ?
Mr.Rick Posted October 19, 2022 Author Report Posted October 19, 2022 28 minutes ago, John Dowson said: That is playing with a volume of 100 on sound device 0 - but only when the FS has the focus. I haven't checked this (i.e. using negative numbers)....maybe it only plays when FSUIPC7 has the focus? Can you check this? And does it work with sound.play("paxsign.wav",0,100) sound.play("paxsign.wav",0,100) does work Tried with -100 and it does only play when FSUIPC has focus and mutes when it looses focus, in the manul it says refers to "FS" having focus, does that measn FSUIPC and not Flight Simulator?
John Dowson Posted October 19, 2022 Report Posted October 19, 2022 5 minutes ago, Snupple said: Tried with -100 and it does only play when FSUIPC has focus and mutes when it looses focus, in the manul it says refers to "FS" having focus, does that measn FSUIPC and not Flight Simulator? At the moment, yes - but really its a bug, a hangover from FSUIPC6 which is an embedded dll, so the FS has the focus when FSUIPC has the focus. I will take a look at this an either restore the correct functionality (i.e. only play the sound if the FS has the focus) or remove this option - I don't think it worth keeping if it only plays when FSUIPC7 has the focus. John
Mr.Rick Posted October 19, 2022 Author Report Posted October 19, 2022 1 minute ago, John Dowson said: I don't think it worth keeping if it only plays when FSUIPC7 has the focus. Agreed, cheers
John Dowson Posted October 19, 2022 Report Posted October 19, 2022 I've just looked into this a bit further...it is not possible to restore this functionality completely, due to the change from an embedded process to a separate application. When using a non-negative number (i.e. 0-100), a windows flag is set when instructing windows to play the sound with "Global Focus", and this is not set when a negative number is used, and so it is windows itself that controls whether you hear the sound or not, but the sound file is played regardless. What this means if that if you play a sound using a negative number, the sound file is still played and if you change the focus to/from the FS then the sound will be played/muted as you change the focus. Now that FSUIPC7 is a separate application, this is no longer possible. However, I could add a check on the existing focus, and if a negative number is used and the FS (or FSUIPC) does not have the focus, then I can just not play the sound file. The result would be similar but not identical, as it would be FSUIPC7 not playing the sound file, rather than windows playing the file and muting when the requested application does not have the focus. Do you think this is still useful and worth implementing, or should I just remove this option?
John Dowson Posted October 19, 2022 Report Posted October 19, 2022 2 hours ago, John Dowson said: Do you think this is still useful and worth implementing, or should I just remove this option? I am going to remove this option, due to difficulties confirming whether MSFS actually has the focus or not. I will still allow negative values (for backwards compatibility) but they will be treated the same as positive values.
Mr.Rick Posted October 20, 2022 Author Report Posted October 20, 2022 Ok, no worries - thanks for taking the time to look into this 🙂
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now