- added process multi
This commit is contained in:
@@ -89,6 +89,16 @@ class Shuffle
|
|||||||
out[s] = sign * in[c];
|
out[s] = sign * in[c];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline void inPlace(T *data, const int *shuffle_spec)
|
||||||
|
{
|
||||||
|
T temp[numCh];
|
||||||
|
for (int c=0; c < numCh; c++)
|
||||||
|
{
|
||||||
|
temp[c] = data[c];
|
||||||
|
}
|
||||||
|
Shuffle<T, numCh>::outOfPlace(temp, data, shuffle_spec);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+10
-1
@@ -126,6 +126,15 @@ class BufferMulti
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BufferMulti & operator =(T data[numCh])
|
||||||
|
{
|
||||||
|
for (uint c=0; c < numCh; c++)
|
||||||
|
{
|
||||||
|
m_buffer[c][0] = data[c];
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
void quer(T *out, int offset=0) const
|
void quer(T *out, int offset=0) const
|
||||||
{
|
{
|
||||||
for (int c=0; c < numCh; c++)
|
for (int c=0; c < numCh; c++)
|
||||||
@@ -134,7 +143,7 @@ class BufferMulti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void quer(T *out, const int *offsets) const
|
void quer(T *out, const int offsets[numCh]) const
|
||||||
{
|
{
|
||||||
for (int c=0; c < numCh; c++)
|
for (int c=0; c < numCh; c++)
|
||||||
{
|
{
|
||||||
|
|||||||
+44
-8
@@ -54,7 +54,6 @@ class Diffusor
|
|||||||
m_shuffle_spec[i] *= (T)-1;
|
m_shuffle_spec[i] *= (T)-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline T process(T in)
|
inline T process(T in)
|
||||||
@@ -63,32 +62,68 @@ class Diffusor
|
|||||||
|
|
||||||
T qbuf[numCh];
|
T qbuf[numCh];
|
||||||
m_dly.quer(qbuf, m_delay_spec);
|
m_dly.quer(qbuf, m_delay_spec);
|
||||||
|
|
||||||
T sbuf[numCh];
|
|
||||||
Shuffle<T, numCh>::outOfPlace(qbuf, sbuf, m_shuffle_spec);
|
|
||||||
|
|
||||||
Hadamard<T, numCh>::inPlace(sbuf);
|
|
||||||
Householder<T, numCh>::inPlace(sbuf);
|
|
||||||
++m_dly;
|
++m_dly;
|
||||||
|
|
||||||
return sbuf[0];
|
Shuffle<T, numCh>::inPlace(qbuf, m_shuffle_spec);
|
||||||
|
Hadamard<T, numCh>::inPlace(qbuf);
|
||||||
|
Householder<T, numCh>::inPlace(qbuf);
|
||||||
|
|
||||||
|
return qbuf[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void process_multi(T data[numCh])
|
||||||
|
{
|
||||||
|
m_dly = data;
|
||||||
|
m_dly.quer(data, m_delay_spec);
|
||||||
|
++m_dly;
|
||||||
|
|
||||||
|
Shuffle<T, numCh>::inPlace(data, m_shuffle_spec);
|
||||||
|
Hadamard<T, numCh>::inPlace(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void split(T in, T out[numCh])
|
||||||
|
{
|
||||||
|
for (uint c=0; c < numCh; c++)
|
||||||
|
{
|
||||||
|
out[c] = in;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline T combine(T data[numCh])
|
||||||
|
{
|
||||||
|
Householder<T, numCh>::inPlace(data);
|
||||||
|
return data[0];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T, uint numCh>
|
template<typename T, uint numCh>
|
||||||
class Reverb
|
class Reverb
|
||||||
{
|
{
|
||||||
std::array<Diffusor<T, numCh>, 3> m_diffusors;
|
std::array<Diffusor<T, numCh>, 3> m_diffusors;
|
||||||
|
dsp::BufferMulti<T, numCh> m_feedbackDly;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Reverb(uint maxDelay)
|
Reverb(uint maxDelay)
|
||||||
: m_diffusors({maxDelay, maxDelay, maxDelay})
|
: m_diffusors({maxDelay, maxDelay, maxDelay})
|
||||||
|
, m_feedbackDly(maxDelay)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void process_multi(float *in, float *out, unsigned numPoints)
|
||||||
|
{
|
||||||
|
for (int i=0; i < numPoints; i++)
|
||||||
|
{
|
||||||
|
T temp[numCh];
|
||||||
|
Diffusor<T, numCh>::split(in[i], temp);
|
||||||
|
for (auto diffusor: m_diffusors)
|
||||||
|
{
|
||||||
|
diffusor.process_multi(temp);
|
||||||
|
}
|
||||||
|
out[i] = Diffusor<T, numCh>::combine(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void process(float *in, float *out, unsigned numPoints)
|
void process(float *in, float *out, unsigned numPoints)
|
||||||
{
|
{
|
||||||
for (int i=0; i < numPoints; i++)
|
for (int i=0; i < numPoints; i++)
|
||||||
@@ -101,6 +136,7 @@ class Reverb
|
|||||||
out[i] = temp;
|
out[i] = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user