diff --git a/CMakeLists.txt b/CMakeLists.txt index f3121303..9edfc252 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -265,7 +265,7 @@ src/engine/platform/sound/lynx/Mikey.cpp src/engine/platform/sound/qsound.c -src/engine/platform/sound/ws.cpp +src/engine/platform/sound/swan.cpp src/engine/platform/ym2610Interface.cpp @@ -309,7 +309,7 @@ src/engine/platform/pcspkr.cpp src/engine/platform/segapcm.cpp src/engine/platform/qsound.cpp src/engine/platform/lynx.cpp -src/engine/platform/ws.cpp +src/engine/platform/swan.cpp src/engine/platform/dummy.cpp ) diff --git a/src/engine/dispatchContainer.cpp b/src/engine/dispatchContainer.cpp index 0bc6a272..8a597cbe 100644 --- a/src/engine/dispatchContainer.cpp +++ b/src/engine/dispatchContainer.cpp @@ -41,7 +41,7 @@ #include "platform/pcspkr.h" #include "platform/segapcm.h" #include "platform/qsound.h" -#include "platform/ws.h" +#include "platform/swan.h" #include "platform/dummy.h" #include "platform/lynx.h" #include "../ta-log.h" @@ -236,7 +236,7 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do dispatch=new DivPlatformSegaPCM; break; case DIV_SYSTEM_SWAN: - dispatch=new DivPlatformWS; + dispatch=new DivPlatformSwan; break; default: logW("this system is not supported yet! using dummy platform.\n"); diff --git a/src/engine/platform/sound/ws.cpp b/src/engine/platform/sound/swan.cpp similarity index 99% rename from src/engine/platform/sound/ws.cpp rename to src/engine/platform/sound/swan.cpp index e02d63ec..60052f61 100644 --- a/src/engine/platform/sound/ws.cpp +++ b/src/engine/platform/sound/swan.cpp @@ -20,7 +20,7 @@ ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "ws.h" +#include "swan.h" #include #define MK_SAMPLE_CACHE \ diff --git a/src/engine/platform/sound/ws.h b/src/engine/platform/sound/swan.h similarity index 100% rename from src/engine/platform/sound/ws.h rename to src/engine/platform/sound/swan.h diff --git a/src/engine/platform/ws.cpp b/src/engine/platform/swan.cpp similarity index 91% rename from src/engine/platform/ws.cpp rename to src/engine/platform/swan.cpp index 1a842a22..c86f2f70 100644 --- a/src/engine/platform/ws.cpp +++ b/src/engine/platform/swan.cpp @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "ws.h" +#include "swan.h" #include "../engine.h" #include @@ -46,11 +46,11 @@ const char* regCheatSheetWS[]={ NULL }; -const char** DivPlatformWS::getRegisterSheet() { +const char** DivPlatformSwan::getRegisterSheet() { return regCheatSheetWS; } -const char* DivPlatformWS::getEffectName(unsigned char effect) { +const char* DivPlatformSwan::getEffectName(unsigned char effect) { switch (effect) { case 0x10: return "10xx: Change waveform"; @@ -71,7 +71,7 @@ const char* DivPlatformWS::getEffectName(unsigned char effect) { return NULL; } -void DivPlatformWS::acquire(short* bufL, short* bufR, size_t start, size_t len) { +void DivPlatformSwan::acquire(short* bufL, short* bufR, size_t start, size_t len) { for (size_t h=start; hgetWave(chan[ch].wave); unsigned char addr=0x40+ch*16; if (wt->max<1 || wt->len<1) { @@ -125,7 +125,7 @@ void DivPlatformWS::updateWave(int ch) { } } -void DivPlatformWS::calcAndWriteOutVol(int ch, int env) { +void DivPlatformSwan::calcAndWriteOutVol(int ch, int env) { int vl=chan[ch].vol*((chan[ch].pan>>4)&0x0f)*env/225; int vr=chan[ch].vol*(chan[ch].pan&0x0f)*env/225; if (ch==1&&pcm) { @@ -138,7 +138,7 @@ void DivPlatformWS::calcAndWriteOutVol(int ch, int env) { writeOutVol(ch); } -void DivPlatformWS::writeOutVol(int ch) { +void DivPlatformSwan::writeOutVol(int ch) { unsigned char val=isMuted[ch]?0:chan[ch].outVol; if (ch==1&&pcm) { rWrite(0x14,val) @@ -147,7 +147,7 @@ void DivPlatformWS::writeOutVol(int ch) { } } -void DivPlatformWS::tick() { +void DivPlatformSwan::tick() { unsigned char sndCtrl=(pcm?0x20:0)|(sweep?0x40:0)|((noise>0)?0x80:0); for (int i=0; i<4; i++) { chan[i].std.next(); @@ -230,7 +230,7 @@ void DivPlatformWS::tick() { rWrite(0x10,sndCtrl); } -int DivPlatformWS::dispatch(DivCommand c) { +int DivPlatformSwan::dispatch(DivCommand c) { switch (c.cmd) { case DIV_CMD_NOTE_ON: { DivInstrument* ins=parent->getIns(chan[c.chan].ins); @@ -419,12 +419,12 @@ int DivPlatformWS::dispatch(DivCommand c) { return 1; } -void DivPlatformWS::muteChannel(int ch, bool mute) { +void DivPlatformSwan::muteChannel(int ch, bool mute) { isMuted[ch]=mute; writeOutVol(ch); } -void DivPlatformWS::forceIns() { +void DivPlatformSwan::forceIns() { for (int i=0; i<4; i++) { chan[i].insChanged=true; chan[i].freqChanged=true; @@ -433,22 +433,22 @@ void DivPlatformWS::forceIns() { } } -void* DivPlatformWS::getChanState(int ch) { +void* DivPlatformSwan::getChanState(int ch) { return &chan[ch]; } -unsigned char* DivPlatformWS::getRegisterPool() { +unsigned char* DivPlatformSwan::getRegisterPool() { // get Random from emulator regPool[0x12]=ws->SoundRead(0x92); regPool[0x13]=ws->SoundRead(0x93); return regPool; } -int DivPlatformWS::getRegisterPoolSize() { +int DivPlatformSwan::getRegisterPoolSize() { return 128; } -void DivPlatformWS::reset() { +void DivPlatformSwan::reset() { while (!writes.empty()) writes.pop(); memset(regPool,0,128); for (int i=0; i<4; i++) { @@ -474,11 +474,11 @@ void DivPlatformWS::reset() { rWrite(0x11,0x09); // enable speakers } -bool DivPlatformWS::isStereo() { +bool DivPlatformSwan::isStereo() { return true; } -void DivPlatformWS::notifyWaveChange(int wave) { +void DivPlatformSwan::notifyWaveChange(int wave) { for (int i=0; i<4; i++) { if (chan[i].wave==wave) { updateWave(i); @@ -486,21 +486,21 @@ void DivPlatformWS::notifyWaveChange(int wave) { } } -void DivPlatformWS::notifyInsDeletion(void* ins) { +void DivPlatformSwan::notifyInsDeletion(void* ins) { for (int i=0; i<4; i++) { chan[i].std.notifyInsDeletion((DivInstrument*)ins); } } -void DivPlatformWS::poke(unsigned int addr, unsigned short val) { +void DivPlatformSwan::poke(unsigned int addr, unsigned short val) { rWrite(addr,val); } -void DivPlatformWS::poke(std::vector& wlist) { +void DivPlatformSwan::poke(std::vector& wlist) { for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); } -int DivPlatformWS::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { +int DivPlatformSwan::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { parent=p; dumpWrites=false; skipRegisterWrites=false; @@ -514,9 +514,9 @@ int DivPlatformWS::init(DivEngine* p, int channels, int sugRate, unsigned int fl return 4; } -void DivPlatformWS::quit() { +void DivPlatformSwan::quit() { delete ws; } -DivPlatformWS::~DivPlatformWS() { +DivPlatformSwan::~DivPlatformSwan() { } diff --git a/src/engine/platform/ws.h b/src/engine/platform/swan.h similarity index 95% rename from src/engine/platform/ws.h rename to src/engine/platform/swan.h index ea6466fb..47470f57 100644 --- a/src/engine/platform/ws.h +++ b/src/engine/platform/swan.h @@ -17,15 +17,15 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef _WS_H -#define _WS_H +#ifndef _SWAN_H +#define _SWAN_H #include "../dispatch.h" #include "../macroInt.h" -#include "sound/ws.h" +#include "sound/swan.h" #include -class DivPlatformWS: public DivDispatch { +class DivPlatformSwan: public DivDispatch { struct Channel { int freq, baseFreq, pitch, note; unsigned char ins, pan; @@ -86,7 +86,7 @@ class DivPlatformWS: public DivDispatch { const char* getEffectName(unsigned char effect); int init(DivEngine* parent, int channels, int sugRate, unsigned int flags); void quit(); - ~DivPlatformWS(); + ~DivPlatformSwan(); private: void calcAndWriteOutVol(int ch, int env); void writeOutVol(int ch);