From c23ba3b532777b271434ccc7a72754f0254a5a85 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Fri, 14 Jan 2022 15:21:57 -0500 Subject: [PATCH] add TIA instrument type --- src/engine/instrument.h | 3 ++- src/gui/gui.cpp | 18 ++++++++++++++---- src/gui/gui.h | 1 + 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/engine/instrument.h b/src/engine/instrument.h index bc0ca5a8..ad27b62f 100644 --- a/src/engine/instrument.h +++ b/src/engine/instrument.h @@ -10,7 +10,8 @@ enum DivInstrumentType { DIV_INS_AMIGA=4, DIV_INS_PCE=5, DIV_INS_AY=6, - DIV_INS_AY8930=7 + DIV_INS_AY8930=7, + DIV_INS_TIA=8 }; struct DivInstrumentFM { diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 27f5f28b..4482bf4e 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -32,6 +32,7 @@ const int _ZERO=0; const int _ONE=1; const int _THREE=3; const int _SEVEN=7; +const int _EIGHT=8; const int _TEN=10; const int _FIFTEEN=15; const int _THIRTY_ONE=31; @@ -562,6 +563,10 @@ void FurnaceGUI::drawInsList() { ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_INSTR_AY8930]); name=fmt::sprintf(ICON_FA_BAR_CHART " %.2x: %s##_INS%d\n",i,ins->name,i); break; + case DIV_INS_TIA: + ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_INSTR_TIA]); + name=fmt::sprintf(ICON_FA_BAR_CHART " %.2x: %s##_INS%d\n",i,ins->name,i); + break; default: ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_INSTR_UNKNOWN]); name=fmt::sprintf(ICON_FA_QUESTION " %.2x: %s##_INS%d\n",i,ins->name,i); @@ -586,8 +591,8 @@ int detuneTable[8]={ 0, 1, 2, 3, 0, -3, -2, -1 }; -const char* insTypes[8]={ - "Standard", "FM", "Game Boy", "C64", "Amiga", "PC Engine", "AY-3-8910/SSG", "AY8930" +const char* insTypes[9]={ + "Standard", "FM", "Game Boy", "C64", "Amiga", "PC Engine", "AY-3-8910/SSG", "AY8930", "TIA" }; const char* ssgEnvTypes[8]={ @@ -602,8 +607,8 @@ void FurnaceGUI::drawInsEdit() { } else { DivInstrument* ins=e->song.ins[curIns]; ImGui::InputText("Name",&ins->name); - if (ins->type<0 || ins->type>7) ins->type=DIV_INS_FM; - if (ImGui::SliderScalar("Type",ImGuiDataType_U8,&ins->type,&_ZERO,&_SEVEN,insTypes[ins->type])) { + if (ins->type<0 || ins->type>8) ins->type=DIV_INS_FM; + if (ImGui::SliderScalar("Type",ImGuiDataType_U8,&ins->type,&_ZERO,&_EIGHT,insTypes[ins->type])) { ins->mode=(ins->type==DIV_INS_FM); } @@ -869,6 +874,9 @@ void FurnaceGUI::drawInsEdit() { if (ins->type==DIV_INS_AY8930) { dutyMax=255; } + if (ins->type==DIV_INS_TIA) { + dutyMax=0; + } if (dutyMax>0) { ImGui::Separator(); if (ins->type==DIV_INS_C64) { @@ -919,6 +927,7 @@ void FurnaceGUI::drawInsEdit() { // wave macro int waveMax=(ins->type==DIV_INS_AY || ins->type==DIV_INS_AY8930)?7:63; + if (ins->type==DIV_INS_TIA) waveMax=15; if (ins->type==DIV_INS_C64) waveMax=8; if (waveMax>0) { ImGui::Separator(); @@ -3377,6 +3386,7 @@ FurnaceGUI::FurnaceGUI(): uiColors[GUI_COLOR_INSTR_PCE]=ImVec4(1.0f,0.8f,0.5f,1.0f); uiColors[GUI_COLOR_INSTR_AY]=ImVec4(1.0f,0.5f,1.0f,1.0f); uiColors[GUI_COLOR_INSTR_AY8930]=ImVec4(0.7f,0.5f,1.0f,1.0f); + uiColors[GUI_COLOR_INSTR_TIA]=ImVec4(1.0f,0.6f,0.4f,1.0f); uiColors[GUI_COLOR_INSTR_UNKNOWN]=ImVec4(0.3f,0.3f,0.3f,1.0f); uiColors[GUI_COLOR_CHANNEL_FM]=ImVec4(0.2f,0.8f,1.0f,1.0f); uiColors[GUI_COLOR_CHANNEL_PULSE]=ImVec4(0.4f,1.0f,0.2f,1.0f); diff --git a/src/gui/gui.h b/src/gui/gui.h index 08310f92..1716d164 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -21,6 +21,7 @@ enum FurnaceGUIColors { GUI_COLOR_INSTR_PCE, GUI_COLOR_INSTR_AY, GUI_COLOR_INSTR_AY8930, + GUI_COLOR_INSTR_TIA, GUI_COLOR_INSTR_UNKNOWN, GUI_COLOR_CHANNEL_FM, GUI_COLOR_CHANNEL_PULSE,