Programmer Guide/Command Reference/LOAD: Difference between revisions

From STX Wiki
Jump to navigationJump to search
m (1 revision: Initial import)
 
(37 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
==LOAD==
==Introduction==
The <code>LOAD</code> command is used to load macro code, spu code, and sound files, making them available for use in the {{STX}} programming environment.


The <code>LOAD</code> command is used to load macro code, spu code and sound files, making them available for use in the S_TOOLS-STx programming environment.
;Note: Macros, signal processing units and sound files must be loaded before they can be used.


Macros, signal processing units and sound files must be loaded before they can be used!Information about the currently active sound file is stored in the variables <code>CSF</code> (= fullfilepath) and <code>CSFH</code> (= srate channels samples code type mode). If no sound file is active, the variable <code>CSF</code> is empty. See Shell Environment for more details.Sound files opened with write access (/Write) cannot be shared with other users or processes.The sound file management is normally performed by the application S_TOOLS-STx . All other applications should use the S_TOOLS-STx APPMSG interface to attach or select sound files.The script library <code>BSF</code> implements a set of functions for using sound files and segments in scripts.To attach the directory of the current sound file to a (temporary) table item use the command <code>NEW TABLE * /Soundfiledirectory</code>. This attachment (and the temporary item) can be removed with "<code>DELETE diritemname</code>" without deleting the sound file directory itself. The directory table is deleted automatically when the sound file is unloaded.
;See also: [[Programmer_Guide/Introduction#Application Environment|Application Environment]], commands [[../UNLOAD|UNLOAD]] and [[../LIST|LIST]], macros [[Programmer_Guide/Macro_Library/SOURCEFILE|SOURCEFILE]] and [[Programmer_Guide/Macro_Library/BSF|BSF]]
 
==LOAD SOURCECODE==
;<code>LOAD SOURCECODE <var>file1</var> [ <var>file2</var> ... ] [ /Nolog [[Programmer_Guide/Command_Reference_Options/Silent|/Silent]] /Zombie /Conditional /Define=<var>ppvar</var> ...]</code>: 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 [[Programmer_Guide/Shell_Items/Table|simple table item]] containing the source code.
 
:;<code>/Nolog</code>:
::If specieifed, not output is written to the log window.
::otherwise: error and warning messages are written to the log window.
 
:;<code>[[Programmer_Guide/Command_Reference_Options/Silent|/Silent]]</code> or <code>/?</code>:
::If specified, errors will generate warning messages rather than error messages
 
:;<code>/Zombie</code> (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 [[Programmer_Guide/Command_Reference/UNLOAD|UNLOAD /U/O]])
 
:;<code>/Conditional</code>:
::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
 
:;<code>/Define=<var>ppvar</var></code>: Define the {{STX}} prepecessor variable <var>ppvar</var>.
 
See the [[../SHELL/]] command for an example.
 
==LOAD SOURCEFILE==
;<code>LOAD SOURCEFILE <var>srcfile</var> <var>libfile</var> /Makelib [ /Nolog [[Programmer_Guide/Command_Reference_Options/Silent|/Silent]] /Define=<var>ppvar</var> ...]</code>: 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.
 
:;<code>/Makelib</code> (make library): This option is mandatory.
 
:;<code>/Nolog</code>, <code>[[Programmer_Guide/Command_Reference_Options/Silent|/Silent]]</code>, <code>/Define</code>: see the descriptions above
 
==LOAD SOUNDFILE==
 
The <code>LOAD SOUNDFILE</code> 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 <code>[[Programmer Guide/Command Reference/UNLOAD|UNLOAD]]</code> command.
 
=== The concept of the active soundfile ===
{{:Programmer_Guide/Concepts/Current_Soundfile}}
 
=== Load or activate ===
<code>LOAD SOUNDFILE <var>soundfilepath</var> [ <var>srate channels code start</var> ] [ /Readonly | /Write ] [ [[Programmer_Guide/Command_Reference_Options/Silent|/Silent]] ]</code>
 
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 <var>srate</var>, <var>channels</var>, <var>code</var> and <var>start</var> are specified, this file is treated as a non-standard-format sound file.
 
;<var>soundfilepath</var>
:The name of the file to open (including a relative or absolute path).
 
;<var>srate</var>
:The sampling rate in Hertz (&ge; <code>1</code>).
 
;<var>channels</var>
:The number of channels (&ge; <code>1</code>).
 
;<var>code</var>
:The sample code. The following sample codes are supported: <code>PCM8</code>, <code>PCM16</code>, <code>PCM24</code>, <code>PCM32</code> or <code>FLOAT</code> (32 bit).
 
;<var>start</var>
:The header size (&ge; 0); This is the offset of first signal sample from the beginning of the file.
 
;<code>/Readonly</code> or <code>/Write</code>
:Specify whether the sound file should be opened in read-only (/Readonly) or read/write mode (/Write). The default mode is read/write.
 
;[[Programmer_Guide/Command_Reference_Options/Silent|<code>/Silent</code>]]
:If specified, errors will generate warning messages rather than error messages. See [[Programmer_Guide/Command_Reference_Options/Silent|The Silent Flag]] for details.
 
=== Activate a soundfile already loaded ===
<code>LOAD SOUNDFILE <var>index</var> | <var>name</var> /Index | /Select [ [[Programmer_Guide/Command_Reference_Options/Silent|/Lent]] ]</code>
 
Activate (make it the current sound file) a loaded sound file, identified by its (zero-based) <var>index</var> or <var>name</var>. This command can be used in macros to check if a sound file is already open/loaded.
 
;<var>[[Programmer_Guide/Command_Reference_Options/Silent|/Lent]]</var> (silent)
:If specified, errors will generate warning messages rather than error messages. See [[Programmer_Guide/Command_Reference_Options/Silent|The Silent Flag]] for details.
 
=== Create and activate a new soundfile ===
<code>LOAD SOUNDFILE <var>soundfilepath srate channels code type</var> /Create [ [[Programmer_Guide/Command_Reference_Options/Silent|/Silent]] ]</code>
 
Create and load a new (empty) sound file (make it the current sound file). See <code>LOAD SOUNDFILE</code> above for a description of the parameters <var>soundfilepath</var>, <var>srate</var>, <var>channels</var> and <var>code</var>. Note that this command will fail if the sound file <var>soundfilepath</var> already exists.
 
;<var>type</var>
:The file format. The following formats are supported: <code>WAVE</code> (Windows WAVE format), <code>ST5</code> (old S_TOOLS 5 file format) or <code>BINARY</code> (raw format, without header).
 
;<var>/Create</var>
:This option is mandatory.
 
;<var>[[Programmer_Guide/Command_Reference_Options/Silent|/Silent]]</var>:
:If specified, errors will generate warning messages rather than error messages. See [[Programmer_Guide/Command_Reference_Options/Silent|The Silent Flag]] for details.
 
<code>LOAD SOUNDFILE <var>table</var> /Directory [ /Load ] [ [[Programmer_Guide/Command_Reference_Options/Silent|/Silent]] ]</code>
 
Attach a directory table <var>table</var> 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: <code>NEW TABLE * /Directory</code>). 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).
 
;<var>[[Programmer_Guide/Command_Reference_Options/Silent|/Silent]]</var>
:If specified, errors will generate warning messages rather than error messages. See The Silent Flag for details.

Latest revision as of 11:10, 29 February 2016

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.

Navigation menu

Personal tools