Author Topic: Continuous Sound Player  (Read 1074 times)

joko markono

  • Full Member
  • ***
  • Posts: 132
    • View Profile
Continuous Sound Player
« 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.
« Last Edit: March 12, 2020, 05:29:42 AM by joko markono »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5272
    • View Profile
    • AdvancedHMI
Re: Continuous Sound Player
« Reply #1 on: March 12, 2020, 07:41:14 AM »
How are you playing the sound currently?

joko markono

  • Full Member
  • ***
  • Posts: 132
    • View Profile
Re: Continuous Sound Player
« Reply #2 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.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5272
    • View Profile
    • AdvancedHMI
Re: Continuous Sound Player
« Reply #3 on: March 12, 2020, 10:15:39 AM »
Are you using the SoundPlayer component or writing code?

joko markono

  • Full Member
  • ***
  • Posts: 132
    • View Profile
Re: Continuous Sound Player
« Reply #4 on: March 12, 2020, 11:20:43 AM »
The component from AHMI toolbox.

Godra

  • Hero Member
  • *****
  • Posts: 1439
    • View Profile
Re: Continuous Sound Player
« Reply #5 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.

« Last Edit: March 14, 2020, 10:43:46 PM by Godra »

joko markono

  • Full Member
  • ***
  • Posts: 132
    • View Profile
Re: Continuous Sound Player
« Reply #6 on: March 12, 2020, 09:13:32 PM »
i will. hopefully the sound continuously play in loop. thanks.

joko markono

  • Full Member
  • ***
  • Posts: 132
    • View Profile
Re: Continuous Sound Player
« Reply #7 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.

Godra

  • Hero Member
  • *****
  • Posts: 1439
    • View Profile
Re: Continuous Sound Player
« Reply #8 on: March 12, 2020, 10:44:38 PM »
How do you stop the sound playback?

joko markono

  • Full Member
  • ***
  • Posts: 132
    • View Profile
Re: Continuous Sound Player
« Reply #9 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.
« Last Edit: March 12, 2020, 11:38:09 PM by joko markono »