30 #include <CoreFoundation/CFUUID.h> 31 #elif defined(HAVE_UUID_UUID_H) 32 #include <uuid/uuid.h> 38 #define CONN_TRANSFORM_SRC(x) ((x >> 10) & 0x000F) 39 #define CONN_TRANSFORM_CTL(x) ((x >> 4) & 0x000F) 40 #define CONN_TRANSFORM_DST(x) (x & 0x000F) 41 #define CONN_TRANSFORM_BIPOLAR_SRC(x) (x & 0x4000) 42 #define CONN_TRANSFORM_BIPOLAR_CTL(x) (x & 0x0100) 43 #define CONN_TRANSFORM_INVERT_SRC(x) (x & 0x8000) 44 #define CONN_TRANSFORM_INVERT_CTL(x) (x & 0x0200) 47 #define CONN_TRANSFORM_SRC_ENCODE(x) ((x & 0x000F) << 10) 48 #define CONN_TRANSFORM_CTL_ENCODE(x) ((x & 0x000F) << 4) 49 #define CONN_TRANSFORM_DST_ENCODE(x) (x & 0x000F) 50 #define CONN_TRANSFORM_BIPOLAR_SRC_ENCODE(x) ((x) ? 0x4000 : 0) 51 #define CONN_TRANSFORM_BIPOLAR_CTL_ENCODE(x) ((x) ? 0x0100 : 0) 52 #define CONN_TRANSFORM_INVERT_SRC_ENCODE(x) ((x) ? 0x8000 : 0) 53 #define CONN_TRANSFORM_INVERT_CTL_ENCODE(x) ((x) ? 0x0200 : 0) 55 #define DRUM_TYPE_MASK 0x80000000 57 #define F_RGN_OPTION_SELFNONEXCLUSIVE 0x0001 59 #define F_WAVELINK_PHASE_MASTER 0x0001 60 #define F_WAVELINK_MULTICHANNEL 0x0002 62 #define F_WSMP_NO_TRUNCATION 0x0001 63 #define F_WSMP_NO_COMPRESSION 0x0002 65 #define MIDI_BANK_COARSE(x) ((x & 0x00007F00) >> 8) // CC0 66 #define MIDI_BANK_FINE(x) (x & 0x0000007F) // CC32 67 #define MIDI_BANK_MERGE(coarse, fine) ((((uint16_t) coarse) << 7) | fine) // CC0 + CC32 68 #define MIDI_BANK_ENCODE(coarse, fine) (((coarse & 0x0000007F) << 8) | (fine & 0x0000007F)) 119 pArticulationCk = artl;
130 for (uint32_t i = 0; i < Connections; i++) {
136 pConnections[i].Init(&connblock);
141 if (pConnections)
delete[] pConnections;
151 const int iEntrySize = 12;
152 pArticulationCk->Resize(HeaderSize + Connections * iEntrySize);
153 uint8_t* pData = (uint8_t*) pArticulationCk->LoadChunkData();
154 store16(&pData[0], HeaderSize);
155 store16(&pData[2], Connections);
156 for (uint32_t i = 0; i < Connections; i++) {
158 store16(&pData[HeaderSize + i * iEntrySize], c.
source);
159 store16(&pData[HeaderSize + i * iEntrySize + 2], c.
control);
160 store16(&pData[HeaderSize + i * iEntrySize + 4], c.
destination);
161 store16(&pData[HeaderSize + i * iEntrySize + 6], c.
transform);
162 store32(&pData[HeaderSize + i * iEntrySize + 8], c.
scale);
172 pParentList = ParentList;
173 pArticulations = NULL;
177 if (!pArticulations) LoadArticulations();
178 if (!pArticulations)
return NULL;
179 ArticulationsIterator = pArticulations->begin();
180 return (ArticulationsIterator != pArticulations->end()) ? *ArticulationsIterator : NULL;
184 if (!pArticulations)
return NULL;
185 ArticulationsIterator++;
186 return (ArticulationsIterator != pArticulations->end()) ? *ArticulationsIterator : NULL;
208 if (pArticulations) {
209 ArticulationList::iterator iter = pArticulations->begin();
210 ArticulationList::iterator end = pArticulations->end();
211 while (iter != end) {
215 delete pArticulations;
226 if (pArticulations) {
227 ArticulationList::iterator iter = pArticulations->begin();
228 ArticulationList::iterator end = pArticulations->end();
229 for (; iter != end; ++iter) {
230 (*iter)->UpdateChunks(pProgress);
256 pFixedStringLengths = NULL;
257 pResourceListChunk = list;
297 pFixedStringLengths = lengths;
327 if (pFixedStringLengths) {
328 for (
int i = 0 ; pFixedStringLengths[i].length ; i++) {
329 if (pFixedStringLengths[i].chunkId == ChunkID) {
330 size = pFixedStringLengths[i].length;
336 ::SaveString(ChunkID, ck, lstINFO, s, sDefault, size != 0, size);
347 if (!pResourceListChunk)
return;
353 String defaultCreationDate =
"";
354 String defaultSoftware =
"";
355 String defaultComments =
"";
357 uint32_t resourceType = pResourceListChunk->
GetListType();
363 defaultName =
"NONAME";
367 time_t now = time(NULL);
368 tm* pNowBroken = localtime(&now);
370 strftime(buf, 11,
"%F", pNowBroken);
371 defaultCreationDate = buf;
386 SaveString(
CHUNK_ID_ICMT, lstINFO, Comments, defaultComments);
388 SaveString(
CHUNK_ID_ICRD, lstINFO, CreationDate, defaultCreationDate);
396 SaveString(
CHUNK_ID_ISFT, lstINFO, Software, defaultSoftware);
427 pFixedStringLengths = orig->pFixedStringLengths;
446 pResourceList = lstResource;
448 pInfo =
new Info(lstResource);
453 ckDLSID->
Read(&pDLSID->ulData1, 1, 4);
454 ckDLSID->
Read(&pDLSID->usData2, 1, 2);
455 ckDLSID->
Read(&pDLSID->usData3, 1, 2);
456 ckDLSID->
Read(pDLSID->abData, 8, 1);
462 if (pDLSID)
delete pDLSID;
463 if (pInfo)
delete pInfo;
477 pInfo->UpdateChunks(pProgress);
482 if (!ckDLSID) ckDLSID = pResourceList->AddSubChunk(
CHUNK_ID_DLID, 16);
485 store32(&pData[0], pDLSID->ulData1);
486 store16(&pData[4], pDLSID->usData2);
487 store16(&pData[6], pDLSID->usData3);
488 memcpy(&pData[8], pDLSID->abData, 8);
496 #if defined(WIN32) || defined(__APPLE__) || defined(HAVE_UUID_GENERATE) 498 if (!pDLSID) pDLSID =
new dlsid_t;
504 pDLSID->ulData1 = uuid.Data1;
505 pDLSID->usData2 = uuid.Data2;
506 pDLSID->usData3 = uuid.Data3;
507 memcpy(pDLSID->abData, uuid.Data4, 8);
509 #elif defined(__APPLE__) 511 CFUUIDRef uuidRef = CFUUIDCreate(NULL);
512 CFUUIDBytes uuid = CFUUIDGetUUIDBytes(uuidRef);
514 pDLSID->ulData1 = uuid.byte0 | uuid.byte1 << 8 | uuid.byte2 << 16 | uuid.byte3 << 24;
515 pDLSID->usData2 = uuid.byte4 | uuid.byte5 << 8;
516 pDLSID->usData3 = uuid.byte6 | uuid.byte7 << 8;
517 pDLSID->abData[0] = uuid.byte8;
518 pDLSID->abData[1] = uuid.byte9;
519 pDLSID->abData[2] = uuid.byte10;
520 pDLSID->abData[3] = uuid.byte11;
521 pDLSID->abData[4] = uuid.byte12;
522 pDLSID->abData[5] = uuid.byte13;
523 pDLSID->abData[6] = uuid.byte14;
524 pDLSID->abData[7] = uuid.byte15;
528 pDLSID->ulData1 = uuid[0] | uuid[1] << 8 | uuid[2] << 16 | uuid[3] << 24;
529 pDLSID->usData2 = uuid[4] | uuid[5] << 8;
530 pDLSID->usData3 = uuid[6] | uuid[7] << 8;
531 memcpy(pDLSID->abData, &uuid[8], 8);
543 pInfo->CopyAssign(orig->
pInfo);
551 pParentList = ParentList;
570 pSampleLoops = (SampleLoops) ?
new sample_loop_t[SampleLoops] : NULL;
572 wsmp->
SetPos(uiHeaderSize);
573 for (uint32_t i = 0; i < SampleLoops; i++) {
574 wsmp->
Read(pSampleLoops + i, 4, 4);
583 if (pSampleLoops)
delete[] pSampleLoops;
599 int wsmpSize = uiHeaderSize + SampleLoops * 16;
602 }
else if (wsmp->
GetSize() != wsmpSize) {
607 store32(&pData[0], uiHeaderSize);
613 store16(&pData[4], UnityNote);
614 store16(&pData[6], FineTune);
615 store32(&pData[8], Gain);
616 store32(&pData[12], SamplerOptions);
617 store32(&pData[16], SampleLoops);
619 for (uint32_t i = 0; i < SampleLoops; i++) {
621 store32(&pData[uiHeaderSize + i * 16], pSampleLoops[i].Size);
622 store32(&pData[uiHeaderSize + i * 16 + 4], pSampleLoops[i].LoopType);
623 store32(&pData[uiHeaderSize + i * 16 + 8], pSampleLoops[i].LoopStart);
624 store32(&pData[uiHeaderSize + i * 16 + 12], pSampleLoops[i].LoopLength);
636 for (
int i = 0; i < SampleLoops; i++) {
637 pNewLoops[i] = pSampleLoops[i];
640 pNewLoops[SampleLoops] = *pLoopDef;
644 if (SampleLoops)
delete[] pSampleLoops;
645 pSampleLoops = pNewLoops;
658 for (
int i = 0, o = 0; i < SampleLoops; i++) {
659 if (&pSampleLoops[i] == pLoopDef)
continue;
660 if (o == SampleLoops - 1) {
662 throw Exception(
"Could not delete Sample Loop, because it does not exist");
664 pNewLoops[o] = pSampleLoops[i];
668 if (SampleLoops)
delete[] pSampleLoops;
669 pSampleLoops = pNewLoops;
689 if (SampleLoops)
delete[] pSampleLoops;
799 const int iReadAtOnce = 64*1024;
801 n = pOrig->
Read(&buf[i], n);
893 if (NewSize < 1)
throw Exception(
"Sample size must be at least one sample point");
894 if ((NewSize >> 48) != 0)
895 throw Exception(
"Unrealistic high DLS sample size detected");
920 if (!
pCkData)
throw Exception(
"No data chunk created for sample yet, call Sample::Resize() to create one");
923 return (result == orderedBytes) ? SampleCount
958 if (
GetSize() < SampleCount)
throw Exception(
"Could not write sample data, current sample size to small");
972 throw Exception(
"Could not save sample, only PCM format is supported");
975 throw Exception(
"Could not save sample, there is no sample data to save");
1008 rgnh->
Read(&
Layer, 1,
sizeof(uint16_t));
1085 if (!pInstrument->
pRegions)
return;
1090 Region* prev_region = NULL;
1092 Instrument::RegionList::iterator iter = pInstrument->
pRegions->begin();
1093 iter != pInstrument->
pRegions->end(); iter++
1095 if ((*iter)->KeyRange.low > this->KeyRange.low) {
1099 prev_region = *iter;
1103 if (prev_region !=
this) pInstrument->MoveRegion(
this, r);
1149 File::SampleList::iterator iter = pFile->
pSamples->begin();
1150 File::SampleList::iterator end = pFile->
pSamples->end();
1151 for (
int i = 0; iter != end; ++iter, i++) {
1229 insh->
Read(&locale, 2, 4);
1284 void Instrument::MoveRegion(
Region* pSrc,
Region* pDst) {
1289 RegionList::iterator iter = find(
pRegions->begin(),
pRegions->end(), pDst);
1295 RegionList::iterator iter = find(
pRegions->begin(),
pRegions->end(), pRegion);
1296 if (iter ==
pRegions->end())
return;
1325 store32(&pData[4], locale.
bank);
1329 RegionList::iterator iter =
pRegions->begin();
1330 RegionList::iterator end =
pRegions->end();
1331 for (
int i = 0; iter != end; ++iter, ++i) {
1334 __divide_progress(pProgress, &subprogress,
pRegions->size(), i);
1336 (*iter)->UpdateChunks(&subprogress);
1338 __notify_progress(pProgress, 1.0);
1348 RegionList::iterator iter =
pRegions->begin();
1349 RegionList::iterator end =
pRegions->end();
1350 while (iter != end) {
1389 RegionList::const_iterator it = orig->
pRegions->begin();
1390 for (
int i = 0; i < orig->
Regions; ++i, ++it) {
1438 if (!pRIFF)
throw DLS::Exception(
"NULL pointer reference to RIFF::File object.");
1439 this->pRIFF =
pRIFF;
1449 if (!colh)
throw DLS::Exception(
"Mandatory chunks in RIFF list chunk not found.");
1490 while (iter != end) {
1498 SampleList::iterator iter =
pSamples->begin();
1499 SampleList::iterator end =
pSamples->end();
1500 while (iter != end) {
1536 pSamples->push_back(
new Sample(
this, wave, waveFileOffset - wvplFileOffset));
1549 pSamples->push_back(
new Sample(
this, wave, waveFileOffset - dwplFileOffset));
1584 SampleList::iterator iter = find(
pSamples->begin(),
pSamples->end(), pSample);
1585 if (iter ==
pSamples->end())
return;
1606 if (lstInstruments) {
1665 if (i == index)
return *iter;
1724 __divide_progress(pProgress, &subprogress, 20.f, 0.f);
1729 for (
int i = 0; iter != end; ++iter, ++i) {
1732 __divide_progress(&subprogress, &subsubprogress,
pInstruments->size(), i);
1734 (*iter)->UpdateChunks(&subsubprogress);
1737 __notify_progress(&subprogress, 1.0);
1757 __divide_progress(pProgress, &subprogress, 20.f, 1.f);
1760 SampleList::iterator iter =
pSamples->begin();
1761 SampleList::iterator end =
pSamples->end();
1762 for (
int i = 0; iter != end; ++iter, ++i) {
1765 __divide_progress(&subprogress, &subsubprogress,
pSamples->size(), i);
1767 (*iter)->UpdateChunks(&subsubprogress);
1770 __notify_progress(&subprogress, 1.0);
1778 const bool bRequires64Bit = (finalFileSize >> 32) != 0;
1782 iPtblSize = WavePoolHeaderSize + iPtblOffsetSize * iSamples;
1786 __notify_progress(pProgress, 1.0);
1807 __divide_progress(pProgress, &subprogress, 2.f, 0.f);
1815 __divide_progress(pProgress, &subprogress, 2.f, 1.f);
1820 __notify_progress(pProgress, 1.0);
1837 __divide_progress(pProgress, &subprogress, 2.f, 0.f);
1844 __divide_progress(pProgress, &subprogress, 2.f, 1.f);
1849 __notify_progress(pProgress, 1.0);
1863 __UpdateWavePoolTableChunk();
1895 void File::__UpdateWavePoolTableChunk() {
1896 __UpdateWavePoolTable();
1902 if (ptbl->
GetSize() < ulRequiredSize)
throw Exception(
"Fatal error, 'ptbl' chunk too small");
1927 ptbl->
SetPos(ullOriginalPos);
1935 void File::__UpdateWavePoolTable() {
1945 uint64_t wvplFileOffset = wvpl->
GetFilePos();
1947 SampleList::iterator iter =
pSamples->begin();
1948 SampleList::iterator end =
pSamples->end();
1949 for (
int i = 0 ; iter != end ; ++iter, i++) {
1951 (*iter)->ullWavePoolOffset = _64BitOffset;
1956 SampleList::iterator iter =
pSamples->begin();
1957 SampleList::iterator end =
pSamples->end();
1958 for (
int i = 0 ; iter != end ; ++iter, i++) {
1960 (*iter)->ullWavePoolOffset = _64BitOffset;
1975 std::cout <<
"DLS::Exception: " <<
Message << std::endl;
file_offset_t WriteUint32(uint32_t *pData, file_offset_t WordCount=1)
Writes WordCount number of 32 Bit unsigned integer words from the buffer pointed by pData to the chun...
virtual void CopyAssign(const Instrument *orig)
Make a (semi) deep copy of the Instrument object given by orig and assign it to this object...
#define CONN_TRANSFORM_BIPOLAR_CTL_ENCODE(x)
uint16_t BlockAlign
The block alignment (in bytes) of the waveform data. Playback software needs to process a multiple of...
file_offset_t GetFilePos() const
Current, actual offset of chunk data body start in file.
#define LIST_TYPE_DWPL
Seen on some files instead of a wvpl list chunk.
sample_loop_t * pSampleLoops
Points to the beginning of a sample loop array, or is NULL if there are no loops defined.
uint32_t Regions
Reflects the number of Region defintions this Instrument has.
File * GetFile() const
Returns pointer to the chunk's File object.
Parses DLS Level 1 and 2 compliant files and provides abstract access to the data.
file_offset_t ReadUint16(uint16_t *pData, file_offset_t WordCount=1)
Reads WordCount number of 16 Bit unsigned integer words and copies it into the buffer pointed by pDat...
stream_whence_t
File stream position dependent to these relations.
String CreationDate
<ICRD-ck>. Specifies the date the subject of the file was created. List dates in yyyy-mm-dd format...
Chunk * GetFirstSubChunk()
Returns the first subchunk within the list (which may be an ordinary chunk as well as a list chunk)...
#define F_WAVELINK_PHASE_MASTER
String GetFileName() const
String Engineer
<IENG-ck>. Stores the name of the engineer who worked on the file. Multiple engineer names are separa...
virtual void SetKeyRange(uint16_t Low, uint16_t High)
Modifies the key range of this Region and makes sure the respective chunks are in correct order...
void __ensureMandatoryChunksExist()
Checks if all (for DLS) mandatory chunks exist, if not they will be created.
String Artists
<IART-ck>. Lists the artist of the original subject of the file.
Sample * GetFirstSample()
Returns a pointer to the first Sample object of the file, NULL otherwise.
file_offset_t SetPos(file_offset_t SampleCount, RIFF::stream_whence_t Whence=RIFF::stream_start)
Sets the position within the sample (in sample points, not in bytes).
Instrument * GetNextInstrument()
Returns a pointer to the next Instrument object of the file, NULL otherwise.
Will be thrown whenever a DLS specific error occurs while trying to access a DLS File.
file_offset_t ReadInt32(int32_t *pData, file_offset_t WordCount=1)
Reads WordCount number of 32 Bit signed integer words and copies it into the buffer pointed by pData...
conn_trn_t SourceTransform
Optional information for DLS files, instruments, samples, etc.
virtual void CopyAssign(const Region *orig)
Make a (semi) deep copy of the Region object given by orig and assign it to this object.
virtual void UpdateChunks(progress_t *pProgress)
Update chunks with current Resource data.
#define CONN_TRANSFORM_INVERT_SRC_ENCODE(x)
RIFF::File * GetExtensionFile(int index)
Returns extension file of given index.
virtual ~Region()
Destructor.
Instrument * AddInstrument()
Add a new instrument definition.
Instrument * GetFirstInstrument()
Returns a pointer to the first Instrument object of the file, NULL otherwise.
String Keywords
<IKEY-ck>. Provides a list of keywords that refer to the file or subject of the file. Keywords are separated with semicolon and blank, e.g., FX; death; murder.
file_offset_t ullWavePoolOffset
#define DLS_WAVE_FORMAT_PCM
#define CONN_TRANSFORM_DST(x)
std::list< Articulation * > ArticulationList
conn_src_t
Connection Sources.
#define CONN_TRANSFORM_SRC_ENCODE(x)
List * GetParent() const
Returns pointer to the chunk's parent list chunk.
uint32_t * pWavePoolTable
uint32_t WavePoolTableIndex
uint16_t Channels
Number of channels represented in the waveform data, e.g. 1 for mono, 2 for stereo (defaults to 1=mon...
#define CONN_TRANSFORM_BIPOLAR_SRC(x)
RIFF::List * pCkInstrument
file_offset_t SamplesTotal
Reflects total number of sample points (only if known sample data format is used, 0 otherwise)...
String SourceForm
<ISRF-ck>. Identifies the original form of the material that was digitized, such as record...
Sampler(RIFF::List *ParentList)
List * GetSubList(uint32_t ListType)
Returns sublist chunk with list type ListType within this chunk list.
void DeleteSubChunk(Chunk *pSubChunk)
Removes a sub chunk.
Defines Sample Loop Points.
virtual ~Sample()
Destructor.
virtual void LoadSamples()
uint16_t MIDIBank
Reflects combination of MIDIBankCoarse and MIDIBankFine (bank 1 - bank 16384). Do not change this val...
virtual void SetGain(int32_t gain)
#define CONN_TRANSFORM_BIPOLAR_CTL(x)
void LoadString(RIFF::Chunk *ck, std::string &s, int strLength)
List * GetFirstSubList()
Returns the first sublist within the list (that is a subchunk with chunk ID "LIST").
file_offset_t GetPos() const
Position within the chunk data body (starting with 0).
#define MIDI_BANK_MERGE(coarse, fine)
#define MIDI_BANK_FINE(x)
virtual void CopyAssign(const Info *orig)
Make a deep copy of the Info object given by orig and assign it to this object.
std::list< Sample * > SampleList
InstrumentList::iterator InstrumentsIterator
uint8_t MIDIBankCoarse
Reflects the MIDI Bank number for MIDI Control Change 0 (bank 1 - 128).
void GenerateDLSID()
Generates a new DLSID for the resource.
uint FrameSize
Reflects the size (in bytes) of one single sample point (only if known sample data format is used...
#define MIDI_BANK_COARSE(x)
Every subject of an DLS file and the file itself can have an unique, computer generated ID...
#define F_WAVELINK_MULTICHANNEL
virtual void CopyAssign(const Sample *orig)
Make a deep copy of the Sample object given by orig and assign it to this object. ...
Region * GetFirstRegion()
void DeleteSampleLoop(sample_loop_t *pLoopDef)
Deletes an existing sample loop.
virtual ~Instrument()
Destructor.
uint16_t low
Low value of range.
void SetByteOrder(endian_t Endian)
Set the byte order to be used when saving.
#define CONN_TRANSFORM_BIPOLAR_SRC_ENCODE(x)
bool b64BitWavePoolOffsets
file_offset_t RemainingBytes() const
Returns the number of bytes left to read in the chunk body.
void SetFixedStringLengths(const string_length_t *lengths)
Forces specific Info fields to be of a fixed length when being saved to a file.
uint16_t FormatTag
Format ID of the waveform data (should be DLS_WAVE_FORMAT_PCM for DLS1 compliant files, this is also the default value if Sample was created with Instrument::AddSample()).
file_offset_t Read(void *pData, file_offset_t WordCount, file_offset_t WordSize)
Reads WordCount number of data words with given WordSize and copies it into a buffer pointed by pData...
virtual void CopyAssign(const Sampler *orig)
Make a deep copy of the Sampler object given by orig and assign it to this object.
void ReleaseSampleData()
Free sample data from RAM.
file_offset_t GetSize() const
Chunk size in bytes (without header, thus the chunk data body)
virtual void CopyAssign(const Articulator *orig)
Not yet implemented in this version, since the .gig format does not need to copy DLS articulators and...
Abstract base class which provides mandatory informations about sample players in general...
String libraryName()
Returns the name of this C++ library.
Exception(String Message)
file_offset_t SetPos(file_offset_t Where, stream_whence_t Whence=stream_start)
Sets the position within the chunk body, thus within the data portion of the chunk (in bytes)...
#define CONN_TRANSFORM_DST_ENCODE(x)
conn_trn_t
Connection Transforms.
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...
uint32_t SampleLoops
Reflects the number of sample loops.
conn_trn_t DestinationTransform
virtual void Save(const String &Path, progress_t *pProgress=NULL)
Save changes to another file.
void Resize(file_offset_t NewSize)
Resize sample.
conn_dst_t
Connection Destinations.
bool NoSampleDepthTruncation
void DeleteSample(Sample *pSample)
Delete a sample.
uint16_t high
High value of range.
Articulation * GetFirstArticulation()
file_offset_t ReadUint32(uint32_t *pData, file_offset_t WordCount=1)
Reads WordCount number of 32 Bit unsigned integer words and copies it into the buffer pointed by pDat...
uint32_t Size
For internal usage only: usually reflects exactly sizeof(sample_loop_t), otherwise if the value is la...
Chunk * GetSubChunk(uint32_t ChunkID)
Returns subchunk with chunk ID ChunkID within this chunk list.
Chunk * GetNextSubChunk()
Returns the next subchunk within the list (which may be an ordinary chunk as well as a list chunk)...
Info(RIFF::List *list)
Constructor.
std::list< Instrument * > InstrumentList
Region(Instrument *pInstrument, RIFF::List *rgnList)
virtual void Save(progress_t *pProgress=NULL)
Save changes to same file.
String Source
<ISRC-ck>. Identifies the name of the person or organization who supplied the original subject of the...
uint16_t BitDepth
Size of each sample per channel (only if known sample data format is used, 0 otherwise).
#define F_WSMP_NO_COMPRESSION
#define CONN_TRANSFORM_SRC(x)
Sample(File *pFile, RIFF::List *waveList, file_offset_t WavePoolOffset)
Constructor.
uint32_t MIDIProgram
Specifies the MIDI Program Change Number this Instrument should be assigned to.
file_offset_t GetRequiredFileSize()
Returns the required size (in bytes) for this RIFF File to be saved to disk.
virtual void UpdateChunks(progress_t *pProgress)
Update chunks with current info values.
String Commissioned
<ICMS-ck>. Lists the name of the person or organization that commissioned the subject of the file...
uint32_t GetChunkID() const
Chunk ID in unsigned integer representation.
#define LIST_HEADER_SIZE(fileOffsetSize)
friend class Articulation
#define F_RGN_OPTION_SELFNONEXCLUSIVE
void SetSample(Sample *pSample)
Assign another sample to this Region.
Used for indicating the progress of a certain task.
SampleList::iterator SamplesIterator
Articulation * GetNextArticulation()
file_offset_t Write(void *pData, file_offset_t WordCount, file_offset_t WordSize)
Writes WordCount number of data words with given WordSize from the buffer pointed by pData...
#define CONN_TRANSFORM_INVERT_CTL_ENCODE(x)
uint16_t WaveLinkOptionFlags
#define F_WSMP_NO_TRUNCATION
#define CONN_TRANSFORM_CTL(x)
#define MIDI_BANK_ENCODE(coarse, fine)
virtual void UpdateChunks(progress_t *pProgress)
Apply Instrument with all its Regions to the respective RIFF chunks.
#define CONN_TRANSFORM_INVERT_SRC(x)
void DeleteInstrument(Instrument *pInstrument)
Delete an instrument.
int GetFileOffsetSize() const
Returns the current size (in bytes) of file offsets stored in the headers of all chunks of this file...
version_t * pVersion
Points to a version_t structure if the file provided a version number else is set to NULL...
String Technician
<ITCH-ck>. Identifies the technician who sampled the subject file.
Instrument(File *pFile, RIFF::List *insList)
Constructor.
RegionList::iterator RegionsIterator
void SetFileName(const String &path)
file_offset_t GetSize() const
Returns sample size.
void * LoadChunkData()
Load chunk body into RAM.
uint32_t AverageBytesPerSecond
The average number of bytes per second at which the waveform data should be transferred (Playback sof...
uint8_t MIDIBankFine
Reflects the MIDI Bank number for MIDI Control Change 32 (bank 1 - 128).
uint32_t WavePoolHeaderSize
virtual void UpdateChunks(progress_t *pProgress)
Apply all articulations to the respective RIFF chunks.
Abstract base class which encapsulates data structures which all DLS resources are able to provide...
void Resize(file_offset_t NewSize)
Resize chunk.
void Init(conn_block_t *Header)
List * AddSubList(uint32_t uiListType)
Creates a new list sub chunk.
InstrumentList * pInstruments
virtual void LoadInstruments()
RIFF specific classes and definitions.
virtual void UpdateChunks(progress_t *pProgress)
Apply all sample player options to the respective RIFF chunk.
String Software
<ISFT-ck>. Identifies the name of the sofware package used to create the file.
#define CONN_TRANSFORM_CTL_ENCODE(x)
String ArchivalLocation
<IARL-ck>. Indicates where the subject of the file is stored.
Encapsulates sample waves used for playback.
Sample * GetNextSample()
Returns a pointer to the next Sample object of the file, NULL otherwise.
void MoveSubChunk(Chunk *pSrc, Chunk *pDst)
Moves a sub chunk witin this list.
String Name
<INAM-ck>. Stores the title of the subject of the file, such as, Seattle From Above.
uint32_t SamplesPerSecond
Sampling rate at which each channel should be played (defaults to 44100 if Sample was created with In...
String Product
<IPRD-ck>. Specifies the name of the title the file was originally intended for, such as World Ruler ...
String GetFileName()
File name of this DLS file.
String Medium
<IMED-ck>. Describes the original subject of the file, such as, record, CD, and so forth...
String Subject
<ISBJ-ck>. Describes the contents of the file.
virtual void LoadRegions()
file_offset_t Read(void *pBuffer, file_offset_t SampleCount)
Reads SampleCount number of sample points from the current position into the buffer pointed by pBuffe...
void CopyAssignCore(const Sample *orig)
Make a deep copy of the Sample object given by orig (without the actual sample waveform data however)...
conn_block_t ToConnBlock()
void ReleaseChunkData()
Free loaded chunk body from RAM.
void DeleteRegion(Region *pRegion)
Abstract base class for classes that provide articulation information (thus for Instrument and Region...
conn_trn_t ControlTransform
virtual void UpdateChunks(progress_t *pProgress)
Apply sample and its settings to the respective RIFF chunks.
Provides access to the defined connections used for the synthesis model.
virtual void UpdateChunks(progress_t *pProgress)
Apply articulation connections to the respective RIFF chunks.
#define CONN_TRANSFORM_INVERT_CTL(x)
uint32_t Instruments
Reflects the number of available Instrument objects.
String Genre
<IGNR-ck>. Descirbes the original work, such as, Jazz, Classic, Rock, Techno, Rave, etc.
Provides all neccessary information for the synthesis of a DLS Instrument.
Quadtuple version number ("major.minor.release.build").
virtual void CopyAssign(const Resource *orig)
Make a deep copy of the Resource object given by orig and assign it to this object.
String Copyright
<ICOP-ck>. Records the copyright information for the file.
file_offset_t Write(void *pBuffer, file_offset_t SampleCount)
Write sample wave data.
Sample * AddSample()
Add a new sample.
void CopyAssignCore(const Instrument *orig)
uint32_t GetListType() const
Returns unsigned integer representation of the list's ID.
DLS specific classes and definitions.
Info * pInfo
Points (in any case) to an Info object, providing additional, optional infos and comments.
RIFF::file_offset_t file_offset_t
String libraryVersion()
Returns version of this C++ library.
Defines a connection within the synthesis model.
file_offset_t ReadInt16(int16_t *pData, file_offset_t WordCount=1)
Reads WordCount number of 16 Bit signed integer words and copies it into the buffer pointed by pData...
uint16_t FormatOptionFlags
uint32_t * pWavePoolTableHi
virtual void UpdateChunks(progress_t *pProgress)
Apply Region settings to the respective RIFF chunks.
String Comments
<ICMT-ck>. Provides general comments about the file or the subject of the file. Sentences might end w...
Articulator(RIFF::List *ParentList)
List * GetNextSubList()
Returns the next sublist (that is a subchunk with chunk ID "LIST") within the list.
Defines Region information of an Instrument.
std::list< RIFF::File * > ExtensionFiles
Articulation(RIFF::Chunk *artl)
Constructor.
Chunk * AddSubChunk(uint32_t uiChunkID, file_offset_t ullBodySize)
Creates a new sub chunk.
bool IsDrum
Indicates if the Instrument is a drum type, as they differ in the synthesis model of DLS from melodic...
std::list< Region * > RegionList
virtual void UpdateChunks(progress_t *pProgress)
Apply all the DLS file's current instruments, samples and settings to the respective RIFF chunks...
void * LoadSampleData()
Load sample data into RAM.
void AddSampleLoop(sample_loop_t *pLoopDef)
Adds a new sample loop with the provided loop definition.
virtual void UpdateFileOffsets()
Updates all file offsets stored all over the file.
Resource(Resource *Parent, RIFF::List *lstResource)
Constructor.