gig::File Class Reference

Provides convenient access to Gigasampler/GigaStudio .gig files. More...

`#include <gig.h>`

Inheritance diagram for gig::File:

## Public Member Functions

| File (RIFF::File *pRIFF)
Sample * | GetFirstSample (progress_t *pProgress=NULL)
| Returns a pointer to the first Sample object of the file, NULL otherwise.
Sample * | GetNextSample ()
| Returns a pointer to the next Sample object of the file, NULL otherwise.
Sample * | GetSample (size_t index, progress_t *pProgress=NULL)
| Returns Sample object of index.
Sample * | AddSample ()
| Add a new sample.
size_t | CountSamples ()
| Returns the total amount of samples of this gig file.
void | DeleteSample (Sample *pSample)
| Delete a sample.
Instrument * | GetFirstInstrument ()
| Returns a pointer to the first Instrument object of the file, NULL otherwise.
Instrument * | GetNextInstrument ()
| Returns a pointer to the next Instrument object of the file, NULL otherwise.
Instrument * | GetInstrument (size_t index, progress_t *pProgress=NULL)
| Returns the instrument with the given index.
Instrument * | AddInstrument ()
| Add a new instrument definition.
Instrument * | AddDuplicateInstrument (const Instrument *orig)
| Add a duplicate of an existing instrument.
size_t | CountInstruments ()
| Returns the total amount of instruments of this gig file.
void | DeleteInstrument (Instrument *pInstrument)
| Delete an instrument.
Group * | GetFirstGroup ()
| Returns a pointer to the first Group object of the file, NULL otherwise.
Group * | GetNextGroup ()
| Returns a pointer to the next Group object of the file, NULL otherwise.
Group * | GetGroup (size_t index)
| Returns the group with the given index.
Group * | GetGroup (String name)
| Returns the group with the given group name.
Group * | AddGroup ()
void | DeleteGroup (Group *pGroup)
| Delete a group and its samples.
void | DeleteGroupOnly (Group *pGroup)
| Delete a group.
void | SetAutoLoad (bool b)
| Enable / disable automatic loading.
bool | GetAutoLoad ()
| Returns whether automatic loading is enabled.
void | AddContentOf (File *pFile)
| Add content of another existing file.
ScriptGroup * | GetScriptGroup (size_t index)
| Get instrument script group (by index).
ScriptGroup * | GetScriptGroup (const String &name)
| Get instrument script group (by name).
ScriptGroup * | AddScriptGroup ()
| Add new instrument script group.
void | DeleteScriptGroup (ScriptGroup *pGroup)
| Delete an instrument script group.
virtual void | UpdateChunks (progress_t *pProgress)
| Apply all the gig file's current instruments, samples, groups and settings to the respective RIFF chunks.
Resource * | GetParent ()
const Resource * | GetParent () const
virtual void | Save (const String &Path, progress_t *pProgress=NULL)
| Save changes to another file.
virtual void | Save (progress_t *pProgress=NULL)
| Save changes to same file.
String | GetFileName ()
| File name of this DLS file.
void | SetFileName (const String &name)
| You may call this method store a future file name, so you don't have to to pass it to the Save() call later on.
RIFF::File * | GetRiffFile ()
| Returns the underlying RIFF::File used for persistency of this DLS::File object.

## Public Attributes

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.
version_t * | pVersion
| Points to a version_t structure if the file provided a version number else is set to NULL.
uint32_t | Instruments
| Reflects the number of available Instrument objects.

## Static Public Attributes

static const DLS::version_t | VERSION_2
| Reflects Gigasampler file format version 2.0 (1998-06-28).
static const DLS::version_t | VERSION_3
| Reflects Gigasampler file format version 3.0 (2003-03-31).
static const DLS::version_t | VERSION_4
| Reflects Gigasampler file format version 4.0 (2007-10-12).

## Protected Types

typedef std::vector< Sample * > | SampleList
typedef std::vector< Instrument * > | InstrumentList

## Protected Member Functions

virtual void | LoadSamples ()
virtual void | LoadInstruments ()
virtual void | LoadGroups ()
virtual void | UpdateFileOffsets ()
| Updates all file offsets stored all over the file.
virtual void | LoadSamples (progress_t *pProgress)
virtual void | LoadInstruments (progress_t *pProgress)
virtual void | LoadScriptGroups ()
void | SetSampleChecksum (Sample *pSample, uint32_t crc)
| Updates the 3crc chunk with the checksum of a sample.
uint32_t | GetSampleChecksum (Sample *pSample)
uint32_t | GetSampleChecksumByIndex (int index)
bool | VerifySampleChecksumTable ()
| Checks whether the file's "3CRC" chunk was damaged.
bool | RebuildSampleChecksumTable ()
| Recalculates CRC32 checksums for all samples and rebuilds this gig file's checksum table with those new checksums.
int | GetWaveTableIndexOf (gig::Sample *pSample)
Sample * | GetSample (size_t index)
| Returns Sample object of index.
Sample * | GetFirstSample ()
| Returns a pointer to the first Sample object of the file, NULL otherwise.
void | DeleteSample (Sample *pSample)
| Delete a sample.
Instrument * | GetInstrument (size_t index)
| Returns the instrument with the given index from the list of instruments of this file.
void | DeleteInstrument (Instrument *pInstrument)
| Delete an instrument.
RIFF::File * | GetExtensionFile (int index)
| Returns extension file of given index.
void | __ensureMandatoryChunksExist ()
| Checks if all (for DLS) mandatory chunks exist, if not they will be created.
virtual void | DeleteChunks ()
| Remove all RIFF chunks associated with this Resource object.
void | GenerateDLSID ()
| Generates a new DLSID for the resource.
virtual void | CopyAssign (const Resource *orig)
| Make a deep copy of the Resource object given by orig and assign it to this object.

## Static Protected Member Functions

static void | GenerateDLSID (dlsid_t *pDLSID)

## Protected Attributes

RIFF::File * | pRIFF
std::list< RIFF::File * > | ExtensionFiles
SampleList * | pSamples
SampleList::iterator | SamplesIterator
InstrumentList * | pInstruments
InstrumentList::iterator | InstrumentsIterator
uint32_t | WavePoolHeaderSize
uint32_t | WavePoolCount
uint32_t * | pWavePoolTable
uint32_t * | pWavePoolTableHi
bool | b64BitWavePoolOffsets
bool | bOwningRiff
| If `true` then `pRIFF` was implicitly allocated by this class and hence pRIFF will automatically be freed by the `DLS::File` destructor in that case.
Resource * | pParent
RIFF::List * | pResourceList

## Detailed Description

Provides convenient access to Gigasampler/GigaStudio .gig files.

This is the entry class for accesing a Gigasampler/GigaStudio (.gig) file with libgig. It allows you to open existing .gig files, modifying them and saving them persistently either under the same file name or under a different location.

A .gig file is merely a monolithic file. That means samples and the defintion of the virtual instruments are contained in the same file. A .gig file contains an arbitrary amount of samples, and an arbitrary amount of instruments which are referencing those samples. It is also possible to store samples in .gig files not being referenced by any instrument. This is not an error from the file format's point of view and it is actually often used in practice during the design phase of new gig instruments.

So on toplevel of the gig file format you have:

- A set of samples (see Sample).
- A set of virtual instruments (see Instrument).

And as extension to the original GigaStudio format, we added:

- Real-time instrument scripts (see Script).

Note that the latter however is only supported by libgig, gigedit and LinuxSampler. Scripts are not supported by the original GigaStudio software.

All released Gigasampler/GigaStudio file format versions are supported (so from first Gigasampler version up to including GigaStudio 4).

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

Definition at line 1422 of file gig.h.

## Member Typedef Documentation

## InstrumentList

typedef std::vector<Instrument*> DLS::File::InstrumentList

protected inherited

Definition at line 592 of file DLS.h.

## SampleList

typedef std::vector<Sample*> DLS::File::SampleList

protected inherited

Definition at line 591 of file DLS.h.

## Constructor & Destructor Documentation

## File() [1/2]

gig::File::File | ( |  | ) |

Definition at line 6274 of file gig.cpp.

## File() [2/2]

gig::File::File | ( | RIFF::File * | pRIFF | ) |

Definition at line 6291 of file gig.cpp.

## ~File()

gig::File::~File | ( |  | ) |

virtual

Reimplemented from DLS::File.

Definition at line 6298 of file gig.cpp.

## Member Function Documentation

## __ensureMandatoryChunksExist()

void DLS::File::__ensureMandatoryChunksExist | ( |  | ) |

protected inherited

Checks if all (for DLS) mandatory chunks exist, if not they will be created.

Note that those chunks will not be made persistent until Save() was called.

Definition at line 2471 of file DLS.cpp.

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

Referenced by AddInstrument(), gig::File::AddInstrument(), AddSample(), and gig::File::AddSample().

## AddContentOf()

void gig::File::AddContentOf | ( | File * | pFile | ) |

Add content of another existing file.

Duplicates the samples, groups and instruments of the original file given by pFile and adds them to `this` File. In case `this` File is a new one that you haven't saved before, then you have to call SetFileName() before calling AddContentOf(), because this method will automatically save this file during operation, which is required for writing the sample waveform data by disk streaming.

Parameters

  pFile | - original file whose's content shall be copied from

Definition at line 6700 of file gig.cpp.

References AddInstrument(), AddSample(), gig::ScriptGroup::AddScript(), AddScriptGroup(), gig::Instrument::CopyAssign(), gig::Script::CopyAssign(), gig::Sample::CopyAssignMeta(), GetFileName(), GetGroup(), gig::Sample::GetGroup(), GetInstrument(), GetSample(), gig::ScriptGroup::GetScript(), GetScriptGroup(), gig::Group::Name, gig::ScriptGroup::Name, and Save().

## AddDuplicateInstrument()

Instrument * gig::File::AddDuplicateInstrument | ( | const Instrument * | orig | ) |

Add a duplicate of an existing instrument.

Duplicates the instrument definition given by orig and adds it to this file. This allows in an instrument editor application to easily create variations of an instrument, which will be stored in the same .gig file, sharing i.e. the same samples.

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

You have to call Save() to make this persistent to the file.

Parameters

  orig | - original instrument to be copied

Returns
  duplicated copy of the given instrument

Definition at line 6683 of file gig.cpp.

References AddInstrument(), and gig::Instrument::CopyAssign().

## AddGroup()

Group * gig::File::AddGroup | ( |  | ) |

Definition at line 7024 of file gig.cpp.

## AddInstrument()

Instrument * gig::File::AddInstrument | ( |  | ) |

Add a new instrument definition.

This will create a new Instrument object for the gig file. You have to call Save() to make this persistent to the file.

Returns
  pointer to new Instrument object

Definition at line 6644 of file gig.cpp.

References DLS::File::__ensureMandatoryChunksExist(), RIFF::List::AddSubChunk(), RIFF::List::AddSubList(), DLS::Resource::GenerateDLSID(), RIFF::List::GetSubList(), and gig::Instrument::pInfo.

Referenced by AddContentOf(), and AddDuplicateInstrument().

## AddSample()

Sample * gig::File::AddSample | ( |  | ) |

Add a new sample.

This will create a new Sample object for the gig file. You have to call Save() to make this persistent to the file.

Returns
  pointer to new Sample object

Definition at line 6382 of file gig.cpp.

References DLS::File::__ensureMandatoryChunksExist(), RIFF::List::AddSubChunk(), RIFF::List::AddSubList(), and RIFF::List::GetSubList().

Referenced by AddContentOf().

## AddScriptGroup()

ScriptGroup * gig::File::AddScriptGroup | ( |  | ) |

Add new instrument script group.

Adds a new, empty real-time instrument script group to the file.

You have to call Save() to make this persistent to the file.

Returns
  new empty script group

Definition at line 7148 of file gig.cpp.

Referenced by AddContentOf().

## CopyAssign()

void Resource::CopyAssign | ( | const Resource * | orig | ) |

virtual inherited

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 654 of file DLS.cpp.

References pInfo, and Resource().

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

## CountInstruments()

size_t gig::File::CountInstruments | ( |  | ) |

Returns the total amount of instruments of this gig file.

Note that this method might block for a long time in case it is required to load the instruments info for the first time.

Returns
  total amount of instruments

Definition at line 6589 of file gig.cpp.

## CountSamples()

size_t gig::File::CountSamples | ( |  | ) |

Returns the total amount of samples of this gig file.

Note that this method might block for a long time in case it is required to load the sample info for the first time.

Returns
  total amount of samples

Definition at line 6369 of file gig.cpp.

## DeleteChunks()

void Resource::DeleteChunks | ( |  | ) |

virtual inherited

Remove all RIFF chunks associated with this Resource object.

At the moment Resource::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 Storage::DeleteChunks() for details.

Implements DLS::Storage.

Reimplemented in DLS::Instrument, DLS::Region, and DLS::Sample.

Definition at line 572 of file DLS.cpp.

Referenced by DLS::Instrument::DeleteChunks(), DLS::Region::DeleteChunks(), and DLS::Sample::DeleteChunks().

## DeleteGroup()

void gig::File::DeleteGroup | ( | Group * | pGroup | ) |

Delete a group and its samples.

This will delete the given Group object and all the samples that belong to this group from the gig file. You have to call Save() to make this persistent to the file.

Parameters

  pGroup | - group to delete

Exceptions

  gig::Exception | if given group could not be found

Definition at line 7042 of file gig.cpp.

References gig::Group::DeleteChunks(), DeleteSample(), and gig::Group::GetSample().

## DeleteGroupOnly()

void gig::File::DeleteGroupOnly | ( | Group * | pGroup | ) |

Delete a group.

This will delete the given Group object from the gig file. All the samples that belong to this group will not be deleted, but instead be moved to another group. You have to call Save() to make this persistent to the file.

Parameters

  pGroup | - group to delete

Exceptions

  gig::Exception | if given group could not be found

Definition at line 7069 of file gig.cpp.

References gig::Group::DeleteChunks(), and gig::Group::MoveAll().

## DeleteInstrument() [1/2]

void DLS::File::DeleteInstrument | ( | Instrument * | pInstrument | ) |

inherited

Delete an instrument.

This will delete the given Instrument object from the DLS file. You have to call Save() to make this persistent to the file.

Parameters

  pInstrument | - instrument to delete

Definition at line 1984 of file DLS.cpp.

References DLS::Instrument::DeleteChunks().

## DeleteInstrument() [2/2]

void gig::File::DeleteInstrument | ( | Instrument * | pInstrument | ) |

Delete an instrument.

This will delete the given Instrument object from the gig file. You have to call Save() to make this persistent to the file.

Parameters

  pInstrument | - instrument to delete

Exceptions

  gig::Exception | if given instrument could not be found

Definition at line 6772 of file gig.cpp.

References DLS::Instrument::DeleteChunks().

## DeleteSample() [1/2]

void DLS::File::DeleteSample | ( | Sample * | pSample | ) |

inherited

Delete a sample.

This will delete the given Sample object from the DLS file. You have to call Save() to make this persistent to the file.

Parameters

  pSample | - sample to delete

Definition at line 1891 of file DLS.cpp.

References DLS::Sample::DeleteChunks().

## DeleteSample() [2/2]

void gig::File::DeleteSample | ( | Sample * | pSample | ) |

Delete a sample.

This will delete the given Sample object from the gig file. Any references to this sample from Regions and DimensionRegions will be removed. You have to call Save() to make this persistent to the file.

Parameters

  pSample | - sample to delete

Exceptions

  gig::Exception | if given sample could not be found

Definition at line 6409 of file gig.cpp.

References DLS::Sample::DeleteChunks(), GetInstrument(), and gig::DimensionRegion::pSample.

Referenced by DeleteGroup().

## DeleteScriptGroup()

void gig::File::DeleteScriptGroup | ( | ScriptGroup * | pScriptGroup | ) |

Delete an instrument script group.

This will delete the given real-time instrument script group and all its instrument scripts it contains. References inside instruments that are using the deleted scripts will be removed from the respective instruments accordingly.

You have to call Save() to make this persistent to the file.

Parameters

  pScriptGroup | - script group to delete

Exceptions

  gig::Exception | if given script group could not be found

Definition at line 7167 of file gig.cpp.

References gig::ScriptGroup::DeleteChunks(), gig::ScriptGroup::DeleteScript(), RIFF::List::DeleteSubChunk(), RIFF::Chunk::GetParent(), and gig::ScriptGroup::GetScript().

## GenerateDLSID() [1/2]

void Resource::GenerateDLSID | ( |  | ) |

inherited

Generates a new DLSID for the resource.

Definition at line 604 of file DLS.cpp.

References GenerateDLSID(), and pDLSID.

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

## GenerateDLSID() [2/2]

void Resource::GenerateDLSID | ( | dlsid_t * | pDLSID | ) |

static inherited

Definition at line 611 of file DLS.cpp.

## GetAutoLoad()

bool gig::File::GetAutoLoad | ( |  | ) |

Returns whether automatic loading is enabled.

See also
  SetAutoLoad()

Definition at line 7475 of file gig.cpp.

Referenced by GetInstrument().

## GetExtensionFile()

RIFF::File * DLS::File::GetExtensionFile | ( | int | index | ) |

inherited

Returns extension file of given index.

Extension files are used sometimes to circumvent the 2 GB file size limit of the RIFF format and of certain operating systems in general. In this case, instead of just using one file, the content is spread among several files with similar file name scheme. This is especially used by some GigaStudio sound libraries.

Parameters

  index | - index of extension file

Returns
  sought extension file, NULL if index out of bounds

See also
  GetFileName()

Definition at line 2015 of file DLS.cpp.

## GetFileName()

String DLS::File::GetFileName | ( |  | ) |

File name of this DLS file.

This method returns the file name as it was provided when loading the respective DLS file. However in case the File object associates an empty, that is new DLS file, which was not yet saved to disk, this method will return an empty string.

See also
  GetExtensionFile()

Definition at line 571 of file DLS.cpp.

Referenced by AddContentOf().

## GetFirstGroup()

Group * gig::File::GetFirstGroup | ( |  | ) |

Returns a pointer to the first Group object of the file, NULL otherwise.

Deprecated
  This method is not reentrant-safe, use GetGroup() instead.

Definition at line 6975 of file gig.cpp.

## GetFirstInstrument()

Instrument * gig::File::GetFirstInstrument | ( |  | ) |

Returns a pointer to the first Instrument object of the file, NULL otherwise.

Deprecated
  This method is not reentrant-safe, use GetInstrument() instead.

Definition at line 6561 of file gig.cpp.

## GetFirstSample() [1/2]

Sample * DLS::File::GetFirstSample | ( |  | ) |

inherited

Returns a pointer to the first Sample object of the file, NULL otherwise.

Deprecated
  This method is not reentrant-safe, use GetSample() instead.

Definition at line 1794 of file DLS.cpp.

## GetFirstSample() [2/2]

Sample * gig::File::GetFirstSample | ( | progress_t * | pProgress = NULL | ) |

Returns a pointer to the first Sample object of the file, NULL otherwise.

Parameters

  pProgress | - optional: callback function for progress notification

Deprecated
  This method is not reentrant-safe, use GetSample() instead.

Definition at line 6327 of file gig.cpp.

## GetGroup() [1/2]

Group * gig::File::GetGroup | ( | size_t | index | ) |

Returns the group with the given index.

Parameters

  index | - number of the sought group (0..n)

Returns
  sought group or NULL if there's no such group

Definition at line 7000 of file gig.cpp.

Referenced by AddContentOf(), GetGroup(), and gig::Sample::Sample().

## GetGroup() [2/2]

Group * gig::File::GetGroup | ( | String | name | ) |

Returns the group with the given group name.

Note: group names don't have to be unique in the gig format! So there can be multiple groups with the same name. This method will simply return the first group found with the given name.

Parameters

  name | - name of the sought group

Returns
  sought group or NULL if there's no group with that name

Definition at line 7016 of file gig.cpp.

References GetGroup().

## GetInstrument() [1/2]

Instrument * DLS::File::GetInstrument | ( | size_t | index | ) |

inherited

Returns the instrument with the given index from the list of instruments of this file.

Parameters

  index | - number of the sought instrument (0..n)

Returns
  sought instrument or NULL if there's no such instrument

Definition at line 1909 of file DLS.cpp.

## GetInstrument() [2/2]

Instrument * gig::File::GetInstrument | ( | size_t | index,
|  | progress_t * | pProgress = NULL )

Returns the instrument with the given index.

Parameters

  index | - number of the sought instrument (0..n)
  pProgress | - optional: callback function for progress notification

Returns
  sought instrument or NULL if there's no such instrument

Definition at line 6602 of file gig.cpp.

References RIFF::progress_t::__range_max, RIFF::progress_t::__range_min, RIFF::progress_t::callback, GetAutoLoad(), and GetSample().

Referenced by AddContentOf(), DeleteSample(), UpdateChunks(), and UpdateFileOffsets().

## GetNextGroup()

Group * gig::File::GetNextGroup | ( |  | ) |

Returns a pointer to the next Group object of the file, NULL otherwise.

Deprecated
  This method is not reentrant-safe, use GetGroup() instead.

Definition at line 6988 of file gig.cpp.

## GetNextInstrument()

Instrument * gig::File::GetNextInstrument | ( |  | ) |

Returns a pointer to the next Instrument object of the file, NULL otherwise.

Deprecated
  This method is not reentrant-safe, use GetInstrument() instead.

Definition at line 6575 of file gig.cpp.

## GetNextSample()

Sample * gig::File::GetNextSample | ( |  | ) |

Returns a pointer to the next Sample object of the file, NULL otherwise.

Deprecated
  This method is not reentrant-safe, use GetSample() instead.

Definition at line 6341 of file gig.cpp.

## GetParent() [1/2]

Resource * DLS::Resource::GetParent | ( |  | ) |

inline

Definition at line 409 of file DLS.h.

## GetParent() [2/2]

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

inline

Definition at line 410 of file DLS.h.

## GetRiffFile()

RIFF::File * DLS::File::GetRiffFile | ( |  | ) |

Returns the underlying RIFF::File used for persistency of this DLS::File object.

Definition at line 584 of file DLS.cpp.

## GetSample() [1/2]

Sample * DLS::File::GetSample | ( | size_t | index | ) |

inherited

Returns Sample object of index.

Parameters

  index | - position of sample in sample list (0..n)

Returns
  sample object or NULL if index is out of bounds

Definition at line 1780 of file DLS.cpp.

## GetSample() [2/2]

Sample * gig::File::GetSample | ( | size_t | index,
|  | progress_t * | pProgress = NULL )

Returns Sample object of index.

Parameters

  index | - position of sample in sample list (0..n)
  pProgress | - optional: callback function for progress notification

Returns
  sample object or NULL if index is out of bounds

Definition at line 6354 of file gig.cpp.

Referenced by AddContentOf(), GetInstrument(), RebuildSampleChecksumTable(), UpdateChunks(), and VerifySampleChecksumTable().

## GetSampleChecksum()

uint32_t gig::File::GetSampleChecksum | ( | Sample * | pSample | ) |

protected

Definition at line 6837 of file gig.cpp.

## GetSampleChecksumByIndex()

uint32_t gig::File::GetSampleChecksumByIndex | ( | int | index | ) |

protected

Definition at line 6845 of file gig.cpp.

## GetScriptGroup() [1/2]

ScriptGroup * gig::File::GetScriptGroup | ( | const String & | name | ) |

Get instrument script group (by name).

Returns the first real-time instrument script group found with the given group name. Note that group names may not necessarily be unique.

Parameters

  name | - name of the sought script group

Returns
  sought script group or NULL if there's no such group

Definition at line 7131 of file gig.cpp.

References gig::ScriptGroup::Name.

## GetScriptGroup() [2/2]

ScriptGroup * gig::File::GetScriptGroup | ( | size_t | index | ) |

Get instrument script group (by index).

Returns the real-time instrument script group with the given index.

Parameters

  index | - number of the sought group (0..n)

Returns
  sought script group or NULL if there's no such group

Definition at line 7117 of file gig.cpp.

Referenced by AddContentOf().

## GetWaveTableIndexOf()

int gig::File::GetWaveTableIndexOf | ( | gig::Sample * | pSample | ) |

protected

Definition at line 6865 of file gig.cpp.

## LoadGroups()

void gig::File::LoadGroups | ( |  | ) |

protected virtual

Definition at line 7082 of file gig.cpp.

## LoadInstruments() [1/2]

void gig::File::LoadInstruments | ( |  | ) |

protected virtual

Reimplemented from DLS::File.

Definition at line 6783 of file gig.cpp.

## LoadInstruments() [2/2]

void gig::File::LoadInstruments | ( | progress_t * | pProgress | ) |

protected virtual

Definition at line 6787 of file gig.cpp.

## LoadSamples() [1/2]

void gig::File::LoadSamples | ( |  | ) |

protected virtual

Reimplemented from DLS::File.

Definition at line 6438 of file gig.cpp.

## LoadSamples() [2/2]

void gig::File::LoadSamples | ( | progress_t * | pProgress | ) |

protected virtual

Definition at line 6442 of file gig.cpp.

## LoadScriptGroups()

void gig::File::LoadScriptGroups | ( |  | ) |

protected virtual

Definition at line 7182 of file gig.cpp.

## RebuildSampleChecksumTable()

bool gig::File::RebuildSampleChecksumTable | ( |  | ) |

protected

Recalculates CRC32 checksums for all samples and rebuilds this gig file's checksum table with those new checksums.

This might usually just be necessary if the checksum table was damaged.

IMPORTANT: The current implementation of this method only works with files that have not been modified since it was loaded, because it expects that no externally caused file structure changes are required!

Due to the expectation above, this method is currently protected and actually only used by the command line tool "gigdump" yet.

Returns
  true if Save() is required to be called after this call, false if no further action is required

Definition at line 6918 of file gig.cpp.

References gig::Sample::crc, RIFF::Chunk::GetNewSize(), GetSample(), RIFF::Chunk::LoadChunkData(), pVersion, RIFF::Chunk::Resize(), and SetSampleChecksum().

## Save() [1/2]

void DLS::File::Save | ( | const String & | Path,
|  | progress_t * | pProgress = NULL )

virtual

Save changes to another file.

Make all changes persistent by writing them to another file. Caution: this method is optimized for writing to another file, do not use it to save the changes to the same file! Use Save() (without path argument) in that case instead! Ignoring this might result in a corrupted file!

After calling this method, this File object will be associated with the new file (given by Path) afterwards.

Parameters

  Path | - path and file name where everything should be written to
  pProgress | - optional: callback function for progress notification

Reimplemented from DLS::File.

Definition at line 587 of file DLS.cpp.

Referenced by AddContentOf().

## Save() [2/2]

void DLS::File::Save | ( | progress_t * | pProgress = NULL | ) |

virtual

Save changes to same file.

Make all changes persistent by writing them to the actual (same) file. The file might temporarily grow to a higher size than it will have at the end of the saving process.

Parameters

  pProgress | - optional: callback function for progress notification

Exceptions

  RIFF::Exception | if any kind of IO error occurred
  DLS::Exception | if any kind of DLS specific error occurred

Reimplemented from DLS::File.

Definition at line 588 of file DLS.cpp.

References RIFF::Chunk::LoadChunkData(), and pDLSID.

## SetAutoLoad()

void gig::File::SetAutoLoad | ( | bool | b | ) |

Enable / disable automatic loading.

By default this property is enabled and every information is loaded automatically. However loading all Regions, DimensionRegions and especially samples might take a long time for large .gig files, and sometimes one might only be interested in retrieving very superficial informations like the amount of instruments and their names. In this case one might disable automatic loading to avoid very slow response times.

CAUTION: by disabling this property many pointers (i.e. sample references) and attributes will have invalid or even undefined data! This feature is currently only intended for retrieving very superficial information in a very fast way. Don't use it to retrieve details like synthesis information or even to modify .gig files!

Definition at line 7467 of file gig.cpp.

## SetFileName()

void DLS::File::SetFileName | ( | const String & | name | ) |

You may call this method store a future file name, so you don't have to to pass it to the Save() call later on.

Definition at line 572 of file DLS.cpp.

## SetSampleChecksum()

void gig::File::SetSampleChecksum | ( | Sample * | pSample,
|  | uint32_t | crc )

protected

Updates the 3crc chunk with the checksum of a sample.

The update is done directly to disk, as this method is called after File::Save()

Definition at line 6822 of file gig.cpp.

References RIFF::Chunk::SetPos(), and RIFF::Chunk::WriteUint32().

Referenced by RebuildSampleChecksumTable(), and gig::Sample::Write().

## UpdateChunks()

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

virtual

Apply all the gig file's current instruments, samples, groups and settings to the respective RIFF chunks.

You have to call 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

  Exception | - on errors

Reimplemented from DLS::File.

Definition at line 7209 of file gig.cpp.

References RIFF::List::AddSubList(), DLS::Sample::Channels, RIFF::List::CountSubChunks(), gig::Sample::crc, GetInstrument(), GetSample(), RIFF::Chunk::GetSize(), RIFF::List::GetSubChunk(), RIFF::List::GetSubChunkAt(), RIFF::List::GetSubList(), Instruments, RIFF::Chunk::LoadChunkData(), RIFF::List::MoveSubChunk(), gig::DimensionRegion::pSample, pVersion, RIFF::Chunk::Resize(), gig::DimensionRegion::SampleLoops, and DLS::File::UpdateChunks().

## UpdateFileOffsets()

void gig::File::UpdateFileOffsets | ( |  | ) |

protected virtual

Updates all file offsets stored all over the file.

This virtual method is called whenever the overall file layout has been changed (i.e. file or individual RIFF chunks have been resized). It is then the responsibility of this method to update all file offsets stored in the file format. For example samples are referenced by instruments by file offsets. The gig format also stores references to instrument scripts as file offsets, and thus it overrides this method to update those file offsets as well.

Reimplemented from DLS::File.

Definition at line 7441 of file gig.cpp.

References GetInstrument(), and DLS::File::UpdateFileOffsets().

## VerifySampleChecksumTable()

bool gig::File::VerifySampleChecksumTable | ( |  | ) |

protected

Checks whether the file's "3CRC" chunk was damaged.

This chunk contains the CRC32 check sums of all samples' raw wave data.

Returns
  true if 3CRC chunk is OK, or false if 3CRC chunk is damaged

Definition at line 6881 of file gig.cpp.

References RIFF::Chunk::GetNewSize(), GetSample(), and RIFF::Chunk::LoadChunkData().

## Member Data Documentation

## b64BitWavePoolOffsets

bool DLS::File::b64BitWavePoolOffsets

protected inherited

Definition at line 604 of file DLS.h.

## bOwningRiff

bool DLS::File::bOwningRiff

protected inherited

If `true` then `pRIFF` was implicitly allocated by this class and hence pRIFF will automatically be freed by the `DLS::File` destructor in that case.

Definition at line 605 of file DLS.h.

Referenced by File(), and File().

## ExtensionFiles

std::list<RIFF::File*> DLS::File::ExtensionFiles

protected inherited

Definition at line 595 of file DLS.h.

## Instruments

uint32_t DLS::File::Instruments

Reflects the number of available Instrument objects.

Definition at line 567 of file DLS.h.

Referenced by UpdateChunks().

## InstrumentsIterator

InstrumentList::iterator DLS::File::InstrumentsIterator

protected inherited

Definition at line 599 of file DLS.h.

## pDLSID

dlsid_t* DLS::Resource::pDLSID

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

Definition at line 407 of file DLS.h.

Referenced by Save().

## pInfo

Info* DLS::Resource::pInfo

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

Definition at line 406 of file DLS.h.

## pInstruments

InstrumentList* DLS::File::pInstruments

protected inherited

Definition at line 598 of file DLS.h.

## pParent

Resource* DLS::Resource::pParent

protected inherited

Definition at line 417 of file DLS.h.

## pResourceList

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

protected inherited

Definition at line 418 of file DLS.h.

## pRIFF

RIFF::File* DLS::File::pRIFF

protected inherited

Definition at line 594 of file DLS.h.

## pSamples

SampleList* DLS::File::pSamples

protected inherited

Definition at line 596 of file DLS.h.

## pVersion

version_t* DLS::File::pVersion

Points to a version_t structure if the file provided a version number else is set to NULL.

Definition at line 566 of file DLS.h.

Referenced by gig::Region::AddDimension(), RebuildSampleChecksumTable(), gig::DimensionRegion::UpdateChunks(), UpdateChunks(), gig::Instrument::UpdateChunks(), and gig::Region::UpdateChunks().

## pWavePoolTable

uint32_t* DLS::File::pWavePoolTable

protected inherited

Definition at line 602 of file DLS.h.

## pWavePoolTableHi

uint32_t* DLS::File::pWavePoolTableHi

protected inherited

Definition at line 603 of file DLS.h.

## SamplesIterator

SampleList::iterator DLS::File::SamplesIterator

protected inherited

Definition at line 597 of file DLS.h.

## VERSION_2

const DLS::version_t gig::File::VERSION_2

static

Initial value:
= {
0, 2, 19980628 & 0xffff, 19980628 >> 16
}

Reflects Gigasampler file format version 2.0 (1998-06-28).

Definition at line 1424 of file gig.h.

## VERSION_3

const DLS::version_t gig::File::VERSION_3

static

Initial value:
= {
0, 3, 20030331 & 0xffff, 20030331 >> 16
}

Reflects Gigasampler file format version 3.0 (2003-03-31).

Definition at line 1425 of file gig.h.

## VERSION_4

const DLS::version_t gig::File::VERSION_4

static

Initial value:
= {
0, 4, 20071012 & 0xffff, 20071012 >> 16
}

Reflects Gigasampler file format version 4.0 (2007-10-12).

Definition at line 1426 of file gig.h.

## WavePoolCount

uint32_t DLS::File::WavePoolCount

protected inherited

Definition at line 601 of file DLS.h.

## WavePoolHeaderSize

uint32_t DLS::File::WavePoolHeaderSize

protected inherited

Definition at line 600 of file DLS.h.

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

- gig.h
- gig.cpp