Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
1ad38cf
test(musicxml): Activate musicxml test suite
Danielku15 Apr 9, 2025
9ff742f
fix: parsing and dynamics display
Danielku15 Apr 9, 2025
d5df1c5
test: update test data
Danielku15 Apr 9, 2025
a5725fb
build: Upload test result files
Danielku15 Apr 13, 2025
37660ec
test: Fix file paths
Danielku15 Apr 13, 2025
c10a0d7
fix(musicxml): Wrong value applied for dot
Danielku15 Apr 13, 2025
6603dcc
test: Zip Test Result viewer
Danielku15 Apr 13, 2025
074285a
fix(musicxml): handle whitespaces
Danielku15 Apr 13, 2025
64f1161
test: Update test paths
Danielku15 Apr 13, 2025
7fdd26f
fix(musicxml): Whitespace in track name
Danielku15 Apr 13, 2025
6244ea7
build(cross): Use VisualTestRun class
Danielku15 Apr 13, 2025
f713997
build(kotlin): typed double list creation
Danielku15 Apr 13, 2025
9c84b09
build(cross): null safe lambda invoke
Danielku15 Apr 13, 2025
42c62de
fix: Check correct renderer for accidentals
Danielku15 Apr 13, 2025
b45424f
fix: handle notes with no articulation set
Danielku15 Apr 13, 2025
7e52105
fix: handle centered unpitched note
Danielku15 Apr 13, 2025
cb3bd7b
fix: only handle tied notes ones (notation)
Danielku15 Apr 13, 2025
e7a8683
test: update test files
Danielku15 Apr 13, 2025
588b8a6
fix(kotlin): primitive array handling
Danielku15 Apr 13, 2025
ddaee53
test: handle changed paths on cleanup
Danielku15 Apr 13, 2025
3baaf8c
fix(kotlin): parse numbers with spaces
Danielku15 Apr 13, 2025
31b105a
fix(musicxml): handle unclean ties
Danielku15 Apr 14, 2025
c01e908
fix(kotlin): Use own map for set
Danielku15 Apr 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ jobs:
- run: npm install
- run: npm run build
- run: npm run test
id: test
- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.test.conclusion == 'failure' }}
with:
name: test-results-web
path: |
test-data/**/*.new.png
test-data/**/*.diff.png

build_csharp:
name: Build and Test C#
Expand All @@ -38,6 +46,14 @@ jobs:
- run: npm install
- run: npm run build-csharp
- run: npm run test-csharp
id: test
- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.test.conclusion == 'failure' }}
with:
name: test-results-csharp
path: |
test-data/**/*.new.png
test-data/**/*.diff.png

build_kotlin:
name: Build and Test Kotlin
Expand Down Expand Up @@ -68,4 +84,12 @@ jobs:
- run: npm install
- run: npm run build-kotlin
- run: npm run test-kotlin
id: test
- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.test.conclusion == 'failure' }}
with:
name: test-results-kotlin
path: |
test-data/**/*.new.png
test-data/**/*.diff.png
- run: ./src.kotlin/alphaTab/gradlew --stop
6 changes: 6 additions & 0 deletions src.compiler/AstPrinterBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ export default abstract class AstPrinterBase {
this.writeCommaSeparated(expr.typeArguments, t => this.writeType(t));
this.write('>');
}

if(expr.nullSafe) {
this.write('?.');
this.write(this._context.toMethodName("invoke"))
}

this.write('(');
if (expr.arguments.length > 5) {
this.writeLine();
Expand Down
7 changes: 4 additions & 3 deletions src.compiler/csharp/CSharpAst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ export interface PrimitiveTypeNode extends TypeNode {

// Expressions

export interface Expression extends Node {}
export interface Expression extends Node { }

export interface PrefixUnaryExpression extends Node {
nodeType: SyntaxKind.PrefixUnaryExpression;
Expand All @@ -337,7 +337,7 @@ export interface ThisLiteral extends Node {
nodeType: SyntaxKind.ThisLiteral;
}

export interface BaseLiteralExpression extends Node {}
export interface BaseLiteralExpression extends Node { }

export interface StringLiteral extends Node {
nodeType: SyntaxKind.StringLiteral;
Expand Down Expand Up @@ -441,6 +441,7 @@ export interface InvocationExpression extends Node {
expression: Expression;
arguments: Expression[];
typeArguments?: TypeNode[];
nullSafe?: Boolean;
}

export interface NewExpression extends Node {
Expand Down Expand Up @@ -485,7 +486,7 @@ export interface YieldExpression extends Node {

// Statements

export interface Statement extends Node {}
export interface Statement extends Node { }

export interface Block extends Statement {
nodeType: SyntaxKind.Block;
Expand Down
3 changes: 2 additions & 1 deletion src.compiler/csharp/CSharpAstTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3705,7 +3705,8 @@ export default class CSharpAstTransformer {
expression: {} as cs.Expression,
parent: parent,
tsNode: expression,
nodeType: cs.SyntaxKind.InvocationExpression
nodeType: cs.SyntaxKind.InvocationExpression,
nullSafe: !!expression.questionDotToken
} as cs.InvocationExpression;

// chai
Expand Down
4 changes: 2 additions & 2 deletions src.compiler/typescript/Serializer.setProperty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ function generateSetPropertyBody(serializable: TypeSchema, importer: (name: stri
if (collectionAddMethod) {
caseStatements.push(
createNodeFromSource<ts.ForOfStatement>(
`for (const i of (v as unknown[])) {
obj.${collectionAddMethod}(i as ${elementTypeName});
`for (const i of (v as ${elementTypeName}[])) {
obj.${collectionAddMethod}(i);
}`,
ts.SyntaxKind.ForOfStatement
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ public class DoubleList : IDoubleIterable {
_size = elements.size
}

internal constructor(elements: IDoubleIterable) {
_items = DoubleArray(0)
_size = 0
for(d in elements) {
push(d)
}
}


private constructor(elements: DoubleArray, size: Int) {
_items = elements
_size = size
Expand Down Expand Up @@ -150,7 +159,7 @@ public class DoubleList : IDoubleIterable {
}
}


internal fun reduce(operation: (acc: Double, v: Double) -> Double, initial:Double): Double {
var accumulator = initial
for (element in _items) accumulator = operation(accumulator, element)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ internal inline fun Int?.toDouble(): Double? {

internal inline fun String.toDoubleOrNaN(): Double {
try {
val number = NumberFormat.getInstance(Locale.ROOT).parse(this)
val number = NumberFormat.getInstance(Locale.ROOT).parse(this.trim())
if (number != null) {
return number.toDouble()
}
Expand All @@ -213,7 +213,7 @@ internal inline fun String.toDoubleOrNaN(): Double {

internal fun String.toIntOrNaN(): Double {
try {
val number = NumberFormat.getInstance(Locale.ROOT).parse(this)
val number = NumberFormat.getInstance(Locale.ROOT).parse(this.trim())
if (number != null) {
return number.toInt().toDouble()
}
Expand All @@ -224,7 +224,7 @@ internal fun String.toIntOrNaN(): Double {

internal fun String.toIntOrNaN(radix: Double): Double {
try {
return Integer.parseInt(this, radix.toInt()).toDouble();
return Integer.parseInt(this.trim(), radix.toInt()).toDouble();
} catch (e: Throwable) {
}
return Double.NaN
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package alphaTab.core.ecmaScript

import alphaTab.collections.IDoubleIterable

@Suppress("NOTHING_TO_INLINE")
internal class Array {
companion object {
public inline fun <T> from(x: Iterable<T>): alphaTab.collections.List<T> {
return alphaTab.collections.List(x)
}
public inline fun from(x: IDoubleIterable): alphaTab.collections.DoubleList {
return alphaTab.collections.DoubleList(x)
}
public inline fun isArray(x:Any?):Boolean {
return x is alphaTab.collections.List<*>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,50 @@
package alphaTab.core.ecmaScript

import alphaTab.collections.ObjectBooleanMap

public class Set<T> : Iterable<T> {
private val _set: HashSet<T>
private val _storage: ObjectBooleanMap<T>

public constructor() {
_set = HashSet()
_storage = ObjectBooleanMap()
}

public val size : Double
get() = _set.size.toDouble()
get() = _storage.size.toDouble()

public constructor(values: Iterable<T>?) {
_set = values?.toHashSet() ?: HashSet()
_storage = ObjectBooleanMap()
if(values != null){
for(v in values) {
add(v)
}
}

}

public fun add(item: T) {
_set.add(item)
_storage.set(item, true)
}

public fun has(item: T): Boolean {
return _set.contains(item)
return _storage.has(item)
}

public fun delete(item: T) {
_set.remove(item)
_storage.delete(item)
}

public fun forEach(action: (item: T) -> Unit) {
for (i in _set) {
for (i in _storage.keys()) {
action(i)
}
}

override fun iterator(): Iterator<T> {
return _set.iterator()
return _storage.keys().iterator()
}

fun clear() {
_set.clear()
_storage.clear()
}
}
12 changes: 12 additions & 0 deletions src/generated/model/TrackSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ export class TrackSerializer {
o.set("shortname", obj.shortName);
o.set("defaultsystemslayout", obj.defaultSystemsLayout);
o.set("systemslayout", obj.systemsLayout);
if (obj.lineBreaks !== undefined) {
const a: number[] = [];
o.set("linebreaks", a);
for (const v of obj.lineBreaks!) {
a.push(v);
}
}
o.set("percussionarticulations", obj.percussionArticulations.map(i => InstrumentArticulationSerializer.toJson(i)));
if (obj.style) {
o.set("style", TrackStyleSerializer.toJson(obj.style));
Expand Down Expand Up @@ -70,6 +77,11 @@ export class TrackSerializer {
case "systemslayout":
obj.systemsLayout = v! as number[];
return true;
case "linebreaks":
for (const i of (v as number[])) {
obj.addLineBreaks(i);
}
return true;
case "percussionarticulations":
obj.percussionArticulations = [];
for (const o of (v as (Map<string, unknown> | null)[])) {
Expand Down
Loading