libgig 4.3.0
gig::Instrument Class Reference

Provides access to a Gigasampler/GigaStudio instrument. More...

#include <gig.h>

Inheritance diagram for gig::Instrument:
DLS::Instrument DLS::Resource DLS::Articulator DLS::Storage DLS::Storage

Public Member Functions

RegionGetFirstRegion ()
 Returns the first Region of the instrument.
 
RegionGetNextRegion ()
 Returns the next Region of the instrument.
 
RegionAddRegion ()
 
void DeleteRegion (Region *pRegion)
 
void MoveTo (Instrument *dst)
 Move this instrument at the position before.
 
virtual void UpdateChunks (progress_t *pProgress)
 Apply Instrument with all its Regions to the respective RIFF chunks.
 
virtual void CopyAssign (const Instrument *orig)
 Make a (semi) deep copy of the Instrument object given by orig and assign it to this object.
 
RegionGetRegion (unsigned int Key)
 Returns the appropriate Region for a triggered note.
 
MidiRuleGetMidiRule (int i)
 Returns a MIDI rule of the instrument.
 
MidiRuleCtrlTriggerAddMidiRuleCtrlTrigger ()
 Adds the "controller trigger" MIDI rule to the instrument.
 
MidiRuleLegatoAddMidiRuleLegato ()
 Adds the legato MIDI rule to the instrument.
 
MidiRuleAlternatorAddMidiRuleAlternator ()
 Adds the alternator MIDI rule to the instrument.
 
void DeleteMidiRule (int i)
 Deletes a MIDI rule from the instrument.
 
ScriptGetScriptOfSlot (uint index)
 Get instrument script (gig format extension).
 
void AddScriptSlot (Script *pScript, bool bypass=false)
 Add new instrument script slot (gig format extension).
 
void SwapScriptSlots (uint index1, uint index2)
 Flip two script slots with each other (gig format extension).
 
void RemoveScriptSlot (uint index)
 Remove script slot.
 
void RemoveScript (Script *pScript)
 Remove reference to given Script (gig format extension).
 
uint ScriptSlotCount () const
 Instrument's amount of script slots.
 
bool IsScriptSlotBypassed (uint index)
 Whether script execution shall be skipped.
 
void SetScriptSlotBypassed (uint index, bool bBypass)
 Defines whether execution shall be skipped.
 
bool IsScriptPatchVariableSet (int slot, String variable)
 Checks whether a certain script 'patch' variable value is set.
 
std::map< String, String > GetScriptPatchVariables (int slot)
 Get all overridden script 'patch' variables.
 
String GetScriptPatchVariable (int slot, String variable)
 Get overridden initial value for 'patch' variable.
 
void SetScriptPatchVariable (int slot, String variable, String value)
 Override initial value for 'patch' variable.
 
void UnsetScriptPatchVariable (int slot=-1, String variable="")
 Drop overridden initial value(s) for 'patch' variable(s).
 

Public Attributes

int32_t Attenuation
 in dB
 
uint16_t EffectSend
 
int16_t FineTune
 in cents
 
uint16_t PitchbendRange
 Number of semitones pitchbend controller can pitch (default is 2).
 
bool PianoReleaseMode
 
range_t DimensionKeyRange
 0-127 (where 0 means C1 and 127 means G9)
 

Protected Types

typedef std::list< Region * > RegionList
 
typedef std::list< Articulation * > ArticulationList
 

Protected Member Functions

 Instrument (File *pFile, RIFF::List *insList, progress_t *pProgress=NULL)
 
 ~Instrument ()
 Destructor.
 
void CopyAssign (const Instrument *orig, const std::map< Sample *, Sample * > *mSamples)
 Make a (semi) deep copy of the Instrument object given by orig and assign it to this object.
 
void UpdateRegionKeyTable ()
 
void LoadScripts ()
 
void UpdateScriptFileOffsets ()
 
void DeleteRegion (Region *pRegion)
 
virtual void UpdateChunks (progress_t *pProgress)
 Apply Instrument with all its Regions to the respective RIFF chunks.
 
virtual void DeleteChunks ()
 Remove all RIFF chunks associated with this Instrument object.
 
virtual void CopyAssign (const Instrument *orig)
 Make a (semi) deep copy of the Instrument object given by orig and assign it to this object.
 
virtual void CopyAssign (const Resource *orig)
 Make a deep copy of the Resource object given by orig and assign it to this object.
 
virtual void CopyAssign (const Articulator *orig)
 Not yet implemented in this version, since the .gig format does not need to copy DLS articulators and so far nobody used pure DLS instrument AFAIK.
 
void CopyAssignCore (const Instrument *orig)
 
virtual void LoadRegions ()
 
ResourceGetParent ()
 
const ResourceGetParent () const
 
void GenerateDLSID ()
 Generates a new DLSID for the resource.
 
Articulation * GetFirstArticulation ()
 
Articulation * GetNextArticulation ()
 
void LoadArticulations ()
 

Static Protected Member Functions

static void GenerateDLSID (dlsid_t *pDLSID)
 

Protected Attributes

RegionRegionKeyTable [128]
 fast lookup for the corresponding Region of a MIDI key
 
bool IsDrum
 Indicates if the Instrument is a drum type, as they differ in the synthesis model of DLS from melodic instruments.
 
uint16_t MIDIBank
 Reflects combination of MIDIBankCoarse and MIDIBankFine (bank 1 - bank 16384). Do not change this value, it will not be saved! Change MIDIBankCoarse and MIDIBankFine instead (we might change that in future).
 
uint8_t MIDIBankCoarse
 Reflects the MIDI Bank number for MIDI Control Change 0 (bank 1 - 128).
 
uint8_t MIDIBankFine
 Reflects the MIDI Bank number for MIDI Control Change 32 (bank 1 - 128).
 
uint32_t MIDIProgram
 Specifies the MIDI Program Change Number this Instrument should be assigned to.
 
uint32_t Regions
 Reflects the number of Region defintions this Instrument has.
 
RIFF::ListpCkInstrument
 
RegionList * pRegions
 
RegionList::iterator RegionsIterator
 
Info * pInfo
 Points (in any case) to an Info object, providing additional, optional infos and comments.
 
dlsid_t * pDLSID
 Points to a dlsid_t structure if the file provided a DLS ID else is NULL.
 
ResourcepParent
 
RIFF::ListpResourceList
 
RIFF::ListpParentList
 
ArticulationList * pArticulations
 
ArticulationList::iterator ArticulationsIterator
 

Detailed Description

Provides access to a Gigasampler/GigaStudio instrument.

This class provides access to Gigasampler/GigaStudio instruments contained in .gig files. A gig instrument is merely a set of keyboard ranges (called Region), plus some additional global informations about the instrument. The major part of the actual instrument definition used for the synthesis of the instrument is contained in the respective Region object (or actually in the respective DimensionRegion object being, see description of Region for details).

Since the gig format was designed as extension to the DLS file format, this class is derived from the DLS::Instrument class. So also refer to DLS::Instrument for additional informations, class attributes and methods.

Definition at line 1266 of file gig.h.

Member Typedef Documentation

◆ ArticulationList

std::list<Articulation*> DLS::Articulator::ArticulationList
protectedinherited

Definition at line 352 of file DLS.h.

◆ RegionList

std::list<Region*> DLS::Instrument::RegionList
protectedinherited

Definition at line 540 of file DLS.h.

Constructor & Destructor Documentation

◆ Instrument()

gig::Instrument::Instrument ( File * pFile,
RIFF::List * insList,
progress_t * pProgress = NULL )
protected

Definition at line 4911 of file gig.cpp.

◆ ~Instrument()

gig::Instrument::~Instrument ( )
protectedvirtual

Destructor.

Frees all memory occupied by this instrument.

Reimplemented from DLS::Instrument.

Definition at line 5075 of file gig.cpp.

Member Function Documentation

◆ AddMidiRuleAlternator()

MidiRuleAlternator * gig::Instrument::AddMidiRuleAlternator ( )

Adds the alternator MIDI rule to the instrument.

Returns
the new MIDI rule

Definition at line 5440 of file gig.cpp.

◆ AddMidiRuleCtrlTrigger()

MidiRuleCtrlTrigger * gig::Instrument::AddMidiRuleCtrlTrigger ( )

Adds the "controller trigger" MIDI rule to the instrument.

Returns
the new MIDI rule

Definition at line 5414 of file gig.cpp.

◆ AddMidiRuleLegato()

MidiRuleLegato * gig::Instrument::AddMidiRuleLegato ( )

Adds the legato MIDI rule to the instrument.

Returns
the new MIDI rule

Definition at line 5427 of file gig.cpp.

◆ AddRegion()

Region * gig::Instrument::AddRegion ( )

Definition at line 5317 of file gig.cpp.

◆ AddScriptSlot()

void gig::Instrument::AddScriptSlot ( Script * pScript,
bool bypass = false )

Add new instrument script slot (gig format extension).

Add the given real-time instrument script reference to this instrument, which shall be executed by the sampler for for this instrument. The script will be added to the end of the script list of this instrument. The positions of the scripts in the Instrument's Script list are relevant, because they define in which order they shall be executed by the sampler. For this reason it is also legal to add the same script twice to an instrument, for example you might have a script called "MyFilter" which performs an event filter task, and you might have another script called "MyNoteTrigger" which triggers new notes, then you might for example have the following list of scripts on the instrument:

  1. Script "MyFilter"
  2. Script "MyNoteTrigger"
  3. Script "MyFilter"

Which would make sense, because the 2nd script launched new events, which you might need to filter as well.

There are two ways to disable / "bypass" scripts. You can either disable a script locally for the respective script slot on an instrument (i.e. by passing false to the 2nd argument of this method, or by calling SetScriptBypassed()). Or you can disable a script globally for all slots and all instruments by setting Script::Bypass.

Note
This is an own format extension which did not exist i.e. in the GigaStudio 4 software. It will currently only work with LinuxSampler and gigedit.
Parameters
pScript- script that shall be executed for this instrument
bypass- if enabled, the sampler shall skip executing this script (in the respective list position)
See also
SetScriptBypassed()

Definition at line 5544 of file gig.cpp.

◆ CopyAssign() [1/5]

void DLS::Articulator::CopyAssign ( const Articulator * orig)
virtualinherited

Not yet implemented in this version, since the .gig format does not need to copy DLS articulators and so far nobody used pure DLS instrument AFAIK.

Definition at line 270 of file DLS.cpp.

Referenced by DLS::Region::CopyAssign().

◆ CopyAssign() [2/5]

void DLS::Instrument::CopyAssign ( const Instrument * orig)
virtualinherited

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

Note that all sample pointers referenced by orig are simply copied as memory address. Thus the respective samples are shared, not duplicated!

Parameters
orig- original Instrument object to be copied from

Definition at line 1524 of file DLS.cpp.

References DLS::Region::CopyAssign(), and DLS::Instrument::Regions.

◆ CopyAssign() [3/5]

void DLS::Resource::CopyAssign ( const Resource * orig)
virtualinherited

Make a deep copy of the Resource object given by orig and assign it to this object.

Parameters
orig- original Resource object to be copied from

Definition at line 601 of file DLS.cpp.

References DLS::Info::CopyAssign(), and DLS::Resource::pInfo.

Referenced by DLS::Region::CopyAssign(), and DLS::Sample::CopyAssignCore().

◆ CopyAssign() [4/5]

void gig::Instrument::CopyAssign ( const Instrument * orig)
virtual

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

Note that all sample pointers referenced by orig are simply copied as memory address. Thus the respective samples are shared, not duplicated!

Parameters
orig- original Instrument object to be copied from

Definition at line 5936 of file gig.cpp.

Referenced by gig::File::AddContentOf(), and gig::File::AddDuplicateInstrument().

◆ CopyAssign() [5/5]

void gig::Instrument::CopyAssign ( const Instrument * orig,
const std::map< Sample *, Sample * > * mSamples )
protected

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

Parameters
orig- original Instrument object to be copied from
mSamples- crosslink map between the foreign file's samples and this file's samples

Definition at line 5948 of file gig.cpp.

References Attenuation, gig::Region::CopyAssign(), DimensionKeyRange, FineTune, PitchbendRange, and DLS::Instrument::Regions.

◆ CopyAssignCore()

void DLS::Instrument::CopyAssignCore ( const Instrument * orig)
protectedinherited

Definition at line 1502 of file DLS.cpp.

◆ DeleteChunks()

void DLS::Instrument::DeleteChunks ( )
virtualinherited

Remove all RIFF chunks associated with this Instrument object.

See Storage::DeleteChunks() for details.

Reimplemented from DLS::Resource.

Definition at line 1481 of file DLS.cpp.

References DLS::Articulator::DeleteChunks(), DLS::Resource::DeleteChunks(), RIFF::List::DeleteSubChunk(), and RIFF::Chunk::GetParent().

Referenced by DLS::File::DeleteInstrument(), and gig::File::DeleteInstrument().

◆ DeleteMidiRule()

void gig::Instrument::DeleteMidiRule ( int i)

Deletes a MIDI rule from the instrument.

Parameters
i- MIDI rule number

Definition at line 5453 of file gig.cpp.

◆ DeleteRegion() [1/2]

void DLS::Instrument::DeleteRegion ( Region * pRegion)
inherited

Definition at line 1408 of file DLS.cpp.

◆ DeleteRegion() [2/2]

void gig::Instrument::DeleteRegion ( Region * pRegion)

Definition at line 5331 of file gig.cpp.

◆ GenerateDLSID() [1/2]

void DLS::Resource::GenerateDLSID ( )
inherited

Generates a new DLSID for the resource.

Definition at line 551 of file DLS.cpp.

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

Referenced by gig::File::AddInstrument(), DLS::Resource::GenerateDLSID(), gig::Script::GenerateUuid(), and DLS::File::UpdateChunks().

◆ GenerateDLSID() [2/2]

void Resource::GenerateDLSID ( dlsid_t * pDLSID)
staticinherited

Definition at line 558 of file DLS.cpp.

◆ GetFirstArticulation()

Articulation * DLS::Articulator::GetFirstArticulation ( )
inherited

Definition at line 192 of file DLS.cpp.

◆ GetFirstRegion()

Region * gig::Instrument::GetFirstRegion ( )

Returns the first Region of the instrument.

You have to call this method once before you use GetNextRegion().

Returns
pointer address to first region or NULL if there is none
See also
GetNextRegion()

Definition at line 5297 of file gig.cpp.

◆ GetMidiRule()

MidiRule * gig::Instrument::GetMidiRule ( int i)

Returns a MIDI rule of the instrument.

The list of MIDI rules, at least in gig v3, always contains at most two rules. The second rule can only be the DEF filter (which currently isn't supported by libgig).

Parameters
i- MIDI rule number
Returns
pointer address to MIDI rule number i or NULL if there is none

Definition at line 5405 of file gig.cpp.

◆ GetNextArticulation()

Articulation * DLS::Articulator::GetNextArticulation ( )
inherited

Definition at line 199 of file DLS.cpp.

◆ GetNextRegion()

Region * gig::Instrument::GetNextRegion ( )

Returns the next Region of the instrument.

You have to call GetFirstRegion() once before you can use this method. By calling this method multiple times it iterates through the available Regions.

Returns
pointer address to the next region or NULL if end reached
See also
GetFirstRegion()

Definition at line 5311 of file gig.cpp.

◆ GetParent() [1/2]

Resource * DLS::Resource::GetParent ( )
inlineinherited

Definition at line 408 of file DLS.h.

◆ GetParent() [2/2]

const Resource * DLS::Resource::GetParent ( ) const
inlineinherited

Definition at line 409 of file DLS.h.

◆ GetRegion()

Region * gig::Instrument::GetRegion ( unsigned int Key)

Returns the appropriate Region for a triggered note.

Parameters
KeyMIDI Key number of triggered note / key (0 - 127)
Returns
pointer adress to the appropriate Region or NULL if there there is no Region defined for the given Key

Definition at line 5279 of file gig.cpp.

◆ GetScriptOfSlot()

Script * gig::Instrument::GetScriptOfSlot ( uint index)

Get instrument script (gig format extension).

Returns the real-time instrument script of instrument script slot index.

Note
This is an own format extension which did not exist i.e. in the GigaStudio 4 software. It will currently only work with LinuxSampler and gigedit.
Parameters
index- instrument script slot index
Returns
script or NULL if index is out of bounds

Definition at line 5503 of file gig.cpp.

◆ GetScriptPatchVariable()

String gig::Instrument::GetScriptPatchVariable ( int slot,
String variable )

Get overridden initial value for 'patch' variable.

Returns current initial value for the requested script variable being overridden by this instrument.

Remarks
Real-time instrument scripts allow to declare special 'patch' variables, which essentially behave like regular variables of their data type, however their initial value may optionally be overridden on a per instrument basis. That allows to share scripts between instruments while still being able to fine tune certain aspects of the script for each instrument individually.
Note
This is an own format extension which did not exist i.e. in the GigaStudio 4 software. It will currently only work with LinuxSampler and Gigedit.
Parameters
slot- script slot index of the variable to be retrieved
variable- name of the 'patch' variable in that script

Definition at line 5772 of file gig.cpp.

◆ GetScriptPatchVariables()

std::map< String, String > gig::Instrument::GetScriptPatchVariables ( int slot)

Get all overridden script 'patch' variables.

Returns map of key-value pairs reflecting all patch variables currently being overridden by this instrument for the given script slot, where key is the variable name and value is the hereby currently overridden value for that variable.

Remarks
Real-time instrument scripts allow to declare special 'patch' variables, which essentially behave like regular variables of their data type, however their initial value may optionally be overridden on a per instrument basis. That allows to share scripts between instruments while still being able to fine tune certain aspects of the script for each instrument individually.
Note
This is an own format extension which did not exist i.e. in the GigaStudio 4 software. It will currently only work with LinuxSampler and Gigedit.
Parameters
slot- script slot index of the variable to be retrieved

Definition at line 5740 of file gig.cpp.

References gig::_UUIDFromCArray(), and gig::Script::Uuid.

◆ IsScriptPatchVariableSet()

bool gig::Instrument::IsScriptPatchVariableSet ( int slot,
String variable )

Checks whether a certain script 'patch' variable value is set.

Returns true if the initial value for the requested script variable is currently overridden by this instrument.

Remarks
Real-time instrument scripts allow to declare special 'patch' variables, which essentially behave like regular variables of their data type, however their initial value may optionally be overridden on a per instrument basis. That allows to share scripts between instruments while still being able to fine tune certain aspects of the script for each instrument individually.
Note
This is an own format extension which did not exist i.e. in the GigaStudio 4 software. It will currently only work with LinuxSampler and Gigedit.
Parameters
slot- script slot index of the variable to be retrieved
variable- name of the 'patch' variable in that script

Definition at line 5706 of file gig.cpp.

References gig::_UUIDFromCArray(), and gig::Script::Uuid.

◆ IsScriptSlotBypassed()

bool gig::Instrument::IsScriptSlotBypassed ( uint index)

Whether script execution shall be skipped.

Defines locally for the Script reference slot in the Instrument's Script list, whether the script shall be skipped by the sampler regarding execution.

It is also possible to ignore exeuction of the script globally, for all slots and for all instruments by setting Script::Bypass.

Note
This is an own format extension which did not exist i.e. in the GigaStudio 4 software. It will currently only work with LinuxSampler and gigedit.
Parameters
index- index of the script slot on this instrument
See also
Script::Bypass

Definition at line 5640 of file gig.cpp.

◆ LoadArticulations()

void DLS::Articulator::LoadArticulations ( )
protectedinherited

Definition at line 205 of file DLS.cpp.

◆ LoadRegions()

void DLS::Instrument::LoadRegions ( )
protectedvirtualinherited

Definition at line 1373 of file DLS.cpp.

◆ LoadScripts()

void gig::Instrument::LoadScripts ( )
protected

Definition at line 5458 of file gig.cpp.

◆ MoveTo()

void gig::Instrument::MoveTo ( Instrument * dst)

Move this instrument at the position before.

  • dst.

This method can be used to reorder the sequence of instruments in a .gig file. This might be helpful especially on large .gig files which contain a large number of instruments within the same .gig file. So grouping such instruments to similar ones, can help to keep track of them when working with such complex .gig files.

When calling this method, this instrument will be removed from in its current position in the instruments list and moved to the requested target position provided by

Parameters
dst.You may also pass NULL as argument to this method, in that case this intrument will be moved to the very end of the .gig file's instrument list.

You have to call Save() to make the order change persistent to the .gig file.

Currently this method is limited to moving the instrument within the same .gig file. Trying to move it to another .gig file by calling this method will throw an exception.

Parameters
dst- destination instrument at which this instrument will be moved to, or pass NULL for moving to end of list
Exceptions
gig::Exceptionif this instrument and target instrument are not part of the same file

Definition at line 5365 of file gig.cpp.

References RIFF::List::GetSubList(), and RIFF::List::MoveSubChunk().

◆ RemoveScript()

void gig::Instrument::RemoveScript ( Script * pScript)

Remove reference to given Script (gig format extension).

This will remove all script slots on the instrument which are referencing the given script.

Note
This is an own format extension which did not exist i.e. in the GigaStudio 4 software. It will currently only work with LinuxSampler and gigedit.
Parameters
pScript- script reference to remove from this instrument
See also
RemoveScriptSlot()

Definition at line 5597 of file gig.cpp.

◆ RemoveScriptSlot()

void gig::Instrument::RemoveScriptSlot ( uint index)

Remove script slot.

Removes the script slot with the given slot index.

Parameters
index- index of script slot to remove

Definition at line 5579 of file gig.cpp.

◆ ScriptSlotCount()

uint gig::Instrument::ScriptSlotCount ( ) const

Instrument's amount of script slots.

This method returns the amount of script slots this instrument currently uses.

A script slot is a reference of a real-time instrument script to be executed by the sampler. The scripts will be executed by the sampler in sequence of the slots. One (same) script may be referenced multiple times in different slots.

Note
This is an own format extension which did not exist i.e. in the GigaStudio 4 software. It will currently only work with LinuxSampler and gigedit.

Definition at line 5620 of file gig.cpp.

◆ SetScriptPatchVariable()

void gig::Instrument::SetScriptPatchVariable ( int slot,
String variable,
String value )

Override initial value for 'patch' variable.

Overrides initial value for the requested script variable for this instrument with the passed value.

Remarks
Real-time instrument scripts allow to declare special 'patch' variables, which essentially behave like regular variables of their data type, however their initial value may optionally be overridden on a per instrument basis. That allows to share scripts between instruments while still being able to fine tune certain aspects of the script for each instrument individually.
Note
This is an own format extension which did not exist i.e. in the GigaStudio 4 software. It will currently only work with LinuxSampler and Gigedit.
Parameters
slot- script slot index of the variable to be set
variable- name of the 'patch' variable in that script
value- overridden initial value for that script variable
Exceptions
gig::Exceptionif given script slot index is invalid or given variable name is empty

Definition at line 5799 of file gig.cpp.

References gig::_UUIDFromCArray(), and gig::Script::Uuid.

◆ SetScriptSlotBypassed()

void gig::Instrument::SetScriptSlotBypassed ( uint index,
bool bBypass )

Defines whether execution shall be skipped.

You can call this method to define locally whether or whether not the given script slot shall be executed by the sampler.

Note
This is an own format extension which did not exist i.e. in the GigaStudio 4 software. It will currently only work with LinuxSampler and gigedit.
Parameters
index- script slot index on this instrument
bBypass- if true, the script slot will be skipped by the sampler
See also
Script::Bypass

Definition at line 5660 of file gig.cpp.

◆ SwapScriptSlots()

void gig::Instrument::SwapScriptSlots ( uint index1,
uint index2 )

Flip two script slots with each other (gig format extension).

Swaps the position of the two given scripts in the Instrument's Script list. The positions of the scripts in the Instrument's Script list are relevant, because they define in which order they shall be executed by the sampler.

Note
This is an own format extension which did not exist i.e. in the GigaStudio 4 software. It will currently only work with LinuxSampler and gigedit.
Parameters
index1- index of the first script slot to swap
index2- index of the second script slot to swap

Definition at line 5564 of file gig.cpp.

◆ UnsetScriptPatchVariable()

void gig::Instrument::UnsetScriptPatchVariable ( int slot = -1,
String variable = "" )

Drop overridden initial value(s) for 'patch' variable(s).

Reverts initial value(s) for requested script variable(s) back to their default initial value(s) defined in the script itself.

Both arguments of this method are optional. The most obvious use case of this method would be passing a valid script slot index and a (non-emtpy string as) variable name to this method, which would cause that single variable to be unset for that specific script slot (on this Instrument level).

Not passing a value (or -1 for slot and/or empty string for variable) means 'wildcard'. So accordingly absence of argument(s) will cause all variables and/or for all script slots being unset. Hence this method serves 2^2 = 4 possible use cases in total and accordingly covers 4 different behaviours in one method.

Remarks
Real-time instrument scripts allow to declare special 'patch' variables, which essentially behave like regular variables of their data type, however their initial value may optionally be overridden on a per instrument basis. That allows to share scripts between instruments while still being able to fine tune certain aspects of the script for each instrument individually.
Note
This is an own format extension which did not exist i.e. in the GigaStudio 4 software. It will currently only work with LinuxSampler and Gigedit.
Parameters
slot- script slot index of the variable to be unset
variable- name of the 'patch' variable in that script

Definition at line 5840 of file gig.cpp.

References gig::_UUIDFromCArray(), and gig::Script::Uuid.

◆ UpdateChunks() [1/2]

void DLS::Instrument::UpdateChunks ( progress_t * pProgress)
virtualinherited

Apply Instrument with all its Regions to the respective RIFF chunks.

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

Parameters
pProgress- callback function for progress notification
Exceptions
Exception- on errors

Reimplemented from DLS::Resource.

Definition at line 1425 of file DLS.cpp.

References RIFF::List::AddSubChunk(), RIFF::List::GetSubChunk(), DLS::Instrument::IsDrum, RIFF::Chunk::LoadChunkData(), DLS::Instrument::MIDIBank, DLS::Instrument::MIDIBankCoarse, DLS::Instrument::MIDIBankFine, DLS::Instrument::MIDIProgram, DLS::Instrument::Regions, DLS::Articulator::UpdateChunks(), and DLS::Resource::UpdateChunks().

Referenced by UpdateChunks().

◆ UpdateChunks() [2/2]

void gig::Instrument::UpdateChunks ( progress_t * pProgress)
virtual

Apply Instrument with all its Regions 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
Exceptions
gig::Exceptionif samples cannot be dereferenced

Definition at line 5093 of file gig.cpp.

References RIFF::List::AddSubChunk(), RIFF::List::AddSubList(), RIFF::List::DeleteSubChunk(), RIFF::Chunk::GetSize(), RIFF::List::GetSubChunk(), RIFF::List::GetSubList(), RIFF::Chunk::LoadChunkData(), DLS::File::pVersion, RIFF::Chunk::Resize(), and DLS::Instrument::UpdateChunks().

◆ UpdateRegionKeyTable()

void gig::Instrument::UpdateRegionKeyTable ( )
protected

Definition at line 5061 of file gig.cpp.

◆ UpdateScriptFileOffsets()

void gig::Instrument::UpdateScriptFileOffsets ( )
protected

Definition at line 5251 of file gig.cpp.

Member Data Documentation

◆ ArticulationsIterator

ArticulationList::iterator DLS::Articulator::ArticulationsIterator
protectedinherited

Definition at line 355 of file DLS.h.

◆ Attenuation

int32_t gig::Instrument::Attenuation

in dB

Definition at line 1279 of file gig.h.

Referenced by CopyAssign().

◆ DimensionKeyRange

range_t gig::Instrument::DimensionKeyRange

0-127 (where 0 means C1 and 127 means G9)

Definition at line 1284 of file gig.h.

Referenced by CopyAssign().

◆ EffectSend

uint16_t gig::Instrument::EffectSend

Definition at line 1280 of file gig.h.

◆ FineTune

int16_t gig::Instrument::FineTune

in cents

Definition at line 1281 of file gig.h.

Referenced by CopyAssign().

◆ IsDrum

bool DLS::Instrument::IsDrum
inherited

Indicates if the Instrument is a drum type, as they differ in the synthesis model of DLS from melodic instruments.

Definition at line 525 of file DLS.h.

Referenced by DLS::Instrument::Instrument(), and DLS::Instrument::UpdateChunks().

◆ MIDIBank

uint16_t DLS::Instrument::MIDIBank
inherited

Reflects combination of MIDIBankCoarse and MIDIBankFine (bank 1 - bank 16384). Do not change this value, it will not be saved! Change MIDIBankCoarse and MIDIBankFine instead (we might change that in future).

Definition at line 526 of file DLS.h.

Referenced by DLS::Instrument::Instrument(), and DLS::Instrument::UpdateChunks().

◆ MIDIBankCoarse

uint8_t DLS::Instrument::MIDIBankCoarse
inherited

Reflects the MIDI Bank number for MIDI Control Change 0 (bank 1 - 128).

Definition at line 527 of file DLS.h.

Referenced by DLS::Instrument::Instrument(), and DLS::Instrument::UpdateChunks().

◆ MIDIBankFine

uint8_t DLS::Instrument::MIDIBankFine
inherited

Reflects the MIDI Bank number for MIDI Control Change 32 (bank 1 - 128).

Definition at line 528 of file DLS.h.

Referenced by DLS::Instrument::Instrument(), and DLS::Instrument::UpdateChunks().

◆ MIDIProgram

uint32_t DLS::Instrument::MIDIProgram
inherited

Specifies the MIDI Program Change Number this Instrument should be assigned to.

Definition at line 529 of file DLS.h.

Referenced by DLS::Instrument::Instrument(), and DLS::Instrument::UpdateChunks().

◆ pArticulations

ArticulationList* DLS::Articulator::pArticulations
protectedinherited

Definition at line 354 of file DLS.h.

◆ pCkInstrument

RIFF::List* DLS::Instrument::pCkInstrument
protectedinherited

Definition at line 546 of file DLS.h.

◆ pDLSID

dlsid_t* DLS::Resource::pDLSID
inherited

Points to a dlsid_t structure if the file provided a DLS ID else is NULL.

Definition at line 406 of file DLS.h.

Referenced by DLS::Resource::GenerateDLSID(), DLS::Resource::Resource(), and DLS::Resource::UpdateChunks().

◆ PianoReleaseMode

bool gig::Instrument::PianoReleaseMode

Definition at line 1283 of file gig.h.

◆ pInfo

Info* DLS::Resource::pInfo
inherited

Points (in any case) to an Info object, providing additional, optional infos and comments.

Definition at line 405 of file DLS.h.

Referenced by gig::File::AddInstrument(), DLS::Resource::CopyAssign(), DLS::Resource::Resource(), gig::Sample::Sample(), and DLS::Resource::UpdateChunks().

◆ PitchbendRange

uint16_t gig::Instrument::PitchbendRange

Number of semitones pitchbend controller can pitch (default is 2).

Definition at line 1282 of file gig.h.

Referenced by CopyAssign().

◆ pParent

Resource* DLS::Resource::pParent
protectedinherited

Definition at line 416 of file DLS.h.

◆ pParentList

RIFF::List* DLS::Articulator::pParentList
protectedinherited

Definition at line 353 of file DLS.h.

◆ pRegions

RegionList* DLS::Instrument::pRegions
protectedinherited

Definition at line 547 of file DLS.h.

◆ pResourceList

RIFF::List* DLS::Resource::pResourceList
protectedinherited

Definition at line 417 of file DLS.h.

◆ RegionKeyTable

Region* gig::Instrument::RegionKeyTable[128]
protected

fast lookup for the corresponding Region of a MIDI key

Definition at line 1319 of file gig.h.

◆ Regions

uint32_t DLS::Instrument::Regions
inherited

Reflects the number of Region defintions this Instrument has.

Definition at line 530 of file DLS.h.

Referenced by DLS::Instrument::CopyAssign(), CopyAssign(), DLS::Instrument::Instrument(), and DLS::Instrument::UpdateChunks().

◆ RegionsIterator

RegionList::iterator DLS::Instrument::RegionsIterator
protectedinherited

Definition at line 548 of file DLS.h.


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