Debian Codegraph @

test/instparamtest.c

raw
1 /*
2 Audio File Library
3
4 Copyright 1998, Michael Pruett <[email protected]>
5 Copyright 2000, Silicon Graphics, Inc.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License along
18 with this program; if not, write to the Free Software Foundation, Inc.,
19 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 */
21
22 #include <audiofile.h>
23 #include <stdio.h>
24 #include <stdlib.h>
25
26 int main (int argc, char **argv)
27 {
28 AFfilehandle file;
29 long result;
30 int count, instids;
31
32 if (argc != 2)
33 {
34 fprintf(stderr, "usage: %s filename\n", argv[0]);
35 exit(EXIT_FAILURE);
36 }
37
38 file = afOpenFile(argv[1], "r", NULL);
39 if (file == AF_NULL_FILEHANDLE)
40 {
41 fprintf(stderr, "could not open file '%s'\n", argv[1]);
42 exit(EXIT_FAILURE);
43 }
44
45 count = afGetInstIDs(file, &instids);
46 printf("%ld instruments in file '%s'\n", count, argv[1]);
47
48 result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_BASENOTE);
49 printf("MIDI base note: %ld\n", result);
50
51 result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_NUMCENTS_DETUNE);
52 printf("detune in cents: %ld\n", result);
53
54 result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_LONOTE);
55 printf("MIDI low note: %ld\n", result);
56
57 result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_HINOTE);
58 printf("MIDI high note: %ld\n", result);
59
60 result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_LOVELOCITY);
61 printf("MIDI low velocity: %ld\n", result);
62
63 result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_HIVELOCITY);
64 printf("MIDI high velocity: %ld\n", result);
65
66 result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_NUMDBS_GAIN);
67 printf("gain in decibels: %ld\n", result);
68
69 result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_SUSLOOPID);
70 printf("sustain loop id: %ld\n", result);
71
72 result = afGetInstParamLong(file, AF_DEFAULT_INST, AF_INST_RELLOOPID);
73 printf("release loop id: %ld\n", result);
74
75 afCloseFile(file);
76
77 return 0;
78 }