|
@@ -0,0 +1,176 @@
|
|
|
+import { CSSProperties } from "vue";
|
|
|
+import relationships from "./fingering-relationships";
|
|
|
+
|
|
|
+export type Fingering = {
|
|
|
+ json: any;
|
|
|
+ relationship: Object;
|
|
|
+ height?: number | string;
|
|
|
+ width?: number | string;
|
|
|
+ maxWidth?: number;
|
|
|
+ styles?: CSSProperties;
|
|
|
+} | null;
|
|
|
+export type ITypeContentItem = {
|
|
|
+ name: IVocals;
|
|
|
+ direction: "vertical" | "transverse";
|
|
|
+ width?: string;
|
|
|
+ paddingLeft?: string;
|
|
|
+ paddingRight?: string;
|
|
|
+};
|
|
|
+
|
|
|
+type ITypeContent = {
|
|
|
+ [key: string | number]: ITypeContentItem;
|
|
|
+};
|
|
|
+
|
|
|
+export type IVocals = "flute" | "clarinet" | "saxophone" | "trumpet" | "horn" | "trombone" | "up-bass-horn" | "small-drum" | "tuba" | "piccolo";
|
|
|
+
|
|
|
+/** 映射声部ID */
|
|
|
+export const mappingVoicePart = (id: number, soruce: 'GYM' | 'COLEXIU' | 'ORCHESTRA') : number => {
|
|
|
+ if (soruce === 'GYM') {
|
|
|
+ return id
|
|
|
+ } else if (soruce === 'COLEXIU'){
|
|
|
+ const subject: {[_key: string | number]: number} = {
|
|
|
+ 2: 32
|
|
|
+ }
|
|
|
+ return subject[id]
|
|
|
+ }
|
|
|
+ return 0
|
|
|
+}
|
|
|
+
|
|
|
+/** 声部的指法配置信息 */
|
|
|
+export const subjectFingering: ITypeContent = {
|
|
|
+ 2: {
|
|
|
+ name: "flute",
|
|
|
+ direction: "transverse",
|
|
|
+ }, // 长笛
|
|
|
+ 4: {
|
|
|
+ name: "clarinet",
|
|
|
+ direction: "vertical",
|
|
|
+ width: "1rem",
|
|
|
+ paddingLeft: "0rem",
|
|
|
+ paddingRight: "1rem",
|
|
|
+ }, // 单簧管
|
|
|
+ 5: {
|
|
|
+ name: "saxophone",
|
|
|
+ direction: "vertical",
|
|
|
+ width: "3rem",
|
|
|
+ }, // 萨克斯
|
|
|
+ 6: {
|
|
|
+ name: "saxophone",
|
|
|
+ direction: "vertical",
|
|
|
+ width: "3rem",
|
|
|
+ }, // 中音萨克斯
|
|
|
+ 12: {
|
|
|
+ name: "trumpet",
|
|
|
+ direction: "transverse",
|
|
|
+ }, // 小号
|
|
|
+ 13: {
|
|
|
+ name: "horn",
|
|
|
+ direction: "vertical",
|
|
|
+ width: "3.5rem",
|
|
|
+ }, // 圆号
|
|
|
+ 14: {
|
|
|
+ name: "trombone",
|
|
|
+ direction: "transverse",
|
|
|
+ }, // 长号
|
|
|
+ 15: {
|
|
|
+ name: "up-bass-horn",
|
|
|
+ direction: "vertical",
|
|
|
+ width: "3rem",
|
|
|
+ }, // 上低音号
|
|
|
+ 17: {
|
|
|
+ name: "tuba",
|
|
|
+ direction: "vertical",
|
|
|
+ width: "3.4rem",
|
|
|
+ }, // 大号
|
|
|
+ // 23: {
|
|
|
+ // name: 'small-drum',
|
|
|
+ // direction: 'vertical'
|
|
|
+ // }, // 打击乐
|
|
|
+ 120: {
|
|
|
+ name: "piccolo",
|
|
|
+ direction: "vertical",
|
|
|
+ width: "1rem",
|
|
|
+ paddingRight: "0.8rem",
|
|
|
+ }, // 短笛
|
|
|
+};
|
|
|
+
|
|
|
+export const getFingeringConfig = async (type: IVocals): Promise<Fingering> => {
|
|
|
+ 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.upBassHorn,
|
|
|
+ };
|
|
|
+ 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.smallDrum,
|
|
|
+ width: "180px",
|
|
|
+ };
|
|
|
+ default:
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+};
|