Technical data
ASTi ACE Studio Components Reference Guide Rev. M DOC-01-TELAS-CRG-4
Copyright © 2014 Advanced Simulation Technology inc. 39
2.17. Playsound
Summary: The playsound component provides the ability to play digitally encoded
soundfiles. Sounds that have no dynamically varying elements (except for overall
volume level) are best handled as fixed off-line recorded sound files (e.g. Missile
launch).
Host inputs are provided to trigger playback, pause playback, set the start of file
offset, set the end of file offset, adjust the overall output gain, and set the file index
number for grouped sound files.
Description: The Trigger and Pause input parameters control playback. The
playback behavior is determined by the Simple Loop and PlayAll flags that are
configured as part of the sound file definition outside of the playsound component.
If the sound file is configured for Simple Loop, the playsound plays the file to its
end, then starts at the beginning again until the trigger is removed. If the sound file
is configured for Play All, the playsound plays the file to its end when the trigger is
removed.
If the playsound component points to a sound group or library, the Index input
parameter determines which sound file within the group or library is played. The
Index value must be greater than 0 for a sound file within a sound group to be
played. The playsound does not play if Index is 0. If the playsound component
points to a sound file, Index is ignored. If the trigger value is held true, and the
index is incremented, the sound file will be played as if the trigger were set true
with the new Index value. If the trigger is held true and the Index is incremented
before the current file is done playing, it’s behavior will be determined by the
Playall and the Loop flags, as explained above.
There are several levels of organization for sound files. A Library is a collection of
Groups. A group is a collection of sounds or playfiles. Within the playsound
component, the Library ID must be set, and is not modified by an external control
(for example a host control). The group ID can be set locally within the component,
and also modified or set by and external control. The Index determines which
soundfile within the specified Library and Group is selected. A Group value of 0
indicates that the soundfile is not in a Group, but directly under the Library
(equivalent to Model Builder organization).
The Gain input parameter controls the amplitude of the playsound output.
The output signal from a pre-recorded sound file can be connected to any
component that accepts audio as an input, such as a Mixer.
Control Inputs
Begin
Offset
Type Default Value
float32 0.0
Description: A value between 0.0 and 1.0 will adjust the start posi-
tion of the soundfile. The sound needs to be fully buffered for this to
function, ensure the buffer setting is set to 'True' for the sound in the
Sound Repository.
Begin
Position
Type Default Value
float32 1.0
Description: The current begin position offset as a fraction of the
selected files total length, i.e. a value of 0.5 starts the file half way
into normal play section.
End Offset
Type Default Value
float32 0.0
Description: A value between 0.0 and 1.0 will adjust the end posi-
tion of the soundfile. The position is calculated relative to the end of
the file (i.e. a value of 0.3 will result in an end position of 70% of the
entire length of the file.) If the end offset is less than the start offset
(after the BeginOffset calculation has been made, the end offset will
result in a value of 0.0). The sound needs to be fully buffered for this
to function, ensure the buffer setting is set to 'True' for the sound in
the Sound Repository.
End Posi-
tion
Type Default Value
float32 1.0
Description: The current end position offset as a fraction of the
selected files total length, i.e. a value of 0.1 stops the file at 90% of
it’s normal end point.










