furnace/src/engine/pattern.cpp

37 lines
644 B
C++
Raw Normal View History

2021-12-09 06:44:40 +00:00
#include "engine.h"
static DivPattern emptyPat;
DivPattern::DivPattern() {
memset(data,-1,256*16*sizeof(short));
2021-12-13 22:09:46 +00:00
for (int i=0; i<256; i++) {
data[i][0]=0;
data[i][1]=0;
}
2021-12-09 06:44:40 +00:00
}
DivPattern* DivChannelData::getPattern(int index, bool create) {
if (data[index]==NULL) {
if (create) {
data[index]=new DivPattern;
} else {
return &emptyPat;
}
}
return data[index];
}
2021-12-15 22:32:08 +00:00
void DivChannelData::wipePatterns() {
for (int i=0; i<128; i++) {
if (data[i]!=NULL) {
delete data[i];
data[i]=NULL;
}
}
}
2021-12-13 22:09:46 +00:00
DivChannelData::DivChannelData():
effectRows(1) {
2021-12-09 06:44:40 +00:00
memset(data,0,128*sizeof(void*));
}