Change YMZ ADPCM type back to 3

Also fix some other mistakes
This commit is contained in:
Natt Akuma 2022-05-19 12:39:38 +07:00
parent 4551c55818
commit b70ea9af57
6 changed files with 15 additions and 15 deletions

View file

@ -136,7 +136,7 @@ void DivPlatformYMZ280B::tick(bool sysTick) {
DivSample* s=parent->getSample(chan[i].sample); DivSample* s=parent->getSample(chan[i].sample);
unsigned char ctrl; unsigned char ctrl;
switch (s->depth) { switch (s->depth) {
case 2: ctrl=0x20; break; case 3: ctrl=0x20; break;
case 8: ctrl=0x40; break; case 8: ctrl=0x40; break;
case 16: ctrl=0x60; break; case 16: ctrl=0x60; break;
default: ctrl=0; default: ctrl=0;
@ -146,7 +146,7 @@ void DivPlatformYMZ280B::tick(bool sysTick) {
if (chan[i].freq<0) chan[i].freq=0; if (chan[i].freq<0) chan[i].freq=0;
if (chan[i].freq>511) chan[i].freq=511; if (chan[i].freq>511) chan[i].freq=511;
// ADPCM has half the range // ADPCM has half the range
if (s->depth==2 && chan[i].freq>255) chan[i].freq=255; if (s->depth==3 && chan[i].freq>255) chan[i].freq=255;
ctrl|=(chan[i].active?0x80:0)|((s->loopStart>=0)?0x10:0)|(chan[i].freq>>8); ctrl|=(chan[i].active?0x80:0)|((s->loopStart>=0)?0x10:0)|(chan[i].freq>>8);
if (chan[i].keyOn) { if (chan[i].keyOn) {
unsigned int start=s->offYMZ280B; unsigned int start=s->offYMZ280B;
@ -154,14 +154,14 @@ void DivPlatformYMZ280B::tick(bool sysTick) {
unsigned int end=start+s->getCurBufLen(); unsigned int end=start+s->getCurBufLen();
if (chan[i].audPos>0) { if (chan[i].audPos>0) {
switch (s->depth) { switch (s->depth) {
case 2: start+=chan[i].audPos/2; break; case 3: start+=chan[i].audPos/2; break;
case 8: start+=chan[i].audPos; break; case 8: start+=chan[i].audPos; break;
case 16: start+=chan[i].audPos*2; break; case 16: start+=chan[i].audPos*2; break;
} }
} }
if (s->loopStart>=0) { if (s->loopStart>=0) {
switch (s->depth) { switch (s->depth) {
case 2: loop=start+s->loopStart/2; break; case 3: loop=start+s->loopStart/2; break;
case 8: loop=start+s->loopStart; break; case 8: loop=start+s->loopStart; break;
case 16: loop=start+s->loopStart*2; break; case 16: loop=start+s->loopStart*2; break;
} }

View file

@ -18,7 +18,7 @@
*/ */
#ifndef _YMZ280B_H #ifndef _YMZ280B_H
#define _QSOUND_H #define _YMZ280B_H
#include "../dispatch.h" #include "../dispatch.h"
#include <queue> #include <queue>

View file

@ -93,7 +93,7 @@ bool DivSample::initInternal(unsigned char d, int count) {
dataDPCM=new unsigned char[lengthDPCM]; dataDPCM=new unsigned char[lengthDPCM];
memset(dataDPCM,0,lengthDPCM); memset(dataDPCM,0,lengthDPCM);
break; break;
case 2: // YMZ ADPCM case 3: // YMZ ADPCM
if (dataZ!=NULL) delete[] dataZ; if (dataZ!=NULL) delete[] dataZ;
lengthZ=(count+1)/2; lengthZ=(count+1)/2;
// for padding AICA sample // for padding AICA sample
@ -664,7 +664,7 @@ void DivSample::render() {
} }
break; break;
} }
case 2: // YMZ ADPCM case 3: // YMZ ADPCM
ymz_decode(dataZ,data16,samples); ymz_decode(dataZ,data16,samples);
break; break;
case 4: // QSound ADPCM case 4: // QSound ADPCM
@ -719,8 +719,8 @@ void DivSample::render() {
if (accum>127) accum=127; if (accum>127) accum=127;
} }
} }
if (depth!=2) { // YMZ ADPCM if (depth!=3) { // YMZ ADPCM
if (!initInternal(2,samples)) return; if (!initInternal(3,samples)) return;
ymz_encode(data16,dataZ,(samples+7)&(~0x7)); ymz_encode(data16,dataZ,(samples+7)&(~0x7));
} }
if (depth!=4) { // QSound ADPCM if (depth!=4) { // QSound ADPCM
@ -759,7 +759,7 @@ void* DivSample::getCurBuf() {
return data1; return data1;
case 1: case 1:
return dataDPCM; return dataDPCM;
case 2: case 3:
return dataZ; return dataZ;
case 4: case 4:
return dataQSoundA; return dataQSoundA;
@ -787,7 +787,7 @@ unsigned int DivSample::getCurBufLen() {
return length1; return length1;
case 1: case 1:
return lengthDPCM; return lengthDPCM;
case 2: case 3:
return lengthZ; return lengthZ;
case 4: case 4:
return lengthQSoundA; return lengthQSoundA;

View file

@ -62,7 +62,7 @@ struct DivSample {
// valid values are: // valid values are:
// - 0: ZX Spectrum overlay drum (1-bit) // - 0: ZX Spectrum overlay drum (1-bit)
// - 1: 1-bit NES DPCM (1-bit) // - 1: 1-bit NES DPCM (1-bit)
// - 2: YMZ ADPCM // - 3: YMZ ADPCM
// - 4: QSound ADPCM // - 4: QSound ADPCM
// - 5: ADPCM-A // - 5: ADPCM-A
// - 6: ADPCM-B // - 6: ADPCM-B
@ -78,7 +78,7 @@ struct DivSample {
short* data16; // 16 short* data16; // 16
unsigned char* data1; // 0 unsigned char* data1; // 0
unsigned char* dataDPCM; // 1 unsigned char* dataDPCM; // 1
unsigned char* dataZ; // 2 unsigned char* dataZ; // 3
unsigned char* dataQSoundA; // 4 unsigned char* dataQSoundA; // 4
unsigned char* dataA; // 5 unsigned char* dataA; // 5
unsigned char* dataB; // 6 unsigned char* dataB; // 6

View file

@ -1885,7 +1885,7 @@ void DivEngine::registerSystems() {
sysDefs[DIV_SYSTEM_YMZ280B]=new DivSysDef( sysDefs[DIV_SYSTEM_YMZ280B]=new DivSysDef(
"Yamaha YMZ280B", NULL, 0xb8, 0, 8, false, true, 0x151, false, "Yamaha YMZ280B", NULL, 0xb8, 0, 8, false, true, 0x151, false,
"used in some arcade boards. Has 8 channels of either 4-bit ADPCM, 8-bit PCM or 16-bit PCM.", "used in some arcade boards. Can play back either 4-bit ADPCM, 8-bit PCM or 16-bit PCM.",
{"PCM 1", "PCM 2", "PCM 3", "PCM 4", "PCM 5", "PCM 6", "PCM 7", "PCM 8"}, {"PCM 1", "PCM 2", "PCM 3", "PCM 4", "PCM 5", "PCM 6", "PCM 7", "PCM 8"},
{"1", "2", "3", "4", "5", "6", "7", "8"}, {"1", "2", "3", "4", "5", "6", "7", "8"},
{DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM}, {DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM, DIV_CH_PCM},

View file

@ -116,8 +116,8 @@ const char* insTypes[DIV_INS_MAX]={
const char* sampleDepths[17]={ const char* sampleDepths[17]={
"1-bit PCM", "1-bit PCM",
"1-bit DPCM", "1-bit DPCM",
"YMZ/YMU/AICA ADPCM",
NULL, NULL,
"YMZ/YMU/AICA ADPCM",
"QSound ADPCM", "QSound ADPCM",
"ADPCM-A", "ADPCM-A",
"ADPCM-B", "ADPCM-B",