From 2a15673610188dd5a4dbb1c1c99f940cd02697f4 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 3 Feb 2022 00:52:50 -0500 Subject: [PATCH] implement loop modality and pitch control flags issue #113 --- src/engine/engine.cpp | 9 +++++++-- src/engine/playback.cpp | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index ae1396f90..d48c57f37 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -4749,9 +4749,14 @@ int DivEngine::calcBaseFreq(double clock, double divider, int note, bool period) } int DivEngine::calcFreq(int base, int pitch, bool period) { + if (song.linearPitch) { + return period? + int(base*pow(2,-(double)pitch/(12.0*128.0))/(98.0+globalPitch*6.0)*98.0): + (int(base*pow(2,(double)pitch/(12.0*128.0))*(98+globalPitch*6))/98); + } return period? - int(base*pow(2,-(double)pitch/(12.0*128.0))/(98.0+globalPitch*6.0)*98.0): - (int(base*pow(2,(double)pitch/(12.0*128.0))*(98+globalPitch*6))/98); + base-pitch: + base+pitch; } void DivEngine::play() { diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 80e9e14c9..ce3b32bf4 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -830,7 +830,9 @@ bool DivEngine::nextTick(bool noAccum) { if (--ticks<=0) { ret=endOfSong; if (endOfSong) { - playSub(true); + if (song.loopModality!=2) { + playSub(true); + } } endOfSong=false; nextRow();