#include <DLS.h>
Inheritance diagram for DLS::File:
Public Member Functions | |
File () | |
Constructor. | |
File (RIFF::File *pRIFF) | |
Constructor. | |
Sample * | GetFirstSample () |
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 * | AddInstrument () |
Add a new instrument definition. | |
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. | |
virtual | ~File () |
Resource * | GetParent () |
Public 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. | |
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. | |
Protected Types | |
typedef std::list< Sample * > | SampleList |
typedef std::list< Instrument * > | InstrumentList |
Protected Member Functions | |
virtual void | LoadSamples () |
virtual void | LoadInstruments () |
void | __ensureMandatoryChunksExist () |
Checks if all (for DLS) mandatory chunks exist, if not they will be created. | |
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 |
Resource * | pParent |
RIFF::List * | pResourceList |
Friends | |
class | Region |
Definition at line 467 of file DLS.h.
typedef std::list<Sample*> DLS::File::SampleList [protected] |
typedef std::list<Instrument*> DLS::File::InstrumentList [protected] |
DLS::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 in gig::File.
Definition at line 1017 of file DLS.cpp.
References b64BitWavePoolOffsets, DLS::version_t::build, Instruments, DLS::version_t::major, DLS::version_t::minor, pInstruments, pSamples, pVersion, pWavePoolTable, pWavePoolTableHi, DLS::version_t::release, WavePoolCount, and WavePoolHeaderSize.
DLS::File::File | ( | RIFF::File * | pRIFF | ) |
Constructor.
Load an existing DLS file.
Reimplemented in gig::File.
Definition at line 1045 of file DLS.cpp.
References b64BitWavePoolOffsets, CHUNK_ID_COLH, CHUNK_ID_PTBL, CHUNK_ID_VERS, RIFF::Chunk::GetSize(), RIFF::List::GetSubChunk(), Instruments, pInstruments, pRIFF, pSamples, pVersion, pWavePoolTable, pWavePoolTableHi, RIFF::Chunk::Read(), RIFF::Chunk::ReadUint32(), RIFF::Chunk::SetPos(), WavePoolCount, and WavePoolHeaderSize.
DLS::File::~File | ( | ) | [virtual] |
Reimplemented in gig::File.
Definition at line 1093 of file DLS.cpp.
References ExtensionFiles, pInstruments, pSamples, pVersion, pWavePoolTable, and pWavePoolTableHi.
Sample * DLS::File::GetFirstSample | ( | ) |
Returns a pointer to the first Sample object of the file, NULL otherwise.
Definition at line 1121 of file DLS.cpp.
References LoadSamples(), pSamples, and SamplesIterator.
Referenced by gig::File::GetInstrument(), DLS::Region::GetSample(), and PrintSamples().
Sample * DLS::File::GetNextSample | ( | ) |
Returns a pointer to the next Sample object of the file, NULL otherwise.
Reimplemented in gig::File.
Definition at line 1128 of file DLS.cpp.
References pSamples, and SamplesIterator.
Referenced by DLS::Region::GetSample(), and PrintSamples().
Sample * DLS::File::AddSample | ( | ) |
Add a new sample.
This will create a new Sample object for the DLS file. You have to call Save() to make this persistent to the file.
Reimplemented in gig::File.
Definition at line 1171 of file DLS.cpp.
References __ensureMandatoryChunksExist(), RIFF::List::AddSubList(), RIFF::List::GetSubList(), LIST_TYPE_WAVE, LIST_TYPE_WVPL, LoadSamples(), pRIFF, and pSamples.
void DLS::File::DeleteSample | ( | Sample * | pSample | ) |
Instrument * DLS::File::GetFirstInstrument | ( | ) |
Returns a pointer to the first Instrument object of the file, NULL otherwise.
Reimplemented in gig::File.
Definition at line 1197 of file DLS.cpp.
References InstrumentsIterator, LoadInstruments(), and pInstruments.
Referenced by PrintInstruments().
Instrument * DLS::File::GetNextInstrument | ( | ) |
Returns a pointer to the next Instrument object of the file, NULL otherwise.
Reimplemented in gig::File.
Definition at line 1204 of file DLS.cpp.
References InstrumentsIterator, and pInstruments.
Referenced by PrintInstruments().
Instrument * DLS::File::AddInstrument | ( | ) |
Add a new instrument definition.
This will create a new Instrument object for the DLS file. You have to call Save() to make this persistent to the file.
Reimplemented in gig::File.
Definition at line 1231 of file DLS.cpp.
References __ensureMandatoryChunksExist(), RIFF::List::AddSubList(), RIFF::List::GetSubList(), LIST_TYPE_INS, LIST_TYPE_LINS, LoadInstruments(), pInstruments, and pRIFF.
void DLS::File::DeleteInstrument | ( | Instrument * | pInstrument | ) |
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 1248 of file DLS.cpp.
References pInstruments.
void DLS::File::UpdateChunks | ( | ) | [virtual] |
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.
Exception | - on errors |
Reimplemented from DLS::Resource.
Definition at line 1263 of file DLS.cpp.
References RIFF::List::AddSubChunk(), b64BitWavePoolOffsets, CHUNK_ID_COLH, CHUNK_ID_PTBL, CHUNK_ID_VERS, RIFF::List::GetSubChunk(), Instruments, RIFF::Chunk::LoadChunkData(), pInstruments, pRIFF, pSamples, pVersion, RIFF::Chunk::Resize(), DLS::Resource::UpdateChunks(), WavePoolCount, and WavePoolHeaderSize.
Referenced by Save().
void DLS::File::Save | ( | const String & | Path | ) | [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.
Path | - path and file name where everything should be written to |
Definition at line 1327 of file DLS.cpp.
References pRIFF, RIFF::File::Save(), and UpdateChunks().
Referenced by GigWriteTest::createNewGigFile().
void DLS::File::Save | ( | ) | [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.
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 pRIFF, RIFF::File::Save(), and UpdateChunks().
void DLS::File::LoadSamples | ( | ) | [protected, virtual] |
Reimplemented in gig::File.
Definition at line 1134 of file DLS.cpp.
References RIFF::Chunk::GetFilePos(), RIFF::List::GetFirstSubList(), RIFF::List::GetListType(), RIFF::List::GetNextSubList(), RIFF::List::GetSubList(), LIST_TYPE_DWPL, LIST_TYPE_WAVE, LIST_TYPE_WVPL, pRIFF, and pSamples.
Referenced by AddSample(), and GetFirstSample().
void DLS::File::LoadInstruments | ( | ) | [protected, virtual] |
Reimplemented in gig::File.
Definition at line 1210 of file DLS.cpp.
References RIFF::List::GetFirstSubList(), RIFF::List::GetListType(), RIFF::List::GetNextSubList(), RIFF::List::GetSubList(), LIST_TYPE_INS, LIST_TYPE_LINS, pInstruments, and pRIFF.
Referenced by AddInstrument(), and GetFirstInstrument().
void DLS::File::__ensureMandatoryChunksExist | ( | ) | [protected] |
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(), b64BitWavePoolOffsets, CHUNK_ID_PTBL, RIFF::List::GetSubChunk(), RIFF::List::GetSubList(), LIST_TYPE_LINS, LIST_TYPE_WVPL, pRIFF, and WavePoolHeaderSize.
Referenced by gig::File::AddGroup(), gig::File::AddInstrument(), AddInstrument(), gig::File::AddSample(), and 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().
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(), File(), PrintFileInformations(), gig::Region::Region(), gig::Region::UpdateChunks(), UpdateChunks(), and ~File().
uint32_t DLS::File::Instruments |
Reflects the number of available Instrument objects.
Definition at line 470 of file DLS.h.
Referenced by File(), gig::File::LoadInstruments(), PrintFileInformations(), GigWriteTest::testArticulationsOfCreatedGigFile(), and UpdateChunks().
RIFF::File* DLS::File::pRIFF [protected] |
Definition at line 490 of file DLS.h.
Referenced by __ensureMandatoryChunksExist(), gig::File::AddInstrument(), AddInstrument(), gig::File::AddSample(), AddSample(), File(), gig::File::LoadGroups(), gig::File::LoadInstruments(), LoadInstruments(), gig::File::LoadSamples(), LoadSamples(), Save(), gig::Group::UpdateChunks(), and UpdateChunks().
std::list<RIFF::File*> DLS::File::ExtensionFiles [protected] |
SampleList* DLS::File::pSamples [protected] |
Definition at line 492 of file DLS.h.
Referenced by gig::File::AddSample(), AddSample(), gig::File::DeleteSample(), DeleteSample(), File(), gig::File::GetFirstSample(), GetFirstSample(), gig::File::GetNextSample(), GetNextSample(), gig::File::LoadSamples(), LoadSamples(), gig::Region::UpdateChunks(), UpdateChunks(), DLS::Region::UpdateChunks(), and ~File().
SampleList::iterator DLS::File::SamplesIterator [protected] |
Definition at line 493 of file DLS.h.
Referenced by gig::File::GetFirstSample(), GetFirstSample(), gig::File::GetNextSample(), and GetNextSample().
InstrumentList* DLS::File::pInstruments [protected] |
Definition at line 494 of file DLS.h.
Referenced by gig::File::AddInstrument(), AddInstrument(), gig::File::DeleteInstrument(), DeleteInstrument(), File(), gig::File::GetFirstInstrument(), GetFirstInstrument(), gig::File::GetInstrument(), gig::File::GetNextInstrument(), GetNextInstrument(), gig::File::LoadInstruments(), LoadInstruments(), UpdateChunks(), and ~File().
InstrumentList::iterator DLS::File::InstrumentsIterator [protected] |
Definition at line 495 of file DLS.h.
Referenced by gig::File::GetFirstInstrument(), GetFirstInstrument(), gig::File::GetInstrument(), gig::File::GetNextInstrument(), and GetNextInstrument().
uint32_t DLS::File::WavePoolHeaderSize [protected] |
Definition at line 496 of file DLS.h.
Referenced by __ensureMandatoryChunksExist(), File(), and UpdateChunks().
uint32_t DLS::File::WavePoolCount [protected] |
Definition at line 497 of file DLS.h.
Referenced by File(), gig::File::LoadSamples(), and UpdateChunks().
uint32_t* DLS::File::pWavePoolTable [protected] |
Definition at line 498 of file DLS.h.
Referenced by File(), DLS::Region::GetSample(), gig::Region::GetSampleFromWavePool(), gig::Region::Region(), and ~File().
uint32_t* DLS::File::pWavePoolTableHi [protected] |
Definition at line 499 of file DLS.h.
Referenced by File(), gig::Region::GetSampleFromWavePool(), gig::File::LoadSamples(), and ~File().
bool DLS::File::b64BitWavePoolOffsets [protected] |
Definition at line 500 of file DLS.h.
Referenced by __ensureMandatoryChunksExist(), File(), and 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(), gig::File::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] |