Name
CopySample -- clone a sample (V5.0)
Synopsis
[id] = CopySample(source, dest[, table])
Library
sound

Function
This function clones the samples specified by source and creates a copy of it as sample dest. The new sample is independent of the old one so you could free the source sample after it has been cloned.

If you pass Nil as dest, CopySample() will return a handle to the new sample to you. Otherwise the new sample will use the identifier specified in dest.

Starting with Hollywood 11 this function accepts a new optional table argument that accepts the following tags:

Hardware:
By default, Hollywood will always create hardware samples. These are samples that can be played instantly. If you don't want to play the sample, however, you can set this tag to False to create a software sample. Software samples are more efficient because they are completely independent of the audio hardware because they will never be played. Defaults to True. (V11.0)

Inputs
source
source sample id
dest
identifier of the sample to be created or Nil for auto id selection
table
optional: table containing further options (see above) (V11.0)
Results
id
optional: handle to the new sample; will only be returned if you specified Nil in dest
Example
CopySample(1, 10)
FreeSample(1)
The above code creates a new sample 10 which contains the same audio data as sample 1. Then it frees sample 1 because it is no longer needed.

Show TOC