Lines Matching refs:chorus
94 priv_t * chorus = (priv_t *) effp->priv; in sox_chorus_getopts() local
98 chorus->num_chorus = 0; in sox_chorus_getopts()
104 sscanf(argv[i++], "%f", &chorus->in_gain); in sox_chorus_getopts()
105 sscanf(argv[i++], "%f", &chorus->out_gain); in sox_chorus_getopts()
107 if ( chorus->num_chorus > MAX_CHORUS ) in sox_chorus_getopts()
112 sscanf(argv[i++], "%f", &chorus->delay[chorus->num_chorus]); in sox_chorus_getopts()
113 sscanf(argv[i++], "%f", &chorus->decay[chorus->num_chorus]); in sox_chorus_getopts()
114 sscanf(argv[i++], "%f", &chorus->speed[chorus->num_chorus]); in sox_chorus_getopts()
115 sscanf(argv[i++], "%f", &chorus->depth[chorus->num_chorus]); in sox_chorus_getopts()
117 chorus->modulation[chorus->num_chorus] = MOD_SINE; in sox_chorus_getopts()
119 chorus->modulation[chorus->num_chorus] = MOD_TRIANGLE; in sox_chorus_getopts()
123 chorus->num_chorus++; in sox_chorus_getopts()
133 priv_t * chorus = (priv_t *) effp->priv; in sox_chorus_start() local
137 chorus->maxsamples = 0; in sox_chorus_start()
139 if ( chorus->in_gain < 0.0 ) in sox_chorus_start()
144 if ( chorus->in_gain > 1.0 ) in sox_chorus_start()
149 if ( chorus->out_gain < 0.0 ) in sox_chorus_start()
154 for ( i = 0; i < chorus->num_chorus; i++ ) { in sox_chorus_start()
155 chorus->samples[i] = (int) ( ( chorus->delay[i] + in sox_chorus_start()
156 chorus->depth[i] ) * effp->in_signal.rate / 1000.0); in sox_chorus_start()
157 chorus->depth_samples[i] = (int) (chorus->depth[i] * in sox_chorus_start()
160 if ( chorus->delay[i] < 20.0 ) in sox_chorus_start()
165 if ( chorus->delay[i] > 100.0 ) in sox_chorus_start()
170 if ( chorus->speed[i] < 0.1 ) in sox_chorus_start()
175 if ( chorus->speed[i] > 5.0 ) in sox_chorus_start()
180 if ( chorus->depth[i] < 0.0 ) in sox_chorus_start()
185 if ( chorus->depth[i] > 10.0 ) in sox_chorus_start()
190 if ( chorus->decay[i] < 0.0 ) in sox_chorus_start()
195 if ( chorus->decay[i] > 1.0 ) in sox_chorus_start()
200 chorus->length[i] = effp->in_signal.rate / chorus->speed[i]; in sox_chorus_start()
201 chorus->lookup_tab[i] = lsx_malloc(sizeof (int) * chorus->length[i]); in sox_chorus_start()
203 if (chorus->modulation[i] == MOD_SINE) in sox_chorus_start()
204 lsx_generate_wave_table(SOX_WAVE_SINE, SOX_INT, chorus->lookup_tab[i], in sox_chorus_start()
205 … (size_t)chorus->length[i], 0., (double)chorus->depth_samples[i], 0.); in sox_chorus_start()
207 lsx_generate_wave_table(SOX_WAVE_TRIANGLE, SOX_INT, chorus->lookup_tab[i], in sox_chorus_start()
208 (size_t)chorus->length[i], in sox_chorus_start()
209 … (double)(chorus->samples[i] - 1 - 2 * chorus->depth_samples[i]), in sox_chorus_start()
210 (double)(chorus->samples[i] - 1), 3 * M_PI_2); in sox_chorus_start()
211 chorus->phase[i] = 0; in sox_chorus_start()
213 if ( chorus->samples[i] > chorus->maxsamples ) in sox_chorus_start()
214 chorus->maxsamples = chorus->samples[i]; in sox_chorus_start()
219 for ( i = 0; i < chorus->num_chorus; i++ ) in sox_chorus_start()
220 sum_in_volume += chorus->decay[i]; in sox_chorus_start()
221 if ( chorus->in_gain * ( sum_in_volume ) > 1.0 / chorus->out_gain ) in sox_chorus_start()
225 chorus->chorusbuf = lsx_malloc(sizeof (float) * chorus->maxsamples); in sox_chorus_start()
226 for ( i = 0; i < chorus->maxsamples; i++ ) in sox_chorus_start()
227 chorus->chorusbuf[i] = 0.0; in sox_chorus_start()
229 chorus->counter = 0; in sox_chorus_start()
230 chorus->fade_out = chorus->maxsamples; in sox_chorus_start()
244 priv_t * chorus = (priv_t *) effp->priv; in sox_chorus_flow() local
255 d_out = d_in * chorus->in_gain; in sox_chorus_flow()
256 for ( i = 0; i < chorus->num_chorus; i++ ) in sox_chorus_flow()
257 d_out += chorus->chorusbuf[(chorus->maxsamples + in sox_chorus_flow()
258 chorus->counter - chorus->lookup_tab[i][chorus->phase[i]]) % in sox_chorus_flow()
259 chorus->maxsamples] * chorus->decay[i]; in sox_chorus_flow()
261 d_out = d_out * chorus->out_gain; in sox_chorus_flow()
265 chorus->chorusbuf[chorus->counter] = d_in; in sox_chorus_flow()
266 chorus->counter = in sox_chorus_flow()
267 ( chorus->counter + 1 ) % chorus->maxsamples; in sox_chorus_flow()
268 for ( i = 0; i < chorus->num_chorus; i++ ) in sox_chorus_flow()
269 chorus->phase[i] = in sox_chorus_flow()
270 ( chorus->phase[i] + 1 ) % chorus->length[i]; in sox_chorus_flow()
281 priv_t * chorus = (priv_t *) effp->priv; in sox_chorus_drain() local
289 while ( ( done < *osamp ) && ( done < chorus->fade_out ) ) { in sox_chorus_drain()
293 for ( i = 0; i < chorus->num_chorus; i++ ) in sox_chorus_drain()
294 d_out += chorus->chorusbuf[(chorus->maxsamples + in sox_chorus_drain()
295 chorus->counter - chorus->lookup_tab[i][chorus->phase[i]]) % in sox_chorus_drain()
296 chorus->maxsamples] * chorus->decay[i]; in sox_chorus_drain()
298 d_out = d_out * chorus->out_gain; in sox_chorus_drain()
302 chorus->chorusbuf[chorus->counter] = d_in; in sox_chorus_drain()
303 chorus->counter = in sox_chorus_drain()
304 ( chorus->counter + 1 ) % chorus->maxsamples; in sox_chorus_drain()
305 for ( i = 0; i < chorus->num_chorus; i++ ) in sox_chorus_drain()
306 chorus->phase[i] = in sox_chorus_drain()
307 ( chorus->phase[i] + 1 ) % chorus->length[i]; in sox_chorus_drain()
309 chorus->fade_out--; in sox_chorus_drain()
313 if (chorus->fade_out == 0) in sox_chorus_drain()
324 priv_t * chorus = (priv_t *) effp->priv; in sox_chorus_stop() local
327 free(chorus->chorusbuf); in sox_chorus_stop()
328 chorus->chorusbuf = NULL; in sox_chorus_stop()
329 for ( i = 0; i < chorus->num_chorus; i++ ) { in sox_chorus_stop()
330 free(chorus->lookup_tab[i]); in sox_chorus_stop()
331 chorus->lookup_tab[i] = NULL; in sox_chorus_stop()