You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

Overview

This document describes how to configure a project so that it has different groups that have different sounds. When double-clicking the Sound column, you choose which kind of windows sound will play when an alarm happens for that specific group.


On this page:


Configuration

It's possible to configure the sounds statically, according to default Windows sounds or dynamically, to advanced users. The following two examples will show how to set both.

example 1 Static way

To configure a project so that a group has a different sound when an alarm is active, use one of these ways:

Select one of the default Windows sounds from the Sound column for the specific group.

Use the default Windows sound option as showed above. However, change the WAV file in the Control Panel on the client computers as you want.

Follow the steps below:

  1. Open the Control Panel, and click Sound option.
  2. In the Sound dialog, click the Sounds tab.
  3. Choose the Event sound that you want to change. In this example, we are changing the Asterisk event.
  4. Click the Browse... button and select a new .wav file for the event.
  5. Click the Apply button and close the Sound dialog.


Step-by-step to configure a new .wav file

example 2 - Playing soud by Scripting.

If the user needs to play a custom sound when an alarm is triggered, it's possible to do it by scripting, in this way, the sound will be played only one time. The most common extensions, like mp3 are supported to.

The procedure describes here will not being running into Alarm Module, but it can be necessary if the user needs to configure any alarm sound into the solution.

In order to play a customized sound signal, the Sound column on Alarms → Groups to be None.

The @Alarms namespace has a property called "TotalCount", it changes its value whenever a new alarm is triggered, so it is possible to run a Task whenever this property changes, registering it as a task trigger.



After that, create a script Task that will run every time the Alarm.TotalCount property changes. This script Task must be a Client Domain.




Below is an example of code you can create to manage the alarm sounds.

//Make sure that the script only runs when there is an active alarm
if(@Alarm.TotalCount <= 0)
	return;   
  
//Make sure that the script only runs when the Alarm.TotalCount increases the number of active alarm
if (@Alarm.TotalCount < @Tag.AlarmTotalCountPrevious)
{
	@Tag.AlarmTotalCountPrevious = @Alarm.TotalCount;
	return;
}
@Tag.AlarmTotalCountPrevious = @Alarm.TotalCount;

try
{
	System.Media.SoundPlayer player = new System.Media.SoundPlayer();
	//Get which group that is active has higher priority
	switch (@Alarm.PriorityItem.Group)
	{
		case "Alarm.Group.Warning":
			string filePath = @Info.GetExecutionFolder() + @"\alarm1.Wav";
		break;
			
		case "Alarm.Group.Critical":
			filePath = @Info.GetExecutionFolder() + @"\alarm2.Wav";
		break;	
	}
	
	//Set the path wav. file
	player.SoundLocation = filePath;
	
	player.Load();
	player.Play();
}
catch(Exception ex)
{
	@Info.Trace("Error playing audio file: "+ ex.Message);


Since the script Task is a Client Domain, the .wav file needs to be in the correct path that is specified in the code on every client computer.


Execution

Every time an alarm happens when the project is running, the Product will check which option was configured in the Sound column and play the .wav file configured on the Control Panel → Sound. Since the alarm sound is played on the client computer, all the Control Panel configurations must be done on all the client computers.



In this section:

The root page @parent could not be found in space v10.

  • No labels