#22004/10/14 13:44:09
多查看dir自带的帮助信息
--------------------------------------------------------------------------------
play() (Sound Channel)
Usage
-- Lingo syntax
soundChannelObjRef.play()
soundChannelObjRef.play(memberObjRef)
soundChannelObjRef.play(propList)
// javascript syntax
soundChannelObjRef.play();
soundChannelObjRef.play(memberObjRef);
soundChannelObjRef.play(propList);
Description
Sound Channel method; begins playing any sounds queued in a sound channel, or queues and begins playing a given cast member.
Sound cast members take some time to load into RAM before they can begin playback. It’s recommended that you queue sounds with queue() before you want to begin playing them and then use the first form of this method. The second two forms do not take advantage of the pre-loading accomplished with the queue() command.
By using an optional property list, you can specify exact playback settings for a sound.
To see an example of play() used in a completed movie, see the Sound Control movie in the Learning/Lingo folder inside the Director application folder.
Parameters
memberObjRef Required if playing a specific cast member. A reference to the cast member object to queue and play.
propList Required if specifying playback settings for a sound. A property list that specifies the exact playback settings for the sound. These properties may be optionally set:
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
This statement plays cast member introMusic in sound channel 1:
-- Lingo syntax
sound(1).play(member("introMusic"))
// javascript syntax
sound(1).play(member("introMusic"));
The following statement plays cast member creditsMusic in sound channel 2. Playback begins 4 seconds into the sound and ends 15 seconds into the sound. The section from 10.5 seconds to 14 seconds loops 6 times.
-- Lingo syntax
sound(2).play([#member:member("creditsMusic"), #startTime:4000, \#endTime:15000, #loopCount:6, #loopStartTime:10500, #loopEndTime:14000])
// javascript syntax
sound(2).play(propList("member",member("creditsMusic"), "startTime",4000, "endTime",15000, "loopCount",6, "loopStartTime",10500, "loopEndTime",14000));
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();
}
--------------------------------------------------------------------------------
stop() (Sound Channel)
Usage
-- Lingo syntax
soundChannelObjRef.stop()
// javascript syntax
soundChannelObjRef.stop();
Description
Sound Channel method; stops the currently playing sound in a sound channel.
Issuing a play() method begins playing the first sound of those that remain in the queue of the given sound channel.
To see an example of stop() used in a completed movie, see the Sound Control movie in the Learning/Lingo folder inside the Director application folder.
Parameters
None.
Example
This statement stops playback of the sound cast member currently playing in sound channel 1:
-- Lingo syntax
sound(1).stop()
// javascript syntax
sound(1).stop();