mirror of
https://github.com/tildearrow/furnace.git
synced 2024-12-31 20:11:29 +00:00
prepare for compat flags, piano, comments, etc.
This commit is contained in:
parent
07b767bee1
commit
3379e8b380
5 changed files with 123 additions and 9 deletions
|
@ -1537,6 +1537,11 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
|
||||||
logI("%s by %s\n",ds.name.c_str(),ds.author.c_str());
|
logI("%s by %s\n",ds.name.c_str(),ds.author.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// compatibility flags
|
||||||
|
ds.limitSlides=true;
|
||||||
|
ds.linearPitch=true;
|
||||||
|
ds.loopModality=0;
|
||||||
|
|
||||||
logI("reading module data...\n");
|
logI("reading module data...\n");
|
||||||
if (ds.version>0x0c) {
|
if (ds.version>0x0c) {
|
||||||
ds.hilightA=reader.readC();
|
ds.hilightA=reader.readC();
|
||||||
|
@ -2057,6 +2062,12 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
||||||
addWarning("this module was created with a more recent version of Furnace!");
|
addWarning("this module was created with a more recent version of Furnace!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ds.version<37) { // compat flags not stored back then
|
||||||
|
ds.limitSlides=true;
|
||||||
|
ds.linearPitch=true;
|
||||||
|
ds.loopModality=0;
|
||||||
|
}
|
||||||
|
|
||||||
reader.readS(); // reserved
|
reader.readS(); // reserved
|
||||||
int infoSeek=reader.readI();
|
int infoSeek=reader.readI();
|
||||||
|
|
||||||
|
@ -2122,8 +2133,15 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
||||||
reader.readI();
|
reader.readI();
|
||||||
}
|
}
|
||||||
|
|
||||||
// reserved
|
// compatibility flags
|
||||||
for (int i=0; i<20; i++) reader.readC();
|
if (ds.version>=37) {
|
||||||
|
ds.limitSlides=reader.readC();
|
||||||
|
ds.linearPitch=reader.readC();
|
||||||
|
ds.loopModality=reader.readC();
|
||||||
|
for (int i=0; i<17; i++) reader.readC();
|
||||||
|
} else {
|
||||||
|
for (int i=0; i<20; i++) reader.readC();
|
||||||
|
}
|
||||||
|
|
||||||
// pointers
|
// pointers
|
||||||
reader.read(insPtr,ds.insLen*4);
|
reader.read(insPtr,ds.insLen*4);
|
||||||
|
@ -2469,8 +2487,11 @@ SafeWriter* DivEngine::saveFur() {
|
||||||
|
|
||||||
w->writeF(song.tuning);
|
w->writeF(song.tuning);
|
||||||
|
|
||||||
// reserved
|
// compatibility flags
|
||||||
for (int i=0; i<20; i++) {
|
w->writeC(song.limitSlides);
|
||||||
|
w->writeC(song.linearPitch);
|
||||||
|
w->writeC(song.loopModality);
|
||||||
|
for (int i=0; i<17; i++) {
|
||||||
w->writeC(0);
|
w->writeC(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
#define DIV_VERSION "0.5.1"
|
#define DIV_VERSION "0.5.2pre1"
|
||||||
#define DIV_ENGINE_VERSION 36
|
#define DIV_ENGINE_VERSION 37
|
||||||
|
|
||||||
enum DivStatusView {
|
enum DivStatusView {
|
||||||
DIV_STATUS_NOTHING=0,
|
DIV_STATUS_NOTHING=0,
|
||||||
|
|
|
@ -201,7 +201,12 @@ struct DivSong {
|
||||||
|
|
||||||
// compatibility flags
|
// compatibility flags
|
||||||
bool limitSlides; // limit slide range
|
bool limitSlides; // limit slide range
|
||||||
bool nonLinearSlides; // E5xx behavior control
|
bool linearPitch; // E5xx behavior control
|
||||||
|
// loop behavior
|
||||||
|
// 0: reset on loop
|
||||||
|
// 1: fake reset on loop
|
||||||
|
// 2: don't do anything on loop
|
||||||
|
unsigned char loopModality;
|
||||||
|
|
||||||
DivOrders orders;
|
DivOrders orders;
|
||||||
std::vector<DivInstrument*> ins;
|
std::vector<DivInstrument*> ins;
|
||||||
|
@ -245,7 +250,9 @@ struct DivSong {
|
||||||
waveLen(0),
|
waveLen(0),
|
||||||
sampleLen(0),
|
sampleLen(0),
|
||||||
tuning(440.0f),
|
tuning(440.0f),
|
||||||
limitSlides(false) {
|
limitSlides(false),
|
||||||
|
linearPitch(true),
|
||||||
|
loopModality(0) {
|
||||||
for (int i=0; i<32; i++) {
|
for (int i=0; i<32; i++) {
|
||||||
system[i]=DIV_SYSTEM_NULL;
|
system[i]=DIV_SYSTEM_NULL;
|
||||||
systemVol[i]=64;
|
systemVol[i]=64;
|
||||||
|
|
|
@ -3360,6 +3360,67 @@ void FurnaceGUI::drawDebug() {
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FurnaceGUI::drawStats() {
|
||||||
|
if (!statsOpen) return;
|
||||||
|
if (ImGui::Begin("Statistics",&statsOpen)) {
|
||||||
|
String adpcmUsage=fmt::sprintf("%d/16384KB",e->adpcmMemLen/1024);
|
||||||
|
String adpcmBUsage=fmt::sprintf("%d/16384KB",e->adpcmBMemLen/1024);
|
||||||
|
ImGui::Text("ADPCM-A");
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::ProgressBar(((float)e->adpcmMemLen)/16777216.0f,ImVec2(-FLT_MIN,0),adpcmUsage.c_str());
|
||||||
|
ImGui::Text("ADPCM-B");
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::ProgressBar(((float)e->adpcmBMemLen)/16777216.0f,ImVec2(-FLT_MIN,0),adpcmBUsage.c_str());
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FurnaceGUI::drawCompatFlags() {
|
||||||
|
if (!compatFlagsOpen) return;
|
||||||
|
if (ImGui::Begin("Compatibility Flags",&compatFlagsOpen)) {
|
||||||
|
ImGui::TextWrapped("these flags are stored in the song when saving in .fur format, and are automatically enabled when saving in .dmf format.");
|
||||||
|
ImGui::Checkbox("Limit slide range",&e->song.limitSlides);
|
||||||
|
ImGui::Checkbox("Linear pitch control",&e->song.linearPitch);
|
||||||
|
ImGui::Text("Loop modality:");
|
||||||
|
if (ImGui::RadioButton("Reset channels",e->song.loopModality==0)) {
|
||||||
|
e->song.loopModality=0;
|
||||||
|
}
|
||||||
|
if (ImGui::RadioButton("Soft reset channels",e->song.loopModality==1)) {
|
||||||
|
e->song.loopModality=1;
|
||||||
|
}
|
||||||
|
if (ImGui::RadioButton("Do nothing",e->song.loopModality==2)) {
|
||||||
|
e->song.loopModality=2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FurnaceGUI::drawPiano() {
|
||||||
|
if (!pianoOpen) return;
|
||||||
|
if (ImGui::Begin("Piano",&pianoOpen)) {
|
||||||
|
for (int i=0; i<e->getTotalChannelCount(); i++) {
|
||||||
|
DivChannelState* cs=e->getChanState(i);
|
||||||
|
if (cs->keyOn) {
|
||||||
|
const char* noteName=NULL;
|
||||||
|
if (cs->note<-60 || cs->note>120) {
|
||||||
|
noteName="???";
|
||||||
|
} else {
|
||||||
|
noteName=noteNames[cs->note+60];
|
||||||
|
}
|
||||||
|
ImGui::Text("%d: %s",i,noteName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FurnaceGUI::drawNotes() {
|
||||||
|
if (!notesOpen) return;
|
||||||
|
if (ImGui::Begin("Song Comments",¬esOpen)) {
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
void FurnaceGUI::startSelection(int xCoarse, int xFine, int y) {
|
void FurnaceGUI::startSelection(int xCoarse, int xFine, int y) {
|
||||||
if (xCoarse!=selStart.xCoarse || xFine!=selStart.xFine || y!=selStart.y) {
|
if (xCoarse!=selStart.xCoarse || xFine!=selStart.xFine || y!=selStart.y) {
|
||||||
curNibble=false;
|
curNibble=false;
|
||||||
|
@ -5179,6 +5240,10 @@ bool FurnaceGUI::loop() {
|
||||||
if (ImGui::MenuItem("mixer")) mixerOpen=!mixerOpen;
|
if (ImGui::MenuItem("mixer")) mixerOpen=!mixerOpen;
|
||||||
if (ImGui::MenuItem("oscilloscope")) oscOpen=!oscOpen;
|
if (ImGui::MenuItem("oscilloscope")) oscOpen=!oscOpen;
|
||||||
if (ImGui::MenuItem("volume meter")) volMeterOpen=!volMeterOpen;
|
if (ImGui::MenuItem("volume meter")) volMeterOpen=!volMeterOpen;
|
||||||
|
if (ImGui::MenuItem("statistics")) statsOpen=!statsOpen;
|
||||||
|
if (ImGui::MenuItem("compatibility flags")) compatFlagsOpen=!compatFlagsOpen;
|
||||||
|
if (ImGui::MenuItem("piano/input pad")) pianoOpen=!pianoOpen;
|
||||||
|
if (ImGui::MenuItem("song comments")) notesOpen=!notesOpen;
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
if (ImGui::BeginMenu("help")) {
|
if (ImGui::BeginMenu("help")) {
|
||||||
|
@ -5221,6 +5286,10 @@ bool FurnaceGUI::loop() {
|
||||||
drawPattern();
|
drawPattern();
|
||||||
drawSettings();
|
drawSettings();
|
||||||
drawDebug();
|
drawDebug();
|
||||||
|
drawStats();
|
||||||
|
drawCompatFlags();
|
||||||
|
drawPiano();
|
||||||
|
drawNotes();
|
||||||
|
|
||||||
if (ImGuiFileDialog::Instance()->Display("FileDialog",ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove,ImVec2(600.0f*dpiScale,400.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale))) {
|
if (ImGuiFileDialog::Instance()->Display("FileDialog",ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove,ImVec2(600.0f*dpiScale,400.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale))) {
|
||||||
//ImGui::GetIO().ConfigFlags&=~ImGuiConfigFlags_NavEnableKeyboard;
|
//ImGui::GetIO().ConfigFlags&=~ImGuiConfigFlags_NavEnableKeyboard;
|
||||||
|
@ -5729,6 +5798,10 @@ bool FurnaceGUI::init() {
|
||||||
mixerOpen=e->getConfBool("mixerOpen",false);
|
mixerOpen=e->getConfBool("mixerOpen",false);
|
||||||
oscOpen=e->getConfBool("oscOpen",true);
|
oscOpen=e->getConfBool("oscOpen",true);
|
||||||
volMeterOpen=e->getConfBool("volMeterOpen",true);
|
volMeterOpen=e->getConfBool("volMeterOpen",true);
|
||||||
|
statsOpen=e->getConfBool("statsOpen",false);
|
||||||
|
compatFlagsOpen=e->getConfBool("compatFlagsOpen",false);
|
||||||
|
pianoOpen=e->getConfBool("pianoOpen",false);
|
||||||
|
notesOpen=e->getConfBool("notesOpen",false);
|
||||||
|
|
||||||
syncSettings();
|
syncSettings();
|
||||||
|
|
||||||
|
@ -5834,6 +5907,10 @@ bool FurnaceGUI::finish() {
|
||||||
e->setConf("mixerOpen",mixerOpen);
|
e->setConf("mixerOpen",mixerOpen);
|
||||||
e->setConf("oscOpen",oscOpen);
|
e->setConf("oscOpen",oscOpen);
|
||||||
e->setConf("volMeterOpen",volMeterOpen);
|
e->setConf("volMeterOpen",volMeterOpen);
|
||||||
|
e->setConf("statsOpen",statsOpen);
|
||||||
|
e->setConf("compatFlagsOpen",compatFlagsOpen);
|
||||||
|
e->setConf("pianoOpen",pianoOpen);
|
||||||
|
e->setConf("notesOpen",notesOpen);
|
||||||
|
|
||||||
// commit last window size
|
// commit last window size
|
||||||
e->setConf("lastWindowWidth",scrW);
|
e->setConf("lastWindowWidth",scrW);
|
||||||
|
@ -5896,6 +5973,10 @@ FurnaceGUI::FurnaceGUI():
|
||||||
debugOpen(false),
|
debugOpen(false),
|
||||||
oscOpen(true),
|
oscOpen(true),
|
||||||
volMeterOpen(true),
|
volMeterOpen(true),
|
||||||
|
statsOpen(false),
|
||||||
|
compatFlagsOpen(false),
|
||||||
|
pianoOpen(false),
|
||||||
|
notesOpen(false),
|
||||||
selecting(false),
|
selecting(false),
|
||||||
curNibble(false),
|
curNibble(false),
|
||||||
orderNibble(false),
|
orderNibble(false),
|
||||||
|
|
|
@ -252,7 +252,8 @@ class FurnaceGUI {
|
||||||
int loopOrder, loopRow, loopEnd, isClipping;
|
int loopOrder, loopRow, loopEnd, isClipping;
|
||||||
bool editControlsOpen, ordersOpen, insListOpen, songInfoOpen, patternOpen, insEditOpen;
|
bool editControlsOpen, ordersOpen, insListOpen, songInfoOpen, patternOpen, insEditOpen;
|
||||||
bool waveListOpen, waveEditOpen, sampleListOpen, sampleEditOpen, aboutOpen, settingsOpen;
|
bool waveListOpen, waveEditOpen, sampleListOpen, sampleEditOpen, aboutOpen, settingsOpen;
|
||||||
bool mixerOpen, debugOpen, oscOpen, volMeterOpen;
|
bool mixerOpen, debugOpen, oscOpen, volMeterOpen, statsOpen, compatFlagsOpen;
|
||||||
|
bool pianoOpen, notesOpen;
|
||||||
SelectionPoint selStart, selEnd, cursor;
|
SelectionPoint selStart, selEnd, cursor;
|
||||||
bool selecting, curNibble, orderNibble, extraChannelButtons, followOrders, followPattern, changeAllOrders;
|
bool selecting, curNibble, orderNibble, extraChannelButtons, followOrders, followPattern, changeAllOrders;
|
||||||
FurnaceGUIWindows curWindow;
|
FurnaceGUIWindows curWindow;
|
||||||
|
@ -337,6 +338,10 @@ class FurnaceGUI {
|
||||||
void drawMixer();
|
void drawMixer();
|
||||||
void drawOsc();
|
void drawOsc();
|
||||||
void drawVolMeter();
|
void drawVolMeter();
|
||||||
|
void drawStats();
|
||||||
|
void drawCompatFlags();
|
||||||
|
void drawPiano();
|
||||||
|
void drawNotes();
|
||||||
void drawAbout();
|
void drawAbout();
|
||||||
void drawSettings();
|
void drawSettings();
|
||||||
void drawDebug();
|
void drawDebug();
|
||||||
|
|
Loading…
Reference in a new issue