279 |
* is located, 0 otherwise |
* is located, 0 otherwise |
280 |
*/ |
*/ |
281 |
Sample::Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset, unsigned long fileNo) : DLS::Sample((DLS::File*) pFile, waveList, WavePoolOffset) { |
Sample::Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset, unsigned long fileNo) : DLS::Sample((DLS::File*) pFile, waveList, WavePoolOffset) { |
282 |
|
pInfo->UseFixedLengthStrings = true; |
283 |
Instances++; |
Instances++; |
284 |
FileNo = fileNo; |
FileNo = fileNo; |
285 |
|
|
376 |
if (!pCkSmpl) pCkSmpl = pWaveList->AddSubChunk(CHUNK_ID_SMPL, 60); |
if (!pCkSmpl) pCkSmpl = pWaveList->AddSubChunk(CHUNK_ID_SMPL, 60); |
377 |
// update 'smpl' chunk |
// update 'smpl' chunk |
378 |
uint8_t* pData = (uint8_t*) pCkSmpl->LoadChunkData(); |
uint8_t* pData = (uint8_t*) pCkSmpl->LoadChunkData(); |
379 |
SamplePeriod = 1 / SamplesPerSecond; |
SamplePeriod = uint32_t(1000000000.0 / SamplesPerSecond + 0.5); |
380 |
memcpy(&pData[0], &Manufacturer, 4); |
memcpy(&pData[0], &Manufacturer, 4); |
381 |
memcpy(&pData[4], &Product, 4); |
memcpy(&pData[4], &Product, 4); |
382 |
memcpy(&pData[8], &SamplePeriod, 4); |
memcpy(&pData[8], &SamplePeriod, 4); |
1167 |
|
|
1168 |
RIFF::Chunk* _3ewa = _3ewl->GetSubChunk(CHUNK_ID_3EWA); |
RIFF::Chunk* _3ewa = _3ewl->GetSubChunk(CHUNK_ID_3EWA); |
1169 |
if (_3ewa) { // if '3ewa' chunk exists |
if (_3ewa) { // if '3ewa' chunk exists |
1170 |
_3ewa->ReadInt32(); // unknown, always 0x0000008C ? |
_3ewa->ReadInt32(); // unknown, always == chunk size ? |
1171 |
LFO3Frequency = (double) GIG_EXP_DECODE(_3ewa->ReadInt32()); |
LFO3Frequency = (double) GIG_EXP_DECODE(_3ewa->ReadInt32()); |
1172 |
EG3Attack = (double) GIG_EXP_DECODE(_3ewa->ReadInt32()); |
EG3Attack = (double) GIG_EXP_DECODE(_3ewa->ReadInt32()); |
1173 |
_3ewa->ReadInt16(); // unknown |
_3ewa->ReadInt16(); // unknown |
1447 |
|
|
1448 |
// update '3ewa' chunk with DimensionRegion's current settings |
// update '3ewa' chunk with DimensionRegion's current settings |
1449 |
|
|
1450 |
const uint32_t unknown = 0x0000008C; // unknown, always 0x0000008C ? |
const uint32_t unknown = _3ewa->GetSize(); // unknown, always chunk size ? |
1451 |
memcpy(&pData[0], &unknown, 4); |
memcpy(&pData[0], &unknown, 4); |
1452 |
|
|
1453 |
const int32_t lfo3freq = (int32_t) GIG_EXP_ENCODE(LFO3Frequency); |
const int32_t lfo3freq = (int32_t) GIG_EXP_ENCODE(LFO3Frequency); |
1454 |
memcpy(&pData[4], &lfo3freq, 4); |
memcpy(&pData[4], &lfo3freq, 4); |
1455 |
|
|
1456 |
const int32_t eg3attack = (int32_t) GIG_EXP_ENCODE(EG3Attack); |
const int32_t eg3attack = (int32_t) GIG_EXP_ENCODE(EG3Attack); |
1457 |
memcpy(&pData[4], &eg3attack, 4); |
memcpy(&pData[8], &eg3attack, 4); |
1458 |
|
|
1459 |
// next 2 bytes unknown |
// next 2 bytes unknown |
1460 |
|
|
1461 |
memcpy(&pData[10], &LFO1InternalDepth, 2); |
memcpy(&pData[14], &LFO1InternalDepth, 2); |
1462 |
|
|
1463 |
// next 2 bytes unknown |
// next 2 bytes unknown |
1464 |
|
|
1465 |
memcpy(&pData[14], &LFO3InternalDepth, 2); |
memcpy(&pData[18], &LFO3InternalDepth, 2); |
1466 |
|
|
1467 |
// next 2 bytes unknown |
// next 2 bytes unknown |
1468 |
|
|
1469 |
memcpy(&pData[18], &LFO1ControlDepth, 2); |
memcpy(&pData[22], &LFO1ControlDepth, 2); |
1470 |
|
|
1471 |
// next 2 bytes unknown |
// next 2 bytes unknown |
1472 |
|
|
1473 |
memcpy(&pData[22], &LFO3ControlDepth, 2); |
memcpy(&pData[26], &LFO3ControlDepth, 2); |
1474 |
|
|
1475 |
const int32_t eg1attack = (int32_t) GIG_EXP_ENCODE(EG1Attack); |
const int32_t eg1attack = (int32_t) GIG_EXP_ENCODE(EG1Attack); |
1476 |
memcpy(&pData[24], &eg1attack, 4); |
memcpy(&pData[28], &eg1attack, 4); |
1477 |
|
|
1478 |
const int32_t eg1decay1 = (int32_t) GIG_EXP_ENCODE(EG1Decay1); |
const int32_t eg1decay1 = (int32_t) GIG_EXP_ENCODE(EG1Decay1); |
1479 |
memcpy(&pData[28], &eg1decay1, 4); |
memcpy(&pData[32], &eg1decay1, 4); |
1480 |
|
|
1481 |
// next 2 bytes unknown |
// next 2 bytes unknown |
1482 |
|
|
1483 |
memcpy(&pData[34], &EG1Sustain, 2); |
memcpy(&pData[38], &EG1Sustain, 2); |
1484 |
|
|
1485 |
const int32_t eg1release = (int32_t) GIG_EXP_ENCODE(EG1Release); |
const int32_t eg1release = (int32_t) GIG_EXP_ENCODE(EG1Release); |
1486 |
memcpy(&pData[36], &eg1release, 4); |
memcpy(&pData[40], &eg1release, 4); |
1487 |
|
|
1488 |
const uint8_t eg1ctl = (uint8_t) EncodeLeverageController(EG1Controller); |
const uint8_t eg1ctl = (uint8_t) EncodeLeverageController(EG1Controller); |
1489 |
memcpy(&pData[40], &eg1ctl, 1); |
memcpy(&pData[44], &eg1ctl, 1); |
1490 |
|
|
1491 |
const uint8_t eg1ctrloptions = |
const uint8_t eg1ctrloptions = |
1492 |
(EG1ControllerInvert) ? 0x01 : 0x00 | |
(EG1ControllerInvert) ? 0x01 : 0x00 | |
1493 |
GIG_EG_CTR_ATTACK_INFLUENCE_ENCODE(EG1ControllerAttackInfluence) | |
GIG_EG_CTR_ATTACK_INFLUENCE_ENCODE(EG1ControllerAttackInfluence) | |
1494 |
GIG_EG_CTR_DECAY_INFLUENCE_ENCODE(EG1ControllerDecayInfluence) | |
GIG_EG_CTR_DECAY_INFLUENCE_ENCODE(EG1ControllerDecayInfluence) | |
1495 |
GIG_EG_CTR_RELEASE_INFLUENCE_ENCODE(EG1ControllerReleaseInfluence); |
GIG_EG_CTR_RELEASE_INFLUENCE_ENCODE(EG1ControllerReleaseInfluence); |
1496 |
memcpy(&pData[41], &eg1ctrloptions, 1); |
memcpy(&pData[45], &eg1ctrloptions, 1); |
1497 |
|
|
1498 |
const uint8_t eg2ctl = (uint8_t) EncodeLeverageController(EG2Controller); |
const uint8_t eg2ctl = (uint8_t) EncodeLeverageController(EG2Controller); |
1499 |
memcpy(&pData[42], &eg2ctl, 1); |
memcpy(&pData[46], &eg2ctl, 1); |
1500 |
|
|
1501 |
const uint8_t eg2ctrloptions = |
const uint8_t eg2ctrloptions = |
1502 |
(EG2ControllerInvert) ? 0x01 : 0x00 | |
(EG2ControllerInvert) ? 0x01 : 0x00 | |
1503 |
GIG_EG_CTR_ATTACK_INFLUENCE_ENCODE(EG2ControllerAttackInfluence) | |
GIG_EG_CTR_ATTACK_INFLUENCE_ENCODE(EG2ControllerAttackInfluence) | |
1504 |
GIG_EG_CTR_DECAY_INFLUENCE_ENCODE(EG2ControllerDecayInfluence) | |
GIG_EG_CTR_DECAY_INFLUENCE_ENCODE(EG2ControllerDecayInfluence) | |
1505 |
GIG_EG_CTR_RELEASE_INFLUENCE_ENCODE(EG2ControllerReleaseInfluence); |
GIG_EG_CTR_RELEASE_INFLUENCE_ENCODE(EG2ControllerReleaseInfluence); |
1506 |
memcpy(&pData[43], &eg2ctrloptions, 1); |
memcpy(&pData[47], &eg2ctrloptions, 1); |
1507 |
|
|
1508 |
const int32_t lfo1freq = (int32_t) GIG_EXP_ENCODE(LFO1Frequency); |
const int32_t lfo1freq = (int32_t) GIG_EXP_ENCODE(LFO1Frequency); |
1509 |
memcpy(&pData[44], &lfo1freq, 4); |
memcpy(&pData[48], &lfo1freq, 4); |
1510 |
|
|
1511 |
const int32_t eg2attack = (int32_t) GIG_EXP_ENCODE(EG2Attack); |
const int32_t eg2attack = (int32_t) GIG_EXP_ENCODE(EG2Attack); |
1512 |
memcpy(&pData[48], &eg2attack, 4); |
memcpy(&pData[52], &eg2attack, 4); |
1513 |
|
|
1514 |
const int32_t eg2decay1 = (int32_t) GIG_EXP_ENCODE(EG2Decay1); |
const int32_t eg2decay1 = (int32_t) GIG_EXP_ENCODE(EG2Decay1); |
1515 |
memcpy(&pData[52], &eg2decay1, 4); |
memcpy(&pData[56], &eg2decay1, 4); |
1516 |
|
|
1517 |
// next 2 bytes unknown |
// next 2 bytes unknown |
1518 |
|
|
1519 |
memcpy(&pData[58], &EG2Sustain, 2); |
memcpy(&pData[62], &EG2Sustain, 2); |
1520 |
|
|
1521 |
const int32_t eg2release = (int32_t) GIG_EXP_ENCODE(EG2Release); |
const int32_t eg2release = (int32_t) GIG_EXP_ENCODE(EG2Release); |
1522 |
memcpy(&pData[60], &eg2release, 4); |
memcpy(&pData[64], &eg2release, 4); |
1523 |
|
|
1524 |
// next 2 bytes unknown |
// next 2 bytes unknown |
1525 |
|
|
1526 |
memcpy(&pData[66], &LFO2ControlDepth, 2); |
memcpy(&pData[70], &LFO2ControlDepth, 2); |
1527 |
|
|
1528 |
const int32_t lfo2freq = (int32_t) GIG_EXP_ENCODE(LFO2Frequency); |
const int32_t lfo2freq = (int32_t) GIG_EXP_ENCODE(LFO2Frequency); |
1529 |
memcpy(&pData[68], &lfo2freq, 4); |
memcpy(&pData[72], &lfo2freq, 4); |
1530 |
|
|
1531 |
// next 2 bytes unknown |
// next 2 bytes unknown |
1532 |
|
|
1533 |
memcpy(&pData[72], &LFO2InternalDepth, 2); |
memcpy(&pData[78], &LFO2InternalDepth, 2); |
1534 |
|
|
1535 |
const int32_t eg1decay2 = (int32_t) (EG1InfiniteSustain) ? 0x7fffffff : (int32_t) GIG_EXP_ENCODE(EG1Decay2); |
const int32_t eg1decay2 = (int32_t) (EG1InfiniteSustain) ? 0x7fffffff : (int32_t) GIG_EXP_ENCODE(EG1Decay2); |
1536 |
memcpy(&pData[74], &eg1decay2, 4); |
memcpy(&pData[80], &eg1decay2, 4); |
1537 |
|
|
1538 |
// next 2 bytes unknown |
// next 2 bytes unknown |
1539 |
|
|
1540 |
memcpy(&pData[80], &EG1PreAttack, 2); |
memcpy(&pData[86], &EG1PreAttack, 2); |
1541 |
|
|
1542 |
const int32_t eg2decay2 = (int32_t) (EG2InfiniteSustain) ? 0x7fffffff : (int32_t) GIG_EXP_ENCODE(EG2Decay2); |
const int32_t eg2decay2 = (int32_t) (EG2InfiniteSustain) ? 0x7fffffff : (int32_t) GIG_EXP_ENCODE(EG2Decay2); |
1543 |
memcpy(&pData[82], &eg2decay2, 4); |
memcpy(&pData[88], &eg2decay2, 4); |
1544 |
|
|
1545 |
// next 2 bytes unknown |
// next 2 bytes unknown |
1546 |
|
|
1547 |
memcpy(&pData[88], &EG2PreAttack, 2); |
memcpy(&pData[94], &EG2PreAttack, 2); |
1548 |
|
|
1549 |
{ |
{ |
1550 |
if (VelocityResponseDepth > 4) throw Exception("VelocityResponseDepth must be between 0 and 4"); |
if (VelocityResponseDepth > 4) throw Exception("VelocityResponseDepth must be between 0 and 4"); |
1562 |
default: |
default: |
1563 |
throw Exception("Could not update DimensionRegion's chunk, unknown VelocityResponseCurve selected"); |
throw Exception("Could not update DimensionRegion's chunk, unknown VelocityResponseCurve selected"); |
1564 |
} |
} |
1565 |
memcpy(&pData[90], &velocityresponse, 1); |
memcpy(&pData[96], &velocityresponse, 1); |
1566 |
} |
} |
1567 |
|
|
1568 |
{ |
{ |
1581 |
default: |
default: |
1582 |
throw Exception("Could not update DimensionRegion's chunk, unknown ReleaseVelocityResponseCurve selected"); |
throw Exception("Could not update DimensionRegion's chunk, unknown ReleaseVelocityResponseCurve selected"); |
1583 |
} |
} |
1584 |
memcpy(&pData[91], &releasevelocityresponse, 1); |
memcpy(&pData[97], &releasevelocityresponse, 1); |
1585 |
} |
} |
1586 |
|
|
1587 |
memcpy(&pData[92], &VelocityResponseCurveScaling, 1); |
memcpy(&pData[98], &VelocityResponseCurveScaling, 1); |
1588 |
|
|
1589 |
memcpy(&pData[93], &AttenuationControllerThreshold, 1); |
memcpy(&pData[99], &AttenuationControllerThreshold, 1); |
1590 |
|
|
1591 |
// next 4 bytes unknown |
// next 4 bytes unknown |
1592 |
|
|
1593 |
memcpy(&pData[98], &SampleStartOffset, 2); |
memcpy(&pData[104], &SampleStartOffset, 2); |
1594 |
|
|
1595 |
// next 2 bytes unknown |
// next 2 bytes unknown |
1596 |
|
|
1609 |
default: |
default: |
1610 |
throw Exception("Could not update DimensionRegion's chunk, unknown DimensionBypass selected"); |
throw Exception("Could not update DimensionRegion's chunk, unknown DimensionBypass selected"); |
1611 |
} |
} |
1612 |
memcpy(&pData[102], &pitchTrackDimensionBypass, 1); |
memcpy(&pData[108], &pitchTrackDimensionBypass, 1); |
1613 |
} |
} |
1614 |
|
|
1615 |
const uint8_t pan = (Pan >= 0) ? Pan : ((-Pan) + 63); // signed 8 bit -> signed 7 bit |
const uint8_t pan = (Pan >= 0) ? Pan : ((-Pan) + 63); // signed 8 bit -> signed 7 bit |
1616 |
memcpy(&pData[103], &pan, 1); |
memcpy(&pData[109], &pan, 1); |
1617 |
|
|
1618 |
const uint8_t selfmask = (SelfMask) ? 0x01 : 0x00; |
const uint8_t selfmask = (SelfMask) ? 0x01 : 0x00; |
1619 |
memcpy(&pData[104], &selfmask, 1); |
memcpy(&pData[110], &selfmask, 1); |
1620 |
|
|
1621 |
// next byte unknown |
// next byte unknown |
1622 |
|
|
1625 |
if (LFO3Sync) lfo3ctrl |= 0x20; // bit 5 |
if (LFO3Sync) lfo3ctrl |= 0x20; // bit 5 |
1626 |
if (InvertAttenuationController) lfo3ctrl |= 0x80; // bit 7 |
if (InvertAttenuationController) lfo3ctrl |= 0x80; // bit 7 |
1627 |
if (VCFType == vcf_type_lowpassturbo) lfo3ctrl |= 0x40; // bit 6 |
if (VCFType == vcf_type_lowpassturbo) lfo3ctrl |= 0x40; // bit 6 |
1628 |
memcpy(&pData[106], &lfo3ctrl, 1); |
memcpy(&pData[112], &lfo3ctrl, 1); |
1629 |
} |
} |
1630 |
|
|
1631 |
const uint8_t attenctl = EncodeLeverageController(AttenuationController); |
const uint8_t attenctl = EncodeLeverageController(AttenuationController); |
1632 |
memcpy(&pData[107], &attenctl, 1); |
memcpy(&pData[113], &attenctl, 1); |
1633 |
|
|
1634 |
{ |
{ |
1635 |
uint8_t lfo2ctrl = LFO2Controller & 0x07; // lower 3 bits |
uint8_t lfo2ctrl = LFO2Controller & 0x07; // lower 3 bits |
1636 |
if (LFO2FlipPhase) lfo2ctrl |= 0x80; // bit 7 |
if (LFO2FlipPhase) lfo2ctrl |= 0x80; // bit 7 |
1637 |
if (LFO2Sync) lfo2ctrl |= 0x20; // bit 5 |
if (LFO2Sync) lfo2ctrl |= 0x20; // bit 5 |
1638 |
if (VCFResonanceController != vcf_res_ctrl_none) lfo2ctrl |= 0x40; // bit 6 |
if (VCFResonanceController != vcf_res_ctrl_none) lfo2ctrl |= 0x40; // bit 6 |
1639 |
memcpy(&pData[108], &lfo2ctrl, 1); |
memcpy(&pData[114], &lfo2ctrl, 1); |
1640 |
} |
} |
1641 |
|
|
1642 |
{ |
{ |
1645 |
if (LFO1Sync) lfo1ctrl |= 0x40; // bit 6 |
if (LFO1Sync) lfo1ctrl |= 0x40; // bit 6 |
1646 |
if (VCFResonanceController != vcf_res_ctrl_none) |
if (VCFResonanceController != vcf_res_ctrl_none) |
1647 |
lfo1ctrl |= GIG_VCF_RESONANCE_CTRL_ENCODE(VCFResonanceController); |
lfo1ctrl |= GIG_VCF_RESONANCE_CTRL_ENCODE(VCFResonanceController); |
1648 |
memcpy(&pData[109], &lfo1ctrl, 1); |
memcpy(&pData[115], &lfo1ctrl, 1); |
1649 |
} |
} |
1650 |
|
|
1651 |
const uint16_t eg3depth = (EG3Depth >= 0) ? EG3Depth |
const uint16_t eg3depth = (EG3Depth >= 0) ? EG3Depth |
1652 |
: uint16_t(((-EG3Depth) - 1) ^ 0xffff); /* binary complementary for negatives */ |
: uint16_t(((-EG3Depth) - 1) ^ 0xffff); /* binary complementary for negatives */ |
1653 |
memcpy(&pData[110], &eg3depth, 1); |
memcpy(&pData[116], &eg3depth, 1); |
1654 |
|
|
1655 |
// next 2 bytes unknown |
// next 2 bytes unknown |
1656 |
|
|
1657 |
const uint8_t channeloffset = ChannelOffset * 4; |
const uint8_t channeloffset = ChannelOffset * 4; |
1658 |
memcpy(&pData[113], &channeloffset, 1); |
memcpy(&pData[120], &channeloffset, 1); |
1659 |
|
|
1660 |
{ |
{ |
1661 |
uint8_t regoptions = 0; |
uint8_t regoptions = 0; |
1662 |
if (MSDecode) regoptions |= 0x01; // bit 0 |
if (MSDecode) regoptions |= 0x01; // bit 0 |
1663 |
if (SustainDefeat) regoptions |= 0x02; // bit 1 |
if (SustainDefeat) regoptions |= 0x02; // bit 1 |
1664 |
memcpy(&pData[114], ®options, 1); |
memcpy(&pData[121], ®options, 1); |
1665 |
} |
} |
1666 |
|
|
1667 |
// next 2 bytes unknown |
// next 2 bytes unknown |
1668 |
|
|
1669 |
memcpy(&pData[117], &VelocityUpperLimit, 1); |
memcpy(&pData[124], &VelocityUpperLimit, 1); |
1670 |
|
|
1671 |
// next 3 bytes unknown |
// next 3 bytes unknown |
1672 |
|
|
1673 |
memcpy(&pData[121], &ReleaseTriggerDecay, 1); |
memcpy(&pData[128], &ReleaseTriggerDecay, 1); |
1674 |
|
|
1675 |
// next 2 bytes unknown |
// next 2 bytes unknown |
1676 |
|
|
1677 |
const uint8_t eg1hold = (EG1Hold) ? 0x80 : 0x00; // bit 7 |
const uint8_t eg1hold = (EG1Hold) ? 0x80 : 0x00; // bit 7 |
1678 |
memcpy(&pData[124], &eg1hold, 1); |
memcpy(&pData[131], &eg1hold, 1); |
1679 |
|
|
1680 |
const uint8_t vcfcutoff = (VCFEnabled) ? 0x80 : 0x00 | /* bit 7 */ |
const uint8_t vcfcutoff = (VCFEnabled) ? 0x80 : 0x00 | /* bit 7 */ |
1681 |
(VCFCutoff) ? 0x7f : 0x00; /* lower 7 bits */ |
(VCFCutoff & 0x7f); /* lower 7 bits */ |
1682 |
memcpy(&pData[125], &vcfcutoff, 1); |
memcpy(&pData[132], &vcfcutoff, 1); |
1683 |
|
|
1684 |
memcpy(&pData[126], &VCFCutoffController, 1); |
memcpy(&pData[133], &VCFCutoffController, 1); |
1685 |
|
|
1686 |
const uint8_t vcfvelscale = (VCFCutoffControllerInvert) ? 0x80 : 0x00 | /* bit 7 */ |
const uint8_t vcfvelscale = (VCFCutoffControllerInvert) ? 0x80 : 0x00 | /* bit 7 */ |
1687 |
(VCFVelocityScale) ? 0x7f : 0x00; /* lower 7 bits */ |
(VCFVelocityScale & 0x7f); /* lower 7 bits */ |
1688 |
memcpy(&pData[127], &vcfvelscale, 1); |
memcpy(&pData[134], &vcfvelscale, 1); |
1689 |
|
|
1690 |
// next byte unknown |
// next byte unknown |
1691 |
|
|
1692 |
const uint8_t vcfresonance = (VCFResonanceDynamic) ? 0x00 : 0x80 | /* bit 7 */ |
const uint8_t vcfresonance = (VCFResonanceDynamic) ? 0x00 : 0x80 | /* bit 7 */ |
1693 |
(VCFResonance) ? 0x7f : 0x00; /* lower 7 bits */ |
(VCFResonance & 0x7f); /* lower 7 bits */ |
1694 |
memcpy(&pData[129], &vcfresonance, 1); |
memcpy(&pData[136], &vcfresonance, 1); |
1695 |
|
|
1696 |
const uint8_t vcfbreakpoint = (VCFKeyboardTracking) ? 0x80 : 0x00 | /* bit 7 */ |
const uint8_t vcfbreakpoint = (VCFKeyboardTracking) ? 0x80 : 0x00 | /* bit 7 */ |
1697 |
(VCFKeyboardTrackingBreakpoint) ? 0x7f : 0x00; /* lower 7 bits */ |
(VCFKeyboardTrackingBreakpoint & 0x7f); /* lower 7 bits */ |
1698 |
memcpy(&pData[130], &vcfbreakpoint, 1); |
memcpy(&pData[137], &vcfbreakpoint, 1); |
1699 |
|
|
1700 |
const uint8_t vcfvelocity = VCFVelocityDynamicRange % 5 | |
const uint8_t vcfvelocity = VCFVelocityDynamicRange % 5 | |
1701 |
VCFVelocityCurve * 5; |
VCFVelocityCurve * 5; |
1702 |
memcpy(&pData[131], &vcfvelocity, 1); |
memcpy(&pData[138], &vcfvelocity, 1); |
1703 |
|
|
1704 |
const uint8_t vcftype = (VCFType == vcf_type_lowpassturbo) ? vcf_type_lowpass : VCFType; |
const uint8_t vcftype = (VCFType == vcf_type_lowpassturbo) ? vcf_type_lowpass : VCFType; |
1705 |
memcpy(&pData[132], &vcftype, 1); |
memcpy(&pData[139], &vcftype, 1); |
1706 |
} |
} |
1707 |
|
|
1708 |
// get the corresponding velocity table from the table map or create & calculate that table if it doesn't exist yet |
// get the corresponding velocity table from the table map or create & calculate that table if it doesn't exist yet |
2044 |
// * |
// * |
2045 |
|
|
2046 |
Region::Region(Instrument* pInstrument, RIFF::List* rgnList) : DLS::Region((DLS::Instrument*) pInstrument, rgnList) { |
Region::Region(Instrument* pInstrument, RIFF::List* rgnList) : DLS::Region((DLS::Instrument*) pInstrument, rgnList) { |
2047 |
|
pInfo->UseFixedLengthStrings = true; |
2048 |
|
|
2049 |
// Initialization |
// Initialization |
2050 |
Dimensions = 0; |
Dimensions = 0; |
2051 |
for (int i = 0; i < 256; i++) { |
for (int i = 0; i < 256; i++) { |
2113 |
uint32_t wavepoolindex = _3lnk->ReadUint32(); |
uint32_t wavepoolindex = _3lnk->ReadUint32(); |
2114 |
if (file->pWavePoolTable) pDimensionRegions[i]->pSample = GetSampleFromWavePool(wavepoolindex); |
if (file->pWavePoolTable) pDimensionRegions[i]->pSample = GetSampleFromWavePool(wavepoolindex); |
2115 |
} |
} |
2116 |
|
GetSample(); // load global region sample reference |
2117 |
} |
} |
2118 |
|
|
2119 |
// make sure there is at least one dimension region |
// make sure there is at least one dimension region |
2157 |
|
|
2158 |
// update dimension definitions in '3lnk' chunk |
// update dimension definitions in '3lnk' chunk |
2159 |
uint8_t* pData = (uint8_t*) _3lnk->LoadChunkData(); |
uint8_t* pData = (uint8_t*) _3lnk->LoadChunkData(); |
2160 |
|
memcpy(&pData[0], &DimensionRegions, 4); |
2161 |
for (int i = 0; i < iMaxDimensions; i++) { |
for (int i = 0; i < iMaxDimensions; i++) { |
2162 |
pData[i * 8] = (uint8_t) pDimensionDefinitions[i].dimension; |
pData[4 + i * 8] = (uint8_t) pDimensionDefinitions[i].dimension; |
2163 |
pData[i * 8 + 1] = pDimensionDefinitions[i].bits; |
pData[5 + i * 8] = pDimensionDefinitions[i].bits; |
2164 |
// next 2 bytes unknown |
// next 2 bytes unknown |
2165 |
pData[i * 8 + 4] = pDimensionDefinitions[i].zones; |
pData[8 + i * 8] = pDimensionDefinitions[i].zones; |
2166 |
// next 3 bytes unknown |
// next 3 bytes unknown |
2167 |
} |
} |
2168 |
|
|
2497 |
Sample* sample = file->GetFirstSample(pProgress); |
Sample* sample = file->GetFirstSample(pProgress); |
2498 |
while (sample) { |
while (sample) { |
2499 |
if (sample->ulWavePoolOffset == soughtoffset && |
if (sample->ulWavePoolOffset == soughtoffset && |
2500 |
sample->FileNo == soughtfileno) return static_cast<gig::Sample*>(pSample = sample); |
sample->FileNo == soughtfileno) return static_cast<gig::Sample*>(sample); |
2501 |
sample = file->GetNextSample(); |
sample = file->GetNextSample(); |
2502 |
} |
} |
2503 |
return NULL; |
return NULL; |
2509 |
// * |
// * |
2510 |
|
|
2511 |
Instrument::Instrument(File* pFile, RIFF::List* insList, progress_t* pProgress) : DLS::Instrument((DLS::File*)pFile, insList) { |
Instrument::Instrument(File* pFile, RIFF::List* insList, progress_t* pProgress) : DLS::Instrument((DLS::File*)pFile, insList) { |
2512 |
|
pInfo->UseFixedLengthStrings = true; |
2513 |
|
|
2514 |
// Initialization |
// Initialization |
2515 |
for (int i = 0; i < 128; i++) RegionKeyTable[i] = NULL; |
for (int i = 0; i < 128; i++) RegionKeyTable[i] = NULL; |
2516 |
|
|
2673 |
// * |
// * |
2674 |
|
|
2675 |
File::File() : DLS::File() { |
File::File() : DLS::File() { |
2676 |
|
pInfo->UseFixedLengthStrings = true; |
2677 |
} |
} |
2678 |
|
|
2679 |
File::File(RIFF::File* pRIFF) : DLS::File(pRIFF) { |
File::File(RIFF::File* pRIFF) : DLS::File(pRIFF) { |
2680 |
|
pInfo->UseFixedLengthStrings = true; |
2681 |
} |
} |
2682 |
|
|
2683 |
Sample* File::GetFirstSample(progress_t* pProgress) { |
Sample* File::GetFirstSample(progress_t* pProgress) { |