gig::File Class Reference

Parses Gigasampler files and provides abstract access to the data. More...

#include <gig.h>

Inheritance diagram for gig::File:

DLS::File DLS::Resource List of all members.

Public Member Functions

 File ()
 Constructor.
 File (RIFF::File *pRIFF)
 Constructor.
SampleGetFirstSample (progress_t *pProgress=NULL)
 Returns a pointer to the first Sample object of the file, NULL otherwise.
SampleGetNextSample ()
 Returns a pointer to the next Sample object of the file, NULL otherwise.
SampleAddSample ()
 Add a new sample.
void DeleteSample (Sample *pSample)
 Delete a sample.
InstrumentGetFirstInstrument ()
 Returns a pointer to the first Instrument object of the file, NULL otherwise.
InstrumentGetNextInstrument ()
 Returns a pointer to the next Instrument object of the file, NULL otherwise.
InstrumentGetInstrument (uint index, progress_t *pProgress=NULL)
 Returns the instrument with the given index.
InstrumentAddInstrument ()
 Add a new instrument definition.
void DeleteInstrument (Instrument *pInstrument)
 Delete an instrument.
GroupGetFirstGroup ()
 Returns a pointer to the first Group object of the file, NULL otherwise.
GroupGetNextGroup ()
 Returns a pointer to the next Group object of the file, NULL otherwise.
GroupGetGroup (uint index)
 Returns the group with the given index.
GroupAddGroup ()
void DeleteGroup (Group *pGroup)
virtual ~File ()

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)
SampleGetFirstSample ()
 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.
virtual void UpdateChunks ()
 Apply all the DLS file's current instruments, samples and settings to the respective RIFF chunks.
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 ()

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::FilepRIFF
std::list< RIFF::File * > ExtensionFiles
SampleListpSamples
SampleList::iterator SamplesIterator
InstrumentListpInstruments
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::ListpResourceList

Friends

class Region
class Sample
class Group

Detailed Description

Parses Gigasampler files and provides abstract access to the data.

Definition at line 683 of file gig.h.


Member Typedef Documentation

typedef std::list<Sample*> DLS::File::SampleList [protected, inherited]

Definition at line 487 of file DLS.h.

typedef std::list<Instrument*> DLS::File::InstrumentList [protected, inherited]

Definition at line 488 of file DLS.h.


Constructor & Destructor Documentation

gig::File::File (  ) 

Constructor.

Default constructor, use this to create an empty DLS file. You have to add samples, instruments and finally call Save() to actually write a DLS file.

Reimplemented from DLS::File.

Definition at line 2802 of file gig.cpp.

References DLS::Resource::pInfo.

gig::File::File ( RIFF::File pRIFF  ) 

Constructor.

Load an existing DLS file.

Parameters:
pRIFF - pointer to a RIFF file which is actually the DLS file to load
Exceptions:
Exception if given file is not a DLS file, expected chunks are missing

Reimplemented from DLS::File.

Definition at line 2807 of file gig.cpp.

References DLS::Resource::pInfo.

gig::File::~File (  )  [virtual]

Reimplemented from DLS::File.

Definition at line 2812 of file gig.cpp.


Member Function Documentation

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

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

Definition at line 2824 of file gig.cpp.

References LoadSamples(), DLS::File::pSamples, and DLS::File::SamplesIterator.

Referenced by ExtractSamples(), gig::Group::GetFirstSample(), gig::Region::GetSampleFromWavePool(), PrintSamples(), GigWriteTest::testArticulationsOfCreatedGigFile(), GigWriteTest::testSamplesData(), and GigWriteTest::testWriteSamples().

Sample * gig::File::GetNextSample (  ) 

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

Reimplemented from DLS::File.

Definition at line 2831 of file gig.cpp.

References DLS::File::pSamples, and DLS::File::SamplesIterator.

Referenced by ExtractSamples(), gig::Group::GetFirstSample(), gig::Group::GetNextSample(), gig::Region::GetSampleFromWavePool(), PrintSamples(), GigWriteTest::testArticulationsOfCreatedGigFile(), GigWriteTest::testSamplesData(), and GigWriteTest::testWriteSamples().

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

Reimplemented from DLS::File.

Definition at line 2844 of file gig.cpp.

References DLS::File::__ensureMandatoryChunksExist(), RIFF::List::AddSubList(), RIFF::List::GetSubList(), LIST_TYPE_WAVE, LIST_TYPE_WVPL, LoadSamples(), DLS::File::pRIFF, DLS::File::pSamples, and Sample.

Referenced by GigWriteTest::createNewGigFile().

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

Delete a sample.

This will delete the given Sample object from the gig file. 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 2863 of file gig.cpp.

References DLS::File::pSamples.

Instrument * gig::File::GetFirstInstrument (  ) 

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

Reimplemented from DLS::File.

Definition at line 2931 of file gig.cpp.

References DLS::File::InstrumentsIterator, LoadInstruments(), and DLS::File::pInstruments.

Referenced by PrintInstruments(), and GigWriteTest::testArticulationsOfCreatedGigFile().

Instrument * gig::File::GetNextInstrument (  ) 

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

Reimplemented from DLS::File.

Definition at line 2938 of file gig.cpp.

References DLS::File::InstrumentsIterator, and DLS::File::pInstruments.

Referenced by PrintInstruments(), and GigWriteTest::testArticulationsOfCreatedGigFile().

Instrument * gig::File::GetInstrument ( uint  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 2951 of file gig.cpp.

References gig::__divide_progress(), gig::__notify_progress(), gig::progress_t::__range_max, gig::progress_t::__range_min, gig::progress_t::callback, DLS::File::GetFirstSample(), DLS::File::InstrumentsIterator, LoadInstruments(), and DLS::File::pInstruments.

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

Reimplemented from DLS::File.

Definition at line 2987 of file gig.cpp.

References DLS::File::__ensureMandatoryChunksExist(), RIFF::List::AddSubList(), RIFF::List::GetSubList(), LIST_TYPE_INS, LIST_TYPE_LINS, LoadInstruments(), DLS::File::pInstruments, and DLS::File::pRIFF.

Referenced by GigWriteTest::createNewGigFile().

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::Excption if given instrument could not be found

Definition at line 3005 of file gig.cpp.

References DLS::File::pInstruments.

Group * gig::File::GetFirstGroup (  ) 

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

Definition at line 3043 of file gig.cpp.

References LoadGroups().

Referenced by gig::Group::MoveAll(), PrintGroups(), and PrintSamples().

Group * gig::File::GetNextGroup (  ) 

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

Definition at line 3050 of file gig.cpp.

Referenced by gig::Group::MoveAll(), PrintGroups(), and PrintSamples().

Group * gig::File::GetGroup ( uint  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 3062 of file gig.cpp.

References LoadGroups().

Referenced by gig::Sample::Sample().

Group * gig::File::AddGroup (  ) 

Definition at line 3072 of file gig.cpp.

References DLS::File::__ensureMandatoryChunksExist(), Group, and LoadGroups().

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

Definition at line 3081 of file gig.cpp.

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

void gig::File::LoadSamples (  )  [protected, virtual]

Reimplemented from DLS::File.

Definition at line 2871 of file gig.cpp.

Referenced by AddSample(), and GetFirstSample().

void gig::File::LoadInstruments (  )  [protected, virtual]

Reimplemented from DLS::File.

Definition at line 3013 of file gig.cpp.

Referenced by AddInstrument(), GetFirstInstrument(), and GetInstrument().

void gig::File::LoadGroups (  )  [protected, virtual]

Definition at line 3092 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, and DLS::File::pRIFF.

Referenced by AddGroup(), DeleteGroup(), GetFirstGroup(), GetGroup(), and LoadSamples().

void gig::File::LoadSamples ( progress_t pProgress  )  [protected, virtual]

Definition at line 2875 of file gig.cpp.

References gig::__notify_progress(), DLS::File::ExtensionFiles, RIFF::File::GetFileName(), RIFF::Chunk::GetFilePos(), 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.

void gig::File::LoadInstruments ( progress_t pProgress  )  [protected, virtual]

Definition at line 3017 of file gig.cpp.

References gig::__divide_progress(), gig::__notify_progress(), 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.

Sample * DLS::File::GetFirstSample (  )  [inherited]

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

Definition at line 1121 of file DLS.cpp.

References DLS::File::LoadSamples(), DLS::File::pSamples, and DLS::File::SamplesIterator.

Referenced by GetInstrument(), DLS::Region::GetSample(), and PrintSamples().

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

References DLS::File::pSamples.

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

References DLS::File::pInstruments.

void DLS::File::UpdateChunks (  )  [virtual, inherited]

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

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

Exceptions:
Exception - on errors

Reimplemented from DLS::Resource.

Definition at line 1263 of file DLS.cpp.

References RIFF::List::AddSubChunk(), DLS::File::b64BitWavePoolOffsets, CHUNK_ID_COLH, CHUNK_ID_PTBL, CHUNK_ID_VERS, RIFF::List::GetSubChunk(), DLS::File::Instruments, RIFF::Chunk::LoadChunkData(), DLS::File::pInstruments, DLS::File::pRIFF, DLS::File::pSamples, DLS::File::pVersion, RIFF::Chunk::Resize(), DLS::Resource::UpdateChunks(), DLS::File::WavePoolCount, and DLS::File::WavePoolHeaderSize.

Referenced by DLS::File::Save().

void DLS::File::Save ( const String Path  )  [virtual, inherited]

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

Definition at line 1327 of file DLS.cpp.

References DLS::File::pRIFF, RIFF::File::Save(), and DLS::File::UpdateChunks().

Referenced by GigWriteTest::createNewGigFile().

void DLS::File::Save (  )  [virtual, inherited]

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.

Exceptions:
RIFF::Exception if any kind of IO error occured
DLS::Exception if any kind of DLS specific error occured

Definition at line 1342 of file DLS.cpp.

References DLS::File::pRIFF, RIFF::File::Save(), and DLS::File::UpdateChunks().

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 1353 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(), AddInstrument(), DLS::File::AddInstrument(), AddSample(), and DLS::File::AddSample().

Resource* DLS::Resource::GetParent (  )  [inline, inherited]

Definition at line 337 of file DLS.h.

References DLS::Resource::pParent.

Referenced by gig::Region::AddDimension(), DLS::Region::GetSample(), gig::Region::GetSampleFromWavePool(), gig::Region::Region(), gig::Region::UpdateChunks(), and DLS::Region::UpdateChunks().


Friends And Related Function Documentation

friend class Region [friend]

Reimplemented from DLS::File.

Definition at line 722 of file gig.h.

friend class Sample [friend]

Definition at line 723 of file gig.h.

Referenced by AddSample(), and LoadSamples().

friend class Group [friend]

Definition at line 724 of file gig.h.

Referenced by AddGroup(), and LoadGroups().


Member Data Documentation

version_t* DLS::File::pVersion [inherited]

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

Definition at line 469 of file DLS.h.

Referenced by gig::Region::AddDimension(), DLS::File::File(), PrintFileInformations(), gig::Region::Region(), gig::Region::UpdateChunks(), DLS::File::UpdateChunks(), and DLS::File::~File().

uint32_t DLS::File::Instruments [inherited]

Reflects the number of available Instrument objects.

Definition at line 470 of file DLS.h.

Referenced by DLS::File::File(), LoadInstruments(), PrintFileInformations(), GigWriteTest::testArticulationsOfCreatedGigFile(), and DLS::File::UpdateChunks().

RIFF::File* DLS::File::pRIFF [protected, inherited]

Definition at line 490 of file DLS.h.

Referenced by DLS::File::__ensureMandatoryChunksExist(), AddInstrument(), DLS::File::AddInstrument(), AddSample(), DLS::File::AddSample(), DLS::File::File(), LoadGroups(), LoadInstruments(), DLS::File::LoadInstruments(), LoadSamples(), DLS::File::LoadSamples(), DLS::File::Save(), gig::Group::UpdateChunks(), and DLS::File::UpdateChunks().

std::list<RIFF::File*> DLS::File::ExtensionFiles [protected, inherited]

Definition at line 491 of file DLS.h.

Referenced by LoadSamples(), and DLS::File::~File().

SampleList* DLS::File::pSamples [protected, inherited]

Definition at line 492 of file DLS.h.

Referenced by AddSample(), DLS::File::AddSample(), DeleteSample(), DLS::File::DeleteSample(), DLS::File::File(), GetFirstSample(), DLS::File::GetFirstSample(), GetNextSample(), DLS::File::GetNextSample(), LoadSamples(), DLS::File::LoadSamples(), gig::Region::UpdateChunks(), DLS::File::UpdateChunks(), DLS::Region::UpdateChunks(), and DLS::File::~File().

SampleList::iterator DLS::File::SamplesIterator [protected, inherited]

Definition at line 493 of file DLS.h.

Referenced by GetFirstSample(), DLS::File::GetFirstSample(), GetNextSample(), and DLS::File::GetNextSample().

InstrumentList* DLS::File::pInstruments [protected, inherited]

Definition at line 494 of file DLS.h.

Referenced by AddInstrument(), DLS::File::AddInstrument(), DeleteInstrument(), DLS::File::DeleteInstrument(), DLS::File::File(), GetFirstInstrument(), DLS::File::GetFirstInstrument(), GetInstrument(), GetNextInstrument(), DLS::File::GetNextInstrument(), LoadInstruments(), DLS::File::LoadInstruments(), DLS::File::UpdateChunks(), and DLS::File::~File().

InstrumentList::iterator DLS::File::InstrumentsIterator [protected, inherited]

Definition at line 495 of file DLS.h.

Referenced by GetFirstInstrument(), DLS::File::GetFirstInstrument(), GetInstrument(), GetNextInstrument(), and DLS::File::GetNextInstrument().

uint32_t DLS::File::WavePoolHeaderSize [protected, inherited]

Definition at line 496 of file DLS.h.

Referenced by DLS::File::__ensureMandatoryChunksExist(), DLS::File::File(), and DLS::File::UpdateChunks().

uint32_t DLS::File::WavePoolCount [protected, inherited]

Definition at line 497 of file DLS.h.

Referenced by DLS::File::File(), LoadSamples(), and DLS::File::UpdateChunks().

uint32_t* DLS::File::pWavePoolTable [protected, inherited]

Definition at line 498 of file DLS.h.

Referenced by DLS::File::File(), DLS::Region::GetSample(), gig::Region::GetSampleFromWavePool(), gig::Region::Region(), and DLS::File::~File().

uint32_t* DLS::File::pWavePoolTableHi [protected, inherited]

Definition at line 499 of file DLS.h.

Referenced by DLS::File::File(), gig::Region::GetSampleFromWavePool(), LoadSamples(), and DLS::File::~File().

bool DLS::File::b64BitWavePoolOffsets [protected, inherited]

Definition at line 500 of file DLS.h.

Referenced by DLS::File::__ensureMandatoryChunksExist(), DLS::File::File(), and DLS::File::UpdateChunks().

Info* DLS::Resource::pInfo [inherited]

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

Definition at line 334 of file DLS.h.

Referenced by GigWriteTest::createNewGigFile(), ExtractSamples(), File(), gig::Instrument::Instrument(), main(), PrintDimensionRegions(), PrintFileInformations(), PrintInstruments(), PrintRegions(), PrintSamples(), gig::Region::Region(), DLS::Resource::Resource(), gig::Sample::Sample(), GigWriteTest::testArticulationsOfCreatedGigFile(), DLS::Resource::UpdateChunks(), and DLS::Resource::~Resource().

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 335 of file DLS.h.

Referenced by DLS::Resource::Resource(), and DLS::Resource::~Resource().

Resource* DLS::Resource::pParent [protected, inherited]

Definition at line 340 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().

RIFF::List* DLS::Resource::pResourceList [protected, inherited]

Definition at line 341 of file DLS.h.

Referenced by DLS::Resource::Resource().


The documentation for this class was generated from the following files:
Generated on Wed Dec 6 19:25:57 2006 for libgig by  doxygen 1.5.1