summaryrefslogtreecommitdiff
path: root/apps/plugins/midi/guspat.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/midi/guspat.c')
-rw-r--r--apps/plugins/midi/guspat.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/apps/plugins/midi/guspat.c b/apps/plugins/midi/guspat.c
index c5b5832ddb..f650555520 100644
--- a/apps/plugins/midi/guspat.c
+++ b/apps/plugins/midi/guspat.c
@@ -22,21 +22,30 @@
22#include "guspat.h" 22#include "guspat.h"
23#include "midiutil.h" 23#include "midiutil.h"
24 24
25/* This came from one of the Gravis documents */ 25/* Note frequencies in milliHz, base A = 440000
26const uint32_t gustable[]= 26 * Calculated using:
27 * double base_a=440000;
28 * double offset;
29 * for(offset=-69;offset<=58;offset++)
30 * {
31 * int value = (int)round(base_a*pow(2,offset/12));
32 * printf("%d, ",value);
33 * }
34 */
35const uint32_t freqtable[]=
27{ 36{
28 8175, 8661, 9177, 9722, 10300, 10913, 11562, 12249, 12978, 13750, 14567, 15433, 37/* C, C#, D, D#, E, F, F#, G, G#, A, A#, B */
29 16351, 17323, 18354, 19445, 20601, 21826, 23124, 24499, 25956, 27500, 29135, 30867, 38 8176, 8662, 9177, 9723, 10301, 10913, 11562, 12250, 12978, 13750, 14568, 15434,
30 32703, 34647, 36708, 38890, 41203, 43653, 46249, 48999, 51913, 54999, 58270, 61735, 39 16352, 17324, 18354, 19445, 20602, 21827, 23125, 24500, 25957, 27500, 29135, 30868,
31 65406, 69295, 73416, 77781, 82406, 87306, 92498, 97998, 103826, 109999, 116540, 123470, 40 32703, 34648, 36708, 38891, 41203, 43654, 46249, 48999, 51913, 55000, 58270, 61735,
32 130812, 138591, 146832, 155563, 164813, 174614, 184997, 195997, 207652, 219999, 233081, 246941, 41 65406, 69296, 73416, 77782, 82407, 87307, 92499, 97999, 103826, 110000, 116541, 123471,
33 261625, 277182, 293664, 311126, 329627, 349228, 369994, 391995, 415304, 440000, 466163, 493883, 42 130813, 138591, 146832, 155563, 164814, 174614, 184997, 195998, 207652, 220000, 233082, 246942,
34 523251, 554365, 587329, 622254, 659255, 698456, 739989, 783991, 830609, 880000, 932328, 987767, 43 261626, 277183, 293665, 311127, 329628, 349228, 369994, 391995, 415305, 440000, 466164, 493883,
35 1046503, 1108731, 1174660, 1244509, 1318511, 1396914, 1479979, 1567983, 1661220, 1760002, 1864657, 1975536, 44 523251, 554365, 587330, 622254, 659255, 698456, 739989, 783991, 830609, 880000, 932328, 987767,
36 2093007, 2217464, 2349321, 2489019, 2637024, 2793830, 2959960, 3135968, 3322443, 3520006, 3729316, 3951073, 45 1046502, 1108731, 1174659, 1244508, 1318510, 1396913, 1479978, 1567982, 1661219, 1760000, 1864655, 1975533,
37 4186073, 4434930, 4698645, 4978041, 5274051, 5587663, 5919922, 6271939, 6644889, 7040015, 7458636, 7902150, 46 2093005, 2217461, 2349318, 2489016, 2637020, 2793826, 2959955, 3135963, 3322438, 3520000, 3729310, 3951066,
38 8372036, 8869863, 9397293, 9956085, 10548105, 11175328, 11839847, 12543881 47 4186009, 4434922, 4698636, 4978032, 5274041, 5587652, 5919911, 6271927, 6644875, 7040000, 7458620, 7902133,
39}; 48 8372018, 8869844, 9397273, 9956063, 10548082, 11175303, 11839822, 12543854 };
40 49
41static unsigned int readWord(int file) 50static unsigned int readWord(int file)
42{ 51{
@@ -141,7 +150,7 @@ static struct GWaveform * loadWaveform(int file)
141static int selectWaveform(struct GPatch * pat, int midiNote) 150static int selectWaveform(struct GPatch * pat, int midiNote)
142{ 151{
143 /* We divide by 100 here because everyone's freq formula is slightly different */ 152 /* We divide by 100 here because everyone's freq formula is slightly different */
144 unsigned int tabFreq = gustable[midiNote]/100; /* Comparison */ 153 unsigned int tabFreq = freqtable[midiNote]/100; /* Comparison */
145 unsigned int a=0; 154 unsigned int a=0;
146 for(a=0; a<pat->numWaveforms; a++) 155 for(a=0; a<pat->numWaveforms; a++)
147 { 156 {