summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorveplaini <victor.lazzarini@nuim.ie>2019-03-11 09:11:40 +0000
committerSam Hartman <hartmans@debian.org>2019-03-21 10:31:29 -0400
commit3626c357e44ef4afce8eaffb95c24926a5366574 (patch)
treeab22e7a2b7e14dd1343f85ff065715c52579129c
parentae004e2c04ff88fcc643e867325d5d968e89cf4d (diff)
applied diskgrain fix to syncgrain andsyncloop
Gbp-Pq: Name applied-diskgrain-fix-to-syncgrain-andsyncloop.patch
-rw-r--r--Opcodes/syncgrain.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/Opcodes/syncgrain.c b/Opcodes/syncgrain.c
index cb0b2bde..1dc19731 100644
--- a/Opcodes/syncgrain.c
+++ b/Opcodes/syncgrain.c
@@ -96,15 +96,16 @@ static int32_t syncgrain_process(CSOUND *csound, syncgrain *p)
int32_t numstreams = p->numstreams, olaps = p->olaps;
int32_t count = p->count, j, newstream;
int32_t datasize = p->datasize, envtablesize = p->envtablesize;
+ MYFLT pscale = p->sfunc->gen01args.sample_rate/CS_ESR;
- pitch = *p->pitch * p->sfunc->gen01args.sample_rate/CS_ESR;
+ pitch = *p->pitch * pscale;
fperiod = FABS(p->sfunc->gen01args.sample_rate/(*p->fr));
//if (UNLIKELY(fperiod < 0)) fperiod = -fperiod;
amp = *p->amp;
grsize = p->sfunc->gen01args.sample_rate * *p->grsize;
if (UNLIKELY(grsize<1)) goto err1;
envincr = envtablesize/grsize;
- prate = *p->prate;
+ prate = *p->prate * pscale;
if (UNLIKELY(offset)) memset(output, '\0', offset*sizeof(MYFLT));
if (UNLIKELY(early)) {
@@ -249,7 +250,7 @@ static int32_t syncgrainloop_process(CSOUND *csound, syncgrainloop *p)
int32_t loopsize;
int32_t firsttime = p->firsttime;
MYFLT sr = p->sfunc->gen01args.sample_rate;
-
+ MYFLT pscale = sr/CS_ESR;
/* loop points & checks */
loop_start = (int32_t) (*p->loop_start*sr);
loop_end = (int32_t) (*p->loop_end*sr);
@@ -260,7 +261,7 @@ static int32_t syncgrainloop_process(CSOUND *csound, syncgrainloop *p)
/*csound->Message(csound, "st:%d, end:%d, loopsize=%d\n",
loop_start, loop_end, loopsize); */
- pitch = *p->pitch * sr/CS_ESR;;
+ pitch = *p->pitch * pscale;
fperiod = FABS(sr/(*p->fr));
//if (UNLIKELY(fperiod < 0)) fperiod = -fperiod;
amp = *p->amp;
@@ -268,7 +269,7 @@ static int32_t syncgrainloop_process(CSOUND *csound, syncgrainloop *p)
if (UNLIKELY(grsize<1)) goto err1;
if (loopsize <= 0) loopsize = grsize;
envincr = envtablesize/grsize;
- prate = *p->prate;
+ prate = *p->prate * pscale;
if (UNLIKELY(offset)) memset(output, '\0', offset*sizeof(MYFLT));
if (UNLIKELY(early)) {