Improvements to the pitch screen UI (FS#10359 by David Johnston)
[kugel-rb.git] / apps / tdspeed.h
blob2fd9498448f598815634f03af69bac8c0c6b9c21
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2006 by Nicolas Pitre <nico@cam.org>
11 * Copyright (C) 2006-2007 by Stéphane Doyon <s.doyon@videotron.ca>
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
23 #ifndef _TDSPEED_H
24 #define _TDSPEED_H
26 #include "dsp.h"
27 /* for the precision #defines: */
28 #include "pitchscreen.h"
30 #define TDSPEED_OUTBUFSIZE 4096
32 /* some #define functions to get the pitch, stretch and speed values based on */
33 /* two known values. Remember that params are alphabetical. */
34 #define GET_SPEED(pitch, stretch) \
35 ((pitch * stretch + PITCH_SPEED_100 / 2L) / PITCH_SPEED_100)
36 #define GET_PITCH(speed, stretch) \
37 ((speed * PITCH_SPEED_100 + stretch / 2L) / stretch)
38 #define GET_STRETCH(pitch, speed) \
39 ((speed * PITCH_SPEED_100 + pitch / 2L) / pitch)
41 void tdspeed_init(void);
42 bool tdspeed_config(int samplerate, bool stereo, int32_t factor);
43 long tdspeed_est_output_size(void);
44 long tdspeed_est_input_size(long size);
45 int tdspeed_doit(int32_t *src[], int count);
47 #define STRETCH_MAX (250L * PITCH_SPEED_PRECISION) /* 250% */
48 #define STRETCH_MIN (35L * PITCH_SPEED_PRECISION) /* 35% */
50 #endif