1732 |
VCFType = vcf_type_lowpass; |
VCFType = vcf_type_lowpass; |
1733 |
memset(DimensionUpperLimits, 127, 8); |
memset(DimensionUpperLimits, 127, 8); |
1734 |
} |
} |
1735 |
// format extension for EG behavior options, these will *NOT* work with |
// chunk for own format extensions, these will *NOT* work with Gigasampler/GigaStudio ! |
|
// Gigasampler/GigaStudio ! |
|
1736 |
RIFF::Chunk* lsde = _3ewl->GetSubChunk(CHUNK_ID_LSDE); |
RIFF::Chunk* lsde = _3ewl->GetSubChunk(CHUNK_ID_LSDE); |
1737 |
if (lsde) { |
if (lsde) { // format extension for EG behavior options |
1738 |
eg_opt_t* pEGOpts[2] = { &EG1Options, &EG2Options }; |
eg_opt_t* pEGOpts[2] = { &EG1Options, &EG2Options }; |
1739 |
for (int i = 0; i < 2; ++i) { |
for (int i = 0; i < 2; ++i) { // NOTE: we reserved a 3rd byte for a potential future EG3 option |
1740 |
unsigned char byte = lsde->ReadUint8(); |
unsigned char byte = lsde->ReadUint8(); |
1741 |
pEGOpts[i]->AttackCancel = byte & 1; |
pEGOpts[i]->AttackCancel = byte & 1; |
1742 |
pEGOpts[i]->AttackHoldCancel = byte & (1 << 1); |
pEGOpts[i]->AttackHoldCancel = byte & (1 << 1); |
1745 |
pEGOpts[i]->ReleaseCancel = byte & (1 << 4); |
pEGOpts[i]->ReleaseCancel = byte & (1 << 4); |
1746 |
} |
} |
1747 |
} |
} |
1748 |
|
// format extension for sustain pedal up effect on release trigger samples |
1749 |
|
if (lsde && lsde->GetSize() > 3) { // NOTE: we reserved the 3rd byte for a potential future EG3 option |
1750 |
|
lsde->SetPos(3); |
1751 |
|
SustainReleaseTrigger = static_cast<sust_rel_trg_t>(lsde->ReadUint8()); |
1752 |
|
} else SustainReleaseTrigger = sust_rel_trg_none; |
1753 |
|
|
1754 |
pVelocityAttenuationTable = GetVelocityTable(VelocityResponseCurve, |
pVelocityAttenuationTable = GetVelocityTable(VelocityResponseCurve, |
1755 |
VelocityResponseDepth, |
VelocityResponseDepth, |
1940 |
SRLZ(SampleAttenuation); |
SRLZ(SampleAttenuation); |
1941 |
SRLZ(EG1Options); |
SRLZ(EG1Options); |
1942 |
SRLZ(EG2Options); |
SRLZ(EG2Options); |
1943 |
|
SRLZ(SustainReleaseTrigger); |
1944 |
|
|
1945 |
// derived attributes from DLS::Sampler |
// derived attributes from DLS::Sampler |
1946 |
SRLZ(FineTune); |
SRLZ(FineTune); |
2248 |
memcpy(&pData[140], DimensionUpperLimits, 8); |
memcpy(&pData[140], DimensionUpperLimits, 8); |
2249 |
} |
} |
2250 |
|
|
2251 |
// format extension for EG behavior options, these will *NOT* work with |
// chunk for own format extensions, these will *NOT* work with |
2252 |
// Gigasampler/GigaStudio ! |
// Gigasampler/GigaStudio ! |
2253 |
RIFF::Chunk* lsde = pParentList->GetSubChunk(CHUNK_ID_LSDE); |
RIFF::Chunk* lsde = pParentList->GetSubChunk(CHUNK_ID_LSDE); |
2254 |
|
const int lsdeSize = 4; // NOTE: we reserved the 3rd byte for a potential future EG3 option |
2255 |
if (!lsde) { |
if (!lsde) { |
2256 |
// only add this "LSDE" chunk if the EG options do not match the |
// only add this "LSDE" chunk if either EG options or sustain |
2257 |
// default EG behavior |
// release trigger option deviate from their default behaviour |
2258 |
eg_opt_t defaultOpt; |
eg_opt_t defaultOpt; |
2259 |
if (memcmp(&EG1Options, &defaultOpt, sizeof(eg_opt_t)) || |
if (memcmp(&EG1Options, &defaultOpt, sizeof(eg_opt_t)) || |
2260 |
memcmp(&EG2Options, &defaultOpt, sizeof(eg_opt_t))) |
memcmp(&EG2Options, &defaultOpt, sizeof(eg_opt_t)) || |
2261 |
|
SustainReleaseTrigger) |
2262 |
{ |
{ |
2263 |
lsde = pParentList->AddSubChunk(CHUNK_ID_LSDE, 2); |
lsde = pParentList->AddSubChunk(CHUNK_ID_LSDE, lsdeSize); |
2264 |
// move LSDE chunk to the end of parent list |
// move LSDE chunk to the end of parent list |
2265 |
pParentList->MoveSubChunk(lsde, (RIFF::Chunk*)NULL); |
pParentList->MoveSubChunk(lsde, (RIFF::Chunk*)NULL); |
2266 |
} |
} |
2267 |
} |
} |
2268 |
if (lsde) { |
if (lsde) { |
2269 |
|
if (lsde->GetNewSize() < lsdeSize) |
2270 |
|
lsde->Resize(lsdeSize); |
2271 |
|
// format extension for EG behavior options |
2272 |
unsigned char* pData = (unsigned char*) lsde->LoadChunkData(); |
unsigned char* pData = (unsigned char*) lsde->LoadChunkData(); |
2273 |
eg_opt_t* pEGOpts[2] = { &EG1Options, &EG2Options }; |
eg_opt_t* pEGOpts[2] = { &EG1Options, &EG2Options }; |
2274 |
for (int i = 0; i < 2; ++i) { |
for (int i = 0; i < 2; ++i) { // NOTE: we reserved the 3rd byte for a potential future EG3 option |
2275 |
pData[i] = |
pData[i] = |
2276 |
(pEGOpts[i]->AttackCancel ? 1 : 0) | |
(pEGOpts[i]->AttackCancel ? 1 : 0) | |
2277 |
(pEGOpts[i]->AttackHoldCancel ? (1<<1) : 0) | |
(pEGOpts[i]->AttackHoldCancel ? (1<<1) : 0) | |
2279 |
(pEGOpts[i]->Decay2Cancel ? (1<<3) : 0) | |
(pEGOpts[i]->Decay2Cancel ? (1<<3) : 0) | |
2280 |
(pEGOpts[i]->ReleaseCancel ? (1<<4) : 0); |
(pEGOpts[i]->ReleaseCancel ? (1<<4) : 0); |
2281 |
} |
} |
2282 |
|
// format extension for effect of sustain pedal up event on release trigger samples |
2283 |
|
pData[3] = static_cast<uint8_t>(SustainReleaseTrigger); |
2284 |
} |
} |
2285 |
} |
} |
2286 |
|
|