File: loop.c

package info (click to toggle)
audiofile 0.2.6-6%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 3,740 kB
  • ctags: 1,921
  • sloc: sh: 46,768; ansic: 15,382; makefile: 261
file content (37 lines) | stat: -rw-r--r-- 1,151 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <audiofile.h>

int main (int argc, char **argv)
{
	AFfilehandle	file;
	AFfilesetup	setup;
	int		markerIDs[] = {1, 2, 3, 4};
	int		loopIDs[] = {1, 2};
	short		frames[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

	setup = afNewFileSetup();
	afInitFileFormat(setup, AF_FILE_AIFF);

	afInitMarkIDs(setup, AF_DEFAULT_TRACK, markerIDs, 4);
	afInitMarkName(setup, AF_DEFAULT_TRACK, 1, "sustain loop start");
	afInitMarkName(setup, AF_DEFAULT_TRACK, 2, "sustain loop end");
	afInitMarkName(setup, AF_DEFAULT_TRACK, 3, "release loop start");
	afInitMarkName(setup, AF_DEFAULT_TRACK, 4, "release loop end");

	afInitLoopIDs(setup, AF_DEFAULT_INST, loopIDs, 2);

	file = afOpenFile(argv[1], "w", setup);

	afWriteFrames(file, AF_DEFAULT_TRACK, frames, 5);

	afSetMarkPosition(file, AF_DEFAULT_TRACK, 1, 0);
	afSetMarkPosition(file, AF_DEFAULT_TRACK, 2, 2);
	afSetMarkPosition(file, AF_DEFAULT_TRACK, 3, 4);
	afSetMarkPosition(file, AF_DEFAULT_TRACK, 4, 5);

	afSetLoopStart(file, AF_DEFAULT_INST, 1, 1);
	afSetLoopEnd(file, AF_DEFAULT_INST, 1, 2);
	afSetLoopStart(file, AF_DEFAULT_INST, 2, 3);
	afSetLoopEnd(file, AF_DEFAULT_INST, 2, 4);

	afCloseFile(file);
}