Merge branch 'master' into es5506_alt

This commit is contained in:
cam900 2022-11-03 13:44:07 +09:00 committed by GitHub
commit bf6487b8bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 2888 additions and 2460 deletions

View file

@ -3069,8 +3069,20 @@ DivSample* DivEngine::sampleFromFile(const char* path) {
if (extS==".brr") {
dataBuf=sample->dataBRR;
if ((len%9)==2) {
// ignore loop position
fseek(f,2,SEEK_SET);
// read loop position
unsigned short loopPos=0;
logD("BRR file has loop position");
if (fread(&loopPos,1,2,f)!=2) {
logW("could not read loop position! %s",strerror(errno));
} else {
#ifdef TA_BIG_ENDIAN
loopPos=(loopPos>>8)|(loopPos<<8);
#endif
sample->loopStart=16*(loopPos/9);
sample->loopEnd=sample->samples;
sample->loop=true;
sample->loopMode=DIV_SAMPLE_LOOP_FORWARD;
}
len-=2;
if (len==0) {
fclose(f);