Skip to content

Commit

Permalink
dev184 - Merge branch 'master' of https://github.com/DevEd2/furnace
Browse files Browse the repository at this point in the history
  • Loading branch information
tildearrow committed Oct 14, 2023
2 parents f1afa42 + ac85732 commit dd7f4c1
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 6 deletions.
3 changes: 2 additions & 1 deletion papers/format.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,8 @@ size | description
1 | broken macro during note off in some FM chips (>=155)
1 | pre note (C64) does not compensate for portamento or legato (>=168)
1 | disable new NES DPCM features (>=183)
4 | reserved
1 | reset arp effect phase on new note (>=184)
3 | reserved
--- | **speed pattern of first song** (>=139)
1 | length of speed pattern (fail if this is lower than 0 or higher than 16)
16 | speed pattern (this overrides speed 1 and speed 2 settings)
Expand Down
4 changes: 2 additions & 2 deletions src/engine/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class DivWorkPool;

#define DIV_UNSTABLE

#define DIV_VERSION "dev183"
#define DIV_ENGINE_VERSION 183
#define DIV_VERSION "dev184"
#define DIV_ENGINE_VERSION 184
// for imports
#define DIV_VERSION_MOD 0xff01
#define DIV_VERSION_FC 0xff02
Expand Down
13 changes: 11 additions & 2 deletions src/engine/fileOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1860,6 +1860,9 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
if (ds.version<183) {
ds.oldDPCM=true;
}
if (ds.version<184) {
ds.resetArpPhaseOnNewNote=false;
}
ds.isDMF=false;

reader.readS(); // reserved
Expand Down Expand Up @@ -2383,7 +2386,12 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
} else {
reader.readC();
}
for (int i=0; i<4; i++) {
if (ds.version>=184) {
ds.resetArpPhaseOnNewNote=reader.readC();
} else {
reader.readC();
}
for (int i=0; i<3; i++) {
reader.readC();
}
}
Expand Down Expand Up @@ -5448,7 +5456,8 @@ SafeWriter* DivEngine::saveFur(bool notPrimary, bool newPatternFormat) {
w->writeC(song.brokenFMOff);
w->writeC(song.preNoteNoEffect);
w->writeC(song.oldDPCM);
for (int i=0; i<4; i++) {
w->writeC(song.resetArpPhaseOnNewNote);
for (int i=0; i<3; i++) {
w->writeC(0);
}

Expand Down
3 changes: 3 additions & 0 deletions src/engine/playback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,9 @@ void DivEngine::processRow(int i, bool afterDelay) {
} else if (!chan[i].noteOnInhibit) {
dispatchCmd(DivCommand(DIV_CMD_NOTE_ON,i,chan[i].note,chan[i].volume>>8));
chan[i].releasing=false;
if (song.resetArpPhaseOnNewNote) {
chan[i].arpStage=-1;
}
chan[i].goneThroughNote=true;
chan[i].wentThroughNote=true;
keyHit[i]=true;
Expand Down
4 changes: 3 additions & 1 deletion src/engine/song.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ struct DivSong {
bool brokenFMOff;
bool preNoteNoEffect;
bool oldDPCM;
bool resetArpPhaseOnNewNote;

std::vector<DivInstrument*> ins;
std::vector<DivWavetable*> wave;
Expand Down Expand Up @@ -498,7 +499,8 @@ struct DivSong {
brokenPortaLegato(false),
brokenFMOff(false),
preNoteNoEffect(false),
oldDPCM(false) {
oldDPCM(false),
resetArpPhaseOnNewNote(false) {
for (int i=0; i<DIV_MAX_CHIPS; i++) {
system[i]=DIV_SYSTEM_NULL;
systemVol[i]=1.0;
Expand Down
4 changes: 4 additions & 0 deletions src/gui/compatFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ void FurnaceGUI::drawCompatFlags() {
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("when enabled, the pitch macro of an instrument is in frequency/period space.");
}
ImGui::Checkbox("Reset arpeggio effect position on new note",&e->song.resetArpPhaseOnNewNote);
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("when enabled, arpeggio effect (00xy) position is reset on a new note.");
}
ImGui::EndTabItem();
}
ImGui::EndTabBar();
Expand Down

0 comments on commit dd7f4c1

Please sign in to comment.