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) { |
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 |
} |
} |
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 |