Exemple #1
0
int
supereq_process (ddb_dsp_context_t *ctx, float *samples, int frames, int maxframes, ddb_waveformat_t *fmt, float *r) {
    ddb_supereq_ctx_t *supereq = (ddb_supereq_ctx_t *)ctx;
    if (supereq->enabled != ctx->enabled) {
        if (ctx->enabled && !supereq->enabled) {
            supereq_reset (ctx);
        }
        supereq->enabled = ctx->enabled;

// this causes a glitch on 1st track
//        DB_playItem_t *it = deadbeef->streamer_get_playing_track ();
//        if (it) {
//            float playpos = deadbeef->streamer_get_playpos ();
//            deadbeef->streamer_seek (playpos);
//            deadbeef->pl_item_unref (it);
//        }
    }
    if (supereq->params_changed) {
        recalc_table (supereq);
        supereq->params_changed = 0;
    }
	if (supereq->last_srate != fmt->samplerate || supereq->last_nch != fmt->channels) {
        deadbeef->mutex_lock (supereq->mutex);
		supereq->last_srate = fmt->samplerate;
		supereq->last_nch = fmt->channels;
        equ_init (&supereq->state, 10, fmt->channels);
        recalc_table (supereq);
		equ_clearbuf(&supereq->state);
        deadbeef->mutex_unlock (supereq->mutex);
    }
	equ_modifySamples_float(&supereq->state, (char *)samples,frames,fmt->channels);
	return frames;
}
void CMusikFX::InitEQ(float freq)
{
	if(!m_bIsInitialized)
	{
		m_bIsInitialized = true;
		m_Frequency = freq;
		equ_init( 14 );		//--- no one knows why, 14 is the magic number ---//
		MakeTable( m_Frequency );
	}
}
Exemple #3
0
ddb_dsp_context_t*
supereq_open (void) {
    ddb_supereq_ctx_t *supereq = malloc (sizeof (ddb_supereq_ctx_t));
    DDB_INIT_DSP_CONTEXT (supereq,ddb_supereq_ctx_t,&plugin);

    equ_init (&supereq->state, 10, 2);
    supereq->paramsroot = paramlist_alloc ();
    supereq->last_srate = 44100;
    supereq->last_nch = 2;
    supereq->mutex = deadbeef->mutex_create ();
    supereq->preamp = 1;
    for (int i = 0; i < 18; i++) {
        supereq->bands[i] = 1;
    }
    recalc_table (supereq);
    equ_clearbuf (&supereq->state);

    return (ddb_dsp_context_t*)supereq;
}