fingering-config.ts 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. import { CSSProperties } from "vue";
  2. import relationships from "./fingering-relationships";
  3. export type Fingering = {
  4. json: any;
  5. relationship: Object;
  6. height?: number | string;
  7. width?: number | string;
  8. maxWidth?: number;
  9. styles?: CSSProperties;
  10. } | null;
  11. export type ITypeContentItem = {
  12. name: IVocals;
  13. direction: "vertical" | "transverse";
  14. width?: string;
  15. paddingLeft?: string;
  16. paddingRight?: string;
  17. };
  18. type ITypeContent = {
  19. [key: string | number]: ITypeContentItem;
  20. };
  21. export type IVocals = "flute" | "clarinet" | "saxophone" | "trumpet" | "horn" | "trombone" | "up-bass-horn" | "small-drum" | "tuba" | "piccolo";
  22. /** 映射声部ID */
  23. export const mappingVoicePart = (id: number, soruce: 'GYM' | 'COLEXIU' | 'ORCHESTRA') : number => {
  24. if (soruce === 'GYM') {
  25. return id
  26. } else if (soruce === 'COLEXIU'){
  27. const subject: {[_key: string | number]: number} = {
  28. 2: 32
  29. }
  30. return subject[id]
  31. }
  32. return 0
  33. }
  34. /** 声部的指法配置信息 */
  35. export const subjectFingering: ITypeContent = {
  36. 2: {
  37. name: "flute",
  38. direction: "transverse",
  39. }, // 长笛
  40. 4: {
  41. name: "clarinet",
  42. direction: "vertical",
  43. width: "1rem",
  44. paddingLeft: "0rem",
  45. paddingRight: "1rem",
  46. }, // 单簧管
  47. 5: {
  48. name: "saxophone",
  49. direction: "vertical",
  50. width: "3rem",
  51. }, // 萨克斯
  52. 6: {
  53. name: "saxophone",
  54. direction: "vertical",
  55. width: "3rem",
  56. }, // 中音萨克斯
  57. 12: {
  58. name: "trumpet",
  59. direction: "transverse",
  60. }, // 小号
  61. 13: {
  62. name: "horn",
  63. direction: "vertical",
  64. width: "3.5rem",
  65. }, // 圆号
  66. 14: {
  67. name: "trombone",
  68. direction: "transverse",
  69. }, // 长号
  70. 15: {
  71. name: "up-bass-horn",
  72. direction: "vertical",
  73. width: "3rem",
  74. }, // 上低音号
  75. 17: {
  76. name: "tuba",
  77. direction: "vertical",
  78. width: "3.4rem",
  79. }, // 大号
  80. // 23: {
  81. // name: 'small-drum',
  82. // direction: 'vertical'
  83. // }, // 打击乐
  84. 120: {
  85. name: "piccolo",
  86. direction: "vertical",
  87. width: "1rem",
  88. paddingRight: "0.8rem",
  89. }, // 短笛
  90. };
  91. export const getFingeringConfig = async (type: IVocals): Promise<Fingering> => {
  92. switch (type) {
  93. case "flute":
  94. const flute = await import(`./fingering-img/flute/index.json`);
  95. return {
  96. json: flute.default,
  97. relationship: relationships.flute,
  98. height: "60px",
  99. styles: {},
  100. };
  101. case "clarinet":
  102. const clarinet = await import(`./fingering-img/clarinet/index.json`);
  103. return {
  104. json: clarinet.default,
  105. relationship: relationships.clarinet,
  106. styles: {
  107. marginLeft: ".4rem",
  108. marginRight: ".7rem",
  109. },
  110. };
  111. case "trumpet":
  112. const trumpet = await import(`./fingering-img/trumpet/index.json`);
  113. return {
  114. json: trumpet.default,
  115. relationship: relationships.trumpet,
  116. // maxWidth: 150,
  117. };
  118. case "horn":
  119. const horn = await import(`./fingering-img/horn/index.json`);
  120. return {
  121. json: horn.default,
  122. relationship: relationships.horn,
  123. height: "212px",
  124. width: "252px",
  125. };
  126. case "tuba":
  127. const tuba = await import(`./fingering-img/tuba/index.json`);
  128. return {
  129. json: tuba.default,
  130. relationship: relationships.tuba,
  131. };
  132. case "piccolo":
  133. const piccolo = await import(`./fingering-img/piccolo/index.json`);
  134. return {
  135. json: piccolo.default,
  136. relationship: relationships.piccolo,
  137. };
  138. case "up-bass-horn":
  139. const upBassHorn = await import(`./fingering-img/up-bass-horn/index.json`);
  140. return {
  141. json: upBassHorn.default,
  142. relationship: relationships.upBassHorn,
  143. };
  144. case "trombone":
  145. const trombone = await import(`./fingering-img/trombone/index.json`);
  146. return {
  147. json: trombone.default,
  148. relationship: relationships.trombone,
  149. };
  150. case "saxophone":
  151. const saxophone = await import(`./fingering-img/saxophone/index.json`);
  152. return {
  153. json: saxophone.default,
  154. relationship: relationships.saxophone,
  155. styles: {
  156. marginLeft: ".2rem",
  157. marginRight: ".3rem",
  158. },
  159. };
  160. case "small-drum":
  161. const smallDrum = await import(`./fingering-img/small-drum/index.json`);
  162. return {
  163. json: smallDrum.default,
  164. relationship: relationships.smallDrum,
  165. width: "180px",
  166. };
  167. default:
  168. return null;
  169. }
  170. };