Merge branch 'master' of https://github.com/tildearrow/furnace into x1_010_bank
This commit is contained in:
commit
b1070f531a
6 changed files with 88 additions and 4 deletions
|
|
@ -1567,6 +1567,49 @@ void DivEngine::changeSong(size_t songIndex) {
|
|||
prevRow=0;
|
||||
}
|
||||
|
||||
void DivEngine::checkAssetDir(std::vector<DivAssetDir>& dir, size_t entries) {
|
||||
bool* inAssetDir=new bool[entries];
|
||||
memset(inAssetDir,0,entries*sizeof(bool));
|
||||
|
||||
for (DivAssetDir& i: dir) {
|
||||
for (size_t j=0; j<i.entries.size(); j++) {
|
||||
// erase invalid entry
|
||||
if (i.entries[j]<0 || i.entries[j]>=(int)entries) {
|
||||
i.entries.erase(i.entries.begin()+j);
|
||||
j--;
|
||||
continue;
|
||||
}
|
||||
|
||||
// mark entry as present
|
||||
inAssetDir[j]=true;
|
||||
}
|
||||
}
|
||||
|
||||
// get unsorted directory
|
||||
DivAssetDir* unsortedDir=NULL;
|
||||
for (DivAssetDir& i: dir) {
|
||||
if (i.name=="Unsorted") {
|
||||
unsortedDir=&i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// create unsorted directory if it doesn't exist
|
||||
if (unsortedDir==NULL) {
|
||||
dir.push_back(DivAssetDir("Unsorted"));
|
||||
unsortedDir=&(*dir.rbegin());
|
||||
}
|
||||
|
||||
// add missing items to unsorted directory
|
||||
for (size_t i=0; i<entries; i++) {
|
||||
if (!inAssetDir[i]) {
|
||||
unsortedDir->entries.push_back(i);
|
||||
}
|
||||
}
|
||||
|
||||
delete[] inAssetDir;
|
||||
}
|
||||
|
||||
void DivEngine::swapChannelsP(int src, int dest) {
|
||||
if (src<0 || src>=chans) return;
|
||||
if (dest<0 || dest>=chans) return;
|
||||
|
|
|
|||
|
|
@ -490,6 +490,9 @@ class DivEngine {
|
|||
// change song (UNSAFE)
|
||||
void changeSong(size_t songIndex);
|
||||
|
||||
// check whether an asset directory is complete
|
||||
void checkAssetDir(std::vector<DivAssetDir>& dir, size_t entries);
|
||||
|
||||
public:
|
||||
DivSong song;
|
||||
DivOrders* curOrders;
|
||||
|
|
|
|||
|
|
@ -2935,6 +2935,7 @@ bool DivEngine::loadMod(unsigned char* file, size_t len) {
|
|||
size_t pos=reader.tell();
|
||||
logD("reading sample data...");
|
||||
for (int i=0; i<insCount; i++) {
|
||||
logV("- %d: %d %d %d",i,pos,ds.sample[i]->samples,sampLens[i]);
|
||||
if (!reader.seek(pos,SEEK_SET)) {
|
||||
logD("%d: couldn't seek to %d",i,pos);
|
||||
throw EndOfFileException(&reader,reader.tell());
|
||||
|
|
@ -2944,6 +2945,7 @@ bool DivEngine::loadMod(unsigned char* file, size_t len) {
|
|||
}
|
||||
|
||||
// convert effects
|
||||
logD("converting module...");
|
||||
for (int ch=0; ch<=chCount; ch++) {
|
||||
unsigned char fxCols=1;
|
||||
for (int pat=0; pat<=patMax; pat++) {
|
||||
|
|
|
|||
|
|
@ -411,6 +411,7 @@ void DivPlatformAmiga::tick(bool sysTick) {
|
|||
if (chan[i].keyOn) {
|
||||
rWrite(0x96,1<<i);
|
||||
if (chan[i].useWave) {
|
||||
rWrite(0x9a,(128<<i));
|
||||
chWrite(i,0,0);
|
||||
chWrite(i,2,i<<8);
|
||||
chWrite(i,4,chan[i].audLen);
|
||||
|
|
@ -500,6 +501,7 @@ int DivPlatformAmiga::dispatch(DivCommand c) {
|
|||
case DIV_CMD_NOTE_ON: {
|
||||
DivInstrument* ins=parent->getIns(chan[c.chan].ins,DIV_INS_AMIGA);
|
||||
if (ins->amiga.useWave) {
|
||||
if (!chan[c.chan].useWave) chan[c.chan].updateWave=true;
|
||||
chan[c.chan].useWave=true;
|
||||
chan[c.chan].audLen=(ins->amiga.waveLen+1)>>1;
|
||||
if (chan[c.chan].insChanged) {
|
||||
|
|
|
|||
|
|
@ -181,6 +181,16 @@ struct DivSubSong {
|
|||
}
|
||||
};
|
||||
|
||||
struct DivAssetDir {
|
||||
String name;
|
||||
std::vector<int> entries;
|
||||
|
||||
DivAssetDir():
|
||||
name("New Directory") {}
|
||||
DivAssetDir(String n):
|
||||
name(n) {}
|
||||
};
|
||||
|
||||
struct DivSong {
|
||||
// version number used for saving the song.
|
||||
// Furnace will save using the latest possible version,
|
||||
|
|
@ -351,6 +361,10 @@ struct DivSong {
|
|||
std::vector<unsigned int> patchbay;
|
||||
std::vector<DivGroovePattern> grooves;
|
||||
|
||||
std::vector<DivAssetDir> insDir;
|
||||
std::vector<DivAssetDir> waveDir;
|
||||
std::vector<DivAssetDir> sampleDir;
|
||||
|
||||
DivInstrument nullIns, nullInsOPLL, nullInsOPL, nullInsOPLDrums, nullInsQSound;
|
||||
DivWavetable nullWave;
|
||||
DivSample nullSample;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue