Added an uninterpolated sine table generator. Renamed default org.
[cantaveria.git] / soundtest.c
blob3426abb9e6bf7ef6301ad08b3ca73cc5f1989927
1 #include <stdio.h>
3 #include <input.h>
4 #include <graphics.h>
5 #include <console.h>
6 #include <transfer.h>
7 #include <seq.h>
8 #include <org.h>
10 void play(int note){
11 seq_instant(EV_NOTEON, 0, note, 0);
14 void stop(int note){
15 seq_instant(EV_NOTEOFF, 0, note, 0);
18 static void press(input in){
19 if(in.button == ESCAPE_KEY){
20 game_is_over();
23 console_printf("%s", input_str(in));
25 switch(in.button){
26 case LEFT_BUTTON: play(0); break;
27 case RIGHT_BUTTON: play(4); break;
28 case DOWN_BUTTON: play(2); break;
29 case FIRE_BUTTON: play(5); break;
30 case JUMP_BUTTON: play(7); break;
31 case SPECIAL_BUTTON: play(9); break;
32 default: break;
36 static void release(input in){
37 switch(in.button){
38 case LEFT_BUTTON: stop(0); break;
39 case RIGHT_BUTTON: stop(4); break;
40 case DOWN_BUTTON: stop(2); break;
41 case FIRE_BUTTON: stop(5); break;
42 case JUMP_BUTTON: stop(7); break;
43 case SPECIAL_BUTTON: stop(9); break;
44 default: break;
48 static void update(){
49 console_update();
52 static void draw(){
56 void setup_inner(){
57 set_handler(update, draw, press, release);
58 console_clear();