HydrogenAudio

Hosted Forums => foobar2000 => Uploads - (fb2k) => Topic started by: lvqcl on 2012-06-14 15:55:20

Title: foo_dsp_invhardlimit (for fb2k 1.1+)
Post by: lvqcl on 2012-06-14 15:55:20
DLL: [attachment=7024:foo_dsp_...ardlimit.zip]

Code:
Code: [Select]
#include "../SDK/foobar2000.h"
#include <boost\math\special_functions\atanh.hpp>

DECLARE_COMPONENT_VERSION("Hard Limiter Inversion", "0.0.1", "");

class dsp_invlimiter : public dsp_impl_base
{
public:
dsp_invlimiter() {}

static GUID g_get_guid() { // {C4688FBC-CCB3-4F35-8F13-E8F1760FBD32}
static const GUID guid = { 0xc4688fbc, 0xccb3, 0x4f35, { 0x8f, 0x13, 0xe8, 0xf1, 0x76, 0xf, 0xbd, 0x32 } };
return guid;
}

static void g_get_name(pfc::string_base & p_out) { p_out = "Invert HardLimiter"; }

static bool g_have_config_popup() { return false; }

virtual void on_endoftrack(abort_callback & p_abort) { }

virtual void on_endofplayback(abort_callback & p_abort) { }

virtual void flush() {}

virtual double get_latency() { return 0.0; }

virtual bool need_track_change_mark() { return false; }

virtual bool on_chunk(audio_chunk * chunk, abort_callback & p_abort)
{
static const float limiter_max = 0.9999f;
static const float limiter_max_05 = limiter_max - 0.5f;

audio_sample * ptr = chunk->get_data();
t_size n;
for(n = chunk->get_data_length(); n; --n)
{
double val = *ptr;

if (val < -0.5)
{
if (val < -limiter_max + DBL_EPSILON) val = -limiter_max + DBL_EPSILON;
val = (boost::math::atanh((val + 0.5) / limiter_max_05) * limiter_max_05 - 0.5);
}
else if (val > 0.5)
{
if (val > limiter_max - DBL_EPSILON) val = limiter_max - DBL_EPSILON;
val = (boost::math::atanh((val - 0.5) / limiter_max_05) * limiter_max_05 + 0.5);
}

*ptr = (audio_sample) val;
ptr++;
}
return true;
}
};

static dsp_factory_nopreset_t<dsp_invlimiter> foo_dsp_invlimiter;

The idea is to cancel the effect of a limiter in foo_dsp_winamp.
Title: foo_dsp_invhardlimit (for fb2k 1.1+)
Post by: DJ_DOGGY on 2013-06-04 18:44:35
Instead of this , try to find the source of the foo_dsp_winamp and remove it from the real source.
Title: foo_dsp_invhardlimit (for fb2k 1.1+)
Post by: lvqcl on 2013-06-04 19:06:06
(http://farm8.staticflickr.com/7011/6809360751_85c9f0282b_z.jpg)
Title: foo_dsp_invhardlimit (for fb2k 1.1+)
Post by: mudlord on 2014-02-15 05:32:28
No.
Title: Re: foo_dsp_invhardlimit (for fb2k 1.1+)
Post by: markanini on 2018-07-24 17:46:27
Can you explain how it works?