@@ -161,8 +161,7 @@ namespace BRIR
161161 {
162162 if (LoadBRIRTableFromSOFA (sofafile, environment))
163163 {
164- environment->GetBRIR ()->EndSetup ();
165- return true ;
164+ return environment->GetBRIR ()->EndSetup ();
166165 }
167166 else
168167 {
@@ -275,31 +274,39 @@ namespace BRIR
275274
276275 double azimuth = pos[array2DIndex (i, 0 , nMeasurements, dims[1 ])];
277276 double elevation = pos[array2DIndex (i, 1 , nMeasurements, dims[1 ])];
278- while (elevation < 0 ) elevation += 360 ; // TODO: check who should do this
279-
277+ while (elevation < 0 ) elevation += 360 ;
280278 // SET VIRTUAL SPEAKER
281279
282280 if ((AnglesAreCloseInDegrees (azimuth, NORTH_AZIMUTH)) && (AnglesAreCloseInDegrees (elevation, 0 .0f )))
283281 {
284- environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::NORTH, Common::T_ear::LEFT, std::move (leftBRIRChannel));
285- environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::NORTH, Common::T_ear::RIGHT, std::move (rightBRIRChannel));
282+ if (! environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::NORTH, Common::T_ear::LEFT, std::move (leftBRIRChannel))){ return false ;}
283+ if (! environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::NORTH, Common::T_ear::RIGHT, std::move (rightBRIRChannel))){ return false ;}
286284 }
287285 if ((AnglesAreCloseInDegrees (azimuth, SOUTH_AZIMUTH)) && (AnglesAreCloseInDegrees (elevation, 0 .0f )))
288286 {
289- environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::SOUTH, Common::T_ear::LEFT, std::move (leftBRIRChannel));
290- environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::SOUTH, Common::T_ear::RIGHT, std::move (rightBRIRChannel));
287+ if (! environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::SOUTH, Common::T_ear::LEFT, std::move (leftBRIRChannel))){ return false ;}
288+ if (! environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::SOUTH, Common::T_ear::RIGHT, std::move (rightBRIRChannel))){ return false ;}
291289 }
292290 if ((AnglesAreCloseInDegrees (azimuth, WEST_AZIMUTH)) && (AnglesAreCloseInDegrees (elevation, 0 .0f )))
293291 {
294- environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::WEST, Common::T_ear::LEFT, std::move (leftBRIRChannel));
295- environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::WEST, Common::T_ear::RIGHT, std::move (rightBRIRChannel));
292+ if (! environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::WEST, Common::T_ear::LEFT, std::move (leftBRIRChannel))){ return false ;}
293+ if (! environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::WEST, Common::T_ear::RIGHT, std::move (rightBRIRChannel))){ return false ;}
296294 }
297295 if ((AnglesAreCloseInDegrees (azimuth, EAST_AZIMUTH)) && (AnglesAreCloseInDegrees (elevation, 0 .0f )))
298296 {
299- environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::EAST, Common::T_ear::LEFT, std::move (leftBRIRChannel));
300- environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::EAST, Common::T_ear::RIGHT, std::move (rightBRIRChannel));
297+ if (!environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::EAST, Common::T_ear::LEFT, std::move (leftBRIRChannel))){return false ;}
298+ if (!environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::EAST, Common::T_ear::RIGHT, std::move (rightBRIRChannel))){return false ;}
299+ }
300+ if (AnglesAreCloseInDegrees (elevation, 90 .0f ))
301+ {
302+ if (!environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::ZENIT, Common::T_ear::LEFT, std::move (leftBRIRChannel))){return false ;}
303+ if (!environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::ZENIT, Common::T_ear::RIGHT, std::move (rightBRIRChannel))){return false ;}
304+ }
305+ if (AnglesAreCloseInDegrees (elevation, 270 .0f ))
306+ {
307+ if (!environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::NADIR, Common::T_ear::LEFT, std::move (leftBRIRChannel))) {return false ;}
308+ if (!environment->GetBRIR ()->AddBRIR (VirtualSpeakerPosition::NADIR, Common::T_ear::RIGHT, std::move (rightBRIRChannel))){return false ;}
301309 }
302- // TO DO: consider elevations. Read zenith and nadir speakers
303310 }
304311 return true ;
305312 }
0 commit comments