Updated TODO.
[ahxm.git] / core.h
blob77a2f563287ec0533e2a07f702996e3d1ce29528
1 /*
3 Ann Hell Ex Machina - Music Software
4 Copyright (C) 2003 Angel Ortega <angel@triptico.com>
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 http://www.triptico.com
24 #ifndef CHANNELS
25 #define CHANNELS 16
26 #endif
28 #define NUM_NOTES 128
29 #define VALID_NOTE(n) ((n) >= 0 && (n) < NUM_NOTES)
31 extern int _frequency;
32 extern int _linear_interpolation;
33 extern int _n_channels;
35 #define TIME2SAMPLES(s) ((s) * _frequency)
37 double note_frequency(int note);
38 float get_sample(float * wave, double size, double offset);
39 double wave_resample(int freq, double size, int n_channels, float * wave[]);
41 /* dynamic string manipulation macros */
42 #ifndef ds_init
43 struct ds { char * d; int p; int s; };
44 #define ds_init(x) x.d=(char *)x.p=x.s=0;
45 #define ds_rewind(x) x.p=0;
46 #define ds_free(x) do { if(x.d) free(x.d); ds_init(x); } while(0)
47 #define ds_redim(x) do { if(x.p >= x.s) x.d=realloc(x.d, x.s += 32); } while(0)
48 #define ds_poke(x,c) do { ds_redim(x); x.d[x.p++]=c; } while(0)
49 #define ds_pokes(x,t) do { char *p=t; while(*p) ds_poke(x, *p++); } while(0)
50 #endif /* ds_init */