Lingo Dictionary > O-R > queue() |  |

queue()

Syntax

    sound(channelNum).queue(member(whichMember))
    sound(channelNum).queue([#member: member(whichmember), {#startTime: milliseconds, #endTime: milliseconds, #loopStartTime: milliseconds, #loopEndTime: milliseconds, #loopCount: numberOfLoops, #preloadTime: milliseconds, #rateShift: shiftAmount}])
    queue(sound(channelNum), member(whichMember))
    queue(soundObject, [#member: member(whichmember), {#startTime: milliseconds, #endTime: milliseconds, #loopStartTime: milliseconds, #loopEndTime: milliseconds, #loopCount: numberOfLoops, #preloadTime: milliseconds, #rateShift: shiftAmount}])

Description

Function; adds the given sound cast member to the queue of sounds to be played in sound channel `channelNum`.

Once a sound has been queued, it can be played immediately with the `play()` command. This is because Director preloads a certain amount of each sound that is queued, preventing any delay between the `play()` command and the start of playback. The default amount of sound that is preloaded is 1500 milliseconds. This parameter can be modified by passing a property list containing one or more parameters with the `queue()` command.

The following properties may be specified with the `queue()` command. These parameters can be used individually or in any combination.

Property | Description
--- | ---
#member | The sound cast member to queue. This property must be provided; all others are optional.
#startTime | The time within the sound at which playback begins, in milliseconds. The default is the beginning of the sound. See `startTime (sound)`.
#endTime | The time within the sound at which playback ends, in milliseconds. The default is the end of the sound. See `endTime`.
#loopStartTime | The time within the sound to begin a loop, in milliseconds. See `loopStartTime`.
#loopEndTime | The time within the sound to end a loop, in milliseconds. See `loopEndTime`.
#loopCount | The number of times to play a loop defined with `#loopStartTime` and `#loopEndTime`. The default is 1. See `loopCount`.
#preloadTime | The amount of the sound to buffer before playback, in milliseconds. See `preLoadTime`.
#rateShift | The amount to increase or decrease the pitch of the sound in tonal half-steps. See rateShift.

These parameters can also be passed with the `setPlayList()` command, which overwrites any existing queued playlist.

To see an example of `queue()` used in a completed movie, see the Sound Control movie in the Learning\Lingo Examples folder inside the Director application folder.

Example

This handler queues and plays two sounds. The first sound, cast member Chimes, is played in its entirety. The second sound, cast member introMusic, is played starting at its 3-second point, with a loop repeated 5 times from the 8-second point to the 8.9 second point, and stopping at the 10-second point. 4 seconds of the sound will be preloaded and it will be played back with a rateShift of 1, or at one half-step higher pitch than normal.

    on playMusic
    	sound(2).queue([#member: member("Chimes")])
    	sound(2).queue([#member: member("introMusic"), #startTime: 3000,\
    	#endTime: 10000, #loopStartTime: 8000, #loopEndTime: 8900, #loopCount: 5, \
    	preloadTime: 4000, rateShift: 1])
    	sound(2).play()
    end

See also

`startTime (sound), endTime, loopCount, loopStartTime, loopEndTime, preLoadTime, rateShift, setPlaylist(), play() (sound), getPlaylist(), pause(), stop() (sound)`