chip sample selection, part 3
This commit is contained in:
parent
3ba87562ea
commit
3a9349d49a
|
@ -532,6 +532,13 @@ class DivDispatch {
|
||||||
*/
|
*/
|
||||||
virtual size_t getSampleMemCapacity(int index = 0);
|
virtual size_t getSampleMemCapacity(int index = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get sample memory name.
|
||||||
|
* @param index the memory index.
|
||||||
|
* @return a name, or NULL if it doesn't have any name in particular.
|
||||||
|
*/
|
||||||
|
virtual const char* getSampleMemName(int index=0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get sample memory usage.
|
* Get sample memory usage.
|
||||||
* @param index the memory index.
|
* @param index the memory index.
|
||||||
|
|
|
@ -152,11 +152,16 @@ size_t DivDispatch::getSampleMemCapacity(int index) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* DivDispatch::getSampleMemName(int index) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
size_t DivDispatch::getSampleMemUsage(int index) {
|
size_t DivDispatch::getSampleMemUsage(int index) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivDispatch::isSampleLoaded(int index, int sample) {
|
bool DivDispatch::isSampleLoaded(int index, int sample) {
|
||||||
|
printf("you are calling.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -370,6 +370,7 @@ bool DivPlatformMSM6258::isSampleLoaded(int index, int sample) {
|
||||||
|
|
||||||
void DivPlatformMSM6258::renderSamples() {
|
void DivPlatformMSM6258::renderSamples() {
|
||||||
memset(adpcmMem,0,getSampleMemCapacity(0));
|
memset(adpcmMem,0,getSampleMemCapacity(0));
|
||||||
|
memset(sampleLoaded,0,256*sizeof(bool));
|
||||||
|
|
||||||
// sample data
|
// sample data
|
||||||
size_t memPos=0;
|
size_t memPos=0;
|
||||||
|
@ -387,6 +388,7 @@ void DivPlatformMSM6258::renderSamples() {
|
||||||
logW("out of ADPCM memory for sample %d!",i);
|
logW("out of ADPCM memory for sample %d!",i);
|
||||||
} else {
|
} else {
|
||||||
memcpy(adpcmMem+memPos,s->dataVOX,paddedLen);
|
memcpy(adpcmMem+memPos,s->dataVOX,paddedLen);
|
||||||
|
sampleLoaded[i]=true;
|
||||||
}
|
}
|
||||||
memPos+=paddedLen;
|
memPos+=paddedLen;
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,6 +346,7 @@ void DivPlatformMSM6295::renderSamples() {
|
||||||
|
|
||||||
memset(adpcmMem,0,getSampleMemCapacity(0));
|
memset(adpcmMem,0,getSampleMemCapacity(0));
|
||||||
memset(sampleOffVOX,0,256*sizeof(unsigned int));
|
memset(sampleOffVOX,0,256*sizeof(unsigned int));
|
||||||
|
memset(sampleLoaded,0,256*sizeof(bool));
|
||||||
|
|
||||||
// sample data
|
// sample data
|
||||||
size_t memPos=128*8;
|
size_t memPos=128*8;
|
||||||
|
@ -363,6 +364,7 @@ void DivPlatformMSM6295::renderSamples() {
|
||||||
logW("out of ADPCM memory for sample %d!",i);
|
logW("out of ADPCM memory for sample %d!",i);
|
||||||
} else {
|
} else {
|
||||||
memcpy(adpcmMem+memPos,s->dataVOX,paddedLen);
|
memcpy(adpcmMem+memPos,s->dataVOX,paddedLen);
|
||||||
|
sampleLoaded[i]=true;
|
||||||
}
|
}
|
||||||
sampleOffVOX[i]=memPos;
|
sampleOffVOX[i]=memPos;
|
||||||
memPos+=paddedLen;
|
memPos+=paddedLen;
|
||||||
|
|
|
@ -728,7 +728,8 @@ bool DivPlatformNES::isSampleLoaded(int index, int sample) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformNES::renderSamples() {
|
void DivPlatformNES::renderSamples() {
|
||||||
memset(dpcmMem,0,getSampleMemCapacity(0));
|
memset(dpcmMem,0,getSampleMemCapacity(0));\
|
||||||
|
memset(sampleLoaded,0,256*sizeof(bool));
|
||||||
|
|
||||||
size_t memPos=0;
|
size_t memPos=0;
|
||||||
for (int i=0; i<parent->song.sampleLen; i++) {
|
for (int i=0; i<parent->song.sampleLen; i++) {
|
||||||
|
@ -750,6 +751,7 @@ void DivPlatformNES::renderSamples() {
|
||||||
logW("out of DPCM memory for sample %d!",i);
|
logW("out of DPCM memory for sample %d!",i);
|
||||||
} else {
|
} else {
|
||||||
memcpy(dpcmMem+memPos,s->dataDPCM,MIN(s->lengthDPCM,paddedLen));
|
memcpy(dpcmMem+memPos,s->dataDPCM,MIN(s->lengthDPCM,paddedLen));
|
||||||
|
sampleLoaded[i]=true;
|
||||||
}
|
}
|
||||||
sampleOffDPCM[i]=memPos;
|
sampleOffDPCM[i]=memPos;
|
||||||
memPos+=paddedLen;
|
memPos+=paddedLen;
|
||||||
|
|
|
@ -1767,6 +1767,7 @@ void DivPlatformOPL::renderSamples() {
|
||||||
if (adpcmChan<0) return;
|
if (adpcmChan<0) return;
|
||||||
memset(adpcmBMem,0,getSampleMemCapacity(0));
|
memset(adpcmBMem,0,getSampleMemCapacity(0));
|
||||||
memset(sampleOffB,0,256*sizeof(unsigned int));
|
memset(sampleOffB,0,256*sizeof(unsigned int));
|
||||||
|
memset(sampleLoaded,0,256*sizeof(bool));
|
||||||
|
|
||||||
size_t memPos=0;
|
size_t memPos=0;
|
||||||
for (int i=0; i<parent->song.sampleLen; i++) {
|
for (int i=0; i<parent->song.sampleLen; i++) {
|
||||||
|
@ -1784,6 +1785,7 @@ void DivPlatformOPL::renderSamples() {
|
||||||
logW("out of ADPCM memory for sample %d!",i);
|
logW("out of ADPCM memory for sample %d!",i);
|
||||||
} else {
|
} else {
|
||||||
memcpy(adpcmBMem+memPos,s->dataB,paddedLen);
|
memcpy(adpcmBMem+memPos,s->dataB,paddedLen);
|
||||||
|
sampleLoaded[i]=true;
|
||||||
}
|
}
|
||||||
sampleOffB[i]=memPos;
|
sampleOffB[i]=memPos;
|
||||||
memPos+=paddedLen;
|
memPos+=paddedLen;
|
||||||
|
|
|
@ -653,6 +653,7 @@ bool DivPlatformQSound::isSampleLoaded(int index, int sample) {
|
||||||
// TODO: ADPCM... come on...
|
// TODO: ADPCM... come on...
|
||||||
void DivPlatformQSound::renderSamples() {
|
void DivPlatformQSound::renderSamples() {
|
||||||
memset(sampleMem,0,getSampleMemCapacity());
|
memset(sampleMem,0,getSampleMemCapacity());
|
||||||
|
memset(sampleLoaded,0,256*sizeof(bool));
|
||||||
|
|
||||||
size_t memPos=0;
|
size_t memPos=0;
|
||||||
for (int i=0; i<parent->song.sampleLen; i++) {
|
for (int i=0; i<parent->song.sampleLen; i++) {
|
||||||
|
@ -677,6 +678,7 @@ void DivPlatformQSound::renderSamples() {
|
||||||
for (int i=0; i<length; i++) {
|
for (int i=0; i<length; i++) {
|
||||||
sampleMem[(memPos+i)^0x8000]=s->data8[i];
|
sampleMem[(memPos+i)^0x8000]=s->data8[i];
|
||||||
}
|
}
|
||||||
|
sampleLoaded[i]=true;
|
||||||
}
|
}
|
||||||
offPCM[i]=memPos^0x8000;
|
offPCM[i]=memPos^0x8000;
|
||||||
memPos+=length+16;
|
memPos+=length+16;
|
||||||
|
|
|
@ -394,6 +394,7 @@ bool DivPlatformRF5C68::isSampleLoaded(int index, int sample) {
|
||||||
void DivPlatformRF5C68::renderSamples() {
|
void DivPlatformRF5C68::renderSamples() {
|
||||||
memset(sampleMem,0,getSampleMemCapacity());
|
memset(sampleMem,0,getSampleMemCapacity());
|
||||||
memset(sampleOffRFC,0,256*sizeof(unsigned int));
|
memset(sampleOffRFC,0,256*sizeof(unsigned int));
|
||||||
|
memset(sampleLoaded,0,256*sizeof(bool));
|
||||||
|
|
||||||
size_t memPos=0;
|
size_t memPos=0;
|
||||||
for (int i=0; i<parent->song.sampleLen; i++) {
|
for (int i=0; i<parent->song.sampleLen; i++) {
|
||||||
|
@ -418,6 +419,7 @@ void DivPlatformRF5C68::renderSamples() {
|
||||||
}
|
}
|
||||||
// align memPos to 256-byte boundary
|
// align memPos to 256-byte boundary
|
||||||
memPos=(memPos+0xff)&~0xff;
|
memPos=(memPos+0xff)&~0xff;
|
||||||
|
sampleLoaded[i]=true;
|
||||||
}
|
}
|
||||||
sampleMemLen=memPos;
|
sampleMemLen=memPos;
|
||||||
}
|
}
|
||||||
|
|
|
@ -806,6 +806,7 @@ bool DivPlatformSNES::isSampleLoaded(int index, int sample) {
|
||||||
void DivPlatformSNES::renderSamples() {
|
void DivPlatformSNES::renderSamples() {
|
||||||
memset(copyOfSampleMem,0,getSampleMemCapacity());
|
memset(copyOfSampleMem,0,getSampleMemCapacity());
|
||||||
memset(sampleOff,0,256*sizeof(unsigned int));
|
memset(sampleOff,0,256*sizeof(unsigned int));
|
||||||
|
memset(sampleLoaded,0,256*sizeof(bool));
|
||||||
|
|
||||||
// skip past sample table and wavetable buffer
|
// skip past sample table and wavetable buffer
|
||||||
size_t memPos=sampleTableBase+8*4+8*9*16;
|
size_t memPos=sampleTableBase+8*4+8*9*16;
|
||||||
|
@ -828,6 +829,7 @@ void DivPlatformSNES::renderSamples() {
|
||||||
logW("out of BRR memory for sample %d!",i);
|
logW("out of BRR memory for sample %d!",i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
sampleLoaded[i]=true;
|
||||||
}
|
}
|
||||||
sampleMemLen=memPos;
|
sampleMemLen=memPos;
|
||||||
memcpy(sampleMem,copyOfSampleMem,65536);
|
memcpy(sampleMem,copyOfSampleMem,65536);
|
||||||
|
|
|
@ -556,6 +556,7 @@ bool DivPlatformSoundUnit::isSampleLoaded(int index, int sample) {
|
||||||
void DivPlatformSoundUnit::renderSamples() {
|
void DivPlatformSoundUnit::renderSamples() {
|
||||||
memset(su->pcm,0,getSampleMemCapacity(0));
|
memset(su->pcm,0,getSampleMemCapacity(0));
|
||||||
memset(sampleOffSU,0,256*sizeof(unsigned int));
|
memset(sampleOffSU,0,256*sizeof(unsigned int));
|
||||||
|
memset(sampleLoaded,0,256*sizeof(bool));
|
||||||
|
|
||||||
size_t memPos=0;
|
size_t memPos=0;
|
||||||
for (int i=0; i<parent->song.sampleLen; i++) {
|
for (int i=0; i<parent->song.sampleLen; i++) {
|
||||||
|
@ -571,6 +572,7 @@ void DivPlatformSoundUnit::renderSamples() {
|
||||||
logW("out of PCM memory for sample %d!",i);
|
logW("out of PCM memory for sample %d!",i);
|
||||||
} else {
|
} else {
|
||||||
memcpy(su->pcm+memPos,s->data8,paddedLen);
|
memcpy(su->pcm+memPos,s->data8,paddedLen);
|
||||||
|
sampleLoaded[i]=true;
|
||||||
}
|
}
|
||||||
sampleOffSU[i]=memPos;
|
sampleOffSU[i]=memPos;
|
||||||
memPos+=paddedLen;
|
memPos+=paddedLen;
|
||||||
|
|
|
@ -958,6 +958,7 @@ bool DivPlatformX1_010::isSampleLoaded(int index, int sample) {
|
||||||
void DivPlatformX1_010::renderSamples() {
|
void DivPlatformX1_010::renderSamples() {
|
||||||
memset(sampleMem,0,getSampleMemCapacity());
|
memset(sampleMem,0,getSampleMemCapacity());
|
||||||
memset(sampleOffX1,0,256*sizeof(unsigned int));
|
memset(sampleOffX1,0,256*sizeof(unsigned int));
|
||||||
|
memset(sampleLoaded,0,256*sizeof(bool));
|
||||||
|
|
||||||
size_t memPos=0;
|
size_t memPos=0;
|
||||||
for (int i=0; i<parent->song.sampleLen; i++) {
|
for (int i=0; i<parent->song.sampleLen; i++) {
|
||||||
|
@ -981,6 +982,7 @@ void DivPlatformX1_010::renderSamples() {
|
||||||
logW("out of X1-010 memory for sample %d!",i);
|
logW("out of X1-010 memory for sample %d!",i);
|
||||||
} else {
|
} else {
|
||||||
memcpy(sampleMem+memPos,s->data8,paddedLen);
|
memcpy(sampleMem+memPos,s->data8,paddedLen);
|
||||||
|
sampleLoaded[i]=true;
|
||||||
}
|
}
|
||||||
sampleOffX1[i]=memPos;
|
sampleOffX1[i]=memPos;
|
||||||
memPos+=paddedLen;
|
memPos+=paddedLen;
|
||||||
|
|
|
@ -1345,6 +1345,7 @@ bool DivPlatformYM2608::isSampleLoaded(int index, int sample) {
|
||||||
void DivPlatformYM2608::renderSamples() {
|
void DivPlatformYM2608::renderSamples() {
|
||||||
memset(adpcmBMem,0,getSampleMemCapacity(0));
|
memset(adpcmBMem,0,getSampleMemCapacity(0));
|
||||||
memset(sampleOffB,0,256*sizeof(unsigned int));
|
memset(sampleOffB,0,256*sizeof(unsigned int));
|
||||||
|
memset(sampleLoaded,0,256*sizeof(bool));
|
||||||
|
|
||||||
size_t memPos=0;
|
size_t memPos=0;
|
||||||
for (int i=0; i<parent->song.sampleLen; i++) {
|
for (int i=0; i<parent->song.sampleLen; i++) {
|
||||||
|
@ -1362,6 +1363,7 @@ void DivPlatformYM2608::renderSamples() {
|
||||||
logW("out of ADPCM memory for sample %d!",i);
|
logW("out of ADPCM memory for sample %d!",i);
|
||||||
} else {
|
} else {
|
||||||
memcpy(adpcmBMem+memPos,s->dataB,paddedLen);
|
memcpy(adpcmBMem+memPos,s->dataB,paddedLen);
|
||||||
|
sampleLoaded[i]=true;
|
||||||
}
|
}
|
||||||
sampleOffB[i]=memPos;
|
sampleOffB[i]=memPos;
|
||||||
memPos+=paddedLen;
|
memPos+=paddedLen;
|
||||||
|
|
|
@ -206,6 +206,10 @@ template<int ChanNum> class DivPlatformYM2610Base: public DivPlatformOPN {
|
||||||
return index == 0 ? 16777216 : index == 1 ? 16777216 : 0;
|
return index == 0 ? 16777216 : index == 1 ? 16777216 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* getSampleMemName(int index=0) {
|
||||||
|
return index == 0 ? "ADPCM-A" : index == 1 ? "ADPCM-B" : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
size_t getSampleMemUsage(int index) {
|
size_t getSampleMemUsage(int index) {
|
||||||
return index == 0 ? adpcmAMemLen : index == 1 ? adpcmBMemLen : 0;
|
return index == 0 ? adpcmAMemLen : index == 1 ? adpcmBMemLen : 0;
|
||||||
}
|
}
|
||||||
|
@ -238,9 +242,9 @@ template<int ChanNum> class DivPlatformYM2610Base: public DivPlatformOPN {
|
||||||
logW("out of ADPCM-A memory for sample %d!",i);
|
logW("out of ADPCM-A memory for sample %d!",i);
|
||||||
} else {
|
} else {
|
||||||
memcpy(adpcmAMem+memPos,s->dataA,paddedLen);
|
memcpy(adpcmAMem+memPos,s->dataA,paddedLen);
|
||||||
|
sampleLoaded[0][i]=true;
|
||||||
}
|
}
|
||||||
sampleOffA[i]=memPos;
|
sampleOffA[i]=memPos;
|
||||||
sampleLoaded[0][i]=true;
|
|
||||||
memPos+=paddedLen;
|
memPos+=paddedLen;
|
||||||
}
|
}
|
||||||
adpcmAMemLen=memPos+256;
|
adpcmAMemLen=memPos+256;
|
||||||
|
@ -263,9 +267,9 @@ template<int ChanNum> class DivPlatformYM2610Base: public DivPlatformOPN {
|
||||||
logW("out of ADPCM-B memory for sample %d!",i);
|
logW("out of ADPCM-B memory for sample %d!",i);
|
||||||
} else {
|
} else {
|
||||||
memcpy(adpcmBMem+memPos,s->dataB,paddedLen);
|
memcpy(adpcmBMem+memPos,s->dataB,paddedLen);
|
||||||
|
sampleLoaded[1][i]=true;
|
||||||
}
|
}
|
||||||
sampleOffB[i]=memPos;
|
sampleOffB[i]=memPos;
|
||||||
sampleLoaded[1][i]=true;
|
|
||||||
memPos+=paddedLen;
|
memPos+=paddedLen;
|
||||||
}
|
}
|
||||||
adpcmBMemLen=memPos+256;
|
adpcmBMemLen=memPos+256;
|
||||||
|
|
|
@ -429,6 +429,7 @@ bool DivPlatformYMZ280B::isSampleLoaded(int index, int sample) {
|
||||||
void DivPlatformYMZ280B::renderSamples() {
|
void DivPlatformYMZ280B::renderSamples() {
|
||||||
memset(sampleMem,0,getSampleMemCapacity());
|
memset(sampleMem,0,getSampleMemCapacity());
|
||||||
memset(sampleOff,0,256*sizeof(unsigned int));
|
memset(sampleOff,0,256*sizeof(unsigned int));
|
||||||
|
memset(sampleLoaded,0,256*sizeof(bool));
|
||||||
|
|
||||||
size_t memPos=0;
|
size_t memPos=0;
|
||||||
for (int i=0; i<parent->song.sampleLen; i++) {
|
for (int i=0; i<parent->song.sampleLen; i++) {
|
||||||
|
@ -455,6 +456,7 @@ void DivPlatformYMZ280B::renderSamples() {
|
||||||
logW("out of YMZ280B PCM memory for sample %d!",i);
|
logW("out of YMZ280B PCM memory for sample %d!",i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
sampleLoaded[i]=true;
|
||||||
}
|
}
|
||||||
sampleMemLen=memPos;
|
sampleMemLen=memPos;
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,6 +281,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
memset(isChipVisible,0,32*sizeof(bool));
|
memset(isChipVisible,0,32*sizeof(bool));
|
||||||
memset(isTypeVisible,0,4*sizeof(bool));
|
memset(isTypeVisible,0,4*sizeof(bool));
|
||||||
memset(isMemVisible,0,32*4*sizeof(bool));
|
memset(isMemVisible,0,32*4*sizeof(bool));
|
||||||
|
memset(isMemWarning,0,32*4*sizeof(bool));
|
||||||
for (int i=0; i<e->song.systemLen; i++) {
|
for (int i=0; i<e->song.systemLen; i++) {
|
||||||
DivDispatch* dispatch=e->getDispatch(i);
|
DivDispatch* dispatch=e->getDispatch(i);
|
||||||
if (dispatch==NULL) continue;
|
if (dispatch==NULL) continue;
|
||||||
|
@ -300,7 +301,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
if (selColumns<=1) {
|
if (selColumns<=1) {
|
||||||
ImGui::Text("NO CHIPS LESS GOOO");
|
ImGui::Text("NO CHIPS LESS GOOO");
|
||||||
} else {
|
} else {
|
||||||
if (ImGui::BeginTable("SEChipSel",selColumns,ImGuiTableFlags_SizingFixedSame|ImGuiTableFlags_ScrollX)) {
|
if (ImGui::BeginTable("SEChipSel",selColumns,ImGuiTableFlags_SizingFixedSame)) {
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
for (int i=0; i<e->song.systemLen; i++) {
|
for (int i=0; i<e->song.systemLen; i++) {
|
||||||
|
@ -356,6 +357,34 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PopStyleColor(4);
|
ImGui::PopStyleColor(4);
|
||||||
|
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
const char* memName=NULL;
|
||||||
|
size_t capacity=0;
|
||||||
|
size_t usage=0;
|
||||||
|
int totalFree=0;
|
||||||
|
DivDispatch* dispatch=e->getDispatch(j);
|
||||||
|
if (dispatch!=NULL) {
|
||||||
|
memName=dispatch->getSampleMemName(i);
|
||||||
|
capacity=dispatch->getSampleMemCapacity(i);
|
||||||
|
usage=dispatch->getSampleMemUsage(i);
|
||||||
|
if (usage<capacity) {
|
||||||
|
totalFree=capacity-usage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String toolText;
|
||||||
|
if (memName==NULL) {
|
||||||
|
toolText=fmt::sprintf("%s\n%d bytes free",e->getSystemName(e->song.system[j]),totalFree);
|
||||||
|
} else {
|
||||||
|
toolText=fmt::sprintf("%s (%s)\n%d bytes free",e->getSystemName(e->song.system[j]),memName,totalFree);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isMemWarning[i][j]) {
|
||||||
|
toolText+="\n\nnot enough memory for this sample!";
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SetTooltip("%s",toolText.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
|
|
Loading…
Reference in New Issue