45 static float mDegToRad(
float degrees);
46 static float mmap(
float value,
float inputMin,
float inputMax,
float outputMin,
float outputMax,
bool clamp =
false);
47 static float clamp(
float a,
float min,
float max);
51 typedef std::vector<float> (
M1DecodeCore::*processSampleForMultichannel)(
float Yaw,
float Pitch,
float Roll);
52 typedef void (
M1DecodeCore::*processSampleForMultichannelPtr)(
float Yaw,
float Pitch,
float Roll,
float *result);
54 std::vector<float> processSample(processSampleForMultichannel _processSampleForMultichannel,
float Yaw,
float Pitch,
float Roll,
int bufferSize = 0,
int sampleIndex = 0);
55 void processSample(processSampleForMultichannelPtr _processSampleForMultichannelPtr,
float Yaw,
float Pitch,
float Roll,
float *result,
int bufferSize = 0,
int sampleIndex = 0);
58 static float alignAngle(
float a,
float min = -180,
float max = 180);
59 static float lerp(
float x1,
float x2,
float t);
60 float radialDistance(
float angle1,
float angle2);
61 float targetDirectionMultiplier(
float angleCurrent,
float angleTarget);
68 float currentYaw, currentPitch, currentRoll;
69 float targetYaw, targetPitch, targetRoll;
70 float previousYaw, previousPitch, previousRoll;
74 long timeLastCalculation;
76 Mach1PlatformType platformType;
77 Mach1DecodeMode decodeMode;
79 void spatialMultichannelAlgo(
Mach1Point3D *channelPoints,
int numChannelPoints,
float Yaw,
float Pitch,
float Roll,
float *result);
81 void spatialAlgo_4(
float Yaw,
float Pitch,
float Roll,
float *result);
82 std::vector<float> spatialAlgo_4(
float Yaw,
float Pitch,
float Roll);
84 void spatialAlgo_8(
float Yaw,
float Pitch,
float Roll,
float *result);
85 std::vector<float> spatialAlgo_8(
float Yaw,
float Pitch,
float Roll);
87 void spatialAlgo_14(
float Yaw,
float Pitch,
float Roll,
float *result);
88 std::vector<float> spatialAlgo_14(
float Yaw,
float Pitch,
float Roll);
91 std::vector<std::string> strLog;
92 void addToLog(std::string str,
int maxCount = 100);
101 static void convertAnglesToMach1(Mach1PlatformType platformType,
float *Y,
float *P,
float *R);
102 static void convertAnglesToPlatform(Mach1PlatformType platformType,
float *Y,
float *P,
float *R);
110 void setPlatformType(Mach1PlatformType type);
111 Mach1PlatformType getPlatformType();
113 int getFormatChannelCount();
114 int getFormatCoeffCount();
116 void setRotation(
Mach1Point3D newRotationFromMinusOnetoOne);
117 void setRotationDegrees(
Mach1Point3D newRotationDegrees);
118 void setRotationRadians(
Mach1Point3D newRotationRadians);
121 void setFilterSpeed(
float filterSpeed);
123 long getCurrentTime();
124 long getLastCalculationTime();
128 void setDecodeMode(Mach1DecodeMode mode);
129 Mach1DecodeMode getDecodeMode();
138 std::vector<float> decode(
float Yaw,
float Pitch,
float Roll,
int bufferSize = 0,
int sampleIndex = 0);
139 std::vector<float> decodeCoeffs(
int bufferSize = 0,
int sampleIndex = 0);
140 std::vector<float> decodePannedCoeffs(
int bufferSize = 0,
int sampleIndex = 0,
bool applyPanLaw =
true);
144 void decode(
float Yaw,
float Pitch,
float Roll,
float *result,
int bufferSize = 0,
int sampleIndex = 0);
145 void decodeCoeffs(
float *result,
int bufferSize = 0,
int sampleIndex = 0);
146 void decodePannedCoeffs(
float *result,
int bufferSize = 0,
int sampleIndex = 0,
bool applyPanLaw =
true);
147 void decodeCoeffsUsingTranscodeMatrix(
void *M1obj,
float *matrix,
int channels,
float *result,
int bufferSize = 0,
int sampleIndex = 0);