Compare commits

...

2 Commits

Author SHA1 Message Date
Felix Roos 12fac86012 rename 2026-02-15 00:42:21 +01:00
Felix Roos cea6301ffd restore export 2026-02-15 00:40:13 +01:00
+5 -6
View File
@@ -37,10 +37,9 @@ function humanFileSize(bytes, si) {
return bytes.toFixed(1) + ' ' + units[u];
}
function getSampleInfo(hapValue, bank) {
export function getSampleInfo(hapValue, bank) {
const { speed = 1.0 } = hapValue;
const { transpose, url, index, midi, label, baseFrequency } = getCommonSampleInfo(hapValue, bank);
const { transpose, url, index, midi, label } = getCommonSampleInfo(hapValue, bank);
const playbackRate = Math.abs(speed) * Math.pow(2, transpose / 12);
return { transpose, url, index, midi, label, playbackRate };
}
@@ -169,15 +168,15 @@ export const processSampleMap = (sampleMap, fn, baseUrl = sampleMap._base || '')
* @param {string} v
* @returns {SampleMetaData}
*/
const fullUrl = (v) => ({ url: baseUrl + v, midi: extractMidiNoteFromString(v) });
const getMetaData = (v) => ({ url: baseUrl + v, midi: extractMidiNoteFromString(v) });
if (Array.isArray(value)) {
//return [key, value.map(replaceUrl)];
value = value.map(fullUrl);
value = value.map(getMetaData);
} else {
// must be object
value = Object.fromEntries(
Object.entries(value).map(([note, samples]) => {
return [note, (typeof samples === 'string' ? [samples] : samples).map(fullUrl)];
return [note, (typeof samples === 'string' ? [samples] : samples).map(getMetaData)];
}),
);
}