123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379 |
- import { CSSProperties } from "vue";
- import relationships from "./fingering-relationships";
- export type ITypeFingering = {
- json: any;
- relationship: any;
- height?: number | string;
- width?: number | string;
- maxWidth?: number;
- styles?: CSSProperties;
- } | null;
- export type IFingering = {
- name?: IVocals;
- direction?: "vertical" | "transverse";
- width?: string;
- height?: string;
- /** 禁用替指 */
- disabledFinger?: boolean;
- /** 横竖屏 0:横屏 1: 竖屏 */
- orientation?: number;
- code?: string;
- /** 是否有替指 */
- hasTizhi?: boolean;
- transform?: string;
- };
- type ITypeContent = {
- [key: string | number]: IFingering;
- };
- export type IVocals =
- | "flute"
- | "clarinet"
- | "saxophone"
- | "trumpet"
- | "horn"
- | "trombone"
- | "up-bass-horn"
- | "small-drum"
- | "tuba"
- | "piccolo"
- | "hulusi-flute"
- | "pan-flute"
- | "pan-flute1"
- | "pan-flute2"
- | "ocarina"
- | "melodica";
- /** 映射声部ID */
- export const mappingVoicePart = (
- id: number | string,
- soruce: "GYM" | "COLEXIU" | "ORCHESTRA" | "INSTRUMENT"
- ): number => {
- if (soruce === "GYM") {
- return Number(id);
- } else if (soruce === "COLEXIU") {
- const subject: { [_key: string | number]: number } = {
- Flute: 2,
- Clarinet: 4,
- Trombone: 14,
- Tuba: 17,
- Trumpet: 12,
- Horn: 13,
- AltoSaxophone: 6,
- TenorSaxophone: 6,
- Saxophone: 6,
- UpBassHorn: 15,
- Melodica: 137,
- HulusiFlute: 136,
- PanFlute: 135,
- Ocarina: 134,
- Recorder: 120,
- Ukulele: 130,
- Mouthorgan: 140,
- Piano: 150,
- };
- return subject[id];
- } else if (soruce === "ORCHESTRA") {
- const subject: { [_key: string | number]: number } = {
- 1: 23,
- 2: 2,
- 3: 5,
- 4: 4,
- 5: 12,
- 6: 14,
- 7: 13,
- 8: 15,
- 9: 17,
- };
- return subject[id];
- } else if (soruce === "INSTRUMENT") {
- let code = id
- if (typeof code === 'string') {
- code = code.toLocaleLowerCase().replace(/ /g, '')
- }
- const subject: { [_key: string | number]: any } = {
- flute: 2,
- clarinet: 4,
- trombone: 14,
- tuba: 17,
- trumpet: 12,
- horn: 13,
- altosaxophone: 6,
- tenorsaxophone: 6,
- saxophone: 6,
- upbasshorn: 15,
- melodica: 137,
- hulusiFlute: 136,
- panflute: 135,
- recorder: 120,
- ukulele: 130,
- mouthorgan: 140,
- piano: 150,
- 4: "piccolo",
- 3: "hulusi-flute",
- 1: "pan-flute",
- 2: "ocarina",
- 5: "melodica",
- tenorrecorder: "piccolo",
- woodwind: "hulusi-flute",
- panpipes: "pan-flute",
- ocarina: "ocarina",
- nai: "melodica",
- };
- return subject[code] || 0;
- }
- return 0;
- };
- /** 声部的指法配置信息 */
- export const subjectFingering = (subjectId: number | string): IFingering => {
- switch (subjectId) {
- case 2: // 长笛
- return {
- name: "flute",
- direction: "transverse",
- height: "1.6rem",
- hasTizhi: true,
- };
- case 4: // 单簧管
- return {
- name: "clarinet",
- direction: "vertical",
- width: "3rem",
- hasTizhi: true,
- };
- case 5: // 萨克斯
- case 6: // 中音萨克斯
- return {
- name: "saxophone",
- direction: "vertical",
- width: "4.34rem",
- hasTizhi: true,
- };
- case 12: // 小号
- return {
- name: "trumpet",
- direction: "transverse",
- height: "1.6rem",
- hasTizhi: false,
- };
- case 13: // 圆号
- return {
- name: "horn",
- direction: "vertical",
- width: "4.98rem",
- hasTizhi: false,
- };
- case 14: // 长号
- return {
- name: "trombone",
- direction: "transverse",
- height: "1.6rem",
- hasTizhi: false,
- };
- case 15: // 上低音号
- return {
- name: "up-bass-horn",
- direction: "vertical",
- width: "4.34rem",
- hasTizhi: false,
- };
- case 17: // 大号
- return {
- name: "tuba",
- direction: "vertical",
- width: "4.34rem",
- hasTizhi: false,
- };
- case 120: // 短笛
- return {
- name: "piccolo",
- direction: "vertical",
- width: "3rem",
- orientation: 1,
- hasTizhi: true,
- };
- case "piccolo": // 竖笛
- return {
- name: "piccolo",
- direction: "vertical",
- width: "3rem",
- orientation: 1,
- code: '竖笛',
- hasTizhi: true,
- };
- case "hulusi-flute": // 葫芦丝
- return {
- name: "hulusi-flute",
- direction: "vertical",
- width: "3rem",
- orientation: 1,
- code: '葫芦丝',
- hasTizhi: false,
- };
- case "pan-flute": // 排箫
- return {
- name: "pan-flute",
- direction: "transverse",
- height: "2.6rem",
- disabledFinger: true,
- orientation: 0,
- code: '排箫',
- hasTizhi: false,
- transform: 'scale(1.9) translateY(22px)',
- };
- case "ocarina": // 陶笛
- return {
- name: "ocarina",
- direction: "vertical",
- width: "3rem",
- disabledFinger: true,
- orientation: 0,
- code: '陶笛',
- hasTizhi: false,
- };
- case "melodica": // 口风琴
- return {
- name: "melodica",
- direction: "transverse",
- height: "1.8rem",
- orientation: 0,
- code: '口风琴',
- hasTizhi: false,
- };
- default:
- return {};
- }
- };
- export const getFingeringConfig = async (type: IVocals | undefined): Promise<ITypeFingering> => {
- switch (type) {
- case "flute":
- const flute = await import(`./fingering-img/flute/index.json`);
- return {
- json: flute.default,
- relationship: relationships.flute,
- height: "60px",
- styles: {},
- };
- case "clarinet":
- const clarinet = await import(`./fingering-img/clarinet/index.json`);
- return {
- json: clarinet.default,
- relationship: relationships.clarinet,
- styles: {
- marginLeft: ".4rem",
- marginRight: ".7rem",
- },
- };
- case "trumpet":
- const trumpet = await import(`./fingering-img/trumpet/index.json`);
- return {
- json: trumpet.default,
- relationship: relationships.trumpet,
- // maxWidth: 150,
- };
- case "horn":
- const horn = await import(`./fingering-img/horn/index.json`);
- return {
- json: horn.default,
- relationship: relationships.horn,
- height: "212px",
- width: "252px",
- };
- case "tuba":
- const tuba = await import(`./fingering-img/tuba/index.json`);
- return {
- json: tuba.default,
- relationship: relationships.tuba,
- };
- case "piccolo":
- const piccolo = await import(`./fingering-img/piccolo/index.json`);
- return {
- json: piccolo.default,
- relationship: relationships.piccolo,
- };
- case "up-bass-horn":
- const upBassHorn = await import(`./fingering-img/up-bass-horn/index.json`);
- return {
- json: upBassHorn.default,
- relationship: relationships["up-bass-horn"],
- };
- case "trombone":
- const trombone = await import(`./fingering-img/trombone/index.json`);
- return {
- json: trombone.default,
- relationship: relationships["trombone"],
- };
- case "saxophone":
- const saxophone = await import(`./fingering-img/saxophone/index.json`);
- return {
- json: saxophone.default,
- relationship: relationships["saxophone"],
- styles: {
- marginLeft: ".2rem",
- marginRight: ".3rem",
- },
- };
- case "small-drum":
- const smallDrum = await import(`./fingering-img/small-drum/index.json`);
- return {
- json: smallDrum.default,
- relationship: relationships["up-bass-horn"],
- width: "180px",
- };
- case "hulusi-flute":
- const hulusi = await import(`./fingering-img/hulusi-flute/index.json`);
- return {
- json: hulusi.default,
- relationship: relationships.hulusi,
- // width: '180px',
- styles: {
- marginLeft: ".6rem",
- marginRight: ".7rem",
- },
- };
- case "pan-flute":
- const pan = await import(`./fingering-img/pan-flute/index.json`);
- return {
- json: pan.default,
- relationship: relationships.pan,
- };
- case "pan-flute1":
- const pan1 = await import(`./fingering-img/pan-flute1/index.json`);
- return {
- json: pan1.default,
- relationship: relationships.pan,
- };
- case "pan-flute2":
- const pan2 = await import(`./fingering-img/pan-flute2/index.json`);
- return {
- json: pan2.default,
- relationship: relationships.pan,
- };
- case "ocarina":
- const ocarina = await import(`./fingering-img/ocarina/index.json`);
- return {
- json: ocarina.default,
- relationship: relationships.ocarina,
- width: "180px",
- styles: {
- marginTop: "auto",
- },
- };
- case "melodica":
- const melodica = await import(`./fingering-img/melodica/index.json`);
- return {
- json: melodica.default,
- relationship: relationships.melodica,
- height: "80px",
- styles: {
- marginTop: "auto",
- },
- };
- default:
- return null;
- }
- };
|