Prepare to add hasSamplePtrHeader and hasSampleInstHeader in dispatch (WIP)

for refresh sample memory when loop/end pointer and instrument parameter changed. Also, this PR has minor code style fixes and add warning in MultiPCM sample map usage.
This commit is contained in:
cam900 2025-08-27 22:52:19 +09:00
parent 4ed40d37d6
commit bd8d9a56a0
10 changed files with 141 additions and 28 deletions

View file

@ -1861,7 +1861,13 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
int sampleCountBefore=e->song.sampleLen;
std::vector<DivInstrument*> instruments=e->instrumentFromFile(path,false);
if (!instruments.empty()) {
if (e->song.sampleLen!=sampleCountBefore) {
int hasSampleInst=false;
for (int s=0; s<e->song.systemLen; s++) {
if (e->getDispatch(s)->hasSampleInstHeader()) {
hasSampleInst=true;
}
}
if ((e->song.sampleLen!=sampleCountBefore) || hasSampleInst) {
e->renderSamplesP();
}
if (curFileDialog==GUI_FILE_INS_OPEN_REPLACE) {
@ -3928,7 +3934,13 @@ bool FurnaceGUI::loop() {
DivWavetable* droppedWave=NULL;
//DivSample* droppedSample=NULL;
if (!instruments.empty()) {
if (e->song.sampleLen!=sampleCountBefore) {
bool hasSampleInst=false;
for (int s=0; s<e->song.systemLen; s++) {
if (e->getDispatch(s)->hasSampleInstHeader()) {
hasSampleInst=true;
}
}
if ((e->song.sampleLen!=sampleCountBefore) || hasSampleInst) {
e->renderSamplesP();
}
if (!e->getWarnings().empty()) {
@ -5521,7 +5533,13 @@ bool FurnaceGUI::loop() {
instruments.push_back(j);
}
}
if (e->song.sampleLen!=sampleCountBefore) {
bool hasSampleInst=false;
for (int s=0; s<e->song.systemLen; s++) {
if (e->getDispatch(s)->hasSampleInstHeader()) {
hasSampleInst=true;
}
}
if ((e->song.sampleLen!=sampleCountBefore) || hasSampleInst) {
e->renderSamplesP();
}
if (warn) {
@ -5561,7 +5579,13 @@ bool FurnaceGUI::loop() {
int sampleCountBefore=e->song.sampleLen;
std::vector<DivInstrument*> instruments=e->instrumentFromFile(copyOfName.c_str(),true,settings.readInsNames);
if (!instruments.empty()) {
if (e->song.sampleLen!=sampleCountBefore) {
bool hasSampleInst=false;
for (int s=0; s<e->song.systemLen; s++) {
if (e->getDispatch(s)->hasSampleInstHeader()) {
hasSampleInst=true;
}
}
if ((e->song.sampleLen!=sampleCountBefore) || hasSampleInst) {
e->renderSamplesP();
}
if (!e->getWarnings().empty()) {