Jump to content
The simFlight Network Forums

LUA Sound Functions


Recommended Posts

Hi Andrew,

On 12/10/2021 at 12:39 PM, John Dowson said:

yes, I have just tested this and found the same. Not sure what has happened, I will look into this over the weekend.

Well, I just looked at this again and it is working for me now...the paths I had used previously weren't correct.
I tested with the below script and heard all three sounds:

Quote

ipc.log("Playing bncrash2 from P3Dv5 Sound folder")
sound.play("bncrash2")

ipc.sleep(5000)
ipc.log("Playing canopy closing from full path to my device 2")
sound.path("D:\\Prepar3D v5 Add-ons\\FSUIPC6\\SoundFiles")

sound.play("canopy_closing", 2)

ipc.sleep(5000)
ipc.log("Playing crash from SoundFiles folder located under P3Dv5 Sound folder")
sound.path("SoundFiles")
sound.play("crash_ground")

ipc.log("Finished SoundTest")
 

Could you adjust that script to use your local folders and sound files to see if you hear anything with that.

Cheers,

John

Link to comment
Share on other sites

1 hour ago, Scotfleiger said:

Sound.play now working thank you.

Ok, good - what was the issue?

1 hour ago, Scotfleiger said:

How do I reference the current FSUIPC6 location? Is there an offset?

There isn't an offset for this, but why do you need it? If you want to reference from the installation folder, use a relative file path.

 

Link to comment
Share on other sites

3 hours ago, John Dowson said:

There isn't an offset for this, but why do you need it? If you want to reference from the installation folder, use a relative file path.

The relative file path does not appear with to work with the sound.path function. It works with everything else.

I have solved my problem by reading the current directory in my GUI and passing that to LUA to give an absolute address for FSUIPC via the sound.path function.

Link to comment
Share on other sites

1 minute ago, Scotfleiger said:

The relative file path does not appear with to work with the sound.path function. It works with everything else.

Yes, sorry, I was mistaken...as documented, relative paths are taken from the current default path, which will be the P3D sounds folder, and not the FSUIPC installation path - that is used in FSUIPC7, not FSUIPC6!

7 minutes ago, Scotfleiger said:

I have solved my problem by reading the current directory in my GUI and passing that to LUA to give an absolute address for FSUIPC via the sound.path function.

Ok. However, I think the installation folder location would be useful, I will look into adding it to an offset - I'm surprised its not already there....

John
 

  • Upvote 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.