Skip to content

Commit

Permalink
ATK refactor: speed of sound, maintain backwards compatability
Browse files Browse the repository at this point in the history
affects: FoaNFC, FoaProximity

NOTE: resolves previously required update to atk-sc3 quark

If AtkFoa.speedOfSound is not passed, plugins use  333.0 mps, which is equivalent to coeffiencts used in previous sc3-plugins (<=v3.11.1)
  • Loading branch information
joslloand committed Sep 16, 2021
1 parent 23e6544 commit 8bc45e4
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions source/ATK/AtkUGens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1910,14 +1910,26 @@ void FoaAsymmetry_next_k(FoaAsymmetry *unit, int inNumSamples)


///////////////////////////////////////////////////////////////////////////////////////////////////////
// FoaNFC -
// FoaNFC
void FoaNFC_Ctor(FoaNFC* unit)
{
int numChannels = unit->mNumInputs;

unit->m_y1x = 0.0f;
unit->m_y1y = 0.0f;
unit->m_y1z = 0.0f;
unit->m_distanceStart = IN0(4);
unit->m_speedOfSound = IN0(5);
/*
maintain backwards compatibility w/ atk-sc3 quark <= v5.0.3
https://github.com/ambisonictoolkit/atk-sc3
*/
if (numChannels == 6) {
unit->m_speedOfSound = IN0(5);
} else {
// previous (equivalent) value
unit->m_speedOfSound = 333.0;
}

if (INRATE(4) == calc_FullRate) {
SETCALC(FoaNFC_next_a);
} else {
Expand Down Expand Up @@ -2026,11 +2038,23 @@ void FoaNFC_next_a(FoaNFC *unit, int inNumSamples)

void FoaProximity_Ctor(FoaProximity* unit)
{
int numChannels = unit->mNumInputs;

unit->m_y1x = 0.0f;
unit->m_y1y = 0.0f;
unit->m_y1z = 0.0f;
unit->m_distanceStart = IN0(4);
unit->m_speedOfSound = IN0(5);
/*
maintain backwards compatibility w/ atk-sc3 quark <= v5.0.3
https://github.com/ambisonictoolkit/atk-sc3
*/
if (numChannels == 6) {
unit->m_speedOfSound = IN0(5);
} else {
// previous (equivalent) value
unit->m_speedOfSound = 333.0;
}

if (INRATE(4) == calc_FullRate) {
SETCALC(FoaProximity_next_a);
} else {
Expand Down

0 comments on commit 8bc45e4

Please sign in to comment.