blob: 56cead5e670dc50cf70d8ea46552f0258c3da0aa (
plain)
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
|
const fs = require('fs');
const data = require('../assets.json');
const header = [
'#pragma once',
'#include "align_asset_macro.h"',
'',
]
const samples = []
async function main(){
const files = Object.keys(data).filter(f => f.endsWith(".aiff") && data[f][1]['us'] != undefined).map(m => {
return {
file: m,
offset: data[m][1]['us'][1]
}
})
files.sort((a, b) => a.offset - b.offset);
for(const entry of files){
const sampleId = entry.offset.toString(16).padStart(2, '0').toUpperCase();
samples.push(`gSample${sampleId}`);
header.push(`#define dgSample${sampleId} "__OTR__${entry.file.replace('.aiff', '')}"`);
header.push(`static const ALIGN_ASSET(2) char gSample${sampleId}[] = dgSample${sampleId};\n`);
}
header.push('static const char* gSampleTable[] = {');
for (const sample of samples) {
header.push(` ${sample},`);
}
header.push('};\n');
fs.writeFileSync('./samples_table.h', header.join('\n'));
}
main();
|