コード例 #1
0
ファイル: c.gain~.cpp プロジェクト: rvega/CicmWrapper
void gain_mousedrag(t_gain *x, t_object *patcherview, t_pt pt, long modifiers)
{
    float newvalue, value;
    if(x->f_mode)
    {
        if(x->f_direction)
        {
            newvalue = pt.x / x->j_box.b_rect.width * 108. - 90.;
        }
        else
        {
            newvalue = (x->j_box.b_rect.height - pt.y) / x->j_box.b_rect.height * 108. - 90.;
        }
        value = pd_clip_minmax(x->f_value_last + newvalue - x->f_value_ref, -90., 18.);
        
        if(value == -90. || value == 18.)
        {
            x->f_value_last = value;
            x->f_value_ref  = newvalue;
        }
    }
    else
    {
        if(x->f_direction)
        {
            value = pd_clip_minmax(pt.x / x->j_box.b_rect.width * 108. - 90., -90., 18.);
        }
        else
        {
            value = pd_clip_minmax((x->j_box.b_rect.height - pt.y) / x->j_box.b_rect.height * 108. - 90., -90., 18.);
        }
    }
    
    gain_float(x, value);
}
コード例 #2
0
ファイル: c.gain~.cpp プロジェクト: rvega/CicmWrapper
void gain_mousedown(t_gain *x, t_object *patcherview, t_pt pt, long modifiers)
{
    float value;
    if(x->f_mode)
    {
        x->f_value_last = x->f_value;
        if(x->f_direction)
        {
            x->f_value_ref = pd_clip_minmax(pt.x / x->j_box.b_rect.width * 108. - 90., -90., 18.);
        }
        else
        {
            x->f_value_ref = pd_clip_minmax((x->j_box.b_rect.height - pt.y) / x->j_box.b_rect.height * 108. - 90., -90., 18.);
        }
    }
    else
    {
        if(x->f_direction)
        {
            value = pd_clip_minmax(pt.x / x->j_box.b_rect.width * 108. - 90., -90., 18.);
        }
        else
        {
            value = pd_clip_minmax((x->j_box.b_rect.height - pt.y) / x->j_box.b_rect.height * 108. - 90., -90., 18.);
        }
        gain_float(x, value);
    }
}
コード例 #3
0
ファイル: c.gain~.cpp プロジェクト: rvega/CicmWrapper
void gain_linear(t_gain *x, float f)
{
    f = pd_clip_minmax(f, 0.00001, 8.);
    f = (20.f * log10f(f));
    
    if(f < -90)
    {
        f  = -90.;
    }
    gain_float(x, f);
}
コード例 #4
0
ファイル: c.gain~.cpp プロジェクト: rvega/CicmWrapper
void gain_dblclick(t_gain *x, t_object *patcherview, t_pt pt, long modifiers)
{
    gain_float(x, 0.);
}
コード例 #5
0
static float equalizer_state_get(EqualizerState *s, int freqhz){
	int idx=equalizer_state_hz_to_index(s,freqhz);
	if (idx>=0) return gain_float(s->fft_cpx[idx*2])*s->nfft;
	return 0;
}