Merge branch 'master' of https://github.com/tildearrow/furnace into nmk112
This commit is contained in:
commit
b12af42b06
43 changed files with 160 additions and 70 deletions
|
|
@ -52,10 +52,10 @@ class DivWorkPool;
|
|||
#define EXTERN_BUSY_BEGIN_SOFT e->softLocked=true; e->isBusy.lock();
|
||||
#define EXTERN_BUSY_END e->isBusy.unlock(); e->softLocked=false;
|
||||
|
||||
#define DIV_UNSTABLE
|
||||
//#define DIV_UNSTABLE
|
||||
|
||||
#define DIV_VERSION "0.6pre16"
|
||||
#define DIV_ENGINE_VERSION 178
|
||||
#define DIV_VERSION "0.6"
|
||||
#define DIV_ENGINE_VERSION 181
|
||||
// for imports
|
||||
#define DIV_VERSION_MOD 0xff01
|
||||
#define DIV_VERSION_FC 0xff02
|
||||
|
|
|
|||
|
|
@ -464,6 +464,13 @@ DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth,
|
|||
accum/=channels;
|
||||
sample->data8[i]=accum;
|
||||
}
|
||||
if (bigEndian) {
|
||||
for (unsigned int i=0; (i+1)<samples; i+=2) {
|
||||
sample->data8[i]^=sample->data8[i^1];
|
||||
sample->data8[i^1]^=sample->data8[i];
|
||||
sample->data8[i]^=sample->data8[i^1];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
memcpy(sample->getCurBuf(),buf,len);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -245,10 +245,10 @@ void DivPlatformC140::tick(bool sysTick) {
|
|||
if (chan[i].sample>=0 && chan[i].sample<parent->song.sampleLen && s->isLoopable()) {
|
||||
if (is219) {
|
||||
loop=MIN(start+(s->loopStart>>1),65535);
|
||||
end=MIN(start+(s->loopEnd>>1)-1,65535);
|
||||
end=MIN(start+(s->loopEnd>>1),65535);
|
||||
} else {
|
||||
loop=MIN(start+s->loopStart,65535);
|
||||
end=MIN(start+s->loopEnd-1,65535);
|
||||
loop=MIN(start+s->loopStart+1,65535);
|
||||
end=MIN(start+s->loopEnd+1,65535);
|
||||
}
|
||||
} else if (chan[i].noise && is219) {
|
||||
loop=0;
|
||||
|
|
@ -575,7 +575,7 @@ void DivPlatformC140::renderSamples(int sysID) {
|
|||
}
|
||||
|
||||
if (is219) { // C219 (8-bit)
|
||||
unsigned int length=s->length8;
|
||||
unsigned int length=s->length8+4;
|
||||
// fit sample size to single bank size
|
||||
if (length>131072) {
|
||||
length=131072;
|
||||
|
|
@ -594,27 +594,39 @@ void DivPlatformC140::renderSamples(int sysID) {
|
|||
logW("out of C219 memory for sample %d!",i);
|
||||
}
|
||||
if (s->depth==DIV_SAMPLE_DEPTH_C219) {
|
||||
unsigned char next=0;
|
||||
unsigned int sPos=0;
|
||||
for (unsigned int i=0; i<length; i++) {
|
||||
if (i>=s->lengthC219) {
|
||||
sampleMem[(memPos+i)^1]=0;
|
||||
} else {
|
||||
sampleMem[(memPos+i)^1]=s->dataC219[i];
|
||||
if (sPos<s->lengthC219) {
|
||||
next=s->dataC219[sPos++];
|
||||
if (s->isLoopable()) {
|
||||
if ((int)sPos>=s->loopEnd) {
|
||||
sPos=s->loopStart;
|
||||
}
|
||||
}
|
||||
}
|
||||
sampleMem[(memPos+i)^1]=next;
|
||||
}
|
||||
} else {
|
||||
signed char next=0;
|
||||
unsigned int sPos=0;
|
||||
for (unsigned int i=0; i<length; i++) {
|
||||
if (i>=s->length8) {
|
||||
sampleMem[(memPos+i)^1]=0;
|
||||
} else {
|
||||
sampleMem[(memPos+i)^1]=s->data8[i];
|
||||
if (sPos<s->length8) {
|
||||
next=s->data8[sPos++];
|
||||
if (s->isLoopable()) {
|
||||
if ((int)sPos>=s->loopEnd) {
|
||||
sPos=s->loopStart;
|
||||
}
|
||||
}
|
||||
}
|
||||
sampleMem[(memPos+i)^1]=next;
|
||||
}
|
||||
}
|
||||
sampleOff[i]=memPos>>1;
|
||||
sampleLoaded[i]=true;
|
||||
memPos+=length;
|
||||
} else { // C140 (16-bit)
|
||||
unsigned int length=s->length16;
|
||||
unsigned int length=s->length16+4;
|
||||
// fit sample size to single bank size
|
||||
if (length>(131072)) {
|
||||
length=131072;
|
||||
|
|
@ -641,7 +653,20 @@ void DivPlatformC140::renderSamples(int sysID) {
|
|||
sampleMem[1+i+memPos]=c140Mu;
|
||||
}
|
||||
} else {
|
||||
memcpy(sampleMem+memPos,s->data16,length);
|
||||
short next=0;
|
||||
unsigned int sPos=0;
|
||||
for (unsigned int i=0; i<length; i+=2) {
|
||||
if (sPos<s->samples) {
|
||||
next=s->data16[sPos++];
|
||||
if (s->isLoopable()) {
|
||||
if ((int)sPos>=s->loopEnd) {
|
||||
sPos=s->loopStart;
|
||||
}
|
||||
}
|
||||
}
|
||||
sampleMem[memPos+i]=((unsigned short)next);
|
||||
sampleMem[memPos+i+1]=((unsigned short)next)>>8;
|
||||
}
|
||||
}
|
||||
sampleOff[i]=memPos>>1;
|
||||
sampleLoaded[i]=true;
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@ DivMacroInt* DivPlatformK007232::getChanMacroInt(int ch) {
|
|||
}
|
||||
|
||||
unsigned short DivPlatformK007232::getPan(int ch) {
|
||||
return ((chan[ch].panning&15)<<8)|((chan[ch].panning&0xf0)>>4);
|
||||
return stereo?(((chan[ch].panning&15)<<8)|((chan[ch].panning&0xf0)>>4)):0;
|
||||
}
|
||||
|
||||
DivDispatchOscBuffer* DivPlatformK007232::getOscBuffer(int ch) {
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ void DivPlatformNamcoWSG::tick(bool sysTick) {
|
|||
if (chan[i].std.vol.had) {
|
||||
chan[i].outVol=((chan[i].vol&15)*MIN(15,chan[i].std.vol.val))>>4;
|
||||
}
|
||||
if (chan[i].std.duty.had && i>=4) {
|
||||
if (chan[i].std.duty.had) {
|
||||
chan[i].noise=chan[i].std.duty.val;
|
||||
chan[i].freqChanged=true;
|
||||
}
|
||||
|
|
@ -418,6 +418,7 @@ int DivPlatformNamcoWSG::dispatch(DivCommand c) {
|
|||
}
|
||||
case DIV_CMD_STD_NOISE_MODE:
|
||||
chan[c.chan].noise=c.value;
|
||||
chan[c.chan].freqChanged=true;
|
||||
break;
|
||||
case DIV_CMD_PANNING: {
|
||||
chan[c.chan].pan=(c.value&0xf0)|(c.value2>>4);
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ void c140_voice_tick(struct c140_t *c140, const unsigned char v, const int cycle
|
|||
if (!voice->muted)
|
||||
{
|
||||
// fetch 12 bit sample
|
||||
signed short s1 = c140->sample_mem[((unsigned int)(voice->bank) << 16) | voice->addr] & ~0xf;
|
||||
signed short s1 = c140->sample_mem[((unsigned int)(voice->bank) << 16) | (voice->addr & 0xffff)] & ~0xf;
|
||||
signed short s2 = c140->sample_mem[((unsigned int)(voice->bank) << 16) | ((voice->addr + 1) & 0xffff)] & ~0xf;
|
||||
if (voice->compressed)
|
||||
{
|
||||
|
|
@ -171,7 +171,7 @@ void c219_voice_tick(struct c219_t *c219, const unsigned char v, const int cycle
|
|||
else
|
||||
{
|
||||
// fetch 8 bit sample
|
||||
signed short s1 = c219->sample_mem[((unsigned int)(c219->bank[(v >> 2) & 3]) << 17) | (voice->addr^1)];
|
||||
signed short s1 = c219->sample_mem[((unsigned int)(c219->bank[(v >> 2) & 3]) << 17) | ((voice->addr^1) & 0x1ffff)];
|
||||
signed short s2 = c219->sample_mem[((unsigned int)(c219->bank[(v >> 2) & 3]) << 17) | (((voice->addr + 1) & 0x1ffff)^1)];
|
||||
if (voice->compressed)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1708,6 +1708,10 @@ void DivEngine::registerSystems() {
|
|||
|
||||
EffectHandlerMap namcoEffectHandlerMap={
|
||||
{0x10, {DIV_CMD_WAVE, "10xx: Set waveform"}},
|
||||
};
|
||||
|
||||
EffectHandlerMap namcoC30EffectHandlerMap={
|
||||
{0x10, {DIV_CMD_WAVE, "10xx: Set waveform"}},
|
||||
{0x11, {DIV_CMD_STD_NOISE_MODE, "11xx: Toggle noise mode"}},
|
||||
};
|
||||
|
||||
|
|
@ -1741,7 +1745,7 @@ void DivEngine::registerSystems() {
|
|||
{DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE, DIV_CH_WAVE},
|
||||
{DIV_INS_NAMCO, DIV_INS_NAMCO, DIV_INS_NAMCO, DIV_INS_NAMCO, DIV_INS_NAMCO, DIV_INS_NAMCO, DIV_INS_NAMCO, DIV_INS_NAMCO},
|
||||
{},
|
||||
namcoEffectHandlerMap
|
||||
namcoC30EffectHandlerMap
|
||||
);
|
||||
|
||||
sysDefs[DIV_SYSTEM_MSM5232]=new DivSysDef(
|
||||
|
|
|
|||
|
|
@ -1747,13 +1747,13 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
|
|||
if (!hasRFC1) {
|
||||
hasRFC1=disCont[i].dispatch->chipClock;
|
||||
isSecond[i]=true;
|
||||
CHIP_VOL(16,1.6);
|
||||
CHIP_VOL(16,0.8);
|
||||
willExport[i]=true;
|
||||
writeRF5C68[1]=disCont[i].dispatch;
|
||||
}
|
||||
} else if (!hasRFC) {
|
||||
hasRFC=disCont[i].dispatch->chipClock;
|
||||
CHIP_VOL(5,1.6);
|
||||
CHIP_VOL(5,1.1);
|
||||
willExport[i]=true;
|
||||
writeRF5C68[0]=disCont[i].dispatch;
|
||||
}
|
||||
|
|
@ -2418,8 +2418,10 @@ SafeWriter* DivEngine::saveVGM(bool* sysToExport, bool loop, int version, bool p
|
|||
}
|
||||
while (!done) {
|
||||
if (loopPos==-1) {
|
||||
if (loopOrder==curOrder && loopRow==curRow && ticks==1) {
|
||||
writeLoop=true;
|
||||
if (loopOrder==curOrder && loopRow==curRow) {
|
||||
if ((ticks-((tempoAccum+curSubSong->virtualTempoN)/curSubSong->virtualTempoD))<=0) {
|
||||
writeLoop=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
songTick++;
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ void DivEngine::runExportThread() {
|
|||
if (sfWrap.doClose()!=0) {
|
||||
logE("could not close audio file!");
|
||||
}
|
||||
exporting=false;
|
||||
|
||||
if (initAudioBackend()) {
|
||||
for (int i=0; i<song.systemLen; i++) {
|
||||
|
|
@ -118,6 +117,7 @@ void DivEngine::runExportThread() {
|
|||
}
|
||||
}
|
||||
logI("done!");
|
||||
exporting=false;
|
||||
break;
|
||||
}
|
||||
case DIV_EXPORT_MODE_MANY_SYS: {
|
||||
|
|
@ -217,7 +217,6 @@ void DivEngine::runExportThread() {
|
|||
logE("could not close audio file!");
|
||||
}
|
||||
}
|
||||
exporting=false;
|
||||
|
||||
if (initAudioBackend()) {
|
||||
for (int i=0; i<song.systemLen; i++) {
|
||||
|
|
@ -229,6 +228,7 @@ void DivEngine::runExportThread() {
|
|||
}
|
||||
}
|
||||
logI("done!");
|
||||
exporting=false;
|
||||
break;
|
||||
}
|
||||
case DIV_EXPORT_MODE_MANY_CHAN: {
|
||||
|
|
@ -336,7 +336,6 @@ void DivEngine::runExportThread() {
|
|||
|
||||
if (stopExport) break;
|
||||
}
|
||||
exporting=false;
|
||||
|
||||
delete[] outBuf[0];
|
||||
delete[] outBuf[1];
|
||||
|
|
@ -359,6 +358,7 @@ void DivEngine::runExportThread() {
|
|||
}
|
||||
}
|
||||
logI("done!");
|
||||
exporting=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue