Debian Codegraph @

test/instparamwrite.c

raw
1 /*
2 Audio File Library
3
4 Copyright 2000, Silicon Graphics, Inc.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21 #include <stdio.h>
22
23 #include <audiofile.h>
24
25 int main (int argc, char **argv)
26 {
27 AFfilehandle file;
28 AFfilesetup setup;
29 AUpvlist list;
30
31 if (argc != 2)
32 {
33 fprintf(stderr, "usage: instparamwrite filename\n");
34 }
35
36 setup = afNewFileSetup();
37 afInitFileFormat(setup, AF_FILE_AIFFC);
38
39 file = afOpenFile(argv[1], "w", setup);
40 if (file == AF_NULL_FILEHANDLE)
41 {
42 fprintf(stderr, "could not open file %s for writing", argv[1]);
43 }
44
45 afFreeFileSetup(setup);
46
47 /* Set the base note to a 'D.' */
48 afSetInstParamLong(file, AF_DEFAULT_INST, AF_INST_MIDI_BASENOTE, 50);
49
50 /* Detune down by 30 cents. */
51 afSetInstParamLong(file, AF_DEFAULT_INST, AF_INST_NUMCENTS_DETUNE, -30);
52
53 afCloseFile(file);
54
55 return 0;
56 }