/[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 3140 by schoenebeck, Wed May 3 16:19:53 2017 UTC revision 3323 by schoenebeck, Thu Jul 20 22:09:54 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            DecayCancel      = true;
351            ReleaseCancel    = true;
352        }
353    
354        void eg_opt_t::serialize(Serialization::Archive* archive) {
355            SRLZ(AttackCancel);
356            SRLZ(AttackHoldCancel);
357            SRLZ(DecayCancel);
358            SRLZ(ReleaseCancel);
359        }
360    
361    
362    
363  // *************** Sample ***************  // *************** Sample ***************
364  // *  // *
365    
# Line 1711  namespace { Line 1730  namespace {
1730              VCFType                         = vcf_type_lowpass;              VCFType                         = vcf_type_lowpass;
1731              memset(DimensionUpperLimits, 127, 8);              memset(DimensionUpperLimits, 127, 8);
1732          }          }
1733            // format extension for EG behavior options, these will *NOT* work with
1734            // Gigasampler/GigaStudio !
1735            RIFF::Chunk* lsde = _3ewl->GetSubChunk(CHUNK_ID_LSDE);
1736            if (lsde) {
1737                unsigned char byte = lsde->ReadUint8();
1738                EGOptions.AttackCancel     = byte & 1;
1739                EGOptions.AttackHoldCancel = byte & (1 << 1);
1740                EGOptions.DecayCancel      = byte & (1 << 2);
1741                EGOptions.ReleaseCancel    = byte & (1 << 3);
1742            }
1743    
1744          pVelocityAttenuationTable = GetVelocityTable(VelocityResponseCurve,          pVelocityAttenuationTable = GetVelocityTable(VelocityResponseCurve,
1745                                                       VelocityResponseDepth,                                                       VelocityResponseDepth,
# Line 1817  namespace { Line 1846  namespace {
1846      }      }
1847    
1848      void DimensionRegion::serialize(Serialization::Archive* archive) {      void DimensionRegion::serialize(Serialization::Archive* archive) {
1849            // in case this class will become backward incompatible one day,
1850            // then set a version and minimum version for this class like:
1851            //archive->setVersion(*this, 2);
1852            //archive->setMinVersion(*this, 1);
1853    
1854          SRLZ(VelocityUpperLimit);          SRLZ(VelocityUpperLimit);
1855          SRLZ(EG1PreAttack);          SRLZ(EG1PreAttack);
1856          SRLZ(EG1Attack);          SRLZ(EG1Attack);
# Line 1894  namespace { Line 1928  namespace {
1928          SRLZ(MSDecode);          SRLZ(MSDecode);
1929          //SRLZ(SampleStartOffset);          //SRLZ(SampleStartOffset);
1930          SRLZ(SampleAttenuation);          SRLZ(SampleAttenuation);
1931            SRLZ(EGOptions);
1932    
1933          // derived attributes from DLS::Sampler          // derived attributes from DLS::Sampler
1934          SRLZ(FineTune);          SRLZ(FineTune);
# Line 2200  namespace { Line 2235  namespace {
2235          if (chunksize >= 148) {          if (chunksize >= 148) {
2236              memcpy(&pData[140], DimensionUpperLimits, 8);              memcpy(&pData[140], DimensionUpperLimits, 8);
2237          }          }
2238    
2239            // format extension for EG behavior options, these will *NOT* work with
2240            // Gigasampler/GigaStudio !
2241            RIFF::Chunk* lsde = pParentList->GetSubChunk(CHUNK_ID_LSDE);
2242            if (!lsde) {
2243                // only add this "LSDE" chunk if the EG options do not match the
2244                // default EG behavior
2245                eg_opt_t defaultOpt;
2246                if (memcmp(&EGOptions, &defaultOpt, sizeof(eg_opt_t))) {
2247                    lsde = pParentList->AddSubChunk(CHUNK_ID_LSDE, 1);
2248                    // move LSDE chunk to the end of parent list
2249                    pParentList->MoveSubChunk(lsde, (RIFF::Chunk*)NULL);
2250                }
2251            }
2252            if (lsde) {
2253                unsigned char* pByte = (unsigned char*) lsde->LoadChunkData();
2254                *pByte =
2255                    (EGOptions.AttackCancel     ? 1 : 0) |
2256                    (EGOptions.AttackHoldCancel ? (1<<1) : 0) |
2257                    (EGOptions.DecayCancel      ? (1<<2) : 0) |
2258                    (EGOptions.ReleaseCancel    ? (1<<3) : 0);
2259            }
2260      }      }
2261    
2262      double* DimensionRegion::GetReleaseVelocityTable(curve_type_t releaseVelocityResponseCurve, uint8_t releaseVelocityResponseDepth) {      double* DimensionRegion::GetReleaseVelocityTable(curve_type_t releaseVelocityResponseCurve, uint8_t releaseVelocityResponseDepth) {
# Line 2614  namespace { Line 2671  namespace {
2671    
2672              // unknown controller type              // unknown controller type
2673              default:              default:
2674                  throw gig::Exception("Unknown leverage controller type.");                  decodedcontroller.type = leverage_ctrl_t::type_none;
2675                    decodedcontroller.controller_number = 0;
2676                    printf("Warning: Unknown leverage controller type (0x%x).\n", EncodedController);
2677                    break;
2678          }          }
2679          return decodedcontroller;          return decodedcontroller;
2680      }      }
# Line 6468  namespace { Line 6528  namespace {
6528  // *************** Exception ***************  // *************** Exception ***************
6529  // *  // *
6530    
6531      Exception::Exception(String Message) : DLS::Exception(Message) {      Exception::Exception() : DLS::Exception() {
6532        }
6533    
6534        Exception::Exception(String format, ...) : DLS::Exception() {
6535            va_list arg;
6536            va_start(arg, format);
6537            Message = assemble(format, arg);
6538            va_end(arg);
6539        }
6540    
6541        Exception::Exception(String format, va_list arg) : DLS::Exception() {
6542            Message = assemble(format, arg);
6543      }      }
6544    
6545      void Exception::PrintMessage() {      void Exception::PrintMessage() {

Legend:
Removed from v.3140  
changed lines
  Added in v.3323

  ViewVC Help
Powered by ViewVC