5b769082da9fe9bc1006b930218a47dd7be73152
[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 EOF
89
90 git add gitrev.txt base dsp ext maths