T6W28: separate instrument type

This commit is contained in:
tildearrow 2022-10-12 00:46:33 -05:00
parent ea0b573402
commit a3fdf171f3
9 changed files with 24 additions and 12 deletions

View File

@ -71,6 +71,7 @@ enum DivInstrumentType: unsigned short {
DIV_INS_YMZ280B=41,
DIV_INS_RF5C68=42,
DIV_INS_MSM5232=43,
DIV_INS_T6W28=44,
DIV_INS_MAX,
DIV_INS_NULL
};

View File

@ -72,8 +72,10 @@ void DivPlatformT6W28::acquire(short* bufL, short* bufR, size_t start, size_t le
}
void DivPlatformT6W28::writeOutVol(int ch) {
rWrite(1,0x90|(ch<<5)|(isMuted[ch]?15:(15-(chan[ch].outVol&15))));
rWrite(0,0x90|(ch<<5)|(isMuted[ch]?15:(15-(chan[ch].outVol&15))));
int left=15-CLAMP(chan[ch].outVol+chan[ch].panL-15,0,15);
int right=15-CLAMP(chan[ch].outVol+chan[ch].panR-15,0,15);
rWrite(0,0x90|(ch<<5)|(isMuted[ch]?15:left));
rWrite(1,0x90|(ch<<5)|(isMuted[ch]?15:right));
}
void DivPlatformT6W28::tick(bool sysTick) {
@ -90,12 +92,10 @@ void DivPlatformT6W28::tick(bool sysTick) {
chan[i].freqChanged=true;
}
if (chan[i].std.panL.had) {
chan[i].pan&=0x0f;
chan[i].pan|=(chan[i].std.panL.val&15)<<4;
chan[i].panL=chan[i].std.panL.val&15;
}
if (chan[i].std.panR.had) {
chan[i].pan&=0xf0;
chan[i].pan|=chan[i].std.panR.val&15;
chan[i].panR=chan[i].std.panR.val&15;
}
if (chan[i].std.vol.had || chan[i].std.panL.had || chan[i].std.panR.had) {
writeOutVol(i);
@ -208,7 +208,9 @@ int DivPlatformT6W28::dispatch(DivCommand c) {
chan[c.chan].noise=c.value;
break;
case DIV_CMD_PANNING: {
chan[c.chan].pan=(c.value&0xf0)|(c.value2>>4);
chan[c.chan].panL=c.value>>4;
chan[c.chan].panR=c.value2>>4;
writeOutVol(c.chan);
break;
}
case DIV_CMD_LEGATO:

View File

@ -29,7 +29,7 @@ class DivPlatformT6W28: public DivDispatch {
struct Channel {
int freq, baseFreq, pitch, pitch2, note;
int ins;
unsigned char pan;
unsigned char panL, panR;
bool active, insChanged, freqChanged, keyOn, keyOff, inPorta, noise;
signed char vol, outVol;
DivMacroInt std;
@ -44,7 +44,8 @@ class DivPlatformT6W28: public DivDispatch {
pitch2(0),
note(0),
ins(-1),
pan(255),
panL(15),
panR(15),
active(false),
insChanged(true),
freqChanged(false),

View File

@ -1660,7 +1660,7 @@ void DivEngine::registerSystems() {
{"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},
{DIV_INS_T6W28, DIV_INS_T6W28, DIV_INS_T6W28, DIV_INS_T6W28},
{},
{
{0x20, {DIV_CMD_STD_NOISE_MODE, "20xy: Set noise mode (x: preset/variable; y: thin pulse/noise)"}}

View File

@ -382,6 +382,10 @@ void FurnaceGUI::drawInsList(bool asChild) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_INSTR_MSM5232]);
name=fmt::sprintf(ICON_FA_BAR_CHART "##_INS%d",i);
break;
case DIV_INS_T6W28:
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_INSTR_T6W28]);
name=fmt::sprintf(ICON_FA_BAR_CHART "##_INS%d",i);
break;
default:
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_INSTR_UNKNOWN]);
name=fmt::sprintf(ICON_FA_QUESTION "##_INS%d",i);

View File

@ -171,6 +171,7 @@ enum FurnaceGUIColors {
GUI_COLOR_INSTR_YMZ280B,
GUI_COLOR_INSTR_RF5C68,
GUI_COLOR_INSTR_MSM5232,
GUI_COLOR_INSTR_T6W28,
GUI_COLOR_INSTR_UNKNOWN,
GUI_COLOR_CHANNEL_BG,

View File

@ -124,6 +124,7 @@ const char* insTypes[DIV_INS_MAX+1]={
"YMZ280B",
"RF5C68",
"MSM5232",
"T6W28",
NULL
};
@ -801,6 +802,7 @@ const FurnaceGUIColorDef guiColors[GUI_COLOR_MAX]={
D(GUI_COLOR_INSTR_YMZ280B,"",ImVec4(0.4f,0.5f,1.0f,1.0f)),
D(GUI_COLOR_INSTR_RF5C68,"",ImVec4(1.0f,0.3f,0.3f,1.0f)),
D(GUI_COLOR_INSTR_MSM5232,"",ImVec4(0.5f,0.9f,1.0f,1.0f)),
D(GUI_COLOR_INSTR_T6W28,"",ImVec4(1.0f,0.8f,0.1f,1.0f)),
D(GUI_COLOR_INSTR_UNKNOWN,"",ImVec4(0.3f,0.3f,0.3f,1.0f)),
D(GUI_COLOR_CHANNEL_BG,"",ImVec4(0.4f,0.6f,0.8f,1.0f)),

View File

@ -4762,7 +4762,7 @@ void FurnaceGUI::drawInsEdit() {
if (ins->type==DIV_INS_C64 || ins->type==DIV_INS_SAA1099) {
waveBitMode=true;
}
if (ins->type==DIV_INS_STD || ins->type==DIV_INS_VRC6_SAW || ins->type==DIV_INS_NES) waveMax=0;
if (ins->type==DIV_INS_STD || ins->type==DIV_INS_VRC6_SAW || ins->type==DIV_INS_NES || ins->type==DIV_INS_T6W28) waveMax=0;
if (ins->type==DIV_INS_TIA || ins->type==DIV_INS_VIC || ins->type==DIV_INS_OPLL) waveMax=15;
if (ins->type==DIV_INS_C64) waveMax=4;
if (ins->type==DIV_INS_SAA1099) waveMax=2;
@ -4866,7 +4866,7 @@ void FurnaceGUI::drawInsEdit() {
}
if (ins->type==DIV_INS_X1_010 || ins->type==DIV_INS_PCE || ins->type==DIV_INS_MIKEY ||
ins->type==DIV_INS_SAA1099 || ins->type==DIV_INS_NAMCO || ins->type==DIV_INS_RF5C68 ||
ins->type==DIV_INS_VBOY) {
ins->type==DIV_INS_VBOY || ins->type==DIV_INS_T6W28) {
panMax=15;
}
if (ins->type==DIV_INS_SEGAPCM) {

View File

@ -1680,6 +1680,7 @@ void FurnaceGUI::drawSettings() {
if (ImGui::TreeNode("Instrument Types")) {
UI_COLOR_CONFIG(GUI_COLOR_INSTR_FM,"FM (OPN)");
UI_COLOR_CONFIG(GUI_COLOR_INSTR_STD,"SN76489/Sega PSG");
UI_COLOR_CONFIG(GUI_COLOR_INSTR_T6W28,"T6W28");
UI_COLOR_CONFIG(GUI_COLOR_INSTR_GB,"Game Boy");
UI_COLOR_CONFIG(GUI_COLOR_INSTR_C64,"C64");
UI_COLOR_CONFIG(GUI_COLOR_INSTR_AMIGA,"Amiga/Generic Sample");