Using Director > Sound, Video, and Synchronization > Playing sounds with Lingo > Playing sound cast members |  |

Playing sound cast members

Once a sound has been imported as a cast member, you can control many aspects of how the sound is played.

To play sound cast members regardless of the settings in the Score:

Use the `queue()` and `play()` functions. The `queue()` function loads the sound into Director's RAM buffer so that it can be played immediately when called for. The `play()` command starts the sound playing. If you omit the `queue()` function, the sound may not play immediately when called for. See `queue()` and `play() (sound)`.

The following statements load the sound called Siren into RAM and start it playing in sound channel 1:

    sound(1).queue(member("Siren"))
    sound(1).play()

To queue more than one sound to play in succession:

Use the `queue()` function to list each sound in the order you want them to play. If you queue them before they are played, Director plays the sounds with no pauses between the sounds. Once the sounds are queued, only one `play()` command is needed.

These statements queue the sound members Explosion and Siren and play them in succession in sound channel 2:

    sound(2).queue(member("Explosion"))
    sound(2).queue(member("Siren"))
    sound(2).play()

To control how a queued sound plays:

Include optional parameters in a property list within the `queue()` function. See `queue()`.

When `setPlayList()` is used, any previously set queue of sounds will be replaced by the new playlist.

Once sounds are queued, you can still control whether the queue is obeyed. You can choose to interrupt loops with the `breakLoop()` command, or to pause playback with the `pause()` function. The `playNext()` command lets you skip immediately to the next sound in the queue. See the Lingo Dictionary for details on these and other sound commands.