comparison audioio/PhaseVocoderTimeStretcher.h @ 25:e74f508db18c

* Add setRatio method to the time stretcher, and make it possible to change the ratio without having to construct and replace the time stretcher. This means we can do it seamlessly. Add a lot more ratios to the time stretch control in the main window
author Chris Cannam
date Fri, 15 Sep 2006 15:35:06 +0000
parents a2ad974b0c8c
children d88d117e0c34
comparison
equal deleted inserted replaced
24:ae0731ba8e67 25:e74f508db18c
18 18
19 #include "base/Window.h" 19 #include "base/Window.h"
20 #include "base/RingBuffer.h" 20 #include "base/RingBuffer.h"
21 21
22 #include <fftw3.h> 22 #include <fftw3.h>
23
24 #include <QMutex>
23 25
24 /** 26 /**
25 * A time stretcher that alters the performance speed of audio, 27 * A time stretcher that alters the performance speed of audio,
26 * preserving pitch. 28 * preserving pitch.
27 * 29 *
85 void getOutput(float **output, size_t samples); 87 void getOutput(float **output, size_t samples);
86 88
87 //!!! and reset? 89 //!!! and reset?
88 90
89 /** 91 /**
92 * Change the time stretch ratio.
93 */
94 void setRatio(float ratio);
95
96 /**
90 * Get the hop size for input. 97 * Get the hop size for input.
91 */ 98 */
92 size_t getInputIncrement() const { return m_n1; } 99 size_t getInputIncrement() const { return m_n1; }
93 100
94 /** 101 /**
139 * magnitude afterwards. 146 * magnitude afterwards.
140 */ 147 */
141 void synthesiseBlock(size_t channel, float *out, float *modulation, 148 void synthesiseBlock(size_t channel, float *out, float *modulation,
142 size_t lastStep); 149 size_t lastStep);
143 150
151 void initialise();
152 void calculateParameters();
153 void cleanup();
154
144 size_t m_sampleRate; 155 size_t m_sampleRate;
145 size_t m_channels; 156 size_t m_channels;
157 size_t m_maxProcessInputBlockSize;
146 float m_ratio; 158 float m_ratio;
147 bool m_sharpen; 159 bool m_sharpen;
148 size_t m_n1; 160 size_t m_n1;
149 size_t m_n2; 161 size_t m_n2;
150 size_t m_wlen; 162 size_t m_wlen;
171 183
172 RingBuffer<float> **m_inbuf; 184 RingBuffer<float> **m_inbuf;
173 RingBuffer<float> **m_outbuf; 185 RingBuffer<float> **m_outbuf;
174 float **m_mashbuf; 186 float **m_mashbuf;
175 float *m_modulationbuf; 187 float *m_modulationbuf;
188
189 QMutex *m_mutex;
176 }; 190 };
177 191
178 #endif 192 #endif