summaryrefslogtreecommitdiff
path: root/muse2/plugins/pandelay/ladspapandelay.cpp
blob: 90ff3bb8c7923e2c8581ec556ce06338e3756346 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//===========================================================================
//
//    ladspapandelay
//
//    Version 0.0.1
//
//
//
//
//  Copyright (c) 2006 Nil Geisweiller
//
//
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
// 02110-1301, USA or point your web browser to http://www.gnu.org.
//===========================================================================

#include "ladspapandelay.h"

//---------------------------------------------------------
//     PanDelay
//---------------------------------------------------------

LADSPAPanDelay::LADSPAPanDelay(unsigned long samplerate) 
  : PanDelayModel(samplerate) {
  //TODO init param 
}

LADSPAPanDelay::~LADSPAPanDelay() {
}

//---------------------------------------------------------
//   activate
//---------------------------------------------------------

void LADSPAPanDelay::activate() {
  *port[4] = param[0];
  *port[5] = param[1];
  *port[6] = param[2];
  *port[7] = param[3];
  *port[8] = param[4];
  *port[9] = param[5];
}

void LADSPAPanDelay::updateParameters() {
  if (param[0] != *port[4]) {
    param[0] = *port[4];
    setBPM(param[0]);
  }
  if (param[1] != *port[5]) {
    param[1] = *port[5];
    setBeatRatio(param[1]);
  }
  if (param[2] != *port[6]) {
    param[2] = *port[6];
    setFeedback(param[2]);
  }
  if (param[3] != *port[7]) {
    param[3] = *port[7];
    setPanLFOFreq(param[3]);
  }
  if (param[4] != *port[8]) {
    param[4] = *port[8];
    setPanLFODepth(param[4]);
  }
  if (param[5] != *port[9]) {
    param[5] = *port[9];
    setDryWet(param[5]);
  }
}

//---------------------------------------------------------
//   processReplace
//---------------------------------------------------------

void LADSPAPanDelay::processReplace(long n) {
  updateParameters();
  PanDelayModel::processReplace(port[0], port[1], port[2], port[3], n);
}

//---------------------------------------------------------
//   processMix
//---------------------------------------------------------

void LADSPAPanDelay::processMix(long n) {
  updateParameters();
  PanDelayModel::processMix(port[0], port[1], port[2], port[3], n);
}