From 7e3cdbc5ac7a07ec1cc8b9d2d8ae0bca1c52506d Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Mon, 10 Aug 2020 16:23:38 +0000 Subject: [PATCH] - simplified sync git-svn-id: http://moon:8086/svn/software/trunk/projects/JaySynth@718 b431acfa-c32f-4a4a-93f1-934dc6c82436 --- Source/synth/lfo.c | 11 +++++------ Source/synth/lfo.h | 1 - 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Source/synth/lfo.c b/Source/synth/lfo.c index 591e954..ec456aa 100644 --- a/Source/synth/lfo.c +++ b/Source/synth/lfo.c @@ -81,7 +81,6 @@ void Sync_init(sync_t *pObj) { pObj->phase = 0; pObj->phase_ref = 0; - pObj->phase_adjusted = 0; pObj->omega = 0.0; pObj->accu = 0; pObj->klead = 1.0; @@ -103,12 +102,12 @@ int Sync_process(sync_t *pObj) { do_lfo_update = 1; pObj->phase_update = 0; - perr = (synth_float_t)Sync_mod(pObj->phase - pObj->phase_ref, 1.0) - (synth_float_t)0.5; -// SynthDebug("phase_ref=%f, phase=%f, perr=%f\n", pObj->phase_ref, pObj->phase_adjusted, perr); + synth_float_t phase_lo = Sync_mod(pObj->phase - 0.5, 1.0); + perr = (synth_float_t)Sync_mod(phase_lo - pObj->phase_ref, 1.0) - (synth_float_t)0.5; + SynthDebug("phase_ref=%f, phase_lo=%f, perr=%f\n", pObj->phase_ref, pObj->phase, perr); } - pObj->phase_adjusted = Sync_mod(pObj->phase - 0.5, 1.0); - pObj->omega = -(pObj->klag*pObj->accu + pObj->klead*perr); pObj->phase = Sync_mod(pObj->phase + pObj->omega, 1.0); + pObj->omega = -(pObj->klag*pObj->accu + pObj->klead*perr); pObj->accu += perr; return do_lfo_update; @@ -279,7 +278,7 @@ synth_float_t* LFO_ProcessDataV(lfo_t *pObj, UINT32 len) LFO_set_omega(pObj, pObj->sync.omega); SynthDebug("BPM=%f\n", pObj->sync.omega*pObj->fs*60); } - pObj->x = pObj->sync.phase_adjusted; + pObj->x = pObj->sync.phase; in = pObj->x + pObj->offset; pObj->out = pObj->smooth_a*pObj->out + pObj->smooth_b*in; diff --git a/Source/synth/lfo.h b/Source/synth/lfo.h index 1dcc6d0..9f2f6da 100644 --- a/Source/synth/lfo.h +++ b/Source/synth/lfo.h @@ -44,7 +44,6 @@ typedef struct _ssync_t { synth_float_t phase; synth_float_t phase_ref; - synth_float_t phase_adjusted; synth_float_t omega; synth_float_t klead;