Mach1 Spatial SDK
Loading...
Searching...
No Matches
Mach1TranscodeCore.h
1// Mach1 Spatial SDK
2// Copyright © 2017-2022 Mach1. All rights reserved.
3//
4// References:
5// - York ambisonics: https://www.york.ac.uk/sadie-project/ambidec.html
6
7#pragma once
8
9#include "M1DSP/M1DSPFilters.h"
10#include "M1DSP/M1DSPUtilities.h"
11#include "Mach1Point3D.h"
12#include <cassert>
13#include <vector>
14
15#include "Mach1TranscodeConstants.h"
16
18 bool processObjectBed = true;
19 bool processChannelBed = true;
20 bool enableBinauralRendering = true;
21};
22
24 private:
25 int inFmt;
26 int outFmt;
27
28 int numFormats;
29
30 std::vector<Mach1TranscodeMatrix> matrices;
31
32 std::vector<Mach1Point3D> inCustomPoints;
33 std::vector<Mach1Point3D> outCustomPoints;
34
35 float *buffers[Mach1TranscodeConstants::MAXCHANS];
36 int bufferSize;
37
38 std::vector<int> formatConversionPath;
39
40 M1DSP::Utilities::CSpatialDownmixChecker spatialDownmixChecker;
41
42 std::vector<M1DSP::Filters::CFilterSimpleLP> lpFilters;
43 std::vector<int> subChannelIndices;
44
45 std::vector<Mach1Point3D> getPointsSet(int fmt);
46 int findMatrix(int inFmt, int outFmt);
47 std::vector<std::vector<float> > getCoeffs(int idxMatrix);
48 void processConversion(int inFmt, float **inBufs, int outFmt, float **outBufs, int numSamples);
49 int getNumChannels(int fmt, bool isInput);
50
51 Mach1Point3D *(*customPointsSamplerCallback)(long long, int &) = nullptr;
52
53 // TODO: remove this for a single instance of the function in all apis
54 float clamp_local(float n, float lower, float upper);
55
56 public:
59
60 int getInputFormat();
61 int getOutputFormat();
62 int getInputNumChannels();
63 int getOutputNumChannels();
64 int getFormatFromString(const char *str);
65 const char *getFormatName(int fmt);
66 const char **getAllFormatNames();
67 int getFormatsCount();
68
69 float processNormalization(float **bufs, int numSamples);
70 void processMasterGain(float **bufs, int numSamples, float masterGain = 1.0f);
71
72 float db2level(float db);
73 float level2db(float level);
74
75 void setLFESub(std::vector<int> subChannelIndices, int sampleRate);
76 void setSpatialDownmixer(float corrThreshold = 0.1);
77 bool getSpatialDownmixerPossibility();
78 const std::vector<float> getAvgSamplesDiff();
79
80 void setInputFormat(int inFmt);
81 void setInputFormatCustomPointsJson(std::string inJson);
82 void setInputFormatCustomPoints(std::vector<Mach1Point3D> points);
83
84 void setOutputFormat(int outFmt);
85 void setOutputFormatCustomPointsJson(std::string outJson);
86 void setOutputFormatCustomPoints(std::vector<Mach1Point3D> points);
87
88 void setCustomPointsSamplerCallback(Mach1Point3D *(*callback)(long long, int &));
89
90 bool processConversionPath();
91 void getMatrixConversion(float *matrix);
92 void processConversion(float **inBufs, float **outBufs, int numSamples);
93
94 std::vector<int> &getFormatConversionPath();
95};
Definition M1DSPUtilities.h:22
Definition Mach1TranscodeCore.h:23
Definition Mach1Point3D.h:17
Definition Mach1TranscodeCore.h:17