question

Victor Alejandro HT avatar image
0 Likes"
Victor Alejandro HT asked Victor Alejandro HT commented

Sound file not playing

Hi all,

I want to play a sound file when a box enters a Queue (is just a test) using a Custom code process flow step. I have follow the code that @Matthew Gillespie shows in this answer.

https://answers.flexsim.com/questions/48163/adding-sound.html?childToView=48164#answer-48164

But perhaps I am missing something because I can not play the file.

This is the line code that I am using:

soundplayfile(activedocumentnode(),"C:\Users\torru\Downloads\sound.wav", 1);

And this is the location of the file.

Do I have to set a view first? I attached the model, asound-test.fsmny help is welcomed. Thank you.

Alejandro

FlexSim 19.1.1
pfsound
pf.png (66.3 KiB)
location.png (9.7 KiB)
sound-test.fsm (23.8 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered Victor Alejandro HT commented

Since you're defining the path as a string you need to put in two slashes instead of one. This is because a string interprets a single slash as an escape character.

Your code should look like this:

soundplayfile(activedocumentnode(),"C:\\Users\\torru\\Downloads\\sound.wav", 1);
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Victor Alejandro HT avatar image Victor Alejandro HT commented ·

Thank you very much for the explanation @Matthew Gillespie now it works and I learned a bit more. Have a great day.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.