/[svn]/libgig/trunk/src/gig.cpp
ViewVC logotype

Diff of /libgig/trunk/src/gig.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3198 by schoenebeck, Sun May 21 12:46:05 2017 UTC revision 3324 by schoenebeck, Fri Jul 21 13:05:39 2017 UTC
# Line 341  namespace { Line 341  namespace {
341    
342    
343    
344    // *************** eg_opt_t ***************
345    // *
346    
347        eg_opt_t::eg_opt_t() {
348            AttackCancel     = true;
349            AttackHoldCancel = true;
350            Decay1Cancel     = true;
351            Decay2Cancel     = true;
352            ReleaseCancel    = true;
353        }
354    
355        void eg_opt_t::serialize(Serialization::Archive* archive) {
356            SRLZ(AttackCancel);
357            SRLZ(AttackHoldCancel);
358            SRLZ(Decay1Cancel);
359            SRLZ(Decay2Cancel);
360            SRLZ(ReleaseCancel);
361        }
362    
363    
364    
365  // *************** Sample ***************  // *************** Sample ***************
366  // *  // *
367    
# Line 1711  namespace { Line 1732  namespace {
1732              VCFType                         = vcf_type_lowpass;              VCFType                         = vcf_type_lowpass;
1733              memset(DimensionUpperLimits, 127, 8);              memset(DimensionUpperLimits, 127, 8);
1734          }          }
1735            // format extension for EG behavior options, these will *NOT* work with
1736            // Gigasampler/GigaStudio !
1737            RIFF::Chunk* lsde = _3ewl->GetSubChunk(CHUNK_ID_LSDE);
1738            if (lsde) {
1739                unsigned char byte = lsde->ReadUint8();
1740                EGOptions.AttackCancel     = byte & 1;
1741                EGOptions.AttackHoldCancel = byte & (1 << 1);
1742                EGOptions.Decay1Cancel     = byte & (1 << 2);
1743                EGOptions.Decay2Cancel     = byte & (1 << 3);
1744                EGOptions.ReleaseCancel    = byte & (1 << 4);
1745            }
1746    
1747          pVelocityAttenuationTable = GetVelocityTable(VelocityResponseCurve,          pVelocityAttenuationTable = GetVelocityTable(VelocityResponseCurve,
1748                                                       VelocityResponseDepth,                                                       VelocityResponseDepth,
# Line 1899  namespace { Line 1931  namespace {
1931          SRLZ(MSDecode);          SRLZ(MSDecode);
1932          //SRLZ(SampleStartOffset);          //SRLZ(SampleStartOffset);
1933          SRLZ(SampleAttenuation);          SRLZ(SampleAttenuation);
1934            SRLZ(EGOptions);
1935    
1936          // derived attributes from DLS::Sampler          // derived attributes from DLS::Sampler
1937          SRLZ(FineTune);          SRLZ(FineTune);
# Line 2205  namespace { Line 2238  namespace {
2238          if (chunksize >= 148) {          if (chunksize >= 148) {
2239              memcpy(&pData[140], DimensionUpperLimits, 8);              memcpy(&pData[140], DimensionUpperLimits, 8);
2240          }          }
2241    
2242            // format extension for EG behavior options, these will *NOT* work with
2243            // Gigasampler/GigaStudio !
2244            RIFF::Chunk* lsde = pParentList->GetSubChunk(CHUNK_ID_LSDE);
2245            if (!lsde) {
2246                // only add this "LSDE" chunk if the EG options do not match the
2247                // default EG behavior
2248                eg_opt_t defaultOpt;
2249                if (memcmp(&EGOptions, &defaultOpt, sizeof(eg_opt_t))) {
2250                    lsde = pParentList->AddSubChunk(CHUNK_ID_LSDE, 1);
2251                    // move LSDE chunk to the end of parent list
2252                    pParentList->MoveSubChunk(lsde, (RIFF::Chunk*)NULL);
2253                }
2254            }
2255            if (lsde) {
2256                unsigned char* pByte = (unsigned char*) lsde->LoadChunkData();
2257                *pByte =
2258                    (EGOptions.AttackCancel     ? 1 : 0) |
2259                    (EGOptions.AttackHoldCancel ? (1<<1) : 0) |
2260                    (EGOptions.Decay1Cancel     ? (1<<2) : 0) |
2261                    (EGOptions.Decay2Cancel     ? (1<<3) : 0) |
2262                    (EGOptions.ReleaseCancel    ? (1<<4) : 0);
2263            }
2264      }      }
2265    
2266      double* DimensionRegion::GetReleaseVelocityTable(curve_type_t releaseVelocityResponseCurve, uint8_t releaseVelocityResponseDepth) {      double* DimensionRegion::GetReleaseVelocityTable(curve_type_t releaseVelocityResponseCurve, uint8_t releaseVelocityResponseDepth) {
# Line 2619  namespace { Line 2675  namespace {
2675    
2676              // unknown controller type              // unknown controller type
2677              default:              default:
2678                  throw gig::Exception("Unknown leverage controller type (0x%x).", EncodedController);                  decodedcontroller.type = leverage_ctrl_t::type_none;
2679                    decodedcontroller.controller_number = 0;
2680                    printf("Warning: Unknown leverage controller type (0x%x).\n", EncodedController);
2681                    break;
2682          }          }
2683          return decodedcontroller;          return decodedcontroller;
2684      }      }

Legend:
Removed from v.3198  
changed lines
  Added in v.3324

  ViewVC Help
Powered by ViewVC