Runtime and build - Move all projects to .NET 10 with SDK-style project files and a shared Directory.Build.props (WIN/LINUX, x86/x64 defines) - Load managed and unmanaged dependencies from libs/managed and libs/unmanaged through assembly and native library resolvers - Compile party modes with Roslyn instead of CodeDom - Update AppVeyor to the .NET 10 SDK and dotnet test - Download the FFmpeg and gstreamer runtimes from the dependencies repository during the build - Remove the VC++ 2015-2022 runtime check, no dependency needs it anymore Graphics and windowing - Replace the Direct3D 9 renderer with Direct3D 11 (Vortice) - Pace Direct3D 11 frames with a frame latency waitable swap chain - Move window, input and message boxes to SDL3 - Replace System.Drawing with SkiaSharp and WinForms with SDL3 and a software renderer Video and audio - Replace Acinerella with FFmpeg 8.1.3 (FFmpeg.AutoGen) - Add hardware accelerated video decoding (D3D11VA, DXVA2, VideoToolbox, VAAPI, VDPAU) with software fallback - Convert YUV video frames to RGB on the GPU in Direct3D 11 and OpenGL - Add the video options HardwareDecoding, GpuColorConversion, DecoderThreads and VideoDownscaleResolution - Update OpenAL to OpenTK 4 and NAudio recording to WasapiRecorder Fixes - Fix the song preview start and shorten the reporter buttons - Fix a crash when opening the highscore without a selected song - Use the options slide highlight in the party mode screens to avoid brightness flicker on VRR displays - Disable GameInput in the x86 build, SDL3 crashes in GameInputCreate on 32-bit systems with the GameInput runtime installed - Fix a truncation warning in PitchTracker
90 lines
3.1 KiB
C++
90 lines
3.1 KiB
C++
#pragma once
|
|
|
|
#include "performous/pitch.hh"
|
|
#include "ptAKF.h"
|
|
#include "dywapitchtrack/ptDyWa.h"
|
|
|
|
#if defined(__linux__) || defined(__APPLE__)
|
|
#define DllExport extern "C"
|
|
#else
|
|
#define DllExport extern "C" __declspec(dllexport)
|
|
#endif
|
|
|
|
|
|
DllExport Analyzer* Analyzer_Create(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 float 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 PtAKF* PtAKF_Create(unsigned step);
|
|
DllExport void PtAKF_Free(PtAKF* analyzer);
|
|
DllExport int PtAKF_GetNumHalfTones();
|
|
DllExport void PtAKF_SetVolumeThreshold(PtAKF* analyzer, float threshold);
|
|
DllExport float PtAKF_GetVolumeThreshold(PtAKF* analyzer);
|
|
DllExport void PtAKF_InputByte(PtAKF* analyzer, char* data, int sampleCt);
|
|
DllExport int PtAKF_GetNote(PtAKF* analyzer, float* maxVolume, float* weights);
|
|
|
|
DllExport PtDyWa* PtDyWa_Create(unsigned step);
|
|
DllExport void PtDyWa_Free(PtDyWa* analyzer);
|
|
DllExport void PtDyWa_SetVolumeTreshold(PtDyWa* analyzer,float threshold);
|
|
DllExport float PtDyWa_GetVolumeThreshold(PtDyWa* analyzer);
|
|
DllExport void PtDyWa_InputByte(PtDyWa* analyzer, char* data, int sampleCt);
|
|
DllExport double PtDyWa_FindNote(PtDyWa* analyzer, float* maxVolume);
|
|
|
|
/*
|
|
public ref class CTone {
|
|
public:
|
|
static const int MAXHARM = 48; ///< The maximum number of harmonics tracked
|
|
static const int MINAGE = 2; ///< The minimum age required for a tone to be output
|
|
double Freq; ///< Frequency (Hz)
|
|
double DB; ///< Level (dB)
|
|
double Stabledb; ///< Stable level, useful for graphics rendering
|
|
int Age; ///< How many times the tone has been detected in row
|
|
double NoteExact;
|
|
int Note;
|
|
/// Less-than compare by levels (instead of frequencies like operator< does)
|
|
static bool dbCompare(CTone l, CTone r) { return l.DB < r.DB; }
|
|
};
|
|
|
|
public ref class CAnalyzer {
|
|
public:
|
|
CAnalyzer(double rate, String^ id) {
|
|
m_analyzer = new Analyzer(rate,"");
|
|
m_id = id;
|
|
}
|
|
CAnalyzer(double rate, String^ id, unsigned step) {
|
|
m_analyzer = new Analyzer(rate,"",step);
|
|
m_id = id;
|
|
}
|
|
~CAnalyzer() { this->!CAnalyzer(); }
|
|
!CAnalyzer() { delete m_analyzer; }
|
|
|
|
void Input(array<float>^ data);
|
|
void Input(array<short>^ data);
|
|
void Input(array<Byte>^ data);
|
|
void Process();
|
|
double GetPeak();
|
|
array<CTone^>^ GetTones();
|
|
CTone^ FindTone();
|
|
CTone^ FindTone(double minFreq);
|
|
CTone^ FindTone(double minFreq, double maxFreq);
|
|
void Output(array<float>^ data, float rate);
|
|
String^ GetId();
|
|
|
|
private:
|
|
Analyzer* m_analyzer;
|
|
String^ m_id;
|
|
};
|
|
|
|
public ref class CPitchTracker abstract sealed{
|
|
public:
|
|
static void Init(double baseToneFrequency, int minHalfTone, int maxHalfTone);
|
|
static void DeInit();
|
|
static int GetTone(array<short>^ samples, array<float>^ weights);
|
|
};
|
|
*/ |