LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sound file causes temporary freezing

Hi all, 

 

I am new to labview and I've faced a problem during running my code.

I have a code that calls subvi which plays a sound file of type .wav using Play Sound File VI and Sound Output Clear VI. The sound file should play when some events occure, the problem is that the application is freez a little bit when it is time to play that sound. So I think I should load that subvi or maybe the sound file whenevr the application start. 

 

Do you have any suggestion for reloading that subvi or sound file and what I should use.

It realy affects the performance of my application. 

 

 

I appreciate your help.

 

 

Thank you in advance 

 

 

0 Kudos
Message 1 of 4
(3,065 Views)

Can you post your code?

This sounds very much like you've placed a long executing piece of code (sound play) inside of an event structure which will prevent other events from being handled while that code is active.

 

Architecturally, there are several ways around this. A queued state machine or dynamic launch of your sound play VI would be the most straightforward.

0 Kudos
Message 2 of 4
(3,038 Views)

Many thanks for your reply

Okay 

 

Let me just make that clear 

 

I am reading signals and wherver the value of the signal reach the limit ( Max Value ) I should alram the user by sound 

 

when event occured.PNG

 

so the subvi on the red circle should be called 

 

and here its code 

 

sound subvi.PNG

 

So what do you think?

0 Kudos
Message 3 of 4
(3,014 Views)
You are overusing local variables. Use dataflow, your code may get vulnaribility to race condition. In this case I would use a producer consumer template. If a warning needs to be fired, put it into the queue. Your consumer loop will dequeue the warning and execute the sound signal.
0 Kudos
Message 4 of 4
(2,974 Views)