LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to play different wav files(songs) when i switch states on a case structure

Hello.I am trying to make a case structure where when I switch states,I can also switch the song that is being played.While I am managing to make that work,I cant figure out how to fix the issue where the playback of the wav file is being looped constantly.

Screenshot_2024-04-02_033522.png 

Screenshot_2024-04-02_034158.png


I am providing below the VI file,along with the wav files(Please make sure to path them accordingly).
Thanks in advance for your time!

0 Kudos
Message 1 of 3
(171 Views)

Hi Fefes,

 


@Fefes wrote:

I cant figure out how to fix the issue where the playback of the wav file is being looped constantly.


Which "issue" do you talk about?

Your case structure is placed inside a loop and as long as the loop iterates it will execute the selected case - and so it also plays the wav file as programmed by you inside the cases!

 


@Fefes wrote:

Hello.I am trying to make a case structure where when I switch states,I can also switch the song that is being played.


Do you want to play the sound ONLY when the boolean button is switched?

Then you should use an event structure or check for boolean changes using the PtByPt-BooleanCrossing function…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(129 Views)

Keep the opened Play-reference in a shift register and use it in the other case to stop it. The open+close combo most probably creates a new ID that's separate and stops that.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 3
(104 Views)