T15: drop WebAudio master for tracks - native master gain + track gain/pan IPC (SF/VST2/VST3 bridges), NativeAudioService + /api/v1/native router, native-first TrackInstrument, test matrix 8 passed
This commit is contained in:
@@ -82,8 +82,10 @@ void NativeMixer::processInPlace (float* outL, float* outR, int32 frames) const
|
||||
else if (r < -1.0f)
|
||||
r = -1.0f;
|
||||
}
|
||||
outL[i] = l;
|
||||
outR[i] = r;
|
||||
// Master fader (T15): sau limiter+clip, linear, khong re-clip — mirror
|
||||
// WebAudio masterBus.output.gain (gain node cuoi cung sau mastering).
|
||||
outL[i] = l * m_masterGain;
|
||||
outR[i] = r * m_masterGain;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,10 @@ public:
|
||||
// thresholdDb clamp -24..0, NaN -> -1 (mirror _clamp trong mastering_engine).
|
||||
void setLimiter (bool active, float thresholdDb);
|
||||
|
||||
// Master fader (T15) — mirror WebAudio masterBus.output.gain (sau mastering
|
||||
// chain + clip; linear, khong re-clip). Mac dinh 1.0.
|
||||
void setMasterGain (float gainLinear) { m_masterGain = gainLinear; }
|
||||
|
||||
// Ap track gain/pan vao buffer roi (neu active) limiter + hard clip [-1,1]
|
||||
// ngay tai buffer (in-place). frames > 0.
|
||||
void processInPlace (float* outL, float* outR, int32 frames) const;
|
||||
@@ -49,6 +53,7 @@ private:
|
||||
bool m_limActive = false;
|
||||
float m_limK = 1.0f; // 1/max(0.02, t_lin)
|
||||
float m_limTk = 1.0f; // tanh(k)
|
||||
float m_masterGain = 1.0f; // T15: master fader (sau limiter+clip, khong re-clip)
|
||||
};
|
||||
|
||||
} // namespace sonicforge
|
||||
|
||||
@@ -409,6 +409,18 @@ __declspec (dllexport) int32 SF_FS_SetMasterLimiter (int32 handle, int32 active,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// T15: master fader — linear, ap sau limiter+clip trong mixer (mirror
|
||||
// masterBus.output.gain WebAudio).
|
||||
__declspec (dllexport) int32 SF_FS_SetMasterGain (int32 handle, float gainLinear)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock (g_mutex);
|
||||
auto it = g_instances.find (handle);
|
||||
if (it == g_instances.end ())
|
||||
return -1;
|
||||
it->second->mixer.setMasterGain (gainLinear);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Đóng: stop audio loop, xóa synth, giải phóng DLL.
|
||||
__declspec (dllexport) int32 SF_FS_Close (int32 handle, char* err, int32 err_cap)
|
||||
{
|
||||
|
||||
@@ -627,4 +627,15 @@ __declspec (dllexport) int32 SF_VST2_SetMasterLimiter (int32 handle, int32 activ
|
||||
return 0;
|
||||
}
|
||||
|
||||
// T15: master fader — mirror masterBus.output.gain WebAudio (sau limiter+clip).
|
||||
__declspec (dllexport) int32 SF_VST2_SetMasterGain (int32 handle, float gainLinear)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock (g_mutex);
|
||||
auto it = g_instances.find (handle);
|
||||
if (it == g_instances.end ())
|
||||
return -1;
|
||||
it->second->mixer.setMasterGain (gainLinear);
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
@@ -573,4 +573,15 @@ __declspec (dllexport) int32 SF_VST3_SetMasterLimiter (int32 handle, int32 activ
|
||||
return 0;
|
||||
}
|
||||
|
||||
// T15: master fader — mirror masterBus.output.gain WebAudio (sau limiter+clip).
|
||||
__declspec (dllexport) int32 SF_VST3_SetMasterGain (int32 handle, float gainLinear)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock (g_mutex);
|
||||
auto it = g_instances.find (handle);
|
||||
if (it == g_instances.end ())
|
||||
return -1;
|
||||
it->second->mixer.setMasterGain (gainLinear);
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
Reference in New Issue
Block a user