Add notifySampleChanged in dispatch and engine:

This method/variables are for notify sample is changed/altered/added/removed.  can be called together with updateSampleTex for sample update.

multipcm: Fix possible desync with instrument and sample parameter

opl4: Split sample table render and sample data render, Add notifySampleChange for refresh sample parameters
This commit is contained in:
cam900 2025-09-22 15:54:48 +09:00 committed by freq-mod
parent 7253bf66cd
commit 1b712e03ee
15 changed files with 146 additions and 52 deletions

View file

@ -2915,6 +2915,7 @@ void FurnaceGUI::processDrags(int dragX, int dragY) {
for (int i=x; i<=x1; i++) ((signed char*)sampleDragTarget)[i]=val;
}
updateSampleTex=true;
notifySampleChange=true;
}
} else { // select
if (sampleSelStart<0) {
@ -4019,26 +4020,22 @@ bool FurnaceGUI::loop() {
}
nextWindow=GUI_WINDOW_WAVE_LIST;
MARK_MODIFIED;
}
else if (!samples.empty())
{
} else if (!samples.empty()) {
if (e->song.sampleLen!=sampleCountBefore) {
//e->renderSamplesP();
}
if (!e->getWarnings().empty())
{
if (!e->getWarnings().empty()) {
showWarning(e->getWarnings(),GUI_WARN_GENERIC);
}
int sampleCount=-1;
for (DivSample* s: samples)
{
for (DivSample* s: samples) {
sampleCount=e->addSamplePtr(s);
}
//sampleCount=e->addSamplePtr(droppedSample);
if (sampleCount>=0 && settings.selectAssetOnLoad)
{
if (sampleCount>=0 && settings.selectAssetOnLoad) {
curSample=sampleCount;
updateSampleTex=true;
notifySampleChange=true;
}
nextWindow=GUI_WINDOW_SAMPLE_LIST;
MARK_MODIFIED;
@ -4277,6 +4274,11 @@ bool FurnaceGUI::loop() {
e->notifyWaveChange(curWave);
}
if (notifySampleChange) {
notifySampleChange=false;
e->notifySampleChange(curSample);
}
eventTimeEnd=SDL_GetPerformanceCounter();
if (SDL_GetWindowFlags(sdlWin)&SDL_WINDOW_MINIMIZED) {
@ -5523,6 +5525,7 @@ bool FurnaceGUI::loop() {
MARK_MODIFIED;
});
updateSampleTex=true;
notifySampleChange=true;
} else {
showError(_("...but you haven't selected a sample!"));
delete samples[0];
@ -7146,6 +7149,7 @@ bool FurnaceGUI::loop() {
MARK_MODIFIED;
});
updateSampleTex=true;
notifySampleChange=true;
} else {
showError(_("...but you haven't selected a sample!"));
delete s;
@ -8511,6 +8515,7 @@ FurnaceGUI::FurnaceGUI():
sysDupEnd(false),
noteInputPoly(true),
notifyWaveChange(false),
notifySampleChange(false),
wantScrollListIns(false),
wantScrollListWave(false),
wantScrollListSample(false),