shithub: leaf

Download patch

ref: 4c483c67a639b349bdfdfc02b4388a679081cd51
parent: d1e38aa8820d43c4fda3dbb399805a232822a597
author: Matthew Wang <mjw7@princeton.edu>
date: Tue Feb 11 09:26:44 EST 2020

rename allocAndClear to calloc

--- a/LEAF/Inc/leaf-mempool.h
+++ b/LEAF/Inc/leaf-mempool.h
@@ -76,7 +76,7 @@
     void mpool_create (char* memory, size_t size, mpool_t* pool);
 
     void* mpool_alloc(size_t size, mpool_t* pool);
-    void* mpool_allocAndClear(size_t asize, mpool_t* pool);
+    void* mpool_calloc(size_t asize, mpool_t* pool);
 
     void mpool_free(void* ptr, mpool_t* pool);
     
@@ -86,7 +86,7 @@
     void leaf_pool_init(char* memory, size_t size);
     
     void* leaf_alloc(size_t size);
-    void* leaf_allocAndClear(size_t size);
+    void* leaf_calloc(size_t size);
 
     void leaf_free(void* ptr);
     
--- a/LEAF/Src/leaf-analysis.c
+++ b/LEAF/Src/leaf-analysis.c
@@ -156,7 +156,7 @@
 
 void tEnvPD_init(tEnvPD* const xpd, int ws, int hs, int bs)
 {
-    _tEnvPD* x = *xpd = (_tEnvPD*) leaf_allocAndClear(sizeof(_tEnvPD));
+    _tEnvPD* x = *xpd = (_tEnvPD*) leaf_calloc(sizeof(_tEnvPD));
     
     int period = hs, npoints = ws;
     
@@ -206,7 +206,7 @@
 void    tEnvPD_initToPool       (tEnvPD* const xpd, int ws, int hs, int bs, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tEnvPD* x = *xpd = (_tEnvPD*) mpool_allocAndClear(sizeof(_tEnvPD), &m->pool);
+    _tEnvPD* x = *xpd = (_tEnvPD*) mpool_calloc(sizeof(_tEnvPD), &m->pool);
     
     int period = hs, npoints = ws;
     
@@ -462,7 +462,7 @@
 
 void tSNAC_init(tSNAC* const snac, int overlaparg)
 {
-    _tSNAC* s = *snac = (_tSNAC*) leaf_allocAndClear(sizeof(_tSNAC));
+    _tSNAC* s = *snac = (_tSNAC*) leaf_calloc(sizeof(_tSNAC));
     
     s->biasfactor = DEFBIAS;
     s->timeindex = 0;
@@ -472,10 +472,10 @@
     s->minrms = DEFMINRMS;
     s->framesize = SNAC_FRAME_SIZE;
     
-    s->inputbuf = (float*) leaf_allocAndClear(sizeof(float) * SNAC_FRAME_SIZE);
-    s->processbuf = (float*) leaf_allocAndClear(sizeof(float) * (SNAC_FRAME_SIZE * 2));
-    s->spectrumbuf = (float*) leaf_allocAndClear(sizeof(float) * (SNAC_FRAME_SIZE / 2));
-    s->biasbuf = (float*) leaf_allocAndClear(sizeof(float) * SNAC_FRAME_SIZE);
+    s->inputbuf = (float*) leaf_calloc(sizeof(float) * SNAC_FRAME_SIZE);
+    s->processbuf = (float*) leaf_calloc(sizeof(float) * (SNAC_FRAME_SIZE * 2));
+    s->spectrumbuf = (float*) leaf_calloc(sizeof(float) * (SNAC_FRAME_SIZE / 2));
+    s->biasbuf = (float*) leaf_calloc(sizeof(float) * SNAC_FRAME_SIZE);
     
     snac_biasbuf(snac);
     tSNAC_setOverlap(snac, overlaparg);
@@ -505,10 +505,10 @@
     s->minrms = DEFMINRMS;
     s->framesize = SNAC_FRAME_SIZE;
 
-    s->inputbuf = (float*) mpool_allocAndClear(sizeof(float) * SNAC_FRAME_SIZE, &m->pool);
-    s->processbuf = (float*) mpool_allocAndClear(sizeof(float) * (SNAC_FRAME_SIZE * 2), &m->pool);
-    s->spectrumbuf = (float*) mpool_allocAndClear(sizeof(float) * (SNAC_FRAME_SIZE / 2), &m->pool);
-    s->biasbuf = (float*) mpool_allocAndClear(sizeof(float) * SNAC_FRAME_SIZE, &m->pool);
+    s->inputbuf = (float*) mpool_calloc(sizeof(float) * SNAC_FRAME_SIZE, &m->pool);
+    s->processbuf = (float*) mpool_calloc(sizeof(float) * (SNAC_FRAME_SIZE * 2), &m->pool);
+    s->spectrumbuf = (float*) mpool_calloc(sizeof(float) * (SNAC_FRAME_SIZE / 2), &m->pool);
+    s->biasbuf = (float*) mpool_calloc(sizeof(float) * SNAC_FRAME_SIZE, &m->pool);
     
     snac_biasbuf(snac);
     tSNAC_setOverlap(snac, overlaparg);
@@ -840,7 +840,7 @@
 //===========================================================================
 void    tPeriodDetection_init    (tPeriodDetection* const pd, float* in, float* out, int bufSize, int frameSize)
 {
-    _tPeriodDetection* p = *pd = (_tPeriodDetection*) leaf_allocAndClear(sizeof(_tPeriodDetection));
+    _tPeriodDetection* p = *pd = (_tPeriodDetection*) leaf_calloc(sizeof(_tPeriodDetection));
     
     p->inBuffer = in;
     p->outBuffer = out;
@@ -875,7 +875,7 @@
 void    tPeriodDetection_initToPool  (tPeriodDetection* const pd, float* in, float* out, int bufSize, int frameSize, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tPeriodDetection* p = *pd = (_tPeriodDetection*) mpool_allocAndClear(sizeof(_tPeriodDetection), &m->pool);
+    _tPeriodDetection* p = *pd = (_tPeriodDetection*) mpool_calloc(sizeof(_tPeriodDetection), &m->pool);
     
     p->inBuffer = in;
     p->outBuffer = out;
--- a/LEAF/Src/leaf-delay.c
+++ b/LEAF/Src/leaf-delay.c
@@ -187,7 +187,7 @@
     else if (delay < 0.0f)  d->delay = 0.0f;
     else                    d->delay = delay;
     
-    d->buff = (float*) leaf_allocAndClear(sizeof(float) * maxDelay);
+    d->buff = (float*) leaf_calloc(sizeof(float) * maxDelay);
     
     d->gain = 1.0f;
     
--- a/LEAF/Src/leaf-effects.c
+++ b/LEAF/Src/leaf-effects.c
@@ -506,10 +506,10 @@
 // init
 void     tSOLAD_init(tSOLAD* const wp)
 {
-    _tSOLAD* w = *wp = (_tSOLAD*) leaf_allocAndClear(sizeof(_tSOLAD));
+    _tSOLAD* w = *wp = (_tSOLAD*) leaf_calloc(sizeof(_tSOLAD));
     
     w->pitchfactor = 1.;
-    w->delaybuf = (float*) leaf_allocAndClear(sizeof(float) * (LOOPSIZE+16));
+    w->delaybuf = (float*) leaf_calloc(sizeof(float) * (LOOPSIZE+16));
     
     solad_init(w);
 }
@@ -526,10 +526,10 @@
 {
     _tMempool* m = *mp;
 
-    _tSOLAD* w = *wp = (_tSOLAD*) mpool_allocAndClear(sizeof(_tSOLAD), &m->pool);
+    _tSOLAD* w = *wp = (_tSOLAD*) mpool_calloc(sizeof(_tSOLAD), &m->pool);
     
     w->pitchfactor = 1.;
-    w->delaybuf = (float*) mpool_allocAndClear(sizeof(float) * (LOOPSIZE+16), &m->pool);
+    w->delaybuf = (float*) mpool_calloc(sizeof(float) * (LOOPSIZE+16), &m->pool);
 
     solad_init(w);
 }
@@ -875,7 +875,7 @@
 
 void tPitchShift_init (tPitchShift* const psr, tPeriodDetection* pd, float* out, int bufSize)
 {
-    _tPitchShift* ps = *psr = (_tPitchShift*) leaf_allocAndClear(sizeof(_tPitchShift));
+    _tPitchShift* ps = *psr = (_tPitchShift*) leaf_calloc(sizeof(_tPitchShift));
     _tPeriodDetection* p = *pd;
     
     ps->p = pd;
@@ -909,7 +909,7 @@
 {
     _tMempool* m = *mp;
 
-    _tPitchShift* ps = *psr = (_tPitchShift*) mpool_allocAndClear(sizeof(_tPitchShift), &m->pool);
+    _tPitchShift* ps = *psr = (_tPitchShift*) mpool_calloc(sizeof(_tPitchShift), &m->pool);
 
     _tPeriodDetection* p = *pd;
     
@@ -1060,14 +1060,14 @@
 
 void tRetune_init(tRetune* const rt, int numVoices, int bufSize, int frameSize)
 {
-    _tRetune* r = *rt = (_tRetune*) leaf_allocAndClear(sizeof(_tRetune));
+    _tRetune* r = *rt = (_tRetune*) leaf_calloc(sizeof(_tRetune));
     
     r->bufSize = bufSize;
     r->frameSize = frameSize;
     r->numVoices = numVoices;
     
-    r->inBuffer = (float*) leaf_allocAndClear(sizeof(float) * r->bufSize);
-    r->outBuffers = (float**) leaf_allocAndClear(sizeof(float*) * r->numVoices);
+    r->inBuffer = (float*) leaf_calloc(sizeof(float) * r->bufSize);
+    r->outBuffers = (float**) leaf_calloc(sizeof(float*) * r->numVoices);
     
     r->hopSize = DEFHOPSIZE;
     r->windowSize = DEFWINDOWSIZE;
@@ -1076,12 +1076,12 @@
     
     r->inputPeriod = 0.0f;
     
-    r->ps = (tPitchShift*) leaf_allocAndClear(sizeof(tPitchShift) * r->numVoices);
-    r->pitchFactor = (float*) leaf_allocAndClear(sizeof(float) * r->numVoices);
-    r->tickOutput = (float*) leaf_allocAndClear(sizeof(float) * r->numVoices);
+    r->ps = (tPitchShift*) leaf_calloc(sizeof(tPitchShift) * r->numVoices);
+    r->pitchFactor = (float*) leaf_calloc(sizeof(float) * r->numVoices);
+    r->tickOutput = (float*) leaf_calloc(sizeof(float) * r->numVoices);
     for (int i = 0; i < r->numVoices; ++i)
     {
-        r->outBuffers[i] = (float*) leaf_allocAndClear(sizeof(float) * r->bufSize);
+        r->outBuffers[i] = (float*) leaf_calloc(sizeof(float) * r->bufSize);
     }
     
     tPeriodDetection_init(&r->pd, r->inBuffer, r->outBuffers[0], r->bufSize, r->frameSize);
@@ -1119,8 +1119,8 @@
     r->frameSize = frameSize;
     r->numVoices = numVoices;
     
-    r->inBuffer = (float*) mpool_allocAndClear(sizeof(float) * r->bufSize, &m->pool);
-    r->outBuffers = (float**) mpool_allocAndClear(sizeof(float*) * r->numVoices, &m->pool);
+    r->inBuffer = (float*) mpool_calloc(sizeof(float) * r->bufSize, &m->pool);
+    r->outBuffers = (float**) mpool_calloc(sizeof(float*) * r->numVoices, &m->pool);
     
     r->hopSize = DEFHOPSIZE;
     r->windowSize = DEFWINDOWSIZE;
@@ -1129,12 +1129,12 @@
     
     r->inputPeriod = 0.0f;
 
-    r->ps = (tPitchShift*) mpool_allocAndClear(sizeof(tPitchShift) * r->numVoices, &m->pool);
-    r->pitchFactor = (float*) mpool_allocAndClear(sizeof(float) * r->numVoices, &m->pool);
-    r->tickOutput = (float*) mpool_allocAndClear(sizeof(float) * r->numVoices, &m->pool);
+    r->ps = (tPitchShift*) mpool_calloc(sizeof(tPitchShift) * r->numVoices, &m->pool);
+    r->pitchFactor = (float*) mpool_calloc(sizeof(float) * r->numVoices, &m->pool);
+    r->tickOutput = (float*) mpool_calloc(sizeof(float) * r->numVoices, &m->pool);
     for (int i = 0; i < r->numVoices; ++i)
     {
-        r->outBuffers[i] = (float*) mpool_allocAndClear(sizeof(float) * r->bufSize, &m->pool);
+        r->outBuffers[i] = (float*) mpool_calloc(sizeof(float) * r->bufSize, &m->pool);
     }
     
     tPeriodDetection_initToPool(&r->pd, r->inBuffer, r->outBuffers[0], r->bufSize, r->frameSize, mp);
@@ -1490,15 +1490,15 @@
     _tFormantShifter* fs = *fsr = (_tFormantShifter*) leaf_alloc(sizeof(_tFormantShifter));
     
     fs->ford = order;
-    fs->fk = (float*) leaf_allocAndClear(sizeof(float) * fs->ford);
-    fs->fb = (float*) leaf_allocAndClear(sizeof(float) * fs->ford);
-    fs->fc = (float*) leaf_allocAndClear(sizeof(float) * fs->ford);
-    fs->frb = (float*) leaf_allocAndClear(sizeof(float) * fs->ford);
-    fs->frc = (float*) leaf_allocAndClear(sizeof(float) * fs->ford);
-    fs->fsig = (float*) leaf_allocAndClear(sizeof(float) * fs->ford);
-    fs->fsmooth = (float*) leaf_allocAndClear(sizeof(float) * fs->ford);
-    fs->ftvec = (float*) leaf_allocAndClear(sizeof(float) * fs->ford);
-    fs->fbuff = (float*) leaf_allocAndClear(sizeof(float*) * fs->ford);
+    fs->fk = (float*) leaf_calloc(sizeof(float) * fs->ford);
+    fs->fb = (float*) leaf_calloc(sizeof(float) * fs->ford);
+    fs->fc = (float*) leaf_calloc(sizeof(float) * fs->ford);
+    fs->frb = (float*) leaf_calloc(sizeof(float) * fs->ford);
+    fs->frc = (float*) leaf_calloc(sizeof(float) * fs->ford);
+    fs->fsig = (float*) leaf_calloc(sizeof(float) * fs->ford);
+    fs->fsmooth = (float*) leaf_calloc(sizeof(float) * fs->ford);
+    fs->ftvec = (float*) leaf_calloc(sizeof(float) * fs->ford);
+    fs->fbuff = (float*) leaf_calloc(sizeof(float*) * fs->ford);
 
     fs->falph = powf(0.001f, 40.0f * leaf.invSampleRate);
     fs->flamb = -(0.8517f*sqrtf(atanf(0.06583f*leaf.sampleRate))-0.1916f);
@@ -1542,16 +1542,16 @@
     _tFormantShifter* fs = *fsr = (_tFormantShifter*) mpool_alloc(sizeof(_tFormantShifter), &m->pool);
     
     fs->ford = order;
-    fs->fk = (float*) mpool_allocAndClear(sizeof(float) * fs->ford, &m->pool);
-    fs->fb = (float*) mpool_allocAndClear(sizeof(float) * fs->ford, &m->pool);
-    fs->fc = (float*) mpool_allocAndClear(sizeof(float) * fs->ford, &m->pool);
-    fs->frb = (float*) mpool_allocAndClear(sizeof(float) * fs->ford, &m->pool);
-    fs->frc = (float*) mpool_allocAndClear(sizeof(float) * fs->ford, &m->pool);
-    fs->fsig = (float*) mpool_allocAndClear(sizeof(float) * fs->ford, &m->pool);
-    fs->fsmooth = (float*) mpool_allocAndClear(sizeof(float) * fs->ford, &m->pool);
-    fs->ftvec = (float*) mpool_allocAndClear(sizeof(float) * fs->ford, &m->pool);
+    fs->fk = (float*) mpool_calloc(sizeof(float) * fs->ford, &m->pool);
+    fs->fb = (float*) mpool_calloc(sizeof(float) * fs->ford, &m->pool);
+    fs->fc = (float*) mpool_calloc(sizeof(float) * fs->ford, &m->pool);
+    fs->frb = (float*) mpool_calloc(sizeof(float) * fs->ford, &m->pool);
+    fs->frc = (float*) mpool_calloc(sizeof(float) * fs->ford, &m->pool);
+    fs->fsig = (float*) mpool_calloc(sizeof(float) * fs->ford, &m->pool);
+    fs->fsmooth = (float*) mpool_calloc(sizeof(float) * fs->ford, &m->pool);
+    fs->ftvec = (float*) mpool_calloc(sizeof(float) * fs->ford, &m->pool);
     
-    fs->fbuff = (float*) mpool_allocAndClear(sizeof(float*) * fs->ford, &m->pool);
+    fs->fbuff = (float*) mpool_calloc(sizeof(float*) * fs->ford, &m->pool);
 
     
     fs->falph = powf(0.001f, 10.0f * leaf.invSampleRate);
--- a/LEAF/Src/leaf-filters.c
+++ b/LEAF/Src/leaf-filters.c
@@ -1040,7 +1040,7 @@
 void    tHighpass_initToPool    (tHighpass* const ft, float freq, tMempool* const mp)
 {
     _tMempool* m = *mp;
-    _tHighpass* f = *ft = (_tHighpass*) mpool_allocAndClear(sizeof(_tHighpass), &m->pool);
+    _tHighpass* f = *ft = (_tHighpass*) mpool_calloc(sizeof(_tHighpass), &m->pool);
     
     f->R = (1.0f - (freq * leaf.twoPiTimesInvSampleRate));
     f->ys = 0.0f;
--- a/LEAF/Src/leaf-mempool.c
+++ b/LEAF/Src/leaf-mempool.c
@@ -145,7 +145,7 @@
 /**
  * allocate memory from memory pool and also clear that memory to be blank
  */
-void* mpool_allocAndClear(size_t asize, mpool_t* pool)
+void* mpool_calloc(size_t asize, mpool_t* pool)
 {
     // If the head is NULL, the mempool is full
     if (pool->head == NULL) return NULL;
@@ -213,10 +213,10 @@
     return block;
 }
 
-void* leaf_allocAndClear(size_t size)
+void* leaf_calloc(size_t size)
 {
     //printf("alloc %i\n", size);
-    void* block = mpool_allocAndClear(size, &leaf_pool->pool);
+    void* block = mpool_calloc(size, &leaf_pool->pool);
     
     if (block == NULL) leaf_mempool_overrun();
     
--- a/LEAF_JUCEPlugin/JuceLibraryCode/AppConfig.h
+++ b/LEAF_JUCEPlugin/JuceLibraryCode/AppConfig.h
@@ -47,7 +47,7 @@
 
 #define JUCE_USE_DARK_SPLASH_SCREEN 1
 
-#define JUCE_PROJUCER_VERSION 0x50405
+#define JUCE_PROJUCER_VERSION 0x50407
 
 //==============================================================================
 #define JUCE_MODULE_AVAILABLE_juce_audio_basics             1
@@ -157,6 +157,10 @@
  //#define JUCE_USE_STUDIO_ONE_COMPATIBLE_PARAMETERS 1
 #endif
 
+#ifndef    JUCE_AU_WRAPPERS_SAVE_PROGRAM_STATES
+ //#define JUCE_AU_WRAPPERS_SAVE_PROGRAM_STATES 0
+#endif
+
 #ifndef    JUCE_STANDALONE_FILTER_WINDOW_USE_KIOSK_MODE
  //#define JUCE_STANDALONE_FILTER_WINDOW_USE_KIOSK_MODE 0
 #endif
@@ -237,8 +241,8 @@
 //==============================================================================
 // juce_events flags:
 
-#ifndef    JUCE_EXECUTE_APP_SUSPEND_ON_IOS_BACKGROUND_TASK
- //#define JUCE_EXECUTE_APP_SUSPEND_ON_IOS_BACKGROUND_TASK 0
+#ifndef    JUCE_EXECUTE_APP_SUSPEND_ON_BACKGROUND_TASK
+ //#define JUCE_EXECUTE_APP_SUSPEND_ON_BACKGROUND_TASK 0
 #endif
 
 //==============================================================================
--- a/LEAF_JUCEPlugin/LEAF.jucer
+++ b/LEAF_JUCEPlugin/LEAF.jucer
@@ -8,7 +8,7 @@
               pluginIsSynth="0" pluginWantsMidiIn="1" pluginProducesMidiOut="0"
               pluginIsMidiEffectPlugin="0" pluginEditorRequiresKeys="0" pluginAUExportPrefix="LEAFAU"
               pluginRTASCategory="" aaxIdentifier="com.pumusic.LEAF" pluginAAXCategory="2"
-              jucerVersion="5.4.5" companyName="Princeton University" companyEmail="mrmulshine@gmail.com"
+              jucerVersion="5.4.7" companyName="Princeton University" companyEmail="mrmulshine@gmail.com"
               displaySplashScreen="1" reportAppUsage="1" splashScreenColour="Dark"
               buildStandalone="1" enableIAA="0" cppLanguageStandard="11" companyCopyright="Princeton University"
               pluginFormats="buildVST,buildAU,buildStandalone" pluginCharacteristicsValue="pluginWantsMidiIn">