Commit 72ad73b6 authored by Michael Kohnen's avatar Michael Kohnen
Browse files

BFormat rotation basics work, number LS hardcoded, number inputchannels...

BFormat rotation basics work, number LS hardcoded, number inputchannels hardcoded, re-max weighting has to be checked
parent 49c5a267
...@@ -650,15 +650,15 @@ void CVAAmbisonicsBinauralMixdownReproduction::UpdateScene(CVASceneState* pNewSt ...@@ -650,15 +650,15 @@ void CVAAmbisonicsBinauralMixdownReproduction::UpdateScene(CVASceneState* pNewSt
Eigen::MatrixXd matRotation = buildRotationMatrix(m_orderMatrices, m_iAmbisonicsTruncationOrder); Eigen::MatrixXd matRotation = buildRotationMatrix(m_orderMatrices, m_iAmbisonicsTruncationOrder);
//To be deleted: only for testing purposes. Better display of 25x25 matrix (possible to see ind. values) //To be deleted: only for testing purposes. Better display of 25x25 matrix (possible to see ind. values)
double matrix[25][25]; /*double matrix[25][25];
for (int i = 0; i < 25; i++) { for (int i = 0; i < 25; i++) {
for (int j = 0; j < 25; j++) { for (int j = 0; j < 25; j++) {
matrix[i][j] = matRotation(i, j); matrix[i][j] = matRotation(i, j);
} }
} }
*/
/*Eigen::MatrixXd matYinvRot = matRotation * m_matYinv;
Eigen::MatrixXd matYinvRot = matRotation * m_matYinv;
double debugYinvRot[25][25]; double debugYinvRot[25][25];
for (int i = 0; i < 25; i++) { for (int i = 0; i < 25; i++) {
...@@ -672,11 +672,11 @@ void CVAAmbisonicsBinauralMixdownReproduction::UpdateScene(CVASceneState* pNewSt ...@@ -672,11 +672,11 @@ void CVAAmbisonicsBinauralMixdownReproduction::UpdateScene(CVASceneState* pNewSt
debugYinv[i][j] = m_matYinv(i, j); //matrix[zeilen][spalten] debugYinv[i][j] = m_matYinv(i, j); //matrix[zeilen][spalten]
} }
} }
*/
int m, n; int m, n;
int iCurrentOrder; int iCurrentOrder;
double dGain; double dGain=0;
//gains //gains
for (int i = 0; i < GetNumInputChannels(); i++){ for (int i = 0; i < GetNumInputChannels(); i++){
iCurrentOrder = floor(sqrt(i)); iCurrentOrder = floor(sqrt(i));
...@@ -684,7 +684,8 @@ void CVAAmbisonicsBinauralMixdownReproduction::UpdateScene(CVASceneState* pNewSt ...@@ -684,7 +684,8 @@ void CVAAmbisonicsBinauralMixdownReproduction::UpdateScene(CVASceneState* pNewSt
{ {
for (int k = 0; k < 25; k++){ for (int k = 0; k < 25; k++){
SHLinear2DegreeOrder(k, m, n); SHLinear2DegreeOrder(k, m, n);
dGain += m_matYinv(k, j) * matRotation(i,k) * m_vdRemaxWeights[n]; dGain += m_matYinv(k, j) * matRotation(i,k) * m_vdRemaxWeights[n];
//dGain = m_matYinv(i, j) * m_vdRemaxWeights[iCurrentOrder];
} }
m_pDecoderMatrixPatchBay->ConnectChannels(0, i, 0, j, dGain); m_pDecoderMatrixPatchBay->ConnectChannels(0, i, 0, j, dGain);
dGain = 0; dGain = 0;
...@@ -692,7 +693,15 @@ void CVAAmbisonicsBinauralMixdownReproduction::UpdateScene(CVASceneState* pNewSt ...@@ -692,7 +693,15 @@ void CVAAmbisonicsBinauralMixdownReproduction::UpdateScene(CVASceneState* pNewSt
} }
} }
/*for (int i = 0; i < GetNumInputChannels(); i++)
{
int iCurrentOrder = (int) floor(sqrt(i));
for( int j=0; j < GetNumVirtualLoudspeaker(); j++ )
{
double dGain = m_matYinv(i, j)*m_vdRemaxWeights[iCurrentOrder];
m_pDecoderMatrixPatchBay->ConnectChannels(0, i, 0, j, dGain);
}
}*/
else if ((m_sRotationMode == "ViewUp") || (m_sRotationMode == "Quaternion") || !m_bBFormatIsInit) { else if ((m_sRotationMode == "ViewUp") || (m_sRotationMode == "Quaternion") || !m_bBFormatIsInit) {
...@@ -704,7 +713,7 @@ void CVAAmbisonicsBinauralMixdownReproduction::UpdateScene(CVASceneState* pNewSt ...@@ -704,7 +713,7 @@ void CVAAmbisonicsBinauralMixdownReproduction::UpdateScene(CVASceneState* pNewSt
//Get Pose of VirtualLoudspeaker //Get Pose of VirtualLoudspeaker
const CVAHardwareDevice* pDevice(m_pVirtualOutput->vpDevices[i]); const CVAHardwareDevice* pDevice(m_pVirtualOutput->vpDevices[i]);
if (m_sRotationMode == "ViewUp") { if (m_sRotationMode == "ViewUp" || !m_bBFormatIsInit) {
//old functionality to rotate //old functionality to rotate
dAzimuth = GetAzimuthOnTarget_DEG(vListenerPos, vListenerView, vListenerUp, pDevice->vPos); //Old solution dAzimuth = GetAzimuthOnTarget_DEG(vListenerPos, vListenerView, vListenerUp, pDevice->vPos); //Old solution
dElevation = GetElevationOnTarget_DEG(vListenerPos, vListenerUp, pDevice->vPos); //Old solution dElevation = GetElevationOnTarget_DEG(vListenerPos, vListenerUp, pDevice->vPos); //Old solution
...@@ -784,12 +793,14 @@ void CVAAmbisonicsBinauralMixdownReproduction::UpdateScene(CVASceneState* pNewSt ...@@ -784,12 +793,14 @@ void CVAAmbisonicsBinauralMixdownReproduction::UpdateScene(CVASceneState* pNewSt
pFilterChL->Release(); pFilterChL->Release();
pFilterChR->Release(); pFilterChR->Release();
m_bBFormatIsInit = true;
m_pdsStreamFilter->pTrigger->trigger(); m_pdsStreamFilter->pTrigger->trigger();
} }
m_bBFormatIsInit = true;
} }
else { else {
return; //RotationMode is set to a wrong String return; //RotationMode is set to a wrong String
} }
......
Markdown is supported
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