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

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

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

revision 2026 by iliev, Tue Nov 3 19:08:44 2009 UTC revision 2044 by persson, Sun Jan 10 12:58:51 2010 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   libsf2 - C++ cross-platform SF2 format file access library            *   *   libsf2 - C++ cross-platform SF2 format file access library            *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2009 Grigor Iliev  <grigor@grigoriliev.com>             *   *   Copyright (C) 2009-2010 Grigor Iliev  <grigor@grigoriliev.com>,       *
6   *   Copyright (C) 2009 Christian Schoenebeck                              *   *    Christian Schoenebeck and Andreas Persson                            *
  *   Copyright (C) 2009 Andreas Persson                                    *  
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 616  namespace sf2 { Line 615  namespace sf2 {
615          if (pPresetRegion == NULL || pPresetRegion->freqModLfo == NONE) return ToHz(freqModLfo);          if (pPresetRegion == NULL || pPresetRegion->freqModLfo == NONE) return ToHz(freqModLfo);
616          return ToHz(pPresetRegion->freqModLfo + freqModLfo);          return ToHz(pPresetRegion->freqModLfo + freqModLfo);
617      }      }
618        
619      double Region::GetDelayModLfo(Region* pPresetRegion) {      double Region::GetDelayModLfo(Region* pPresetRegion) {
620          if (pPresetRegion == NULL || pPresetRegion->delayModLfo == NONE) return ToSeconds(delayModLfo);          if (pPresetRegion == NULL || pPresetRegion->delayModLfo == NONE) return ToSeconds(delayModLfo);
621          return ToSeconds(pPresetRegion->delayModLfo + delayModLfo);          return ToSeconds(pPresetRegion->delayModLfo + delayModLfo);
# Line 682  namespace sf2 { Line 681  namespace sf2 {
681      }      }
682    
683      Instrument::~Instrument() {      Instrument::~Instrument() {
           
684      }      }
685    
686      Region* Instrument::CreateRegion() {      Region* Instrument::CreateRegion() {
# Line 771  namespace sf2 { Line 769  namespace sf2 {
769              }              }
770    
771              Region* reg = CreateRegion();              Region* reg = CreateRegion();
772                
773              for (int j = gIdx1; j < gIdx2; j++) {              for (int j = gIdx1; j < gIdx2; j++) {
774                  reg->SetGenerator(pFile, pFile->InstGenLists[j]);                  reg->SetGenerator(pFile, pFile->InstGenLists[j]);
775                  // TODO: ignore generators following a sampleID generator                  // TODO: ignore generators following a sampleID generator
# Line 806  namespace sf2 { Line 804  namespace sf2 {
804      }      }
805    
806      Preset::~Preset() {      Preset::~Preset() {
           
807      }      }
808    
809      Region* Preset::CreateRegion() {      Region* Preset::CreateRegion() {
# Line 1074  namespace sf2 { Line 1071  namespace sf2 {
1071              if (Samples[i]) delete (Samples[i]);              if (Samples[i]) delete (Samples[i]);
1072          }          }
1073      }      }
1074        
1075      int File::GetPresetCount() {      int File::GetPresetCount() {
1076          return Presets.size() - 1; // exclude terminal preset (EOP)          return Presets.size() - 1; // exclude terminal preset (EOP)
1077      }      }
# Line 1185  namespace sf2 { Line 1182  namespace sf2 {
1182       * that the size is given in bytes! You get the number of actually cached       * that the size is given in bytes! You get the number of actually cached
1183       * samples by dividing it by the frame size of the sample:       * samples by dividing it by the frame size of the sample:
1184       * @code       * @code
1185       *  buffer_t buf       = pSample->LoadSampleData(acquired_samples);       *  buffer_t buf       = pSample->LoadSampleData(acquired_samples);
1186       *  long cachedsamples = buf.Size / pSample->FrameSize;       *  long cachedsamples = buf.Size / pSample->FrameSize;
1187       * @endcode       * @endcode
1188       *       *
1189       * @param SampleCount - number of sample points to load into RAM       * @param SampleCount - number of sample points to load into RAM
# Line 1230  namespace sf2 { Line 1227  namespace sf2 {
1227       * that the size is given in bytes! You get the number of actually cached       * that the size is given in bytes! You get the number of actually cached
1228       * samples by dividing it by the frame size of the sample:       * samples by dividing it by the frame size of the sample:
1229       * @code       * @code
1230       *  buffer_t buf       = pSample->LoadSampleDataWithNullSamplesExtension(acquired_samples, null_samples);       *  buffer_t buf       = pSample->LoadSampleDataWithNullSamplesExtension(acquired_samples, null_samples);
1231       *  long cachedsamples = buf.Size / pSample->FrameSize;       *  long cachedsamples = buf.Size / pSample->FrameSize;
1232       * @endcode       * @endcode
1233       * The method will add \a NullSamplesCount silence samples past the       * The method will add \a NullSamplesCount silence samples past the
1234       * official buffer end (this won't affect the 'Size' member of the       * official buffer end (this won't affect the 'Size' member of the
# Line 1337  namespace sf2 { Line 1334  namespace sf2 {
1334          if (SampleCount == 0) return 0;          if (SampleCount == 0) return 0;
1335          long pos = GetPos();          long pos = GetPos();
1336          if (pos + SampleCount > GetTotalFrameCount()) SampleCount = GetTotalFrameCount() - pos;          if (pos + SampleCount > GetTotalFrameCount()) SampleCount = GetTotalFrameCount() - pos;
1337            
1338          if (GetFrameSize() / GetChannelCount() == 3 /* 24 bit */) {          if (GetFrameSize() / GetChannelCount() == 3 /* 24 bit */) {
1339              uint8_t* pBuf = (uint8_t*)pBuffer;              uint8_t* pBuf = (uint8_t*)pBuffer;
1340              if (SampleType == MONO_SAMPLE || SampleType == ROM_MONO_SAMPLE) {              if (SampleType == MONO_SAMPLE || SampleType == ROM_MONO_SAMPLE) {

Legend:
Removed from v.2026  
changed lines
  Added in v.2044

  ViewVC Help
Powered by ViewVC