LCC Fusion Project 1.0
LCC Automation
Loading...
Searching...
No Matches
Sound Sequences
Collaboration diagram for Sound Sequences:

To provide more realism and automation to a layout, sequences of sounds (bells, airhorns, whistles) can be sent via DCC to cab(s).

Typically a sequence of sounds is used when a cab approaches specific areas, such as a grade crossing or signal. A sound sequence is made up of one or more sound commands with optional delay and duration information.

Users of the 'sound' text command must provide the FN numbers for both the bell and the airhorn/whistle.

How to change the sound duration of existing sequences
  • enum SoundDuration provides the declarations for the duration of the sound (bells and airhorn/whistle)
  • Note that for better granularity, the duration is in units of half-secs (500ms). For example, half-second works well for a short sound.
  • Additional declarations can be added or existing declarations can be modified to make the duration longer or shorter
How to add a new sequence
Additional sequences can be added as follows:
  1. update enum SoundEffect with a new declaration representing the new sequence
  2. udpate the switch statement below with a new case statement for the added SoundEffect declaration
  3. add one or more RegisterList::setSound() function call(s) with the following params:
    • cab, fnBells, and fnAirhorn are passed thru to RegisterList::setSound() without changing
    • SoundFnToggle indicates whether the sound should be turned on or off
    • SoundDelay controls the placement of the sound in the 'sound timeline' as follows:
      • for the first sound, use SoundDelay::NONE or a value (half-secs) for the delay of the sound
      • for sequencing more than one sound, use SoundDelay::CALCULATED to cause the playing of the sound to place after a previous sound (a 'short' delay is automatically added)
    • SoundDuration specifies how long the sound is to be played. Use a value >0 when turning a sound on (ignored when turning sound off)
Note
Here is an example of a sequence
case SoundEffect::APPROACHING_CROSSING: // 5-effect, (2-Long,1-Short,1-Held till stopped. /w bells)
Serial.print("\n 2-long, 1-short, 1-long");
setSound(cab, fnBells, SoundFnToggle::ON, SoundDelay::NONE, SoundDuration::CONTINOUS, track); // toggle on the bells to play continously
setSound(cab, fnAirhorn, SoundFnToggle::ON, SoundDelay::CALCULATED, SoundDuration::LONG, track); // play a 'long' airhorn (includes short delay)
setSound(cab, fnAirhorn, SoundFnToggle::ON, SoundDelay::CALCULATED, SoundDuration::LONG, track); // play a 'long' airhorn (includes short delay)
setSound(cab, fnAirhorn, SoundFnToggle::ON, SoundDelay::CALCULATED, SoundDuration::SHORT, track); // play a 'short' airhorn (includes short delay)
setSound(cab, fnAirhorn, SoundFnToggle::ON, SoundDelay::CALCULATED, SoundDuration::CONTINOUS, track); // play a 'continous' sound (includes short delay)
break;
@ NONE
indicates no delay before playing sound
@ APPROACHING_CROSSING
sound 2-Long, 1-Short, 1-Held airhorn/whistle till stopped with bells playing continously
@ SHORT
indicates a short (half sec) delay
@ CONTINOUS
indicates sound is to play continously
@ LONG
indicates a long (1.5 sec) delay