• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files

gig.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                                                         *
00003  *   libgig - C++ cross-platform Gigasampler format file access library    *
00004  *                                                                         *
00005  *   Copyright (C) 2003-2007 by Christian Schoenebeck                      *
00006  *                              <cuse@users.sourceforge.net>               *
00007  *                                                                         *
00008  *   This library is free software; you can redistribute it and/or modify  *
00009  *   it under the terms of the GNU General Public License as published by  *
00010  *   the Free Software Foundation; either version 2 of the License, or     *
00011  *   (at your option) any later version.                                   *
00012  *                                                                         *
00013  *   This library is distributed in the hope that it will be useful,       *
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00016  *   GNU General Public License for more details.                          *
00017  *                                                                         *
00018  *   You should have received a copy of the GNU General Public License     *
00019  *   along with this library; if not, write to the Free Software           *
00020  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00021  *   MA  02111-1307  USA                                                   *
00022  ***************************************************************************/
00023 
00024 #include "gig.h"
00025 
00026 #include "helper.h"
00027 
00028 #include <math.h>
00029 #include <iostream>
00030 #include <algorithm>
00031 
00037 #define INITIAL_SAMPLE_BUFFER_SIZE              512000 // 512 kB
00038 
00040 #define GIG_EXP_DECODE(x)                       (pow(1.000000008813822, x))
00041 #define GIG_EXP_ENCODE(x)                       (log(x) / log(1.000000008813822))
00042 #define GIG_PITCH_TRACK_EXTRACT(x)              (!(x & 0x01))
00043 #define GIG_PITCH_TRACK_ENCODE(x)               ((x) ? 0x00 : 0x01)
00044 #define GIG_VCF_RESONANCE_CTRL_EXTRACT(x)       ((x >> 4) & 0x03)
00045 #define GIG_VCF_RESONANCE_CTRL_ENCODE(x)        ((x & 0x03) << 4)
00046 #define GIG_EG_CTR_ATTACK_INFLUENCE_EXTRACT(x)  ((x >> 1) & 0x03)
00047 #define GIG_EG_CTR_DECAY_INFLUENCE_EXTRACT(x)   ((x >> 3) & 0x03)
00048 #define GIG_EG_CTR_RELEASE_INFLUENCE_EXTRACT(x) ((x >> 5) & 0x03)
00049 #define GIG_EG_CTR_ATTACK_INFLUENCE_ENCODE(x)   ((x & 0x03) << 1)
00050 #define GIG_EG_CTR_DECAY_INFLUENCE_ENCODE(x)    ((x & 0x03) << 3)
00051 #define GIG_EG_CTR_RELEASE_INFLUENCE_ENCODE(x)  ((x & 0x03) << 5)
00052 
00053 namespace gig {
00054 
00055 // *************** progress_t ***************
00056 // *
00057 
00058     progress_t::progress_t() {
00059         callback    = NULL;
00060         custom      = NULL;
00061         __range_min = 0.0f;
00062         __range_max = 1.0f;
00063     }
00064 
00065     // private helper function to convert progress of a subprocess into the global progress
00066     static void __notify_progress(progress_t* pProgress, float subprogress) {
00067         if (pProgress && pProgress->callback) {
00068             const float totalrange    = pProgress->__range_max - pProgress->__range_min;
00069             const float totalprogress = pProgress->__range_min + subprogress * totalrange;
00070             pProgress->factor         = totalprogress;
00071             pProgress->callback(pProgress); // now actually notify about the progress
00072         }
00073     }
00074 
00075     // private helper function to divide a progress into subprogresses
00076     static void __divide_progress(progress_t* pParentProgress, progress_t* pSubProgress, float totalTasks, float currentTask) {
00077         if (pParentProgress && pParentProgress->callback) {
00078             const float totalrange    = pParentProgress->__range_max - pParentProgress->__range_min;
00079             pSubProgress->callback    = pParentProgress->callback;
00080             pSubProgress->custom      = pParentProgress->custom;
00081             pSubProgress->__range_min = pParentProgress->__range_min + totalrange * currentTask / totalTasks;
00082             pSubProgress->__range_max = pSubProgress->__range_min + totalrange / totalTasks;
00083         }
00084     }
00085 
00086 
00087 // *************** Internal functions for sample decompression ***************
00088 // *
00089 
00090 namespace {
00091 
00092     inline int get12lo(const unsigned char* pSrc)
00093     {
00094         const int x = pSrc[0] | (pSrc[1] & 0x0f) << 8;
00095         return x & 0x800 ? x - 0x1000 : x;
00096     }
00097 
00098     inline int get12hi(const unsigned char* pSrc)
00099     {
00100         const int x = pSrc[1] >> 4 | pSrc[2] << 4;
00101         return x & 0x800 ? x - 0x1000 : x;
00102     }
00103 
00104     inline int16_t get16(const unsigned char* pSrc)
00105     {
00106         return int16_t(pSrc[0] | pSrc[1] << 8);
00107     }
00108 
00109     inline int get24(const unsigned char* pSrc)
00110     {
00111         const int x = pSrc[0] | pSrc[1] << 8 | pSrc[2] << 16;
00112         return x & 0x800000 ? x - 0x1000000 : x;
00113     }
00114 
00115     inline void store24(unsigned char* pDst, int x)
00116     {
00117         pDst[0] = x;
00118         pDst[1] = x >> 8;
00119         pDst[2] = x >> 16;
00120     }
00121 
00122     void Decompress16(int compressionmode, const unsigned char* params,
00123                       int srcStep, int dstStep,
00124                       const unsigned char* pSrc, int16_t* pDst,
00125                       unsigned long currentframeoffset,
00126                       unsigned long copysamples)
00127     {
00128         switch (compressionmode) {
00129             case 0: // 16 bit uncompressed
00130                 pSrc += currentframeoffset * srcStep;
00131                 while (copysamples) {
00132                     *pDst = get16(pSrc);
00133                     pDst += dstStep;
00134                     pSrc += srcStep;
00135                     copysamples--;
00136                 }
00137                 break;
00138 
00139             case 1: // 16 bit compressed to 8 bit
00140                 int y  = get16(params);
00141                 int dy = get16(params + 2);
00142                 while (currentframeoffset) {
00143                     dy -= int8_t(*pSrc);
00144                     y  -= dy;
00145                     pSrc += srcStep;
00146                     currentframeoffset--;
00147                 }
00148                 while (copysamples) {
00149                     dy -= int8_t(*pSrc);
00150                     y  -= dy;
00151                     *pDst = y;
00152                     pDst += dstStep;
00153                     pSrc += srcStep;
00154                     copysamples--;
00155                 }
00156                 break;
00157         }
00158     }
00159 
00160     void Decompress24(int compressionmode, const unsigned char* params,
00161                       int dstStep, const unsigned char* pSrc, uint8_t* pDst,
00162                       unsigned long currentframeoffset,
00163                       unsigned long copysamples, int truncatedBits)
00164     {
00165         int y, dy, ddy, dddy;
00166 
00167 #define GET_PARAMS(params)                      \
00168         y    = get24(params);                   \
00169         dy   = y - get24((params) + 3);         \
00170         ddy  = get24((params) + 6);             \
00171         dddy = get24((params) + 9)
00172 
00173 #define SKIP_ONE(x)                             \
00174         dddy -= (x);                            \
00175         ddy  -= dddy;                           \
00176         dy   =  -dy - ddy;                      \
00177         y    += dy
00178 
00179 #define COPY_ONE(x)                             \
00180         SKIP_ONE(x);                            \
00181         store24(pDst, y << truncatedBits);      \
00182         pDst += dstStep
00183 
00184         switch (compressionmode) {
00185             case 2: // 24 bit uncompressed
00186                 pSrc += currentframeoffset * 3;
00187                 while (copysamples) {
00188                     store24(pDst, get24(pSrc) << truncatedBits);
00189                     pDst += dstStep;
00190                     pSrc += 3;
00191                     copysamples--;
00192                 }
00193                 break;
00194 
00195             case 3: // 24 bit compressed to 16 bit
00196                 GET_PARAMS(params);
00197                 while (currentframeoffset) {
00198                     SKIP_ONE(get16(pSrc));
00199                     pSrc += 2;
00200                     currentframeoffset--;
00201                 }
00202                 while (copysamples) {
00203                     COPY_ONE(get16(pSrc));
00204                     pSrc += 2;
00205                     copysamples--;
00206                 }
00207                 break;
00208 
00209             case 4: // 24 bit compressed to 12 bit
00210                 GET_PARAMS(params);
00211                 while (currentframeoffset > 1) {
00212                     SKIP_ONE(get12lo(pSrc));
00213                     SKIP_ONE(get12hi(pSrc));
00214                     pSrc += 3;
00215                     currentframeoffset -= 2;
00216                 }
00217                 if (currentframeoffset) {
00218                     SKIP_ONE(get12lo(pSrc));
00219                     currentframeoffset--;
00220                     if (copysamples) {
00221                         COPY_ONE(get12hi(pSrc));
00222                         pSrc += 3;
00223                         copysamples--;
00224                     }
00225                 }
00226                 while (copysamples > 1) {
00227                     COPY_ONE(get12lo(pSrc));
00228                     COPY_ONE(get12hi(pSrc));
00229                     pSrc += 3;
00230                     copysamples -= 2;
00231                 }
00232                 if (copysamples) {
00233                     COPY_ONE(get12lo(pSrc));
00234                 }
00235                 break;
00236 
00237             case 5: // 24 bit compressed to 8 bit
00238                 GET_PARAMS(params);
00239                 while (currentframeoffset) {
00240                     SKIP_ONE(int8_t(*pSrc++));
00241                     currentframeoffset--;
00242                 }
00243                 while (copysamples) {
00244                     COPY_ONE(int8_t(*pSrc++));
00245                     copysamples--;
00246                 }
00247                 break;
00248         }
00249     }
00250 
00251     const int bytesPerFrame[] =      { 4096, 2052, 768, 524, 396, 268 };
00252     const int bytesPerFrameNoHdr[] = { 4096, 2048, 768, 512, 384, 256 };
00253     const int headerSize[] =         { 0, 4, 0, 12, 12, 12 };
00254     const int bitsPerSample[] =      { 16, 8, 24, 16, 12, 8 };
00255 }
00256 
00257 
00258 
00259 // *************** Internal CRC-32 (Cyclic Redundancy Check) functions  ***************
00260 // *
00261 
00262     static uint32_t* __initCRCTable() {
00263         static uint32_t res[256];
00264 
00265         for (int i = 0 ; i < 256 ; i++) {
00266             uint32_t c = i;
00267             for (int j = 0 ; j < 8 ; j++) {
00268                 c = (c & 1) ? 0xedb88320 ^ (c >> 1) : c >> 1;
00269             }
00270             res[i] = c;
00271         }
00272         return res;
00273     }
00274 
00275     static const uint32_t* __CRCTable = __initCRCTable();
00276 
00282     inline static void __resetCRC(uint32_t& crc) {
00283         crc = 0xffffffff;
00284     }
00285 
00305     static void __calculateCRC(unsigned char* buf, int bufSize, uint32_t& crc) {
00306         for (int i = 0 ; i < bufSize ; i++) {
00307             crc = __CRCTable[(crc ^ buf[i]) & 0xff] ^ (crc >> 8);
00308         }
00309     }
00310 
00316     inline static uint32_t __encodeCRC(const uint32_t& crc) {
00317         return crc ^ 0xffffffff;
00318     }
00319 
00320 
00321 
00322 // *************** Other Internal functions  ***************
00323 // *
00324 
00325     static split_type_t __resolveSplitType(dimension_t dimension) {
00326         return (
00327             dimension == dimension_layer ||
00328             dimension == dimension_samplechannel ||
00329             dimension == dimension_releasetrigger ||
00330             dimension == dimension_keyboard ||
00331             dimension == dimension_roundrobin ||
00332             dimension == dimension_random ||
00333             dimension == dimension_smartmidi ||
00334             dimension == dimension_roundrobinkeyboard
00335         ) ? split_type_bit : split_type_normal;
00336     }
00337 
00338     static int __resolveZoneSize(dimension_def_t& dimension_definition) {
00339         return (dimension_definition.split_type == split_type_normal)
00340         ? int(128.0 / dimension_definition.zones) : 0;
00341     }
00342 
00343 
00344 
00345 // *************** Sample ***************
00346 // *
00347 
00348     unsigned int Sample::Instances = 0;
00349     buffer_t     Sample::InternalDecompressionBuffer;
00350 
00369     Sample::Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset, unsigned long fileNo) : DLS::Sample((DLS::File*) pFile, waveList, WavePoolOffset) {
00370         static const DLS::Info::string_length_t fixedStringLengths[] = {
00371             { CHUNK_ID_INAM, 64 },
00372             { 0, 0 }
00373         };
00374         pInfo->SetFixedStringLengths(fixedStringLengths);
00375         Instances++;
00376         FileNo = fileNo;
00377 
00378         __resetCRC(crc);
00379 
00380         pCk3gix = waveList->GetSubChunk(CHUNK_ID_3GIX);
00381         if (pCk3gix) {
00382             uint16_t iSampleGroup = pCk3gix->ReadInt16();
00383             pGroup = pFile->GetGroup(iSampleGroup);
00384         } else { // '3gix' chunk missing
00385             // by default assigned to that mandatory "Default Group"
00386             pGroup = pFile->GetGroup(0);
00387         }
00388 
00389         pCkSmpl = waveList->GetSubChunk(CHUNK_ID_SMPL);
00390         if (pCkSmpl) {
00391             Manufacturer  = pCkSmpl->ReadInt32();
00392             Product       = pCkSmpl->ReadInt32();
00393             SamplePeriod  = pCkSmpl->ReadInt32();
00394             MIDIUnityNote = pCkSmpl->ReadInt32();
00395             FineTune      = pCkSmpl->ReadInt32();
00396             pCkSmpl->Read(&SMPTEFormat, 1, 4);
00397             SMPTEOffset   = pCkSmpl->ReadInt32();
00398             Loops         = pCkSmpl->ReadInt32();
00399             pCkSmpl->ReadInt32(); // manufByt
00400             LoopID        = pCkSmpl->ReadInt32();
00401             pCkSmpl->Read(&LoopType, 1, 4);
00402             LoopStart     = pCkSmpl->ReadInt32();
00403             LoopEnd       = pCkSmpl->ReadInt32();
00404             LoopFraction  = pCkSmpl->ReadInt32();
00405             LoopPlayCount = pCkSmpl->ReadInt32();
00406         } else { // 'smpl' chunk missing
00407             // use default values
00408             Manufacturer  = 0;
00409             Product       = 0;
00410             SamplePeriod  = uint32_t(1000000000.0 / SamplesPerSecond + 0.5);
00411             MIDIUnityNote = 60;
00412             FineTune      = 0;
00413             SMPTEFormat   = smpte_format_no_offset;
00414             SMPTEOffset   = 0;
00415             Loops         = 0;
00416             LoopID        = 0;
00417             LoopType      = loop_type_normal;
00418             LoopStart     = 0;
00419             LoopEnd       = 0;
00420             LoopFraction  = 0;
00421             LoopPlayCount = 0;
00422         }
00423 
00424         FrameTable                 = NULL;
00425         SamplePos                  = 0;
00426         RAMCache.Size              = 0;
00427         RAMCache.pStart            = NULL;
00428         RAMCache.NullExtensionSize = 0;
00429 
00430         if (BitDepth > 24) throw gig::Exception("Only samples up to 24 bit supported");
00431 
00432         RIFF::Chunk* ewav = waveList->GetSubChunk(CHUNK_ID_EWAV);
00433         Compressed        = ewav;
00434         Dithered          = false;
00435         TruncatedBits     = 0;
00436         if (Compressed) {
00437             uint32_t version = ewav->ReadInt32();
00438             if (version == 3 && BitDepth == 24) {
00439                 Dithered = ewav->ReadInt32();
00440                 ewav->SetPos(Channels == 2 ? 84 : 64);
00441                 TruncatedBits = ewav->ReadInt32();
00442             }
00443             ScanCompressedSample();
00444         }
00445 
00446         // we use a buffer for decompression and for truncating 24 bit samples to 16 bit
00447         if ((Compressed || BitDepth == 24) && !InternalDecompressionBuffer.Size) {
00448             InternalDecompressionBuffer.pStart = new unsigned char[INITIAL_SAMPLE_BUFFER_SIZE];
00449             InternalDecompressionBuffer.Size   = INITIAL_SAMPLE_BUFFER_SIZE;
00450         }
00451         FrameOffset = 0; // just for streaming compressed samples
00452 
00453         LoopSize = LoopEnd - LoopStart + 1;
00454     }
00455 
00467     void Sample::UpdateChunks() {
00468         // first update base class's chunks
00469         DLS::Sample::UpdateChunks();
00470 
00471         // make sure 'smpl' chunk exists
00472         pCkSmpl = pWaveList->GetSubChunk(CHUNK_ID_SMPL);
00473         if (!pCkSmpl) {
00474             pCkSmpl = pWaveList->AddSubChunk(CHUNK_ID_SMPL, 60);
00475             memset(pCkSmpl->LoadChunkData(), 0, 60);
00476         }
00477         // update 'smpl' chunk
00478         uint8_t* pData = (uint8_t*) pCkSmpl->LoadChunkData();
00479         SamplePeriod = uint32_t(1000000000.0 / SamplesPerSecond + 0.5);
00480         store32(&pData[0], Manufacturer);
00481         store32(&pData[4], Product);
00482         store32(&pData[8], SamplePeriod);
00483         store32(&pData[12], MIDIUnityNote);
00484         store32(&pData[16], FineTune);
00485         store32(&pData[20], SMPTEFormat);
00486         store32(&pData[24], SMPTEOffset);
00487         store32(&pData[28], Loops);
00488 
00489         // we skip 'manufByt' for now (4 bytes)
00490 
00491         store32(&pData[36], LoopID);
00492         store32(&pData[40], LoopType);
00493         store32(&pData[44], LoopStart);
00494         store32(&pData[48], LoopEnd);
00495         store32(&pData[52], LoopFraction);
00496         store32(&pData[56], LoopPlayCount);
00497 
00498         // make sure '3gix' chunk exists
00499         pCk3gix = pWaveList->GetSubChunk(CHUNK_ID_3GIX);
00500         if (!pCk3gix) pCk3gix = pWaveList->AddSubChunk(CHUNK_ID_3GIX, 4);
00501         // determine appropriate sample group index (to be stored in chunk)
00502         uint16_t iSampleGroup = 0; // 0 refers to default sample group
00503         File* pFile = static_cast<File*>(pParent);
00504         if (pFile->pGroups) {
00505             std::list<Group*>::iterator iter = pFile->pGroups->begin();
00506             std::list<Group*>::iterator end  = pFile->pGroups->end();
00507             for (int i = 0; iter != end; i++, iter++) {
00508                 if (*iter == pGroup) {
00509                     iSampleGroup = i;
00510                     break; // found
00511                 }
00512             }
00513         }
00514         // update '3gix' chunk
00515         pData = (uint8_t*) pCk3gix->LoadChunkData();
00516         store16(&pData[0], iSampleGroup);
00517     }
00518 
00520     void Sample::ScanCompressedSample() {
00521         //TODO: we have to add some more scans here (e.g. determine compression rate)
00522         this->SamplesTotal = 0;
00523         std::list<unsigned long> frameOffsets;
00524 
00525         SamplesPerFrame = BitDepth == 24 ? 256 : 2048;
00526         WorstCaseFrameSize = SamplesPerFrame * FrameSize + Channels; // +Channels for compression flag
00527 
00528         // Scanning
00529         pCkData->SetPos(0);
00530         if (Channels == 2) { // Stereo
00531             for (int i = 0 ; ; i++) {
00532                 // for 24 bit samples every 8:th frame offset is
00533                 // stored, to save some memory
00534                 if (BitDepth != 24 || (i & 7) == 0) frameOffsets.push_back(pCkData->GetPos());
00535 
00536                 const int mode_l = pCkData->ReadUint8();
00537                 const int mode_r = pCkData->ReadUint8();
00538                 if (mode_l > 5 || mode_r > 5) throw gig::Exception("Unknown compression mode");
00539                 const unsigned long frameSize = bytesPerFrame[mode_l] + bytesPerFrame[mode_r];
00540 
00541                 if (pCkData->RemainingBytes() <= frameSize) {
00542                     SamplesInLastFrame =
00543                         ((pCkData->RemainingBytes() - headerSize[mode_l] - headerSize[mode_r]) << 3) /
00544                         (bitsPerSample[mode_l] + bitsPerSample[mode_r]);
00545                     SamplesTotal += SamplesInLastFrame;
00546                     break;
00547                 }
00548                 SamplesTotal += SamplesPerFrame;
00549                 pCkData->SetPos(frameSize, RIFF::stream_curpos);
00550             }
00551         }
00552         else { // Mono
00553             for (int i = 0 ; ; i++) {
00554                 if (BitDepth != 24 || (i & 7) == 0) frameOffsets.push_back(pCkData->GetPos());
00555 
00556                 const int mode = pCkData->ReadUint8();
00557                 if (mode > 5) throw gig::Exception("Unknown compression mode");
00558                 const unsigned long frameSize = bytesPerFrame[mode];
00559 
00560                 if (pCkData->RemainingBytes() <= frameSize) {
00561                     SamplesInLastFrame =
00562                         ((pCkData->RemainingBytes() - headerSize[mode]) << 3) / bitsPerSample[mode];
00563                     SamplesTotal += SamplesInLastFrame;
00564                     break;
00565                 }
00566                 SamplesTotal += SamplesPerFrame;
00567                 pCkData->SetPos(frameSize, RIFF::stream_curpos);
00568             }
00569         }
00570         pCkData->SetPos(0);
00571 
00572         // Build the frames table (which is used for fast resolving of a frame's chunk offset)
00573         if (FrameTable) delete[] FrameTable;
00574         FrameTable = new unsigned long[frameOffsets.size()];
00575         std::list<unsigned long>::iterator end  = frameOffsets.end();
00576         std::list<unsigned long>::iterator iter = frameOffsets.begin();
00577         for (int i = 0; iter != end; i++, iter++) {
00578             FrameTable[i] = *iter;
00579         }
00580     }
00581 
00591     buffer_t Sample::LoadSampleData() {
00592         return LoadSampleDataWithNullSamplesExtension(this->SamplesTotal, 0); // 0 amount of NullSamples
00593     }
00594 
00617     buffer_t Sample::LoadSampleData(unsigned long SampleCount) {
00618         return LoadSampleDataWithNullSamplesExtension(SampleCount, 0); // 0 amount of NullSamples
00619     }
00620 
00640     buffer_t Sample::LoadSampleDataWithNullSamplesExtension(uint NullSamplesCount) {
00641         return LoadSampleDataWithNullSamplesExtension(this->SamplesTotal, NullSamplesCount);
00642     }
00643 
00676     buffer_t Sample::LoadSampleDataWithNullSamplesExtension(unsigned long SampleCount, uint NullSamplesCount) {
00677         if (SampleCount > this->SamplesTotal) SampleCount = this->SamplesTotal;
00678         if (RAMCache.pStart) delete[] (int8_t*) RAMCache.pStart;
00679         unsigned long allocationsize = (SampleCount + NullSamplesCount) * this->FrameSize;
00680         RAMCache.pStart            = new int8_t[allocationsize];
00681         RAMCache.Size              = Read(RAMCache.pStart, SampleCount) * this->FrameSize;
00682         RAMCache.NullExtensionSize = allocationsize - RAMCache.Size;
00683         // fill the remaining buffer space with silence samples
00684         memset((int8_t*)RAMCache.pStart + RAMCache.Size, 0, RAMCache.NullExtensionSize);
00685         return GetCache();
00686     }
00687 
00698     buffer_t Sample::GetCache() {
00699         // return a copy of the buffer_t structure
00700         buffer_t result;
00701         result.Size              = this->RAMCache.Size;
00702         result.pStart            = this->RAMCache.pStart;
00703         result.NullExtensionSize = this->RAMCache.NullExtensionSize;
00704         return result;
00705     }
00706 
00713     void Sample::ReleaseSampleData() {
00714         if (RAMCache.pStart) delete[] (int8_t*) RAMCache.pStart;
00715         RAMCache.pStart = NULL;
00716         RAMCache.Size   = 0;
00717     }
00718 
00749     void Sample::Resize(int iNewSize) {
00750         if (Compressed) throw gig::Exception("There is no support for modifying compressed samples (yet)");
00751         DLS::Sample::Resize(iNewSize);
00752     }
00753 
00775     unsigned long Sample::SetPos(unsigned long SampleCount, RIFF::stream_whence_t Whence) {
00776         if (Compressed) {
00777             switch (Whence) {
00778                 case RIFF::stream_curpos:
00779                     this->SamplePos += SampleCount;
00780                     break;
00781                 case RIFF::stream_end:
00782                     this->SamplePos = this->SamplesTotal - 1 - SampleCount;
00783                     break;
00784                 case RIFF::stream_backward:
00785                     this->SamplePos -= SampleCount;
00786                     break;
00787                 case RIFF::stream_start: default:
00788                     this->SamplePos = SampleCount;
00789                     break;
00790             }
00791             if (this->SamplePos > this->SamplesTotal) this->SamplePos = this->SamplesTotal;
00792 
00793             unsigned long frame = this->SamplePos / 2048; // to which frame to jump
00794             this->FrameOffset   = this->SamplePos % 2048; // offset (in sample points) within that frame
00795             pCkData->SetPos(FrameTable[frame]);           // set chunk pointer to the start of sought frame
00796             return this->SamplePos;
00797         }
00798         else { // not compressed
00799             unsigned long orderedBytes = SampleCount * this->FrameSize;
00800             unsigned long result = pCkData->SetPos(orderedBytes, Whence);
00801             return (result == orderedBytes) ? SampleCount
00802                                             : result / this->FrameSize;
00803         }
00804     }
00805 
00809     unsigned long Sample::GetPos() {
00810         if (Compressed) return SamplePos;
00811         else            return pCkData->GetPos() / FrameSize;
00812     }
00813 
00848     unsigned long Sample::ReadAndLoop(void* pBuffer, unsigned long SampleCount, playback_state_t* pPlaybackState,
00849                                       DimensionRegion* pDimRgn, buffer_t* pExternalDecompressionBuffer) {
00850         unsigned long samplestoread = SampleCount, totalreadsamples = 0, readsamples, samplestoloopend;
00851         uint8_t* pDst = (uint8_t*) pBuffer;
00852 
00853         SetPos(pPlaybackState->position); // recover position from the last time
00854 
00855         if (pDimRgn->SampleLoops) { // honor looping if there are loop points defined
00856 
00857             const DLS::sample_loop_t& loop = pDimRgn->pSampleLoops[0];
00858             const uint32_t loopEnd = loop.LoopStart + loop.LoopLength;
00859 
00860             if (GetPos() <= loopEnd) {
00861                 switch (loop.LoopType) {
00862 
00863                     case loop_type_bidirectional: { //TODO: not tested yet!
00864                         do {
00865                             // if not endless loop check if max. number of loop cycles have been passed
00866                             if (this->LoopPlayCount && !pPlaybackState->loop_cycles_left) break;
00867 
00868                             if (!pPlaybackState->reverse) { // forward playback
00869                                 do {
00870                                     samplestoloopend  = loopEnd - GetPos();
00871                                     readsamples       = Read(&pDst[totalreadsamples * this->FrameSize], Min(samplestoread, samplestoloopend), pExternalDecompressionBuffer);
00872                                     samplestoread    -= readsamples;
00873                                     totalreadsamples += readsamples;
00874                                     if (readsamples == samplestoloopend) {
00875                                         pPlaybackState->reverse = true;
00876                                         break;
00877                                     }
00878                                 } while (samplestoread && readsamples);
00879                             }
00880                             else { // backward playback
00881 
00882                                 // as we can only read forward from disk, we have to
00883                                 // determine the end position within the loop first,
00884                                 // read forward from that 'end' and finally after
00885                                 // reading, swap all sample frames so it reflects
00886                                 // backward playback
00887 
00888                                 unsigned long swapareastart       = totalreadsamples;
00889                                 unsigned long loopoffset          = GetPos() - loop.LoopStart;
00890                                 unsigned long samplestoreadinloop = Min(samplestoread, loopoffset);
00891                                 unsigned long reverseplaybackend  = GetPos() - samplestoreadinloop;
00892 
00893                                 SetPos(reverseplaybackend);
00894 
00895                                 // read samples for backward playback
00896                                 do {
00897                                     readsamples          = Read(&pDst[totalreadsamples * this->FrameSize], samplestoreadinloop, pExternalDecompressionBuffer);
00898                                     samplestoreadinloop -= readsamples;
00899                                     samplestoread       -= readsamples;
00900                                     totalreadsamples    += readsamples;
00901                                 } while (samplestoreadinloop && readsamples);
00902 
00903                                 SetPos(reverseplaybackend); // pretend we really read backwards
00904 
00905                                 if (reverseplaybackend == loop.LoopStart) {
00906                                     pPlaybackState->loop_cycles_left--;
00907                                     pPlaybackState->reverse = false;
00908                                 }
00909 
00910                                 // reverse the sample frames for backward playback
00911                                 SwapMemoryArea(&pDst[swapareastart * this->FrameSize], (totalreadsamples - swapareastart) * this->FrameSize, this->FrameSize);
00912                             }
00913                         } while (samplestoread && readsamples);
00914                         break;
00915                     }
00916 
00917                     case loop_type_backward: { // TODO: not tested yet!
00918                         // forward playback (not entered the loop yet)
00919                         if (!pPlaybackState->reverse) do {
00920                             samplestoloopend  = loopEnd - GetPos();
00921                             readsamples       = Read(&pDst[totalreadsamples * this->FrameSize], Min(samplestoread, samplestoloopend), pExternalDecompressionBuffer);
00922                             samplestoread    -= readsamples;
00923                             totalreadsamples += readsamples;
00924                             if (readsamples == samplestoloopend) {
00925                                 pPlaybackState->reverse = true;
00926                                 break;
00927                             }
00928                         } while (samplestoread && readsamples);
00929 
00930                         if (!samplestoread) break;
00931 
00932                         // as we can only read forward from disk, we have to
00933                         // determine the end position within the loop first,
00934                         // read forward from that 'end' and finally after
00935                         // reading, swap all sample frames so it reflects
00936                         // backward playback
00937 
00938                         unsigned long swapareastart       = totalreadsamples;
00939                         unsigned long loopoffset          = GetPos() - loop.LoopStart;
00940                         unsigned long samplestoreadinloop = (this->LoopPlayCount) ? Min(samplestoread, pPlaybackState->loop_cycles_left * loop.LoopLength - loopoffset)
00941                                                                                   : samplestoread;
00942                         unsigned long reverseplaybackend  = loop.LoopStart + Abs((loopoffset - samplestoreadinloop) % loop.LoopLength);
00943 
00944                         SetPos(reverseplaybackend);
00945 
00946                         // read samples for backward playback
00947                         do {
00948                             // if not endless loop check if max. number of loop cycles have been passed
00949                             if (this->LoopPlayCount && !pPlaybackState->loop_cycles_left) break;
00950                             samplestoloopend     = loopEnd - GetPos();
00951                             readsamples          = Read(&pDst[totalreadsamples * this->FrameSize], Min(samplestoreadinloop, samplestoloopend), pExternalDecompressionBuffer);
00952                             samplestoreadinloop -= readsamples;
00953                             samplestoread       -= readsamples;
00954                             totalreadsamples    += readsamples;
00955                             if (readsamples == samplestoloopend) {
00956                                 pPlaybackState->loop_cycles_left--;
00957                                 SetPos(loop.LoopStart);
00958                             }
00959                         } while (samplestoreadinloop && readsamples);
00960 
00961                         SetPos(reverseplaybackend); // pretend we really read backwards
00962 
00963                         // reverse the sample frames for backward playback
00964                         SwapMemoryArea(&pDst[swapareastart * this->FrameSize], (totalreadsamples - swapareastart) * this->FrameSize, this->FrameSize);
00965                         break;
00966                     }
00967 
00968                     default: case loop_type_normal: {
00969                         do {
00970                             // if not endless loop check if max. number of loop cycles have been passed
00971                             if (this->LoopPlayCount && !pPlaybackState->loop_cycles_left) break;
00972                             samplestoloopend  = loopEnd - GetPos();
00973                             readsamples       = Read(&pDst[totalreadsamples * this->FrameSize], Min(samplestoread, samplestoloopend), pExternalDecompressionBuffer);
00974                             samplestoread    -= readsamples;
00975                             totalreadsamples += readsamples;
00976                             if (readsamples == samplestoloopend) {
00977                                 pPlaybackState->loop_cycles_left--;
00978                                 SetPos(loop.LoopStart);
00979                             }
00980                         } while (samplestoread && readsamples);
00981                         break;
00982                     }
00983                 }
00984             }
00985         }
00986 
00987         // read on without looping
00988         if (samplestoread) do {
00989             readsamples = Read(&pDst[totalreadsamples * this->FrameSize], samplestoread, pExternalDecompressionBuffer);
00990             samplestoread    -= readsamples;
00991             totalreadsamples += readsamples;
00992         } while (readsamples && samplestoread);
00993 
00994         // store current position
00995         pPlaybackState->position = GetPos();
00996 
00997         return totalreadsamples;
00998     }
00999 
01022     unsigned long Sample::Read(void* pBuffer, unsigned long SampleCount, buffer_t* pExternalDecompressionBuffer) {
01023         if (SampleCount == 0) return 0;
01024         if (!Compressed) {
01025             if (BitDepth == 24) {
01026                 return pCkData->Read(pBuffer, SampleCount * FrameSize, 1) / FrameSize;
01027             }
01028             else { // 16 bit
01029                 // (pCkData->Read does endian correction)
01030                 return Channels == 2 ? pCkData->Read(pBuffer, SampleCount << 1, 2) >> 1
01031                                      : pCkData->Read(pBuffer, SampleCount, 2);
01032             }
01033         }
01034         else {
01035             if (this->SamplePos >= this->SamplesTotal) return 0;
01036             //TODO: efficiency: maybe we should test for an average compression rate
01037             unsigned long assumedsize      = GuessSize(SampleCount),
01038                           remainingbytes   = 0,           // remaining bytes in the local buffer
01039                           remainingsamples = SampleCount,
01040                           copysamples, skipsamples,
01041                           currentframeoffset = this->FrameOffset;  // offset in current sample frame since last Read()
01042             this->FrameOffset = 0;
01043 
01044             buffer_t* pDecompressionBuffer = (pExternalDecompressionBuffer) ? pExternalDecompressionBuffer : &InternalDecompressionBuffer;
01045 
01046             // if decompression buffer too small, then reduce amount of samples to read
01047             if (pDecompressionBuffer->Size < assumedsize) {
01048                 std::cerr << "gig::Read(): WARNING - decompression buffer size too small!" << std::endl;
01049                 SampleCount      = WorstCaseMaxSamples(pDecompressionBuffer);
01050                 remainingsamples = SampleCount;
01051                 assumedsize      = GuessSize(SampleCount);
01052             }
01053 
01054             unsigned char* pSrc = (unsigned char*) pDecompressionBuffer->pStart;
01055             int16_t* pDst = static_cast<int16_t*>(pBuffer);
01056             uint8_t* pDst24 = static_cast<uint8_t*>(pBuffer);
01057             remainingbytes = pCkData->Read(pSrc, assumedsize, 1);
01058 
01059             while (remainingsamples && remainingbytes) {
01060                 unsigned long framesamples = SamplesPerFrame;
01061                 unsigned long framebytes, rightChannelOffset = 0, nextFrameOffset;
01062 
01063                 int mode_l = *pSrc++, mode_r = 0;
01064 
01065                 if (Channels == 2) {
01066                     mode_r = *pSrc++;
01067                     framebytes = bytesPerFrame[mode_l] + bytesPerFrame[mode_r] + 2;
01068                     rightChannelOffset = bytesPerFrameNoHdr[mode_l];
01069                     nextFrameOffset = rightChannelOffset + bytesPerFrameNoHdr[mode_r];
01070                     if (remainingbytes < framebytes) { // last frame in sample
01071                         framesamples = SamplesInLastFrame;
01072                         if (mode_l == 4 && (framesamples & 1)) {
01073                             rightChannelOffset = ((framesamples + 1) * bitsPerSample[mode_l]) >> 3;
01074                         }
01075                         else {
01076                             rightChannelOffset = (framesamples * bitsPerSample[mode_l]) >> 3;
01077                         }
01078                     }
01079                 }
01080                 else {
01081                     framebytes = bytesPerFrame[mode_l] + 1;
01082                     nextFrameOffset = bytesPerFrameNoHdr[mode_l];
01083                     if (remainingbytes < framebytes) {
01084                         framesamples = SamplesInLastFrame;
01085                     }
01086                 }
01087 
01088                 // determine how many samples in this frame to skip and read
01089                 if (currentframeoffset + remainingsamples >= framesamples) {
01090                     if (currentframeoffset <= framesamples) {
01091                         copysamples = framesamples - currentframeoffset;
01092                         skipsamples = currentframeoffset;
01093                     }
01094                     else {
01095                         copysamples = 0;
01096                         skipsamples = framesamples;
01097                     }
01098                 }
01099                 else {
01100                     // This frame has enough data for pBuffer, but not
01101                     // all of the frame is needed. Set file position
01102                     // to start of this frame for next call to Read.
01103                     copysamples = remainingsamples;
01104                     skipsamples = currentframeoffset;
01105                     pCkData->SetPos(remainingbytes, RIFF::stream_backward);
01106                     this->FrameOffset = currentframeoffset + copysamples;
01107                 }
01108                 remainingsamples -= copysamples;
01109 
01110                 if (remainingbytes > framebytes) {
01111                     remainingbytes -= framebytes;
01112                     if (remainingsamples == 0 &&
01113                         currentframeoffset + copysamples == framesamples) {
01114                         // This frame has enough data for pBuffer, and
01115                         // all of the frame is needed. Set file
01116                         // position to start of next frame for next
01117                         // call to Read. FrameOffset is 0.
01118                         pCkData->SetPos(remainingbytes, RIFF::stream_backward);
01119                     }
01120                 }
01121                 else remainingbytes = 0;
01122 
01123                 currentframeoffset -= skipsamples;
01124 
01125                 if (copysamples == 0) {
01126                     // skip this frame
01127                     pSrc += framebytes - Channels;
01128                 }
01129                 else {
01130                     const unsigned char* const param_l = pSrc;
01131                     if (BitDepth == 24) {
01132                         if (mode_l != 2) pSrc += 12;
01133 
01134                         if (Channels == 2) { // Stereo
01135                             const unsigned char* const param_r = pSrc;
01136                             if (mode_r != 2) pSrc += 12;
01137 
01138                             Decompress24(mode_l, param_l, 6, pSrc, pDst24,
01139                                          skipsamples, copysamples, TruncatedBits);
01140                             Decompress24(mode_r, param_r, 6, pSrc + rightChannelOffset, pDst24 + 3,
01141                                          skipsamples, copysamples, TruncatedBits);
01142                             pDst24 += copysamples * 6;
01143                         }
01144                         else { // Mono
01145                             Decompress24(mode_l, param_l, 3, pSrc, pDst24,
01146                                          skipsamples, copysamples, TruncatedBits);
01147                             pDst24 += copysamples * 3;
01148                         }
01149                     }
01150                     else { // 16 bit
01151                         if (mode_l) pSrc += 4;
01152 
01153                         int step;
01154                         if (Channels == 2) { // Stereo
01155                             const unsigned char* const param_r = pSrc;
01156                             if (mode_r) pSrc += 4;
01157 
01158                             step = (2 - mode_l) + (2 - mode_r);
01159                             Decompress16(mode_l, param_l, step, 2, pSrc, pDst, skipsamples, copysamples);
01160                             Decompress16(mode_r, param_r, step, 2, pSrc + (2 - mode_l), pDst + 1,
01161                                          skipsamples, copysamples);
01162                             pDst += copysamples << 1;
01163                         }
01164                         else { // Mono
01165                             step = 2 - mode_l;
01166                             Decompress16(mode_l, param_l, step, 1, pSrc, pDst, skipsamples, copysamples);
01167                             pDst += copysamples;
01168                         }
01169                     }
01170                     pSrc += nextFrameOffset;
01171                 }
01172 
01173                 // reload from disk to local buffer if needed
01174                 if (remainingsamples && remainingbytes < WorstCaseFrameSize && pCkData->GetState() == RIFF::stream_ready) {
01175                     assumedsize    = GuessSize(remainingsamples);
01176                     pCkData->SetPos(remainingbytes, RIFF::stream_backward);
01177                     if (pCkData->RemainingBytes() < assumedsize) assumedsize = pCkData->RemainingBytes();
01178                     remainingbytes = pCkData->Read(pDecompressionBuffer->pStart, assumedsize, 1);
01179                     pSrc = (unsigned char*) pDecompressionBuffer->pStart;
01180                 }
01181             } // while
01182 
01183             this->SamplePos += (SampleCount - remainingsamples);
01184             if (this->SamplePos > this->SamplesTotal) this->SamplePos = this->SamplesTotal;
01185             return (SampleCount - remainingsamples);
01186         }
01187     }
01188 
01211     unsigned long Sample::Write(void* pBuffer, unsigned long SampleCount) {
01212         if (Compressed) throw gig::Exception("There is no support for writing compressed gig samples (yet)");
01213 
01214         // if this is the first write in this sample, reset the
01215         // checksum calculator
01216         if (pCkData->GetPos() == 0) {
01217             __resetCRC(crc);
01218         }
01219         if (GetSize() < SampleCount) throw Exception("Could not write sample data, current sample size to small");
01220         unsigned long res;
01221         if (BitDepth == 24) {
01222             res = pCkData->Write(pBuffer, SampleCount * FrameSize, 1) / FrameSize;
01223         } else { // 16 bit
01224             res = Channels == 2 ? pCkData->Write(pBuffer, SampleCount << 1, 2) >> 1
01225                                 : pCkData->Write(pBuffer, SampleCount, 2);
01226         }
01227         __calculateCRC((unsigned char *)pBuffer, SampleCount * FrameSize, crc);
01228 
01229         // if this is the last write, update the checksum chunk in the
01230         // file
01231         if (pCkData->GetPos() == pCkData->GetSize()) {
01232             File* pFile = static_cast<File*>(GetParent());
01233             pFile->SetSampleChecksum(this, __encodeCRC(crc));
01234         }
01235         return res;
01236     }
01237 
01254     buffer_t Sample::CreateDecompressionBuffer(unsigned long MaxReadSize) {
01255         buffer_t result;
01256         const double worstCaseHeaderOverhead =
01257                 (256.0 /*frame size*/ + 12.0 /*header*/ + 2.0 /*compression type flag (stereo)*/) / 256.0;
01258         result.Size              = (unsigned long) (double(MaxReadSize) * 3.0 /*(24 Bit)*/ * 2.0 /*stereo*/ * worstCaseHeaderOverhead);
01259         result.pStart            = new int8_t[result.Size];
01260         result.NullExtensionSize = 0;
01261         return result;
01262     }
01263 
01271     void Sample::DestroyDecompressionBuffer(buffer_t& DecompressionBuffer) {
01272         if (DecompressionBuffer.Size && DecompressionBuffer.pStart) {
01273             delete[] (int8_t*) DecompressionBuffer.pStart;
01274             DecompressionBuffer.pStart = NULL;
01275             DecompressionBuffer.Size   = 0;
01276             DecompressionBuffer.NullExtensionSize = 0;
01277         }
01278     }
01279 
01288     Group* Sample::GetGroup() const {
01289         return pGroup;
01290     }
01291 
01292     Sample::~Sample() {
01293         Instances--;
01294         if (!Instances && InternalDecompressionBuffer.Size) {
01295             delete[] (unsigned char*) InternalDecompressionBuffer.pStart;
01296             InternalDecompressionBuffer.pStart = NULL;
01297             InternalDecompressionBuffer.Size   = 0;
01298         }
01299         if (FrameTable) delete[] FrameTable;
01300         if (RAMCache.pStart) delete[] (int8_t*) RAMCache.pStart;
01301     }
01302 
01303 
01304 
01305 // *************** DimensionRegion ***************
01306 // *
01307 
01308     uint                               DimensionRegion::Instances       = 0;
01309     DimensionRegion::VelocityTableMap* DimensionRegion::pVelocityTables = NULL;
01310 
01311     DimensionRegion::DimensionRegion(Region* pParent, RIFF::List* _3ewl) : DLS::Sampler(_3ewl) {
01312         Instances++;
01313 
01314         pSample = NULL;
01315         pRegion = pParent;
01316 
01317         if (_3ewl->GetSubChunk(CHUNK_ID_WSMP)) memcpy(&Crossfade, &SamplerOptions, 4);
01318         else memset(&Crossfade, 0, 4);
01319 
01320         if (!pVelocityTables) pVelocityTables = new VelocityTableMap;
01321 
01322         RIFF::Chunk* _3ewa = _3ewl->GetSubChunk(CHUNK_ID_3EWA);
01323         if (_3ewa) { // if '3ewa' chunk exists
01324             _3ewa->ReadInt32(); // unknown, always == chunk size ?
01325             LFO3Frequency = (double) GIG_EXP_DECODE(_3ewa->ReadInt32());
01326             EG3Attack     = (double) GIG_EXP_DECODE(_3ewa->ReadInt32());
01327             _3ewa->ReadInt16(); // unknown
01328             LFO1InternalDepth = _3ewa->ReadUint16();
01329             _3ewa->ReadInt16(); // unknown
01330             LFO3InternalDepth = _3ewa->ReadInt16();
01331             _3ewa->ReadInt16(); // unknown
01332             LFO1ControlDepth = _3ewa->ReadUint16();
01333             _3ewa->ReadInt16(); // unknown
01334             LFO3ControlDepth = _3ewa->ReadInt16();
01335             EG1Attack           = (double) GIG_EXP_DECODE(_3ewa->ReadInt32());
01336             EG1Decay1           = (double) GIG_EXP_DECODE(_3ewa->ReadInt32());
01337             _3ewa->ReadInt16(); // unknown
01338             EG1Sustain          = _3ewa->ReadUint16();
01339             EG1Release          = (double) GIG_EXP_DECODE(_3ewa->ReadInt32());
01340             EG1Controller       = DecodeLeverageController(static_cast<_lev_ctrl_t>(_3ewa->ReadUint8()));
01341             uint8_t eg1ctrloptions        = _3ewa->ReadUint8();
01342             EG1ControllerInvert           = eg1ctrloptions & 0x01;
01343             EG1ControllerAttackInfluence  = GIG_EG_CTR_ATTACK_INFLUENCE_EXTRACT(eg1ctrloptions);
01344             EG1ControllerDecayInfluence   = GIG_EG_CTR_DECAY_INFLUENCE_EXTRACT(eg1ctrloptions);
01345             EG1ControllerReleaseInfluence = GIG_EG_CTR_RELEASE_INFLUENCE_EXTRACT(eg1ctrloptions);
01346             EG2Controller       = DecodeLeverageController(static_cast<_lev_ctrl_t>(_3ewa->ReadUint8()));
01347             uint8_t eg2ctrloptions        = _3ewa->ReadUint8();
01348             EG2ControllerInvert           = eg2ctrloptions & 0x01;
01349             EG2ControllerAttackInfluence  = GIG_EG_CTR_ATTACK_INFLUENCE_EXTRACT(eg2ctrloptions);
01350             EG2ControllerDecayInfluence   = GIG_EG_CTR_DECAY_INFLUENCE_EXTRACT(eg2ctrloptions);
01351             EG2ControllerReleaseInfluence = GIG_EG_CTR_RELEASE_INFLUENCE_EXTRACT(eg2ctrloptions);
01352             LFO1Frequency    = (double) GIG_EXP_DECODE(_3ewa->ReadInt32());
01353             EG2Attack        = (double) GIG_EXP_DECODE(_3ewa->ReadInt32());
01354             EG2Decay1        = (double) GIG_EXP_DECODE(_3ewa->ReadInt32());
01355             _3ewa->ReadInt16(); // unknown
01356             EG2Sustain       = _3ewa->ReadUint16();
01357             EG2Release       = (double) GIG_EXP_DECODE(_3ewa->ReadInt32());
01358             _3ewa->ReadInt16(); // unknown
01359             LFO2ControlDepth = _3ewa->ReadUint16();
01360             LFO2Frequency    = (double) GIG_EXP_DECODE(_3ewa->ReadInt32());
01361             _3ewa->ReadInt16(); // unknown
01362             LFO2InternalDepth = _3ewa->ReadUint16();
01363             int32_t eg1decay2 = _3ewa->ReadInt32();
01364             EG1Decay2          = (double) GIG_EXP_DECODE(eg1decay2);
01365             EG1InfiniteSustain = (eg1decay2 == 0x7fffffff);
01366             _3ewa->ReadInt16(); // unknown
01367             EG1PreAttack      = _3ewa->ReadUint16();
01368             int32_t eg2decay2 = _3ewa->ReadInt32();
01369             EG2Decay2         = (double) GIG_EXP_DECODE(eg2decay2);
01370             EG2InfiniteSustain = (eg2decay2 == 0x7fffffff);
01371             _3ewa->ReadInt16(); // unknown
01372             EG2PreAttack      = _3ewa->ReadUint16();
01373             uint8_t velocityresponse = _3ewa->ReadUint8();
01374             if (velocityresponse < 5) {
01375                 VelocityResponseCurve = curve_type_nonlinear;
01376                 VelocityResponseDepth = velocityresponse;
01377             } else if (velocityresponse < 10) {
01378                 VelocityResponseCurve = curve_type_linear;
01379                 VelocityResponseDepth = velocityresponse - 5;
01380             } else if (velocityresponse < 15) {
01381                 VelocityResponseCurve = curve_type_special;
01382                 VelocityResponseDepth = velocityresponse - 10;
01383             } else {
01384                 VelocityResponseCurve = curve_type_unknown;
01385                 VelocityResponseDepth = 0;
01386             }
01387             uint8_t releasevelocityresponse = _3ewa->ReadUint8();
01388             if (releasevelocityresponse < 5) {
01389                 ReleaseVelocityResponseCurve = curve_type_nonlinear;
01390                 ReleaseVelocityResponseDepth = releasevelocityresponse;
01391             } else if (releasevelocityresponse < 10) {
01392                 ReleaseVelocityResponseCurve = curve_type_linear;
01393                 ReleaseVelocityResponseDepth = releasevelocityresponse - 5;
01394             } else if (releasevelocityresponse < 15) {
01395                 ReleaseVelocityResponseCurve = curve_type_special;
01396                 ReleaseVelocityResponseDepth = releasevelocityresponse - 10;
01397             } else {
01398                 ReleaseVelocityResponseCurve = curve_type_unknown;
01399                 ReleaseVelocityResponseDepth = 0;
01400             }
01401             VelocityResponseCurveScaling = _3ewa->ReadUint8();
01402             AttenuationControllerThreshold = _3ewa->ReadInt8();
01403             _3ewa->ReadInt32(); // unknown
01404             SampleStartOffset = (uint16_t) _3ewa->ReadInt16();
01405             _3ewa->ReadInt16(); // unknown
01406             uint8_t pitchTrackDimensionBypass = _3ewa->ReadInt8();
01407             PitchTrack = GIG_PITCH_TRACK_EXTRACT(pitchTrackDimensionBypass);
01408             if      (pitchTrackDimensionBypass & 0x10) DimensionBypass = dim_bypass_ctrl_94;
01409             else if (pitchTrackDimensionBypass & 0x20) DimensionBypass = dim_bypass_ctrl_95;
01410             else                                       DimensionBypass = dim_bypass_ctrl_none;
01411             uint8_t pan = _3ewa->ReadUint8();
01412             Pan         = (pan < 64) ? pan : -((int)pan - 63); // signed 7 bit -> signed 8 bit
01413             SelfMask = _3ewa->ReadInt8() & 0x01;
01414             _3ewa->ReadInt8(); // unknown
01415             uint8_t lfo3ctrl = _3ewa->ReadUint8();
01416             LFO3Controller           = static_cast<lfo3_ctrl_t>(lfo3ctrl & 0x07); // lower 3 bits
01417             LFO3Sync                 = lfo3ctrl & 0x20; // bit 5
01418             InvertAttenuationController = lfo3ctrl & 0x80; // bit 7
01419             AttenuationController  = DecodeLeverageController(static_cast<_lev_ctrl_t>(_3ewa->ReadUint8()));
01420             uint8_t lfo2ctrl       = _3ewa->ReadUint8();
01421             LFO2Controller         = static_cast<lfo2_ctrl_t>(lfo2ctrl & 0x07); // lower 3 bits
01422             LFO2FlipPhase          = lfo2ctrl & 0x80; // bit 7
01423             LFO2Sync               = lfo2ctrl & 0x20; // bit 5
01424             bool extResonanceCtrl  = lfo2ctrl & 0x40; // bit 6
01425             uint8_t lfo1ctrl       = _3ewa->ReadUint8();
01426             LFO1Controller         = static_cast<lfo1_ctrl_t>(lfo1ctrl & 0x07); // lower 3 bits
01427             LFO1FlipPhase          = lfo1ctrl & 0x80; // bit 7
01428             LFO1Sync               = lfo1ctrl & 0x40; // bit 6
01429             VCFResonanceController = (extResonanceCtrl) ? static_cast<vcf_res_ctrl_t>(GIG_VCF_RESONANCE_CTRL_EXTRACT(lfo1ctrl))
01430                                                         : vcf_res_ctrl_none;
01431             uint16_t eg3depth = _3ewa->ReadUint16();
01432             EG3Depth = (eg3depth <= 1200) ? eg3depth /* positives */
01433                                         : (-1) * (int16_t) ((eg3depth ^ 0xffff) + 1); /* binary complementary for negatives */
01434             _3ewa->ReadInt16(); // unknown
01435             ChannelOffset = _3ewa->ReadUint8() / 4;
01436             uint8_t regoptions = _3ewa->ReadUint8();
01437             MSDecode           = regoptions & 0x01; // bit 0
01438             SustainDefeat      = regoptions & 0x02; // bit 1
01439             _3ewa->ReadInt16(); // unknown
01440             VelocityUpperLimit = _3ewa->ReadInt8();
01441             _3ewa->ReadInt8(); // unknown
01442             _3ewa->ReadInt16(); // unknown
01443             ReleaseTriggerDecay = _3ewa->ReadUint8(); // release trigger decay
01444             _3ewa->ReadInt8(); // unknown
01445             _3ewa->ReadInt8(); // unknown
01446             EG1Hold = _3ewa->ReadUint8() & 0x80; // bit 7
01447             uint8_t vcfcutoff = _3ewa->ReadUint8();
01448             VCFEnabled = vcfcutoff & 0x80; // bit 7
01449             VCFCutoff  = vcfcutoff & 0x7f; // lower 7 bits
01450             VCFCutoffController = static_cast<vcf_cutoff_ctrl_t>(_3ewa->ReadUint8());
01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown
01455             uint8_t vcfresonance = _3ewa->ReadUint8();
01456             VCFResonance = vcfresonance & 0x7f; // lower 7 bits
01457             VCFResonanceDynamic = !(vcfresonance & 0x80); // bit 7
01458             uint8_t vcfbreakpointa name="l01451">01451             uint8_t vcfvelscale = _3ewa->ReadUint8();
01452             VCFCutoffControllerInvert = vcfvelscale & 0x80; // bit 7
01453             VCFVelocityScale = vcfvelscale & 0x7f; // lower 7 bits
01454             _3ewa->ReadInt8(); // unknown