User Manual

4.9 Scripting 69
buf = activeWave.readSamples(0, 20, 100); // read 100 samples on left channel, fr
om sample index 20
for (i = 0; i < 100; i++)
{
logWindow.printInfo(buf[i]);
}
Audio Montage Scripting Commands
Functions
Preliminary info: the Scripting API is an open project and will evolve according to user re-
quests.
size() - Returns the number of samples in the Audio Montage.
sampleRate() - Returns the sample rate of the Audio Montage.
numChannels() - Returns the number of output channels of the Audio Montage.
numTracks() - Returns the number of tracks of the Audio Montage.
cursorPosition() - Returns the current cursor position (in samples).
setCursorPosition(pos) - Sets the current cursor position at a certain sample location.
selectionStart() - Returns the index of the first selected sample, or -1 if there is no selection.
selectionSize() - Returns the number of selected samples.
select(presetName) - Loads the audio range preset and applies its setting to the active
Audio Montage.
select(start, size) - Selects a number of samples, starting from a given position.
setFocusedTrack(index) - Sets the focused track.
addMarker(type, name, comment) - Add a marker at the cursor position. Possible values
for type are:
generic
temporary
cdTrackStart
cdTrackEnd
cdTrackFrontier
cdTrackIndex
loopStart
loopEnd
muteStart
muteEnd
playbackStarter
regionStart
WaveLab 7