Drag[en]gine Script Module DragonScript Script API  1.0
Announcer Class Reference

Announcer. More...

Inheritance diagram for Announcer:

Public Member Functions

void addAnnouncePart (String partID)
 Add announcement part. More...
 
void addPart (AnnouncerPart part)
 Add part. More...
 
Synthesizer createSynthesizer ()
 Create synthesizer from announcer definition. More...
 
void forEachPart (Block ablock)
 Visit parts with block with parameter AnnouncerPart. More...
 
String getAnnouncePartAt (int index)
 Get announcement part at index. More...
 
int getAnnouncePartCount ()
 Number of parts in the announcement. More...
 
AnnouncerPart getPart (String partID)
 Get named part or null if absent. More...
 
int getPartCount ()
 Number of parts. More...
 
Speaker getSpeaker ()
 Speaker used to play back announcer. More...
 
SynthesizerInstance getSynthesizer ()
 Synthesizer used for playing back announcer. More...
 
bool hasPart (String partID)
 Part with ID is present. More...
 
Announcer new ()
 Create announcer. More...
 
void play ()
 Start playing if announcement parts are present. More...
 
void removeAllAnnounceParts ()
 Clear announcement parts. More...
 
void removeAllParts ()
 Remove all parts. More...
 
void removePart (String partID)
 Remove part. More...
 
void setAnnounceFromText (String text)
 Set announce parts from text. More...
 
void setModifierSynthesizer (Synthesizer synthesizer)
 Set custom synthesizer modifying the announcement or null if not used. More...
 
void stop ()
 Stop and reset. More...
 
void updateSampleRate ()
 Update next remaining sample rate from synthesizer if present. More...
 
void updateSpeaker ()
 Update speaker for playing back announcer. More...
 
void updateSynthesizer ()
 Update synthesizer instance play time and curves. More...
 

Detailed Description

Announcer.

Play back word sound files to produce an announcement similar to train or building announcement systems using a synthesizer loaded from an XML file.

Announcers operate a synthesizer instance and a speaker attached to it. In real world scenarios though announcements typically apply to multiple speakers at the same time. In a game situation though it is usually enough to play back only from the speaker neartest to the location the player is located in. If more speakers have to play back the same announcement you can assign the synthesizer instance to speakers you have created yourself and start playing them whenever you start playing an announcement on the announcer handled speaker. If you need special abilities like some speakers having audible odities using a custom made synthesizer to alter the announcement you have to create one announcer for each such speaker. This might be anyways the most simple solution.

If a custom modifier synthesizer is used it is added as a synthesizer source after the source producing the announcement. Additionally a modified synthesizer blend controller is added as well as copies of controllers matching the modifier synthesizer controllers properly linked.

Author
Roland Pl├╝ss
Version
1.0
Date
2016

Member Function Documentation

§ addAnnouncePart()

void addAnnouncePart ( String  partID)

Add announcement part.

§ addPart()

void addPart ( AnnouncerPart  part)

Add part.

§ createSynthesizer()

Synthesizer createSynthesizer ( )

Create synthesizer from announcer definition.

§ forEachPart()

void forEachPart ( Block  ablock)

Visit parts with block with parameter AnnouncerPart.

§ getAnnouncePartAt()

String getAnnouncePartAt ( int  index)

Get announcement part at index.

§ getAnnouncePartCount()

int getAnnouncePartCount ( )

Number of parts in the announcement.

§ getPart()

AnnouncerPart getPart ( String  partID)

Get named part or null if absent.

§ getPartCount()

int getPartCount ( )

Number of parts.

§ getSpeaker()

Speaker getSpeaker ( )

Speaker used to play back announcer.

§ getSynthesizer()

SynthesizerInstance getSynthesizer ( )

Synthesizer used for playing back announcer.

§ hasPart()

bool hasPart ( String  partID)

Part with ID is present.

§ new()

Announcer new ( )

Create announcer.

§ play()

void play ( )

Start playing if announcement parts are present.

§ removeAllAnnounceParts()

void removeAllAnnounceParts ( )

Clear announcement parts.

§ removeAllParts()

void removeAllParts ( )

Remove all parts.

§ removePart()

void removePart ( String  partID)

Remove part.

§ setAnnounceFromText()

void setAnnounceFromText ( String  text)

Set announce parts from text.

Scans text for parts adding them. Always picks the part with the most words/characters matching. Matching is done by converting text to lowercase first. Special parts are handled using pauses.

§ setModifierSynthesizer()

void setModifierSynthesizer ( Synthesizer  synthesizer)

Set custom synthesizer modifying the announcement or null if not used.

§ stop()

void stop ( )

Stop and reset.

§ updateSampleRate()

void updateSampleRate ( )

Update next remaining sample rate from synthesizer if present.

§ updateSpeaker()

void updateSpeaker ( )

Update speaker for playing back announcer.

Call this method after modifying the parts.

§ updateSynthesizer()

void updateSynthesizer ( )

Update synthesizer instance play time and curves.

Sets the play time of the synthesizer instance to the play length of the entire announcement. Sets the select and play curve to play back the desired announcement.


The documentation for this class was generated from the following file: