Drag[en]gine Script Module DragonScript 1.35
Loading...
Searching...
No Matches
Dragengine.Audio.Announcer.Announcer Class Reference

Announcer. More...

Inheritance diagram for Dragengine.Audio.Announcer.Announcer:

Public Member Functions

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

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.

Member Function Documentation

◆ addAnnouncePart()

void Dragengine.Audio.Announcer.Announcer.addAnnouncePart ( String partID)

Add announcement part.

References removeAllParts().

Referenced by play().

◆ addPart()

void Dragengine.Audio.Announcer.Announcer.addPart ( AnnouncerPart part)

Add part.

References getPart().

Referenced by setModifierSynthesizer().

◆ createSynthesizer()

Synthesizer Dragengine.Audio.Announcer.Announcer.createSynthesizer ( )

◆ forEachPart()

void Dragengine.Audio.Announcer.Announcer.forEachPart ( Block ablock)

Visit parts with block with parameter AnnouncerPart.

Referenced by removeAllAnnounceParts().

◆ getAnnouncePartAt()

String Dragengine.Audio.Announcer.Announcer.getAnnouncePartAt ( int index)

Get announcement part at index.

References removePart().

Referenced by stop().

◆ getAnnouncePartCount()

int Dragengine.Audio.Announcer.Announcer.getAnnouncePartCount ( )

Number of parts in the announcement.

Referenced by getSpeaker().

◆ getControllerPart()

SynthesizerController Dragengine.Audio.Announcer.Announcer.getControllerPart ( )

Part selector controller.

Referenced by createSynthesizer().

◆ getControllerState()

SynthesizerController Dragengine.Audio.Announcer.Announcer.getControllerState ( )

Play state controller.

Referenced by createSynthesizer().

◆ getPart()

AnnouncerPart Dragengine.Audio.Announcer.Announcer.getPart ( String partID)

Get named part or null if absent.

Referenced by addPart().

◆ getPartCount()

int Dragengine.Audio.Announcer.Announcer.getPartCount ( )

Number of parts.

Referenced by hasPart().

◆ getPlaying()

bool Dragengine.Audio.Announcer.Announcer.getPlaying ( )

Announcement is playing back.

References removeAllAnnounceParts().

Referenced by createSynthesizer().

◆ getSpeaker()

Speaker Dragengine.Audio.Announcer.Announcer.getSpeaker ( )

Speaker used to play back announcer.

References getAnnouncePartCount().

Referenced by createSynthesizer().

◆ getSynthesizer()

SynthesizerInstance Dragengine.Audio.Announcer.Announcer.getSynthesizer ( )

Synthesizer used for playing back announcer.

References setModifierSynthesizer().

Referenced by createSynthesizer().

◆ hasPart()

bool Dragengine.Audio.Announcer.Announcer.hasPart ( String partID)

Part with ID is present.

References getPartCount().

Referenced by removeAllParts().

◆ new()

Announcer Dragengine.Audio.Announcer.Announcer.new ( )

Create announcer.

References new().

Referenced by new().

◆ play()

void Dragengine.Audio.Announcer.Announcer.play ( )

Start playing if announcement parts are present.

References addAnnouncePart().

Referenced by createSynthesizer().

◆ removeAllAnnounceParts()

void Dragengine.Audio.Announcer.Announcer.removeAllAnnounceParts ( )

Clear announcement parts.

References forEachPart().

Referenced by getPlaying().

◆ removeAllParts()

void Dragengine.Audio.Announcer.Announcer.removeAllParts ( )

Remove all parts.

References hasPart().

Referenced by addAnnouncePart().

◆ removePart()

void Dragengine.Audio.Announcer.Announcer.removePart ( String partID)

Remove part.

Referenced by getAnnouncePartAt().

◆ setAnnounceFromText()

void Dragengine.Audio.Announcer.Announcer.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.

Referenced by updateSynthesizer().

◆ setModifierSynthesizer()

void Dragengine.Audio.Announcer.Announcer.setModifierSynthesizer ( Synthesizer synthesizer)

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

References addPart().

Referenced by getSynthesizer().

◆ stop()

void Dragengine.Audio.Announcer.Announcer.stop ( )

Stop and reset.

References getAnnouncePartAt().

Referenced by createSynthesizer().

◆ updateSampleRate()

void Dragengine.Audio.Announcer.Announcer.updateSampleRate ( )

Update next remaining sample rate from synthesizer if present.

Referenced by createSynthesizer().

◆ updateSpeaker()

void Dragengine.Audio.Announcer.Announcer.updateSpeaker ( )

Update speaker for playing back announcer.

Call this method after modifying the parts.

Referenced by createSynthesizer().

◆ updateSynthesizer()

void Dragengine.Audio.Announcer.Announcer.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.

References setAnnounceFromText().

Referenced by createSynthesizer().


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