Minot coding style fix
[zyn.git] / portamento.h
blob76d9b6e7c0f4f0c92ef26d7b21c5ee3b6a3558a1
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*****************************************************************************
4 * Copyright (C) 2006,2007,2008,2009 Nedko Arnaudov <nedko@arnaudov.name>
5 * Copyright (C) 2002-2005 Nasca Octavian Paul
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *****************************************************************************/
22 #ifndef PORTAMENTO_H__83CC72B6_3F89_4791_ACEF_098A31CB368A__INCLUDED
23 #define PORTAMENTO_H__83CC72B6_3F89_4791_ACEF_098A31CB368A__INCLUDED
25 struct zyn_portamento
27 bool enabled; // whether portamento is enabled
29 float time;
31 // the threshold of enabling protamento
32 // Minimum or max. difference of the notes in order to do the portamento (x 100 cents)
33 float pitch_threshold;
35 // whether to enable the portamento only below (false) or above (true) the threshold
36 bool pitch_threshold_above;
38 // 'up portanemto' means when the frequency is rising (eg: the portamento is from 200Hz to 300 Hz)
39 // 'down portanemto' means when the frequency is lowering (eg: the portamento is from 300Hz to 200 Hz)
41 // Portamento time stretch (up/down)
42 // this value represent how the portamento time is reduced
43 // -1.0 - for down portamento
44 // (-1.0,0) - the up portamento's time is smaller than the down portamento
45 // 0 - the portamento time is always the same
46 // (0,1.0) - the down portamento's time is smaller than the up portamento
47 // 1.0 - for upper portamento
48 float up_down_time_stretch;
50 // this value is used to compute the actual portamento
51 float freqrap;
53 // whether portamento is used by a note
54 bool used;
56 // x is from 0.0 (start portamento) to 1.0 (finished portamento)
57 float x;
59 // dx is x increment
60 float dx;
62 // this is used for computing oldfreq value from x
63 float origfreqrap;
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 #if 0
70 } /* Adjust editor indent */
71 #endif
73 void
74 zyn_portamento_init(
75 struct zyn_portamento * portamento_ptr);
77 // returns true if the portamento's conditions are true, else returns false
78 bool
79 zyn_portamento_start(
80 float sample_rate,
81 struct zyn_portamento * portamento_ptr,
82 float oldfreq,
83 float newfreq);
85 // update portamento values
86 void
87 zyn_portamento_update(
88 struct zyn_portamento * portamento_ptr);
90 #if 0
91 { /* Adjust editor indent */
92 #endif
93 #ifdef __cplusplus
94 } /* extern "C" */
95 #endif
97 #endif /* #ifndef PORTAMENTO_H__83CC72B6_3F89_4791_ACEF_098A31CB368A__INCLUDED */