[vlc-commits] [Git][videolan/vlc][master] 4 commits: audio_filter: spatializer: make members private

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Oct 10 06:02:39 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
d86e01d6 by Tristan Matthews at 2025-10-10T05:47:46+00:00
audio_filter: spatializer: make members private

- - - - -
7da580da by Tristan Matthews at 2025-10-10T05:47:46+00:00
audio_filter: spatializer: drop unused getters

- - - - -
e4356625 by Tristan Matthews at 2025-10-10T05:47:46+00:00
audio_filter: spatializer: initialize members earlier

N.B. It doesn't seem like any of these values were actually used uninitialized.

Fixes CID 1002951 and CID 1002952

- - - - -
d02452cb by Tristan Matthews at 2025-10-10T05:47:46+00:00
audio_filter: spatializer: cosmetics

- - - - -


6 changed files:

- modules/audio_filter/spatializer/allpass.cpp
- modules/audio_filter/spatializer/allpass.hpp
- modules/audio_filter/spatializer/comb.cpp
- modules/audio_filter/spatializer/comb.hpp
- modules/audio_filter/spatializer/revmodel.cpp
- modules/audio_filter/spatializer/revmodel.hpp


Changes:

=====================================
modules/audio_filter/spatializer/allpass.cpp
=====================================
@@ -7,16 +7,12 @@
 #include "allpass.hpp"
 #include <stddef.h>
 
-allpass::allpass()
+allpass::allpass(float *buf, int size) :
+    feedback(0.5f),
+    buffer(buf),
+    bufsize(size),
+    bufidx(0)
 {
-    bufidx = 0;
-    buffer = NULL;
-}
-
-void allpass::setbuffer(float *buf, int size)
-{
-    buffer = buf;
-    bufsize = size;
 }
 
 void allpass::mute()
@@ -30,9 +26,4 @@ void allpass::setfeedback(float val)
     feedback = val;
 }
 
-float allpass::getfeedback()
-{
-    return feedback;
-}
-
 //ends


=====================================
modules/audio_filter/spatializer/allpass.hpp
=====================================
@@ -11,15 +11,13 @@
 class allpass
 {
 public:
-        allpass();
-    void    setbuffer(float *buf, int size);
-    inline  float    process(float inp);
-    void    mute();
-    void    setfeedback(float val);
-    float    getfeedback();
-// private:
-    float    feedback;
-    float    *buffer;
+    allpass(float *buf, int size);
+    inline float process(float inp);
+    void   mute();
+    void   setfeedback(float val);
+private:
+    float  feedback;
+    float  *buffer;
     int    bufsize;
     int    bufidx;
 };


=====================================
modules/audio_filter/spatializer/comb.cpp
=====================================
@@ -7,17 +7,15 @@
 #include "comb.hpp"
 #include <stddef.h>
 
-comb::comb()
+comb::comb(float *buf, int size) :
+    feedback(0.0f),
+    filterstore(0.0f),
+    damp1(0.0f),
+    damp2(0.0f),
+    buffer(buf),
+    bufsize(size),
+    bufidx(0)
 {
-    filterstore = 0;
-    bufidx = 0;
-    buffer = NULL;
-}
-
-void comb::setbuffer(float *buf, int size)
-{
-    buffer = buf;
-    bufsize = size;
 }
 
 void comb::mute()
@@ -32,19 +30,9 @@ void comb::setdamp(float val)
     damp2 = 1-val;
 }
 
-float comb::getdamp()
-{
-    return damp1;
-}
-
 void comb::setfeedback(float val)
 {
     feedback = val;
 }
 
-float comb::getfeedback()
-{
-    return feedback;
-}
-
 // ends


=====================================
modules/audio_filter/spatializer/comb.hpp
=====================================
@@ -16,20 +16,17 @@
 class comb
 {
 public:
-    comb();
-    void    setbuffer(float *buf, int size);
-    inline  float    process(float inp);
-    void    mute();
-    void    setdamp(float val);
-    float    getdamp();
-    void    setfeedback(float val);
-    float    getfeedback();
+    comb(float *buf, int size);
+    inline float process(float inp);
+    void   mute();
+    void   setdamp(float val);
+    void   setfeedback(float val);
 private:
-    float    feedback;
-    float    filterstore;
-    float    damp1;
-    float    damp2;
-    float    *buffer;
+    float  feedback;
+    float  filterstore;
+    float  damp1;
+    float  damp2;
+    float  *buffer;
     int    bufsize;
     int    bufidx;
 };


=====================================
modules/audio_filter/spatializer/revmodel.cpp
=====================================
@@ -15,50 +15,27 @@
 #include "tuning.h"
 #include <stdlib.h>
 
-revmodel::revmodel() : roomsize(initialroom), damp(initialdamp),
-                       wet(initialwet), dry(initialdry), width(1.), mode(0.)
+revmodel::revmodel() : roomsize(initialroom*scaleroom + offsetroom),
+                       damp(initialdamp*scaledamp),
+                       wet(initialwet*scalewet),
+                       dry(initialdry*scaledry),
+                       width(initialwidth),
+                       mode(initialmode),
+                       // Tie the components to their buffers
+                       combL {    {bufcombL1, combtuningL1}, {bufcombL2, combtuningL2},
+                                  {bufcombL3, combtuningL3}, {bufcombL4, combtuningL4},
+                                  {bufcombL5, combtuningL5}, {bufcombL6, combtuningL6},
+                                  {bufcombL7, combtuningL7}, {bufcombL8, combtuningL8} },
+                       combR {    {bufcombR1, combtuningR1}, {bufcombR2, combtuningR2},
+                                  {bufcombR3, combtuningR3}, {bufcombR4, combtuningR4},
+                                  {bufcombR5, combtuningR5}, {bufcombR6, combtuningR6},
+                                  {bufcombR7, combtuningR7}, {bufcombR8, combtuningR8} },
+                       allpassL { {bufallpassL1, allpasstuningL1}, {bufallpassL2, allpasstuningL2},
+                                  {bufallpassL3, allpasstuningL3}, {bufallpassL4, allpasstuningL4} },
+                       allpassR { {bufallpassR1, allpasstuningR1}, {bufallpassR2, allpasstuningR2},
+                                  {bufallpassR3, allpasstuningR3}, {bufallpassR4, allpasstuningR4} }
 {
-    // Tie the components to their buffers
-    combL[0].setbuffer(bufcombL1,combtuningL1);
-    combR[0].setbuffer(bufcombR1,combtuningR1);
-    combL[1].setbuffer(bufcombL2,combtuningL2);
-    combR[1].setbuffer(bufcombR2,combtuningR2);
-    combL[2].setbuffer(bufcombL3,combtuningL3);
-    combR[2].setbuffer(bufcombR3,combtuningR3);
-    combL[3].setbuffer(bufcombL4,combtuningL4);
-    combR[3].setbuffer(bufcombR4,combtuningR4);
-    combL[4].setbuffer(bufcombL5,combtuningL5);
-    combR[4].setbuffer(bufcombR5,combtuningR5);
-    combL[5].setbuffer(bufcombL6,combtuningL6);
-    combR[5].setbuffer(bufcombR6,combtuningR6);
-    combL[6].setbuffer(bufcombL7,combtuningL7);
-    combR[6].setbuffer(bufcombR7,combtuningR7);
-    combL[7].setbuffer(bufcombL8,combtuningL8);
-    combR[7].setbuffer(bufcombR8,combtuningR8);
-    allpassL[0].setbuffer(bufallpassL1,allpasstuningL1);
-    allpassR[0].setbuffer(bufallpassR1,allpasstuningR1);
-    allpassL[1].setbuffer(bufallpassL2,allpasstuningL2);
-    allpassR[1].setbuffer(bufallpassR2,allpasstuningR2);
-    allpassL[2].setbuffer(bufallpassL3,allpasstuningL3);
-    allpassR[2].setbuffer(bufallpassR3,allpasstuningR3);
-    allpassL[3].setbuffer(bufallpassL4,allpasstuningL4);
-    allpassR[3].setbuffer(bufallpassR4,allpasstuningR4);
-
-    // Set default values
-    allpassL[0].setfeedback(0.5f);
-    allpassR[0].setfeedback(0.5f);
-    allpassL[1].setfeedback(0.5f);
-    allpassR[1].setfeedback(0.5f);
-    allpassL[2].setfeedback(0.5f);
-    allpassR[2].setfeedback(0.5f);
-    allpassL[3].setfeedback(0.5f);
-    allpassR[3].setfeedback(0.5f);
-    setwet(initialwet);
-    setroomsize(initialroom);
-    setdry(initialdry);
-    setdamp(initialdamp);
-    setwidth(initialwidth);
-    setmode(initialmode);
+    update();
 
     // Buffer will be full of rubbish - so we MUST mute them
     mute();
@@ -188,7 +165,7 @@ void revmodel::update()
     }
 }
 
-// The following get/set functions are not inlined, because
+// The following set functions are not inlined, because
 // speed is never an issue when calling them, and also
 // because as you develop the reverb model, you may
 // wish to take dynamic action when they are called.
@@ -199,54 +176,29 @@ void revmodel::setroomsize(float value)
     update();
 }
 
-float revmodel::getroomsize()
-{
-    return (roomsize-offsetroom)/scaleroom;
-}
-
 void revmodel::setdamp(float value)
 {
     damp = value*scaledamp;
     update();
 }
 
-float revmodel::getdamp()
-{
-    return damp/scaledamp;
-}
-
 void revmodel::setwet(float value)
 {
     wet = value*scalewet;
     update();
 }
 
-float revmodel::getwet()
-{
-    return wet/scalewet;
-}
-
 void revmodel::setdry(float value)
 {
     dry = value*scaledry;
 }
 
-float revmodel::getdry()
-{
-    return dry/scaledry;
-}
-
 void revmodel::setwidth(float value)
 {
     width = value;
     update();
 }
 
-float revmodel::getwidth()
-{
-    return width;
-}
-
 void revmodel::setmode(float value)
 {
     mode = value;


=====================================
modules/audio_filter/spatializer/revmodel.hpp
=====================================
@@ -23,66 +23,61 @@ public:
     void    processreplace(float *inputL, float *outputL, long numsamples, int skip);
     void    processmix(float *inputL, float *outputL, long numsamples, int skip);
     void    setroomsize(float value);
-    float    getroomsize();
     void    setdamp(float value);
-    float    getdamp();
     void    setwet(float value);
-    float    getwet();
     void    setdry(float value);
-    float    getdry();
     void    setwidth(float value);
-    float    getwidth();
     void    setmode(float value);
 private:
     void    update();
 private:
-    float    gain;
-    float    roomsize,roomsize1;
-    float    damp,damp1;
-    float    wet,wet1,wet2;
-    float    dry;
-    float    width;
-    float    mode;
+    float   gain;
+    float   roomsize,roomsize1;
+    float   damp,damp1;
+    float   wet,wet1,wet2;
+    float   dry;
+    float   width;
+    float   mode;
 
 // The following are all declared inline
 // to remove the need for dynamic allocation
 // with its subsequent error-checking messiness
 
-// Comb filters
+    // Comb filters
     comb    combL[numcombs];
     comb    combR[numcombs];
 
     // Allpass filters
-    allpass    allpassL[numallpasses];
-    allpass    allpassR[numallpasses];
+    allpass allpassL[numallpasses];
+    allpass allpassR[numallpasses];
 
     // Buffers for the combs
-    float    bufcombL1[combtuningL1];
-    float    bufcombR1[combtuningR1];
-    float    bufcombL2[combtuningL2];
-    float    bufcombR2[combtuningR2];
-    float    bufcombL3[combtuningL3];
-    float    bufcombR3[combtuningR3];
-    float    bufcombL4[combtuningL4];
-    float    bufcombR4[combtuningR4];
-    float    bufcombL5[combtuningL5];
-    float    bufcombR5[combtuningR5];
-    float    bufcombL6[combtuningL6];
-    float    bufcombR6[combtuningR6];
-    float    bufcombL7[combtuningL7];
-    float    bufcombR7[combtuningR7];
-    float    bufcombL8[combtuningL8];
-    float    bufcombR8[combtuningR8];
+    float   bufcombL1[combtuningL1];
+    float   bufcombR1[combtuningR1];
+    float   bufcombL2[combtuningL2];
+    float   bufcombR2[combtuningR2];
+    float   bufcombL3[combtuningL3];
+    float   bufcombR3[combtuningR3];
+    float   bufcombL4[combtuningL4];
+    float   bufcombR4[combtuningR4];
+    float   bufcombL5[combtuningL5];
+    float   bufcombR5[combtuningR5];
+    float   bufcombL6[combtuningL6];
+    float   bufcombR6[combtuningR6];
+    float   bufcombL7[combtuningL7];
+    float   bufcombR7[combtuningR7];
+    float   bufcombL8[combtuningL8];
+    float   bufcombR8[combtuningR8];
 
     // Buffers for the allpasses
-    float    bufallpassL1[allpasstuningL1];
-    float    bufallpassR1[allpasstuningR1];
-    float    bufallpassL2[allpasstuningL2];
-    float    bufallpassR2[allpasstuningR2];
-    float    bufallpassL3[allpasstuningL3];
-    float    bufallpassR3[allpasstuningR3];
-    float    bufallpassL4[allpasstuningL4];
-    float    bufallpassR4[allpasstuningR4];
+    float   bufallpassL1[allpasstuningL1];
+    float   bufallpassR1[allpasstuningR1];
+    float   bufallpassL2[allpasstuningL2];
+    float   bufallpassR2[allpasstuningR2];
+    float   bufallpassL3[allpasstuningL3];
+    float   bufallpassR3[allpasstuningR3];
+    float   bufallpassL4[allpasstuningL4];
+    float   bufallpassR4[allpasstuningR4];
 };
 
 #endif//_revmodel_



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/59103d665c3e00116a36d9c644ce93ed24714185...d02452cb2ea98b0692cafc17d7b019dcc364caa9

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/59103d665c3e00116a36d9c644ce93ed24714185...d02452cb2ea98b0692cafc17d7b019dcc364caa9
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list