aboutsummaryrefslogtreecommitdiff
path: root/fmdriver
diff options
context:
space:
mode:
Diffstat (limited to 'fmdriver')
-rw-r--r--fmdriver/fmdriver.h5
-rw-r--r--fmdriver/fmdriver_fmp.c3
-rw-r--r--fmdriver/fmdriver_pmd.c5
3 files changed, 13 insertions, 0 deletions
diff --git a/fmdriver/fmdriver.h b/fmdriver/fmdriver.h
index 9f3afee..aebe27e 100644
--- a/fmdriver/fmdriver.h
+++ b/fmdriver/fmdriver.h
@@ -100,6 +100,11 @@ struct fmdriver_work {
bool pcmerror[2];
uint8_t ssg_noise_freq;
struct fmdriver_track_status track_status[FMDRIVER_TRACK_NUM];
+ uint8_t loop_cnt;
+ // current timerb count
+ uint32_t timerb_cnt;
+ // loop length
+ uint32_t loop_timerb_cnt;
// fm3ex part map
};
diff --git a/fmdriver/fmdriver_fmp.c b/fmdriver/fmdriver_fmp.c
index cc6f1a6..41d0a48 100644
--- a/fmdriver/fmdriver_fmp.c
+++ b/fmdriver/fmdriver_fmp.c
@@ -875,6 +875,7 @@ static bool fmp_cmd74_loop(struct fmdriver_work *work,
}
// 248c
fmp->loop_cnt++;
+ work->loop_cnt = fmp->loop_cnt;
fmp->part_loop_bit = fmp->part_playing_bit;
// al=2; 1b64();
}
@@ -891,6 +892,7 @@ static bool fmp_cmd74_loop(struct fmdriver_work *work,
// 3e16();
fmp->status.stopped = true;
fmp->status.looped = true;
+ work->loop_cnt = -1;
}
// 24f0
if (!part->type.rhythm) {
@@ -3148,6 +3150,7 @@ static void fmp_opna_interrupt(struct fmdriver_work *work) {
struct driver_fmp *fmp = (struct driver_fmp *)work->driver;
if (work->opna_status(work, 0) & 0x02) {
fmp_timerb(work, fmp);
+ work->timerb_cnt++;
}
}
diff --git a/fmdriver/fmdriver_pmd.c b/fmdriver/fmdriver_pmd.c
index 7090fc8..14459a5 100644
--- a/fmdriver/fmdriver_pmd.c
+++ b/fmdriver/fmdriver_pmd.c
@@ -5486,6 +5486,9 @@ static void pmd_proc_parts(
struct fmdriver_work *work,
struct driver_pmd *pmd
) {
+ pmd->loop.looped = true;
+ pmd->loop.ended = true;
+ pmd->loop.env = false;
if (!pmd->opm_flag) {
for (int c = 0; c < 3; c++) {
pmd->proc_ch = c+1;
@@ -5538,6 +5541,7 @@ static void pmd_proc_parts(
} else {
pmd->status2 = 0xff;
}
+ work->loop_cnt = pmd->status2;
}
// 3e2e
@@ -5623,6 +5627,7 @@ static void pmd_timer(
}
if (status & 2) {
pmd_timerb(work, pmd);
+ work->timerb_cnt++;
}
}