37 #define INITIAL_SAMPLE_BUFFER_SIZE 512000 // 512 kB
40 #define GIG_EXP_DECODE(x) (pow(1.000000008813822, x))
41 #define GIG_EXP_ENCODE(x) (log(x) / log(1.000000008813822))
42 #define GIG_PITCH_TRACK_EXTRACT(x) (!(x & 0x01))
43 #define GIG_PITCH_TRACK_ENCODE(x) ((x) ? 0x00 : 0x01)
44 #define GIG_VCF_RESONANCE_CTRL_EXTRACT(x) ((x >> 4) & 0x03)
45 #define GIG_VCF_RESONANCE_CTRL_ENCODE(x) ((x & 0x03) << 4)
46 #define GIG_EG_CTR_ATTACK_INFLUENCE_EXTRACT(x) ((x >> 1) & 0x03)
47 #define GIG_EG_CTR_DECAY_INFLUENCE_EXTRACT(x) ((x >> 3) & 0x03)
48 #define GIG_EG_CTR_RELEASE_INFLUENCE_EXTRACT(x) ((x >> 5) & 0x03)
49 #define GIG_EG_CTR_ATTACK_INFLUENCE_ENCODE(x) ((x & 0x03) << 1)
50 #define GIG_EG_CTR_DECAY_INFLUENCE_ENCODE(x) ((x & 0x03) << 3)
51 #define GIG_EG_CTR_RELEASE_INFLUENCE_ENCODE(x) ((x & 0x03) << 5)
66 static void __notify_progress(
progress_t* pProgress,
float subprogress) {
67 if (pProgress && pProgress->
callback) {
69 const float totalprogress = pProgress->
__range_min + subprogress * totalrange;
70 pProgress->
factor = totalprogress;
76 static void __divide_progress(progress_t* pParentProgress, progress_t* pSubProgress,
float totalTasks,
float currentTask) {
77 if (pParentProgress && pParentProgress->callback) {
78 const float totalrange = pParentProgress->__range_max - pParentProgress->__range_min;
79 pSubProgress->callback = pParentProgress->callback;
80 pSubProgress->custom = pParentProgress->custom;
81 pSubProgress->__range_min = pParentProgress->__range_min + totalrange * currentTask / totalTasks;
82 pSubProgress->__range_max = pSubProgress->__range_min + totalrange / totalTasks;
92 inline int get12lo(
const unsigned char* pSrc)
94 const int x = pSrc[0] | (pSrc[1] & 0x0f) << 8;
95 return x & 0x800 ? x - 0x1000 : x;
98 inline int get12hi(
const unsigned char* pSrc)
100 const int x = pSrc[1] >> 4 | pSrc[2] << 4;
101 return x & 0x800 ? x - 0x1000 : x;
104 inline int16_t get16(
const unsigned char* pSrc)
106 return int16_t(pSrc[0] | pSrc[1] << 8);
109 inline int get24(
const unsigned char* pSrc)
111 const int x = pSrc[0] | pSrc[1] << 8 | pSrc[2] << 16;
112 return x & 0x800000 ? x - 0x1000000 : x;
115 inline void store24(
unsigned char* pDst,
int x)
122 void Decompress16(
int compressionmode,
const unsigned char* params,
123 int srcStep,
int dstStep,
124 const unsigned char* pSrc, int16_t* pDst,
125 unsigned long currentframeoffset,
126 unsigned long copysamples)
128 switch (compressionmode) {
130 pSrc += currentframeoffset * srcStep;
131 while (copysamples) {
140 int y = get16(params);
141 int dy = get16(params + 2);
142 while (currentframeoffset) {
146 currentframeoffset--;
148 while (copysamples) {
160 void Decompress24(
int compressionmode,
const unsigned char* params,
161 int dstStep,
const unsigned char* pSrc, uint8_t* pDst,
162 unsigned long currentframeoffset,
163 unsigned long copysamples,
int truncatedBits)
165 int y, dy, ddy, dddy;
167 #define GET_PARAMS(params) \
169 dy = y - get24((params) + 3); \
170 ddy = get24((params) + 6); \
171 dddy = get24((params) + 9)
173 #define SKIP_ONE(x) \
179 #define COPY_ONE(x) \
181 store24(pDst, y << truncatedBits); \
184 switch (compressionmode) {
186 pSrc += currentframeoffset * 3;
187 while (copysamples) {
188 store24(pDst, get24(pSrc) << truncatedBits);
197 while (currentframeoffset) {
200 currentframeoffset--;
202 while (copysamples) {
211 while (currentframeoffset > 1) {
215 currentframeoffset -= 2;
217 if (currentframeoffset) {
219 currentframeoffset--;
226 while (copysamples > 1) {
239 while (currentframeoffset) {
241 currentframeoffset--;
243 while (copysamples) {
251 const int bytesPerFrame[] = { 4096, 2052, 768, 524, 396, 268 };
252 const int bytesPerFrameNoHdr[] = { 4096, 2048, 768, 512, 384, 256 };
253 const int headerSize[] = { 0, 4, 0, 12, 12, 12 };
254 const int bitsPerSample[] = { 16, 8, 24, 16, 12, 8 };
262 static uint32_t* __initCRCTable() {
263 static uint32_t res[256];
265 for (
int i = 0 ; i < 256 ; i++) {
267 for (
int j = 0 ; j < 8 ; j++) {
268 c = (c & 1) ? 0xedb88320 ^ (c >> 1) : c >> 1;
275 static const uint32_t* __CRCTable = __initCRCTable();
282 inline static void __resetCRC(uint32_t& crc) {
305 static void __calculateCRC(
unsigned char* buf,
int bufSize, uint32_t& crc) {
306 for (
int i = 0 ; i < bufSize ; i++) {
307 crc = __CRCTable[(crc ^ buf[i]) & 0xff] ^ (crc >> 8);
316 inline static uint32_t __encodeCRC(
const uint32_t& crc) {
317 return crc ^ 0xffffffff;
338 static int __resolveZoneSize(dimension_def_t& dimension_definition) {
340 ? int(128.0 / dimension_definition.zones) : 0;
438 if (version == 3 &&
BitDepth == 24) {
443 ScanCompressedSample();
487 store32(&pData[28],
Loops);
491 store32(&pData[36],
LoopID);
502 uint16_t iSampleGroup = 0;
504 if (pFile->pGroups) {
505 std::list<Group*>::iterator iter = pFile->pGroups->begin();
506 std::list<Group*>::iterator end = pFile->pGroups->end();
507 for (
int i = 0; iter != end; i++, iter++) {
516 store16(&pData[0], iSampleGroup);
520 void Sample::ScanCompressedSample() {
523 std::list<unsigned long> frameOffsets;
531 for (
int i = 0 ; ; i++) {
538 if (mode_l > 5 || mode_r > 5)
throw gig::Exception(
"Unknown compression mode");
539 const unsigned long frameSize = bytesPerFrame[mode_l] + bytesPerFrame[mode_r];
544 (bitsPerSample[mode_l] + bitsPerSample[mode_r]);
553 for (
int i = 0 ; ; i++) {
558 const unsigned long frameSize = bytesPerFrame[mode];
574 FrameTable =
new unsigned long[frameOffsets.size()];
575 std::list<unsigned long>::iterator end = frameOffsets.end();
576 std::list<unsigned long>::iterator iter = frameOffsets.begin();
577 for (
int i = 0; iter != end; i++, iter++) {
679 unsigned long allocationsize = (SampleCount + NullSamplesCount) * this->
FrameSize;
795 unsigned long frame = this->
SamplePos / 2048;
801 unsigned long orderedBytes = SampleCount * this->
FrameSize;
802 unsigned long result =
pCkData->
SetPos(orderedBytes, Whence);
803 return (result == orderedBytes) ? SampleCount
852 unsigned long samplestoread = SampleCount, totalreadsamples = 0, readsamples, samplestoloopend;
853 uint8_t* pDst = (uint8_t*) pBuffer;
862 if (
GetPos() <= loopEnd) {
870 if (!pPlaybackState->
reverse) {
872 samplestoloopend = loopEnd -
GetPos();
873 readsamples =
Read(&pDst[totalreadsamples * this->
FrameSize], Min(samplestoread, samplestoloopend), pExternalDecompressionBuffer);
874 samplestoread -= readsamples;
875 totalreadsamples += readsamples;
876 if (readsamples == samplestoloopend) {
877 pPlaybackState->
reverse =
true;
880 }
while (samplestoread && readsamples);
890 unsigned long swapareastart = totalreadsamples;
892 unsigned long samplestoreadinloop = Min(samplestoread, loopoffset);
893 unsigned long reverseplaybackend =
GetPos() - samplestoreadinloop;
895 SetPos(reverseplaybackend);
899 readsamples =
Read(&pDst[totalreadsamples * this->
FrameSize], samplestoreadinloop, pExternalDecompressionBuffer);
900 samplestoreadinloop -= readsamples;
901 samplestoread -= readsamples;
902 totalreadsamples += readsamples;
903 }
while (samplestoreadinloop && readsamples);
905 SetPos(reverseplaybackend);
907 if (reverseplaybackend == loop.
LoopStart) {
909 pPlaybackState->
reverse =
false;
913 if (totalreadsamples > swapareastart)
914 SwapMemoryArea(&pDst[swapareastart * this->
FrameSize], (totalreadsamples - swapareastart) * this->FrameSize, this->FrameSize);
916 }
while (samplestoread && readsamples);
922 if (!pPlaybackState->
reverse)
do {
923 samplestoloopend = loopEnd -
GetPos();
924 readsamples =
Read(&pDst[totalreadsamples * this->
FrameSize], Min(samplestoread, samplestoloopend), pExternalDecompressionBuffer);
925 samplestoread -= readsamples;
926 totalreadsamples += readsamples;
927 if (readsamples == samplestoloopend) {
928 pPlaybackState->
reverse =
true;
931 }
while (samplestoread && readsamples);
933 if (!samplestoread)
break;
941 unsigned long swapareastart = totalreadsamples;
945 unsigned long reverseplaybackend = loop.
LoopStart + Abs((loopoffset - samplestoreadinloop) % loop.
LoopLength);
947 SetPos(reverseplaybackend);
953 samplestoloopend = loopEnd -
GetPos();
954 readsamples =
Read(&pDst[totalreadsamples * this->
FrameSize], Min(samplestoreadinloop, samplestoloopend), pExternalDecompressionBuffer);
955 samplestoreadinloop -= readsamples;
956 samplestoread -= readsamples;
957 totalreadsamples += readsamples;
958 if (readsamples == samplestoloopend) {
962 }
while (samplestoreadinloop && readsamples);
964 SetPos(reverseplaybackend);
967 SwapMemoryArea(&pDst[swapareastart * this->
FrameSize], (totalreadsamples - swapareastart) * this->FrameSize, this->FrameSize);
975 samplestoloopend = loopEnd -
GetPos();
976 readsamples =
Read(&pDst[totalreadsamples * this->
FrameSize], Min(samplestoread, samplestoloopend), pExternalDecompressionBuffer);
977 samplestoread -= readsamples;
978 totalreadsamples += readsamples;
979 if (readsamples == samplestoloopend) {
983 }
while (samplestoread && readsamples);
991 if (samplestoread)
do {
992 readsamples =
Read(&pDst[totalreadsamples * this->
FrameSize], samplestoread, pExternalDecompressionBuffer);
993 samplestoread -= readsamples;
994 totalreadsamples += readsamples;
995 }
while (readsamples && samplestoread);
1000 return totalreadsamples;
1026 if (SampleCount == 0)
return 0;
1033 return Channels == 2 ?
pCkData->
Read(pBuffer, SampleCount << 1, 2) >> 1
1040 unsigned long assumedsize =
GuessSize(SampleCount),
1042 remainingsamples = SampleCount,
1043 copysamples, skipsamples,
1050 if (pDecompressionBuffer->
Size < assumedsize) {
1051 std::cerr <<
"gig::Read(): WARNING - decompression buffer size too small!" << std::endl;
1053 remainingsamples = SampleCount;
1057 unsigned char* pSrc = (
unsigned char*) pDecompressionBuffer->
pStart;
1058 int16_t* pDst = static_cast<int16_t*>(pBuffer);
1059 uint8_t* pDst24 =
static_cast<uint8_t*
>(pBuffer);
1060 remainingbytes =
pCkData->
Read(pSrc, assumedsize, 1);
1062 while (remainingsamples && remainingbytes) {
1064 unsigned long framebytes, rightChannelOffset = 0, nextFrameOffset;
1066 int mode_l = *pSrc++, mode_r = 0;
1068 if (Channels == 2) {
1070 framebytes = bytesPerFrame[mode_l] + bytesPerFrame[mode_r] + 2;
1071 rightChannelOffset = bytesPerFrameNoHdr[mode_l];
1072 nextFrameOffset = rightChannelOffset + bytesPerFrameNoHdr[mode_r];
1073 if (remainingbytes < framebytes) {
1075 if (mode_l == 4 && (framesamples & 1)) {
1076 rightChannelOffset = ((framesamples + 1) * bitsPerSample[mode_l]) >> 3;
1079 rightChannelOffset = (framesamples * bitsPerSample[mode_l]) >> 3;
1084 framebytes = bytesPerFrame[mode_l] + 1;
1085 nextFrameOffset = bytesPerFrameNoHdr[mode_l];
1086 if (remainingbytes < framebytes) {
1092 if (currentframeoffset + remainingsamples >= framesamples) {
1093 if (currentframeoffset <= framesamples) {
1094 copysamples = framesamples - currentframeoffset;
1095 skipsamples = currentframeoffset;
1099 skipsamples = framesamples;
1106 copysamples = remainingsamples;
1107 skipsamples = currentframeoffset;
1109 this->
FrameOffset = currentframeoffset + copysamples;
1111 remainingsamples -= copysamples;
1113 if (remainingbytes > framebytes) {
1114 remainingbytes -= framebytes;
1115 if (remainingsamples == 0 &&
1116 currentframeoffset + copysamples == framesamples) {
1124 else remainingbytes = 0;
1126 currentframeoffset -= skipsamples;
1128 if (copysamples == 0) {
1133 const unsigned char*
const param_l = pSrc;
1135 if (mode_l != 2) pSrc += 12;
1137 if (Channels == 2) {
1138 const unsigned char*
const param_r = pSrc;
1139 if (mode_r != 2) pSrc += 12;
1141 Decompress24(mode_l, param_l, 6, pSrc, pDst24,
1143 Decompress24(mode_r, param_r, 6, pSrc + rightChannelOffset, pDst24 + 3,
1145 pDst24 += copysamples * 6;
1148 Decompress24(mode_l, param_l, 3, pSrc, pDst24,
1150 pDst24 += copysamples * 3;
1154 if (mode_l) pSrc += 4;
1157 if (Channels == 2) {
1158 const unsigned char*
const param_r = pSrc;
1159 if (mode_r) pSrc += 4;
1161 step = (2 - mode_l) + (2 - mode_r);
1162 Decompress16(mode_l, param_l, step, 2, pSrc, pDst, skipsamples, copysamples);
1163 Decompress16(mode_r, param_r, step, 2, pSrc + (2 - mode_l), pDst + 1,
1164 skipsamples, copysamples);
1165 pDst += copysamples << 1;
1169 Decompress16(mode_l, param_l, step, 1, pSrc, pDst, skipsamples, copysamples);
1170 pDst += copysamples;
1173 pSrc += nextFrameOffset;
1177 if (remainingsamples && remainingbytes < WorstCaseFrameSize && pCkData->GetState() ==
RIFF::stream_ready) {
1178 assumedsize =
GuessSize(remainingsamples);
1182 pSrc = (
unsigned char*) pDecompressionBuffer->
pStart;
1186 this->
SamplePos += (SampleCount - remainingsamples);
1188 return (SampleCount - remainingsamples);
1222 if (
GetSize() < SampleCount)
throw Exception(
"Could not write sample data, current sample size to small");
1227 res = Channels == 2 ?
pCkData->
Write(pBuffer, SampleCount << 1, 2) >> 1
1230 __calculateCRC((
unsigned char *)pBuffer, SampleCount *
FrameSize, crc);
1259 const double worstCaseHeaderOverhead =
1260 (256.0 + 12.0 + 2.0 ) / 256.0;
1261 result.
Size = (
unsigned long) (
double(MaxReadSize) * 3.0 * 2.0 * worstCaseHeaderOverhead);
1275 if (DecompressionBuffer.
Size && DecompressionBuffer.
pStart) {
1276 delete[] (int8_t*) DecompressionBuffer.
pStart;
1277 DecompressionBuffer.
pStart = NULL;
1278 DecompressionBuffer.
Size = 0;
1311 uint DimensionRegion::Instances = 0;
1312 DimensionRegion::VelocityTableMap* DimensionRegion::pVelocityTables = NULL;
1323 if (!pVelocityTables) pVelocityTables =
new VelocityTableMap;
1344 uint8_t eg1ctrloptions = _3ewa->
ReadUint8();
1350 uint8_t eg2ctrloptions = _3ewa->
ReadUint8();
1376 uint8_t velocityresponse = _3ewa->
ReadUint8();
1377 if (velocityresponse < 5) {
1380 }
else if (velocityresponse < 10) {
1383 }
else if (velocityresponse < 15) {
1390 uint8_t releasevelocityresponse = _3ewa->
ReadUint8();
1391 if (releasevelocityresponse < 5) {
1394 }
else if (releasevelocityresponse < 10) {
1397 }
else if (releasevelocityresponse < 15) {
1409 uint8_t pitchTrackDimensionBypass = _3ewa->
ReadInt8();
1415 Pan = (pan < 64) ? pan : -((
int)pan - 63);
1427 bool extResonanceCtrl = lfo2ctrl & 0x40;
1435 EG3Depth = (eg3depth <= 1200) ? eg3depth
1436 : (-1) * (int16_t) ((eg3depth ^ 0xffff) + 1);
1439 uint8_t regoptions = _3ewa->
ReadUint8();
1454 uint8_t vcfvelscale = _3ewa->
ReadUint8();
1458 uint8_t vcfresonance = _3ewa->
ReadUint8();
1461 uint8_t vcfbreakpoint = _3ewa->
ReadUint8();
1464 uint8_t vcfvelocity = _3ewa->
ReadUint8();
1469 if (lfo3ctrl & 0x40)
1564 pVelocityReleaseTable = GetReleaseVelocityTable(
1590 for (
int k = 0 ; k < 128 ; k++)
1638 const uint32_t chunksize = _3ewa->
GetNewSize();
1639 store32(&pData[0], chunksize);
1642 store32(&pData[4], lfo3freq);
1645 store32(&pData[8], eg3attack);
1664 store32(&pData[28], eg1attack);
1667 store32(&pData[32], eg1decay1);
1674 store32(&pData[40], eg1release);
1676 const uint8_t eg1ctl = (uint8_t) EncodeLeverageController(
EG1Controller);
1679 const uint8_t eg1ctrloptions =
1684 pData[45] = eg1ctrloptions;
1686 const uint8_t eg2ctl = (uint8_t) EncodeLeverageController(
EG2Controller);
1689 const uint8_t eg2ctrloptions =
1694 pData[47] = eg2ctrloptions;
1697 store32(&pData[48], lfo1freq);
1700 store32(&pData[52], eg2attack);
1703 store32(&pData[56], eg2decay1);
1710 store32(&pData[64], eg2release);
1717 store32(&pData[72], lfo2freq);
1724 store32(&pData[80], eg1decay2);
1731 store32(&pData[88], eg2decay2);
1744 velocityresponse += 5;
1747 velocityresponse += 10;
1751 throw Exception(
"Could not update DimensionRegion's chunk, unknown VelocityResponseCurve selected");
1753 pData[96] = velocityresponse;
1763 releasevelocityresponse += 5;
1766 releasevelocityresponse += 10;
1770 throw Exception(
"Could not update DimensionRegion's chunk, unknown ReleaseVelocityResponseCurve selected");
1772 pData[97] = releasevelocityresponse;
1789 pitchTrackDimensionBypass |= 0x10;
1792 pitchTrackDimensionBypass |= 0x20;
1798 throw Exception(
"Could not update DimensionRegion's chunk, unknown DimensionBypass selected");
1800 pData[108] = pitchTrackDimensionBypass;
1803 const uint8_t pan = (
Pan >= 0) ?
Pan : ((-
Pan) + 63);
1806 const uint8_t selfmask = (
SelfMask) ? 0x01 : 0x00;
1807 pData[110] = selfmask;
1816 pData[112] = lfo3ctrl;
1820 pData[113] = attenctl;
1827 pData[114] = lfo2ctrl;
1836 pData[115] = lfo1ctrl;
1840 : uint16_t(((-
EG3Depth) - 1) ^ 0xffff);
1841 store16(&pData[116], eg3depth);
1846 pData[120] = channeloffset;
1849 uint8_t regoptions = 0;
1852 pData[121] = regoptions;
1865 const uint8_t eg1hold = (
EG1Hold) ? 0x80 : 0x00;
1866 pData[131] = eg1hold;
1868 const uint8_t vcfcutoff = (
VCFEnabled ? 0x80 : 0x00) |
1870 pData[132] = vcfcutoff;
1876 pData[134] = vcfvelscale;
1882 pData[136] = vcfresonance;
1886 pData[137] = vcfbreakpoint;
1890 pData[138] = vcfvelocity;
1893 pData[139] = vcftype;
1895 if (chunksize >= 148) {
1900 double* DimensionRegion::GetReleaseVelocityTable(
curve_type_t releaseVelocityResponseCurve, uint8_t releaseVelocityResponseDepth) {
1902 uint8_t depth = releaseVelocityResponseDepth;
1911 return GetVelocityTable(curveType, depth, 0);
1914 double* DimensionRegion::GetCutoffVelocityTable(
curve_type_t vcfVelocityCurve,
1915 uint8_t vcfVelocityDynamicRange,
1916 uint8_t vcfVelocityScale,
1920 uint8_t depth = vcfVelocityDynamicRange;
1929 return GetVelocityTable(curveType, depth,
1931 ? vcfVelocityScale : 0);
1935 double* DimensionRegion::GetVelocityTable(
curve_type_t curveType, uint8_t depth, uint8_t scaling)
1938 uint32_t tableKey = (curveType<<16) | (depth<<8) | scaling;
1939 if (pVelocityTables->count(tableKey)) {
1940 table = (*pVelocityTables)[tableKey];
1943 table = CreateVelocityTable(curveType, depth, scaling);
1944 (*pVelocityTables)[tableKey] = table;
1953 leverage_ctrl_t DimensionRegion::DecodeLeverageController(_lev_ctrl_t EncodedController) {
1955 switch (EncodedController) {
1957 case _lev_ctrl_none:
1961 case _lev_ctrl_velocity:
1965 case _lev_ctrl_channelaftertouch:
1971 case _lev_ctrl_modwheel:
1975 case _lev_ctrl_breath:
1979 case _lev_ctrl_foot:
1983 case _lev_ctrl_effect1:
1987 case _lev_ctrl_effect2:
1991 case _lev_ctrl_genpurpose1:
1995 case _lev_ctrl_genpurpose2:
1999 case _lev_ctrl_genpurpose3:
2003 case _lev_ctrl_genpurpose4:
2007 case _lev_ctrl_portamentotime:
2011 case _lev_ctrl_sustainpedal:
2015 case _lev_ctrl_portamento:
2019 case _lev_ctrl_sostenutopedal:
2023 case _lev_ctrl_softpedal:
2027 case _lev_ctrl_genpurpose5:
2031 case _lev_ctrl_genpurpose6:
2035 case _lev_ctrl_genpurpose7:
2039 case _lev_ctrl_genpurpose8:
2043 case _lev_ctrl_effect1depth:
2047 case _lev_ctrl_effect2depth:
2051 case _lev_ctrl_effect3depth:
2055 case _lev_ctrl_effect4depth:
2059 case _lev_ctrl_effect5depth:
2068 return decodedcontroller;
2071 DimensionRegion::_lev_ctrl_t DimensionRegion::EncodeLeverageController(leverage_ctrl_t DecodedController) {
2072 _lev_ctrl_t encodedcontroller;
2073 switch (DecodedController.type) {
2076 encodedcontroller = _lev_ctrl_none;
2079 encodedcontroller = _lev_ctrl_velocity;
2082 encodedcontroller = _lev_ctrl_channelaftertouch;
2087 switch (DecodedController.controller_number) {
2089 encodedcontroller = _lev_ctrl_modwheel;
2092 encodedcontroller = _lev_ctrl_breath;
2095 encodedcontroller = _lev_ctrl_foot;
2098 encodedcontroller = _lev_ctrl_effect1;
2101 encodedcontroller = _lev_ctrl_effect2;
2104 encodedcontroller = _lev_ctrl_genpurpose1;
2107 encodedcontroller = _lev_ctrl_genpurpose2;
2110 encodedcontroller = _lev_ctrl_genpurpose3;
2113 encodedcontroller = _lev_ctrl_genpurpose4;
2116 encodedcontroller = _lev_ctrl_portamentotime;
2119 encodedcontroller = _lev_ctrl_sustainpedal;
2122 encodedcontroller = _lev_ctrl_portamento;
2125 encodedcontroller = _lev_ctrl_sostenutopedal;
2128 encodedcontroller = _lev_ctrl_softpedal;
2131 encodedcontroller = _lev_ctrl_genpurpose5;
2134 encodedcontroller = _lev_ctrl_genpurpose6;
2137 encodedcontroller = _lev_ctrl_genpurpose7;
2140 encodedcontroller = _lev_ctrl_genpurpose8;
2143 encodedcontroller = _lev_ctrl_effect1depth;
2146 encodedcontroller = _lev_ctrl_effect2depth;
2149 encodedcontroller = _lev_ctrl_effect3depth;
2152 encodedcontroller = _lev_ctrl_effect4depth;
2155 encodedcontroller = _lev_ctrl_effect5depth;
2158 throw gig::Exception(
"leverage controller number is not supported by the gig format");
2164 return encodedcontroller;
2171 VelocityTableMap::iterator iter;
2172 for (iter = pVelocityTables->begin(); iter != pVelocityTables->end(); iter++) {
2173 double* pTable = iter->second;
2174 if (pTable)
delete[] pTable;
2176 pVelocityTables->clear();
2177 delete pVelocityTables;
2178 pVelocityTables = NULL;
2195 return pVelocityAttenuationTable[MIDIKeyVelocity];
2199 return pVelocityReleaseTable[MIDIKeyVelocity];
2203 return pVelocityCutoffTable[MIDIKeyVelocity];
2211 pVelocityAttenuationTable =
2223 pVelocityAttenuationTable =
2235 pVelocityAttenuationTable =
2296 double* DimensionRegion::CreateVelocityTable(
curve_type_t curveType, uint8_t depth, uint8_t scaling) {
2301 const int lin0[] = { 1, 1, 127, 127 };
2302 const int lin1[] = { 1, 21, 127, 127 };
2303 const int lin2[] = { 1, 45, 127, 127 };
2304 const int lin3[] = { 1, 74, 127, 127 };
2305 const int lin4[] = { 1, 127, 127, 127 };
2308 const int non0[] = { 1, 4, 24, 5, 57, 17, 92, 57, 122, 127, 127, 127 };
2309 const int non1[] = { 1, 4, 46, 9, 93, 56, 118, 106, 123, 127,
2311 const int non2[] = { 1, 4, 46, 9, 57, 20, 102, 107, 107, 127,
2313 const int non3[] = { 1, 15, 10, 19, 67, 73, 80, 80, 90, 98, 98, 127,
2315 const int non4[] = { 1, 25, 33, 57, 82, 81, 92, 127, 127, 127 };
2318 const int spe0[] = { 1, 2, 76, 10, 90, 15, 95, 20, 99, 28, 103, 44,
2319 113, 127, 127, 127 };
2320 const int spe1[] = { 1, 2, 27, 5, 67, 18, 89, 29, 95, 35, 107, 67,
2321 118, 127, 127, 127 };
2322 const int spe2[] = { 1, 1, 33, 1, 53, 5, 61, 13, 69, 32, 79, 74,
2323 85, 90, 91, 127, 127, 127 };
2324 const int spe3[] = { 1, 32, 28, 35, 66, 48, 89, 59, 95, 65, 99, 73,
2325 117, 127, 127, 127 };
2326 const int spe4[] = { 1, 4, 23, 5, 49, 13, 57, 17, 92, 57, 122, 127,
2330 const int spe5[] = { 1, 2, 30, 5, 60, 19, 77, 70, 83, 85, 88, 106,
2331 91, 127, 127, 127 };
2333 const int*
const curves[] = { non0, non1, non2, non3, non4,
2334 lin0, lin1, lin2, lin3, lin4,
2335 spe0, spe1, spe2, spe3, spe4, spe5 };
2337 double*
const table =
new double[128];
2339 const int* curve = curves[curveType * 5 + depth];
2340 const int s = scaling == 0 ? 20 : scaling;
2343 for (
int x = 1 ; x < 128 ; x++) {
2345 if (x > curve[2]) curve += 2;
2346 double y = curve[1] + (x - curve[0]) *
2347 (
double(curve[3] - curve[1]) / (curve[2] - curve[0]));
2352 if (s < 20 && y >= 0.5)
2353 y = y / ((2 - 40.0 / s) * y + 40.0 / s - 1);
2370 for (
int i = 0; i < 256; i++) {
2386 for (
int i = 0; i < dimensionBits; i++) {
2427 uint32_t wavepoolindex = _3lnk->
ReadUint32();
2434 for (
int i = 0 ; i < 8 ; i++) {
2477 const int iMaxDimensions = version3 ? 8 : 5;
2478 const int iMaxDimensionRegions = version3 ? 256 : 32;
2483 const int _3lnkChunkSize = version3 ? 1092 : 172;
2493 store32(&pData[0], DimensionRegions);
2495 for (
int i = 0; i < iMaxDimensions; i++) {
2507 const int iWavePoolOffset = version3 ? 68 : 44;
2508 for (uint i = 0; i < iMaxDimensionRegions; i++) {
2509 int iWaveIndex = -1;
2510 if (i < DimensionRegions) {
2512 File::SampleList::iterator iter = pFile->
pSamples->begin();
2513 File::SampleList::iterator end = pFile->
pSamples->end();
2514 for (
int index = 0; iter != end; ++iter, ++index) {
2521 store32(&pData[iWavePoolOffset + i * 4], iWaveIndex);
2528 int dimensionRegionNr = 0;
2533 dimensionRegionNr++;
2537 if (dimensionRegionNr == 0)
throw gig::Exception(
"No dimension region found.");
2557 if (veldim == -1)
return;
2573 table =
new uint8_t[128];
2577 int velocityZone = 0;
2579 for (
int k = i ; k < end ; k += step) {
2581 for (; tableidx <= d->
DimensionUpperLimits[veldim] ; tableidx++) table[tableidx] = velocityZone;
2585 for (
int k = i ; k < end ; k += step) {
2587 for (; tableidx <= d->
VelocityUpperLimit ; tableidx++) table[tableidx] = velocityZone;
2601 if (j == veldim) i += skipveldim;
2614 if (j == Dimensions)
break;
2638 throw gig::Exception(
"Could not add new dimension, max. amount of " + ToString(iMaxDimensions) +
" dimensions already reached");
2640 int iCurrentBits = 0;
2643 if (iCurrentBits >= iMaxDimensions)
2644 throw gig::Exception(
"Could not add new dimension, max. amount of " + ToString(iMaxDimensions) +
" dimension bits already reached");
2645 const int iNewBits = iCurrentBits + pDimDef->
bits;
2646 if (iNewBits > iMaxDimensions)
2647 throw gig::Exception(
"Could not add new dimension, new dimension would exceed max. amount of " + ToString(iMaxDimensions) +
" dimension bits");
2651 throw gig::Exception(
"Could not add new dimension, there is already a dimension of the same type");
2658 for (
int i = 0 ; i < pos ; i++)
2663 for (
int i = 0 ; i < (1 << iCurrentBits) ; i++) {
2664 for (
int j = Dimensions ; j > pos ; j--) {
2684 for (
int i = (1 << iCurrentBits) - (1 << bitpos) ; i >= 0 ; i -= (1 << bitpos)) {
2685 for (
int k = 0 ; k < (1 << bitpos) ; k++) {
2688 for (
int j = 1 ; j < (1 << pDimDef->
bits) ; j++) {
2689 for (
int k = 0 ; k < (1 << bitpos) ; k++) {
2691 if (moveTo) _3prg->
MoveSubChunk(pNewDimRgnListChunk, moveTo);
2704 int mask = (1 << bitpos) - 1;
2705 for (
int z = 0 ; z < pDimDef->
zones ; z++) {
2706 uint8_t upperLimit = uint8_t((z + 1) * 128.0 / pDimDef->
zones - 1);
2707 for (
int i = 0 ; i < 1 << iCurrentBits ; i++) {
2735 int iDimensionNr = -1;
2742 if (iDimensionNr < 0)
throw gig::Exception(
"Invalid dimension_def_t pointer");
2746 for (
int i = 0; i < iDimensionNr; i++)
2751 for (
int i = iDimensionNr + 1; i <
Dimensions; i++)
2758 for (
int iUpperBit = 0; iUpperBit < 1 << iUpperBits; iUpperBit++) {
2760 for (
int iLowerBit = 0; iLowerBit < 1 << iLowerBits; iLowerBit++) {
2762 iObsoleteBit << iLowerBits |
2775 for (
int iFrom = 2, iTo = 1; iFrom < 256 && iTo < 256 - 1; iTo++) {
2777 if (iFrom <= iTo) iFrom = iTo + 1;
2789 for (
int i = iDimensionNr + 1; i <
Dimensions; i++) {
2796 for (
int i = iDimensionNr + 1; i <
Dimensions; i++) {
2810 for (
int i = 0; i < 256; i++) {
2850 if (DimValues[i] <=
pDimensionRegions[bits << bitpos]->DimensionUpperLimits[i])
break;
2859 bits = DimValues[i] & limiter_mask;
2862 dimregidx |= bits << bitpos;
2874 dimregidx |= bits << velbitpos;
2915 if ((int32_t)WavePoolTableIndex == -1)
return NULL;
2939 for (
int i = 0 ; i <
Triggers ; i++) {
2973 pMidiRules[0] = NULL;
2984 uint8_t dimkeystart = _3ewg->
ReadUint8();
2996 if (id1 == 4 && id2 == 16) {
3001 pMidiRules[i] = NULL;
3013 __notify_progress(pProgress, (
float)
pRegions->size() / (float)
Regions);
3023 __notify_progress(pProgress, 1.0f);
3028 RegionList::iterator iter =
pRegions->begin();
3029 RegionList::iterator end =
pRegions->end();
3030 for (; iter != end; ++iter) {
3032 for (
int iKey = pRegion->
KeyRange.
low; iKey <= pRegion->KeyRange.high; iKey++) {
3039 for (
int i = 0 ; pMidiRules[i] ; i++) {
3040 delete pMidiRules[i];
3042 delete[] pMidiRules;
3060 RegionList::iterator iter =
pRegions->begin();
3061 RegionList::iterator end =
pRegions->end();
3062 for (; iter != end; ++iter)
3063 (*iter)->UpdateChunks();
3087 pData[10] = dimkeystart;
3168 return pMidiRules[i];
3183 pNameChunk = ck3gnm;
3184 ::LoadString(pNameChunk,
Name);
3213 if (strcmp(static_cast<char*>(ck->LoadChunkData()),
"") == 0) {
3238 if (pSample->GetGroup() ==
this)
return pSample;
3256 if (pSample->GetGroup() ==
this)
return pSample;
3276 Group* pOtherGroup = NULL;
3278 if (pOtherGroup !=
this)
break;
3281 "Could not move samples to another group, since there is no "
3282 "other Group. This is a bug, report it!"
3297 0, 2, 19980628 & 0xffff, 19980628 >> 16
3302 0, 3, 20030331 & 0xffff, 20030331 >> 16
3350 std::list<Group*>::iterator iter = pGroups->begin();
3351 std::list<Group*>::iterator end = pGroups->end();
3352 while (iter != end) {
3408 if (iter ==
pSamples->end())
throw gig::Exception(
"Could not delete sample, could not find given sample");
3417 for (
Region* region = instrument->GetFirstRegion() ; region ;
3418 region = instrument->GetNextRegion()) {
3420 if (region->GetSample() == pSample) region->SetSample(NULL);
3422 for (
int i = 0 ; i < region->DimensionRegions ; i++) {
3445 int iSampleIndex = 0;
3454 int nameLen = name.length();
3456 if (nameLen > 4 && name.substr(nameLen - 4) ==
".gig") nameLen -= 4;
3458 for (
int fileNo = 0 ; ; ) {
3461 unsigned long wvplFileOffset = wvpl->
GetFilePos();
3466 const float subprogress = (float) iSampleIndex / (
float) iTotalSamples;
3467 __notify_progress(pProgress, subprogress);
3469 unsigned long waveFileOffset = wave->
GetFilePos();
3470 pSamples->push_back(
new Sample(
this, wave, waveFileOffset - wvplFileOffset, fileNo));
3477 if (fileNo == lastFileNo)
break;
3481 sprintf(suffix,
".gx%02d", fileNo);
3482 name.replace(nameLen, 5, suffix);
3488 __notify_progress(pProgress, 1.0);
3517 __divide_progress(pProgress, &subprogress, 3.0f, 0.0f);
3518 __notify_progress(&subprogress, 0.0f);
3521 __notify_progress(&subprogress, 1.0f);
3524 if (pProgress && pProgress->
callback) {
3528 __notify_progress(&subprogress, 0.0f);
3530 __notify_progress(&subprogress, 1.0f);
3535 if (i == index)
return static_cast<gig::Instrument*
>( *InstrumentsIterator );
3593 if (lstInstruments) {
3594 int iInstrumentIndex = 0;
3599 const float localProgress = (float) iInstrumentIndex / (
float)
Instruments;
3600 __notify_progress(pProgress, localProgress);
3604 __divide_progress(pProgress, &subprogress,
Instruments, iInstrumentIndex);
3612 __notify_progress(pProgress, 1.0);
3624 int iWaveIndex = -1;
3625 File::SampleList::iterator iter =
pSamples->begin();
3626 File::SampleList::iterator end =
pSamples->end();
3627 for (
int index = 0; iter != end; ++iter, ++index) {
3628 if (*iter == pSample) {
3633 if (iWaveIndex < 0)
throw gig::Exception(
"Could not update crc, could not find sample");
3636 _3crc->
SetPos(iWaveIndex * 8);
3645 GroupsIterator = pGroups->begin();
3646 return *GroupsIterator;
3650 if (!pGroups)
return NULL;
3652 return (GroupsIterator == pGroups->end()) ? NULL : *GroupsIterator;
3663 GroupsIterator = pGroups->begin();
3664 for (uint i = 0; GroupsIterator != pGroups->end(); i++) {
3665 if (i == index)
return *GroupsIterator;
3676 pGroups->push_back(pGroup);
3691 std::list<Group*>::iterator iter = find(pGroups->begin(), pGroups->end(), pGroup);
3692 if (iter == pGroups->end())
throw gig::Exception(
"Could not delete group, could not find given group");
3693 if (pGroups->size() == 1)
throw gig::Exception(
"Cannot delete group, there must be at least one default group!");
3699 pGroups->erase(iter);
3715 std::list<Group*>::iterator iter = find(pGroups->begin(), pGroups->end(), pGroup);
3716 if (iter == pGroups->end())
throw gig::Exception(
"Could not delete group, could not find given group");
3717 if (pGroups->size() == 1)
throw gig::Exception(
"Cannot delete group, there must be at least one default group!");
3720 pGroups->erase(iter);
3725 if (!pGroups) pGroups =
new std::list<Group*>;
3735 strcmp(static_cast<char*>(ck->
LoadChunkData()),
"") == 0)
break;
3737 pGroups->push_back(
new Group(
this, ck));
3744 if (!pGroups->size()) {
3746 pGroup->
Name =
"Default Group";
3747 pGroups->push_back(pGroup);
3774 if (first != info) {
3781 std::list<Group*>::iterator iter = pGroups->begin();
3782 std::list<Group*>::iterator end = pGroups->end();
3783 for (; iter != end; ++iter) {
3784 (*iter)->UpdateChunks();
3791 for (
int i = 0 ; i < 128 ; i++) {
3792 if (i >= pGroups->size()) ::SaveString(
CHUNK_ID_3GNM, _3gnm, _3gnl,
"",
"",
true, 64);
3814 int sublen =
pSamples->size() / 8 + 49;
3819 if (einf->
GetSize() != einfSize) {
3823 }
else if (newFile) {
3829 std::map<gig::Sample*,int> sampleMap;
3832 sampleMap[pSample] = sampleIdx++;
3835 int totnbusedsamples = 0;
3836 int totnbusedchannels = 0;
3837 int totnbregions = 0;
3838 int totnbdimregions = 0;
3840 int instrumentIdx = 0;
3842 memset(&pData[48], 0, sublen - 48);
3846 int nbusedsamples = 0;
3847 int nbusedchannels = 0;
3848 int nbdimregions = 0;
3851 memset(&pData[(instrumentIdx + 1) * sublen + 48], 0, sublen - 48);
3853 for (
Region* region = instrument->GetFirstRegion() ; region ;
3854 region = instrument->GetNextRegion()) {
3855 for (
int i = 0 ; i < region->DimensionRegions ; i++) {
3858 int sampleIdx = sampleMap[d->
pSample];
3859 int byte = 48 + sampleIdx / 8;
3860 int bit = 1 << (sampleIdx & 7);
3861 if ((pData[(instrumentIdx + 1) * sublen + byte] & bit) == 0) {
3862 pData[(instrumentIdx + 1) * sublen + byte] |= bit;
3866 if ((pData[byte] & bit) == 0) {
3875 nbdimregions += region->DimensionRegions;
3879 store32(&pData[(instrumentIdx + 1) * sublen + 4], nbusedchannels);
3880 store32(&pData[(instrumentIdx + 1) * sublen + 8], nbusedsamples);
3881 store32(&pData[(instrumentIdx + 1) * sublen + 12], 1);
3882 store32(&pData[(instrumentIdx + 1) * sublen + 16], instrument->Regions);
3883 store32(&pData[(instrumentIdx + 1) * sublen + 20], nbdimregions);
3884 store32(&pData[(instrumentIdx + 1) * sublen + 24], nbloops);
3886 store32(&pData[(instrumentIdx + 1) * sublen + 36], instrumentIdx);
3887 store32(&pData[(instrumentIdx + 1) * sublen + 40],
pSamples->size());
3890 totnbregions += instrument->Regions;
3891 totnbdimregions += nbdimregions;
3892 totnbloops += nbloops;
3897 store32(&pData[4], totnbusedchannels);
3898 store32(&pData[8], totnbusedsamples);
3900 store32(&pData[16], totnbregions);
3901 store32(&pData[20], totnbdimregions);
3902 store32(&pData[24], totnbloops);
3905 store32(&pData[40],
pSamples->size());
3918 }
else if (newFile) {
3963 std::cout <<
"gig::Exception: " <<
Message << std::endl;
bool LFO2FlipPhase
Inverts phase of the filter cutoff LFO wave.
void UpdateRegionKeyTable()
void MoveAll()
Move all members of this group to another group (preferably the 1st one except this).
unsigned long WriteUint32(uint32_t *pData, unsigned long WordCount=1)
Writes WordCount number of 32 Bit unsigned integer words from the buffer pointed by pData to the chun...
dim_bypass_ctrl_t DimensionBypass
If defined, the MIDI controller can switch on/off the dimension in realtime.
Encapsulates articulation information of a dimension region.
range_t DimensionKeyRange
0-127 (where 0 means C1 and 127 means G9)
sample_loop_t * pSampleLoops
Points to the beginning of a sample loop array, or is NULL if there are no loops defined.
#define GIG_EG_CTR_RELEASE_INFLUENCE_EXTRACT(x)
uint8_t VCFVelocityScale
(0-127) Amount velocity controls VCF cutoff frequency (only if no other VCF cutoff controller is defi...
unsigned long FrameOffset
Current offset (sample points) in current sample frame (for decompression only).
bool reverse
If playback direction is currently backwards (in case there is a pingpong or reverse loop defined)...
uint32_t Regions
Reflects the number of Region defintions this Instrument has.
Region * GetRegion(unsigned int Key)
Returns the appropriate Region for a triggered note.
void AddSample(Sample *pSample)
Move Sample given by pSample from another Group to this Group.
virtual void UpdateChunks()
Apply dimension region settings to the respective RIFF chunks.
virtual void UpdateChunks()
Apply Instrument with all its Regions to the respective RIFF chunks.
Sample * AddSample()
Add a new sample.
bool VCFEnabled
If filter should be used.
void AddDimension(dimension_def_t *pDimDef)
Einstein would have dreamed of it - create a new dimension.
stream_whence_t
File stream position dependent to these relations.
uint32_t FineTune
Specifies the fraction of a semitone up from the specified MIDI unity note field. A value of 0x800000...
unsigned long Read(void *pData, unsigned long WordCount, unsigned long WordSize)
Reads WordCount number of data words with given WordSize and copies it into a buffer pointed by pData...
uint16_t LFO1ControlDepth
Controller depth influencing sample amplitude LFO pitch (0 - 1200 cents).
Chunk * GetFirstSubChunk()
Returns the first subchunk within the list.
lfo1_ctrl_t
Defines how LFO1 is controlled by.
Group of Gigasampler objects.
uint32_t LoopType
Defines how the waveform samples will be looped (appropriate loop types for the gig format are define...
uint8_t VCFVelocityDynamicRange
0x04 = lowest, 0x00 = highest .
String Name
Stores the name of this Group.
DimensionRegion * GetDimensionRegionByBit(const uint8_t DimBits[8])
Returns the appropriate DimensionRegion for the given dimension bit numbers (zone index)...
Special dimension for triggering samples on releasing a key.
uint16_t PitchbendRange
Number of semitones pitchbend controller can pitch (default is 2).
virtual void UpdateChunks()
Apply all the gig file's current instruments, samples, groups and settings to the respective RIFF chu...
double EG1Release
Release time of the sample amplitude EG (0.000 - 60.000s).
unsigned long ReadAndLoop(void *pBuffer, unsigned long SampleCount, playback_state_t *pPlaybackState, DimensionRegion *pDimRgn, buffer_t *pExternalDecompressionBuffer=NULL)
Reads SampleCount number of sample points from the position stored in pPlaybackState into the buffer ...
#define GIG_EG_CTR_ATTACK_INFLUENCE_EXTRACT(x)
uint8_t Triggers
Number of triggers.
#define GIG_EG_CTR_RELEASE_INFLUENCE_ENCODE(x)
virtual void UpdateChunks()
Apply Instrument with all its Regions to the respective RIFF chunks.
uint32_t GetChunkID()
Chunk ID in unsigned integer representation.
vcf_type_t VCFType
Defines the general filter characteristic (lowpass, highpass, bandpass, etc.).
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.
uint32_t LoopSize
Caution: Use the respective fields in the DimensionRegion instead of this one! (Intended purpose: Len...
void(* callback)(progress_t *)
Callback function pointer which has to be assigned to a function for progress notification.
Instrument * AddInstrument()
Add a new instrument definition.
loop_type_t LoopType
Caution: Use the respective field in the DimensionRegion instead of this one! (Intended purpose: The ...
lfo1_ctrl_t LFO1Controller
MIDI Controller which controls sample amplitude LFO.
#define GIG_VCF_RESONANCE_CTRL_EXTRACT(x)
Only internally controlled.
Sample * GetFirstSample()
Returns a pointer to the first Sample object of the file, NULL otherwise.
uint8_t low
Low value of range.
uint16_t SampleStartOffset
Number of samples the sample start should be moved (0 - 2000).
MIDI rule for triggering notes by control change events.
uint8_t Key
Key to trigger.
unsigned long WorstCaseFrameSize
For compressed samples only: size (in bytes) of the largest possible sample frame.
bool EG1Hold
If true, Decay1 stage should be postponed until the sample reached the sample loop start...
dimension values are already the sought bit number
uint8_t VelocityResponseCurveScaling
0 - 127 (usually you don't have to interpret this parameter, use GetVelocityAttenuation() instead)...
bool Descending
If the change in CC value should be downwards.
double GetVelocityCutoff(uint8_t MIDIKeyVelocity)
unsigned long Size
Size of the actual data in the buffer in bytes.
Instrument * GetFirstInstrument()
Returns a pointer to the first Instrument object of the file, NULL otherwise.
unsigned long SetPos(unsigned long Where, stream_whence_t Whence=stream_start)
Sets the position within the chunk body, thus within the data portion of the chunk (in bytes)...
Region * RegionKeyTable[128]
fast lookup for the corresponding Region of a MIDI key
unsigned long GetSize()
Returns sample size.
Sample(File *pFile, RIFF::List *waveList, unsigned long WavePoolOffset, unsigned long fileNo=0)
Constructor.
uint32_t * pWavePoolTable
For MIDI tools like legato and repetition mode.
bool VCFKeyboardTracking
If true: VCF cutoff frequence will be dependend to the note key position relative to the defined brea...
uint32_t WavePoolTableIndex
uint8_t Velocity
Velocity of the note to trigger. 255 means that velocity should depend on the speed of the controller...
Defines a controller that has a certain contrained influence on a particular synthesis parameter (use...
uint16_t Channels
Number of channels represented in the waveform data, e.g. 1 for mono, 2 for stereo (defaults to 1=mon...
void SetVCFVelocityScale(uint8_t scaling)
Updates the respective member variable and the lookup table / cache that depends on this value...
RIFF::List * pCkInstrument
Defines Region information of an Instrument.
#define GIG_EXP_ENCODE(x)
unsigned long GetPos()
Returns the current position in the sample (in sample points).
void UpdateVelocityTable()
unsigned long SamplesPerFrame
For compressed samples only: number of samples in a full sample frame.
uint32_t LoopPlayCount
Number of times the loop should be played (a value of 0 = infinite).
uint8_t ReleaseTriggerDecay
0 - 8
void GenerateDLSID()
Generates a new DLSID for the resource.
lfo3_ctrl_t LFO3Controller
MIDI Controller which controls the sample pitch LFO.
static unsigned int Instances
Number of instances of class Sample.
uint32_t MIDIUnityNote
Specifies the musical note at which the sample will be played at it's original sample rate...
uint8_t ControllerNumber
MIDI controller number.
#define GIG_PITCH_TRACK_EXTRACT(x)
List * GetSubList(uint32_t ListType)
Returns sublist chunk with list type ListType within this chunk list.
void DeleteSubChunk(Chunk *pSubChunk)
Removes a sub chunk.
uint8_t ChannelOffset
Audio output where the audio signal of the dimension region should be routed to (0 - 9)...
void Resize(int iNewSize)
Resize sample.
Defines Sample Loop Points.
uint8_t VCFResonance
Firm internal filter resonance weight.
bool VCFResonanceDynamic
If true: Increases the resonance Q according to changes of controllers that actually control the VCF ...
unsigned int Dimensions
Number of defined dimensions, do not alter!
Only controlled by external modulation wheel.
#define GIG_VCF_RESONANCE_CTRL_ENCODE(x)
vcf_cutoff_ctrl_t VCFCutoffController
Specifies which external controller has influence on the filter cutoff frequency. ...
virtual void SetGain(int32_t gain)
unsigned long RemainingBytes()
Returns the number of bytes left to read in the chunk body.
double EG1Decay1
Decay time of the sample amplitude EG (0.000 - 60.000s).
List * GetFirstSubList()
Returns the first sublist within the list (that is a subchunk with chunk ID "LIST").
float __range_min
Only for internal usage, do not modify!
DimensionRegion * GetDimensionRegionByValue(const uint DimValues[8])
Use this method in your audio engine to get the appropriate dimension region with it's articulation d...
virtual void UpdateChunks()
Apply Region settings and all its DimensionRegions to the respective RIFF chunks. ...
lfo2_ctrl_t LFO2Controller
MIDI Controlle which controls the filter cutoff LFO.
void LoadDimensionRegions(RIFF::List *rgn)
Different samples triggered each time a note is played, any key advances the counter.
bool Dithered
For 24-bit compressed samples only: if dithering was used during compression with bit reduction...
Region * GetFirstRegion()
Returns the first Region of the instrument.
String libraryVersion()
Returns version of this C++ library.
uint8_t VelocityUpperLimit
Defines the upper velocity value limit of a velocity split (only if an user defined limit was set...
uint8_t ReleaseVelocityResponseDepth
Dynamic range of release velocity affecting envelope time (0 - 4).
std::list< Sample * > SampleList
Will be thrown whenever a gig specific error occurs while trying to access a Gigasampler File...
buffer_t LoadSampleDataWithNullSamplesExtension(uint NullSamplesCount)
Loads (and uncompresses if needed) the whole sample wave into RAM.
virtual void UpdateChunks()
Apply all the DLS file's current instruments, samples and settings to the respective RIFF chunks...
Group * GetGroup() const
Returns pointer to the Group this Sample belongs to.
InstrumentList::iterator InstrumentsIterator
Instrument(File *pFile, RIFF::List *insList, progress_t *pProgress=NULL)
Used for indicating the progress of a certain task.
uint8_t in_end
End position of fade in.
void SetVCFCutoffController(vcf_cutoff_ctrl_t controller)
Updates the respective member variable and the lookup table / cache that depends on this value...
unsigned long WorstCaseMaxSamples(buffer_t *pDecompressionBuffer)
static const DLS::version_t VERSION_2
Reflects Gigasampler file format version 2.0 (1998-06-28).
Sample * pSample
Points to the Sample which is assigned to the dimension region.
uint FrameSize
Reflects the size (in bytes) of one single sample point (only if known sample data format is used...
buffer_t LoadSampleData()
Loads (and uncompresses if needed) the whole sample wave into RAM.
uint32_t LoopStart
Caution: Use the respective field in the DimensionRegion instead of this one! (Intended purpose: The ...
Group * GetNextGroup()
Returns a pointer to the next Group object of the file, NULL otherwise.
unsigned long ReadUint32(uint32_t *pData, unsigned long WordCount=1)
Reads WordCount number of 32 Bit unsigned integer words and copies it into the buffer pointed by pDat...
void SetVCFVelocityCurve(curve_type_t curve)
Updates the respective member variable and the lookup table / cache that depends on this value...
double EG2Decay1
Decay time of the filter cutoff EG (0.000 - 60.000s).
uint8_t EG1ControllerAttackInfluence
Amount EG1 Controller has influence on the EG1 Attack time (0 - 3, where 0 means off).
unsigned long GetPos()
Position within the chunk data body.
#define INITIAL_SAMPLE_BUFFER_SIZE
Initial size of the sample buffer which is used for decompression of compressed sample wave streams -...
unsigned long position
Current position within the sample.
void SetAutoLoad(bool b)
Enable / disable automatic loading.
MidiRule * GetMidiRule(int i)
Returns a MIDI rule of the instrument.
smpte_format_t SMPTEFormat
Specifies the Society of Motion Pictures and Television E time format used in the following SMPTEOffs...
uint16_t low
Low value of range.
double SampleAttenuation
Sample volume (calculated from DLS::Sampler::Gain)
lfo3_ctrl_t
Defines how LFO3 is controlled by.
bool b64BitWavePoolOffsets
unsigned long GetSize()
Chunk size in bytes (without header, thus the chunk data body)
double EG1Decay2
Only if EG1InfiniteSustain == false: 2nd decay stage time of the sample amplitude EG (0...
void SetFixedStringLengths(const string_length_t *lengths)
Forces specific Info fields to be of a fixed length when being saved to a file.
attenuation_ctrl_t AttenuationController
MIDI Controller which has influence on the volume level of the sample (or entire sample group)...
float __range_max
Only for internal usage, do not modify!
static buffer_t InternalDecompressionBuffer
Buffer used for decompression as well as for truncation of 24 Bit -> 16 Bit samples.
static void DestroyDecompressionBuffer(buffer_t &DecompressionBuffer)
Free decompression buffer, previously created with CreateDecompressionBuffer().
Pointer address and size of a buffer.
virtual void LoadSamples()
uint8_t in_start
Start position of fade in.
unsigned long Read(void *pBuffer, unsigned long SampleCount, buffer_t *pExternalDecompressionBuffer=NULL)
Reads SampleCount number of sample points from the current position into the buffer pointed by pBuffe...
dimension_t dimension
Specifies which source (usually a MIDI controller) is associated with the dimension.
unsigned long SamplesInLastFrame
For compressed samples only: length of the last sample frame.
bool EG2ControllerInvert
Invert values coming from defined EG2 controller.
Group * GetFirstGroup()
Returns a pointer to the first Group object of the file, NULL otherwise.
Group * GetGroup(uint index)
Returns the group with the given index.
uint8_t VelSensitivity
How sensitive the velocity should be to the speed of the controller change.
uint32_t DimensionRegions
Total number of DimensionRegions this Region contains, do not alter!
bool MSDecode
Gigastudio flag: defines if Mid Side Recordings should be decoded.
Key Velocity (this is the only dimension in gig2 where the ranges can exactly be defined).
bool EG1InfiniteSustain
If true, instead of going into Decay2 phase, Decay1 level will be hold until note will be released...
bool Compressed
If the sample wave is compressed (probably just interesting for instrument and sample editors...
void ReleaseSampleData()
Frees the cached sample from RAM if loaded with LoadSampleData() previously.
uint32_t SampleLoops
Reflects the number of sample loops.
More poles than normal lowpass.
uint16_t LFO2InternalDepth
Firm pitch of the filter cutoff LFO (0 - 1200 cents).
void Resize(int iNewSize)
Resize sample.
uint16_t LFO1InternalDepth
Firm pitch of the sample amplitude LFO (0 - 1200 cents).
The difference between none and none2 is unknown.
virtual void LoadInstruments()
float zone_size
Intended for internal usage: reflects the size of each zone (128/zones) for normal split types only...
bool PitchTrack
If true: sample will be pitched according to the key position (this will be disabled for drums for ex...
double GetVelocityRelease(uint8_t MIDIKeyVelocity)
unsigned long Write(void *pBuffer, unsigned long SampleCount)
Write sample wave data.
unsigned long ReadInt32(int32_t *pData, unsigned long WordCount=1)
Reads WordCount number of 32 Bit signed integer words and copies it into the buffer pointed by pData...
virtual void UpdateChunks()
Apply Region settings to the respective RIFF chunks.
unsigned int Layers
Amount of defined layers (1 - 32). A value of 1 actually means no layering, a value > 1 means there i...
void * pStart
Points to the beginning of the buffer.
bool EG2InfiniteSustain
If true, instead of going into Decay2 phase, Decay1 level will be hold until note will be released...
unsigned long SamplePos
For compressed samples only: stores the current position (in sample points).
Group * pGroup
pointer to the Group this sample belongs to (always not-NULL)
Chunk * GetSubChunk(uint32_t ChunkID)
Returns subchunk with chunk ID ChunkID within this chunk list.
Chunk * GetNextSubChunk()
Returns the next subchunk within the list.
std::list< Instrument * > InstrumentList
uint8_t EG2ControllerAttackInfluence
Amount EG2 Controller has influence on the EG2 Attack time (0 - 3, where 0 means off).
Exception(String Message)
bool SelfMask
If true: high velocity notes will stop low velocity notes at the same note, with that you can save vo...
int16_t LFO3ControlDepth
Controller depth of the sample pitch LFO (-1200 - +1200 cents).
#define GET_PARAMS(params)
double EG3Attack
Attack time of the sample pitch EG (0.000 - 10.000s).
void DeleteDimension(dimension_def_t *pDimDef)
Delete an existing dimension.
Instrument * GetNextInstrument()
Returns a pointer to the next Instrument object of the file, NULL otherwise.
unsigned long SamplesTotal
Reflects total number of sample points (only if known sample data format is used, 0 otherwise)...
uint8_t out_end
End postition of fade out.
void DeleteGroupOnly(Group *pGroup)
Delete a group.
double EG2Attack
Attack time of the filter cutoff EG (0.000 - 60.000s).
uint16_t BitDepth
Size of each sample per channel (only if known sample data format is used, 0 otherwise).
bool InvertAttenuationController
Inverts the values coming from the defined Attenuation Controller.
double LFO1Frequency
Frequency of the sample amplitude LFO (0.10 - 10.00 Hz).
uint32_t GetListType()
Returns unsigned integer representation of the list's ID.
DimensionRegion(Region *pParent, RIFF::List *_3ewl)
uint32_t LoopID
Specifies the unique ID that corresponds to one of the defined cue points in the cue point list (only...
virtual void UpdateChunks()
Update chunks with current group settings.
bool LFO1FlipPhase
Inverts phase of the sample amplitude LFO wave.
void DeleteSample(Sample *pSample)
Delete a sample.
unsigned long GetFilePos()
Current, actual offset in file.
Region(Instrument *pInstrument, RIFF::List *rgnList)
static buffer_t CreateDecompressionBuffer(unsigned long MaxReadSize)
Allocates a decompression buffer for streaming (compressed) samples with Sample::Read().
bool LFO3Sync
If set to true only one LFO should be used for all voices.
double LFO3Frequency
Frequency of the sample pitch LFO (0.10 - 10.00 Hz).
static const DLS::version_t VERSION_3
Reflects Gigasampler file format version 3.0 (2003-03-31).
uint32_t LoopLength
Length of the looping area (in sample points).
void DeleteRegion(Region *pRegion)
#define GIG_EG_CTR_ATTACK_INFLUENCE_ENCODE(x)
#define GIG_EG_CTR_DECAY_INFLUENCE_ENCODE(x)
DimensionRegion * pDimensionRegions[256]
Pointer array to the 32 (gig2) or 256 (gig3) possible dimension regions (reflects NULL for dimension ...
uint32_t Product
Specifies the MIDI model ID defined by the manufacturer corresponding to the Manufacturer field...
bool LFO1Sync
If set to true only one LFO should be used for all voices.
unsigned long ReadInt16(int16_t *pData, unsigned long WordCount=1)
Reads WordCount number of 16 Bit signed integer words and copies it into the buffer pointed by pData...
split_type_t
Intended for internal usage: will be used to convert a dimension value into the corresponding dimensi...
Alternating loop (forward/backward, also known as Ping Pong)
unsigned long loop_cycles_left
How many times the loop has still to be passed, this value will be decremented with each loop cycle...
void SetSampleChecksum(Sample *pSample, uint32_t crc)
Updates the 3crc chunk with the checksum of a sample.
Sample * GetNextSample()
Returns the next Sample of the Group.
uint8_t EG2ControllerReleaseInfluence
Amount EG2 Controller has influence on the EG2 Release time (0 - 3, where 0 means off)...
unsigned long Write(void *pData, unsigned long WordCount, unsigned long WordSize)
Writes WordCount number of data words with given WordSize from the buffer pointed by pData...
SampleList::iterator SamplesIterator
List * GetParent()
Returns pointer to the chunk's parent list chunk.
uint16_t EG2PreAttack
Preattack value of the filter cutoff EG (0 - 1000 permille).
Chunk * AddSubChunk(uint32_t uiChunkID, uint uiBodySize)
Creates a new sub chunk.
uint32_t Loops
Caution: Use the respective field in the DimensionRegion instead of this one! (Intended purpose: Numb...
bool LFO2Sync
If set to true only one LFO should be used for all voices.
uint32_t SMPTEOffset
The SMPTE Offset value specifies the time offset to be used for the synchronization / calibration to ...
unsigned long FileNo
File number (> 0 when sample is stored in an extension file, 0 when it's in the gig) ...
Sample * GetFirstSample(progress_t *pProgress=NULL)
Returns a pointer to the first Sample object of the file, NULL otherwise.
bool EG1ControllerInvert
Invert values coming from defined EG1 controller.
Ordinary MIDI control change controller, see field 'controller_number'.
vcf_type_t
Defines which frequencies are filtered by the VCF.
version_t * pVersion
Points to a version_t structure if the file provided a version number else is set to NULL...
void DeleteInstrument(Instrument *pInstrument)
Delete an instrument.
uint16_t LFO2ControlDepth
Controller depth influencing filter cutoff LFO pitch (0 - 1200).
uint32_t LoopStart
The start value specifies the offset (in sample points) in the waveform data of the first sample poin...
RegionList::iterator RegionsIterator
int16_t EG3Depth
Depth of the sample pitch EG (-1200 - +1200).
bool GetAutoLoad()
Returns whether automatic loading is enabled.
uint8_t VCFKeyboardTrackingBreakpoint
See VCFKeyboardTracking (0 - 127).
eg2_ctrl_t EG2Controller
MIDI Controller which has influence on filter cutoff EG parameters (attack, decay, release).
For layering of up to 8 instruments (and eventually crossfading of 2 or 4 layers).
void * LoadChunkData()
Load chunk body into RAM.
bool VCFCutoffControllerInvert
Inverts values coming from the defined cutoff controller.
Different samples triggered each time a note is played, random order.
void * custom
This pointer can be used for arbitrary data.
double EG2Release
Release time of the filter cutoff EG (0.000 - 60.000s).
uint8_t EG1ControllerReleaseInfluence
Amount EG1 Controller has influence on the EG1 Release time (0 - 3, where 0 means off)...
float factor
Reflects current progress as value between 0.0 and 1.0.
uint8_t EG2ControllerDecayInfluence
Amount EG2 Controller has influence on the EG2 Decay time (0 - 3, where 0 means off).
Abstract base class for all MIDI rules.
void SetVelocityResponseCurveScaling(uint8_t scaling)
Updates the respective member variable and the lookup table / cache that depends on this value...
dimension_t
Defines the type of dimension, that is how the dimension zones (and thus how the dimension regions ar...
uint32_t LoopEnd
Caution: Use the respective field in the DimensionRegion instead of this one! (Intended purpose: The ...
curve_type_t ReleaseVelocityResponseCurve
Defines a transformation curve to the incoming release veloctiy values affecting envelope times...
Different samples triggered each time a note is played, dimension regions selected in sequence...
dimension_def_t pDimensionDefinitions[8]
Defines the five (gig2) or eight (gig3) possible dimensions (the dimension's controller and number of...
uint8_t zones
Number of zones the dimension has.
Effect 5 Depth (MIDI Controller 95)
#define GIG_EXP_DECODE(x)
(so far) every exponential paramater in the gig format has a basis of 1.000000008813822 ...
uint8_t AttenuationControllerThreshold
0-127
buffer_t GetCache()
Returns current cached sample points.
void SetVCFVelocityDynamicRange(uint8_t range)
Updates the respective member variable and the lookup table / cache that depends on this value...
vcf_cutoff_ctrl_t
Defines how the filter cutoff frequency is controlled by.
Encapsulates sample waves used for playback.
virtual void SetGain(int32_t gain)
Updates the respective member variable and updates SampleAttenuation which depends on this value...
List * AddSubList(uint32_t uiListType)
Creates a new list sub chunk.
Group(File *file, RIFF::Chunk *ck3gnm)
Constructor.
InstrumentList * pInstruments
virtual void UpdateChunks()
Apply sample and its settings to the respective RIFF chunks.
unsigned long GuessSize(unsigned long samples)
dimension value between 0-127
int16_t LFO3InternalDepth
Firm depth of the sample pitch LFO (-1200 - +1200 cents).
String Software
<ISFT-ck>. Identifies the name of the sofware package used to create the file.
String ArchivalLocation
<IARL-ck>. Indicates where the subject of the file is stored.
Sample * GetNextSample()
Returns a pointer to the next Sample object of the file, NULL otherwise.
unsigned long ulWavePoolOffset
double EG2Decay2
Only if EG2InfiniteSustain == false: 2nd stage decay time of the filter cutoff EG (0...
Encapsulates sample waves used for playback.
type_t type
Controller type.
uint controller_number
MIDI controller number if this controller is a control change controller, 0 otherwise.
uint8_t * VelocityTable
For velocity dimensions with custom defined zone ranges only: used for fast converting from velocity ...
void MoveSubChunk(Chunk *pSrc, Chunk *pDst)
Moves a sub chunk.
uint32_t SamplesPerSecond
Sampling rate at which each channel should be played (defaults to 44100 if Sample was created with In...
curve_type_t VelocityResponseCurve
Defines a transformation curve to the incoming velocity values affecting amplitude (usually you don't...
uint16_t EG1Sustain
Sustain value of the sample amplitude EG (0 - 1000 permille).
unsigned long NullExtensionSize
The buffer might be bigger than the actual data, if that's the case that unused space at the end of t...
void SetVelocityResponseDepth(uint8_t depth)
Updates the respective member variable and the lookup table / cache that depends on this value...
Sample * GetSampleFromWavePool(unsigned int WavePoolTableIndex, progress_t *pProgress=NULL)
uint8_t DimensionUpperLimits[8]
gig3: defines the upper limit of the dimension values for this dimension region
uint8_t TriggerPoint
The CC value to pass for the note to be triggered.
uint8_t VelocityResponseDepth
Dynamic range of velocity affecting amplitude (0 - 4) (usually you don't have to interpret this param...
uint32_t LoopFraction
The fractional value specifies a fraction of a sample at which to loop. This allows a loop to be fine...
uint32_t TruncatedBits
For 24-bit compressed samples only: number of bits truncated during compression (0, 4 or 6)
Instrument * GetInstrument(uint index, progress_t *pProgress=NULL)
Returns the instrument with the given index.
unsigned long ReadUint16(uint16_t *pData, unsigned long WordCount=1)
Reads WordCount number of 16 Bit unsigned integer words and copies it into the buffer pointed by pDat...
virtual void UpdateChunks()
Apply sample and its settings to the respective RIFF chunks.
int8_t Pan
Panorama / Balance (-64..0..63 <-> left..middle..right)
Only internally controlled.
Parses Gigasampler files and provides abstract access to the data.
void DeleteRegion(Region *pRegion)
lfo2_ctrl_t
Defines how LFO2 is controlled by.
Dimension for keyswitching.
void SetReleaseVelocityResponseDepth(uint8_t depth)
Updates the respective member variable and the lookup table / cache that depends on this value...
Sample * GetFirstSample()
Returns the first Sample of this Group.
struct gig::MidiRuleCtrlTrigger::trigger_t pTriggers[32]
uint16_t EG2Sustain
Sustain value of the filter cutoff EG (0 - 1000 permille).
uint32_t Instruments
Reflects the number of available Instrument objects.
Provides all neccessary information for the synthesis of a DLS Instrument.
Provides all neccessary information for the synthesis of an Instrument.
void DeleteGroup(Group *pGroup)
Delete a group and its samples.
bool SustainDefeat
If true: Sustain pedal will not hold a note.
buffer_t RAMCache
Buffers samples (already uncompressed) in RAM.
bool NoteOff
If a note off should be triggered instead of a note on.
String libraryName()
Returns the name of this C++ library.
virtual void LoadGroups()
Quadtuple version number ("major.minor.release.build").
double LFO2Frequency
Frequency of the filter cutoff LFO (0.10 - 10.00 Hz).
unsigned long GetNewSize()
New chunk size if it was modified with Resize().
uint32_t SamplePeriod
Specifies the duration of time that passes during the playback of one sample in nanoseconds (normally...
uint16_t EG1PreAttack
Preattack value of the sample amplitude EG (0 - 1000 permille).
unsigned long * FrameTable
For positioning within compressed samples only: stores the offset values for each frame...
curve_type_t
Defines the shape of a function graph.
uint8_t bits
Number of "bits" (1 bit = 2 splits/zones, 2 bit = 4 splits/zones, 3 bit = 8 splits/zones,...).
uint8_t out_start
Start position of fade out.
uint8_t VCFCutoff
Max. cutoff frequency.
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...
unsigned long SetPos(unsigned long SampleCount, RIFF::stream_whence_t Whence=RIFF::stream_start)
Sets the position within the sample (in sample points, not in bytes).
Info * pInfo
Points (in any case) to an Info object, providing additional, optional infos and comments.
uint32_t Manufacturer
Specifies the MIDI Manufacturer's Association (MMA) Manufacturer code for the sampler intended to rec...
uint8_t high
High value of range.
virtual void UpdateChunks()
Apply all sample player options to the respective RIFF chunk.
bool OverridePedal
If a note off should be triggered even if the sustain pedal is down.
Reflects the current playback state for a sample.
Region * GetParent() const
General dimension definition.
eg1_ctrl_t EG1Controller
MIDI Controller which has influence on sample amplitude EG parameters (attack, decay, release).
uint32_t * pWavePoolTableHi
split_type_t split_type
Intended for internal usage: will be used to convert a dimension value into the corresponding dimensi...
If used sample has more than one channel (thus is not mono).
void Resize(int iNewSize)
Resize chunk.
void SetReleaseVelocityResponseCurve(curve_type_t curve)
Updates the respective member variable and the lookup table / cache that depends on this value...
vcf_res_ctrl_t VCFResonanceController
Specifies which external controller has influence on the filter resonance Q.
curve_type_t VCFVelocityCurve
Defines a transformation curve for the incoming velocity values, affecting the VCF.
#define GIG_PITCH_TRACK_ENCODE(x)
uint8_t EG1ControllerDecayInfluence
Amount EG1 Controller has influence on the EG1 Decay time (0 - 3, where 0 means off).
List * GetNextSubList()
Returns the next sublist (that is a subchunk with chunk ID "LIST") within the list.
Defines Region information of an Instrument.
Effect 4 Depth (MIDI Controller 94)
double GetVelocityAttenuation(uint8_t MIDIKeyVelocity)
Returns the correct amplitude factor for the given MIDIKeyVelocity.
std::list< RIFF::File * > ExtensionFiles
Sample * GetSample()
Returns pointer address to the Sample referenced with this region.
void SetVelocityResponseCurve(curve_type_t curve)
Updates the respective member variable and the lookup table / cache that depends on this value...
#define GIG_EG_CTR_DECAY_INFLUENCE_EXTRACT(x)
double EG1Attack
Attack time of the sample amplitude EG (0.000 - 60.000s).
MidiRuleCtrlTrigger(RIFF::Chunk *_3ewg)
unsigned long ReadInt8(int8_t *pData, unsigned long WordCount=1)
Reads WordCount number of 8 Bit signed integer words and copies it into the buffer pointed by pData...
unsigned long ReadUint8(uint8_t *pData, unsigned long WordCount=1)
Reads WordCount number of 8 Bit unsigned integer words and copies it into the buffer pointed by pData...
std::list< Region * > RegionList
Region * GetNextRegion()
Returns the next Region of the instrument.