MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / mixBuffer

Function mixBuffer

Source/Amiga/paula.cpp:173–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171
172template<bool stereo>
173inline int mixBuffer(int16 *&buf, const int8 *data, Paula::Offset &offset, frac_t rate, int neededSamples, unsigned int bufSize, uint8 volume, uint8 panning, Paula::FilterState &filterState, int voice) {
174 int samples;
175 for (samples = 0; samples < neededSamples && offset.int_off < bufSize; ++samples) {
176 const int32 tmp = filter(((int32) data[offset.int_off]) * volume, filterState, voice);
177 if (stereo) {
178 *buf++ += (tmp * (255 - panning)) >> 7;
179 *buf++ += (tmp * (panning)) >> 7;
180 } else
181 *buf++ += tmp;
182
183 // Step to next source sample
184 offset.rem_off += rate;
185 if (offset.rem_off >= (frac_t)FRAC_ONE) {
186 offset.int_off += fracToInt(offset.rem_off);
187 offset.rem_off &= FRAC_LO_MASK;
188 }
189 }
190
191 return samples;
192}
193
194template<bool stereo>
195int Paula::readBufferIntern(int16 *buffer, const int numSamples) {

Callers

nothing calls this directly

Calls 2

filterFunction · 0.85
fracToIntFunction · 0.85

Tested by

no test coverage detected