Guitarix
beat.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013, Hermann Meyer, Andreas Degert
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  * --------------------------------------------------------------------------
18  *
19  *
20  * This file is part of the Guitarix Audio Engine
21  *
22  *
23  * --------------------------------------------------------------------------
24  */
25 
26 
27 
28 #pragma once
29 
30 #ifndef SRC_HEADERS_BEAT_H_
31 #define SRC_HEADERS_BEAT_H_
32 
33 /*
34  * definition for ffunction(float B2N(int,float), "beat.h", "");
35  * in digital_delay.dsp
36  * set delaytime in relation of notation to ms(bpm(samples))
37  */
38 
39 static double always_inline B2N(int ta, double beat) {
40  double beatta = beat;
41  switch(ta) {
42  case(0):
43  beatta *=3.0;
44  break;
45  case(1):
46  beatta *=2.0;
47  break;
48  case(2):
49  beatta *=1.3333;
50  break;
51  case(3):
52  beatta *=1.5;
53  break;
54  case(4):
55  beatta =beat;
56  break;
57  case(5):
58  beatta *=0.6666;
59  break;
60  case(6):
61  beatta *=0.75;
62  break;
63  case(7):
64  beatta *=0.5;
65  break;
66  case(8):
67  beatta *=0.333;
68  break;
69  case(9):
70  beatta *=0.45;
71  break;
72  case(10):
73  beatta *=0.25;
74  break;
75  case(11):
76  beatta *=0.1666;
77  break;
78  case(12):
79  beatta *=0.1875;
80  break;
81  case(13):
82  beatta *=0.125;
83  break;
84  case(14):
85  beatta *=0.083334;
86  break;
87  case(15):
88  beatta *=0.09375;
89  break;
90  case(16):
91  beatta *=0.0625;
92  break;
93  case(17):
94  beatta *=0.041666;
95  break;
96  default:
97  break;
98  }
99  return beatta;
100 }
101 #endif //SRC_HEADERS_BEAT_H_
#define always_inline