MCPcopy Create free account
hub / github.com/audacity/audacity / read

Method read

lib-src/soundtouch/source/SoundStretch/WavFile.cpp:271–297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269
270
271int WavInFile::read(unsigned char *buffer, int maxElems)
272{
273 int numBytes;
274 uint afterDataRead;
275
276 // ensure it's 8 bit format
277 if (header.format.bits_per_sample != 8)
278 {
279 ST_THROW_RT_ERROR("Error: WavInFile::read(char*, int) works only with 8bit samples.");
280 }
281 assert(sizeof(char) == 1);
282
283 numBytes = maxElems;
284 afterDataRead = dataRead + numBytes;
285 if (afterDataRead > header.data.data_len)
286 {
287 // Don't read more samples than are marked available in header
288 numBytes = (int)header.data.data_len - (int)dataRead;
289 assert(numBytes >= 0);
290 }
291
292 assert(buffer);
293 numBytes = (int)fread(buffer, 1, numBytes, fptr);
294 dataRead += numBytes;
295
296 return numBytes;
297}
298
299
300int WavInFile::read(short *buffer, int maxElems)

Callers 2

processFunction · 0.45
detectBPMFunction · 0.45

Calls 4

_swap16BufferFunction · 0.85
_swap16Function · 0.85
_swap32Function · 0.85
c_strMethod · 0.45

Tested by

no test coverage detected