/[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 3731 by schoenebeck, Sat Feb 1 15:35:07 2020 UTC revision 3913 by schoenebeck, Fri Jun 4 11:28:11 2021 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   libgig - C++ cross-platform Gigasampler format file access library    *   *   libgig - C++ cross-platform Gigasampler format file access library    *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003-2020 by Christian Schoenebeck                      *   *   Copyright (C) 2003-2021 by Christian Schoenebeck                      *
6   *                              <cuse@users.sourceforge.net>               *   *                              <cuse@users.sourceforge.net>               *
7   *                                                                         *   *                                                                         *
8   *   This library is free software; you can redistribute it and/or modify  *   *   This library is free software; you can redistribute it and/or modify  *
# Line 482  namespace { Line 482  namespace {
482              ScanCompressedSample();              ScanCompressedSample();
483          }          }
484    
485          // we use a buffer for decompression and for truncating 24 bit samples to 16 bit          // we use a buffer for decompression only
486          if ((Compressed || BitDepth == 24) && !InternalDecompressionBuffer.Size) {          if (Compressed && !InternalDecompressionBuffer.Size) {
487              InternalDecompressionBuffer.pStart = new unsigned char[INITIAL_SAMPLE_BUFFER_SIZE];              InternalDecompressionBuffer.pStart = new unsigned char[INITIAL_SAMPLE_BUFFER_SIZE];
488              InternalDecompressionBuffer.Size   = INITIAL_SAMPLE_BUFFER_SIZE;              InternalDecompressionBuffer.Size   = INITIAL_SAMPLE_BUFFER_SIZE;
489          }          }
# Line 3807  namespace { Line 3807  namespace {
3807       * @throws gig::Exception if requested zone could not be deleted       * @throws gig::Exception if requested zone could not be deleted
3808       */       */
3809      void Region::DeleteDimensionZone(dimension_t type, int zone) {      void Region::DeleteDimensionZone(dimension_t type, int zone) {
3810            if (!Dimensions)
3811                throw gig::Exception("Could not delete dimension zone, because there is no dimension at all.");
3812          dimension_def_t* oldDef = GetDimensionDefinition(type);          dimension_def_t* oldDef = GetDimensionDefinition(type);
3813          if (!oldDef)          if (!oldDef)
3814              throw gig::Exception("Could not delete dimension zone, no such dimension of given type");              throw gig::Exception("Could not delete dimension zone, no such dimension of given type");
# Line 3835  namespace { Line 3837  namespace {
3837          // requested by the arguments of this method call) to the temporary          // requested by the arguments of this method call) to the temporary
3838          // region, and don't use Region::CopyAssign() here for this task, since          // region, and don't use Region::CopyAssign() here for this task, since
3839          // it would also alter fast lookup helper variables here and there          // it would also alter fast lookup helper variables here and there
3840          dimension_def_t newDef;          dimension_def_t newDef = {};
3841          for (int i = 0; i < Dimensions; ++i) {          for (int i = 0; i < Dimensions; ++i) {
3842              dimension_def_t def = pDimensionDefinitions[i]; // copy, don't reference              dimension_def_t def = pDimensionDefinitions[i]; // copy, don't reference
3843              // is this the dimension requested by the method arguments? ...              // is this the dimension requested by the method arguments? ...
# Line 3846  namespace { Line 3848  namespace {
3848              }              }
3849              tempRgn->AddDimension(&def);              tempRgn->AddDimension(&def);
3850          }          }
3851            // silence clang sanitizer warning
3852            if (newDef.dimension == dimension_none)
3853                throw gig::Exception("Unexpected internal failure resolving dimension in DeleteDimensionZone() [this is a bug].");
3854    
3855          // find the dimension index in the tempRegion which is the dimension          // find the dimension index in the tempRegion which is the dimension
3856          // type passed to this method (paranoidly expecting different order)          // type passed to this method (paranoidly expecting different order)
# Line 3946  namespace { Line 3951  namespace {
3951       * @throws gig::Exception if requested zone could not be splitted       * @throws gig::Exception if requested zone could not be splitted
3952       */       */
3953      void Region::SplitDimensionZone(dimension_t type, int zone) {      void Region::SplitDimensionZone(dimension_t type, int zone) {
3954            if (!Dimensions)
3955                throw gig::Exception("Could not split dimension zone, because there is no dimension at all.");
3956          dimension_def_t* oldDef = GetDimensionDefinition(type);          dimension_def_t* oldDef = GetDimensionDefinition(type);
3957          if (!oldDef)          if (!oldDef)
3958              throw gig::Exception("Could not split dimension zone, no such dimension of given type");              throw gig::Exception("Could not split dimension zone, no such dimension of given type");
# Line 3972  namespace { Line 3979  namespace {
3979          // requested by the arguments of this method call) to the temporary          // requested by the arguments of this method call) to the temporary
3980          // region, and don't use Region::CopyAssign() here for this task, since          // region, and don't use Region::CopyAssign() here for this task, since
3981          // it would also alter fast lookup helper variables here and there          // it would also alter fast lookup helper variables here and there
3982          dimension_def_t newDef;          dimension_def_t newDef = {};
3983          for (int i = 0; i < Dimensions; ++i) {          for (int i = 0; i < Dimensions; ++i) {
3984              dimension_def_t def = pDimensionDefinitions[i]; // copy, don't reference              dimension_def_t def = pDimensionDefinitions[i]; // copy, don't reference
3985              // is this the dimension requested by the method arguments? ...              // is this the dimension requested by the method arguments? ...
# Line 3983  namespace { Line 3990  namespace {
3990              }              }
3991              tempRgn->AddDimension(&def);              tempRgn->AddDimension(&def);
3992          }          }
3993            // silence clang sanitizer warning
3994            if (newDef.dimension == dimension_none)
3995                throw gig::Exception("Unexpected internal failure resolving dimension in SplitDimensionZone() [this is a bug].");
3996    
3997          // find the dimension index in the tempRegion which is the dimension          // find the dimension index in the tempRegion which is the dimension
3998          // type passed to this method (paranoidly expecting different order)          // type passed to this method (paranoidly expecting different order)
# Line 5696  namespace { Line 5706  namespace {
5706       * still being able to fine tune certain aspects of the script for each       * still being able to fine tune certain aspects of the script for each
5707       * instrument individually.       * instrument individually.
5708       *       *
5709         * @note This is an own format extension which did not exist i.e. in the
5710         * GigaStudio 4 software. It will currently only work with LinuxSampler and
5711         * Gigedit.
5712         *
5713       * @param slot - script slot index of the variable to be retrieved       * @param slot - script slot index of the variable to be retrieved
5714       * @param variable - name of the 'patch' variable in that script       * @param variable - name of the 'patch' variable in that script
5715       */       */
# Line 5727  namespace { Line 5741  namespace {
5741       * still being able to fine tune certain aspects of the script for each       * still being able to fine tune certain aspects of the script for each
5742       * instrument individually.       * instrument individually.
5743       *       *
5744         * @note This is an own format extension which did not exist i.e. in the
5745         * GigaStudio 4 software. It will currently only work with LinuxSampler and
5746         * Gigedit.
5747         *
5748       * @param slot - script slot index of the variable to be retrieved       * @param slot - script slot index of the variable to be retrieved
5749       */       */
5750      std::map<String,String> Instrument::GetScriptPatchVariables(int slot) {      std::map<String,String> Instrument::GetScriptPatchVariables(int slot) {
# Line 5754  namespace { Line 5772  namespace {
5772       * still being able to fine tune certain aspects of the script for each       * still being able to fine tune certain aspects of the script for each
5773       * instrument individually.       * instrument individually.
5774       *       *
5775         * @note This is an own format extension which did not exist i.e. in the
5776         * GigaStudio 4 software. It will currently only work with LinuxSampler and
5777         * Gigedit.
5778         *
5779       * @param slot - script slot index of the variable to be retrieved       * @param slot - script slot index of the variable to be retrieved
5780       * @param variable - name of the 'patch' variable in that script       * @param variable - name of the 'patch' variable in that script
5781       */       */
# Line 5774  namespace { Line 5796  namespace {
5796       * still being able to fine tune certain aspects of the script for each       * still being able to fine tune certain aspects of the script for each
5797       * instrument individually.       * instrument individually.
5798       *       *
5799         * @note This is an own format extension which did not exist i.e. in the
5800         * GigaStudio 4 software. It will currently only work with LinuxSampler and
5801         * Gigedit.
5802         *
5803       * @param slot - script slot index of the variable to be set       * @param slot - script slot index of the variable to be set
5804       * @param variable - name of the 'patch' variable in that script       * @param variable - name of the 'patch' variable in that script
5805       * @param value - overridden initial value for that script variable       * @param value - overridden initial value for that script variable
# Line 5814  namespace { Line 5840  namespace {
5840       * still being able to fine tune certain aspects of the script for each       * still being able to fine tune certain aspects of the script for each
5841       * instrument individually.       * instrument individually.
5842       *       *
5843         * @note This is an own format extension which did not exist i.e. in the
5844         * GigaStudio 4 software. It will currently only work with LinuxSampler and
5845         * Gigedit.
5846         *
5847       * @param slot - script slot index of the variable to be unset       * @param slot - script slot index of the variable to be unset
5848       * @param variable - name of the 'patch' variable in that script       * @param variable - name of the 'patch' variable in that script
5849       */       */
# Line 5938  namespace { Line 5968  namespace {
5968          PianoReleaseMode = orig->PianoReleaseMode;          PianoReleaseMode = orig->PianoReleaseMode;
5969          DimensionKeyRange = orig->DimensionKeyRange;          DimensionKeyRange = orig->DimensionKeyRange;
5970          scriptPoolFileOffsets = orig->scriptPoolFileOffsets;          scriptPoolFileOffsets = orig->scriptPoolFileOffsets;
5971          pScriptRefs = orig->pScriptRefs;          // deep copy of pScriptRefs required (to avoid undefined behaviour)
5972            if (pScriptRefs) delete pScriptRefs;
5973            pScriptRefs = new std::vector<_ScriptPooolRef>;
5974            if (orig->pScriptRefs)
5975                *pScriptRefs = *orig->pScriptRefs;
5976          scriptVars = orig->scriptVars;          scriptVars = orig->scriptVars;
5977                    
5978          // free old midi rules          // free old midi rules

Legend:
Removed from v.3731  
changed lines
  Added in v.3913

  ViewVC Help
Powered by ViewVC