Announcement

Collapse
No announcement yet.

playing sound once

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • playing sound once

    I know that when I am plotting a triangle when the stoch goes above 80 I put a "removeShape(Shape.TRIANGLE)" before the instruction to plot it only once per event.

    Is there a similar instruction to only play a wav file once as it crossed above the 80? I tried putting in the instruction "only the first time" and this allows the wav file to play only the first time of the day when the stoch goes above 80.

    Hope this makes sense

  • #2
    The best way to do this is to set a global variable (outside of main()), and then set it to true when the alert sounds, and false when the lines go below 80. Here's an example...

    var vGlobalFlag = false;

    function main () {

    ...

    if (condition1 == true && vGlobalFlag == false) {

    // play sound
    vGlobalFlag = true;

    }

    if (condition2 == true && vGlobalFlag == true) vGlobalFlag = false;

    }
    Regards,
    Jay F.
    Product Manager
    _____________________________________
    Have a suggestion to improve our products?
    Click Support --> Request a Feature in eSignal 11

    Comment

    Working...
    X