total extinction of legacy sample mode, part 1

This commit is contained in:
tildearrow 2025-11-08 14:37:51 -05:00
parent 08e21a6298
commit 416148bd62
34 changed files with 44 additions and 437 deletions

View file

@ -934,10 +934,9 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
sample->name="";
}
logD("%d name %s (%d)",i,sample->name.c_str(),length);
sample->rate=22050;
sample->centerRate=22050;
if (ds.version>=0x0b) {
sample->rate=fileToDivRate(reader.readC());
sample->centerRate=sample->rate;
sample->centerRate=fileToDivRate(reader.readC());
pitch=reader.readC();
vol=reader.readC();
@ -947,7 +946,7 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
}
}
if (ds.version<=0x08) {
sample->rate=ymuSampleRate*400;
sample->centerRate=ymuSampleRate*400;
}
if (ds.version>0x15) {
sample->depth=(DivSampleDepth)reader.readC();
@ -1680,7 +1679,7 @@ SafeWriter* DivEngine::saveDMF(unsigned char version) {
for (DivSample* i: song.sample) {
w->writeI(i->samples);
w->writeString(i->name,true);
w->writeC(divToFileRate(i->rate));
w->writeC(divToFileRate(i->centerRate));
w->writeC(5);
w->writeC(50);
// i'm too lazy to deal with .dmf's weird way of storing 8-bit samples

View file

@ -1986,7 +1986,6 @@ bool DivEngine::loadFTM(unsigned char* file, size_t len, bool dnft, bool dnft_si
DivSample* sample = ds.sample[index];
sample->rate = 33144;
sample->centerRate = 33144;
sample->depth = DIV_SAMPLE_DEPTH_1BIT_DPCM;

View file

@ -112,8 +112,7 @@ bool DivEngine::loadMod(unsigned char* file, size_t len) {
if (slen==2) slen=0;
signed char fineTune=reader.readC()&0x0f;
if (fineTune>=8) fineTune-=16;
sample->rate=(int)(pow(2.0,(double)fineTune/96.0)*8363.0);
sample->centerRate=sample->rate;
sample->centerRate=(int)(pow(2.0,(double)fineTune/96.0)*8363.0);
defaultVols[i]=reader.readC();
int loopStart=reader.readS_BE()*2;
int loopLen=reader.readS_BE()*2;

View file

@ -75,7 +75,6 @@ void DivEngine::loadP(SafeReader& reader, std::vector<DivSample*>& ret, String&
{
DivSample* s = new DivSample;
s->rate = P_SAMPLE_RATE;
s->centerRate = P_SAMPLE_RATE;
s->depth = DIV_SAMPLE_DEPTH_VOX;
@ -121,4 +120,4 @@ void DivEngine::loadP(SafeReader& reader, std::vector<DivSample*>& ret, String&
lastError=_("premature end of file");
logE("premature end of file");
}
}
}

View file

@ -110,7 +110,6 @@ void DivEngine::loadP86(SafeReader& reader, std::vector<DivSample*>& ret, String
{
DivSample* s = new DivSample;
s->rate = P86_SAMPLE_RATE;
s->centerRate = P86_SAMPLE_RATE;
s->depth = DIV_SAMPLE_DEPTH_8BIT;
s->init(headers[i].sample_length); //byte per sample
@ -139,4 +138,4 @@ void DivEngine::loadP86(SafeReader& reader, std::vector<DivSample*>& ret, String
lastError=_("premature end of file");
logE("premature end of file");
}
}
}

View file

@ -69,7 +69,6 @@ void DivEngine::loadPDX(SafeReader& reader, std::vector<DivSample*>& ret, String
{
DivSample* s = new DivSample;
s->rate = PDX_SAMPLE_RATE;
s->centerRate = PDX_SAMPLE_RATE;
s->depth = DIV_SAMPLE_DEPTH_VOX;
s->init(headers[i].sample_length * 2);
@ -98,4 +97,4 @@ void DivEngine::loadPDX(SafeReader& reader, std::vector<DivSample*>& ret, String
lastError=_("premature end of file");
logE("premature end of file");
}
}
}

View file

@ -109,7 +109,6 @@ void DivEngine::loadPPC(SafeReader& reader, std::vector<DivSample*>& ret, String
{
DivSample* s = new DivSample;
s->rate = PPC_SAMPLE_RATE;
s->centerRate = PPC_SAMPLE_RATE;
s->depth = DIV_SAMPLE_DEPTH_ADPCM_B;
s->init((headers[i].end_pointer - headers[i].start_pointer) * 32 * 2);
@ -139,4 +138,4 @@ void DivEngine::loadPPC(SafeReader& reader, std::vector<DivSample*>& ret, String
lastError=_("premature end of file");
logE("premature end of file");
}
}
}

View file

@ -90,7 +90,6 @@ void DivEngine::loadPPS(SafeReader& reader, std::vector<DivSample*>& ret, String
{
DivSample* s = new DivSample;
s->rate = PPS_SAMPLE_RATE;
s->centerRate = PPS_SAMPLE_RATE;
s->depth = DIV_SAMPLE_DEPTH_4BIT;
s->init(headers[i].sample_length*2); // bytes->samples

View file

@ -125,7 +125,6 @@ void DivEngine::loadPVI(SafeReader& reader, std::vector<DivSample*>& ret, String
{
DivSample* s = new DivSample;
s->rate = PVI_SAMPLE_RATE;
s->centerRate = PVI_SAMPLE_RATE;
s->depth = DIV_SAMPLE_DEPTH_ADPCM_B;
s->init((headers[i].end_pointer - headers[i].start_pointer) * 32 * 2);
@ -155,4 +154,4 @@ void DivEngine::loadPVI(SafeReader& reader, std::vector<DivSample*>& ret, String
lastError=_("premature end of file");
logE("premature end of file");
}
}
}

View file

@ -113,7 +113,6 @@ void DivEngine::loadPZI(SafeReader& reader, std::vector<DivSample*>& ret, String
{
DivSample* s = new DivSample;
s->rate = headers[i].sample_rate;
s->centerRate = headers[i].sample_rate;
s->depth = DIV_SAMPLE_DEPTH_8BIT;
s->init(headers[i].sample_length); //byte per sample

View file

@ -262,7 +262,6 @@ SafeWriter* DivEngine::saveText(bool separatePatterns) {
w->writeText(fmt::sprintf("- data length: %d\n",sample->getCurBufLen()));
w->writeText(fmt::sprintf("- samples: %d\n",sample->samples));
w->writeText(fmt::sprintf("- rate: %d\n",sample->centerRate));
w->writeText(fmt::sprintf("- compat rate: %d\n",sample->rate));
w->writeText(fmt::sprintf("- loop: %s\n",trueFalse[sample->loop?1:0]));
if (sample->loop) {
w->writeText(fmt::sprintf(" - start: %d\n",sample->loopStart));