Lynx: fix stereo

This commit is contained in:
tildearrow 2022-02-24 16:53:20 -05:00
parent f7bd06c4eb
commit e4ad569f8d
2 changed files with 24 additions and 15 deletions

View File

@ -30,6 +30,7 @@
#define WRITE_CONTROL(ch,v) rWrite(0x25+(ch<<3),(v)) #define WRITE_CONTROL(ch,v) rWrite(0x25+(ch<<3),(v))
#define WRITE_OTHER(ch,v) rWrite(0x27+(ch<<3),(v)) #define WRITE_OTHER(ch,v) rWrite(0x27+(ch<<3),(v))
#define WRITE_ATTEN(ch,v) rWrite((0x40+ch),(v)) #define WRITE_ATTEN(ch,v) rWrite((0x40+ch),(v))
#define WRITE_STEREO(v) rWrite(0x50,(v))
#define CHIP_DIVIDER 64 #define CHIP_DIVIDER 64
@ -88,9 +89,9 @@ const char* regCheatSheetLynx[]={
const char** DivPlatformLynx::getRegisterSheet() { const char** DivPlatformLynx::getRegisterSheet() {
return regCheatSheetLynx; return regCheatSheetLynx;
} }
const char* DivPlatformLynx::getEffectName(unsigned char effect) { const char* DivPlatformLynx::getEffectName(unsigned char effect) {
switch (effect) switch (effect)
{ {
case 0x30: case 0x31: case 0x32: case 0x33: case 0x30: case 0x31: case 0x32: case 0x33:
@ -197,7 +198,8 @@ int DivPlatformLynx::dispatch(DivCommand c) {
} }
break; break;
case DIV_CMD_PANNING: case DIV_CMD_PANNING:
WRITE_ATTEN(c.chan, c.value); chan[c.chan].pan=((c.value&0x0f)<<4)|((c.value&0xf0)>>4);
WRITE_ATTEN(c.chan,chan[c.chan].pan);
break; break;
case DIV_CMD_GET_VOLUME: case DIV_CMD_GET_VOLUME:
if (chan[c.chan].std.hasVol) { if (chan[c.chan].std.hasVol) {
@ -261,6 +263,10 @@ void DivPlatformLynx::muteChannel(int ch, bool mute) {
if (chan[ch].active) WRITE_VOLUME(ch,(isMuted[ch]?0:(chan[ch].outVol&127))); if (chan[ch].active) WRITE_VOLUME(ch,(isMuted[ch]?0:(chan[ch].outVol&127)));
} }
bool DivPlatformLynx::isStereo() {
return true;
}
void DivPlatformLynx::forceIns() { void DivPlatformLynx::forceIns() {
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
if (chan[i].active) { if (chan[i].active) {
@ -272,16 +278,16 @@ void DivPlatformLynx::forceIns() {
void* DivPlatformLynx::getChanState(int ch) { void* DivPlatformLynx::getChanState(int ch) {
return &chan[ch]; return &chan[ch];
} }
unsigned char* DivPlatformLynx::getRegisterPool() unsigned char* DivPlatformLynx::getRegisterPool()
{ {
return const_cast<unsigned char*>( mikey->getRegisterPool() ); return const_cast<unsigned char*>( mikey->getRegisterPool() );
} }
int DivPlatformLynx::getRegisterPoolSize() int DivPlatformLynx::getRegisterPoolSize()
{ {
return 4*8+4; return 4*8+4;
} }
void DivPlatformLynx::reset() { void DivPlatformLynx::reset() {
@ -294,6 +300,7 @@ void DivPlatformLynx::reset() {
if (dumpWrites) { if (dumpWrites) {
addWrite(0xffffffff,0); addWrite(0xffffffff,0);
} }
WRITE_STEREO(0);
} }
bool DivPlatformLynx::keyOffAffectsArp(int ch) { bool DivPlatformLynx::keyOffAffectsArp(int ch) {

View File

@ -45,7 +45,7 @@ class DivPlatformLynx: public DivDispatch {
MikeyFreqDiv fd; MikeyFreqDiv fd;
MikeyDuty duty; MikeyDuty duty;
int baseFreq, pitch, note, actualNote, lfsr; int baseFreq, pitch, note, actualNote, lfsr;
unsigned char ins; unsigned char ins, pan;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta; bool active, insChanged, freqChanged, keyOn, keyOff, inPorta;
signed char vol, outVol; signed char vol, outVol;
Channel(): Channel():
@ -58,6 +58,7 @@ class DivPlatformLynx: public DivDispatch {
actualNote(0), actualNote(0),
lfsr(-1), lfsr(-1),
ins(-1), ins(-1),
pan(0xff),
active(false), active(false),
insChanged(true), insChanged(true),
freqChanged(false), freqChanged(false),
@ -81,6 +82,7 @@ class DivPlatformLynx: public DivDispatch {
void forceIns(); void forceIns();
void tick(); void tick();
void muteChannel(int ch, bool mute); void muteChannel(int ch, bool mute);
bool isStereo();
bool keyOffAffectsArp(int ch); bool keyOffAffectsArp(int ch);
bool keyOffAffectsPorta(int ch); bool keyOffAffectsPorta(int ch);
//int getPortaFloor(int ch); //int getPortaFloor(int ch);