dev233 - breaking the limit, part 1

now up to 32768 wavetables and 32768 samples

this is the first part and does not implement the new sample limit correctly
I have to adapt every dispatch to the new limit... see you in the next part

the format version had to be bumped because the WL and SL .fui features were limited to 256 entries
there are new LW and LS blocks with more space
howwver there's a new issue... we can have a feature larger than 65536, which is a limit imposed by the feature header :<
this will be addressed though
This commit is contained in:
tildearrow 2025-07-26 18:48:23 -05:00
parent c96d2983cd
commit 98030de8c7
9 changed files with 276 additions and 77 deletions

View file

@ -932,11 +932,13 @@ void DivEngine::delUnusedWaves() {
}
void DivEngine::delUnusedSamples() {
if (song.sample.empty()) return;
BUSY_BEGIN;
saveLock.lock();
bool isUsed[256];
memset(isUsed,0,256*sizeof(bool));
bool* isUsed=new bool[song.sample.size()];
memset(isUsed,0,song.sample.size()*sizeof(bool));
// scan in instruments
for (DivInstrument* i: song.ins) {
@ -1029,6 +1031,8 @@ void DivEngine::delUnusedSamples() {
// render
renderSamples();
delete[] isUsed;
saveLock.unlock();
BUSY_END;
}
@ -2707,7 +2711,7 @@ void DivEngine::delInstrument(int index) {
}
int DivEngine::addWave() {
if (song.wave.size()>=256) {
if (song.wave.size()>=32768) {
lastError=_("too many wavetables!");
return -1;
}
@ -2724,7 +2728,7 @@ int DivEngine::addWave() {
}
int DivEngine::addWavePtr(DivWavetable* which) {
if (song.wave.size()>=256) {
if (song.wave.size()>=32768) {
lastError=_("too many wavetables!");
delete which;
return -1;