1 /**
2  *  Impulse Response Processor model abstract class
3  *
4  *  Copyright (C) 2006-2018 Teru Kamogashira
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  */
20 
21 
_FV3_(irbasem)22 class _FV3_(irbasem)
23 {
24  public:
25   _FV3_(irbasem)();
26   virtual _FV3_(~irbasem)();
27   virtual void loadImpulse(const _fv3_float_t * inputL, long size)
28     throw(std::bad_alloc) = 0;
29   virtual void unloadImpulse();
30   virtual unsigned setFFTFlags(unsigned flags);
31   virtual unsigned getFFTFlags();
32   virtual void     setSIMD(uint32_t flag1, uint32_t flag2);
33   virtual uint32_t getSIMD(uint32_t select);
34   virtual long getImpulseSize();
35   virtual long getLatency();
36   virtual void resume();
37   virtual void suspend();
38   virtual void mute() = 0;
39   virtual void processreplace(_fv3_float_t *inputL, long numsamples) = 0;
40 
41  protected:
42   long impulseSize, latency;
43   unsigned fftflags;
44   uint32_t simdFlag1, simdFlag2;
45 
46  private:
47   _FV3_(irbasem)(const _FV3_(irbasem)& x);
48   _FV3_(irbasem)& operator=(const _FV3_(irbasem)& x);
49 };
50 
_FV3_(irbase)51 class _FV3_(irbase)
52 {
53  public:
54   _FV3_(irbase)();
55   virtual _FV3_(~irbase)();
56   virtual void loadImpulse(const _fv3_float_t * inputL, const _fv3_float_t * inputR, long size)
57     throw(std::bad_alloc) = 0;
58   virtual void unloadImpulse();
59   virtual void setprocessoptions(unsigned options);
60   virtual unsigned getprocessoptions();
61   virtual unsigned setFFTFlags(unsigned flags);
62   virtual unsigned getFFTFlags();
63   virtual void     setSIMD(uint32_t flag1, uint32_t flag2);
64   virtual uint32_t getSIMD(uint32_t select);
65   virtual long getImpulseSize();
66   virtual long getLatency();
67   virtual void setInitialDelay(long numsamples)
68     throw(std::bad_alloc);
69   virtual long getInitialDelay();
70   virtual void resume();
71   virtual void suspend();
72   virtual void mute();
73   virtual void processreplace(const _fv3_float_t *inputL, const _fv3_float_t *inputR, _fv3_float_t *outputL, _fv3_float_t *outputR, long numsamples) = 0;
74   virtual void processreplace(const _fv3_float_t *inputL, const _fv3_float_t *inputR, _fv3_float_t *outputL, _fv3_float_t *outputR, long numsamples, unsigned options);
75   virtual void processdrywetout(const _fv3_float_t *dL, const _fv3_float_t *dR, _fv3_float_t *wL, _fv3_float_t *wR, _fv3_float_t *oL, _fv3_float_t *oR, long numsamples);
76   virtual void setwet(_fv3_float_t db);
77   virtual _fv3_float_t getwet();
78   virtual void setwetr(_fv3_float_t value);
79   virtual _fv3_float_t getwetr();
80   virtual void setdry(_fv3_float_t db);
81   virtual _fv3_float_t getdry();
82   virtual void setdryr(_fv3_float_t value);
83   virtual _fv3_float_t getdryr();
84   virtual void setwidth(_fv3_float_t value);
85   virtual _fv3_float_t getwidth();
86   virtual void setLPF(_fv3_float_t value);
87   virtual _fv3_float_t getLPF();
88   virtual void setHPF(_fv3_float_t value);
89   virtual _fv3_float_t getHPF();
90   virtual void setLRBalance(_fv3_float_t value);
91   virtual _fv3_float_t getLRBalance();
92 
93  protected:
94   void update();
95   _fv3_float_t wet, wetdB, dry, drydB, width, lrbalance, wet1, wet2, wet1L, wet2L, wet1R, wet2R;
96   _FV3_(delay) delayDL, delayDR, delayWL, delayWR;
97   _FV3_(efilter) filter;
98   long impulseSize, initialDelay, latency;
99   unsigned fftflags, processoptions;
100   uint32_t simdFlag1, simdFlag2;
101   _FV3_(irbasem) *irmL, *irmR;
102 
103  private:
104   _FV3_(irbase)(const _FV3_(irbase)& x);
105   _FV3_(irbase)& operator=(const _FV3_(irbase)& x);
106 };
107