source: thomson/code/C/meatracker/display.c@ 62e3665

main
Last change on this file since 62e3665 was 62e3665, checked in by Adrien Destugues <pulkomandy@…>, 11 years ago

MEA music tracker !
Very early version that won't be very useful.

git-svn-id: svn://localhost/thomson@40 85ae3b6b-dc8f-4344-a89d-598714f2e4e5

  • Property mode set to 100644
File size: 1.4 KB
Line 
1#include <text.h>
2
3static const char* notes = "C C#D D#E F F#G G#A A#B --";
4
5static const char FM1[] = {
62,'3', 4,'3', 5,'3', 6,'3', 7,'3', 9,'3', 10,'3', 11,'3',
70,'4', 2,'4', 3,'4', 4,'4', 5,'4', 6,'4', 7,'4', 8,'4',
8// >> FM2
99,'4', 10,'4', 11,'4', 0,'5', 1,'5', 2,'5', 3,'5', 4,'5',
105,'5', 6,'5', 7,'5', 8,'5', 9,'5', 10,'5', 11,'5', 0,'6'
11};
12
13static const char FM2[] = {
149,'4', 10,'4', 11,'4', 0,'5', 1,'5', 2,'5', 3,'5', 4,'5',
155,'5', 6,'5', 7,'5', 8,'5', 9,'5', 10,'5', 11,'5', 0,'6',
16// << FM1
171,'6', 2,'6', 3,'6', 5,'6', 6,'6', 7,'6', 8,'6', 9,'6',
1810,'6', 0,'7', 1,'7', 2,'7', 4,'7', 5,'7', 7,'7', 8,'7'
19};
20
21static const char FM3[] = {
222,'6', 4,'6', 7,'6', 9,'6', 0,'7', 2,'7', 5,'7', 8,'7'
23};
24
25static const char FM4[] = { 9,'7' };
26
27void printnote(char channel, char pos, char note)
28{
29 if (channel > 3) return;
30
31 char n, o;
32 pos *= 8;
33 if (note >= 0)
34 {
35 note *= 2;
36 switch (channel)
37 {
38 case 0:
39 n = FM1[note]; o = FM1[note+1];
40 break;
41 case 1:
42 n = FM2[note]; o = FM2[note+1];
43 break;
44 case 2:
45 n = FM3[note]; o = FM3[note+1];
46 break;
47 case 3:
48 n = FM4[note]; o = FM4[note+1];
49 break;
50 }
51 } else {
52 n = 12;
53 }
54
55 channel *= 5;
56 n *= 2;
57 drawchar(notes[n], channel++, pos);
58 drawchar(notes[n + 1], channel++, pos);
59 drawchar(o, channel, pos);
60}
61
62void refreshchannels()
63{
64 int x,y;
65
66 for(x = 0; x < 4; x++)
67 for(y = 0; y < 16; y++)
68 {
69 printnote(x, y, 0);
70 }
71}
Note: See TracBrowser for help on using the repository browser.