Implement sample loop end position, enum-ise sample depth (#557)

TODO: new sample format
This commit is contained in:
cam900 2022-07-22 13:36:42 +09:00 committed by GitHub
parent a137eefd20
commit 5127d5ef18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 461 additions and 306 deletions

View file

@ -2226,7 +2226,7 @@ int DivEngine::addSampleFromFile(const char* path) {
sample->rate=33144;
sample->centerRate=33144;
sample->depth=1;
sample->depth=DIV_SAMPLE_DEPTH_1BIT_DPCM;
sample->init(len*8);
if (fread(sample->dataDPCM,1,len,f)==0) {
@ -2301,9 +2301,9 @@ int DivEngine::addSampleFromFile(const char* path) {
int index=0;
if ((si.format&SF_FORMAT_SUBMASK)==SF_FORMAT_PCM_U8) {
sample->depth=8;
sample->depth=DIV_SAMPLE_DEPTH_8BIT;
} else {
sample->depth=16;
sample->depth=DIV_SAMPLE_DEPTH_16BIT;
}
sample->init(si.frames);
if ((si.format&SF_FORMAT_SUBMASK)==SF_FORMAT_PCM_U8) {
@ -2358,6 +2358,7 @@ int DivEngine::addSampleFromFile(const char* path) {
if(inst.loop_count && inst.loops[0].mode == SF_LOOP_FORWARD)
{
sample->loopStart=inst.loops[0].start;
sample->loopEnd=inst.loops[0].end;
if(inst.loops[0].end < (unsigned int)sampleCount)
sampleCount=inst.loops[0].end;
}