smoosic 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/smoosic.js +7 -7
- package/package.json +1 -1
- package/release/smoosic.js +7 -7
- package/src/render/sui/scoreView.ts +8 -0
- package/src/render/vex/vxMeasure.ts +1 -1
- package/src/smo/data/measure.ts +8 -3
- package/src/smo/data/noteModifiers.ts +3 -3
- package/src/smo/data/score.ts +6 -0
- package/src/ui/dialogs/components/rocker.ts +0 -1
- package/src/ui/dialogs/preferences.ts +8 -2
|
@@ -723,6 +723,14 @@ export abstract class SuiScoreView {
|
|
|
723
723
|
serialized.keySignature = concertKey;
|
|
724
724
|
const rmeasure = SmoMeasure.deserialize(serialized);
|
|
725
725
|
rmeasure.svg = svg;
|
|
726
|
+
// If this is a tranposed score, the displayed score needs to be in 'C'.
|
|
727
|
+
// We do this step last since serialize/unserialize work in a pitch transposed
|
|
728
|
+
// for the instrument
|
|
729
|
+
if (this.score.preferences.transposingScore && !this.score.isPartExposed()) {
|
|
730
|
+
rmeasure.transposeToOffset(-1 * xpose, 'c');
|
|
731
|
+
rmeasure.keySignature = 'c';
|
|
732
|
+
rmeasure.transposeIndex = 0;
|
|
733
|
+
}
|
|
726
734
|
const selector: SmoSelector = { staff: staffId, measure: i, voice: 0, tick: 0, pitches: [] };
|
|
727
735
|
this.score.replaceMeasure(selector, rmeasure);
|
|
728
736
|
});
|
|
@@ -378,7 +378,7 @@ export class VxMeasure implements VxMeasureIf {
|
|
|
378
378
|
continue;
|
|
379
379
|
}
|
|
380
380
|
const traverseTupletTree = ( parentTuplet: SmoTuplet): void => {
|
|
381
|
-
const vexNotes = [];
|
|
381
|
+
const vexNotes: Note[] = [];
|
|
382
382
|
for (let smoNote of this.smoMeasure.tupletNotes(parentTuplet)) {
|
|
383
383
|
vexNotes.push(this.noteToVexMap[smoNote.attrs.id]);
|
|
384
384
|
}
|
package/src/smo/data/measure.ts
CHANGED
|
@@ -667,7 +667,12 @@ export class SmoMeasure implements SmoMeasureParams, TickMappable {
|
|
|
667
667
|
let startIndex: number | null = null;
|
|
668
668
|
params.voices.forEach((voice) => {
|
|
669
669
|
voice.notes.forEach((note, index) => {
|
|
670
|
-
|
|
670
|
+
// backwards-compatibiliity, some scores don't have attrs on tuplet
|
|
671
|
+
if (typeof(tupJson.id) === 'string') {
|
|
672
|
+
tupJson.attrs = { type: 'SmoTuplet', id: tupJson.id };
|
|
673
|
+
}
|
|
674
|
+
const id = tupJson.attrs.id;
|
|
675
|
+
if (note.isTuplet && note.tupletId === id) {
|
|
671
676
|
tupletNotes.push(note);
|
|
672
677
|
//we cannot trust startIndex coming from legacy json
|
|
673
678
|
//we need to count index of the first note in the tuplet
|
|
@@ -1562,8 +1567,8 @@ export class SmoMeasure implements SmoMeasureParams, TickMappable {
|
|
|
1562
1567
|
}
|
|
1563
1568
|
|
|
1564
1569
|
addNthEnding(ending: SmoVolta) {
|
|
1565
|
-
const mods = [];
|
|
1566
|
-
this.modifiers.forEach((modifier) => {
|
|
1570
|
+
const mods: SmoMeasureModifierBase[] = [];
|
|
1571
|
+
this.modifiers.forEach((modifier: SmoMeasureModifierBase) => {
|
|
1567
1572
|
if (modifier.ctor !== 'SmoVolta' || (modifier as SmoVolta).startBar !== ending.startBar ||
|
|
1568
1573
|
(modifier as SmoVolta).endBar !== ending.endBar) {
|
|
1569
1574
|
mods.push(modifier);
|
|
@@ -973,9 +973,9 @@ export class SmoLyric extends SmoNoteModifierBase {
|
|
|
973
973
|
// var str = this._text;
|
|
974
974
|
const reg = /^([A-Z|a-z|0-9|]+)/g;
|
|
975
975
|
let mmm = str.match(reg);
|
|
976
|
-
let tokeType = '';
|
|
977
|
-
let toke = '';
|
|
978
|
-
const tokens = [];
|
|
976
|
+
let tokeType: string = '';
|
|
977
|
+
let toke: string = '';
|
|
978
|
+
const tokens: string[] = [];
|
|
979
979
|
while (str.length) {
|
|
980
980
|
if (!mmm) {
|
|
981
981
|
tokeType = str[0];
|
package/src/smo/data/score.ts
CHANGED
|
@@ -667,6 +667,11 @@ export class SmoScore {
|
|
|
667
667
|
params.audioSettings = SmoScoreModifierBase.deserialize(jsonObj.audioSettings);
|
|
668
668
|
}
|
|
669
669
|
params.preferences.transposingScore = params.preferences.transposingScore ?? false;
|
|
670
|
+
if (jsonObj.staves && jsonObj.staves.length === 1) {
|
|
671
|
+
// Ignore serialized tranpose of score if there is only a single part.
|
|
672
|
+
params.preferences.transposingScore = false;
|
|
673
|
+
}
|
|
674
|
+
|
|
670
675
|
params.preferences.hideEmptyLines = params.preferences.hideEmptyLines ?? false;
|
|
671
676
|
let renumberingMap: Record<number, number> = { 0: 0 };
|
|
672
677
|
if (jsonObj.columnAttributeMap && jsonObj.columnAttributeMap.renumberingMap) {
|
|
@@ -1118,6 +1123,7 @@ export class SmoScore {
|
|
|
1118
1123
|
// Need to do this since score serialization doesn't include TS in each measure
|
|
1119
1124
|
jsonObj.timeSignature = measure.timeSignature.serialize();
|
|
1120
1125
|
jsonObj.tempo = measure.tempo.serialize();
|
|
1126
|
+
jsonObj.tupletTrees = []; // assume no tuplets in a prototype measure
|
|
1121
1127
|
let newMeasure = SmoMeasure.deserialize(jsonObj);
|
|
1122
1128
|
newMeasure.measureNumber = measure.measureNumber;
|
|
1123
1129
|
newMeasure.clef = parameters.measureInstrumentMap[0].clef as Clef;
|
|
@@ -16,10 +16,12 @@ const deepCopy = (x: any) => JSON.parse(JSON.stringify(x));
|
|
|
16
16
|
export class SuiScorePreferencesAdapter extends SuiComponentAdapter {
|
|
17
17
|
preferences: SmoScorePreferences;
|
|
18
18
|
backup: SmoScorePreferences;
|
|
19
|
+
originalTransposeScore: boolean;
|
|
19
20
|
constructor(view: SuiScoreViewOperations) {
|
|
20
21
|
super(view);
|
|
21
22
|
this.preferences = new SmoScorePreferences(view.score.preferences);
|
|
22
23
|
this.backup = JSON.parse(JSON.stringify(this.preferences));
|
|
24
|
+
this.originalTransposeScore = this.preferences.transposingScore;
|
|
23
25
|
}
|
|
24
26
|
get autoAdvance(): boolean {
|
|
25
27
|
return this.preferences.autoAdvance;
|
|
@@ -77,8 +79,12 @@ export class SuiScorePreferencesAdapter extends SuiComponentAdapter {
|
|
|
77
79
|
await this.view.updateScorePreferences(this.backup);
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
|
-
commit() {
|
|
81
|
-
|
|
82
|
+
async commit() {
|
|
83
|
+
if (this.originalTransposeScore !== this.preferences.transposingScore) {
|
|
84
|
+
await this.view.refreshViewport();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
return;
|
|
82
88
|
}
|
|
83
89
|
}
|
|
84
90
|
/**
|