Page 1 of 1

Trying to use API Sound.Play

Posted: Wed May 24, 2017 3:26 pm
by gtc
I wish to play a bell sound, using file bell.wav

For this API the user guide says ...
Calling in a calculation

Declare a variable 'result' of type BOOL
Add to a calculation icon:

result = ::Sound.Play("filename")
I have done that, but I get no sound played, and the result variable's value is True, even if the wav file does not exist.

Scratching my head here!

(FC6)

Re: Trying to use API Sound.Play

Posted: Wed May 24, 2017 3:39 pm
by Benj
Hello,

There is an example here you can refer to but there is quite a lot going on.
viewtopic.php?f=54&t=16848&p=73371

It seems all I am doing is calling the sound.play function in the PlayMidiFile macro for the simulation sound so you can check to see if my .wav file works for you. It could be that your file is in the wrong format for the function to work correctly.

Re: Trying to use API Sound.Play

Posted: Wed May 24, 2017 4:13 pm
by gtc
Mine is a valid .wav file, but I tried your TETRIS.WAV as suggested and it doesn't play either.

Your code uses simulation and component macros.

The User Guide implies that all I need to use is a calculation. Is the UG incorrect, or do I simply not understand how to use API stuff?