Merge branch 'master' of https://github.com/tildearrow/furnace into es5506_alt

* 'master' of https://github.com/tildearrow/furnace: (26 commits)
  prepare for #38
  NES: DPCM work!
  fix bug caused by new renderSamples approach
  NES: prepare for DPCM
  OPZ: more fixed frequency mode fixes
  OPZ: possibly fix fixed freq emulation
  OPZ: fix muting
  OPL: fix panning
  damn it
  per-channel oscilloscope, part 10
  NES: NSFPlay per-channel osc
  NES: NSFPlay muting
  NES: now fix tri_mute
  NES: finally
  fix typo in playback engine
  NES: wire up NSFplay
  now fix it damn it
  now move these files
  add readme
  convertir de Shift-JIS a UTF-8
  ...

# Conflicts:
#	src/engine/engine.cpp
#	src/engine/engine.h
#	src/engine/platform/nes.cpp
#	src/engine/vgmOps.cpp
#	src/gui/stats.cpp
This commit is contained in:
cam900 2022-05-03 11:07:50 +09:00
commit e136db6d7a
53 changed files with 3990 additions and 393 deletions

View file

@ -268,8 +268,6 @@ const char* DivPlatformQSound::getEffectName(unsigned char effect) {
return NULL;
}
void DivPlatformQSound::acquire(short* bufL, short* bufR, size_t start, size_t len) {
chip.rom_data = parent->qsoundMem;
chip.rom_mask = 0xffffff;
for (size_t h=start; h<start+len; h++) {
qsound_update(&chip);
bufL[h]=chip.out[0];
@ -638,6 +636,51 @@ int DivPlatformQSound::getRegisterPoolDepth() {
return 16;
}
const void* DivPlatformQSound::getSampleMem(int index) {
return index == 0 ? sampleMem : NULL;
}
size_t DivPlatformQSound::getSampleMemCapacity(int index) {
return index == 0 ? 16777216 : 0;
}
size_t DivPlatformQSound::getSampleMemUsage(int index) {
return index == 0 ? sampleMemLen : 0;
}
void DivPlatformQSound::renderSamples() {
memset(sampleMem,0,getSampleMemCapacity());
size_t memPos=0;
for (int i=0; i<parent->song.sampleLen; i++) {
DivSample* s=parent->song.sample[i];
int length=s->length8;
if (length>65536-16) {
length=65536-16;
}
if ((memPos&0xff0000)!=((memPos+length)&0xff0000)) {
memPos=(memPos+0xffff)&0xff0000;
}
if (memPos>=getSampleMemCapacity()) {
logW("out of QSound PCM memory for sample %d!",i);
break;
}
if (memPos+length>=getSampleMemCapacity()) {
for (unsigned int i=0; i<getSampleMemCapacity()-(memPos+length); i++) {
sampleMem[(memPos+i)^0x8000]=s->data8[i];
}
logW("out of QSound PCM memory for sample %d!",i);
} else {
for (int i=0; i<length; i++) {
sampleMem[(memPos+i)^0x8000]=s->data8[i];
}
}
s->offQSound=memPos^0x8000;
memPos+=length+16;
}
sampleMemLen=memPos+256;
}
int DivPlatformQSound::init(DivEngine* p, int channels, int sugRate, unsigned int flags) {
parent=p;
dumpWrites=false;
@ -651,8 +694,10 @@ int DivPlatformQSound::init(DivEngine* p, int channels, int sugRate, unsigned in
chipClock=60000000;
rate = qsound_start(&chip, chipClock);
chip.rom_data = (unsigned char*)&chip.rom_mask;
chip.rom_mask = 0;
sampleMem=new unsigned char[getSampleMemCapacity()];
sampleMemLen=0;
chip.rom_data=sampleMem;
chip.rom_mask=0xffffff;
reset();
for (int i=0; i<19; i++) {
@ -662,6 +707,7 @@ int DivPlatformQSound::init(DivEngine* p, int channels, int sugRate, unsigned in
}
void DivPlatformQSound::quit() {
delete[] sampleMem;
for (int i=0; i<19; i++) {
delete oscBuf[i];
}