LOAD

From STX Wiki
Jump to navigation Jump to search

Introduction

The LOAD command is used to load macro code, spu code, and sound files, making them available for use in the STx programming environment.

Note
Macros, signal processing units and sound files must be loaded before they can be used.
See also
Application Environment, commands UNLOAD and LIST, macros SOURCEFILE and BSF

LOAD SOURCECODE

LOAD SOURCECODE file1 [ file2 ... ] [ /Nolog /Silent /Zombie /Conditional /Define=ppvar ...]
Load all source code from the specified source files (file1 etc). The command loads all sections containing source code, preprocesses them and adds them to the shell environment.
Note: An argument can also be the name of a simple table item containing the source code.
/Nolog
If specieifed, not output is written to the log window.
otherwise: error and warning messages are written to the log window.
/Silent or /?
If specified, errors will generate warning messages rather than error messages
/Zombie (no owner)
If specified, no owner is assigned to the source files
otherwise: the shell executing the command is the owner of the source files (see UNLOAD /U/O)
/Conditional
If specified, a section of a source file is only loaded if the source file is not already loaded
otherwise: the sections of a source are always loaded
/Define=ppvar
Define the STx prepecessor variable ppvar.

See the SHELL command for an example.

LOAD SOURCEFILE

LOAD SOURCEFILE srcfile libfile /Makelib [ /Nolog /Silent /Define=ppvar ...]
Add all code sections of the source file srcfile to the (new or existing) compressed STx library libfile. The sections of srcfile are not loaded! This command can be used to create a library file containing the source codes from multiple source files. STx library files can be loaded like normal source files.
/Makelib (make library)
This option is mandatory.
/Nolog, /Silent, /Define
see the descriptions above

LOAD SOUNDFILE

The LOAD SOUNDFILE command loads a sound file into the shell's sound file list and make it the current sound file. Once you have finished with a sound file, you can unload it with the UNLOAD command.

The concept of the active soundfile

Information about the currently active sound file is stored in the following two variables:

CSF - containing the full path of the file

CSFH - a string of the format "srate channels samples code type mode", indicating the respective properties of the sound file

If no sound file is active, the variable CSF is empty. See Shell Environment for more details.

Sound files opened for write access (/Write) cannot be shared with other users or processes. The sound file management is normally performed by the application STx. All other applications should use the STx APPMSG interface to attach or select sound files.

The script library BSF implements a set of functions for using sound files and segments in scripts. Namely the function BSF SELECT may be used to designate a sound file as the current sound file.

You can retrieve a list of loaded sound files with the LIST SOUNDFILE command. The sound file list is globally available. The current sound file, however, is dependent on the shell environment.

Load or activate

LOAD SOUNDFILE soundfilepath [ srate channels code start ] [ /Readonly | /Write ] [ /Silent ]

Load a sound file or activate an already loaded sound file (make it the current sound file). The access-mode options (/R|W) are only processed if the sound file is not already loaded. If the parameters srate, channels, code and start are specified, this file is treated as a non-standard-format sound file.

soundfilepath
The name of the file to open (including a relative or absolute path).
srate
The sampling rate in Hertz (≥ 1).
channels
The number of channels (≥ 1).
code
The sample code. The following sample codes are supported: PCM8, PCM16, PCM24, PCM32 or FLOAT (32 bit).
start
The header size (≥ 0); This is the offset of first signal sample from the beginning of the file.
/Readonly or /Write
Specify whether the sound file should be opened in read-only (/Readonly) or read/write mode (/Write). The default mode is read/write.
/Silent
If specified, errors will generate warning messages rather than error messages. See The Silent Flag for details.

Activate a soundfile already loaded

LOAD SOUNDFILE index | name /Index | /Select [ /Lent ]

Activate (make it the current sound file) a loaded sound file, identified by its (zero-based) index or name. This command can be used in macros to check if a sound file is already open/loaded.

/Lent (silent)
If specified, errors will generate warning messages rather than error messages. See The Silent Flag for details.

Create and activate a new soundfile

LOAD SOUNDFILE soundfilepath srate channels code type /Create [ /Silent ]

Create and load a new (empty) sound file (make it the current sound file). See LOAD SOUNDFILE above for a description of the parameters soundfilepath, srate, channels and code. Note that this command will fail if the sound file soundfilepath already exists.

type
The file format. The following formats are supported: WAVE (Windows WAVE format), ST5 (old S_TOOLS 5 file format) or BINARY (raw format, without header).
/Create
This option is mandatory.
/Silent
If specified, errors will generate warning messages rather than error messages. See The Silent Flag for details.

LOAD SOUNDFILE table /Directory [ /Load ] [ /Silent ]

Attach a directory table table to a sound file. Only one table can be attached to a sound file. The table must be created with the /Directory option (e.g. with: NEW TABLE * /Directory). The directory table of a sound file can be accessed by all shells! Use the option /Load if STx should try to load the directory stored in the sound file (only for files created by S_TOOLS 5).

/Silent
If specified, errors will generate warning messages rather than error messages. See The Silent Flag for details.