annotate ringtools/imy/main.c @ 1009:4a153059abbb

doc/DUART28-boot-control: update for fc-linux-patch and fc-usbser-tools
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 12 Dec 2023 06:57:11 +0000
parents a96cb97b66a2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
882
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This file contains the top-level code for fc-imy2pwt.
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <stdio.h>
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdlib.h>
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include "sizelimits.h"
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 char *imy_filename;
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 char melody_str_buf[MELODY_BUF_SIZE];
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 unsigned beats_per_min = 120;
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 FILE *outF;
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 main(argc, argv)
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 char **argv;
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 {
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 if (argc < 2 || argc > 3) {
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 fprintf(stderr, "usage: %s imy-file [outfile]\n", argv[0]);
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 exit(1);
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 }
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 imy_filename = argv[1];
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 read_imy_firstpass();
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 compute_note_durations();
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 if (argc > 2) {
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 outF = fopen(argv[2], "w");
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 if (!outF) {
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 perror(argv[2]);
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 exit(1);
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 }
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 } else
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 outF = stdout;
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 melody_convert_pass();
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 exit(0);
fd4c9bc7835d fc-imy2pwt program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 }