1 #include <sys/soundcard.h>
2 #include <stdint.h>
3 
4 #define MYNAME "ctronome"
5 #define VERSION "0.5.5"
6 #define CREDITS "homepage: http://ctronome.kign.org/\n"
7 
8 /* set up these three variables to your system */
9 static char *metronomewav1 = "/usr/local/share/ctronome/metronome1.wav\0";
10 static char *metronomewav2 = "/usr/local/share/ctronome/metronome2.wav\0";
11 static char *dspdev = "/dev/dsp\0";
12 
13 /* means: 1/4, 1/8 etc. */
14 static int default_base_note = 4;
15 
16 char *programfile;
17 
18 #define HELP "usage: ctronome <parameters>\n\
19                valid parameters are:\n\
20                 -b <bpm>            beat per minute\n\
21                 -t <bpt>            beat per tact\n\
22                 -p <filename>       program file\n\
23                 -c <count>          play tact/program <count> times then exit\n\
24                 -w1 <filename>      wav to use for first beat of tact\n\
25                 -w2 <filename>      wav to use for other beat of tact\n\
26                 -d <device>         dsp device\n\
27                 -h                  display this help screen\n\
28                 -v                  print version\n\
29            e.g: ctronome -b 60 -t 4\n\
30            for defaults/limits and required WAV format see README\n"
31 
32 /* my lazy type definitions */
33 typedef uint32_t DWORD;
34 typedef uint16_t WORD;
35 typedef uint8_t BYTE;
36 typedef DWORD dword;
37 typedef WORD word;
38 typedef BYTE byte;
39 
40 word dsp_channels;
41 dword dsp_speed;
42 word dsp_format;
43 byte dsp_depth;
44 
45 static int count = 1; /* tact counter */
46 static int pcount = 1; /* repeat tact/program pcount times then exit 0 = endless */
47 static int pdecrease = 0;
48 
49 static int bpm[2] = {60,4}; /* 60 bpm is given for 1/4 notes */
50 static int bpt[2] = {1,4}; /* beat per tact */
51 static byte slash = 47; /* the / character */
52 static byte hashmark = 35; /* the # character */
53 static byte space = 32; /* the   character */
54 
55 int dsp_init(byte *,word,word,dword);
56 void next_program(FILE *); /* process the next line of program */
57 void parm_init(int, char *[]);
58 void dsp_close(byte);
59 void dsp_write(byte, byte *, dword);
60 
61 byte debug;
62