da4b634edcbbe35a47145a5974b8ab4148d71b48
6 //#define DEBUG //Uncomment for debuging
7 #define MAX_CHANS 128 //Maximum lenght of line in loopfile (recomended 128 or 64)
10 // display error messages
11 void Error(const char *text
)
13 printf("Error(%d): %s\n",BASS_ErrorGetCode(),text
);
18 int main(int argc
, char *argv
)
20 if (!BASS_Init(-1,44100,0,0,NULL
)) {
21 // couldn't initialize device
22 printf("Error -1- Init");
26 char loopf
[] = "loop.txt";
27 int i
= 0, t
= 0, sch
=sizeof(char), sleep
= 500; //t = total chanells
28 HSAMPLE sample
[MAX_CHANS
];
29 HCHANNEL channel
[MAX_CHANS
];
30 char *line
, bar
[MAX_CHANS
] = {'1', '0'};
31 line
= malloc(MAX_CHANS
*sch
);
34 loop
= fopen(loopf
, "r");
36 printf("ConDrummer\nSimple Console Drumstation for Windows\nHarvie 2oo7\nFile: %s\n\n", loopf
);
39 fgets(line
, MAX_CHANS
, loop
);
40 if(strstr(line
, ";")) {
41 //printf("%s", line+sch);
44 if(strstr(line
, "!")) {
45 printf("%s", line
+sch
);
48 if(strstr(line
, ":")) {
50 memset( line
+strlen(line
)-1, 0, 1);
51 printf("Sample: %i = %s\n", i
, line
);
52 sprintf(line
, "%s", line
);
53 sample
[i
] = BASS_SampleLoad(FALSE
, line
, 0, 0, 100, BASS_SAMPLE_MONO
);
54 channel
[i
] = BASS_SampleGetChannel(sample
[i
], FALSE
); // get a sample channel
61 if(strstr(line
, "?")) {
62 sleep
= atoi(line
+sch
);
64 printf("Delay: %i\n", sleep
);
68 if(strstr(line
, "@")) {
69 sleep
= atoi(line
+sch
);
70 sleep
= (60*1000)/(sleep
*4);
72 printf("Delay: %i\n", sleep
);
77 if(strstr(line
, "#")) {
82 printf("Channels total: %i\nPlaying...\n\n", t
);
89 fgets(line
, MAX_CHANS
, loop
);
90 if(strstr(line
, "-")) {
91 sprintf(bar
, "%s\x0", (line
+sch
));
96 printf("rewind\n"); //Debug
100 fgets(line
, MAX_CHANS
, loop
);
101 if(strstr(line
, "#")) { break; }
108 BASS_ChannelPlay(channel
[i
], FALSE
);
123 - better samples (Audacity or ER-0)
124 - better (user friendly) loopfile syntax
125 - BPM 2 sleep delay calculator
129 - Linux port (SDL???)
130 - volume for each beat
This page took 0.414522 seconds and 5 git commands to generate.