~ubuntu-branches/ubuntu/precise/lmms/precise-updates

« back to all changes in this revision

Viewing changes to plugins/ladspa_effect/calf/src/modules_mod.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Артём Попов
  • Date: 2011-02-14 20:58:36 UTC
  • mfrom: (1.1.10 upstream) (3.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110214205836-2u41xus1d2mj8nfz
Tags: 0.4.10-1ubuntu1
* Merge from debian unstable (LP: #718801).  Remaining changes:
  - Replace build-dep on libwine-dev with wine1.2-dev to build
    against the newer Wine.

Show diffs side-by-side

added added

removed removed

Lines of Context:
231
231
{
232
232
}
233
233
 
234
 
void rotary_speaker_audio_module::control_change(int ctl, int val)
 
234
void rotary_speaker_audio_module::control_change(int /*channel*/, int ctl, int val)
235
235
{
236
236
    if (vibrato_mode == 3 && ctl == 64)
237
237
    {
321
321
 
322
322
uint32_t rotary_speaker_audio_module::process(uint32_t offset, uint32_t nsamples, uint32_t inputs_mask, uint32_t outputs_mask)
323
323
{
 
324
    if (true)
 
325
    {
 
326
        crossover2l.set_bp_rbj(2000.f, 0.7, (float)srate);
 
327
        crossover2r.copy_coeffs(crossover2l);
 
328
        damper1l.set_bp_rbj(1000.f*pow(4.0, *params[par_test]), 0.7, (float)srate);
 
329
        damper1r.copy_coeffs(damper1l);
 
330
    }
 
331
    else
 
332
    {
 
333
        crossover2l.set_hp_rbj(800.f, 0.7, (float)srate);
 
334
        crossover2r.copy_coeffs(crossover2l);
 
335
    }
324
336
    int shift = (int)(300000 * (*params[par_shift])), pdelta = (int)(300000 * (*params[par_spacing]));
325
337
    int md = (int)(100 * (*params[par_moddepth]));
326
338
    float mix = 0.5 * (1.0 - *params[par_micdistance]);
327
339
    float mix2 = *params[par_reflection];
328
340
    float mix3 = mix2 * mix2;
 
341
    float am_depth = *params[par_am_depth];
329
342
    for (unsigned int i = 0; i < nsamples; i++) {
330
343
        float in_l = ins[0][i + offset], in_r = ins[1][i + offset];
331
 
        float in_mono = 0.5f * (in_l + in_r);
 
344
        float in_mono = atan(0.5f * (in_l + in_r));
332
345
        
333
346
        int xl = pseudo_sine_scl(phase_l), yl = pseudo_sine_scl(phase_l + 0x40000000);
334
347
        int xh = pseudo_sine_scl(phase_h), yh = pseudo_sine_scl(phase_h + 0x40000000);
337
350
        meter_h = xh;
338
351
        // float out_hi_l = in_mono - delay.get_interp_1616(shift + md * xh) + delay.get_interp_1616(shift + md * 65536 + pdelta - md * yh) - delay.get_interp_1616(shift + md * 65536 + pdelta + pdelta - md * xh);
339
352
        // float out_hi_r = in_mono + delay.get_interp_1616(shift + md * 65536 - md * yh) - delay.get_interp_1616(shift + pdelta + md * xh) + delay.get_interp_1616(shift + pdelta + pdelta + md * yh);
340
 
        float out_hi_l = in_mono + delay.get_interp_1616(shift + md * xh) - mix2 * delay.get_interp_1616(shift + md * 65536 + pdelta - md * yh) + mix3 * delay.get_interp_1616(shift + md * 65536 + pdelta + pdelta - md * xh);
341
 
        float out_hi_r = in_mono + delay.get_interp_1616(shift + md * 65536 - md * yh) - mix2 * delay.get_interp_1616(shift + pdelta + md * xh) + mix3 * delay.get_interp_1616(shift + pdelta + pdelta + md * yh);
 
353
        float fm_hi_l = delay.get_interp_1616(shift + md * xh) - mix2 * delay.get_interp_1616(shift + md * 65536 + pdelta - md * yh) + mix3 * delay.get_interp_1616(shift + md * 65536 + pdelta + pdelta - md * xh);
 
354
        float fm_hi_r = delay.get_interp_1616(shift + md * 65536 - md * yh) - mix2 * delay.get_interp_1616(shift + pdelta + md * xh) + mix3 * delay.get_interp_1616(shift + pdelta + pdelta + md * yh);
 
355
        float out_hi_l = lerp(in_mono, damper1l.process(fm_hi_l), lerp(0.5, xh * 1.0 / 65536.0, am_depth));
 
356
        float out_hi_r = lerp(in_mono, damper1r.process(fm_hi_r), lerp(0.5, yh * 1.0 / 65536.0, am_depth));
342
357
 
343
 
        float out_lo_l = in_mono + delay.get_interp_1616(shift + md * xl); // + delay.get_interp_1616(shift + md * 65536 + pdelta - md * yl);
344
 
        float out_lo_r = in_mono + delay.get_interp_1616(shift + md * yl); // - delay.get_interp_1616(shift + pdelta + md * yl);
 
358
        float out_lo_l = lerp(in_mono, delay.get_interp_1616(shift + (md * xl >> 2)), lerp(0.5, yl * 1.0 / 65536.0, am_depth)); // + delay.get_interp_1616(shift + md * 65536 + pdelta - md * yl);
 
359
        float out_lo_r = lerp(in_mono, delay.get_interp_1616(shift + (md * yl >> 2)), lerp(0.5, xl * 1.0 / 65536.0, am_depth)); // + delay.get_interp_1616(shift + md * 65536 + pdelta - md * yl);
345
360
        
346
361
        out_hi_l = crossover2l.process(out_hi_l); // sanitize(out_hi_l);
347
362
        out_hi_r = crossover2r.process(out_hi_r); // sanitize(out_hi_r);
354
369
        float mic_l = out_l + mix * (out_r - out_l);
355
370
        float mic_r = out_r + mix * (out_l - out_r);
356
371
        
357
 
        outs[0][i + offset] = mic_l * 0.5f;
358
 
        outs[1][i + offset] = mic_r * 0.5f;
 
372
        outs[0][i + offset] = mic_l;
 
373
        outs[1][i + offset] = mic_r;
359
374
        delay.put(in_mono);
360
375
        phase_l += dphase_l;
361
376
        phase_h += dphase_h;
364
379
    crossover1r.sanitize();
365
380
    crossover2l.sanitize();
366
381
    crossover2r.sanitize();
 
382
    damper1l.sanitize();
 
383
    damper1r.sanitize();
367
384
    float delta = nsamples * 1.0 / srate;
368
385
    if (vibrato_mode == 5)
369
386
        update_speed_manual(delta);