/[svn]/linuxsampler/trunk/src/engines/common/SampleFile.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/common/SampleFile.cpp

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

revision 2215 by persson, Mon Feb 21 17:34:36 2011 UTC revision 2216 by iliev, Mon Jul 25 17:21:16 2011 UTC
# Line 146  namespace LinuxSampler { Line 146  namespace LinuxSampler {
146      Sample::buffer_t SampleFile::LoadSampleDataWithNullSamplesExtension(unsigned long FrameCount, uint NullFramesCount) {      Sample::buffer_t SampleFile::LoadSampleDataWithNullSamplesExtension(unsigned long FrameCount, uint NullFramesCount) {
147          Open();          Open();
148          if (FrameCount > this->TotalFrameCount) FrameCount = this->TotalFrameCount;          if (FrameCount > this->TotalFrameCount) FrameCount = this->TotalFrameCount;
149            
150            if (Offset > MaxOffset && FrameCount < TotalFrameCount) {
151                FrameCount = FrameCount + Offset > TotalFrameCount ? TotalFrameCount - Offset : FrameCount;
152                // Offset the RAM cache
153                RAMCacheOffset = Offset;
154            }
155          if (RAMCache.pStart) delete[] (int8_t*) RAMCache.pStart;          if (RAMCache.pStart) delete[] (int8_t*) RAMCache.pStart;
156          unsigned long allocationsize = (FrameCount + NullFramesCount) * this->FrameSize;          unsigned long allocationsize = (FrameCount + NullFramesCount) * this->FrameSize;
157          SetPos(0, SEEK_SET); // reset read position to begin of sample          SetPos(RAMCacheOffset, SEEK_SET); // reset read position to playback start point
158          RAMCache.pStart            = new int8_t[allocationsize];          RAMCache.pStart            = new int8_t[allocationsize];
159    
160          RAMCache.Size = Read(RAMCache.pStart, FrameCount) * this->FrameSize;          RAMCache.Size = Read(RAMCache.pStart, FrameCount) * this->FrameSize;

Legend:
Removed from v.2215  
changed lines
  Added in v.2216

  ViewVC Help
Powered by ViewVC