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

Method read

lib-src/libscorealign/audiofilereader.cpp:33–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31
32
33long Audio_file_reader::read(float *data, long n)
34{
35 // note that "samples_per_frame" is really "frames_per_window" in this
36 // context, so we're computing bytes per window
37 float *input_data = (float *) alloca(bytes_per_frame * samples_per_frame);
38 assert(input_data != NULL) ;
39
40 long frames_read = (long) sf_readf_float(sf, input_data, n);
41 long chans = sf_info.channels;
42 // now convert to mono and move to data
43 for (int frame = 0; frame < frames_read; frame++) {
44 float sum = 0;
45 for (int chan = 0; chan < sf_info.channels; chan++) {
46 // sum over channels within a frame
47 sum += input_data[frame * chans + chan];
48 }
49 // write the frame sum to result array
50 data[frame] = sum;
51 }
52 return frames_read;
53}
54
55
56bool Audio_file_reader::open(const char *filename, Scorealign &sa, bool verbose)

Callers 15

~SMSMethod · 0.45
adjustMethod · 0.45
markMethod · 0.45
assignStartMethod · 0.45
startMethod · 0.45
readMethod · 0.45
readMethod · 0.45
analyzeMethod · 0.45
extractMethod · 0.45
adjust1Method · 0.45
readSubSamplesMethod · 0.45
readMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected