libgig  4.4.1
gig::Script Class Reference

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

#include <gig.h>

Inheritance diagram for gig::Script:
DLS::Storage

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. More...
 
void SetScriptAsText (const String &text)
 Replaces the current script with the new script source code text given by text. More...
 
void SetGroup (ScriptGroup *pGroup)
 Move this script from its current ScriptGroup to another ScriptGroup given by pGroup. More...
 
ScriptGroupGetGroup () const
 Returns the script group this script currently belongs to. More...
 
void CopyAssign (const Script *orig)
 Make a (semi) deep copy of the Script object given by orig and assign it to this object. More...
 

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. More...
 
void DeleteChunks ()
 Remove all RIFF chunks associated with this Script object. More...
 
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:

Definition at line 1179 of file gig.h.

Member Enumeration Documentation

◆ Compression_t

Enumerator
COMPRESSION_NONE 

Is not compressed at all (default).

Definition at line 1184 of file gig.h.

◆ Encoding_t

Enumerator
ENCODING_ASCII 

Standard 8 bit US ASCII character encoding (default).

Definition at line 1181 of file gig.h.

◆ 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.

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, gig::File::GetInstrument(), RIFF::List::GetSubChunk(), Language, Name, gig::Sample::pGroup, and gig::Instrument::RemoveScript().

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

◆ DeleteChunks()

void gig::Script::DeleteChunks ( )
protectedvirtual

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 compatiblity issues.

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

Implements DLS::Storage.

Definition at line 4669 of file gig.cpp.

◆ 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.

References gig::Sample::pGroup.

◆ 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.

◆ 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.

References gig::Sample::pGroup.

◆ 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)
protectedvirtual

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 gig::Sample::crc, and gig::Sample::pGroup.


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