Director Help

queue()

Usage

-- Lingo syntax
soundChannelObjRef.queue(memberObjRef)
soundChannelObjRef.queue(propList)

// JavaScript syntax
soundChannelObjRef.queue(memberObjRef);
soundChannelObjRef.queue(propList);

Description

Sound Channel method; adds a sound cast member to the queue of a sound channel.

Once a sound has been queued, it can be played immediately with the play() method. This is because Director preloads a certain amount of each sound that is queued, preventing any delay between the play() method 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() method. These parameters can also be passed with the setPlayList() method.

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

Parameters

memberObjRef Required if specifying a sound cast member. A reference to the sound cast member to queue.

propList Required if passing a property list as parameters. A property list that applies to the sound cast member to queue. These properties include:

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.

#endTime

The time within the sound at which playback ends, in milliseconds. The default is the end of the sound. See endTime.

#loopCount

The number of times to play a loop defined with #loopStartTime and #loopEndTime. The default is 1. See loopCount.

#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.

#preloadTime

The amount of the sound to buffer before playback, in milliseconds. See preloadTime.

Example

The following 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.

-- Lingo syntax
on playMusic
    sound(2).queue(member("Chimes"))
    sound(2).queue([#member:member("introMusic"), #startTime:3000, #endTime:10000, #loopCount:5, #loopStartTime:8000, #loopEndTime:8900])
    sound(2).play()
end playMusic

// JavaScript syntax
function playMusic() {
    sound(2).queue(member("Chimes"))
    sound(2).queue(propList("member",member("introMusic"), "startTime",3000, "endTime",10000, "loopCount",5, "loopStartTime",8000, "loopEndTime",8900));
    sound(2).play();
}

See also

endTime, loopCount, loopEndTime, loopStartTime, pause() (Sound Channel), play() (Sound Channel), preLoadTime, setPlayList(), Sound Channel, startTime, stop() (Sound Channel)