Sound Events Basics
Sound events added to Comflow. They are available to enrich errors or to add sounds in Java rules.
New Class SoundEvent
net.comactivity.core.renderer.sound.SoundEvent
SoundEvent
has two fields, severity
and soundName
. Severity values are modeled after severities in net.comactivity.base.error.CAError
. In a similar fashion, default sound names are named to mirror constants in CAError
. Default severity
is Undefined
. soundName
will by default be resolved according to severity
.
Severity | Severity value | Sound name |
---|---|---|
Undefined | -1 | empty string |
Info | 0 | info |
Warning | 10 | warning |
Confirmation | 20 | confirmation |
Error | 30 | error |
Fatal | 99 | fatal |
Sounds in Portal
Both DialogWorkspace
and ErrorService
has sound events. The sound with highest severity will be added to RendererModel
at dialog out. At dynamic requests, the sound with the highest severity be sent as a script reply. One sound will be played at a time in the client.
Add Sounds
Sound files resides in PublicRoot/sounds
and are identified by their name, without consideration to their extension.
Comflow ships with placeholder sound files that aren't meant for production use. To properly use sounds, files will have to be added with names that correspond to the default names: info, warning, confirmation, error, and fatal. Custom sounds are added the same way, with a name that corresponds to the sound name used in rules.
Example
A developer decides to use sounds to enrich a customer project's CAError
messages. They use SoundKit, and appropriate sound files are added in PublicRoot/sounds
with new names.
File Name in SoundKit | File Name in Comflow |
---|---|
Train Station.wav | info.wav |
Confused.wav | warning.wav |
Chimey.wav | confirmation.wav |
Tongue Out.wav | error.wav |
Synth Cord.wav | fatal.wav |
Technical Details
- Sounds are played in client with Javascript library Buzz.
- Sound files can be in formats
mp3
,wav
,aac
, andogg
. - Client needs to have support for
HTML5
audio
tag to support all formats listed above. There's a fallback for older clients in Comflow's PDA rendering. It uses the tagbgsound
and supportswav
files.