-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.c
29 lines (26 loc) · 896 Bytes
/
main.c
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
// File used for testing
// Trying to get fingerprint on snaar_cut.wav
#include <stdlib.h>
#include "./fingerprint.h"
#define DR_WAV_IMPLEMENTATION // needed to compile drwav
#include "./dr_wav/dr_wav.h"
int main(int argc, char** argv) {
if (argc == 1)
return -1;
drwav* pWav = drwav_open_file(argv[1]);
if (pWav == NULL) {
return -1;
}
float* pSampleData = (float*) malloc((size_t)pWav->totalSampleCount * sizeof(float));
drwav_read_f32(pWav, pWav->totalSampleCount, pSampleData);
PeakHashCollection * hashes = fingerprint(pSampleData,
pWav->totalSampleCount);
//GETTING HASHES
for (int i = 0; i < hashes->count; i++)
printf("%s -> %d\n", hashes->peak_hashes[i].hash,
hashes->peak_hashes[i].time);
drwav_close(pWav);
free((*hashes).peak_hashes);
free(hashes);
return 0;
}