Lingo Dictionary > S > setPlaylist()

 

setPlaylist()

Syntax

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

Description

Function; sets or resets the playlist of the given sound channel. This command is useful for queueing several sounds at once. Passing an empty playlist with setPlaylist() is the only way to empty the playlist.

SetPlaylist() accepts a list of property lists. Each property list queues one sound.

You can specifiy these properties for each sound to be queued:

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.


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

Example

This handler sets the play list for sound channel 2 to include the cast member called introMusic, 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. At the same time, it adds the sound cast member endMusic to the play list and sets it to loop twice in its entirety.

on playMusic
	sound(2).setPlayList([[#member: member("introMusic"), #startTime: 3000, \
	#endTime: 10000, #loopStartTime: 8000, #loopEndTime: 8900, #loopCount: 5], \
	[#member: member("endMusic"), #loopCount: 2]])
	sound(2).play()
end

See also

endTime, getPlaylist(), sprite, loopCount, loopEndTime, loopStartTime, member (sound property), play() (sound), preLoadTime, queue(), rateShift