int sp_revsc_init(sp_data *sp, sp_revsc *p) { p->iSampleRate = sp->sr; p->sampleRate = sp->sr; p->feedback = 0.97; p->lpfreq = 10000; p->iPitchMod = 1; p->iSkipInit = 0; p->dampFact = 1.0; p->prv_LPFreq = 0.0; p->initDone = 1; int i, nBytes = 0; for(i = 0; i < 8; i++){ nBytes += delay_line_bytes_alloc(sp->sr, 1, i); } sp_auxdata_alloc(&p->aux, nBytes); nBytes = 0; for (i = 0; i < 8; i++) { p->delayLines[i].buf = (p->aux.ptr) + nBytes; init_delay_line(p, &p->delayLines[i], i); nBytes += delay_line_bytes_alloc(sp->sr, 1, i); } return SP_OK; }
void effect_screverb_setup(y_synth_t *synth) { SC_REVERB *p = (SC_REVERB *)synth->effect_buffer; int i; /* set up delay lines */ for (i = 0; i < 8; i++) init_delay_line(synth, p, &p->delayLines[i], i); p->dampFact = 1.0; p->prv_LPFreq = -1.0f; }
static int32_t sc_reverb_init(CSOUND *csound, SC_REVERB *p) { int32_t i; int32_t nBytes; /* check for valid parameters */ if (UNLIKELY(*(p->iSampleRate) <= FL(0.0))) p->sampleRate = (double) CS_ESR; else p->sampleRate = (double) *(p->iSampleRate); if (UNLIKELY(p->sampleRate < MIN_SRATE || p->sampleRate > MAX_SRATE)) { return csound->InitError(csound, Str("reverbsc: sample rate is out of range")); } if (UNLIKELY(*(p->iPitchMod) < FL(0.0) || *(p->iPitchMod) > (MYFLT) MAX_PITCHMOD)) { return csound->InitError(csound, Str("reverbsc: invalid pitch modulation factor")); } /* calculate the number of bytes to allocate */ nBytes = 0; for (i = 0; i < 8; i++) nBytes += delay_line_bytes_alloc(p, i); if (nBytes != (int32_t)p->auxData.size) csound->AuxAlloc(csound, (size_t) nBytes, &(p->auxData)); else if (p->initDone && *(p->iSkipInit) != FL(0.0)) return OK; /* skip initialisation if requested */ /* set up delay lines */ nBytes = 0; for (i = 0; i < 8; i++) { p->delayLines[i] = (delayLine*) ((unsigned char*) (p->auxData.auxp) + (int32_t) nBytes); init_delay_line(p, p->delayLines[i], i); nBytes += delay_line_bytes_alloc(p, i); } p->dampFact = 1.0; p->prv_LPFreq = FL(0.0); p->initDone = 1; return OK; }