PlaySample(id[, table], ...)
id
. You can load samples either
using the LoadSample() command or by using the @SAMPLE preprocessor
command (the sample will be preloaded then).
Starting with Hollywood 2.0, you can also pass a table as the second argument that defines parameters for the sample playback. The table can contain the following fields:
Times:
Times
to 0.
Volume:
Pitch:
Time:
Times
tag.
Panning:
Channel:
PlaySample()
will automatically choose a vacant channel and will fail if there
is no vacant channel. To override this behaviour, you can use
this field. When specified, it will always enforce playback on the
very channel specified here. If the channel is already playing, it will
be stopped first. (V6.1)
Also new in Hollywood 2.0 is the possibility to play multiple samples
at once with one call to PlaySample()
. Simply repeat the argument list
as many times as you like and PlaySample()
will play all specified
samples together - perfectly synchronized. Please note that for each
additional sample there is also an additional optional argument, that
either specifies the number of times the sample shall be played or it
is a table that contains further attributes for the sample playback. See
above for all possibilities.
PlaySample()
will start all samples at the same time if you
specify more than onePlaySample(1)The above code starts playing sample 1. The sample will not be looped.
PlaySample(1, {Time = 10000})The code above plays sample 1 for exactly 10 seconds (= 10000 milliseconds).
PlaySample(1, {Times = 2}, 2, {Times = 4}, 3, {Time=5000})The code above plays sample 1 two times, sample 2 four times and sample 3 is played for 5 seconds. All three samples are started at once.