optimize renderSamples
only render sample which has changed
This commit is contained in:
parent
6b6a8518ce
commit
624e45afa8
5 changed files with 45 additions and 43 deletions
|
|
@ -396,13 +396,13 @@ int DivEngine::loadSampleROMs() {
|
|||
return error;
|
||||
}
|
||||
|
||||
void DivEngine::renderSamplesP() {
|
||||
void DivEngine::renderSamplesP(int whichSample) {
|
||||
BUSY_BEGIN;
|
||||
renderSamples();
|
||||
renderSamples(whichSample);
|
||||
BUSY_END;
|
||||
}
|
||||
|
||||
void DivEngine::renderSamples() {
|
||||
void DivEngine::renderSamples(int whichSample) {
|
||||
sPreview.sample=-1;
|
||||
sPreview.pos=0;
|
||||
sPreview.dir=false;
|
||||
|
|
@ -418,8 +418,12 @@ void DivEngine::renderSamples() {
|
|||
}
|
||||
|
||||
// step 1: render samples
|
||||
for (int i=0; i<song.sampleLen; i++) {
|
||||
song.sample[i]->render(formatMask);
|
||||
if (whichSample==-1) {
|
||||
for (int i=0; i<song.sampleLen; i++) {
|
||||
song.sample[i]->render(formatMask);
|
||||
}
|
||||
} else if (whichSample>=0 && whichSample<song.sampleLen) {
|
||||
song.sample[whichSample]->render(formatMask);
|
||||
}
|
||||
|
||||
// step 2: render samples to dispatch
|
||||
|
|
|
|||
|
|
@ -1064,10 +1064,14 @@ class DivEngine {
|
|||
unsigned int getSampleFormatMask();
|
||||
|
||||
// UNSAFE render samples - only execute when locked
|
||||
void renderSamples();
|
||||
void renderSamples(int whichSample=-1);
|
||||
|
||||
// public render samples
|
||||
void renderSamplesP();
|
||||
// values for whichSample
|
||||
// -2: don't render anything - just update chip sample memory
|
||||
// -1: render all samples
|
||||
// >=0: render specific sample
|
||||
void renderSamplesP(int whichSample=-1);
|
||||
|
||||
// public swap channels
|
||||
void swapChannelsP(int src, int dest);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue