speed-tag.ts 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /**
  2. Grava壮板=40
  3. Largo广板=46
  4. Lento慢板=52
  5. Adagio柔板=56
  6. Larghetto小广板=60
  7. Andante行板=66
  8. Anderato/Andantino小行板=69
  9. Moderato中板=88
  10. Allegretto小快板=108
  11. Allegro Moderato=108 // 考级需要
  12. Allegro快板=132
  13. Vivace快速有生气=152
  14. Vivo快速有生气=160
  15. Vivacissimo极其活泼的快板=168
  16. Presto急板=184
  17. Prestissimo最急板=208
  18. */
  19. // import {TextAlignmentEnum} from "../../Common/Enums/TextAlignment";
  20. export const SpeedTag: { [key in string]: number } = {
  21. Grava: 40,
  22. Largo: 46,
  23. Lento: 52,
  24. Adagio: 56,
  25. Larghetto: 60,
  26. Andante: 66,
  27. Anderato: 69,
  28. Andantino: 69,
  29. Moderato: 88,
  30. Allegretto: 108,
  31. "Allegro Moderato": 108,
  32. Allegro: 132,
  33. Vivace: 152,
  34. Vivo: 160,
  35. Vivacissimo: 168,
  36. Presto: 184,
  37. Prestissimo: 208
  38. }
  39. export const SpecialMarks: string[] = ["纯律", "纯律结束"]
  40. export const HideWords: string[] = ["跳过下一个", "b", "#", "§", "º", "X"]
  41. export const GradientWords: string[] = ["poco rit.", "rall.", "rit.", "accel.", "molto rit.", "molto rall", "lentando", "poco accel.", "calando"]
  42. export const GRADIENT_SPEED_CLOSE_TAG = "结束范围速度"
  43. export const GRADIENT_SPEED_RESET_TAG = "a tempo"
  44. export const SpecialWords: string[] = [GRADIENT_SPEED_CLOSE_TAG]
  45. export const SpeedKeyword = "速度 "
  46. export const SpeedHiddenKeyword = "仅文本速度 "
  47. /** 是否为速度关键词 */
  48. export function isSpeedKeyword(str: string): boolean {
  49. return str.indexOf(SpeedKeyword) === 0
  50. }
  51. /** 是否为速度关键词 */
  52. export function isSpeedHiddenKeyword(str: string): boolean {
  53. return str.indexOf(SpeedHiddenKeyword) === 0
  54. }
  55. /** 格式化速度关键词移除前缀 */
  56. export function formatSpeedKeyword(str: string): string {
  57. return str.replace(SpeedHiddenKeyword, "").replace(SpeedKeyword, "")
  58. }
  59. /** 是否是渐变速度关键词 */
  60. export function isGradientWords(str: string): boolean {
  61. return GradientWords.includes(str)
  62. }
  63. /**
  64. * 是否为特殊标记
  65. * 包含中文与英文,中文正则存在部分问题
  66. */
  67. export function isSpecialMark(str: string): boolean {
  68. return [...Object.keys(SpeedTag), ...SpecialMarks, ...SpecialWords, ...HideWords]
  69. .map((s: string) => s.trim().toLocaleUpperCase())
  70. .includes(str.toLocaleUpperCase().trim())
  71. }
  72. // export function isTopFont(textAlignment): boolean {
  73. // return [TextAlignmentEnum.CenterTop, TextAlignmentEnum.RightTop].includes(textAlignment);
  74. // };