prepare for possible major optimization

by just forwarding an output buffer to the dispatch and begin/length,
the number of calls may be reduced which improves performance.
This commit is contained in:
tildearrow 2021-12-06 05:21:42 -05:00
parent 055b4f9c26
commit 6efcfc2e8a
19 changed files with 178 additions and 132 deletions

View file

@ -2,16 +2,17 @@
#include <stdio.h>
#include <math.h>
void DivPlatformDummy::acquire(int& l, int& r) {
l=0;
for (unsigned char i=0; i<chans; i++) {
if (chan[i].active) {
l+=((chan[i].pos>=0x8000)?chan[i].vol:-chan[i].vol)*chan[i].amp;
chan[i].pos+=chan[i].freq;
void DivPlatformDummy::acquire(short** buf, size_t start, size_t len) {
for (size_t i=start; i<start+len; i++) {
buf[0][i]=0;
for (unsigned char j=0; j<chans; j++) {
if (chan[j].active) {
buf[0][i]+=((chan[j].pos>=0x8000)?chan[j].vol:-chan[j].vol)*chan[j].amp;
chan[j].pos+=chan[j].freq;
}
}
buf[1][i]=buf[0][i];
}
r=l;
}
void DivPlatformDummy::tick() {