gig::Script Class Reference

Real-time instrument script (gig format extension). More...

`#include <gig.h>`

Inheritance diagram for gig::Script:

## Public Types

enum | Encoding_t { ENCODING_ASCII = 0 }
enum | Compression_t { COMPRESSION_NONE = 0 }
enum | Language_t { LANGUAGE_NKSP = 0 }

## Public Member Functions

String | GetScriptAsText ()
| Returns the current script (i.e.
void | SetScriptAsText (const String &text)
| Replaces the current script with the new script source code text given by text.
void | SetGroup (ScriptGroup *pGroup)
| Move this script from its current ScriptGroup to another ScriptGroup given by pGroup.
ScriptGroup * | GetGroup () const
| Returns the script group this script currently belongs to.
void | CopyAssign (const Script *orig)
| Make a (semi) deep copy of the Script object given by orig and assign it to this object.

## Public Attributes

String | Name
| Arbitrary name of the script, which may be displayed i.e. in an instrument editor.
Compression_t | Compression
| Whether the script was/should be compressed, and if so, which compression algorithm shall be used.
Encoding_t | Encoding
| Format the script's source code text is encoded with.
Language_t | Language
| Programming language and dialect the script is written in.
bool | Bypass
| Global bypass: if enabled, this script shall not be executed by the sampler for any instrument.
uint8_t | Uuid [16]
| Persistent Universally Unique Identifier of this script, which remains identical after any changes to this script.

## Protected Member Functions

| Script (ScriptGroup *group, RIFF::Chunk *ckScri)
void | UpdateChunks (progress_t *pProgress)
| Apply this script to the respective RIFF chunks.
void | DeleteChunks ()
| Remove all RIFF chunks associated with this Script object.
void | RemoveAllScriptReferences ()
void | GenerateUuid ()
| Generate a new Universally Unique Identifier (UUID) for this script.

## Detailed Description

Real-time instrument script (gig format extension).

Real-time instrument scripts are user supplied small programs which can be used by instrument designers to create custom behaviors and features not available in the stock sampler engine. Features which might be very exotic or specific for the respective instrument.

This is an extension of the GigaStudio format, thus a feature which was not available in the GigaStudio 4 software. It is currently only supported by LinuxSampler and gigedit. Scripts will not load with the original GigaStudio software.

You find more informations about Instrument Scripts on the LinuxSampler documentation site:

- About Instrument Scripts in General
- Introduction to the NKSP Script Language
- NKSP Reference Manual
- Using Instrument Scripts with Gigedit

Definition at line 1179 of file gig.h.

## Member Enumeration Documentation

## Compression_t

enum gig::Script::Compression_t

Enumerator
COMPRESSION_NONE | Is not compressed at all (default).

Definition at line 1184 of file gig.h.

## Encoding_t

enum gig::Script::Encoding_t

Enumerator
ENCODING_ASCII | Standard 8 bit US ASCII character encoding (default).

Definition at line 1181 of file gig.h.

## Language_t

enum gig::Script::Language_t

Enumerator
LANGUAGE_NKSP | NKSP stands for "Is Not KSP" (default). Refer to the NKSP Reference Manual for details about this script language.

Definition at line 1187 of file gig.h.

## Constructor & Destructor Documentation

## Script()

gig::Script::Script | ( | ScriptGroup * | group,
|  | RIFF::Chunk * | ckScri )

protected

Definition at line 4593 of file gig.cpp.

## ~Script()

gig::Script::~Script | ( |  | ) |

protected virtual

Definition at line 4636 of file gig.cpp.

## Member Function Documentation

## CopyAssign()

void gig::Script::CopyAssign | ( | const Script * | orig | ) |

Make a (semi) deep copy of the Script object given by orig and assign it to this object.

Note: the ScriptGroup this Script object belongs to remains untouched by this call.

Parameters

  orig | - original Script object to be copied from

Definition at line 4770 of file gig.cpp.

References Bypass, Compression, Encoding, Language, and Name.

Referenced by gig::File::AddContentOf().

## DeleteChunks()

void gig::Script::DeleteChunks | ( |  | ) |

protected virtual

Remove all RIFF chunks associated with this Script object.

At the moment Script::DeleteChunks() does nothing. It is recommended to call this method explicitly though from deriving classes's own overridden implementation of this method to avoid potential future compatibility issues.

See DLS::Storage::DeleteChunks() for details.

Implements DLS::Storage.

Definition at line 4669 of file gig.cpp.

## GenerateUuid()

void gig::Script::GenerateUuid | ( |  | ) |

protected

Generate a new Universally Unique Identifier (UUID) for this script.

Definition at line 4719 of file gig.cpp.

References DLS::Resource::GenerateDLSID(), and Uuid.

## GetGroup()

ScriptGroup * gig::Script::GetGroup | ( |  | ) | const

Returns the script group this script currently belongs to.

Each script is a member of exactly one ScriptGroup.

Returns
  current script group

Definition at line 4759 of file gig.cpp.

## GetScriptAsText()

String gig::Script::GetScriptAsText | ( |  | ) |

Returns the current script (i.e.

as source code) in text format.

Definition at line 4642 of file gig.cpp.

## RemoveAllScriptReferences()

void gig::Script::RemoveAllScriptReferences | ( |  | ) |

protected

Definition at line 4779 of file gig.cpp.

## SetGroup()

void gig::Script::SetGroup | ( | ScriptGroup * | pGroup | ) |

Move this script from its current ScriptGroup to another ScriptGroup given by pGroup.

Parameters

  pGroup | - script's new group

Definition at line 4746 of file gig.cpp.

## SetScriptAsText()

void gig::Script::SetScriptAsText | ( | const String & | text | ) |

Replaces the current script with the new script source code text given by text.

Parameters

  text | - new script source code

Definition at line 4655 of file gig.cpp.

## UpdateChunks()

void gig::Script::UpdateChunks | ( | progress_t * | pProgress | ) |

protected virtual

Apply this script to the respective RIFF chunks.

You have to call File::Save() to make changes persistent.

Usually there is absolutely no need to call this method explicitly. It will be called automatically when File::Save() was called.

Parameters

  pProgress | - callback function for progress notification

Implements DLS::Storage.

Definition at line 4681 of file gig.cpp.

References Bypass, Compression, Encoding, Language, Name, and Uuid.

## Member Data Documentation

## Bypass

bool gig::Script::Bypass

Global bypass: if enabled, this script shall not be executed by the sampler for any instrument.

Definition at line 1195 of file gig.h.

Referenced by CopyAssign(), and UpdateChunks().

## Compression

Compression_t gig::Script::Compression

Whether the script was/should be compressed, and if so, which compression algorithm shall be used.

Definition at line 1192 of file gig.h.

Referenced by CopyAssign(), and UpdateChunks().

## Encoding

Encoding_t gig::Script::Encoding

Format the script's source code text is encoded with.

Definition at line 1193 of file gig.h.

Referenced by CopyAssign(), and UpdateChunks().

## Language

Language_t gig::Script::Language

Programming language and dialect the script is written in.

Definition at line 1194 of file gig.h.

Referenced by CopyAssign(), and UpdateChunks().

## Name

String gig::Script::Name

Arbitrary name of the script, which may be displayed i.e. in an instrument editor.

Definition at line 1191 of file gig.h.

Referenced by CopyAssign(), and UpdateChunks().

## Uuid

uint8_t gig::Script::Uuid[16]

Persistent Universally Unique Identifier of this script, which remains identical after any changes to this script.

Definition at line 1196 of file gig.h.

Referenced by GenerateUuid(), gig::Instrument::GetScriptPatchVariables(), gig::Instrument::IsScriptPatchVariableSet(), gig::Instrument::SetScriptPatchVariable(), gig::Instrument::UnsetScriptPatchVariable(), and UpdateChunks().

The documentation for this class was generated from the following files:

- gig.h
- gig.cpp