Commit 184c7fa5 authored by Michael Kohnen's avatar Michael Kohnen
Browse files

Ambisonics Rendering and HP repro running (static Decoding)

parent 2b37d8b0
......@@ -1320,12 +1320,11 @@ std::vector<double> CVAAmbisonicsFreeFieldAudioRenderer::vdRealvalued_basefuncti
double CVAAmbisonicsFreeFieldAudioRenderer::dNormalizeConst(int m, int n)
{
double Res = 1;
if (m%2==1)
double Res=-1;
else
double Res=1;
return sqrt((2*n+1) * (2-iKronecker(m)) * factorial(n-m) / (4*3.141592565359*factorial(n+m)) );
Res=-1;
return Res * sqrt((2*n+1) * (2-iKronecker(m)) * factorial(n-m) / (4*3.141592565359*factorial(n+m)) );
}
......@@ -1337,11 +1336,12 @@ int CVAAmbisonicsFreeFieldAudioRenderer::iKronecker(int m)
return 0;
}
std::vector<double> CVAAmbisonicsFreeFieldAudioRenderer::dAssociateLegendre(int N, double mu)
std::vector<double> CVAAmbisonicsFreeFieldAudioRenderer::dAssociateLegendre(int N, double mu) //call by ref
{
assert(abs(mu) <= 1);
double dN = 0;
std::vector<double> P;
P.resize((N+1)*(N+1));
P.resize((N+1)*(N+1)); //membervariable
P[0] = 1.0;// *dNormalizeConst(0, 0);
for (int n=1; n<=N; n++)
{
......
......@@ -83,20 +83,58 @@ CVAAmbisonicsBinauralMixdownReproduction::CVAAmbisonicsBinauralMixdownReproducti
m_pDecoderMatrixPatchBay->AddOutput( GetNumVirtualLoudspeaker() );
m_pdsStreamFilter = new CMixdownStreamFilter( GetNumVirtualLoudspeaker(), dSampleRate, iBlockLength, m_iHRIRFilterLength );
m_pdsStreamFilter->pdsInput = m_pDecoderMatrixPatchBay->GetOutputDatasource( 0 );
double dYInv[9][14] =
//if (m_iAmbisonicsTruncationOrder == 3)
//{
double dYInv[16][12] =
{
{ 0.1935, 0.1935, 0.1935, 0.1935, 0.2222, 0.2222, 0.2222, 0.2222, 0.2386, 0.2386, 0.2386, 0.2386 },
{ 0.5226, -0.5226, -0.5226, 0.5226, -0.0000, -0.6052, 0.0000, 0.6052, -0.0000, -0.6203, 0.0000, 0.6203 },
{ -0.0083, -0.0083, -0.0083, -0.0083, 0.6265, 0.6265, 0.6265, 0.6265, -0.5964, -0.5964, -0.5964, -0.5964 },
{ 0.5226, 0.5226, -0.5226, -0.5226, 0.6052, -0.0000, -0.6052, -0.0000, 0.6203, 0.0000, -0.6203, -0.0000 },
{ 1.3985, -1.3985, 1.3985, -1.3985, 0.0000, -0.0000, -0.0000, 0.0000, -0.0000, -0.0000, -0.0000, -0.0000 },
{ 0.0072, -0.0072, -0.0072, 0.0072, -0.0000, -2.0462, 0.0000, 2.0462, 0.0000, 2.0034, 0.0000, -2.0034 },
{ -0.4886, -0.4886, -0.4886, -0.4886, -0.1783, -0.1783, -0.1783, -0.1783, -0.1914, -0.1914, -0.1914, -0.1914 },
{ 0.0072, 0.0072, -0.0072, -0.0072, 2.0462, 0.0000, -2.0462, 0.0000, -2.0034, 0.0000, 2.0034, -0.0000 },
{ -0.0000, 0.0000, 0.0000, -0.0000, 0.7820, -0.7820, 0.7820, -0.7820, 0.8396, -0.8396, 0.8396, -0.8396 },
{ 1.5412, -1.5412, -1.5412, 1.5412, -0.0000, 1.1505, 0.0000, -1.1505, -0.0000, 1.3099, 0.0000, -1.3099 },
{ 0.0000, 0.0000, 0.0000, -0.0000, -0.0000, 0.0000, -0.0000, 0.0000, -0.0000, -0.0000, 0.0000, 0.0000 },
{ -0.5516, 0.5516, 0.5516, -0.5516, 0.0000, -0.3022, 0.0000, 0.3022, -0.0000, -0.1409, -0.0000, 0.1409 },
{ 0.0004, 0.0004, 0.0004, 0.0004, -1.1248, -1.1248, -1.1248, -1.1248, 1.0876, 1.0876, 1.0876, 1.0876 },
{ -0.5516, -0.5516, 0.5516, 0.5516, 0.3022, 0.0000, -0.3022, 0.0000, 0.1409, -0.0000, -0.1409, 0.0000 },
{ -0.0000, 0.0000, 0.0000, 0.0000, 1.4519, -1.4519, 1.4519, -1.4519, -1.4043, 1.4043, -1.4043, 1.4043 },
{ -1.5412, -1.5412, 1.5412, 1.5412, 1.1505, 0.0000, -1.1505, -0.0000, 1.3099, -0.0000, -1.3099, 0.0000 },
};
/* }
else if (m_iAmbisonicsTruncationOrder == 2)
{
double dYInv[9][12] =
{
{ 0.1935, 0.1935, 0.1935, 0.1935, 0.2287, 0.2287, 0.2287, 0.2287, 0.2323, 0.2323, 0.2323, 0.2323 },
{ 0.5348, -0.5348, -0.5348, 0.5348, 0.0000, -0.6703, -0.0000, 0.6703, -0.0000, -0.7317, 0.0000, 0.7317 },
{ -0.0087, -0.0087, -0.0087, -0.0087, 0.5053, 0.5053, 0.5053, 0.5053, -0.4788, -0.4788, -0.4788, -0.4788 },
{ 0.5348, 0.5348, -0.5348, -0.5348, 0.6703, 0.0000, -0.6703, -0.0000, 0.7317, -0.0000, -0.7317, -0.0000 },
{ 1.6712, -1.6712, 1.6712, -1.6712, -0.0000, 0.0000, -0.0000, 0.0000, 0.0000, -0.0000, -0.0000, -0.0000 },
{ -0.0414, 0.0414, 0.0414, -0.0414, 0.0000, -2.4757, 0.0000, 2.4757, 0.0000, 2.3722, 0.0000, -2.3722 },
{ -0.5839, -0.5839, -0.5839, -0.5839, -0.1921, -0.1921, -0.1921, -0.1921, -0.2490, -0.2490, -0.2490, -0.2490 },
{ -0.0414, -0.0414, 0.0414, 0.0414, 2.4757, -0.0000, -2.4757, 0.0000, -2.3722, -0.0000, 2.3722, -0.0000 },
{ 0.0000, -0.0000, 0.0000, -0.0000, 0.9531, -0.9531, 0.9531, -0.9531, 0.9854, -0.9854, 0.9854, -0.9854 },
};
}
else if (m_iAmbisonicsTruncationOrder == 1)
{
{ 0.1935, 0.1935, 0.1935, 0.1935, 0.2287, 0.2287, 0.2287, 0.2287, 0.2323, 0.2323, 0.2323, 0.2323, 0.4788, 0.4484 },
{ -0.0043, -0.0043, -0.0043, -0.0043, 0.2512, 0.2512, 0.2512, 0.2512, -0.2380, -0.2380, -0.2380, -0.2380, -0.6773, 0.6419 },
{ -0.2659, -0.2659, 0.2659, 0.2659, -0.3333, 0.0000, 0.3333, -0.0000, -0.3638, -0.0000, 0.3638, 0.0000, 0.0000, 0.0000 },
{ -0.2659, 0.2659, 0.2659, -0.2659, 0.0000, 0.3333, -0.0000, -0.3333, -0.0000, 0.3638, 0.0000, -0.3638, -0.0000, 0.0000 },
{ 0.0113, -0.0113, -0.0113, 0.0113, 0.0000, 0.6780, 0.0000, -0.6780, 0.0000, -0.6496, -0.0000, 0.6496, 0.0000, -0.0000 },
{ 0.0113, 0.0113, -0.0113, -0.0113, -0.6780, 0.0000, 0.6780, -0.0000, 0.6496, -0.0000, -0.6496, -0.0000, -0.0000, -0.0000 },
{ 0.0799, 0.0799, 0.0799, 0.0799, 0.2523, -0.1997, 0.2523, -0.1997, 0.2678, -0.1996, 0.2678, -0.1996, -0.2841, -0.2772 },
{ 0.4576, -0.4576, 0.4576, -0.4576, 0.0000, 0.0000, -0.0000, -0.0000, 0.0000, -0.0000, 0.0000, 0.0000, -0.0000, -0.0000 },
{ 0.1385, 0.1385, 0.1385, 0.1385, -0.0849, 0.1761, -0.0849, 0.1761, -0.0759, 0.1940, -0.0759, 0.1940, -0.4921, -0.4802 },
};
double dYInv[4][12] =
{
{ 0.2533, 0.2533, 0.2533, 0.2533, 0.2484, 0.2484, 0.2484, 0.2484, 0.2578, 0.2578, 0.2578, 0.2578 },
{ 0.5940, -0.5940, -0.5940, 0.5940, -0.0000, -0.7734, 0.0000, 0.7734, -0.0000, -0.7864, 0.0000, 0.7864 },
{ -0.0163, -0.0163, -0.0163, -0.0163, 0.5596, 0.5596, 0.5596, 0.5596, -0.5351, -0.5351, -0.5351, -0.5351 },
{ 0.5940, 0.5940, -0.5940, -0.5940, 0.7734, 0.0000, -0.7734, 0.0000, 0.7864, -0.0000, -0.7864, -0.0000 },
};
}
else
{
VA_EXCEPT1("Ambisonics truncation order unknown - ATM only 1,2,3 is supported");
} */
// Matrix
for( int i=0; i < GetNumInputChannels(); i++ )
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment