libgig
3.3.0.svn3
|
Parses Gigasampler files and provides abstract access to the data. More...
#include <gig.h>
Public Member Functions | |
File () | |
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 * | AddSample () |
Add a new sample. | |
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 (uint index, progress_t *pProgress=NULL) |
Returns the instrument with the given index. | |
Instrument * | AddInstrument () |
Add a new instrument definition. | |
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 (uint index) |
Returns the group with the given index. | |
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. | |
virtual | ~File () |
virtual void | UpdateChunks () |
Apply all the gig file's current instruments, samples, groups and settings to the respective RIFF chunks. | |
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). | |
Protected Types | |
typedef std::list< Sample * > | SampleList |
typedef std::list< Instrument * > | InstrumentList |
Protected Member Functions | |
virtual void | LoadSamples () |
virtual void | LoadInstruments () |
virtual void | LoadGroups () |
virtual void | LoadSamples (progress_t *pProgress) |
virtual void | LoadInstruments (progress_t *pProgress) |
void | SetSampleChecksum (Sample *pSample, uint32_t crc) |
Updates the 3crc chunk with the checksum of a sample. | |
String | GetFileName () |
File name of this DLS file. | |
Sample * | GetFirstSample () |
Returns a pointer to the first Sample object of the file, NULL otherwise. | |
void | DeleteSample (Sample *pSample) |
Delete a sample. | |
void | DeleteInstrument (Instrument *pInstrument) |
Delete an instrument. | |
RIFF::File * | GetExtensionFile (int index) |
Returns extension file of given index. | |
virtual void | Save (const String &Path) |
Save changes to another file. | |
virtual void | Save () |
Save changes to same file. | |
void | __ensureMandatoryChunksExist () |
Checks if all (for DLS) mandatory chunks exist, if not they will be created. | |
Resource * | GetParent () |
void | GenerateDLSID () |
Generates a new DLSID for the resource. | |
Protected Attributes | |
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. | |
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 |
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. | |
Resource * | pParent |
RIFF::List * | pResourceList |
Friends | |
class | Region |
class | Sample |
class | Group |
Parses Gigasampler files and provides abstract access to the data.
|
protectedinherited |
|
protectedinherited |
gig::File::File | ( | ) |
Definition at line 3326 of file gig.cpp.
References RIFF::List::AddSubChunk(), DLS::Info::ArchivalLocation, CHUNK_ID_COLH, CHUNK_ID_DLID, CHUNK_ID_VERS, DLS::Resource::GenerateDLSID(), DLS::Resource::pInfo, DLS::File::pRIFF, DLS::File::pVersion, DLS::Info::SetFixedStringLengths(), and VERSION_3.
gig::File::File | ( | RIFF::File * | pRIFF | ) |
Definition at line 3342 of file gig.cpp.
References DLS::Resource::pInfo, and DLS::Info::SetFixedStringLengths().
|
protectedinherited |
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 1568 of file DLS.cpp.
References RIFF::List::AddSubChunk(), RIFF::List::AddSubList(), DLS::File::b64BitWavePoolOffsets, CHUNK_ID_PTBL, RIFF::List::GetSubChunk(), RIFF::List::GetSubList(), LIST_TYPE_LINS, LIST_TYPE_WVPL, DLS::File::pRIFF, and DLS::File::WavePoolHeaderSize.
Referenced by AddGroup(), DLS::File::AddInstrument(), AddInstrument(), DLS::File::AddSample(), and AddSample().
Group * gig::File::AddGroup | ( | ) |
Definition at line 3671 of file gig.cpp.
References DLS::File::__ensureMandatoryChunksExist(), Group, and LoadGroups().
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.
Definition at line 3548 of file gig.cpp.
References DLS::File::__ensureMandatoryChunksExist(), RIFF::List::AddSubChunk(), RIFF::List::AddSubList(), CHUNK_ID_DLID, CHUNK_ID_INSH, DLS::Resource::GenerateDLSID(), RIFF::List::GetSubList(), LIST_TYPE_INFO, LIST_TYPE_INS, LIST_TYPE_LINS, LoadInstruments(), DLS::Resource::pInfo, DLS::File::pInstruments, DLS::File::pRIFF, and DLS::Info::Software.
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.
Definition at line 3380 of file gig.cpp.
References DLS::File::__ensureMandatoryChunksExist(), RIFF::List::AddSubChunk(), RIFF::List::AddSubList(), CHUNK_ID_FMT, RIFF::List::GetSubList(), LIST_TYPE_INFO, LIST_TYPE_WAVE, LIST_TYPE_WVPL, LoadSamples(), DLS::File::pRIFF, DLS::File::pSamples, and Sample.
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.
pGroup | - group to delete |
gig::Exception | if given group could not be found |
Definition at line 3689 of file gig.cpp.
References DeleteSample(), gig::Group::GetFirstSample(), gig::Group::GetNextSample(), and LoadGroups().
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.
pGroup | - group to delete |
gig::Exception | if given group could not be found |
Definition at line 3713 of file gig.cpp.
References LoadGroups(), and gig::Group::MoveAll().
|
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.
pInstrument | - instrument to delete |
Definition at line 1427 of file DLS.cpp.
References DLS::File::pInstruments.
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.
pInstrument | - instrument to delete |
gig::Exception | if given instrument could not be found |
Definition at line 3578 of file gig.cpp.
References DLS::File::pInstruments.
|
inherited |
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.
pSample | - sample to delete |
gig::Exception | if given sample could not be found |
Definition at line 3405 of file gig.cpp.
References GetFirstInstrument(), GetNextInstrument(), gig::DimensionRegion::pSample, DLS::File::pSamples, and DLS::File::SamplesIterator.
Referenced by DeleteGroup().
|
inherited |
Generates a new DLSID for the resource.
Definition at line 450 of file DLS.cpp.
References DLS::dlsid_t::abData, DLS::Resource::pDLSID, DLS::dlsid_t::ulData1, DLS::dlsid_t::usData2, and DLS::dlsid_t::usData3.
Referenced by AddInstrument(), and File().
bool gig::File::GetAutoLoad | ( | ) |
Returns whether automatic loading is enabled.
Definition at line 3950 of file gig.cpp.
Referenced by GetInstrument(), gig::Instrument::Instrument(), and gig::Region::Region().
|
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.
index | - index of extension file |
Definition at line 1447 of file DLS.cpp.
References DLS::File::ExtensionFiles.
|
inherited |
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.
Definition at line 1464 of file DLS.cpp.
References RIFF::File::GetFileName(), and DLS::File::pRIFF.
Group * gig::File::GetFirstGroup | ( | ) |
Returns a pointer to the first Group object of the file, NULL otherwise.
Definition at line 3642 of file gig.cpp.
References LoadGroups().
Referenced by gig::Group::MoveAll().
Instrument * gig::File::GetFirstInstrument | ( | ) |
Returns a pointer to the first Instrument object of the file, NULL otherwise.
Definition at line 3491 of file gig.cpp.
References DLS::File::InstrumentsIterator, LoadInstruments(), and DLS::File::pInstruments.
Referenced by DeleteSample(), and UpdateChunks().
|
inherited |
Returns a pointer to the first Sample object of the file, NULL otherwise.
Definition at line 1300 of file DLS.cpp.
References DLS::File::LoadSamples(), DLS::File::pSamples, and DLS::File::SamplesIterator.
Referenced by GetInstrument(), DLS::Region::GetSample(), and UpdateChunks().
Sample * gig::File::GetFirstSample | ( | progress_t * | pProgress = NULL | ) |
Returns a pointer to the first Sample object of the file, NULL otherwise.
Definition at line 3360 of file gig.cpp.
References LoadSamples(), DLS::File::pSamples, and DLS::File::SamplesIterator.
Referenced by gig::Group::GetFirstSample(), and gig::Region::GetSampleFromWavePool().
Group * gig::File::GetGroup | ( | uint | index | ) |
Returns the group with the given index.
index | - number of the sought group (0..n) |
Definition at line 3661 of file gig.cpp.
References LoadGroups().
Referenced by gig::Sample::Sample().
Instrument * gig::File::GetInstrument | ( | uint | index, |
progress_t * | pProgress = NULL |
||
) |
Returns the instrument with the given index.
index | - number of the sought instrument (0..n) |
pProgress | - optional: callback function for progress notification |
Definition at line 3511 of file gig.cpp.
References gig::progress_t::__range_max, gig::progress_t::__range_min, gig::progress_t::callback, GetAutoLoad(), DLS::File::GetFirstSample(), DLS::File::InstrumentsIterator, LoadInstruments(), and DLS::File::pInstruments.
Group * gig::File::GetNextGroup | ( | ) |
Returns a pointer to the next Group object of the file, NULL otherwise.
Definition at line 3649 of file gig.cpp.
Referenced by gig::Group::MoveAll().
Instrument * gig::File::GetNextInstrument | ( | ) |
Returns a pointer to the next Instrument object of the file, NULL otherwise.
Definition at line 3498 of file gig.cpp.
References DLS::File::InstrumentsIterator, and DLS::File::pInstruments.
Referenced by DeleteSample(), and UpdateChunks().
Sample * gig::File::GetNextSample | ( | ) |
Returns a pointer to the next Sample object of the file, NULL otherwise.
Definition at line 3367 of file gig.cpp.
References DLS::File::pSamples, and DLS::File::SamplesIterator.
Referenced by gig::Group::GetFirstSample(), gig::Group::GetNextSample(), gig::Region::GetSampleFromWavePool(), and UpdateChunks().
|
inlineinherited |
Definition at line 328 of file DLS.h.
References DLS::Resource::pParent.
Referenced by gig::Region::AddDimension(), DLS::Region::GetSample(), gig::Region::GetSampleFromWavePool(), gig::Region::Region(), DLS::Region::SetKeyRange(), gig::Region::SetKeyRange(), DLS::Region::UpdateChunks(), gig::DimensionRegion::UpdateChunks(), gig::Region::UpdateChunks(), gig::Instrument::UpdateChunks(), and gig::Sample::Write().
|
protectedvirtual |
Definition at line 3724 of file gig.cpp.
References CHUNK_ID_3GNM, RIFF::Chunk::GetChunkID(), RIFF::List::GetFirstSubChunk(), RIFF::List::GetNextSubChunk(), RIFF::List::GetSubList(), Group, LIST_TYPE_3GNL, LIST_TYPE_3GRI, RIFF::Chunk::LoadChunkData(), DLS::version_t::major, gig::Group::Name, DLS::File::pRIFF, and DLS::File::pVersion.
Referenced by AddGroup(), DeleteGroup(), DeleteGroupOnly(), GetFirstGroup(), GetGroup(), and LoadSamples().
|
protectedvirtual |
Reimplemented from DLS::File.
Definition at line 3586 of file gig.cpp.
Referenced by AddInstrument(), GetFirstInstrument(), and GetInstrument().
|
protectedvirtual |
Definition at line 3590 of file gig.cpp.
References RIFF::List::GetFirstSubList(), RIFF::List::GetListType(), RIFF::List::GetNextSubList(), RIFF::List::GetSubList(), DLS::File::Instruments, LIST_TYPE_INS, LIST_TYPE_LINS, DLS::File::pInstruments, and DLS::File::pRIFF.
|
protectedvirtual |
Reimplemented from DLS::File.
Definition at line 3431 of file gig.cpp.
Referenced by AddSample(), and GetFirstSample().
|
protectedvirtual |
Definition at line 3435 of file gig.cpp.
References DLS::File::ExtensionFiles, RIFF::File::GetFileName(), RIFF::Chunk::GetFilePos(), RIFF::List::GetFirstSubList(), RIFF::List::GetListType(), RIFF::List::GetNextSubList(), RIFF::List::GetSubList(), LIST_TYPE_WAVE, LIST_TYPE_WVPL, LoadGroups(), DLS::File::pRIFF, DLS::File::pSamples, DLS::File::pWavePoolTableHi, Sample, and DLS::File::WavePoolCount.
|
virtualinherited |
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.
Path | - path and file name where everything should be written to |
Definition at line 1542 of file DLS.cpp.
References DLS::File::pRIFF, RIFF::File::Save(), and DLS::File::UpdateChunks().
|
virtualinherited |
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.
RIFF::Exception | if any kind of IO error occured |
DLS::Exception | if any kind of DLS specific error occured |
Definition at line 1557 of file DLS.cpp.
References DLS::File::pRIFF, RIFF::File::Save(), and DLS::File::UpdateChunks().
void gig::File::SetAutoLoad | ( | bool | b | ) |
Enable / disable automatic loading.
By default this properyt is enabled and all informations are 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 informations will have invalid or even undefined data! This feature is currently only intended for retrieving very superficial informations in a very fast way. Don't use it to retrieve details like synthesis informations or even to modify .gig files!
|
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 3619 of file gig.cpp.
References CHUNK_ID_3CRC, RIFF::List::GetSubChunk(), DLS::File::pRIFF, DLS::File::pSamples, RIFF::Chunk::SetPos(), and RIFF::Chunk::WriteUint32().
Referenced by gig::Sample::Write().
|
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.
Exception | - on errors |
Reimplemented from DLS::File.
Definition at line 3761 of file gig.cpp.
References RIFF::List::AddSubChunk(), DLS::File::b64BitWavePoolOffsets, DLS::Sample::Channels, CHUNK_ID_3CRC, CHUNK_ID_3GNM, CHUNK_ID_EINF, GetFirstInstrument(), DLS::File::GetFirstSample(), RIFF::List::GetFirstSubChunk(), GetNextInstrument(), GetNextSample(), RIFF::List::GetNextSubChunk(), RIFF::Chunk::GetSize(), RIFF::List::GetSubChunk(), RIFF::List::GetSubList(), DLS::File::Instruments, LIST_TYPE_3GNL, LIST_TYPE_3GRI, LIST_TYPE_INFO, RIFF::Chunk::LoadChunkData(), DLS::version_t::major, RIFF::List::MoveSubChunk(), DLS::File::pRIFF, gig::DimensionRegion::pSample, DLS::File::pSamples, DLS::File::pVersion, RIFF::Chunk::Resize(), DLS::Sampler::SampleLoops, and DLS::File::UpdateChunks().
|
friend |
Definition at line 795 of file gig.h.
Referenced by AddGroup(), and LoadGroups().
|
friend |
Definition at line 794 of file gig.h.
Referenced by AddSample(), and LoadSamples().
|
protectedinherited |
Definition at line 501 of file DLS.h.
Referenced by DLS::File::__ensureMandatoryChunksExist(), DLS::File::File(), DLS::File::UpdateChunks(), and UpdateChunks().
|
protectedinherited |
Definition at line 492 of file DLS.h.
Referenced by DLS::File::GetExtensionFile(), LoadSamples(), and DLS::File::~File().
|
inherited |
Reflects the number of available Instrument objects.
Definition at line 469 of file DLS.h.
Referenced by DLS::File::File(), LoadInstruments(), DLS::File::UpdateChunks(), and UpdateChunks().
|
protectedinherited |
Definition at line 496 of file DLS.h.
Referenced by DLS::File::GetFirstInstrument(), GetFirstInstrument(), GetInstrument(), DLS::File::GetNextInstrument(), and GetNextInstrument().
|
inherited |
Points to a dlsid_t structure if the file provided a DLS ID else is NULL.
Definition at line 326 of file DLS.h.
Referenced by DLS::Resource::GenerateDLSID(), DLS::Resource::Resource(), DLS::Resource::UpdateChunks(), and DLS::Resource::~Resource().
|
inherited |
Points (in any case) to an Info object, providing additional, optional infos and comments.
Definition at line 325 of file DLS.h.
Referenced by AddInstrument(), File(), gig::Instrument::Instrument(), DLS::Resource::Resource(), gig::Sample::Sample(), DLS::Resource::UpdateChunks(), and DLS::Resource::~Resource().
|
protectedinherited |
Definition at line 495 of file DLS.h.
Referenced by DLS::File::AddInstrument(), AddInstrument(), DLS::File::DeleteInstrument(), DeleteInstrument(), DLS::File::File(), DLS::File::GetFirstInstrument(), GetFirstInstrument(), GetInstrument(), DLS::File::GetNextInstrument(), GetNextInstrument(), DLS::File::LoadInstruments(), LoadInstruments(), DLS::File::UpdateChunks(), and DLS::File::~File().
|
protectedinherited |
Definition at line 332 of file DLS.h.
Referenced by DLS::Resource::GetParent(), DLS::Resource::Resource(), gig::Sample::UpdateChunks(), DLS::Instrument::~Instrument(), DLS::Region::~Region(), and DLS::Sample::~Sample().
|
protectedinherited |
Definition at line 333 of file DLS.h.
Referenced by DLS::Resource::Resource(), and DLS::Resource::UpdateChunks().
|
protectedinherited |
Definition at line 491 of file DLS.h.
Referenced by DLS::File::__ensureMandatoryChunksExist(), DLS::File::AddInstrument(), AddInstrument(), DLS::File::AddSample(), AddSample(), DLS::File::File(), File(), DLS::File::GetFileName(), LoadGroups(), DLS::File::LoadInstruments(), LoadInstruments(), DLS::File::LoadSamples(), LoadSamples(), DLS::File::Save(), SetSampleChecksum(), DLS::File::UpdateChunks(), gig::Group::UpdateChunks(), and UpdateChunks().
|
protectedinherited |
Definition at line 493 of file DLS.h.
Referenced by DLS::File::AddSample(), AddSample(), DLS::File::DeleteSample(), DeleteSample(), DLS::File::File(), DLS::File::GetFirstSample(), GetFirstSample(), DLS::File::GetNextSample(), GetNextSample(), DLS::File::LoadSamples(), LoadSamples(), SetSampleChecksum(), DLS::Region::UpdateChunks(), DLS::File::UpdateChunks(), gig::Region::UpdateChunks(), UpdateChunks(), and DLS::File::~File().
|
inherited |
Points to a version_t structure if the file provided a version number else is set to NULL.
Definition at line 468 of file DLS.h.
Referenced by gig::Region::AddDimension(), DLS::File::File(), File(), LoadGroups(), gig::Region::Region(), gig::DimensionRegion::UpdateChunks(), DLS::File::UpdateChunks(), gig::Region::UpdateChunks(), gig::Instrument::UpdateChunks(), gig::Group::UpdateChunks(), UpdateChunks(), and DLS::File::~File().
|
protectedinherited |
Definition at line 499 of file DLS.h.
Referenced by DLS::File::File(), DLS::Region::GetSample(), gig::Region::GetSampleFromWavePool(), gig::Region::Region(), and DLS::File::~File().
|
protectedinherited |
Definition at line 500 of file DLS.h.
Referenced by DLS::File::File(), gig::Region::GetSampleFromWavePool(), LoadSamples(), and DLS::File::~File().
|
protectedinherited |
Definition at line 494 of file DLS.h.
Referenced by DeleteSample(), DLS::File::GetFirstSample(), GetFirstSample(), DLS::File::GetNextSample(), and GetNextSample().
|
static |
|
static |
|
protectedinherited |
Definition at line 498 of file DLS.h.
Referenced by DLS::File::File(), LoadSamples(), and DLS::File::UpdateChunks().
|
protectedinherited |
Definition at line 497 of file DLS.h.
Referenced by DLS::File::__ensureMandatoryChunksExist(), DLS::File::File(), and DLS::File::UpdateChunks().