summaryrefslogtreecommitdiff
path: root/apps/codecs/dumb/src/it/itunload.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/dumb/src/it/itunload.c')
-rw-r--r--apps/codecs/dumb/src/it/itunload.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/apps/codecs/dumb/src/it/itunload.c b/apps/codecs/dumb/src/it/itunload.c
new file mode 100644
index 0000000000..8f282bea2e
--- /dev/null
+++ b/apps/codecs/dumb/src/it/itunload.c
@@ -0,0 +1,71 @@
1/* _______ ____ __ ___ ___
2 * \ _ \ \ / \ / \ \ / / ' ' '
3 * | | \ \ | | || | \/ | . .
4 * | | | | | | || ||\ /| |
5 * | | | | | | || || \/ | | ' ' '
6 * | | | | | | || || | | . .
7 * | |_/ / \ \__// || | |
8 * /_______/ynamic \____/niversal /__\ /____\usic /| . . ibliotheque
9 * / \
10 * / . \
11 * itunload.c - Code to free an Impulse Tracker / / \ \
12 * module from memory. | < / \_
13 * | \/ /\ /
14 * By entheh. \_ / > /
15 * | \ / /
16 * | ' /
17 * \__/
18 */
19
20#include <stdlib.h>
21
22#include "dumb.h"
23#include "internal/it.h"
24
25
26
27void _dumb_it_unload_sigdata(sigdata_t *vsigdata)
28{
29 if (vsigdata) {
30 DUMB_IT_SIGDATA *sigdata = vsigdata;
31 int n;
32
33 if (sigdata->order)
34 free(sigdata->order);
35
36 if (sigdata->instrument)
37 free(sigdata->instrument);
38
39 if (sigdata->sample) {
40 for (n = 0; n < sigdata->n_samples; n++) {
41 if (sigdata->sample[n].left)
42 free(sigdata->sample[n].left);
43 if (sigdata->sample[n].right)
44 free(sigdata->sample[n].right);
45 }
46 free(sigdata->sample);
47 }
48
49 if (sigdata->pattern) {
50 for (n = 0; n < sigdata->n_patterns; n++)
51 if (sigdata->pattern[n].entry)
52 free(sigdata->pattern[n].entry);
53 free(sigdata->pattern);
54 }
55
56 if (sigdata->midi)
57 free(sigdata->midi);
58
59 {
60 IT_CHECKPOINT *checkpoint = sigdata->checkpoint;
61 while (checkpoint) {
62 IT_CHECKPOINT *next = checkpoint->next;
63 _dumb_it_end_sigrenderer(checkpoint->sigrenderer);
64 free(checkpoint);
65 checkpoint = next;
66 }
67 }
68
69 free(vsigdata);
70 }
71}