T13: NativeMixer mirror server pipeline (track gain/pan constant-power + brickwall limiter tanh, wired VST2/VST3 bridge, golden test 0.0001dB)
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "vestige.h"
|
||||
#include "AudioEngine.h"
|
||||
#include "NativeMixer.h"
|
||||
|
||||
#include <atomic>
|
||||
|
||||
@@ -50,6 +51,7 @@ struct Instance
|
||||
void* paramCbUserdata = nullptr;
|
||||
sonicforge::AudioEngine audio; // T12: native audio loop (SPSC + WASAPI)
|
||||
std::atomic<bool> audioRunning {false};
|
||||
sonicforge::NativeMixer mixer; // T13: track gain/pan + master limiter
|
||||
};
|
||||
|
||||
std::mutex g_mutex;
|
||||
@@ -163,6 +165,7 @@ bool vst2AudioProcess (const sonicforge::MidiEvent* events, int32 eventCount,
|
||||
{
|
||||
float* outs[2] = { outL, outR };
|
||||
inst->effect->processReplacing (inst->effect, nullptr, outs, frames);
|
||||
inst->mixer.processInPlace (outL, outR, frames); // T13: gain/pan + limiter
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -602,4 +605,26 @@ __declspec (dllexport) int32 SF_VST2_AudioBlocks (int32 handle)
|
||||
return it->second->audio.blocksRendered ();
|
||||
}
|
||||
|
||||
// T13: track gain/pan + master limiter (NativeMixer). Set truoc AudioStart;
|
||||
// audio thread doc state nay (khong lock).
|
||||
__declspec (dllexport) int32 SF_VST2_SetTrackGainPan (int32 handle, float gainDb, float pan)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock (g_mutex);
|
||||
auto it = g_instances.find (handle);
|
||||
if (it == g_instances.end ())
|
||||
return -1;
|
||||
it->second->mixer.setTrack (sonicforge::TrackGainPan::fromDbPan (gainDb, pan));
|
||||
return 0;
|
||||
}
|
||||
|
||||
__declspec (dllexport) int32 SF_VST2_SetMasterLimiter (int32 handle, int32 active, float thresholdDb)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock (g_mutex);
|
||||
auto it = g_instances.find (handle);
|
||||
if (it == g_instances.end ())
|
||||
return -1;
|
||||
it->second->mixer.setLimiter (active != 0, thresholdDb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
Reference in New Issue
Block a user