/[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 2912 by schoenebeck, Tue May 17 14:30:10 2016 UTC revision 3048 by schoenebeck, Fri Nov 25 18:34:45 2016 UTC
# Line 882  namespace DLS { Line 882  namespace DLS {
882       * FormatTag must be DLS_WAVE_FORMAT_PCM. Trying to resize samples with       * FormatTag must be DLS_WAVE_FORMAT_PCM. Trying to resize samples with
883       * other formats will fail!       * other formats will fail!
884       *       *
885       * @param iNewSize - new sample wave data size in sample points (must be       * @param NewSize - new sample wave data size in sample points (must be
886       *                   greater than zero)       *                  greater than zero)
887       * @throws Excecption if FormatTag != DLS_WAVE_FORMAT_PCM       * @throws Exception if FormatTag != DLS_WAVE_FORMAT_PCM
888       * @throws Exception if \a iNewSize is less than 1       * @throws Exception if \a NewSize is less than 1 or unrealistic large
889       * @see File::Save(), FrameSize, FormatTag       * @see File::Save(), FrameSize, FormatTag
890       */       */
891      void Sample::Resize(int iNewSize) {      void Sample::Resize(file_offset_t NewSize) {
892          if (FormatTag != DLS_WAVE_FORMAT_PCM) throw Exception("Sample's format is not DLS_WAVE_FORMAT_PCM");          if (FormatTag != DLS_WAVE_FORMAT_PCM) throw Exception("Sample's format is not DLS_WAVE_FORMAT_PCM");
893          if (iNewSize < 1) throw Exception("Sample size must be at least one sample point");          if (NewSize < 1) throw Exception("Sample size must be at least one sample point");
894          const int iSizeInBytes = iNewSize * FrameSize;          if ((NewSize >> 48) != 0)
895                throw Exception("Unrealistic high DLS sample size detected");
896            const file_offset_t sizeInBytes = NewSize * FrameSize;
897          pCkData = pWaveList->GetSubChunk(CHUNK_ID_DATA);          pCkData = pWaveList->GetSubChunk(CHUNK_ID_DATA);
898          if (pCkData) pCkData->Resize(iSizeInBytes);          if (pCkData) pCkData->Resize(sizeInBytes);
899          else pCkData = pWaveList->AddSubChunk(CHUNK_ID_DATA, iSizeInBytes);          else pCkData = pWaveList->AddSubChunk(CHUNK_ID_DATA, sizeInBytes);
900      }      }
901    
902      /**      /**
# Line 994  namespace DLS { Line 996  namespace DLS {
996      Region::Region(Instrument* pInstrument, RIFF::List* rgnList) : Resource(pInstrument, rgnList), Articulator(rgnList), Sampler(rgnList) {      Region::Region(Instrument* pInstrument, RIFF::List* rgnList) : Resource(pInstrument, rgnList), Articulator(rgnList), Sampler(rgnList) {
997          pCkRegion = rgnList;          pCkRegion = rgnList;
998    
999          // articulation informations          // articulation information
1000          RIFF::Chunk* rgnh = rgnList->GetSubChunk(CHUNK_ID_RGNH);          RIFF::Chunk* rgnh = rgnList->GetSubChunk(CHUNK_ID_RGNH);
1001          if (rgnh) {          if (rgnh) {
1002              rgnh->Read(&KeyRange, 2, 2);              rgnh->Read(&KeyRange, 2, 2);
# Line 1016  namespace DLS { Line 1018  namespace DLS {
1018          }          }
1019          SelfNonExclusive = FormatOptionFlags & F_RGN_OPTION_SELFNONEXCLUSIVE;          SelfNonExclusive = FormatOptionFlags & F_RGN_OPTION_SELFNONEXCLUSIVE;
1020    
1021          // sample informations          // sample information
1022          RIFF::Chunk* wlnk = rgnList->GetSubChunk(CHUNK_ID_WLNK);          RIFF::Chunk* wlnk = rgnList->GetSubChunk(CHUNK_ID_WLNK);
1023          if (wlnk) {          if (wlnk) {
1024              WaveLinkOptionFlags = wlnk->ReadUint16();              WaveLinkOptionFlags = wlnk->ReadUint16();
# Line 1825  namespace DLS { Line 1827  namespace DLS {
1827       * have at the end of the saving process.       * have at the end of the saving process.
1828       *       *
1829       * @param pProgress - optional: callback function for progress notification       * @param pProgress - optional: callback function for progress notification
1830       * @throws RIFF::Exception if any kind of IO error occured       * @throws RIFF::Exception if any kind of IO error occurred
1831       * @throws DLS::Exception  if any kind of DLS specific error occured       * @throws DLS::Exception  if any kind of DLS specific error occurred
1832       */       */
1833      void File::Save(progress_t* pProgress) {      void File::Save(progress_t* pProgress) {
1834          {          {

Legend:
Removed from v.2912  
changed lines
  Added in v.3048

  ViewVC Help
Powered by ViewVC