Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | import { Song } from "shared/lib/uge/song/Song";
import { InstrumentType } from "store/features/editor/editorState";
export const getInstrumentTypeByChannel = (
channel: number,
): InstrumentType | null => {
switch (channel) {
case 0:
case 1:
return "duty";
case 2:
return "wave";
case 3:
return "noise";
default:
return null;
}
};
export const getInstrumentListByType = (song: Song, type: InstrumentType) => {
switch (type) {
case "duty":
return song.duty_instruments;
case "wave":
return song.wave_instruments;
case "noise":
return song.noise_instruments;
default:
return [];
}
};
const noteName = [
"C-",
"C#",
"D-",
"D#",
"E-",
"F-",
"F#",
"G-",
"G#",
"A-",
"A#",
"B-",
];
export const renderNote = (note: number | null): string => {
Iif (note === null) {
return "...";
}
const octave = ~~(note / 12) + 3;
return `${noteName[note % 12]}${octave}`;
};
export const renderInstrument = (instrument: number | null): string => {
Iif (instrument === null) return "..";
return (instrument + 1).toString().padStart(2, "0") || "..";
};
export const renderEffect = (effectcode: number | null): string => {
return effectcode?.toString(16).toUpperCase() || ".";
};
export const renderEffectParam = (effectparam: number | null): string => {
return effectparam?.toString(16).toUpperCase().padStart(2, "0") || "..";
};
|