summaryrefslogtreecommitdiff
path: root/test/loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/loop.c')
-rw-r--r--test/loop.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/loop.c b/test/loop.c
new file mode 100644
index 0000000..3778eef
--- /dev/null
+++ b/test/loop.c
@@ -0,0 +1,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);
+}