diff --git a/papers/format.md b/papers/format.md index d26ca41d..bef8b1f8 100644 --- a/papers/format.md +++ b/papers/format.md @@ -236,6 +236,7 @@ size | description | - 0xbd: YM2612 extra features extended - 11 channels | - 0xbe: YM2612 extra features - 7 channels | - 0xbf: T6W28 - 4 channels + | - 0xc0: PCM DAC - 1 channel | - 0xde: YM2610B extended - 19 channels | - 0xe0: QSound - 19 channels | - 0xfd: Dummy System - 8 channels diff --git a/src/engine/song.h b/src/engine/song.h index 2248292e..d06c5737 100644 --- a/src/engine/song.h +++ b/src/engine/song.h @@ -114,6 +114,8 @@ enum DivSystem { DIV_SYSTEM_YM2612_FRAC, DIV_SYSTEM_YM2612_FRAC_EXT, DIV_SYSTEM_RESERVED_8, + DIV_SYSTEM_T6W28, + DIV_SYSTEM_PCM_DAC, DIV_SYSTEM_DUMMY }; diff --git a/src/engine/sysDef.cpp b/src/engine/sysDef.cpp index e5a4888b..04815866 100644 --- a/src/engine/sysDef.cpp +++ b/src/engine/sysDef.cpp @@ -2082,6 +2082,35 @@ void DivEngine::registerSystems() { fmPostEffectHandler ); + sysDefs[DIV_SYSTEM_T6W28]=new DivSysDef( + "T6W28", NULL, 0xbf, 0, 4, false, true, 0, false, + "an SN76489 derivative used in Neo Geo Pocket, has independent stereo volume and noise channel frequency.", + {"Square 1", "Square 2", "Square 3", "Noise"}, + {"S1", "S2", "S3", "NO"}, + {DIV_CH_PULSE, DIV_CH_PULSE, DIV_CH_PULSE, DIV_CH_NOISE}, + {DIV_INS_STD, DIV_INS_STD, DIV_INS_STD, DIV_INS_STD}, + {}, + [this](int ch, unsigned char effect, unsigned char effectVal) -> bool { + switch (effect) { + case 0x20: // SN noise mode + dispatchCmd(DivCommand(DIV_CMD_STD_NOISE_MODE,ch,effectVal)); + break; + default: + return false; + } + return true; + } + ); + + sysDefs[DIV_SYSTEM_PCM_DAC]=new DivSysDef( + "Generic PCM DAC", NULL, 0xc0, 0, 1, false, true, 0, false, + "as generic sample playback as it gets.", + {"Sample"}, + {"PCM"}, + {DIV_CH_PCM}, + {DIV_INS_AMIGA} + ); + sysDefs[DIV_SYSTEM_DUMMY]=new DivSysDef( "Dummy System", NULL, 0xfd, 0, 8, false, true, 0, false, "this is a system designed for testing purposes.", diff --git a/src/gui/sysConf.cpp b/src/gui/sysConf.cpp index 21fef35d..b34dd0b2 100644 --- a/src/gui/sysConf.cpp +++ b/src/gui/sysConf.cpp @@ -608,12 +608,34 @@ void FurnaceGUI::drawSysConf(int chan, DivSystem type, unsigned int& flags, bool } break; } + case DIV_SYSTEM_PCM_DAC: { + int sampRate=(flags&65535)+1; + int bitDepth=((flags>>16)&15)+1; + bool stereo=(flags>>20)&1; + ImGui::Text("Output rate:"); + if (CWSliderInt("##SampRate",&sampRate,1,65536)) { + if (sampRate<1) sampRate=1; + if (sampRate>65536) sampRate=65536; + copyOfFlags=(flags&(~65535))|(sampRate-1); + } rightClickable + ImGui::Text("Output depth:"); + if (CWSliderInt("##BitDepth",&bitDepth,1,16)) { + if (bitDepth<1) bitDepth=1; + if (bitDepth>16) bitDepth=16; + copyOfFlags=(flags&(~(15<<16)))|((bitDepth-1)<<16); + } rightClickable + if (ImGui::Checkbox("Stereo",&stereo)) { + copyOfFlags=(flags&(~(1<<20)))|(stereo<<20); + } + break; + } case DIV_SYSTEM_GB: case DIV_SYSTEM_SWAN: case DIV_SYSTEM_VERA: case DIV_SYSTEM_BUBSYS_WSG: case DIV_SYSTEM_YMU759: case DIV_SYSTEM_PET: + case DIV_SYSTEM_T6W28: ImGui::Text("nothing to configure"); break; default: