Skip to content

Commit ef6860f

Browse files
fix bugs with text brackets
1 parent 3435bdc commit ef6860f

File tree

13 files changed

+22920
-16497
lines changed

13 files changed

+22920
-16497
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"typeDocServer.definitionFiles": []
3+
}

build/html/smoosic.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@
4646
<audio crossOrigin="anonymous" id="samplebb4" data-pitch="bb/4" data-patch="piano"
4747
src="https://aarondavidnewman.github.io/SmoSounds/piano/piano-bb4-iowa.mp3"> </audio>
4848
</div>
49+
<div>
50+
<audio crossOrigin="anonymous" id="sample-piano-a2" data-pitch="a/2" data-patch="piano"
51+
src="https://aarondavidnewman.github.io/SmoSounds/piano/piano-a2.mp3"> </audio>
52+
</div>
53+
<div>
54+
<audio crossOrigin="anonymous" id="sample-piano-fs2" data-pitch="fs/2" data-patch="piano"
55+
src="https://aarondavidnewman.github.io/SmoSounds/piano/piano-fs2.mp3"> </audio>
56+
</div>
4957
<div>
5058
<audio crossOrigin="anonymous" id="sample-cello-bb3" data-pitch="bb/3" data-patch="cello"
5159
src="https://aarondavidnewman.github.io/SmoSounds/strings/cello-bb3-iowa.mp3">

release/html/smoosic.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@
4646
<audio crossOrigin="anonymous" id="samplebb4" data-pitch="bb/4" data-patch="piano"
4747
src="https://aarondavidnewman.github.io/SmoSounds/piano/piano-bb4-iowa.mp3"> </audio>
4848
</div>
49+
<div>
50+
<audio crossOrigin="anonymous" id="sample-piano-a2" data-pitch="a/2" data-patch="piano"
51+
src="https://aarondavidnewman.github.io/SmoSounds/piano/piano-a2.mp3"> </audio>
52+
</div>
53+
<div>
54+
<audio crossOrigin="anonymous" id="sample-piano-fs2" data-pitch="fs/2" data-patch="piano"
55+
src="https://aarondavidnewman.github.io/SmoSounds/piano/piano-fs2.mp3"> </audio>
56+
</div>
4957
<div>
5058
<audio crossOrigin="anonymous" id="sample-cello-bb3" data-pitch="bb/3" data-patch="cello"
5159
src="https://aarondavidnewman.github.io/SmoSounds/strings/cello-bb3-iowa.mp3">

release/smoosic.js

Lines changed: 22871 additions & 16488 deletions
Large diffs are not rendered by default.

release/smoosic.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/common/vex.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,8 @@ export function getChordSymbolMetricsForGlyph(code: string) {
385385
if (code === '#') {
386386
code = 'accidentalSharp';
387387
}
388-
const glyphMetrics = VexChordSymbol.metrics;
389-
return (glyphMetrics as any)[code];
388+
const glyphMetrics = VexChordSymbol.metrics.glyphs;
389+
return glyphMetrics[code];
390390
}
391391
/**
392392
* Vex 5 compatibility. yShift

src/render/audio/oscillator.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ export class SuiSampler extends SuiOscillator {
435435
if (!sample) {
436436
return node;
437437
}
438+
438439
const cents = 1200 * (Math.log(this.frequency / sample!.frequency))
439440
/ Math.log(2);
440441

src/render/audio/samples.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,26 @@ export class SuiSampleMedia {
145145
instrument: 'piano',
146146
nativeFrequency: SmoAudioPitch.smoPitchToFrequency({ letter: 'b', accidental: 'b', octave: 4 }, 0, null),
147147
});
148+
SuiSampleMedia.insertIntoMap({
149+
sustain: 'percussive',
150+
realOvertones: [],
151+
imaginaryOvertones: [],
152+
sample: 'sample-piano-a2',
153+
family: 'keyboard',
154+
instrument: 'piano',
155+
dynamic: 50,
156+
nativeFrequency: SmoAudioPitch.smoPitchToFrequency({ letter: 'a', accidental: 'n', octave: 2 }, 0, null),
157+
});
158+
SuiSampleMedia.insertIntoMap({
159+
sustain: 'percussive',
160+
realOvertones: [],
161+
imaginaryOvertones: [],
162+
sample: 'sample-piano-fs2',
163+
family: 'keyboard',
164+
instrument: 'piano',
165+
dynamic: 50,
166+
nativeFrequency: SmoAudioPitch.smoPitchToFrequency({ letter: 'f', accidental: '#', octave: 2 }, 0, null),
167+
});
148168
SuiSampleMedia.insertIntoMap({
149169
sustain: 'percussive',
150170
sample: 'basspizz-c2-sso',

src/render/sui/mapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export abstract class SuiMapper {
133133
this.localModifiers.push({ index, selection: sel, modifier: tempo, box: tempo.logicalBox ?? SvgBox.default });
134134
index += 1;
135135
});
136-
sel.staff.getModifiers().forEach((mod) => {
136+
sel.staff.renderableModifiers.forEach((mod) => {
137137
if (SmoSelector.gteq(sel.selector, mod.startSelector) &&
138138
SmoSelector.lteq(sel.selector, mod.endSelector) && mod.logicalBox) {
139139
const exists = this.localModifiers.find((mm) => mm.modifier.ctor === mod.ctor);

src/render/sui/scoreRender.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export class SuiScoreRender {
160160
staff.measures.forEach((measure) => {
161161
this.unrenderMeasure(measure);
162162
});
163-
staff.modifiers.forEach((modifier) => {
163+
staff.renderableModifiers.forEach((modifier) => {
164164
if (modifier.element) {
165165
modifier.element.remove();
166166
modifier.element = null;

src/render/sui/scoreViewOperations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@ export class SuiScoreViewOperations extends SuiScoreView {
14611461
this.renderer.unrenderMeasure(staff.measures[staff.measures.length - 1]);
14621462
// A little hacky - delete the modifiers if they start or end on
14631463
// the measure
1464-
staff.modifiers.forEach((modifier) => {
1464+
staff.renderableModifiers.forEach((modifier) => {
14651465
if (modifier.startSelector.measure === index || modifier.endSelector.measure === index) {
14661466
if (modifier.logicalBox) {
14671467
const context = this.renderer.renderer.getRenderer(modifier.logicalBox);

src/smo/data/staffModifiers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,9 @@ export interface SmoStaffTextBracketParamsSer extends StaffModifierBaseSer{
494494
function isSmoStaffTextBracketParamsSer(params: Partial<SmoStaffTextBracketParamsSer>):
495495
params is SmoStaffTextBracketParamsSer {
496496
if (params.ctor && params.ctor === 'SmoStaffTextBracket') {
497-
return false;
497+
return true;
498498
}
499-
return true;
499+
return false;
500500
}
501501
export type SmoTextBracketStringType = 'text' | 'superscript';
502502
export const SmoTextBracketStringTypes: SmoTextBracketStringType[] = ['text', 'superscript'];

src/smo/data/systemStaff.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ export class SmoSystemStaff implements SmoObjectParams {
455455
return rv;
456456
}
457457
getModifier(modData: any) {
458-
return this.getModifiers().find((mod) =>
458+
return this.renderableModifiers.find((mod) =>
459459
SmoSelector.eq(mod.startSelector, modData.startSelector) && mod.attrs.type === modData.attrs.type);
460460
}
461461
setLyricFont(fontInfo: FontInfo) {

0 commit comments

Comments
 (0)