mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 05:38:35 +00:00
Merge pull request #1333 from daslyfe/jade/soundimportorder
FIX: sound import order
This commit is contained in:
commit
d6c2a88496
@ -54,25 +54,23 @@ export function registerSamplesFromDB(config = userSamplesDBConfig, onComplete =
|
|||||||
splitRelativePath[splitRelativePath.length - 2] ?? soundFile.id.split(/\W+/)[0] ?? 'user';
|
splitRelativePath[splitRelativePath.length - 2] ?? soundFile.id.split(/\W+/)[0] ?? 'user';
|
||||||
const blob = soundFile.blob;
|
const blob = soundFile.blob;
|
||||||
|
|
||||||
// Files used to be uploaded as base64 strings, After Jan 1 2025 this check can be safely deleted
|
|
||||||
if (typeof blob === 'string') {
|
|
||||||
const soundPaths = sounds.get(parentDirectory) ?? new Set();
|
|
||||||
soundPaths.add(blob);
|
|
||||||
sounds.set(parentDirectory, soundPaths);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return blobToDataUrl(blob).then((soundPath) => {
|
return blobToDataUrl(blob).then((soundPath) => {
|
||||||
const soundPaths = sounds.get(parentDirectory) ?? new Set();
|
const titlePathMap = sounds.get(parentDirectory) ?? new Map();
|
||||||
soundPaths.add(soundPath);
|
|
||||||
sounds.set(parentDirectory, soundPaths);
|
titlePathMap.set(title, soundPath);
|
||||||
|
|
||||||
|
sounds.set(parentDirectory, titlePathMap);
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
sounds.forEach((soundPaths, key) => {
|
sounds.forEach((titlePathMap, key) => {
|
||||||
const value = Array.from(soundPaths);
|
const value = Array.from(titlePathMap.keys())
|
||||||
|
.sort((a, b) => {
|
||||||
|
return a.localeCompare(b);
|
||||||
|
})
|
||||||
|
.map((title) => titlePathMap.get(title));
|
||||||
|
|
||||||
registerSound(key, (t, hapValue, onended) => onTriggerSample(t, hapValue, onended, value), {
|
registerSound(key, (t, hapValue, onended) => onTriggerSample(t, hapValue, onended, value), {
|
||||||
type: 'sample',
|
type: 'sample',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user