AdvancedHMI Software

General Category => Support Questions => Topic started by: joko markono on March 12, 2020, 02:22:28 AM

Title: Continuous Sound Player
Post by: joko markono on March 12, 2020, 02:22:28 AM
Hi,

I need to play an alarm sound continuously. at the moment the sound will stop after a cycle.
please help.
Title: Re: Continuous Sound Player
Post by: Archie on March 12, 2020, 07:41:14 AM
How are you playing the sound currently?
Title: Re: Continuous Sound Player
Post by: joko markono on March 12, 2020, 10:05:11 AM
There is an address from plc program which is triggered by certain condition i.e. high or low value.
Title: Re: Continuous Sound Player
Post by: Archie on March 12, 2020, 10:15:39 AM
Are you using the SoundPlayer component or writing code?
Title: Re: Continuous Sound Player
Post by: joko markono on March 12, 2020, 11:20:43 AM
The component from AHMI toolbox.
Title: Re: Continuous Sound Player
Post by: Godra on March 12, 2020, 08:01:54 PM
Try using the attached modified version of the SoundPlayer.

Remove the current SoundPlayer component from the form, save and close the form, replace the stock version in the AdvancedHMIControls/Components folder with the modified one, rebuild the solution.

The modified version only has 2 triggers, PositiveChange and NegativeChange (AnyChange was removed) and a new LoopSound property.
The change of value will start/stop sound playback when the LoopSound property is set to True, otherwise it will play sound only once.

Title: Re: Continuous Sound Player
Post by: joko markono on March 12, 2020, 09:13:32 PM
i will. hopefully the sound continuously play in loop. thanks.
Title: Re: Continuous Sound Player
Post by: joko markono on March 12, 2020, 09:52:36 PM
i found the easiest solution:

1. in the solution explorer, go to Controls>Components>SoundPlayer.vb
2. right click SoundPlayer.vb>view code
3. expand the Events and see the Private Sub PlaySound()
4. Change the player.Play() to player.PlayLooping()
5. Rebuild and Save the project.
Title: Re: Continuous Sound Player
Post by: Godra on March 12, 2020, 10:44:38 PM
How do you stop the sound playback?
Title: Re: Continuous Sound Player
Post by: joko markono on March 12, 2020, 11:33:26 PM
that will be from the PLC program.
so at the moment i have a BarLevel indicator with high and low setting.
if above high and below low limit, the sound alarm will activate (program in the PLC).

did i miss out anything? please let me know.