Merge fast detector with analyzer and use it in CBuffer
This commit is contained in:
1 parent
b1bca37bf8
commit
c781f5427f
11 files changed
+141
-314
No files matched your search
+26
-10
@@ -4,19 +4,35 @@
|
||||
|
||||
#define DllExport extern "C" __declspec(dllexport)
|
||||
|
||||
class AnalyzerExt: public Analyzer{
|
||||
public:
|
||||
AnalyzerExt(double baseToneFrequency, int minHalfTone, int maxHalfTone, unsigned step = 200);
|
||||
~AnalyzerExt();
|
||||
template <typename InIt> void input(InIt begin, InIt end){
|
||||
m_fastAnalysisBuf.insert(begin, end);
|
||||
Analyzer::input(begin, end);
|
||||
}
|
||||
int GetNoteFast(float* weights);
|
||||
private:
|
||||
constexpr static size_t m_SampleCt = 4096;
|
||||
RingBuffer<m_SampleCt * 2> m_fastAnalysisBuf; // Buffer used for fast analysis instead of FFT
|
||||
float m_AnalysisBuf[4096];
|
||||
};
|
||||
|
||||
DllExport void PtFast_Init(double baseToneFrequency, int minHalfTone, int maxHalfTone);
|
||||
DllExport void PtFast_DeInit();
|
||||
DllExport int PtFast_GetTone(short* samples, int sampleCt, float* weights);
|
||||
|
||||
DllExport Analyzer* Analyzer_Create(double rate, unsigned step);
|
||||
DllExport void Analyzer_Free(Analyzer* analyzer);
|
||||
DllExport void Analyzer_InputFloat(Analyzer* analyzer, float* data, int sampleCt);
|
||||
DllExport void Analyzer_InputShort(Analyzer* analyzer, short* data, int sampleCt);
|
||||
DllExport void Analyzer_InputByte(Analyzer* analyzer, char* data, int sampleCt);
|
||||
DllExport void Analyzer_Process(Analyzer* analyzer);
|
||||
DllExport double Analyzer_GetPeak(Analyzer* analyzer);
|
||||
DllExport double Analyzer_FindNote(Analyzer* analyzer, double minFreq, double maxFreq);
|
||||
DllExport bool Analyzer_OutputFloat(Analyzer* analyzer, float* data, int sampleCt, float rate);
|
||||
DllExport AnalyzerExt* Analyzer_Create(double baseToneFrequency, int minHalfTone, int maxHalfTone, unsigned step);
|
||||
DllExport void Analyzer_Free(AnalyzerExt* analyzer);
|
||||
DllExport void Analyzer_InputFloat(AnalyzerExt* analyzer, float* data, int sampleCt);
|
||||
DllExport void Analyzer_InputShort(AnalyzerExt* analyzer, short* data, int sampleCt);
|
||||
DllExport void Analyzer_InputByte(AnalyzerExt* analyzer, char* data, int sampleCt);
|
||||
DllExport void Analyzer_Process(AnalyzerExt* analyzer);
|
||||
DllExport double Analyzer_GetPeak(AnalyzerExt* analyzer);
|
||||
DllExport int Analyzer_GetNoteFast(AnalyzerExt* analyzer, float* weights);
|
||||
DllExport double Analyzer_FindNote(AnalyzerExt* analyzer, double minFreq, double maxFreq);
|
||||
DllExport bool Analyzer_OutputFloat(AnalyzerExt* analyzer, float* data, int sampleCt, float rate);
|
||||
|
||||
/*
|
||||
public ref class CTone {
|
||||
@@ -59,7 +75,7 @@ public:
|
||||
String^ GetId();
|
||||
|
||||
private:
|
||||
Analyzer* m_analyzer;
|
||||
AnalyzerExt* m_analyzer;
|
||||
String^ m_id;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user