Add primary MultiPCM support

Partially revert previous commit
Add notifyInsAddition in dispatch for instrument addition
Refresh sample memory when instrument type changed
Fix naming for consistency
Also, this commit fixes a some possible issue in MultiPCM on openMSX core.
Chip ID: Already determined
This commit is contained in:
cam900 2025-08-29 16:24:32 +09:00
parent bd8d9a56a0
commit 957b57f3d9
19 changed files with 1085 additions and 55 deletions

View file

@ -2647,16 +2647,10 @@ int DivEngine::addInstrument(int refChan, DivInstrumentType fallbackType) {
song.ins.push_back(ins);
song.insLen=insCount+1;
checkAssetDir(song.insDir,song.ins.size());
for (int i=0; i<song.systemLen; i++) {
disCont[i].dispatch->notifyInsAddition(i);
}
saveLock.unlock();
bool hasSampleInst=false;
for (int s=0; s<song.systemLen; s++) {
if (disCont[s].dispatch->hasSampleInstHeader()) {
hasSampleInst=true;
}
}
if (hasSampleInst) {
renderSamplesP();
}
BUSY_END;
return insCount;
}
@ -2673,16 +2667,10 @@ int DivEngine::addInstrumentPtr(DivInstrument* which) {
checkAssetDir(song.insDir,song.ins.size());
checkAssetDir(song.waveDir,song.wave.size());
checkAssetDir(song.sampleDir,song.sample.size());
for (int i=0; i<song.systemLen; i++) {
disCont[i].dispatch->notifyInsAddition(i);
}
saveLock.unlock();
bool hasSampleInst=false;
for (int s=0; s<song.systemLen; s++) {
if (disCont[s].dispatch->hasSampleInstHeader()) {
hasSampleInst=true;
}
}
if (hasSampleInst) {
renderSamplesP();
}
BUSY_END;
return song.insLen;
}
@ -2718,13 +2706,13 @@ void DivEngine::delInstrumentUnsafe(int index) {
}
removeAsset(song.insDir,index);
checkAssetDir(song.insDir,song.ins.size());
bool hasSampleInst=false;
bool hasSampleIns=false;
for (int s=0; s<song.systemLen; s++) {
if (disCont[s].dispatch->hasSampleInstHeader()) {
hasSampleInst=true;
if (disCont[s].dispatch->hasSampleInsHeader()) {
hasSampleIns=true;
}
}
if (hasSampleInst) {
if (hasSampleIns) {
renderSamplesP();
}
}