From 403799d1a32285eff09ba320c65aa8beee4e37c2 Mon Sep 17 00:00:00 2001 From: Kagamiin~ Date: Fri, 15 Dec 2023 14:20:56 -0300 Subject: [PATCH] Updating sysDef; implementing mapVelocity --- src/engine/platform/esfm.cpp | 7 +++++++ src/engine/platform/esfm.h | 1 + src/engine/sysDef.cpp | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/engine/platform/esfm.cpp b/src/engine/platform/esfm.cpp index 961c84f39..baefa1291 100644 --- a/src/engine/platform/esfm.cpp +++ b/src/engine/platform/esfm.cpp @@ -1019,6 +1019,13 @@ void DivPlatformESFM::notifyInsDeletion(void* ins) { } } +int DivPlatformESFM::mapVelocity(int ch, unsigned char vel) { + const int volMax=MAX(1,dispatch(DivCommand(DIV_CMD_GET_VOLMAX,MAX(ch,0)))); + double attenDb=40*log10(vel/127); + double attenUnits=attenDb*(8.0/6.0); // negative + return MAX(0,volMax+attenUnits); +} + void DivPlatformESFM::poke(unsigned int addr, unsigned short val) { immWrite(addr,val); } diff --git a/src/engine/platform/esfm.h b/src/engine/platform/esfm.h index 698313ad8..8ec29fb8c 100644 --- a/src/engine/platform/esfm.h +++ b/src/engine/platform/esfm.h @@ -136,6 +136,7 @@ class DivPlatformESFM: public DivDispatch { void toggleRegisterDump(bool enable); void notifyInsChange(int ins); void notifyInsDeletion(void* ins); + int mapVelocity(int ch, unsigned char vel); void poke(unsigned int addr, unsigned short val); void poke(std::vector& wlist); void setFlags(const DivConfig& flags); diff --git a/src/engine/sysDef.cpp b/src/engine/sysDef.cpp index 5420dbf77..792b731c3 100644 --- a/src/engine/sysDef.cpp +++ b/src/engine/sysDef.cpp @@ -1972,7 +1972,7 @@ void DivEngine::registerSystems() { ); sysDefs[DIV_SYSTEM_ESFM]=new DivSysDef( - "ESS ES1xxx series (ESFM)", NULL, 0xd1, 0, 18, true, false, 0, false, 0, + "ESS ES1xxx series (ESFM)", NULL, 0xd1, 0, 18, true, false, 0, false, 0, 0, 0, "a unique FM synth featured in PC sound cards.\nbased on the OPL3 design, but with lots of its features extended.", {"FM 1", "FM 2", "FM 3", "FM 4", "FM 5", "FM 6", "FM 7", "FM 8", "FM 9", "FM 10", "FM 11", "FM 12", "FM 13", "FM 14", "FM 15", "FM 16", "FM 17", "FM 18"}, {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18"},