Debian Codegraph @

src/smploaders/pt2_load_raw.c

raw symbols SCIP
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdint.h>
4 #include <stdbool.h>
5 #include "../pt2_header.h"
6 #include "../pt2_config.h"
7 #include "../pt2_structs.h"
8 #include "../pt2_replayer.h"
9
10 bool loadRAWSample(FILE *f, uint32_t filesize, moduleSample_t *s)
11 {
12 uint32_t sampleLength = filesize;
13 if (sampleLength > (uint32_t)config.maxSampleLength)
14 sampleLength = config.maxSampleLength;
15
16 int8_t *smpDataPtr = &song->sampleData[s->offset];
17
18 turnOffVoices();
19 fread(smpDataPtr, 1, sampleLength, f);
20
21 if (sampleLength & 1)
22 {
23 if (++sampleLength > (uint32_t)config.maxSampleLength)
24 sampleLength = config.maxSampleLength;
25 else
26 smpDataPtr[sampleLength-1] = 0;
27 }
28
29 s->volume = 64;
30 s->fineTune = 0;
31 s->length = sampleLength;
32 s->loopStart = 0;
33 s->loopLength = 2;
34
35 return true;
36 }