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

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

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

revision 55 by schoenebeck, Tue Apr 27 09:06:07 2004 UTC revision 666 by persson, Sun Jun 19 15:18:59 2005 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   libgig - C++ cross-platform Gigasampler format file loader library    *   *   libgig - C++ cross-platform Gigasampler format file loader library    *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Christian Schoenebeck                     *   *   Copyright (C) 2003-2005 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  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 413  namespace DLS { Line 413  namespace DLS {
413          uint32_t headersize = ptbl->ReadUint32();          uint32_t headersize = ptbl->ReadUint32();
414          WavePoolCount  = ptbl->ReadUint32();          WavePoolCount  = ptbl->ReadUint32();
415          pWavePoolTable = new uint32_t[WavePoolCount];          pWavePoolTable = new uint32_t[WavePoolCount];
416            pWavePoolTableHi = new uint32_t[WavePoolCount];
417          ptbl->SetPos(headersize);          ptbl->SetPos(headersize);
418          ptbl->Read(pWavePoolTable, WavePoolCount, sizeof(uint32_t));  
419            // Check for 64 bit offsets (used in gig v3 files)
420            if (ptbl->GetSize() - headersize == WavePoolCount * 8) {
421                for (int i = 0 ; i < WavePoolCount ; i++) {
422                    pWavePoolTableHi[i] = ptbl->ReadUint32();
423                    pWavePoolTable[i] = ptbl->ReadUint32();
424                    if (pWavePoolTable[i] & 0x80000000)
425                        throw DLS::Exception("Files larger than 2 GB not yet supported");
426                }
427            }
428            else {
429                ptbl->Read(pWavePoolTable, WavePoolCount, sizeof(uint32_t));
430                for (int i = 0 ; i < WavePoolCount ; i++) pWavePoolTableHi[i] = 0;
431            }
432    
433          pSamples     = NULL;          pSamples     = NULL;
434          pInstruments = NULL;          pInstruments = NULL;
         Instruments  = 0;  
435      }      }
436    
437      File::~File() {      File::~File() {
# Line 443  namespace DLS { Line 456  namespace DLS {
456          }          }
457    
458          if (pWavePoolTable) delete[] pWavePoolTable;          if (pWavePoolTable) delete[] pWavePoolTable;
459            if (pWavePoolTableHi) delete[] pWavePoolTableHi;
460          if (pVersion) delete pVersion;          if (pVersion) delete pVersion;
461      }      }
462    
# Line 529  namespace DLS { Line 543  namespace DLS {
543          std::cout << "DLS::Exception: " << Message << std::endl;          std::cout << "DLS::Exception: " << Message << std::endl;
544      }      }
545    
546    
547    // *************** functions ***************
548    // *
549    
550        /**
551         * Returns the name of this C++ library. This is usually "libgig" of
552         * course. This call is equivalent to RIFF::libraryName() and
553         * gig::libraryName().
554         */
555        String libraryName() {
556            return PACKAGE;
557        }
558    
559        /**
560         * Returns version of this C++ library. This call is equivalent to
561         * RIFF::libraryVersion() and gig::libraryVersion().
562         */
563        String libraryVersion() {
564            return VERSION;
565        }
566    
567  } // namespace DLS  } // namespace DLS

Legend:
Removed from v.55  
changed lines
  Added in v.666

  ViewVC Help
Powered by ViewVC