replace ::cast_dynamic() with relevant ActionManager::get_*_action() calls
[ardour.git] / tools / update_qm-dsp.sh
1 #!/bin/sh
2
3 if ! test -f wscript || ! test -d gtk2_ardour || ! test -d libs/qm-dsp/;then
4         echo "This script needs to run from ardour's top-level src tree"
5         exit 1
6 fi
7
8 if test -z "`which rsync`" -o -z "`which git`"; then
9         echo "this script needs rsync and git"
10         exit 1
11 fi
12
13 ASRC=`pwd`
14 set -e
15
16 TMP=`mktemp -d`
17 test -d "$TMP"
18 echo $TMP
19 trap "rm -rf $TMP" EXIT
20
21 cd $TMP
22 git clone git://github.com/c4dm/qm-dsp.git qm-dsp
23 cd qm-dsp
24 git describe --tags > "$ASRC/libs/qm-dsp/gitrev.txt"
25 QMDSP="$TMP/qm-dsp"
26
27 cd "$ASRC/libs/qm-dsp"
28 find base dsp ext maths -type f -exec rsync -c --progress "$QMDSP/{}" "{}" \;
29
30
31 ## this applies to qm-vamp-plugins-v1.7.1-20-g4d15479
32 ## (see also Ardour 5.8-250-gc0c24aff7)
33 patch -p3 << EOF
34 diff --git a/libs/qm-dsp/dsp/signalconditioning/FiltFilt.cpp b/libs/qm-dsp/dsp/signalconditioning/FiltFilt.cpp
35 index 714d5755d..c88641de7 100644
36 --- a/libs/qm-dsp/dsp/signalconditioning/FiltFilt.cpp
37 +++ b/libs/qm-dsp/dsp/signalconditioning/FiltFilt.cpp
38 @@ -35,6 +35,13 @@ void FiltFilt::process(double *src, double *dst, unsigned int length)
39  
40      if (length == 0) return;
41  
42 +    if (length < 2) {
43 +       for( i = 0; i < length; i++ ) {
44 +           dst[i] = src [i];
45 +       }
46 +       return;
47 +    }
48 +
49      unsigned int nFilt = m_ord + 1;
50      unsigned int nFact = 3 * ( nFilt - 1);
51      unsigned int nExt  = length + 2 * nFact;
52 @@ -58,11 +65,16 @@ void FiltFilt::process(double *src, double *dst, unsigned int length)
53         filtScratchIn[ index++ ] = sample0 - src[ i ];
54      }
55      index = 0;
56 -    for( i = 0; i < nFact; i++ )
57 +    for( i = 0; i < nFact && i + 2 < length; i++ )
58      {
59         filtScratchIn[ (nExt - nFact) + index++ ] = sampleN - src[ (length - 2) - i ];
60      }
61  
62 +    for(; i < nFact; i++ )
63 +    {
64 +       filtScratchIn[ (nExt - nFact) + index++ ] = 0;
65 +    }
66 +
67      index = 0;
68      for( i = 0; i < length; i++ )
69      {
70 EOF
71
72 ## this applies to qm-vamp-plugins-v1.7.1-20-g4d15479
73 ## fix OSX 10.5 / PPC builds gcc4.2
74 patch -p3 << EOF
75 diff --git a/libs/qm-dsp/base/KaiserWindow.h b/libs/qm-dsp/base/KaiserWindow.h
76 index f16a4b6c1..0253d6d4c 100644
77 --- a/libs/qm-dsp/base/KaiserWindow.h
78 +++ b/libs/qm-dsp/base/KaiserWindow.h
79 @@ -81,7 +81,7 @@ public:
80      }
81  
82      const double *getWindow() const { 
83 -       return m_window.data();
84 +       return &m_window[0];
85      }
86  
87      void cut(double *src) const { 
88 diff --git a/libs/qm-dsp/base/SincWindow.h b/libs/qm-dsp/base/SincWindow.h
89 index bb35d90c2..02de92867 100644
90 --- a/libs/qm-dsp/base/SincWindow.h
91 +++ b/libs/qm-dsp/base/SincWindow.h
92 @@ -37,7 +37,7 @@ public:
93      }
94  
95      const double *getWindow() const { 
96 -       return m_window.data();
97 +       return &m_window[0];
98      }
99  
100      void cut(double *src) const { 
101 EOF
102
103 ## this applies to qm-vamp-plugins-v1.7.1-20-g4d15479
104 ## MSVC compatibility
105 patch -p3 << EOF
106 diff --git a/libs/qm-dsp/dsp/signalconditioning/Filter.cpp b/libs/qm-dsp/dsp/signalconditioning/Filter.cpp
107 index e9523e229..53fb35abe 100644
108 --- a/libs/qm-dsp/dsp/signalconditioning/Filter.cpp
109 +++ b/libs/qm-dsp/dsp/signalconditioning/Filter.cpp
110 @@ -74,8 +74,8 @@ Filter::reset()
111  }
112  
113  void
114 -Filter::process(const double *const __restrict__ in,
115 -               double *const __restrict__ out,
116 +Filter::process(const double *const __restrict in,
117 +               double *const __restrict out,
118                 const int n)
119  {
120      for (int s = 0; s < n; ++s) {
121 diff --git a/libs/qm-dsp/dsp/signalconditioning/Filter.h b/libs/qm-dsp/dsp/signalconditioning/Filter.h
122 index 05f79e972..8c1aee731 100644
123 --- a/libs/qm-dsp/dsp/signalconditioning/Filter.h
124 +++ b/libs/qm-dsp/dsp/signalconditioning/Filter.h
125 @@ -42,8 +42,8 @@ public:
126       * write the resulting \arg n samples into \arg out. There must be
127       * enough room in \arg out for \arg n samples to be written.
128       */
129 -    void process(const double *const __restrict__ in,
130 -                 double *const __restrict__ out,
131 +    void process(const double *const __restrict in,
132 +                 double *const __restrict out,
133                   const int n);
134  
135      int getOrder() const { return m_order; }
136 EOF
137
138 git add gitrev.txt base dsp ext maths