MCPcopy Create free account
hub / github.com/VCVRack/Rack / endIncr

Method endIncr

include/dsp/ringbuffer.hpp:125–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123 return &data[i];
124 }
125 void endIncr(size_t n) {
126 size_t i = end % S;
127 size_t e1 = i + n;
128 size_t e2 = (e1 < S) ? e1 : S;
129 // Copy data forward
130 std::memcpy(&data[S + i], &data[i], sizeof(T) * (e2 - i));
131
132 if (e1 > S) {
133 // Copy data backward from the doubled block to the main block
134 std::memcpy(data, &data[S], sizeof(T) * (e1 - S));
135 }
136 end += n;
137 }
138 /** Returns a pointer to S consecutive elements for consumption
139 If any data is consumed, call startIncr afterwards.
140 */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected