prepare for ch3 mode
This commit is contained in:
parent
5a8e20fcd1
commit
2532401265
|
@ -34,6 +34,7 @@ src/engine/macroInt.cpp
|
||||||
src/engine/playback.cpp
|
src/engine/playback.cpp
|
||||||
src/engine/platform/abstract.cpp
|
src/engine/platform/abstract.cpp
|
||||||
src/engine/platform/genesis.cpp
|
src/engine/platform/genesis.cpp
|
||||||
|
src/engine/platform/genesisext.cpp
|
||||||
src/engine/platform/sms.cpp
|
src/engine/platform/sms.cpp
|
||||||
src/engine/platform/dummy.cpp)
|
src/engine/platform/dummy.cpp)
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../ta-log.h"
|
#include "../ta-log.h"
|
||||||
#include "../audio/sdl.h"
|
#include "../audio/sdl.h"
|
||||||
#include "platform/genesis.h"
|
#include "platform/genesis.h"
|
||||||
|
#include "platform/genesisext.h"
|
||||||
#include "platform/sms.h"
|
#include "platform/sms.h"
|
||||||
#include "platform/dummy.h"
|
#include "platform/dummy.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
@ -676,6 +677,9 @@ bool DivEngine::init() {
|
||||||
case DIV_SYSTEM_GENESIS:
|
case DIV_SYSTEM_GENESIS:
|
||||||
dispatch=new DivPlatformGenesis;
|
dispatch=new DivPlatformGenesis;
|
||||||
break;
|
break;
|
||||||
|
case DIV_SYSTEM_GENESIS_EXT:
|
||||||
|
dispatch=new DivPlatformGenesisExt;
|
||||||
|
break;
|
||||||
case DIV_SYSTEM_SMS:
|
case DIV_SYSTEM_SMS:
|
||||||
dispatch=new DivPlatformSMS;
|
dispatch=new DivPlatformSMS;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
// TODO fix all the writes.
|
|
||||||
// i think there is no wait for data writes, just for ON/OFF writes
|
|
||||||
void DivPlatformGenesis::acquire(int& l, int& r) {
|
void DivPlatformGenesis::acquire(int& l, int& r) {
|
||||||
static short o[2];
|
static short o[2];
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifndef _GENESIS_H
|
||||||
|
#define _GENESIS_H
|
||||||
#include "../dispatch.h"
|
#include "../dispatch.h"
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include "../../../extern/Nuked-OPN2/ym3438.h"
|
#include "../../../extern/Nuked-OPN2/ym3438.h"
|
||||||
|
@ -5,6 +7,7 @@
|
||||||
#include "sms.h"
|
#include "sms.h"
|
||||||
|
|
||||||
class DivPlatformGenesis: public DivDispatch {
|
class DivPlatformGenesis: public DivDispatch {
|
||||||
|
protected:
|
||||||
struct Channel {
|
struct Channel {
|
||||||
unsigned char freqH, freqL;
|
unsigned char freqH, freqL;
|
||||||
int freq, baseFreq, pitch;
|
int freq, baseFreq, pitch;
|
||||||
|
@ -45,3 +48,4 @@ class DivPlatformGenesis: public DivDispatch {
|
||||||
void tick();
|
void tick();
|
||||||
int init(DivEngine* parent, int channels, int sugRate);
|
int init(DivEngine* parent, int channels, int sugRate);
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
#include "genesisext.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
int DivPlatformGenesisExt::dispatch(DivCommand c) {
|
||||||
|
if (c.chan<2) {
|
||||||
|
return DivPlatformGenesis::dispatch(c);
|
||||||
|
}
|
||||||
|
if (c.chan>5) {
|
||||||
|
c.chan-=3;
|
||||||
|
return DivPlatformGenesis::dispatch(c);
|
||||||
|
}
|
||||||
|
printf("HANDLE: %d %d %d %d\n",c.cmd,c.chan,c.value,c.value2);
|
||||||
|
switch (c.cmd) {
|
||||||
|
case DIV_CMD_NOTE_ON:
|
||||||
|
chan[c.chan].freq=16.4f*pow(2.0f,((float)c.value/12.0f));
|
||||||
|
chan[c.chan].active=true;
|
||||||
|
break;
|
||||||
|
case DIV_CMD_NOTE_OFF:
|
||||||
|
chan[c.chan].active=false;
|
||||||
|
break;
|
||||||
|
case DIV_CMD_VOLUME:
|
||||||
|
chan[c.chan].vol=c.value;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DivPlatformGenesisExt::tick() {
|
||||||
|
DivPlatformGenesis::tick();
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
#include "../dispatch.h"
|
||||||
|
|
||||||
|
#include "genesis.h"
|
||||||
|
|
||||||
|
class DivPlatformGenesisExt: public DivPlatformGenesis {
|
||||||
|
public:
|
||||||
|
int dispatch(DivCommand c);
|
||||||
|
void tick();
|
||||||
|
};
|
|
@ -25,6 +25,7 @@ const char* formatNote(unsigned char note, unsigned char octave) {
|
||||||
bool DivEngine::perSystemEffect(int ch, unsigned char effect, unsigned char effectVal) {
|
bool DivEngine::perSystemEffect(int ch, unsigned char effect, unsigned char effectVal) {
|
||||||
switch (song.system) {
|
switch (song.system) {
|
||||||
case DIV_SYSTEM_GENESIS:
|
case DIV_SYSTEM_GENESIS:
|
||||||
|
case DIV_SYSTEM_GENESIS_EXT:
|
||||||
switch (effect) {
|
switch (effect) {
|
||||||
case 0x17: // DAC enable
|
case 0x17: // DAC enable
|
||||||
dispatch->dispatch(DivCommand(DIV_CMD_SAMPLE_MODE,ch,(effectVal>0)));
|
dispatch->dispatch(DivCommand(DIV_CMD_SAMPLE_MODE,ch,(effectVal>0)));
|
||||||
|
@ -54,6 +55,7 @@ bool DivEngine::perSystemEffect(int ch, unsigned char effect, unsigned char effe
|
||||||
bool DivEngine::perSystemPostEffect(int ch, unsigned char effect, unsigned char effectVal) {
|
bool DivEngine::perSystemPostEffect(int ch, unsigned char effect, unsigned char effectVal) {
|
||||||
switch (song.system) {
|
switch (song.system) {
|
||||||
case DIV_SYSTEM_GENESIS:
|
case DIV_SYSTEM_GENESIS:
|
||||||
|
case DIV_SYSTEM_GENESIS_EXT:
|
||||||
switch (effect) {
|
switch (effect) {
|
||||||
case 0x11: // FB
|
case 0x11: // FB
|
||||||
dispatch->dispatch(DivCommand(DIV_CMD_FM_FB,ch,effectVal&7));
|
dispatch->dispatch(DivCommand(DIV_CMD_FM_FB,ch,effectVal&7));
|
||||||
|
@ -360,7 +362,7 @@ void DivEngine::nextTick() {
|
||||||
dispatch->dispatch(DivCommand(DIV_CMD_NOTE_OFF,i));
|
dispatch->dispatch(DivCommand(DIV_CMD_NOTE_OFF,i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chan[i].arp!=0) {
|
if (chan[i].arp!=0 && chan[i].portaSpeed<1) {
|
||||||
chan[i].arpStage++;
|
chan[i].arpStage++;
|
||||||
if (chan[i].arpStage>2) chan[i].arpStage=0;
|
if (chan[i].arpStage>2) chan[i].arpStage=0;
|
||||||
switch (chan[i].arpStage) {
|
switch (chan[i].arpStage) {
|
||||||
|
|
Loading…
Reference in New Issue