/[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 2216 by iliev, Mon Jul 25 17:21:16 2011 UTC revision 2234 by iliev, Tue Aug 9 18:27:58 2011 UTC
# Line 132  namespace LinuxSampler { Line 132  namespace LinuxSampler {
132      }      }
133    
134      Sample::buffer_t SampleFile::LoadSampleData() {      Sample::buffer_t SampleFile::LoadSampleData() {
135          return LoadSampleDataWithNullSamplesExtension(this->TotalFrameCount, 0); // 0 amount of NullSamples          return LoadSampleDataWithNullSamplesExtension(GetTotalFrameCount(), 0); // 0 amount of NullSamples
136      }      }
137    
138      Sample::buffer_t SampleFile::LoadSampleData(unsigned long FrameCount) {      Sample::buffer_t SampleFile::LoadSampleData(unsigned long FrameCount) {
# Line 140  namespace LinuxSampler { Line 140  namespace LinuxSampler {
140      }      }
141    
142      Sample::buffer_t SampleFile::LoadSampleDataWithNullSamplesExtension(uint NullFrameCount) {      Sample::buffer_t SampleFile::LoadSampleDataWithNullSamplesExtension(uint NullFrameCount) {
143          return LoadSampleDataWithNullSamplesExtension(this->TotalFrameCount, NullFrameCount);          return LoadSampleDataWithNullSamplesExtension(GetTotalFrameCount(), NullFrameCount);
144      }      }
145    
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 > GetTotalFrameCount()) FrameCount = GetTotalFrameCount();
149                    
150          if (Offset > MaxOffset && FrameCount < TotalFrameCount) {          if (Offset > MaxOffset && FrameCount < GetTotalFrameCount()) {
151              FrameCount = FrameCount + Offset > TotalFrameCount ? TotalFrameCount - Offset : FrameCount;              FrameCount = FrameCount + Offset > GetTotalFrameCount() ? GetTotalFrameCount() - Offset : FrameCount;
152              // Offset the RAM cache              // Offset the RAM cache
153              RAMCacheOffset = Offset;              RAMCacheOffset = Offset;
154          }          }
# Line 167  namespace LinuxSampler { Line 167  namespace LinuxSampler {
167    
168      long SampleFile::Read(void* pBuffer, unsigned long FrameCount) {      long SampleFile::Read(void* pBuffer, unsigned long FrameCount) {
169          Open();          Open();
170            
171            if (GetPos() + FrameCount > GetTotalFrameCount()) FrameCount = GetTotalFrameCount() - GetPos(); // For the cases where a different sample end is specified (not the end of the file)
172    
173          // ogg files must be read with sf_readf, not sf_read_raw. On          // ogg files must be read with sf_readf, not sf_read_raw. On
174          // big endian machines, sf_readf_short is also used for 16 bit          // big endian machines, sf_readf_short is also used for 16 bit

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

  ViewVC Help
Powered by ViewVC