/[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 3709 by schoenebeck, Fri Jan 10 11:21:59 2020 UTC revision 3710 by schoenebeck, Fri Jan 10 13:32:34 2020 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-2019 by Christian Schoenebeck                      *   *   Copyright (C) 2003-2020 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 3460  namespace { Line 3460  namespace {
3460              store32(&pData[iWavePoolOffset + i * 4], iWaveIndex);              store32(&pData[iWavePoolOffset + i * 4], iWaveIndex);
3461          }          }
3462    
3463          if (versiongt2) {          // The following chunks are just added for compatibility with the
3464            // GigaStudio software, which would show a warning if these were
3465            // missing. However currently these chunks don't cover any useful
3466            // data. So if this gig file uses any of our own gig format
3467            // extensions which would cause this gig file to be unloadable
3468            // with GSt software anyway, then just skip these GSt compatibility
3469            // chunks here as well.
3470            if (versiongt2 && !UsesAnyGigFormatExtension()) {
3471              // add 3dnm list which always seems to be empty              // add 3dnm list which always seems to be empty
3472              RIFF::List* _3dnm = pCkRegion->GetSubList(LIST_TYPE_3DNM);              RIFF::List* _3dnm = pCkRegion->GetSubList(LIST_TYPE_3DNM);
3473              if (!_3dnm) _3dnm = pCkRegion->AddSubList(LIST_TYPE_3DNM);              if (!_3dnm) _3dnm = pCkRegion->AddSubList(LIST_TYPE_3DNM);
# Line 4363  namespace { Line 4370  namespace {
4370          Layers = orig->Layers;          Layers = orig->Layers;
4371      }      }
4372    
4373        /**
4374         * Returns @c true in case this Region object uses any gig format
4375         * extension, that is e.g. whether any DimensionRegion object currently
4376         * has any setting effective that would require our "LSDE" RIFF chunk to
4377         * be stored to the gig file.
4378         *
4379         * Right now this is a private method. It is considerable though this method
4380         * to become (in slightly modified form) a public API method in future, i.e.
4381         * to allow instrument editors to visualize and/or warn the user of any gig
4382         * format extension being used. See also comments on
4383         * DimensionRegion::UsesAnyGigFormatExtension() for details about such a
4384         * potential public API change in future.
4385         */
4386        bool Region::UsesAnyGigFormatExtension() const {
4387            for (int i = 0; i < 256; i++) {
4388                if (pDimensionRegions[i]) {
4389                    if (pDimensionRegions[i]->UsesAnyGigFormatExtension())
4390                        return true;
4391                }
4392            }
4393            return false;
4394        }
4395    
4396    
4397  // *************** MidiRule ***************  // *************** MidiRule ***************
4398  // *  // *
# Line 5533  namespace { Line 5563  namespace {
5563          UpdateRegionKeyTable();          UpdateRegionKeyTable();
5564      }      }
5565    
5566        /**
5567         * Returns @c true in case this Instrument object uses any gig format
5568         * extension, that is e.g. whether any DimensionRegion object currently
5569         * has any setting effective that would require our "LSDE" RIFF chunk to
5570         * be stored to the gig file.
5571         *
5572         * Right now this is a private method. It is considerable though this method
5573         * to become (in slightly modified form) a public API method in future, i.e.
5574         * to allow instrument editors to visualize and/or warn the user of any gig
5575         * format extension being used. See also comments on
5576         * DimensionRegion::UsesAnyGigFormatExtension() for details about such a
5577         * potential public API change in future.
5578         */
5579        bool Instrument::UsesAnyGigFormatExtension() const {
5580            if (!pRegions) return false;
5581            RegionList::const_iterator iter = pRegions->begin();
5582            RegionList::const_iterator end  = pRegions->end();
5583            for (; iter != end; ++iter) {
5584                gig::Region* rgn = static_cast<gig::Region*>(*iter);
5585                if (rgn->UsesAnyGigFormatExtension())
5586                    return true;
5587            }
5588            return false;
5589        }
5590    
5591    
5592  // *************** Group ***************  // *************** Group ***************
5593  // *  // *
# Line 6863  namespace { Line 6918  namespace {
6918          return bAutoLoad;          return bAutoLoad;
6919      }      }
6920    
6921        /**
6922         * Returns @c true in case this gig File object uses any gig format
6923         * extension, that is e.g. whether any DimensionRegion object currently
6924         * has any setting effective that would require our "LSDE" RIFF chunk to
6925         * be stored to the gig file.
6926         *
6927         * Right now this is a private method. It is considerable though this method
6928         * to become (in slightly modified form) a public API method in future, i.e.
6929         * to allow instrument editors to visualize and/or warn the user of any gig
6930         * format extension being used. See also comments on
6931         * DimensionRegion::UsesAnyGigFormatExtension() for details about such a
6932         * potential public API change in future.
6933         */
6934        bool File::UsesAnyGigFormatExtension() const {
6935            if (!pInstruments) return false;
6936            InstrumentList::iterator iter = pInstruments->begin();
6937            InstrumentList::iterator end  = pInstruments->end();
6938            for (; iter != end; ++iter) {
6939                Instrument* pInstrument = static_cast<gig::Instrument*>(*iter);
6940                if (pInstrument->UsesAnyGigFormatExtension())
6941                    return true;
6942            }
6943            return false;
6944        }
6945    
6946    
6947  // *************** Exception ***************  // *************** Exception ***************

Legend:
Removed from v.3709  
changed lines
  Added in v.3710

  ViewVC Help
Powered by ViewVC