FreeCalypso > hg > freecalypso-tools
comparison target-utils/buzplayer/melentry.c @ 80:eb5960dc258c
buzplayer: melody entry implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 27 Oct 2016 04:31:31 +0000 |
parents | |
children | 9092ff68e37d |
comparison
equal
deleted
inserted
replaced
79:49d2684805b1 | 80:eb5960dc258c |
---|---|
1 #include <sys/types.h> | |
2 #include <ctype.h> | |
3 #include <stdlib.h> | |
4 #include "types.h" | |
5 #include "melody.h" | |
6 | |
7 extern struct melentry *melody_buf_start, *melody_buf_tailptr; | |
8 | |
9 void | |
10 melody_init() | |
11 { | |
12 melody_buf_tailptr = melody_buf_start; | |
13 } | |
14 | |
15 void | |
16 melody_entry(argbulk) | |
17 char *argbulk; | |
18 { | |
19 char *argv[3]; | |
20 u32 tone, dur; | |
21 | |
22 if (parse_args(argbulk, 2, 2, argv, 0) < 0) | |
23 return; | |
24 tone = strtoul(argv[0], 0, 0); | |
25 dur = strtoul(argv[1], 0, 0); | |
26 if (tone > 255 || dur < 1 || dur > 0xFFFF) { | |
27 printf("ERROR: argument(s) out of range\n"); | |
28 return; | |
29 } | |
30 melody_buf_tailptr->tone = tone; | |
31 melody_buf_tailptr->dur = dur; | |
32 melody_buf_tailptr++; | |
33 } |