diff --git a/Build/Haxe/src/alphaTab/JsonSerializationBuilder.hx b/Build/Haxe/src/alphaTab/JsonSerializationBuilder.hx new file mode 100644 index 000000000..5dd732aa7 --- /dev/null +++ b/Build/Haxe/src/alphaTab/JsonSerializationBuilder.hx @@ -0,0 +1,585 @@ +#if macro +package alphaTab; + +import haxe.macro.Expr; +import haxe.macro.Type; +import haxe.macro.Context; +import haxe.macro.ExprTools; +import haxe.macro.TypeTools; +import haxe.macro.ComplexTypeTools; + +class JsonSerializationBuilder { + public static macro function build():Array { + var fields = Context.getBuildFields(); + + var currentType = Context.getLocalType(); + + var typeToBuild:Type = null; + + switch (currentType) { + case TInst(t, params): + typeToBuild = currentType; + switch (t.get().kind) { + case KAbstractImpl(a): + typeToBuild = TAbstract(a, params); + default: + } + + case TAbstract(t, params): + typeToBuild = currentType; + + default: + trace("Unsupported JSON serialization type: " + currentType); + return fields; + } + + var toJsonMethod:Field = null; + var fromJsonMethod:Field = null; + var fillToJsonMethod:Field = null; + var fillFromJsonMethod:Field = null; + var setPropertyMethod:Field = null; + + var properties = new Array(); + + for (f in fields) { + switch (f.kind) { + case FVar(t, e): + properties.push(f); + case FFun(fun): + switch (f.name) { + case 'toJson': + toJsonMethod = f; + case 'fromJson': + fromJsonMethod = f; + case 'fillToJson': + fillToJsonMethod = f; + case 'fillFromJson': + fillFromJsonMethod = f; + case 'setProperty': + setPropertyMethod = f; + } + case FProp(get, set, t, e): + properties.push(f); + } + } + + var isAbstract = false; + switch(typeToBuild) { + case TInst(t, p): + isAbstract = false; + case TAbstract(t,p): + isAbstract = true; + default: + trace('Unsupported kind: ' + typeToBuild); + } + + if (toJsonMethod == null) { + toJsonMethod = { + name: 'toJson', + meta: [], + access: [AStatic, APublic], + pos: Context.currentPos(), + kind: FFun({ + args: [{name: 'obj', type: Context.toComplexType(typeToBuild)}], + expr: null, + ret: macro:Dynamic + }) + } + fields.push(toJsonMethod); + } + + if (fillToJsonMethod == null) { + fillToJsonMethod = { + name: 'fillToJson', + meta: [], + access: [APublic], + pos: Context.currentPos(), + kind: FFun({ + args: [{name: 'obj', type: macro:Dynamic}], + expr: null, + ret: macro:Void + }) + } + if(!isAbstract) + { + fields.push(fillToJsonMethod); + } + } + + if (fromJsonMethod == null) { + fromJsonMethod = { + name: 'fromJson', + meta: [], + access: [AStatic, APublic], + pos: Context.currentPos(), + kind: FFun({ + args: [{name: 'json', type: macro:Dynamic}], + expr: null, + ret: Context.toComplexType(typeToBuild) + }) + } + fields.push(fromJsonMethod); + } + + if (fillFromJsonMethod == null) { + fillFromJsonMethod = { + name: 'fillFromJson', + meta: [], + access: [APublic], + pos: Context.currentPos(), + kind: FFun({ + args: [{name: 'json', type: macro:Dynamic}], + expr: null, + ret: macro:Void + }) + } + if(!isAbstract) + { + fields.push(fillFromJsonMethod); + } + } + + if (setPropertyMethod == null) { + setPropertyMethod = { + name: 'setProperty', + meta: [], + access: [APublic], + pos: Context.currentPos(), + kind: FFun({ + args: [ + {name: 'property', type: macro:system.CsString}, + {name: 'value', type: macro:Dynamic } + ], + expr: null, + ret: macro:Bool + }) + } + if(!isAbstract) + { + fields.push(setPropertyMethod); + } + } + + switch(typeToBuild) { + case TInst(t, p): + switch (toJsonMethod.kind) { + case FFun(fun): + fun.args[0].name = "obj"; + fun.expr = generateToJsonBodyForClass(properties, typeToBuild); + default: + trace('Invalid method kind'); + } + + switch (fillToJsonMethod.kind) { + case FFun(fun): + fun.args[0].name = "json"; + fun.expr = generateFillToJsonBodyForClass(properties, typeToBuild); + default: + trace('Invalid method kind'); + } + + switch (fromJsonMethod.kind) { + case FFun(fun): + fun.args[0].name = "json"; + fun.expr = generateFromJsonBodyForClass(properties, t.get()); + default: + trace('Invalid method kind'); + } + + switch (fillFromJsonMethod.kind) { + case FFun(fun): + fun.args[0].name = "json"; + fun.expr = generateFillFromJsonBodyForClass(properties, t.get()); + default: + trace('Invalid method kind'); + } + + switch (setPropertyMethod.kind) { + case FFun(fun): + fun.expr = generateSetPropertyMethodBodyForClass(properties, t.get()); + default: + trace('Invalid method kind'); + } + case TAbstract(t,p): + switch (toJsonMethod.kind) { + case FFun(fun): + fun.args[0].name = "obj"; + fun.expr = generateToJsonBodyForAbstract(properties, t.get()); + default: + trace('Invalid method kind'); + } + + switch (fromJsonMethod.kind) { + case FFun(fun): + fun.args[0].name = "json"; + fun.expr = generateFromJsonBodyForAbstract(properties, t.get()); + default: + trace('Invalid method kind'); + } + default: + trace('Unsupported kind: ' + typeToBuild); + } + + return fields; + } + + private static function generateToJsonBodyForAbstract(fields:Array, sourceType:AbstractType):Expr { + var statements = new Array(); + + statements.push(macro return obj.toInt32_IFormatProvider(null)); + + return macro $b{statements}; + } + + private static function generateFromJsonBodyForAbstract(fields:Array, sourceType:AbstractType):Expr { + var statements = new Array(); + + statements.push(macro if(untyped __js__("typeof json === 'number'")) { + return json; + }); + + statements.push(macro if(untyped __js__("typeof json === 'string'")) { + return fromString(json); + }); + + statements.push(macro throw new alphaTab.utils.SerializationException().SerializationException('Unsupported value type') ); + + return macro $b{statements}; + } + + private static function generateToJsonBodyForClass(fields:Array, sourceType:Type):Expr { + var statements = new Array(); + + var sourceTypeComplex:ComplexType = Context.toComplexType(sourceType); + + statements.push(macro var json:Dynamic = {}); + statements.push(macro obj.fillToJson(json)); + statements.push(macro return json); + + return macro $b{statements}; + } + + private static function generateFillToJsonBodyForClass(fields:Array, sourceType:Type):Expr { + var statements = new Array(); + + var sourceTypeComplex:ComplexType = Context.toComplexType(sourceType); + + for(f in fields) { + var fieldName:String = f.name; + var jsonName:String = null; + if (f.meta != null) { + for (metaEntry in f.meta) { + if (metaEntry.name == "json" && metaEntry.params != null) { + for (v in metaEntry.params) { + var name = ExprTools.getValue(v).toString(); + if (name != "") { + jsonName = name; + } + } + } + } + } + + if(jsonName != null) { + var fieldType:ComplexType = null; + switch (f.kind) { + case FVar(t, e): + fieldType = t; + case FProp(get, set, t, e): + fieldType = t; + default: + } + + if (fieldType != null) { + var fieldTypeType = ComplexTypeTools.toType(fieldType); + switch (fieldTypeType) { + case TInst(tfield, params): + var fieldType = tfield.get(); + + var fieldTypeName = fieldType.pack.join('.') + '.' + fieldType.name; + + if(isImmutable(fieldType)) { + statements.push(macro { + json.$jsonName = $p{fieldTypeName.split('.')}.toJson(this.$fieldName); + }); + } + else { + statements.push(macro { + if(json.$jsonName == null) { + json.$jsonName = $p{fieldTypeName.split('.')}.toJson(this.$fieldName); + } else { + this.$fieldName.fillToJson(json.$jsonName); + } + }); + } + + + + case TAbstract(tabs, params): + var abstractType = tabs.get(); + var fullName = abstractType.pack.join('.') + '.' + abstractType.name; + + switch (fullName) { + case 'system.CsString', + 'system.Boolean', + 'system.Byte', + 'system.SByte', + 'system.Int16', + 'system.UInt16', + 'system.Int32', + 'system.UInt32', + 'system.Int64', + 'system.UInt64', + 'system.Single', + 'system.Double', + 'system.Char': + statements.push(macro { + json.$jsonName = this.$fieldName; + }); + + case 'system.BooleanArray', + 'system.ByteArray', + 'system.SByteArray', + 'system.Int16Array', + 'system.UInt16Array', + 'system.Int32Array', + 'system.UInt32Array', + 'system.Int64Array', + 'system.UInt64Array', + 'system.SingleArray', + 'system.DoubleArray', + 'system.CharArray': + statements.push(macro { + json.$jsonName = this.$fieldName == null ? null : this.$fieldName.clone(); + }); + + default: + statements.push(macro { + json.$jsonName = $p{fullName.split('.')}.toJson(this.$fieldName); + }); + } + + default: + statements.push(macro { + json.$jsonName = this.$fieldName; + }); + } + } + } + } + + return macro $b{statements}; + } + + private static function generateFromJsonBodyForClass(fields:Array, targetType:ClassType):Expr { + var statements = new Array(); + + var targetTypePath:TypePath = { + pack: targetType.pack, + name: targetType.name + }; + + statements.push(macro if(json == null) return null); + + statements.push(macro var obj = new $targetTypePath()); + statements.push(macro obj.fillFromJson(json)); + statements.push(macro return obj); + + return macro $b{statements}; + } + + private static function isImmutable(type:ClassType) : Bool { + return type.meta.has("immutable"); + } + + private static function generateSetPropertyMethodBodyForClass(fields:Array, targetType:ClassType):Expr { + var statements = new Array(); + + var targetTypePath:TypePath = { + pack: targetType.pack, + name: targetType.name + }; + + var switchExpr:Expr = macro switch(property) { + default: { } + }; + statements.push(switchExpr); + + var switchCases:Array = null; + switch(switchExpr.expr) { + case ESwitch(e, cases, edef): + switchCases = cases; + default: + } + + for (f in fields) { + var fieldCase:Case = { + values: [], + expr: null + } + + var jsonNames = new Array(); + if (f.meta != null) { + for (metaEntry in f.meta) { + if (metaEntry.name == "json" && metaEntry.params != null) { + for (v in metaEntry.params) { + var name = ExprTools.getValue(v).toString(); + var jsonName = { + pos: Context.currentPos(), + expr: EConst(CString(name.toLowerCase())) + } + jsonNames.push(jsonName); + if (name != "") { + fieldCase.values.push(jsonName); + } + } + } + } + } + + if (jsonNames.length > 0) { + var fieldName:String = f.name; + var fieldType:ComplexType = null; + switch (f.kind) { + case FVar(t, e): + fieldType = t; + case FProp(get, set, t, e): + fieldType = t; + default: + } + + var val = macro value; + + if (fieldType != null) { + var fieldTypeType = ComplexTypeTools.toType(fieldType); + switch (fieldTypeType) { + case TInst(tfield, params): + var fieldType = tfield.get(); + var fieldTypeName = fieldType.pack.copy(); + fieldTypeName.push(fieldType.name); + + if(isImmutable(fieldType)) { + // for immutable types a fromJson for deserialization of the value is used + switchCases.push(fieldCase); + fieldCase.expr = macro { + this.$fieldName = $p{fieldTypeName}.fromJson(${val}); + return true; + }; + } + else { + // for complex types it is a bit more tricky + // if the property matches exactly, we use fromJson + // if the property starts with the field name, we try to set a sub-property + var newExpr:Expr = { + pos: Context.currentPos(), + expr: ENew({pack:fieldType.pack, name: fieldType.name}, []) + }; + var complexMapping = macro { + if(alphaTab.platform.Platform.equalsAny(property, [$a{jsonNames}])) { + if(this.$fieldName == null) { + this.$fieldName = $p{fieldTypeName}.fromJson(${val}); + } + else { + this.$fieldName.fillFromJson(${val}); + } + return true; + } else { + var partialMatch = alphaTab.platform.Platform.findStartsWith(property, [$a{jsonNames}]); + if(partialMatch != null) { + if(this.$fieldName == null) { + this.$fieldName = ${newExpr}; + } + if(this.$fieldName.setProperty(property.substring_Int32(partialMatch.length) , ${val})) + { + return true; + } + } + } + }; + statements.push(complexMapping); + } + + + case TAbstract(tabs, params): + // abstracts are simple field assignments only + switchCases.push(fieldCase); + + var abstractType = tabs.get(); + var fullName = abstractType.pack.join('.') + '.' + abstractType.name; + + switch (fullName) { + case 'system.CsString', + 'system.Boolean', + 'system.Byte', + 'system.SByte', + 'system.Int16', + 'system.UInt16', + 'system.Int32', + 'system.UInt32', + 'system.Int64', + 'system.UInt64', + 'system.Single', + 'system.Double', + 'system.Char': + // TODO: better validation of input value vs output value + fieldCase.expr = macro { + this.$fieldName = ${val}; + return true; + }; + + + case 'system.BooleanArray', + 'system.ByteArray', + 'system.SByteArray', + 'system.Int16Array', + 'system.UInt16Array', + 'system.Int32Array', + 'system.UInt32Array', + 'system.Int64Array', + 'system.UInt64Array', + 'system.SingleArray', + 'system.DoubleArray', + 'system.CharArray': + // TODO: better validation of input value vs output value + fieldCase.expr = macro { + this.$fieldName = ${val} == null ? null : ${val}.slice(); + return true; + }; + + default: + fieldCase.expr = macro { + this.$fieldName = $p{fullName.split('.')}.fromJson(${val}); + return true; + }; + } + + default: + } + } + } + } + + statements.push(macro return false); + + return macro $b{statements}; + } + + private static function generateFillFromJsonBodyForClass(fields:Array, targetType:ClassType):Expr { + var statements = new Array(); + + var targetTypePath:TypePath = { + pack: targetType.pack, + name: targetType.name + }; + + statements.push(macro if(json == null) return); + + var forSwitch:Expr = macro system.ObjectExtensions.forIn(json, function(key) { + setProperty(key.toLower(), untyped json[key]); + }); + statements.push(forSwitch); + + return macro $b{statements}; + } +} +#end diff --git a/Directory.Build.props b/Directory.Build.props index 90141f6c6..f39a5396b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,9 +3,9 @@ full true - 0.9.5 - 0.9.5.0 - 0.9.5.0 + 0.9.6 + 0.9.6.0 + 0.9.6.0 Danielku15 CoderLine AlphaTab diff --git a/Documentation/input/Shared/_PropertyDescription.cshtml b/Documentation/input/Shared/_PropertyDescription.cshtml new file mode 100644 index 000000000..117640501 --- /dev/null +++ b/Documentation/input/Shared/_PropertyDescription.cshtml @@ -0,0 +1,35 @@ +@{ + string dotNetName = Model.String("Title"); + string[] jsNames = Model.String("JsName").Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries); + string[] jsonNames = Model.String("JsonName").Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries); + string[] dataAttributeNames = Model.String("DataAttribute").Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries); +} + + + + + + + + @foreach(var name in jsNames) + { + + + + } + + @foreach(var name in jsonNames) + { + + + + } + + @foreach(var name in dataAttributeNames) + { + + + + } + +
@dotNetName .net
@name JavaScript
@name JSON
@name HTML
\ No newline at end of file diff --git a/Documentation/input/alphatex/exporter.cshtml b/Documentation/input/alphatex/exporter.cshtml index 3aac7928c..bfd4471c0 100644 --- a/Documentation/input/alphatex/exporter.cshtml +++ b/Documentation/input/alphatex/exporter.cshtml @@ -59,7 +59,6 @@ function exportFile(data) { } $('#exporterFile').change(function(e) { - debugger; var files = e.originalEvent.target.files; if(files.length > 0) { var reader = new FileReader(); diff --git a/Documentation/input/assets/css/override.css b/Documentation/input/assets/css/override.css index 889a1444c..2b9def3b0 100644 --- a/Documentation/input/assets/css/override.css +++ b/Documentation/input/assets/css/override.css @@ -1,3 +1,10 @@ +.layout-boxed .wrapper { + max-width: 80%; +} +.table-striped > tbody > tr:nth-of-type(odd) { + background-color: #FFF; +} + .top-banner { background-image: linear-gradient(to bottom,#fff 0,#f8f8f8 100%); background-repeat: repeat-x; @@ -39,6 +46,13 @@ white-space: nowrap; } +.type-table code.code-badge span, +.reference-table code.code-badge span { + border-left: 1px solid #DEDEDE; + padding-left: 5px; + opacity: 0.5; +} + .type-table code .code-badge, .reference-table code .code-badge { border-left: 1px solid #DEDEDE; @@ -46,6 +60,30 @@ opacity: 0.5; } +.code-badge { + margin-left: 3px; + margin-bottom: 3px; + display: inline-block; +} + +.code-badge.code-badge-net { border-color: #5d99c6; } +.code-badge.code-badge-net span { border-color: #5d99c6; color: #5d99c6; } + +.code-badge.code-badge-js { border-color: #75a478; } +.code-badge.code-badge-js span { border-color: #75a478; color: #75a478; } + +.code-badge.code-badge-json { border-color: #b3bc6d; } +.code-badge.code-badge-json span { border-color: #b3bc6d; color: #b3bc6d; } + +.code-badge.code-badge-html { border-color: #ba6b6c; } +.code-badge.code-badge-html span { border-color: #ba6b6c; color: #ba6b6c; } + +.code-badge.code-badge-jquery { border-color: #c97b63; } +.code-badge.code-badge-jquery span { border-color: #c97b63; color: #c97b63; } + +.code-badge.code-badge-all { border-color: #808e95; } +.code-badge.code-badge-all span { border-color: #808e95; color: #808e95; } + .main-header .navbar .sidebar-toggle { color: #777; } @@ -92,4 +130,8 @@ padding: initial; border-radius: initial; border-bottom: initial; +} + +.table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td { + border-top: 1px solid #c1c1c1; } \ No newline at end of file diff --git a/Documentation/input/examples/general/html5.cshtml b/Documentation/input/examples/general/html5.cshtml index 5382066ce..eef0c300c 100644 --- a/Documentation/input/examples/general/html5.cshtml +++ b/Documentation/input/examples/general/html5.cshtml @@ -4,7 +4,7 @@ Order: 3
The music notation is rendered as SVG by default. To use HTML5 canvas as render - engine specify the option engine: 'html5' when initializing or by using data-engine="html5". + engine specify the option core.engine = 'html5' when initializing or by using data-core-engine="html5".
@@ -20,14 +20,16 @@ Order: 3
-
+
-
+
-
+
@@ -105,24 +107,24 @@ Order: 10 .alphaTabSurface { background: #000; }
+ data-display-resources-staffLineColor="rgba(255,255,255, 0.8)" + data-display-resources-barSeparatorColor="rgb(255,255,255)" + data-display-resources-barNumberColor="rgba(255,255,255, 0.8)" + data-display-resources-mainGlyphColor="rgb(255,255,255)" + data-display-resources-secondaryGlyphColor="rgba(255,255,255,0.40)" + data-display-resources-scoreInfoColor="rgb(255,255,255)">
@@ -32,7 +29,7 @@ Order: 3
-
+
@@ -31,7 +28,7 @@ Order: 5
-
+
@@ -32,7 +29,7 @@ Order: 4
-
+
-
+
@@ -35,7 +32,7 @@ Order: 2
-
+
-
+
-
+
-
+
-
+
-
+
@@ -75,7 +69,7 @@ Order: 3
-
+
@@ -117,7 +107,7 @@ Order: 3
-
+
-
+
-
+
-
+
@@ -27,7 +27,7 @@ Order: 1
@@ -37,11 +37,10 @@ Order: 1 All bars are aligned in rows side by side till the row is full.

-
+
@@ -54,12 +53,7 @@ Order: 1
@@ -72,12 +66,9 @@ Order: 1
@@ -91,9 +82,7 @@ Order: 1
@@ -106,12 +95,10 @@ Order: 1
diff --git a/Documentation/input/reference/api/api.cshtml b/Documentation/input/reference/api/api.cshtml index cb028975b..1cb490d57 100644 --- a/Documentation/input/reference/api/api.cshtml +++ b/Documentation/input/reference/api/api.cshtml @@ -18,7 +18,7 @@ Since: 0.9.4 - +
alphaTab('api') jQueryalphaTab('api') jQuery
@@ -33,6 +33,6 @@ Nothing
 
 var api = $('#alphaTab').alphaTab('api');
-api.Render();
+api.render();
 
 
\ No newline at end of file diff --git a/Documentation/input/reference/api/changetrackmute.cshtml b/Documentation/input/reference/api/changetrackmute.cshtml index 5175dc4dc..bedeb4f4c 100644 --- a/Documentation/input/reference/api/changetrackmute.cshtml +++ b/Documentation/input/reference/api/changetrackmute.cshtml @@ -18,13 +18,13 @@ Since: 0.9.4 - + - + - +
void ChangeTrackMute(Track[] tracks, bool mute) .netvoid ChangeTrackMute(Track[] tracks, bool mute) .net
function changeTrackMute(tracks, mute) JavaScriptfunction changeTrackMute(tracks, mute) JavaScript
alphaTab('muteTracks', tracks, mute) jQueryalphaTab('muteTracks', tracks, mute) jQuery
@@ -40,12 +40,12 @@ Since: 0.9.4 - tracks all + tracks all AlphaTab.Model.Tracks[] The array of tracks that should be muted. - mute all + mute all bool A value indicating whether the track should be muted or not diff --git a/Documentation/input/reference/api/changetracksolo.cshtml b/Documentation/input/reference/api/changetracksolo.cshtml index 06746105b..6fa5bc481 100644 --- a/Documentation/input/reference/api/changetracksolo.cshtml +++ b/Documentation/input/reference/api/changetracksolo.cshtml @@ -19,13 +19,13 @@ Since: 0.9.4 - + - + - +
void ChangeTrackSolo(Track[] tracks, bool solo) .netvoid ChangeTrackSolo(Track[] tracks, bool solo) .net
function changeTrackSolo(tracks, solo) JavaScriptfunction changeTrackSolo(tracks, solo) JavaScript
alphaTab('soloTracks', tracks, solo) jQueryalphaTab('soloTracks', tracks, solo) jQuery
@@ -41,12 +41,12 @@ Since: 0.9.4 - tracks all + tracks all AlphaTab.Model.Tracks[] The array of tracks that should be muted. - solo all + solo all bool A value indicating whether the track should be played solo or not diff --git a/Documentation/input/reference/api/changetrackvolume.cshtml b/Documentation/input/reference/api/changetrackvolume.cshtml index 81933f52f..9241d4048 100644 --- a/Documentation/input/reference/api/changetrackvolume.cshtml +++ b/Documentation/input/reference/api/changetrackvolume.cshtml @@ -18,13 +18,13 @@ Since: 0.9.4 - + - + - +
void ChangeTrackVolume(Track[] tracks, float volume) .netvoid ChangeTrackVolume(Track[] tracks, float volume) .net
function changeTrackVolume(tracks, volume) JavaScriptfunction changeTrackVolume(tracks, volume) JavaScript
alphaTab('trackVolume', tracks, volume) jQueryalphaTab('trackVolume', tracks, volume) jQuery
@@ -40,12 +40,12 @@ Since: 0.9.4 - tracks all + tracks all AlphaTab.Model.Tracks[] The array of tracks that should be muted. - volume all + volume all float The volume multiplicator that should be added to the volume that the track normally has. e.g. 1.0 for no change on the volume, diff --git a/Documentation/input/reference/api/container.cshtml b/Documentation/input/reference/api/container.cshtml index 5eb8a630a..e4e2f3901 100644 --- a/Documentation/input/reference/api/container.cshtml +++ b/Documentation/input/reference/api/container.cshtml @@ -17,16 +17,16 @@ Since: 0.9.4 - + - + - + - +
AlphaTab.UI.IContainer allAlphaTab.UI.IContainer all
AlphaTab.Platform.CSharp.WinForms.ControlContainer .net WinFormsAlphaTab.Platform.CSharp.WinForms.ControlContainer .net WinForms
AlphaTab.Platform.CSharp.WinForms.FrameworkElementContainer .net WPFAlphaTab.Platform.CSharp.WinForms.FrameworkElementContainer .net WPF
AlphaTab.UI.HtmlElementContainer JavaScriptAlphaTab.UI.HtmlElementContainer JavaScript
diff --git a/Documentation/input/reference/api/destroy.cshtml b/Documentation/input/reference/api/destroy.cshtml index 9b7ebd48e..19a0a3376 100644 --- a/Documentation/input/reference/api/destroy.cshtml +++ b/Documentation/input/reference/api/destroy.cshtml @@ -19,13 +19,13 @@ Since: 0.9.4 - + - + - +
void Destroy() .netvoid Destroy() .net
function destroy() JavaScriptfunction destroy() JavaScript
alphaTab('destroy') jQueryalphaTab('destroy') jQuery
diff --git a/Documentation/input/reference/api/index.cshtml b/Documentation/input/reference/api/index.cshtml index b0bfc8dc6..c29e375ce 100644 --- a/Documentation/input/reference/api/index.cshtml +++ b/Documentation/input/reference/api/index.cshtml @@ -42,17 +42,17 @@ The following table contains all the properties as they can be set on the genera @if(!child.Get("JavaScriptOnly", false)) { - @(child.WithoutSettings.String(Keys.Title, childTreePath.Last().ToString())) .net + @(child.WithoutSettings.String(Keys.Title, childTreePath.Last().ToString())) .net
} @for(int i = 0; i < jsNames.Length; i++) { - @(jsNames[i]) JavaScript + @(jsNames[i]) JavaScript
} @for(int i = 0; i < jqueryNames.Length; i++) { - @(jqueryNames[i]) jQuery + @(jqueryNames[i]) jQuery
}
diff --git a/Documentation/input/reference/api/init.cshtml b/Documentation/input/reference/api/init.cshtml index 28471811d..7ef4534d5 100644 --- a/Documentation/input/reference/api/init.cshtml +++ b/Documentation/input/reference/api/init.cshtml @@ -18,7 +18,7 @@ Since: 0.9.4 - +
alphaTab(settings) jQueryalphaTab(settings) jQuery
@@ -34,7 +34,7 @@ Since: 0.9.4 - settings jQuery + settings jQuery AlphaTab.Settings The settings to use for alphaTab. Either as JSON structure or as Settings instance diff --git a/Documentation/input/reference/api/islooping.cshtml b/Documentation/input/reference/api/islooping.cshtml index 3043608cc..7ae9ff2d4 100644 --- a/Documentation/input/reference/api/islooping.cshtml +++ b/Documentation/input/reference/api/islooping.cshtml @@ -18,7 +18,7 @@ Since: 0.9.4 - +
bool allbool all
diff --git a/Documentation/input/reference/api/isreadyforplayback.cshtml b/Documentation/input/reference/api/isreadyforplayback.cshtml index f9134773c..0fc6f0a69 100644 --- a/Documentation/input/reference/api/isreadyforplayback.cshtml +++ b/Documentation/input/reference/api/isreadyforplayback.cshtml @@ -19,7 +19,7 @@ Since: 0.9.4 - +
bool allbool all
diff --git a/Documentation/input/reference/api/load.cshtml b/Documentation/input/reference/api/load.cshtml index 60aa81a32..75f7a5caf 100644 --- a/Documentation/input/reference/api/load.cshtml +++ b/Documentation/input/reference/api/load.cshtml @@ -17,58 +17,58 @@ Since: 0.9.4 - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
bool Load(Score score) .net - Load the given score objectbool Load(Score score) .net - Load the given score object
bool Load(Score score, int[] trackIndexes) .net - Load the given score objectbool Load(Score score, int[] trackIndexes) .net - Load the given score object
bool Load(byte[] raw) .net - Load the score from the given raw bytes using the available score loadersbool Load(byte[] raw) .net - Load the score from the given raw bytes using the available score loaders
bool Load(byte[] raw, int[] trackIndexes) .net - Load the score from the given raw bytes using the available score loadersbool Load(byte[] raw, int[] trackIndexes) .net - Load the score from the given raw bytes using the available score loaders
void Load(Stream[] raw) .net - Load the score from the given stream using the available score loadersvoid Load(Stream[] raw) .net - Load the score from the given stream using the available score loaders
void Load(Stream[] raw, int[] trackIndexes) .net - Load the score from the given stream using the available score loadersvoid Load(Stream[] raw, int[] trackIndexes) .net - Load the score from the given stream using the available score loaders
function load(arraybuffer, trackIndexes) JavaScript - Load the score from the given raw bytes using the available score loadersfunction load(arraybuffer, trackIndexes) JavaScript - Load the score from the given raw bytes using the available score loaders
function load(arraybuffer) JavaScript - Load the score from the given raw bytes using the available score loadersfunction load(arraybuffer) JavaScript - Load the score from the given raw bytes using the available score loaders
function load(uint8array) JavaScript - Load the score from the given raw bytes using the available score loadersfunction load(uint8array) JavaScript - Load the score from the given raw bytes using the available score loaders
function load(uint8array, trackIndexes) JavaScript - Load the score from the given raw bytes using the available score loadersfunction load(uint8array, trackIndexes) JavaScript - Load the score from the given raw bytes using the available score loaders
function load(url) JavaScript - Load the score from the given URL via Ajax using the available score loadersfunction load(url) JavaScript - Load the score from the given URL via Ajax using the available score loaders
function load(url, trackIndexes) JavaScript - Load the score from the given URL via Ajax using the available score loadersfunction load(url, trackIndexes) JavaScript - Load the score from the given URL via Ajax using the available score loaders
alphaTab('load', arraybuffer) jQuery - Load the score from the given raw bytes using the available score loadersalphaTab('load', arraybuffer) jQuery - Load the score from the given raw bytes using the available score loaders
alphaTab('load', arraybuffer, trackIndexes) jQuery - Load the score from the given raw bytes using the available score loadersalphaTab('load', arraybuffer, trackIndexes) jQuery - Load the score from the given raw bytes using the available score loaders
alphaTab('load', uint8array) jQuery - Load the score from the given raw bytes using the available score loadersalphaTab('load', uint8array) jQuery - Load the score from the given raw bytes using the available score loaders
alphaTab('load', uint8array, trackIndexes) jQuery - Load the score from the given raw bytes using the available score loadersalphaTab('load', uint8array, trackIndexes) jQuery - Load the score from the given raw bytes using the available score loaders
alphaTab('load', url) jQuery - Load the score from the given URL via Ajax using the available score loadersalphaTab('load', url) jQuery - Load the score from the given URL via Ajax using the available score loaders
alphaTab('load', url, trackIndexes) jQuery - Load the score from the given URL via Ajax using the available score loadersalphaTab('load', url, trackIndexes) jQuery - Load the score from the given URL via Ajax using the available score loaders
@@ -84,37 +84,37 @@ Since: 0.9.4 - score .net + score .net AlphaTab.Model.Score The score object to load. - raw .net + raw .net byte[] The raw bytes containing a file supported by the score loaders. - raw .net + raw .net System.IO.Stream The stream containing a file supported by the score loaders. - arraybuffer .JavaScript & jQuery + arraybuffer JavaScript & jQuery ArrayBuffer The arraybuffer containing the raw bytes of a file supported by the score loaders. - uint8array .JavaScript & jQuery + uint8array JavaScript & jQuery Uint8Array The Uint8Array containing the raw bytes of a file supported by the score loaders. - url .JavaScript & jQuery + url JavaScript & jQuery string A URL that should be loaded via AJAX and the passed on to the supported score loaders for importing. - trackIndexes all + trackIndexes all int[] A indexes of the tracks that should be rendered after the track is loaded. If not supplied, the first song will be rendered. diff --git a/Documentation/input/reference/api/loadsoundfont.cshtml b/Documentation/input/reference/api/loadsoundfont.cshtml index 3b719ac83..9db94af68 100644 --- a/Documentation/input/reference/api/loadsoundfont.cshtml +++ b/Documentation/input/reference/api/loadsoundfont.cshtml @@ -18,28 +18,28 @@ Since: 0.9.4 - + - + - + - + - + - + - + - +
bool LoadSoundFont(byte[] raw) .net - Load the soundfont from the given raw bytes.bool LoadSoundFont(byte[] raw) .net - Load the soundfont from the given raw bytes.
bool LoadSoundFont(Stream[] raw) .net - Load the soundfont from the given stream.bool LoadSoundFont(Stream[] raw) .net - Load the soundfont from the given stream.
function loadSoundFont(arraybuffer) JavaScript - Load the soundfont from the given raw bytes.function loadSoundFont(arraybuffer) JavaScript - Load the soundfont from the given raw bytes.
function loadSoundFont(uint8array) JavaScript - Load the soundfont from the given raw bytesfunction loadSoundFont(uint8array) JavaScript - Load the soundfont from the given raw bytes
function loadSoundFont(url) JavaScript - Load the soundfont from the given URL via AJAXfunction loadSoundFont(url) JavaScript - Load the soundfont from the given URL via AJAX
alphaTab('loadSoundFont', arraybuffer) jQuery - Load the soundfont from the given raw bytes.alphaTab('loadSoundFont', arraybuffer) jQuery - Load the soundfont from the given raw bytes.
alphaTab('loadSoundFont', uint8array) jQuery - Load the soundfont from the given raw bytesalphaTab('loadSoundFont', uint8array) jQuery - Load the soundfont from the given raw bytes
alphaTab('loadSoundFont', url) jQuery - Load the soundfont from the given URL via AJAXalphaTab('loadSoundFont', url) jQuery - Load the soundfont from the given URL via AJAX
@@ -55,27 +55,27 @@ Since: 0.9.4 - raw .net + raw .net byte[] The raw bytes containing a SoundFont2 file. - raw .net + raw .net System.IO.Stream The stream containing a SoundFont2 file. - arraybuffer JavaScript & jQuery + arraybuffer JavaScript & jQuery ArrayBuffer The arraybuffer containing the raw bytes of a SoundFont2 file. - uint8array JavaScript & jQuery + uint8array JavaScript & jQuery Uint8Array The Uint8Array containing the raw bytes of a SoundFont2 file. - url JavaScript & jQuery + url JavaScript & jQuery string A URL pointing to a SoundFont2 file that should be loaded via AJAX. diff --git a/Documentation/input/reference/api/mastervolume.cshtml b/Documentation/input/reference/api/mastervolume.cshtml index ea8a6497d..501691a5a 100644 --- a/Documentation/input/reference/api/mastervolume.cshtml +++ b/Documentation/input/reference/api/mastervolume.cshtml @@ -18,7 +18,7 @@ Since: 0.9.4 - +
float allfloat all
diff --git a/Documentation/input/reference/api/metronomevolume.cshtml b/Documentation/input/reference/api/metronomevolume.cshtml index 779fc1b68..3d7ba61ab 100644 --- a/Documentation/input/reference/api/metronomevolume.cshtml +++ b/Documentation/input/reference/api/metronomevolume.cshtml @@ -18,7 +18,7 @@ Since: 0.9.4 - +
float allfloat all
diff --git a/Documentation/input/reference/api/pause.cshtml b/Documentation/input/reference/api/pause.cshtml index 526e836cf..e051c586c 100644 --- a/Documentation/input/reference/api/pause.cshtml +++ b/Documentation/input/reference/api/pause.cshtml @@ -17,13 +17,13 @@ Since: 0.9.4 - + - + - +
void Pause().netvoid Pause().net
function pause() JavaScriptfunction pause() JavaScript
alphaTab('pause) jQueryalphaTab('pause) jQuery
diff --git a/Documentation/input/reference/api/play.cshtml b/Documentation/input/reference/api/play.cshtml index 737f30cc5..19fa2ae45 100644 --- a/Documentation/input/reference/api/play.cshtml +++ b/Documentation/input/reference/api/play.cshtml @@ -17,13 +17,13 @@ Since: 0.9.4 - + - + - +
void Play().netvoid Play().net
function play() JavaScriptfunction play() JavaScript
alphaTab('play) jQueryalphaTab('play) jQuery
diff --git a/Documentation/input/reference/api/playbackrange.cshtml b/Documentation/input/reference/api/playbackrange.cshtml index db4e4709c..6935482eb 100644 --- a/Documentation/input/reference/api/playbackrange.cshtml +++ b/Documentation/input/reference/api/playbackrange.cshtml @@ -18,7 +18,7 @@ Since: 0.9.4 - +
AlphaTab.Audio.Synth.Synthesis.PlaybackRange allAlphaTab.Audio.Synth.Synthesis.PlaybackRange all
@@ -36,8 +36,8 @@ Since: 0.9.4 - StartTick .net
- startTick JavaScript + StartTick .net
+ startTick JavaScript int @@ -46,8 +46,8 @@ Since: 0.9.4 - EndTick .net
- endTick JavaScript + EndTick .net
+ endTick JavaScript int diff --git a/Documentation/input/reference/api/playbackspeed.cshtml b/Documentation/input/reference/api/playbackspeed.cshtml index 4511fada7..08a200f66 100644 --- a/Documentation/input/reference/api/playbackspeed.cshtml +++ b/Documentation/input/reference/api/playbackspeed.cshtml @@ -18,7 +18,7 @@ Since: 0.9.4 - +
float allfloat all
diff --git a/Documentation/input/reference/api/player.cshtml b/Documentation/input/reference/api/player.cshtml index c58d5f312..5d834035a 100644 --- a/Documentation/input/reference/api/player.cshtml +++ b/Documentation/input/reference/api/player.cshtml @@ -17,7 +17,7 @@ Since: 0.9.4 - +
AlphaTab.Audio.Synth.IAlphaSynth allAlphaTab.Audio.Synth.IAlphaSynth all
diff --git a/Documentation/input/reference/api/playerfinished.cshtml b/Documentation/input/reference/api/playerfinished.cshtml index 60a64e7ae..aa1a026eb 100644 --- a/Documentation/input/reference/api/playerfinished.cshtml +++ b/Documentation/input/reference/api/playerfinished.cshtml @@ -17,10 +17,10 @@ Since: 0.9.4 - + - +
Action .netAction .net
function() JavaScriptfunction() JavaScript
diff --git a/Documentation/input/reference/api/playerstate.cshtml b/Documentation/input/reference/api/playerstate.cshtml index 3e29da54a..8defb100b 100644 --- a/Documentation/input/reference/api/playerstate.cshtml +++ b/Documentation/input/reference/api/playerstate.cshtml @@ -18,10 +18,10 @@ Since: 0.9.4 - + - +
AlphaTab.Audio.Synth .netAlphaTab.Audio.Synth .net
int Javascript - 0 for paused, 1 for playingint JavaScript - 0 for paused, 1 for playing
diff --git a/Documentation/input/reference/api/playpause.cshtml b/Documentation/input/reference/api/playpause.cshtml index cd22ad612..bb974aeae 100644 --- a/Documentation/input/reference/api/playpause.cshtml +++ b/Documentation/input/reference/api/playpause.cshtml @@ -18,13 +18,13 @@ Since: 0.9.4 - + - + - +
void PlayPause().netvoid PlayPause().net
function playPause() JavaScriptfunction playPause() JavaScript
alphaTab('playPause) jQueryalphaTab('playPause) jQuery
diff --git a/Documentation/input/reference/api/print.cshtml b/Documentation/input/reference/api/print.cshtml index 2d4efe36e..86a10fd4e 100644 --- a/Documentation/input/reference/api/print.cshtml +++ b/Documentation/input/reference/api/print.cshtml @@ -26,16 +26,16 @@ Since: 0.9.4 - + - + - + - +
function print() JavaScriptfunction print() JavaScript
function print(width) JavaScriptfunction print(width) JavaScript
alphaTab('print') jQueryalphaTab('print') jQuery
alphaTab('print', width) jQueryalphaTab('print', width) jQuery
@@ -51,7 +51,7 @@ Since: 0.9.4 - width JavaScript & jQuery + width JavaScript & jQuery string An optional custom width as CSS width that should be used. Best is to use a CSS width that is suitable for your preferred page size. diff --git a/Documentation/input/reference/api/render.cshtml b/Documentation/input/reference/api/render.cshtml index 707801129..017aea2c7 100644 --- a/Documentation/input/reference/api/render.cshtml +++ b/Documentation/input/reference/api/render.cshtml @@ -18,13 +18,13 @@ Since: 0.9.4 - + - + - +
void Render() .netvoid Render() .net
function render() JavaScriptfunction render() JavaScript
alphaTab('render') jQueryalphaTab('render') jQuery
diff --git a/Documentation/input/reference/api/renderer.cshtml b/Documentation/input/reference/api/renderer.cshtml index ecb01370b..75940ea9f 100644 --- a/Documentation/input/reference/api/renderer.cshtml +++ b/Documentation/input/reference/api/renderer.cshtml @@ -15,7 +15,7 @@ Since: 0.9.4 - +
AlphaTab.Rendering.IScoreRenderer allAlphaTab.Rendering.IScoreRenderer all
\ No newline at end of file diff --git a/Documentation/input/reference/api/renderscore.cshtml b/Documentation/input/reference/api/renderscore.cshtml index 1f1c536f9..9be6205eb 100644 --- a/Documentation/input/reference/api/renderscore.cshtml +++ b/Documentation/input/reference/api/renderscore.cshtml @@ -17,22 +17,22 @@ Since: 0.9.4 - + - + - + - + - + - +
bool RenderScore(Score score) .netbool RenderScore(Score score) .net
bool RenderScore(Score score, int[] tracks) .netbool RenderScore(Score score, int[] tracks) .net
function renderScore(score, tracks) JavaScriptfunction renderScore(score, tracks) JavaScript
function renderScore(tracks) JavaScriptfunction renderScore(tracks) JavaScript
alphaTab('renderScore', tracks) jQueryalphaTab('renderScore', tracks) jQuery
alphaTab('renderScore', score, tracks) jQueryalphaTab('renderScore', score, tracks) jQuery
@@ -48,12 +48,12 @@ Since: 0.9.4 - score all + score all AlphaTab.Model.Score The score that contains the tracks to be rendered. - tracks all + tracks all AlphaTab.Model.Track[] The indexes of the tracks that should be rendered. If not provided, the first track of the song will be rendered. diff --git a/Documentation/input/reference/api/rendertracks.cshtml b/Documentation/input/reference/api/rendertracks.cshtml index 4e32ff8b2..cc0d5e5b2 100644 --- a/Documentation/input/reference/api/rendertracks.cshtml +++ b/Documentation/input/reference/api/rendertracks.cshtml @@ -17,13 +17,13 @@ Since: 0.9.4 - + - + - +
bool RenderTracks(Tracks[] track) .netbool RenderTracks(Tracks[] track) .net
function renderTracks(tracks) JavaScriptfunction renderTracks(tracks) JavaScript
alphaTab('renderTracks', tracks) jQueryalphaTab('renderTracks', tracks) jQuery
@@ -39,7 +39,7 @@ Since: 0.9.4 - tracks all + tracks all AlphaTab.Model.Track[] The tracks that should be rendered. diff --git a/Documentation/input/reference/api/settings.cshtml b/Documentation/input/reference/api/settings.cshtml index 7e5515a1f..bbbbffd47 100644 --- a/Documentation/input/reference/api/settings.cshtml +++ b/Documentation/input/reference/api/settings.cshtml @@ -18,7 +18,7 @@ Since: 0.9.4 - +
AlphaTab.Settings allAlphaTab.Settings all
diff --git a/Documentation/input/reference/api/stop.cshtml b/Documentation/input/reference/api/stop.cshtml index 561c2ca82..83050e58a 100644 --- a/Documentation/input/reference/api/stop.cshtml +++ b/Documentation/input/reference/api/stop.cshtml @@ -18,13 +18,13 @@ Since: 0.9.4 - + - + - +
void Stop().netvoid Stop().net
function stop() JavaScriptfunction stop() JavaScript
alphaTab('stop') jQueryalphaTab('stop') jQuery
diff --git a/Documentation/input/reference/api/tex.cshtml b/Documentation/input/reference/api/tex.cshtml index c414cca11..70da9080f 100644 --- a/Documentation/input/reference/api/tex.cshtml +++ b/Documentation/input/reference/api/tex.cshtml @@ -17,22 +17,22 @@ Since: 0.9.4 - + - + - + - + - + - +
void Tex(string tex) .netvoid Tex(string tex) .net
void Tex(string tex, int[] tracks) .netvoid Tex(string tex, int[] tracks) .net
function tex(tex) JavaScriptfunction tex(tex) JavaScript
alphaTab('tex', tex) jQueryalphaTab('tex', tex) jQuery
function tex(tex, tracks) JavaScriptfunction tex(tex, tracks) JavaScript
alphaTab('tex', tex, tracks) jQueryalphaTab('tex', tex, tracks) jQuery
@@ -48,17 +48,17 @@ Since: 0.9.4 - tex all + tex all string The alphaTex encoded string to load. - tracks all + tracks all int[] Which tracks to display. - tracks JavaScript & jQuery + tracks JavaScript & jQuery int Which track to display. diff --git a/Documentation/input/reference/api/tickposition.cshtml b/Documentation/input/reference/api/tickposition.cshtml index b294732dd..d4fd680cd 100644 --- a/Documentation/input/reference/api/tickposition.cshtml +++ b/Documentation/input/reference/api/tickposition.cshtml @@ -18,7 +18,7 @@ Since: 0.9.4 - +
int allint all
diff --git a/Documentation/input/reference/api/timeposition.cshtml b/Documentation/input/reference/api/timeposition.cshtml index 18431c946..ccac831ea 100644 --- a/Documentation/input/reference/api/timeposition.cshtml +++ b/Documentation/input/reference/api/timeposition.cshtml @@ -18,7 +18,7 @@ Since: 0.9.4 - +
int allint all
diff --git a/Documentation/input/reference/api/updatelayout.cshtml b/Documentation/input/reference/api/updatelayout.cshtml deleted file mode 100644 index c2d609862..000000000 --- a/Documentation/input/reference/api/updatelayout.cshtml +++ /dev/null @@ -1,86 +0,0 @@ -Title: UpdateLayout() -JsName: updateLayout() -jQueryName: alphaTab('updateLayout') -Category: Methods - Core -Description: Updates the layout settings and triggers a re-rendering. -ShowInSideBar: false -Since: 0.9.4 ---- - - -

Description

-

- Updates the layout settings and triggers a re-rendering. -

- -

Signatures

- - - - - - - - - - - - - -
bool UpdateLayout(LayoutSettings layoutSettings) .net
function updateLayout(layoutSettings) JavaScript
alphaTab('updateLayout', layoutSettings) jQuery
- -

Parameters

- - - - - - - - - - - - - - - -
ParametersTypeSummary
layoutSettings allAlphaTab.LayoutSettingsThe new layout settings to use for display.
- - -

Returns

-Nothing - -

Example - C#

- -
-
-var api = new AlphaTabApi(...);
-api.UpdateLayout(new LayoutSettings
-{
-    Mode = "horizontal"
-});
-
-
- - -

Example - JavaScript

- -
-
-var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'));
-api.updateLayout({
-    mode: 'horizontal'
-});
-
-
- -

Example - jQuery

- -
-
-$('#alphaTab').alphaTab('updateLayout', {
-    mode: 'horizontal'
-});
-
-
\ No newline at end of file diff --git a/Documentation/input/reference/api/updatesettings.cshtml b/Documentation/input/reference/api/updatesettings.cshtml index 594851e6a..a6dbcd4f6 100644 --- a/Documentation/input/reference/api/updatesettings.cshtml +++ b/Documentation/input/reference/api/updatesettings.cshtml @@ -19,13 +19,13 @@ Since: 0.9.4 - + - + - +
void UpdateSettings() .netvoid UpdateSettings() .net
function updateSettings() JavaScriptfunction updateSettings() JavaScript
alphaTab('updateSettings') jQueryalphaTab('updateSettings') jQuery
diff --git a/Documentation/input/reference/breakingchanges-95-96.cshtml b/Documentation/input/reference/breakingchanges-95-96.cshtml new file mode 100644 index 000000000..e23077467 --- /dev/null +++ b/Documentation/input/reference/breakingchanges-95-96.cshtml @@ -0,0 +1,1442 @@ +Title: Breaking changes on Settings between 0.9.5 and 0.9.6 +Description: Describes all the breaking changes from 0.9.5 and 0.9.6 due to the settings reorganization. +ShowInSideBar: true +Since: 0.9.6 +--- + +

+ In 0.9.6 there was a bigger settings rework introduced that very likely broke every setup beside the default one. + Please find all changes that were introduced below. +

+ +

API changes

+ + + + + + + + + + + + + + + + + + + + + +
BeforeAfterDescription
+ AlphaTab.Settings.Defaults .net
+ alphaTab.Settings.get_defaults() JavaScript
+
+ new AlphaTab.Settings() .net
+ new alphaTab.Settings() JavaScript
+
+ The default values for all settings were moved to the constructor. Simply + create a new object and all default settings will be configured. +
+ AlphaTabApi.updateLayout(settings,json,dataAttributes) JavaScript
+
+ + + This API was removed. Simply change the settings and call updateSettings and render to achive the same behavior. +
+ +

Settings changes

+ +

+ Many settings have now a new place within the settings object, hence many settings might need adjustment in your code. The new + mechanism of specifying settings is way more tolerant than the old one: settings are now case insensitive (useWorkers is equal to uSeWoRkerS) and dashes on html attributes are also + ignored (data-use-workers is equal to data-useworkers). +

+
    +
  • .net is how the property is named on .net object level
  • +
  • JavaScript is how the property is named on the JavaScript object level (alphaTab.Settings instance)
  • +
  • JSON is how the property is named when specifying the property as input to alphaTab (usually short hand names)
  • +
  • HTML is how the property is named on HTML data attributes
  • +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BeforeAfterNotes
+ UseWorkers .net
+ useWorker JavaScript
+ useWorker JSON
+ data-use-worker HTML
+
+ Core.UseWorkers .net
+ core.useWorkers JavaScript
+ core.useWorkers JSON
+ useWorkers JSON
+ data-core-use-workers HTML
+ data-use-workers HTML
+
+ LogLevel .net
+ logLevel JavaScript
+ logging JSON
+ data-logging HTML
+
+ Core.LogLevel .net
+ core.logLevel JavaScript
+ core.logLevel JSON
+ logLevel JSON
+ data-core-loglevel HTML
+ data-loglevel HTML
+
+ DisplayMode .net
+ displayMode JavaScript
+ displayMode JSON
+ data-display-mode HTML
+
+ Notation.NotationMode .net
+ notation.notationMode JavaScript
+ notation.notationMode JSON
+ data-notation-notationmode HTML
+
+ Scale .net
+ scale JavaScript
+ scale JSON
+ data-scale HTML
+
+ Display.Scale .net
+ display.scale JavaScript
+ display.scale JSON
+ scale JSON
+ data-display-scale HTML
+ data-scale HTML
+
+ SlurHeight .net
+ slurHeight JavaScript
+ slurHeight JSON
+ data-slur-height HTML
+
+ Notation.SlurHeight .net
+ notation.slurHeight JavaScript
+ notation.slurHeight JSON
+ data-notation-slur-height HTML
+
+ Engine .net
+ engine JavaScript
+ engine JSON
+ data-engine HTML
+
+ Core.Engine .net
+ core.engine JavaScript
+ core.engine JSON
+ engine JSON
+ data-core-engine HTML
+ data-engine HTML
+
+ StretchForce .net
+ stretchForce JavaScript
+ stretchForce JSON
+ data-stretch-force HTML
+
+ Display.StretchForce .net
+ display.stretchForce JavaScript
+ display.stretchForce JSON
+ stretchForce JSON
+ data-display-stretchforce HTML
+ data-stretchforce HTML
+
+ ForcePianoFingering .net
+ forcePianoFingering JavaScript
+ forcePianoFingering JSON
+ data-force-piano-fingering HTML
+
+ Notation.FingeringMode .net
+ forcePianoFingering JavaScript
+ forcePianoFingering JSON
+ data-force-piano-fingering HTML
+
+ Set it to ScoreForcePiano or SingleNoteEffectBandForcePiano to get the + forced piano fingering depending on the preferred display of fingering. +
+ EnableLazyLoading .net
+ enableLazyLoading JavaScript
+ lazy JSON
+ data-lazy HTML
+
+ Core.EnableLazyLoading .net
+ Core.enableLazyLoading JavaScript
+ core.enableLazyLoading JSON
+ enableLazyLoading JSON
+ data-core-enablelazyloading HTML
+ data-enablelazyloading HTML
+
+ TranspositionPitches .net
+ transpositionPitches JavaScript
+ transpositionPitches JSON
+ data-transposition-pitches HTML
+
+ Notation.TranspositionPitches .net
+ Notation.transpositionPitches JavaScript
+ Notation.transpositionPitches JSON
+ data-notation-transpositionpitches HTML
+
+ DisplayTranspositionPitches .net
+ displayTranspositionPitches JavaScript
+ displayTranspositionPitches JSON
+ data-display-transposition-pitches HTML
+
+ Notation.DisplayTranspositionPitches .net
+ notation.displayTranspositionPitches JavaScript
+ notation.displayTranspositionPitches JSON
+ data-notation-displaytranspositionpitches HTML
+
+ ScriptFile .net
+ scriptFile JavaScript
+ scriptFile JSON
+ data-script-file HTML
+
+ Core.ScriptFile .net
+ core.scriptFile JavaScript
+ core.scriptFile JSON
+ scriptFile JSON
+ data-core-script-fileHTML
+ data-script-file HTML
+
+ FontDirectory .net
+ fontDirectory JavaScript
+ fontDirectory JSON
+ data-font-directory HTML
+
+ Core.FontDirectory .net
+ core.fontDirectory JavaScript
+ core.fontDirectory JSON
+ fontDirectory JSON
+ data-core-font-directory HTML
+ data-font-directory HTML
+
+ SmallGraceTabNotes .net
+ smallGraceTabNotes JavaScript
+ smallGraceTabNotes JSON
+ data-small-grace-tab-notes HTML
+
+ Notation.SmallGraceTabNotes .net
+ notation.smallGraceTabNotes JavaScript
+ notation.smallGraceTabNotes JSON
+ data-notation-smallgracetabnotes HTML
+
+ FingeringMode .net
+ fingeringMode JavaScript
+ fingeringMode JSON
+ data-fingering-mode HTML
+
+ Notation.FingeringMode .net
+ notation.fingeringMode JavaScript
+ notation.fingeringMode JSON
+ data-notation-fingering-mode HTML
+
+ ExtendBendArrowsOnTiedNotes .net
+ extendBendArrowsOnTiedNotes JavaScript
+ extendBendArrowsOnTiedNotes JSON
+ data-extend-bend-arrows-on-tied-notes HTML
+
+ Notation.ExtendBendArrowsOnTiedNotes .net
+ notation.extendBendArrowsOnTiedNotes JavaScript
+ notation.extendBendArrowsOnTiedNotes JSON
+ data-notation-extendbendarrowsontiednotes HTML
+
+ ShowParenthesisForTiedBends .net
+ showParenthesisForTiedBends JavaScript
+ showParenthesisForTiedBends JSON
+ data-show-parenthesis-for-tied-bends HTML
+
+ Notation.ShowParenthesisForTiedBends .net
+ notation.showParenthesisForTiedBends JavaScript
+ notation.showParenthesisForTiedBends JSON
+ data-notation-showparenthesisfortiedbends HTML
+
+ ShowTabNoteOnTiedBend .net
+ showTabNoteOnTiedBend JavaScript
+ showTabNoteOnTiedBend JSON
+ data-show-tab-note-on-tied-bend HTML
+
+ Notation.ShowTabNoteOnTiedBend .net
+ notation.showTabNoteOnTiedBend JavaScript
+ notation.showTabNoteOnTiedBend JSON
+ data-notation-showtabnoteontiedbend HTML
+
+ ShowZeroOnDiveWhammy .net
+ showZeroOnDiveWhammy JavaScript
+ showZeroOnDiveWhammy JSON
+ data-show-zero-on-dive-whammy HTML
+
+ Notation.ShowZeroOnDiveWhammy .net
+ notation.showZeroOnDiveWhammy JavaScript
+ notation.showZeroOnDiveWhammy JSON
+ data-notation-showzeroondivewhammy HTML
+
+ ExtendLineEffectsToBeatEnd .net
+ extendLineEffectsToBeatEnd JavaScript
+ extendLineEffectsToBeatEnd JSON
+ data-extend-line-effects-to-beat-end HTML
+
+ Notation.ExtendLineEffectsToBeatEnd .net
+ notation.extendLineEffectsToBeatEnd JavaScript
+ notation.extendLineEffectsToBeatEnd JSON
+ data-notation-extendlineeffectstobeatend HTML
+
+ SongBookBendDuration .net
+ songBookBendDuration JavaScript
+ songBookBendDuration JSON
+ data-song-book-bend-duration HTML
+
+ Player.SongBookBendDuration .net
+ player.songBookBendDuration JavaScript
+ player.songBookBendDuration JSON
+ data-player-songbookbendduration HTML
+
+ SongBookDipDuration .net
+ songBookDipDuration JavaScript
+ songBookDipDuration JSON
+ data-song-book-dip-duration HTML
+
+ Player.SongBookDipDuration .net
+ player.songBookDipDuration JavaScript
+ player.songBookDipDuration JSON
+ data-player-songbookdipduration HTML
+
+ Layout.Mode .net
+ layout.mode JavaScript
+ layout.mode JSON
+ layout JSON
+ data-layout HTML
+
+ Display.LayoutMode .net
+ display.layoutMode JavaScript
+ display.layoutMode JSON
+ layoutMode JSON
+ data-display-layout-mode HTML
+ data-layout-mode HTML
+
+ The display mode is now a strong typed enumeration. +
+ Layout.AdditionalSettings["barsPerRow"] .net
+ layout.additionalSettings.barsPerRow JavaScript
+ layout.additionalSettings.barsPerRow JSON
+ data-layout-bars-per-row HTML
+
+ Display.BarsPerRow .net
+ display.barsPerRow JavaScript
+ display.barsPerRow JSON
+ barsPerRow JSON
+ data-display-barsperrow HTML
+ data-barsperrow HTML
+
+ Layout.AdditionalSettings["start"] .net
+ layout.additionalSettings.start JavaScript
+ layout.additionalSettings.start JSON
+ data-layout-start HTML
+
+ Display.StartBar .net
+ display.startBar JavaScript
+ display.startBar JSON
+ startBar JSON
+ data-display-startbar HTML
+ data-startbar HTML
+
+ Layout.AdditionalSettings["count"] .net
+ layout.additionalSettings.count JavaScript
+ layout.additionalSettings.count JSON
+ data-layout-count HTML
+
+ Display.BarCount .net
+ display.barCount JavaScript
+ display.barCount JSON
+ barCount JSON
+ data-display-barcount HTML
+ data-barcount HTML
+
+ Layout.AdditionalSettings["hideInfo"] .net
+ layout.additionalSettings.hideInfo JavaScript
+ layout.additionalSettings.hideInfo JSON
+ data-layout-hide-info HTML
+
+ Display.HideInfo .net
+ display.hideInfo JavaScript
+ display.hideInfo JSON
+ hideInfo JSON
+ data-display-hideinfo HTML
+ data-hideinfo HTML
+
+ Layout.AdditionalSettings["hideTuning"] .net
+ layout.additionalSettings.hideTuning JavaScript
+ layout.additionalSettings.hideTuning JSON
+ data-layout-hide-tuning HTML
+
+ Display.HideTuning .net
+ display.hideTuning JavaScript
+ display.hideTuning JSON
+ hideTuning JSON
+ data-display-hidetuning HTML
+ data-hidetuning HTML
+
+ Layout.AdditionalSettings["hideChordDiagram"] .net
+ layout.additionalSettings.hideChordDiagram JavaScript
+ layout.additionalSettings.hideChordDiagram JSON
+ data-layout-hide-chord-diagram HTML
+
+ Display.HideChordDiagrams .net
+ display.hideChordDiagrams JavaScript
+ display.hideChordDiagrams JSON
+ hideChordDiagrams JSON
+ data-display-hidechorddiagrams HTML
+ data-hidechorddiagrams HTML
+
+ Layout.AdditionalSettings["hideTrackNames"] .net
+ layout.additionalSettings.hideTrackNames JavaScript
+ layout.additionalSettings.hideTrackNames JSON
+ data-layout-hide-track-names HTML
+
+ Display.HideTrackNames .net
+ display.hideTrackNames JavaScript
+ display.hideTrackNames JSON
+ hideTrackNames JSON
+ data-display-hidetracknames HTML
+ data-hidetracknames HTML
+
+ IncludeNoteBounds .net
+ includeNoteBounds JavaScript
+ includeNoteBounds JSON
+ data-include-note-bounds HTML
+
+ Core.IncludeNoteBounds .net
+ core.includeNoteBounds JavaScript
+ core.includeNoteBounds JSON
+ includeNoteBoundsJSON
+ data-core-includenotebounds HTML
+ data-includenotebounds HTML
+
+ PlayTripletFeel .net
+ playTripletFeel JavaScript
+ playTripletFeel JSON
+ data-play-triplet-feel HTML
+
+ player.PlayTripletFeel .net
+ player.playTripletFeel JavaScript
+ player.playTripletFeel JSON
+ data-player-playtripletfeel HTML
+ +
+ Vibrato.NoteSlightAmplitude .net
+ vibrato.noteSlightAmplitude JavaScript
+ vibrato.noteSlightAmplitude JSON
+ data-vibrato-note-slight-amplitude HTML
+
+ Player.Vibrato.NoteSlightAmplitude .net
+ player.vibrato.noteSlightAmplitude JavaScript
+ player.vibrato.noteSlightAmplitude JSON
+ data-player-vibrato-noteslightamplitude HTML
+
+ Vibrato.NoteWideAmplitude .net
+ vibrato.noteWideAmplitude JavaScript
+ vibrato.noteWideAmplitude JSON
+ data-vibrato-note-wide-amplitude HTML
+
+ Player.Vibrato.NoteWideAmplitude .net
+ player.vibrato.noteWideAmplitude JavaScript
+ player.vibrato.noteWideAmplitude JSON
+ data-player-vibrato-notewideamplitude HTML
+ +
+ Vibrato.NoteSlightLength .net
+ vibrato.noteSlightLength JavaScript
+ vibrato.noteSlightLength JSON
+ data-vibrato-note-slight-length HTML
+
+ Player.Vibrato.NoteSlightLength .net
+ player.vibrato.noteSlightLength JavaScript
+ player.vibrato.noteSlightLength JSON
+ data-player-vibrato-noteslightlength HTML
+
+ Vibrato.NoteWideLength .net
+ vibrato.noteWideLength JavaScript
+ vibrato.noteWideLength JSON
+ data-vibrato-note-wide-length HTML
+
+ Player.Vibrato.NoteWideLength .net
+ player.vibrato.noteWideLength JavaScript
+ player.vibrato.noteWideLength JSON
+ data-player-vibrato-notewidelength HTML
+
+ Vibrato.BeatSlightAmplitude .net
+ vibrato.beatSlightAmplitude JavaScript
+ vibrato.beatSlightAmplitude JSON
+ data-vibrato-beat-slight-amplitude HTML
+
+ Player.Vibrato.BeatSlightAmplitude .net
+ player.vibrato.beatSlightAmplitude JavaScript
+ player.vibrato.beatSlightAmplitude JSON
+ data-player-vibrato-beatslightamplitude HTML
+
+ Vibrato.BeatWideAmplitude .net
+ vibrato.beatWideAmplitude JavaScript
+ vibrato.beatWideAmplitude JSON
+ data-vibrato-beat-wide-amplitude HTML
+
+ Player.Vibrato.BeatWideAmplitude .net
+ player.vibrato.beatWideAmplitude JavaScript
+ player.vibrato.beatWideAmplitude JSON
+ data-player-vibrato-beatwideamplitude HTML
+ +
+ Vibrato.BeatSlightLength .net
+ vibrato.beatSlightLength JavaScript
+ vibrato.beatSlightLength JSON
+ data-vibrato-beat-slight-length HTML
+
+ Player.Vibrato.BeatSlightLength .net
+ player.vibrato.beatSlightLength JavaScript
+ player.vibrato.beatSlightLength JSON
+ data-player-vibrato-beatslightlength HTML
+
+ Vibrato.BeatWideLength .net
+ vibrato.beatWideLength JavaScript
+ vibrato.beatWideLength JSON
+ data-vibrato-beat-wide-length HTML
+
+ Player.Vibrato.BeatWideLength .net
+ player.vibrato.beatWideLength JavaScript
+ player.vibrato.beatWideLength JSON
+ data-player-vibrato-beatwidelength HTML
+
+ Staves.Id .net
+ staves.id JavaScript
+ staves.id JSON
+ staves JSON
+ data-staves HTML
+
+ Display.StaveProfile .net
+ display.staveProfile JavaScript
+ display.staveProfile JSON
+ staveProfile JSON
+ data-display-staveprofile HTML
+ data-staveprofile HTML
+
+ Staves.AdditionalSettings["rhythm"] .net
+ staves.additionalSettings.rhythm JavaScript
+ staves.additionalSettings.rhythm JSON
+ data-staves-rhythm HTML
+
+ Notation.RhythmMode .net
+ notation.rhythmMode JavaScript
+ notation.rhythmMode JSON
+ data-notation-rhythmmode HTML
+ +
+ Staves.AdditionalSettings["rhythmBeams"] .net
+ staves.additionalSettings.rhythmBeams JavaScript
+ staves.additionalSettings.rhythmBeams JSON
+ data-staves-rhythm-beams HTML
+
+ Notation.RhythmMode .net
+ notation.rhythmMode JavaScript
+ notation.rhythmMode JSON
+ data-notation-rhythmmode HTML
+ +
+ Staves.AdditionalSettings["rhythmHeight"] .net
+ staves.additionalSettings.rhythmHeight JavaScript
+ staves.additionalSettings.rhythmHeight JSON
+ data-staves-rhythm-height HTML
+
+ Notation.RhythmHeight .net
+ notation.rhythmHeight JavaScript
+ notation.rhythmHeight JSON
+ data-notation-rhythmheight HTML
+ +
+ EnablePlayer .net
+ enablePlayer JavaScript
+ enablePlayer JSON
+ data-player HTML
+
+ Player.EnablePlayer .net
+ player.enablePlayer JavaScript
+ player.enablePlayer JSON
+ data-player-enableplayer HTML
+
+ On JavaScript earlier the setting controlled both enabling the player and which soundfont should be loaded. + Now it really only controls whether the player should be enabled. The soundfont is specified via SoundFont or loaded manually via API. +
+ SoundFontFile .net
+ soundFontFile JavaScript
+ soundFontFile JSON
+ data-player HTML
+
+ Player.SoundFont .net
+ player.soundFont JavaScript
+ player.soundFont JSON
+ data-player-soundfont HTML
+
+ EnableCursor .net
+ enableCursor JavaScript
+ cursor JSON
+ data-cursor HTML
+
+ Player.EnableCursor .net
+ player.enableCursor JavaScript
+ player.enableCursor JSON
+ data-player-enablecursor HTML
+ +
+ ImporterSettings["encoding"] .net
+ importer.encoding JavaScript
+ importer.encoding JSON
+ data-importer-encoding HTML
+
+ Importer.Encoding .net
+ importer.encoding JavaScript
+ importer.encoding JSON
+ data-importer-encoding HTML
+
+ Staves.ImporterSettings["musicXMLMergePartGroups"] .net
+ staves.importer.musicXMLMergePartGroups JavaScript
+ staves.importer.musicXMLMergePartGroups JSON
+ data-importer-musicxml-merge-part-groups HTML
+
+ Importer.MergePartGroupsInMusicXml .net
+ importer.mergePartGroupsInMusicXml JavaScript
+ importer.mergePartGroupsInMusicXml JSON
+ data-importer-mergepartgroupsinmusicxml HTML
+ +
+ RenderingResources.CopyrightFont .net
+ resources.copyrightFont JavaScript
+ resources.copyrightFont JSON
+ data-resources-copyright-font HTML
+
+ Display.Resources.CopyrightFont .net
+ display.resources.copyrightFont JavaScript
+ display.resources.copyrightFont JSON
+ resources.copyrightFont JSON
+ data-display-resources-copyrightfont HTML
+ data-resources-copyrightfont HTML
+ +
+ RenderingResources.TitleFont .net
+ resources.titleFont JavaScript
+ resources.titleFont JSON
+ data-resources-title-font HTML
+
+ Display.Resources.TitleFont .net
+ display.resources.titleFont JavaScript
+ display.resources.titleFont JSON
+ resources.titleFont JSON
+ data-display-resources-titlefont HTML
+ data-resources-titlefont HTML
+
+ RenderingResources.SubTitleFont .net
+ resources.subTitleFont JavaScript
+ resources.subTitleFont JSON
+ data-resources-subtitle-font HTML
+
+ Display.Resources.SubTitleFont .net
+ display.resources.subTitleFont JavaScript
+ display.resources.subTitleFont JSON
+ resources.subTitleFont JSON
+ data-display-resources-subtitlefont HTML
+ data-resources-subtitlefont HTML
+ +
+ RenderingResources.WordsFont .net
+ resources.wordsFont JavaScript
+ resources.wordsFont JSON
+ data-resources-words-font HTML
+
+ Display.Resources.WordsFont .net
+ display.resources.wordsFont JavaScript
+ display.resources.wordsFont JSON
+ resources.wordsFont JSON
+ data-display-resources-wordsfont HTML
+ data-resources-wordsfont HTML
+
+ RenderingResources.EffectFont .net
+ resources.effectFont JavaScript
+ resources.effectFont JSON
+ data-resources-effect-font HTML
+
+ Display.Resources.EffectFont .net
+ display.resources.effectFont JavaScript
+ display.resources.effectFont JSON
+ resources.effectFont JSON
+ data-display-resources-effectfont HTML
+ data-resources-effectfont HTML
+
+ RenderingResources.FretboardNumberFont .net
+ resources.fretboardNumberFont JavaScript
+ resources.fretboardNumberFont JSON
+ data-resources-fretboard-number-font HTML
+
+ Display.Resources.FretboardNumberFont .net
+ display.resources.fretboardNumberFont JavaScript
+ display.resources.fretboardNumberFont JSON
+ resources.fretboardNumberFont JSON
+ data-display-resources-fretboardnumberfont HTML
+ data-resources-fretboardnumberfont HTML
+
+ RenderingResources.TablatureFont .net
+ resources.tablatureFont JavaScript
+ resources.tablatureFont JSON
+ data-resources-tablature-font HTML
+
+ Display.Resources.TablatureFont .net
+ display.resources.tablatureFont JavaScript
+ display.resources.tablatureFont JSON
+ resources.tablatureFont JSON
+ data-display-resources-tablaturefontHTML
+ data-resources-tablaturefontHTML
+
+ RenderingResources.GraceFont .net
+ resources.graceFont JavaScript
+ resources.graceFont JSON
+ data-resources-grace-font HTML
+
+ Display.Resources.GraceFont .net
+ display.resources.graceFont JavaScript
+ display.resources.graceFont JSON
+ resources.graceFont JSON
+ data-display-resources-gracefont HTML
+ data-resources-gracefont HTML
+
+ RenderingResources.BarNumberFont .net
+ resources.barNumberFont JavaScript
+ resources.barNumberFont JSON
+ data-resources-bar-number-font HTML
+
+ Display.Resources.BarNumberFont .net
+ display.resources.barNumberFont JavaScript
+ display.resources.barNumberFont JSON
+ resources.barNumberFont JSON
+ data-display-resources-barnumberfont HTML
+ data-resources-barnumberfont HTML
+
+ RenderingResources.FingeringFont .net
+ resources.fingeringFont JavaScript
+ resources.fingeringFont JSON
+ data-resources-fingering-font HTML
+
+ Display.Resources.FingeringFont .net
+ display.resources.fingeringFont JavaScript
+ display.resources.fingeringFont JSON
+ resources.fingeringFont JSON
+ data-display-resources-fingeringfont HTML
+ data-resources-fingeringfont HTML
+
+ RenderingResources.MarkerFont .net
+ resources.markerFont JavaScript
+ resources.markerFont JSON
+ data-resources-marker-font HTML
+
+ Display.Resources.MarkerFont .net
+ display.resources.markerFont JavaScript
+ display.resources.markerFont JSON
+ resources.markerFont JSON
+ data-display-resources-markerfont HTML
+ data-resources-markerfont HTML
+
+ RenderingResources.StaffLineColor .net
+ resources.staffLineColor JavaScript
+ resources.staffLineColor JSON
+ data-resources-staff-line-color HTML
+
+ Display.Resources.StaffLineColor .net
+ display.resources.staffLineColor JavaScript
+ display.resources.staffLineColor JSON
+ resources.staffLineColor JSON
+ data-display-resources-stafflinecolor HTML
+ data-resources-stafflinecolor HTML
+
+ RenderingResources.BarNumberColor .net
+ resources.barNumberColor JavaScript
+ resources.barNumberColor JSON
+ data-resources-bar-number-color HTML
+
+ Display.Resources.BarNumberColor .net
+ display.resources.barNumberColor JavaScript
+ display.resources.barNumberColor JSON
+ resources.barNumberColor JSON
+ data-display-resources-barnumbercolor HTML
+ data-resources-barnumbercolor HTML
+
+ RenderingResources.BarSeparatorColor .net
+ resources.barSeparatorColor JavaScript
+ resources.barSeparatorColor JSON
+ data-resources-bar-separator-color HTML
+
+ Display.Resources.BarSeparatorColor .net
+ display.resources.barSeparatorColor JavaScript
+ display.resources.barSeparatorColor JSON
+ resources.barSeparatorColor JSON
+ data-display-resources-barseparatorcolor HTML
+ data-resources-barseparatorcolor HTML
+
+ RenderingResources.MainGlyphColor .net
+ resources.mainGlyphColor JavaScript
+ resources.mainGlyphColor JSON
+ data-resources-main-glyph-color HTML
+
+ Display.Resources.MainGlyphColor .net
+ display.resources.mainGlyphColor JavaScript
+ display.resources.mainGlyphColor JSON
+ resources.mainGlyphColor JSON
+ data-display-resources-mainglyphcolor HTML
+ data-resources-mainglyphcolor HTML
+
+ RenderingResources.SecondaryGlyphColor .net
+ resources.secondaryGlyphColor JavaScript
+ resources.secondaryGlyphColor JSON
+ data-resources-secondary-glyph-color HTML
+
+ Display.Resources.SecondaryGlyphColor .net
+ display.resources.secondaryGlyphColor JavaScript
+ display.resources.secondaryGlyphColor JSON
+ resources.secondaryGlyphColor JSON
+ data-display-resources-secondaryglyphcolor HTML
+ data-resources-secondaryglyphcolor HTML
+
+ RenderingResources.ScoreInfoColor .net
+ resources.scoreInfoColor JavaScript
+ resources.scoreInfoColor JSON
+ data-resources-score-info-color HTML
+
+ Display.Resources.ScoreInfoColor .net
+ display.resources.scoreInfoColor JavaScript
+ display.resources.scoreInfoColor JSON
+ resources.scoreInfoColor JSON
+ data-display-resources-scoreinfocolor HTML
+ data-resources-scoreinfocolor HTML
+
+ ScrollOffsetX .net
+ scrollOffsetX JavaScript
+ playerOffset JSON
+ playerOffset[0] JSON
+ data-player-offset HTML
+
+ player.ScrollOffsetX .net
+ player.scrollOffsetX JavaScript
+ player.scrollOffsetX JSON
+ data-player-scrolloffsetx HTML
+
+ ScrollOffsetY .net
+ scrollOffsetY JavaScript
+ playerOffset JSON
+ playerOffset[1] JSON
+ data-player-offset HTML
+
+ player.ScrollOffsetY .net
+ player.scrollOffsetY JavaScript
+ player.scrollOffsetY JSON
+ data-player-scrolloffsety HTML
+
+ ScrollMode .net
+ scrollMode JavaScript
+ autoScroll JSON
+ data-auto-scroll HTML
+
+ player.ScrollMode .net
+ player.scrollMode JavaScript
+ player.scrollMode JSON
+ data-player-scrollmode HTML
+
+ ScrollSpeed .net
+ scrollSpeed JavaScript
+ scrollSpeed JSON
+
+ player.ScrollSpeed .net
+ player.scrollSpeed JavaScript
+ player.scrollSpeed JSON
+ data-player-scrollspeed HTML
+
+ ScrollElement .net
+ scrollElement JavaScript
+ scrollElement JSON
+ data-scroll-element HTML
+
+ Player.ScrollElement .net
+ player.scrollElement JavaScript
+ player.scrollElement JSON
+ data-player-scroll-element HTML
+
+ BeatCursorWidth .net
+ beatCursorWidth JavaScript
+ beatCursorWidth JSON
+ data-beat-cursor-width HTML
+
+ + Setting was removed4 use CSS like for the other stylings to set the width of the beat cursor. +
+ + +

Side-by-side Comparison

+ +

Right below you can find a side-by-side comparison between a settings object before and after the rework. + + + + + + + + + + + + + + +
BeforeAfter
+
+                
+{
+    scriptFile: null,
+    fontDirectory: null,
+    enableLazyLoading: true,
+    soundFontFile: null,
+    scrollElement: "html,body",
+    scale: 1,
+    engine: "default",
+    layout: {
+        mode: "page",
+        additionalSettings: {}
+    },
+    importerSettings: {},
+    stretchForce: 1,
+    forcePianoFingering: false,
+    staves: {
+        id: "default",
+        additionalSettings: {}
+    },
+    transpositionPitches: [],
+    displayTranspositionPitches: [],
+    logLevel: "info"
+    smallGraceTabNotes: true,
+    extendBendArrowsOnTiedNotes: true,
+    showParenthesisForTiedBends: true,
+    showTabNoteOnTiedBend: true,
+    displayMode: 0,
+    fingeringMode: 0,
+    showZeroOnDiveWhammy: false,
+    extendLineEffectsToBeatEnd: false,
+    vibrato: {
+        noteWideLength: 480,
+        noteWideAmplitude: 2,
+        noteSlightLength: 480,
+        noteSlightAmplitude: 2,
+        beatWideLength: 240,
+        beatWideAmplitude: 3,
+        beatSlightLength: 240,
+        beatSlightAmplitude: 3
+    }
+    playTripletFeel: true,
+    slurHeight: 7,
+    songBookBendDuration: 75,
+    songBookDipDuration: 150,
+    includeNoteBounds: false,
+    useWorkers: true,
+    enablePlayer: false,
+    enableCursor: false,
+    beatCursorWidth: 3,
+    scrollOffsetX: 0,
+    scrollOffsetY: 0,
+    scrollMode: "continuous",
+    scrollSpeed: 300,
+    renderingResources: {
+        copyrightFont: "bold 12px 'Arial'",
+        titleFont: "32px 'Georgia'",
+        subTitleFont: "20px 'Georgia'",
+        wordsFont: "15px 'Georgia'",
+        effectFont: "italic 12px 'Georgia'",
+        fretboardNumberFont: "11px 'Arial'",
+        tablatureFont: "13px 'Arial'",
+        graceFont: "11px 'Arial'",
+        staffLineColor: "#A5A5A5",
+        barSeparatorColor:"#222211",
+        barNumberFont: "11px 'Arial'",
+        barNumberColor: "#C80000"},
+        fingeringFont: "14px 'Georgia'",
+        markerFont: "bold 14px 'Georgia'",
+        mainGlyphColor: "#000000"},
+        secondaryGlyphColor: "rgba(0,0,0,0.40)",
+        scoreInfoColor: "#000000"
+    }
+}
+                
+                
+
+
+                
+{
+    core: {
+        includeNoteBounds: false,
+        useWorkers: true,
+        logLevel: "info",
+        engine: "default",
+        enableLazyLoading: true,
+        scriptFile: "https://docs.alphatab.net/develop/js/alphaTab/alphaTab.min.js",
+        fontDirectory: "https://docs.alphatab.net/develop/js/alphaTab/Font/"    
+    },
+    display: {
+        barCountPerPartial: 10
+        barCount: -1
+        startBar: 1
+        barsPerRow: -1
+        staveProfile: 'default'
+        layoutMode: 'page',
+        stretchForce: 1
+        scale: 1
+        padding: null,
+        resources: {
+            copyrightFont: "bold 12px 'Arial'",
+            titleFont: "32px 'Georgia'",
+            subTitleFont: "20px 'Georgia'",
+            wordsFont: "15px 'Georgia'",
+            effectFont: "italic 12px 'Georgia'",
+            fretboardNumberFont: "11px 'Arial'",
+            tablatureFont: "13px 'Arial'",
+            graceFont: "11px 'Arial'",
+            staffLineColor: "#A5A5A5",
+            barSeparatorColor:"#222211",
+            barNumberFont: "11px 'Arial'",
+            barNumberColor: "#C80000"},
+            fingeringFont: "14px 'Georgia'",
+            markerFont: "bold 14px 'Georgia'",
+            mainGlyphColor: "#000000"},
+            secondaryGlyphColor: "rgba(0,0,0,0.40)",
+            scoreInfoColor: "#000000"
+        }
+    },
+    importer: {
+        mergePartGroupsInMusicXml: false,
+        encoding: "utf-8"
+    },
+    notation: {
+        slurHeight: 7,
+        extendLineEffectsToBeatEnd: false,
+        showZeroOnDiveWhammy: false,
+        showTabNoteOnTiedBend: true,
+        showParenthesisForTiedBends: true,
+        extendBendArrowsOnTiedNotes: true,
+        smallGraceTabNotes: true,
+        displayTranspositionPitches: []
+        transpositionPitches: [],
+        rhythmHeight: 15,
+        rhythmMode: "hidden",
+        hideChordDiagrams: false,
+        hideTrackNames: false,
+        hideTuning: false,
+        hideInfo: false,
+        fingeringMode: "ScoreDefault",
+        notationMode: "GuitarPro"
+    }
+    player: {
+        playTripletFeel: true,
+        vibrato: {
+            beatSlightAmplitude: 3,
+            beatSlightLength: 240,
+            beatWideAmplitude: 3,
+            beatWideLength: 240,
+            noteSlightAmplitude: 2,
+            noteSlightLength: 480,
+            noteWideAmplitude: 2,
+            noteWideLength: 480,
+        }
+        songBookDipDuration: 150,
+        songBookBendDuration: 75,
+        scrollSpeed: 300,
+        scrollMode: "Continuous",
+        scrollOffsetY: 0,
+        scrollOffsetX: 0,
+        enableCursor: true,
+        enablePlayer: false,
+        scrollElement: "html,body",
+        soundFont: null
+    }
+}
+                
+                
+
\ No newline at end of file diff --git a/Documentation/input/reference/events/error.cshtml b/Documentation/input/reference/events/error.cshtml index 48546a5ad..0a4481e4f 100644 --- a/Documentation/input/reference/events/error.cshtml +++ b/Documentation/input/reference/events/error.cshtml @@ -19,10 +19,10 @@ Since: 0.9.4 - + - +
Action<string,Exception> .netAction<string,Exception> .net
function(type, details) JavaScriptfunction(type, details) JavaScript
@@ -39,7 +39,7 @@ Since: 0.9.4 - type All + type all string The kind of error that happened, or the module that reported the error. Possible values are: @@ -52,7 +52,7 @@ Since: 0.9.4 - details All + details all System.Exception The raw bytes containing a file supported by the score loaders. diff --git a/Documentation/input/reference/events/index.cshtml b/Documentation/input/reference/events/index.cshtml index 296b68df0..b9647c7c9 100644 --- a/Documentation/input/reference/events/index.cshtml +++ b/Documentation/input/reference/events/index.cshtml @@ -41,13 +41,13 @@ For the other cases the events can be subscribed via registering a function on t - @(child.WithoutSettings.String(Keys.Title, childTreePath.Last().ToString())) .net + @(child.WithoutSettings.String(Keys.Title, childTreePath.Last().ToString())) .net @for(int i = 0; i < jsNames.Length; i++) {
- @(jsNames[i]) JavaScript + @(jsNames[i]) JavaScript } -
@(child.String("DomName")) DOM +
@(child.String("DomName")) DOM
diff --git a/Documentation/input/reference/events/loaded.cshtml b/Documentation/input/reference/events/loaded.cshtml index fb08502bb..994e8b063 100644 --- a/Documentation/input/reference/events/loaded.cshtml +++ b/Documentation/input/reference/events/loaded.cshtml @@ -18,10 +18,10 @@ Since: 0.9.4 - + - +
Action<AlphaTab.Model.Score> .netAction<AlphaTab.Model.Score> .net
function(score) JavaScriptfunction(score) JavaScript
@@ -38,7 +38,7 @@ Since: 0.9.4 - score All + score all AlphaTab.Model.Score The score that was loaded with applied transpositions. diff --git a/Documentation/input/reference/events/midiloaded.cshtml b/Documentation/input/reference/events/midiloaded.cshtml index fcca5432c..596e15902 100644 --- a/Documentation/input/reference/events/midiloaded.cshtml +++ b/Documentation/input/reference/events/midiloaded.cshtml @@ -17,10 +17,10 @@ Since: 0.9.4 - + - +
Action .netAction .net
function() JavaScriptfunction() JavaScript
diff --git a/Documentation/input/reference/events/playedbeatchanged.cshtml b/Documentation/input/reference/events/playedbeatchanged.cshtml index 2d4500550..64d1abe12 100644 --- a/Documentation/input/reference/events/playedbeatchanged.cshtml +++ b/Documentation/input/reference/events/playedbeatchanged.cshtml @@ -17,10 +17,10 @@ Since: 0.9.4 - + - +
Action<Beat> .netAction<Beat> .net
function(e) JavaScriptfunction(e) JavaScript
@@ -37,7 +37,7 @@ Since: 0.9.4 - args All + args all AlphaTab.Model.Beat The new beat that is now being played. diff --git a/Documentation/input/reference/events/playerpositionchanged.cshtml b/Documentation/input/reference/events/playerpositionchanged.cshtml index 0ec470e6b..ac409c964 100644 --- a/Documentation/input/reference/events/playerpositionchanged.cshtml +++ b/Documentation/input/reference/events/playerpositionchanged.cshtml @@ -17,10 +17,10 @@ Since: 0.9.4 - + - +
Action<PositionChangedEventArgs> .netAction<PositionChangedEventArgs> .net
function(e) JavaScriptfunction(e) JavaScript
@@ -37,7 +37,7 @@ Since: 0.9.4 - args All + args all AlphaTab.PositionChangedEventArgs The information about the player position. @@ -59,8 +59,8 @@ Since: 0.9.4 - CurrentTime .net
- currentTime JavaScript + CurrentTime .net
+ currentTime JavaScript double @@ -69,8 +69,8 @@ Since: 0.9.4 - EndTime .net
- endTime JavaScript + EndTime .net
+ endTime JavaScript double @@ -79,8 +79,8 @@ Since: 0.9.4 - CurrentTick .net
- currentTick JavaScript + CurrentTick .net
+ currentTick JavaScript int @@ -89,8 +89,8 @@ Since: 0.9.4 - EndTick .net
- endTick JavaScript + EndTick .net
+ endTick JavaScript int diff --git a/Documentation/input/reference/events/playerstatechanged.cshtml b/Documentation/input/reference/events/playerstatechanged.cshtml index 488fd07f7..ca994f939 100644 --- a/Documentation/input/reference/events/playerstatechanged.cshtml +++ b/Documentation/input/reference/events/playerstatechanged.cshtml @@ -17,10 +17,10 @@ Since: 0.9.4 - + - +
Action<PlayerStateChangedEventArgs> .netAction<PlayerStateChangedEventArgs> .net
function(e) JavaScriptfunction(e) JavaScript
@@ -37,7 +37,7 @@ Since: 0.9.4 - args All + args all AlphaTab.Audio.Synth.PlayerStateChangedEventArgs The information about the player state change event. @@ -59,7 +59,7 @@ Since: 0.9.4 - State .net
+ State .net
AlphaTab.Audio.Synth.PlayerState @@ -68,7 +68,7 @@ Since: 0.9.4 - state JavaScript
+ state JavaScript
int @@ -81,8 +81,8 @@ Since: 0.9.4 - Stopped .net
- stopped JavaScript + Stopped .net
+ stopped JavaScript bool diff --git a/Documentation/input/reference/events/postrenderfinished.cshtml b/Documentation/input/reference/events/postrenderfinished.cshtml index e4fdbbf21..a7e488150 100644 --- a/Documentation/input/reference/events/postrenderfinished.cshtml +++ b/Documentation/input/reference/events/postrenderfinished.cshtml @@ -19,10 +19,10 @@ Since: 0.9.4 - + - +
Action .netAction .net
function() JavaScriptfunction() JavaScript
diff --git a/Documentation/input/reference/events/readyforplayback.cshtml b/Documentation/input/reference/events/readyforplayback.cshtml index ba6cba121..6ee867f00 100644 --- a/Documentation/input/reference/events/readyforplayback.cshtml +++ b/Documentation/input/reference/events/readyforplayback.cshtml @@ -18,10 +18,10 @@ Since: 0.9.4 - + - +
Action .netAction .net
function() JavaScriptfunction() JavaScript
diff --git a/Documentation/input/reference/events/renderfinished.cshtml b/Documentation/input/reference/events/renderfinished.cshtml index 0671c8c9b..8bc4a536b 100644 --- a/Documentation/input/reference/events/renderfinished.cshtml +++ b/Documentation/input/reference/events/renderfinished.cshtml @@ -18,10 +18,10 @@ Since: 0.9.4 - + - +
Action .netAction .net
function() JavaScriptfunction() JavaScript
diff --git a/Documentation/input/reference/events/renderstarted.cshtml b/Documentation/input/reference/events/renderstarted.cshtml index 080e872a0..1319a8197 100644 --- a/Documentation/input/reference/events/renderstarted.cshtml +++ b/Documentation/input/reference/events/renderstarted.cshtml @@ -18,10 +18,10 @@ Since: 0.9.4 - + - +
Action .netAction .net
function() JavaScriptfunction() JavaScript
@@ -37,7 +37,7 @@ Since: 0.9.4 - resize All + resize all bool Whether the rendering is triggered from a resize diff --git a/Documentation/input/reference/events/resize.cshtml b/Documentation/input/reference/events/resize.cshtml index a0a0a50c9..96e2991a3 100644 --- a/Documentation/input/reference/events/resize.cshtml +++ b/Documentation/input/reference/events/resize.cshtml @@ -19,10 +19,10 @@ Since: 0.9.4 - + - +
Action<ResizeEventArgs> .netAction<ResizeEventArgs> .net
function(a) JavaScriptfunction(a) JavaScript
@@ -39,7 +39,7 @@ Since: 0.9.4 - args All + args all AlphaTab.ResizeEventArgs The information about the resize event. @@ -61,8 +61,8 @@ Since: 0.9.4 - OldWidth .net
- oldWidth JavaScript + OldWidth .net
+ oldWidth JavaScript int @@ -71,8 +71,8 @@ Since: 0.9.4 - NewWidth .net
- newWidth JavaScript + NewWidth .net
+ newWidth JavaScript int @@ -81,8 +81,8 @@ Since: 0.9.4 - Settings .net
- settings JavaScript + Settings .net
+ settings JavaScript AlphaTab.Settings diff --git a/Documentation/input/reference/events/soundfontload.cshtml b/Documentation/input/reference/events/soundfontload.cshtml index cf9a04e52..fc82d94ae 100644 --- a/Documentation/input/reference/events/soundfontload.cshtml +++ b/Documentation/input/reference/events/soundfontload.cshtml @@ -18,7 +18,7 @@ Since: 0.9.4 - +
function(e) JavaScriptfunction(e) JavaScript
@@ -34,7 +34,7 @@ Since: 0.9.4 - args All + args all AlphaTab.ProgressEventArgs The information about the load progress of the file. diff --git a/Documentation/input/reference/events/soundfontloaded.cshtml b/Documentation/input/reference/events/soundfontloaded.cshtml index f6ff802f5..9d5ab9a94 100644 --- a/Documentation/input/reference/events/soundfontloaded.cshtml +++ b/Documentation/input/reference/events/soundfontloaded.cshtml @@ -17,10 +17,10 @@ Since: 0.9.4 - + - +
Action .netAction .net
function() JavaScriptfunction() JavaScript
diff --git a/Documentation/input/reference/property/beatcursorwidth.cshtml b/Documentation/input/reference/property/beatcursorwidth.cshtml deleted file mode 100644 index 9b96874ef..000000000 --- a/Documentation/input/reference/property/beatcursorwidth.cshtml +++ /dev/null @@ -1,68 +0,0 @@ -Title: BeatCursorWidth -JsName: beatCursorWidth -DataAttribute: data-beat-cursor-width -Category: Player -Description: Gets or sets the width of the beat cursor in pixels. -ShowInSideBar: false -Since: 0.9.4 ---- - -

Description

-

- This setting configures how wide the beat cursor is. This is a dedicated setting to ensure the cursor is centered on the beat when it reaches the beat play position. -

- -

Types

- - - - - - - - - - - - - - -
TypeValues
int all - 1
- 3
- 5 -
- -

Default Value

- -3 - -

Example - C#

- -
-
-var settings = Settings.Defaults;
-settings.BeatCursorWidth = 3;
-
-
- - -

Example - JavaScript

- -
-
-var settings = {
-    beatCursorWidth: 3
-};
-var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
-var japi = $('#alphaTab').alphaTab(settings);
-
-
- -

Example - HTML

- -
-
-<div id="alphaTab" data-beat-cursor-width="3"></div>
-
-
diff --git a/Documentation/input/reference/property/enablelazyloading.cshtml b/Documentation/input/reference/property/core-enablelazyloading.cshtml similarity index 51% rename from Documentation/input/reference/property/enablelazyloading.cshtml rename to Documentation/input/reference/property/core-enablelazyloading.cshtml index 0d913a6f0..f82faa4b7 100644 --- a/Documentation/input/reference/property/enablelazyloading.cshtml +++ b/Documentation/input/reference/property/core-enablelazyloading.cshtml @@ -1,10 +1,11 @@ -Title: EnableLazyLoading -JsName: lazy -DataAttribute: data-lazy -Category: JavaScript Specific +Title: Core.EnableLazyLoading +JsName: core.enableLazyLoading;enableLazyLoading +JsonName: core.enableLazyLoading:enableLazyLoading +DataAttribute: data-core-enablelazyloading;data-enablelazyloading +Category: Core - JavaScript Specific Description: Enables lazy loading of the rendered music sheet chunks. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

Description

@@ -15,6 +16,8 @@ Since: 0.9.4 This setting set to false, ensures that all rendered items are instantly appended to the DOM.

+@Html.Partial("_PropertyDescription", Model) +

Types

@@ -23,38 +26,4 @@ Since: 0.9.4 -
bool
- -

Default Value

- -true - -

Example - C#

- -
-
-var settings = Settings.Defaults; 
-settings.EnableLazyLoading = false;
-
-
- - -

Example - JavaScript

- -
-
-var settings = {
-    lazy: false
-};
-var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
-var japi = $('#alphaTab').alphaTab(settings);
-
-
- -

Example - HTML

- -
-
-<div id="alphaTab" data-lazy="false"></div>
-
-
\ No newline at end of file + \ No newline at end of file diff --git a/Documentation/input/reference/property/engine.cshtml b/Documentation/input/reference/property/core-engine.cshtml similarity index 61% rename from Documentation/input/reference/property/engine.cshtml rename to Documentation/input/reference/property/core-engine.cshtml index c084f9057..4890c5a87 100644 --- a/Documentation/input/reference/property/engine.cshtml +++ b/Documentation/input/reference/property/core-engine.cshtml @@ -1,10 +1,11 @@ -Title: Engine -JsName: engine -DataAttribute: data-engine +Title: Core.Engine +JsName: core.engine;engine +JsonName: core.engine;engine +DataAttribute: data-core-engine;data-engine Category: Core Description: The engine which should be used to render the the tablature. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

Description

@@ -12,6 +13,8 @@ Since: 0.9.4 AlphaTab can use various render engines to draw the music notation. The available render engines is specific to the platform. Please refer to the table below to find out which engines are available on which platform.

+@Html.Partial("_PropertyDescription", Model) +

Types

@@ -23,7 +26,7 @@ Since: 0.9.4 - + - +
string .netstring .net skia - Available on all .net platforms. Uses Skia for rendering
gdi - Only available desktop .net. Uses GDI+ for rendering
@@ -31,7 +34,7 @@ Since: 0.9.4
string JavaScript & HTMLstring JavaScript & HTML svg - Outputs SVG strings.
html5 - Uses HTML5 canvas elements to render the music notation. @@ -42,43 +45,15 @@ Since: 0.9.4

Default Value

+default which is mapped per platform: + - + - + -
skia .netskia .net
svg JavaScript & HTMLsvg JavaScript & HTML
- -

Example - C#

- -
-
-var settings = Settings.Defaults; 
-settings.Engine = "gdi";
-
-
- - -

Example - JavaScript

- -
-
-var settings = {
-    engine: 'html5'
-};
-var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
-var japi = $('#alphaTab').alphaTab(settings);
-
-
- -

Example - HTML

- -
-
-<div id="alphaTab" data-engine="html5"></div>
-
-
\ No newline at end of file +
\ No newline at end of file diff --git a/Documentation/input/reference/property/fontdirectory.cshtml b/Documentation/input/reference/property/core-fontdirectory.cshtml similarity index 53% rename from Documentation/input/reference/property/fontdirectory.cshtml rename to Documentation/input/reference/property/core-fontdirectory.cshtml index 718b22249..63648fe72 100644 --- a/Documentation/input/reference/property/fontdirectory.cshtml +++ b/Documentation/input/reference/property/core-fontdirectory.cshtml @@ -1,10 +1,11 @@ -Title: FontDirectory -JsName: fontDirectory -DataAttribute: data-font-directory -Category: JavaScript Specific +Title: Core.FontDirectory +JsName: core.fontDirectory;fontDirectory +JsonName: core.fontDirectory;fontDirectory +DataAttribute: data-core-fontdirectory;data-fontdirectory +Category: Core - JavaScript Specific Description: The full URL to the alphaTab font directory. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

Description

@@ -15,37 +16,18 @@ Since: 0.9.4 Alternatively also a global variable ALPHATAB_FONT can be set on the page before initializing alphaTab.

+@Html.Partial("_PropertyDescription", Model) +

Types

- +
stringstring

Default Value

-${AlphaTabScriptFolder}/Font/ - -

Example - JavaScript

- -
-
-window.ALPHATAB_FONT = "https://cdn.myserver.com/fonts/";
-var settings = {
-    fontDirectory: "/assets/fonts/"
-};
-var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
-var japi = $('#alphaTab').alphaTab(settings);
-
-
- -

Example - HTML

- -
-
-<div id="alphaTab" data-font-directory="/assets/fonts/"></div>
-
-
\ No newline at end of file +${AlphaTabScriptFolder}/Font/ \ No newline at end of file diff --git a/Documentation/input/reference/property/includenotebounds.cshtml b/Documentation/input/reference/property/core-includenotebounds.cshtml similarity index 60% rename from Documentation/input/reference/property/includenotebounds.cshtml rename to Documentation/input/reference/property/core-includenotebounds.cshtml index c0498461e..2fbbb8127 100644 --- a/Documentation/input/reference/property/includenotebounds.cshtml +++ b/Documentation/input/reference/property/core-includenotebounds.cshtml @@ -1,9 +1,10 @@ -Title: IncludeNoteBounds -JsName: includeNoteBounds -DataAttribute: data-include-note-bounds +Title: Core.IncludeNoteBounds +JsName: core.includeNoteBounds;includeNoteBounds +JsonName: core.includeNoteBounds;includeNoteBounds +DataAttribute: data-core-includenotebounds;data-includenotebounds Category: Core Description: Gets or sets whether in the BoundsLookup also the position and area of each individual note is provided. -Since: 0.9.4 +Since: 0.9.6 ShowInSideBar: false --- @@ -13,54 +14,39 @@ ShowInSideBar: false By default the position of the individual notes is not collected due to performance reasons. If access to note position information is needed, this setting can enable it.

+@Html.Partial("_PropertyDescription", Model) +

Types

- +
boolbool

Default Value

-false - -

Example - C#

- -
-
-var settings = Settings.Defaults; 
-settings.IncludeNoteBounds = true;
-
-
- +false

Example - JavaScript

 
-var settings = {
-    includeNoteBounds: 'true'
+const settings = {
+    core: {
+        includeNoteBounds: true
+    }
 };
-var api = null;
+let api = null;
 document.querySelector('#alphaTab').addEventListener('alphaTab.rendered', function() {
-    var lookup = api.Renderer.BoundsLookup;
+    var lookup = api.renderer.boundsLookup;
     var x = 100;
     var y = 100;
-    var beat = lookup.GetBeatAtPos(x, y);
-    var note = lookup.GetNoteAtPos(beat, x, y); 
+    var beat = lookup.getBeatAtPos(x, y);
+    var note = lookup.getNoteAtPos(beat, x, y); 
 });
 api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
-var japi = $('#alphaTab').alphaTab(settings);
-
-
- -

Example - HTML

- -
-
-<div id="alphaTab" data-include-note-bounds="true"></div>
 
 
\ No newline at end of file diff --git a/Documentation/input/reference/property/loglevel.cshtml b/Documentation/input/reference/property/core-loglevel.cshtml similarity index 60% rename from Documentation/input/reference/property/loglevel.cshtml rename to Documentation/input/reference/property/core-loglevel.cshtml index 36bd03493..4deb34f08 100644 --- a/Documentation/input/reference/property/loglevel.cshtml +++ b/Documentation/input/reference/property/core-loglevel.cshtml @@ -1,9 +1,10 @@ -Title: LogLevel -JsName: logging -DataAttribute: data-logging +Title: Core.LogLevel +JsName: core.logLevel;logLevel +JsonName: core.logLevel;logLevel +DataAttribute: data-core-loglevel;data-loglevel Category: Core Description: The log level to use within alphaTab. -Since: 0.9.4 +Since: 0.9.6 ShowInSideBar: false --- @@ -12,6 +13,8 @@ ShowInSideBar: false AlphaTab internally does quite a bit of logging for debugging and informational purposes. The log level of alphaTab can be controlled via this setting.

+@Html.Partial("_PropertyDescription", Model) +

Types

@@ -23,7 +26,7 @@ AlphaTab internally does quite a bit of logging for debugging and informational - + - + - +
AlphaTab.Util.LogLevel .netAlphaTab.Util.LogLevel .net None - No logging
Debug - Debug level (internal details are displayed)
@@ -33,7 +36,7 @@ AlphaTab internally does quite a bit of logging for debugging and informational
string JavaScript & HTMLstring JSON & HTML none
debug
@@ -43,7 +46,7 @@ AlphaTab internally does quite a bit of logging for debugging and informational
int JavaScript & HTMLint JavaScript & HTML 0 - None
1 - Debug
@@ -56,36 +59,5 @@ AlphaTab internally does quite a bit of logging for debugging and informational

Default Value

- -GuitarPro - -

Example - C#

- -
-
-var settings = Settings.Defaults; 
-settings.LogLevel = LogLevel.Warning;
-
-
- - -

Example - JavaScript

- -
-
-var settings = {
-    logging: 'warning'
-};
-var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
-var japi = $('#alphaTab').alphaTab(settings);
-
-
- -

Example - HTML

- -
-
-<div id="alphaTab" data-logging="warning"></div>
-
-
+Info diff --git a/Documentation/input/reference/property/scriptfile.cshtml b/Documentation/input/reference/property/core-scriptfile.cshtml similarity index 55% rename from Documentation/input/reference/property/scriptfile.cshtml rename to Documentation/input/reference/property/core-scriptfile.cshtml index 5abb848b0..7997fe043 100644 --- a/Documentation/input/reference/property/scriptfile.cshtml +++ b/Documentation/input/reference/property/core-scriptfile.cshtml @@ -1,10 +1,11 @@ -Title: ScriptFile -JsName: scriptFile -DataAttribute: data-script-file -Category: JavaScript Specific +Title: Core.ScriptFile +JsName: core.scriptFile;scriptFile +JsonName: core.scriptFile;scriptFile +DataAttribute: data-core-scriptfile;data-scriptfile +Category: Core - JavaScript Specific Description: The full URL to the alphaTab JavaScript file. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

Description

@@ -16,37 +17,17 @@ Since: 0.9.4 this will cause an error when alphaTab starts this script as worker.

+@Html.Partial("_PropertyDescription", Model) +

Types

- +
stringstring

Default Value

- -${AlphaTabScriptFolder}/Font/ - -

Example - JavaScript

- -
-
-window.ALPHATAB_ROOT = "https://cdn.myserver.com/scripts/alphaTab.min.js";
-var settings = {
-    scriptFile: "/scripts/bundle.js"
-};
-var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
-var japi = $('#alphaTab').alphaTab(settings);
-
-
- -

Example - HTML

- -
-
-<div id="alphaTab" data-script-file="/assets/fonts/"></div>
-
-
\ No newline at end of file +Absolute url to JavaScript file containing alphaTab. (auto detected) \ No newline at end of file diff --git a/Documentation/input/reference/property/core-useworkers.cshtml b/Documentation/input/reference/property/core-useworkers.cshtml new file mode 100644 index 000000000..f929f2c87 --- /dev/null +++ b/Documentation/input/reference/property/core-useworkers.cshtml @@ -0,0 +1,30 @@ +Title: Core.UseWorkers +JsName: core.useWorkers;useWorkers +JsonName: core.useWorkers;useWorkers +DataAttribute: data-core-useworkers;data-useworkers +Category: Core +Description: Gets or sets whether the rendering should be done in a worker if possible. +ShowInSideBar: false +Since: 0.9.6 +--- + +

Description

+

+ AlphaTab normally tries to render the music sheet asynchronously in a worker. This reduces the load on the UI side and avoids hanging. However sometimes it might be more desirable to have + a synchronous rendering behavior. This setting can be set to false to synchronously render the music sheet on the UI side. +

+ +@Html.Partial("_PropertyDescription", Model) + +

Types

+ + + + + + + +
bool
+ +

Default Value

+true \ No newline at end of file diff --git a/Documentation/input/reference/property/display-barcount.cshtml b/Documentation/input/reference/property/display-barcount.cshtml new file mode 100644 index 000000000..9521606af --- /dev/null +++ b/Documentation/input/reference/property/display-barcount.cshtml @@ -0,0 +1,39 @@ +Title: Display.BarCount +JsName: display.barCount;barCount +JsonName: display.barCount;barCount +DataAttribute: data-display-barcount, data-barcount +Category: Display +Description: The total number of bars that should be rendered from the song. +ShowInSideBar: false +Since: 0.9.6 +--- + +

Description

+

+ This setting sets the number of bars that should be rendered from the overall song. This setting can be used to + achieve a paging system or to only show partial bars of the same file. By this a tutorial alike display can be achieved + that explains various parts of the song. + Demo +

+ +@Html.Partial("_PropertyDescription", Model) + +

Types

+ + + + + + + + + + + + + +
TypeValues
int all
+ +

Default Value

+ +-1 - All bars from start \ No newline at end of file diff --git a/Documentation/input/reference/property/display-barcountperpartial.cshtml b/Documentation/input/reference/property/display-barcountperpartial.cshtml new file mode 100644 index 000000000..e4be68772 --- /dev/null +++ b/Documentation/input/reference/property/display-barcountperpartial.cshtml @@ -0,0 +1,38 @@ +Title: Display.BarCountPerPartial +JsName: display.barCountPerPartial;barCountPerPartial +JsonName: display.barCountPerPartial;barCountPerPartial +DataAttribute: data-display-barcountperpartial, data-barcountperpartial +Category: Display +Description: The number of bars that should be placed within one partial render. +ShowInSideBar: false +Since: 0.9.6 +--- + +

Description

+

+ AlphaTab renders the whole music sheet in smaller chunks named "partials". This is to reduce the risk of + encountering browser performance restrictions and it gives faster visual feedback to the user. This + setting controls how many bars are placed within such a partial. +

+ +@Html.Partial("_PropertyDescription", Model) + +

Types

+ + + + + + + + + + + + + +
TypeValues
int all
+ +

Default Value

+ +10 diff --git a/Documentation/input/reference/property/display-barsperrow.cshtml b/Documentation/input/reference/property/display-barsperrow.cshtml new file mode 100644 index 000000000..c387d535e --- /dev/null +++ b/Documentation/input/reference/property/display-barsperrow.cshtml @@ -0,0 +1,38 @@ +Title: Display.BarsPerRow +JsName: display.barsPerRow;barsPerRow +JsonName: display.barsPerRow;barsPerRow +DataAttribute: data-display-barsperrow, data-barsperrow +Category: Display +Description: Limit the displayed bars per row. +ShowInSideBar: false +Since: 0.9.6 +--- + +

Description

+

+ This setting sets the number of bars that should be put into one row during layouting. This setting is only respected + when using the layoutMode page where bars are aligned in rows. + Demo +

+ +@Html.Partial("_PropertyDescription", Model) + +

Types

+ + + + + + + + + + + + + +
TypeValues
int all
+ +

Default Value

+ +-1 - automatic \ No newline at end of file diff --git a/Documentation/input/reference/property/display-layoutmode.cshtml b/Documentation/input/reference/property/display-layoutmode.cshtml new file mode 100644 index 000000000..3ed0bd9b2 --- /dev/null +++ b/Documentation/input/reference/property/display-layoutmode.cshtml @@ -0,0 +1,40 @@ +Title: Display.LayoutMode +JsName: display.layoutMode +JsonName: display.layoutMode +DataAttribute: data-display-layoutmode +Category: Display +Description: The layouting mode used to arrange the the notation. +Since: 0.9.6 +ShowInSideBar: false +--- + +

Description

+

+ AlphaTab has various layout engines that arrange the rendered bars differently. This setting controls which layout mode is used. +

+ +@Html.Partial("_PropertyDescription", Model) + +

Types

+ + + + + + + + + + + + + + +
TypeValues
string all + page - The bars are aligned in a page-style fashion
+ horizontal - The bars are aligned in a left-to-right fashion. +
+ +

Default Value

+ +page \ No newline at end of file diff --git a/Documentation/input/reference/property/display-padding.cshtml b/Documentation/input/reference/property/display-padding.cshtml new file mode 100644 index 000000000..2171bf999 --- /dev/null +++ b/Documentation/input/reference/property/display-padding.cshtml @@ -0,0 +1,43 @@ +Title: Display.Padding +JsName: display.padding;padding +JsonName: display.padding;padding +DataAttribute: data-display-padding, data-padding +Category: Display +Description: Adjusts the padding between the music notation and the border +ShowInSideBar: false +Since: 0.9.6 +--- + +

Description

+

+ AlphaTab by default has a padding between the border of the control and the start of the content. + This setting controls this padding between border and content. +

+ +@Html.Partial("_PropertyDescription", Model) + +

Types

+ + + + + + + + + + + + + + +
TypeValues
float[] all + [, , , ] +
+ +

Default Value

+ +If set to null:
+ +[20, 20, 20, 20] - for LayoutMode.Horizontal
+[40, 40, 40, 40] - for LayoutMode.Page \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-barnumbercolor.cshtml b/Documentation/input/reference/property/display-resources-barnumbercolor.cshtml new file mode 100644 index 000000000..168630787 --- /dev/null +++ b/Documentation/input/reference/property/display-resources-barnumbercolor.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.BarNumberColor +JsName: display.resources.barNumberColor;resources.barNumberColor +JsonName: display.resources.barNumberColor;resources.barNumberColor +DataAttribute: data-display-resources-barnumbercolor;data-resources-barnumbercolor +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Color +JsType: alphaTab.platform.model.Color +JsonType: string;int +DefaultValue: rgb(200, 0, 0) +Description: The color to use for displaying the bar numbers above the music sheet. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-barnumberfont.cshtml b/Documentation/input/reference/property/display-resources-barnumberfont.cshtml new file mode 100644 index 000000000..58bcc8f32 --- /dev/null +++ b/Documentation/input/reference/property/display-resources-barnumberfont.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.BarNumberFont +JsName: display.resources.barNumberFont;resources.barNumberFont +JsonName: display.resources.barNumberFont;resources.barNumberFont +DataAttribute: data-display-resources-barnumberfont;data-resources-barnumberfont +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Font +JsType: alphaTab.platform.model.Font +JsonType: string +DefaultValue: 11px Arial +Description: The font to use for displaying the bar numbers above the music sheet. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-barseparatorcolor.cshtml b/Documentation/input/reference/property/display-resources-barseparatorcolor.cshtml new file mode 100644 index 000000000..943e8778e --- /dev/null +++ b/Documentation/input/reference/property/display-resources-barseparatorcolor.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.BarSeparatorColor +JsName: display.resources.barSeparatorColor;resources.barSeparatorColor +JsonName: display.resources.barSeparatorColor;resources.barSeparatorColor +DataAttribute: data-display-resources-barseparatorcolor;data-resources-barseparatorcolor +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Color +JsType: alphaTab.platform.model.Color +JsonType: string;int +DefaultValue: rgb(34, 34, 17) +Description: The color to use for rendering bar separators, the accolade and repeat signs. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-copyrightfont.cshtml b/Documentation/input/reference/property/display-resources-copyrightfont.cshtml new file mode 100644 index 000000000..256603a62 --- /dev/null +++ b/Documentation/input/reference/property/display-resources-copyrightfont.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.CopyrightFont +JsName: display.resources.copyrightFont;resources.copyrightFont +JsonName: display.resources.copyrightFont;resources.copyrightFont +DataAttribute: data-display-resources-copyrightfont;data-resources-copyrightfont +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Font +JsType: alphaTab.platform.model.Font +JsonType: string +DefaultValue: bold 12px Arial +Description: The font to use for displaying the songs copyright information in the header of the music sheet. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-effectfont.cshtml b/Documentation/input/reference/property/display-resources-effectfont.cshtml new file mode 100644 index 000000000..bc700a961 --- /dev/null +++ b/Documentation/input/reference/property/display-resources-effectfont.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.EffectFont +JsName: display.resources.effectFont;resources.effectFont +JsonName: display.resources.effectFont;resources.effectFont +DataAttribute: data-display-resources-effectfont;data-resources-effectfont +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Font +JsType: alphaTab.platform.model.Font +JsonType: string +DefaultValue: italic 12px Georgia +Description: The font to use for displaying certain effect related elements in the music sheet. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-fingeringfont.cshtml b/Documentation/input/reference/property/display-resources-fingeringfont.cshtml new file mode 100644 index 000000000..54cb7b685 --- /dev/null +++ b/Documentation/input/reference/property/display-resources-fingeringfont.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.FingeringFont +JsName: display.resources.fingeringFont;resources.fingeringFont +JsonName: display.resources.fingeringFont;resources.fingeringFont +DataAttribute: data-display-resources-fingeringfont;data-resources-fingeringfont +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Font +JsType: alphaTab.platform.model.Font +JsonType: string +DefaultValue: 14px Georgia +Description: The font to use for displaying finger information in the music sheet. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-fretboardnumberfont.cshtml b/Documentation/input/reference/property/display-resources-fretboardnumberfont.cshtml new file mode 100644 index 000000000..c8f2a4d4f --- /dev/null +++ b/Documentation/input/reference/property/display-resources-fretboardnumberfont.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.FretboardNumberFont +JsName: display.resources.fretboardNumberFont;resources.fretboardNumberFont +JsonName: display.resources.fretboardNumberFont;resources.fretboardNumberFont +DataAttribute: data-display-resources-fretboardnumberfont;data-resources-fretboardnumberfont +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Font +JsType: alphaTab.platform.model.Font +JsonType: string +DefaultValue: 11px Arial +Description: The font to use for displaying the fretboard numbers in chord diagrams. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-gracefont.cshtml b/Documentation/input/reference/property/display-resources-gracefont.cshtml new file mode 100644 index 000000000..ff416db94 --- /dev/null +++ b/Documentation/input/reference/property/display-resources-gracefont.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.GraceFont +JsName: display.resources.graceFont;resources.graceFont +JsonName: display.resources.graceFont;resources.graceFont +DataAttribute: data-display-resources-gracefont;data-resources-gracefont +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Font +JsType: alphaTab.platform.model.Font +JsonType: string +DefaultValue: 11px Arial +Description: The font to use for grace notation related texts in the music sheet. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-mainglyphcolor.cshtml b/Documentation/input/reference/property/display-resources-mainglyphcolor.cshtml new file mode 100644 index 000000000..a8c3b0a56 --- /dev/null +++ b/Documentation/input/reference/property/display-resources-mainglyphcolor.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.MainGlyphColor +JsName: display.resources.mainGlyphColor;resources.mainGlyphColor +JsonName: display.resources.mainGlyphColor;resources.mainGlyphColor +DataAttribute: data-display-resources-mainglyphcolor;data-resources-mainglyphcolor +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Color +JsType: alphaTab.platform.model.Color +JsonType: string;int +DefaultValue: rgb(0, 0, 0) +Description: The color to use for music notation elements of the primary voice. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-markerfont.cshtml b/Documentation/input/reference/property/display-resources-markerfont.cshtml new file mode 100644 index 000000000..d83dea968 --- /dev/null +++ b/Documentation/input/reference/property/display-resources-markerfont.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.MarkerFont +JsName: display.resources.markerFont;resources.markerFont +JsonName: display.resources.markerFont;resources.markerFont +DataAttribute: data-display-resources-markerfont;data-resources-markerfont +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Font +JsType: alphaTab.platform.model.Font +JsonType: string +DefaultValue: bold 14px Georgia +Description: The font to use for section marker labels shown above the music sheet. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-scoreinfocolor.cshtml b/Documentation/input/reference/property/display-resources-scoreinfocolor.cshtml new file mode 100644 index 000000000..ee509c513 --- /dev/null +++ b/Documentation/input/reference/property/display-resources-scoreinfocolor.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.ScoreInfoColor +JsName: display.resources.scoreInfoColor;resources.scoreInfoColor +JsonName: display.resources.scoreInfoColor;resources.scoreInfoColor +DataAttribute: data-display-resources-scoreinfocolor;data-resources-scoreinfocolor +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Color +JsType: alphaTab.platform.model.Color +JsonType: string;int +DefaultValue: rgb(0, 0, 0) +Description: The color to use for displaying the song information above the music sheets. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-secondaryglyphcolor.cshtml b/Documentation/input/reference/property/display-resources-secondaryglyphcolor.cshtml new file mode 100644 index 000000000..8fec97625 --- /dev/null +++ b/Documentation/input/reference/property/display-resources-secondaryglyphcolor.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.SecondaryGlyphColor +JsName: display.resources.secondaryGlyphColor;resources.secondaryGlyphColor +JsonName: display.resources.secondaryGlyphColor;resources.secondaryGlyphColor +DataAttribute: data-display-resources-secondaryglyphcolor;data-resources-secondaryglyphcolor +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Color +JsType: alphaTab.platform.model.Color +JsonType: string;int +DefaultValue: rgb(0,0,0,0.4) +Description: The color to use for music notation elements of the secondary voices. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-stafflinecolor.cshtml b/Documentation/input/reference/property/display-resources-stafflinecolor.cshtml new file mode 100644 index 000000000..6d83cd06b --- /dev/null +++ b/Documentation/input/reference/property/display-resources-stafflinecolor.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.StaffLineColor +JsName: display.resources.staffLineColor;resources.staffLineColor +JsonName: display.resources.staffLineColor;resources.staffLineColor +DataAttribute: data-display-resources-stafflinecolor;data-resources-stafflinecolor +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Color +JsType: alphaTab.platform.model.Color +JsonType: string;int +DefaultValue: rgb(165, 165, 165) +Description: The color to use for rendering the lines of staves. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-subtitlefont.cshtml b/Documentation/input/reference/property/display-resources-subtitlefont.cshtml new file mode 100644 index 000000000..9ac0b9db6 --- /dev/null +++ b/Documentation/input/reference/property/display-resources-subtitlefont.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.SubTitleFont +JsName: display.resources.subTitleFont;resources.subTitleFont +JsonName: display.resources.subTitleFont;resources.subTitleFont +DataAttribute: data-display-resources-subtitlefont;data-resources-subtitlefont +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Font +JsType: alphaTab.platform.model.Font +JsonType: string +DefaultValue: 20px Georgia +Description: The font to use for displaying the songs subtitle in the header of the music sheet. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-tablaturefont.cshtml b/Documentation/input/reference/property/display-resources-tablaturefont.cshtml new file mode 100644 index 000000000..ca36862a4 --- /dev/null +++ b/Documentation/input/reference/property/display-resources-tablaturefont.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.TablatureFont +JsName: display.resources.tablatureFont;resources.tablatureFont +JsonName: display.resources.tablatureFont;resources.tablatureFont +DataAttribute: data-display-resources-tablaturefont;data-resources-tablaturefont +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Font +JsType: alphaTab.platform.model.Font +JsonType: string +DefaultValue: 13px Arial +Description: The font to use for displaying the guitar tablature numbers in the music sheet. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-titlefont.cshtml b/Documentation/input/reference/property/display-resources-titlefont.cshtml new file mode 100644 index 000000000..cfa86258b --- /dev/null +++ b/Documentation/input/reference/property/display-resources-titlefont.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.TitleFont +JsName: display.resources.titleFont;resources.titleFont +JsonName: display.resources.titleFont;resources.titleFont +DataAttribute: data-display-resources-titlefont;data-resources-titlefont +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Font +JsType: alphaTab.platform.model.Font +JsonType: string +DefaultValue: 32px Georgia +Description: The font to use for displaying the songs title in the header of the music sheet. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources-wordsfont.cshtml b/Documentation/input/reference/property/display-resources-wordsfont.cshtml new file mode 100644 index 000000000..9735f677c --- /dev/null +++ b/Documentation/input/reference/property/display-resources-wordsfont.cshtml @@ -0,0 +1,16 @@ +Title: Display.Resources.WordsFont +JsName: display.resources.wordsFont;resources.wordsFont +JsonName: display.resources.wordsFont;resources.wordsFont +DataAttribute: data-display-resources-wordsfont;data-resources-wordsfont +Category: Display - Rendering Resources +Type: AlphaTab.Platform.Model.Font +JsType: alphaTab.platform.model.Font +JsonType: string +DefaultValue: 15px Arial +Description: The font to use for displaying the lyrics information in the header of the music sheet. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/display-resources +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/display-resources.cshtml b/Documentation/input/reference/property/display-resources.cshtml new file mode 100644 index 000000000..dffe97e4e --- /dev/null +++ b/Documentation/input/reference/property/display-resources.cshtml @@ -0,0 +1,189 @@ +Title: Display.Resources +JsName: display.resources;resources +JsonName: display.resources;resources +DataAttribute: data-display-resources-*, data-resources-* +Category: Display +Description: Allows adjusting of the used fonts and colors for rendering. +Since: 0.9.6 +ShowInSideBar: false +--- + +@functions { + IEnumerable GetDocumentsAtPath(string relativePath) + { + return Documents.Where(d => + string.Join("/", d.Get(Keys.TreePath) ?? new object[0]) + .StartsWith(relativePath) + ); + } +} + +

Description

+

+ AlphaTab allows configuring the colors and fonts used for rendering via the rendering resources settings. Please note that as of today + this is the primary way of changing the way how alphaTab styles elements. CSS styling in the browser cannot be guaranteed to work due to its flexibility. +

+ +

+Due to space reasons in the following table the common prefix of the settings are removed. Please refer to these examples to eliminate confusion on the usage: +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PlatformPrefixExample Usage
.net + Display.Resources. + settings.Display.Resources.WordsFonts = ...
JavaScript + display.resources. + + settings.display.resources.wordsFont = '...' +
JSON + display.resources.
+ resources. +
+ var settings = { display: { resources: { wordsFonts: '...'} }; or
+ var settings = { resources: { wordsFonts: '...'} }; +
HTML + data-display-resources-
+ data-resources-
+ <div data-resources-wordsfont="...">
+ <div data-wordsfont="..."> +
+ +

Resources

+Following resources exist for adjusting the style. + + + + + + + + + + + + @foreach(IDocument child in GetDocumentsAtPath("reference/property/display-resources-")) + { + var prefixes = new [] { + "display.resources.", "resources.", + "data-display-resources-", "data-resources-" + }; + Func simplifyNames = array => + { + for(var i = 0; i < array.Length; i++) + { + foreach(var prefix in prefixes) + { + if(array[i].StartsWith(prefix)) + { + array[i] = array[i].Substring(prefix.Length); + break; + } + } + } + return array.Distinct().ToArray(); + }; + + object[] childTreePath = child.Get(Keys.TreePath); + string[] jsTypes = child.String("JsType").Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries); + string[] jsonTypes = child.String("JsonType").Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries); + string dotNetName = simplifyNames(new[]{child.String("Title")})[0]; + string[] jsNames = simplifyNames(child.String("JsName").Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries)); + string[] jsonNames = simplifyNames(child.String("JsonName").Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries)); + string[] dataAttributeNames = simplifyNames(child.String("DataAttribute").Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries)); + + + + + + + + } + +
ResourceTypeDefaultSummary
+ + @dotNetName + .net + + @foreach(var name in jsNames) + { +
+ + @name JavaScript + + } + @foreach(var name in jsonNames) + { +
+ + @name JSON + + } + @foreach(var name in dataAttributeNames) + { +
+ + @name HTML + + } +
+ + @Html.Raw(child.String("Type")) + .net + + @foreach(var jsType in jsTypes) + { +
+ @(jsType) JavaScript + } + @foreach(var jsonType in jsonTypes) + { +
+ @(jsonType) JSON & HTML + } +
@Html.Raw(child.String("DefaultValue")) + @(child.String(DocsKeys.Description)) +
+ +

Types

+ +

Fonts

+

+For the .net platform any installed font on the system can be used. Simply construct the Font object to configure your desired fonts. +

+

+For the JavaScript platform any font that might be installed on the client machines can be used. Any additional fonts can be added via WebFonts. The rendering of the score will be delayed until it is detected that the font was loaded. Simply use any CSS font property compliant string as configuration. Relative font sizes with percentual values are not supported, remaining values will be considered if supported. +

+ + +

Colors

+

+On .net simply construct the Color object to configure your desired color. For JavaScript you can use any CSS font property compliant string. (#RGB, #RGBA, #RRGGBB, #RRGGBBAA, rgb(r,g,b), rgba(r,g,b,a) ) +

\ No newline at end of file diff --git a/Documentation/input/reference/property/scale.cshtml b/Documentation/input/reference/property/display-scale.cshtml similarity index 51% rename from Documentation/input/reference/property/scale.cshtml rename to Documentation/input/reference/property/display-scale.cshtml index 32db3bbda..13f6a5fc1 100644 --- a/Documentation/input/reference/property/scale.cshtml +++ b/Documentation/input/reference/property/display-scale.cshtml @@ -1,10 +1,11 @@ -Title: Scale -JsName: scale -DataAttribute: data-scale -Category: Core +Title: Display.Scale +JsName: display.scale;scale +JsonName: display.scale;scale +DataAttribute: data-display-scale, data-scale +Category: Display Description: Sets the zoom level of the rendered notation. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

Description

@@ -13,6 +14,8 @@ Since: 0.9.4 percental values.

+@Html.Partial("_PropertyDescription", Model) +

Types

@@ -24,7 +27,7 @@ Since: 0.9.4 - +
float allfloat all 1.0 - 100%
1.2 - 120%
@@ -35,35 +38,4 @@ Since: 0.9.4

Default Value

- -1.0 - -

Example - C#

- -
-
-var settings = Settings.Defaults;
-settings.Scale = 1.2f;
-
-
- - -

Example - JavaScript

- -
-
-var settings = {
-    scale: 1.2
-};
-var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
-var japi = $('#alphaTab').alphaTab(settings);
-
-
- -

Example - HTML

- -
-
-<div id="alphaTab" data-scale="1.2"></div>
-
-
+1.0 \ No newline at end of file diff --git a/Documentation/input/reference/property/display-startbar.cshtml b/Documentation/input/reference/property/display-startbar.cshtml new file mode 100644 index 000000000..1d8c7fd4c --- /dev/null +++ b/Documentation/input/reference/property/display-startbar.cshtml @@ -0,0 +1,39 @@ +Title: Display.StartBar +JsName: display.startBar;startBar +JsonName: display.startBar;startBar +DataAttribute: data-display-startbar, data-startbar +Category: Display +Description: The bar start index to start layouting with. +ShowInSideBar: false +Since: 0.9.6 +--- + +

Description

+

+ This setting sets the index of the first bar that should be rendered from the overall song. This setting can be used to + achieve a paging system or to only show partial bars of the same file. By this a tutorial alike display can be achieved + that explains various parts of the song. Please note that this is the bar number as shown in the music sheet (1-based) not the array index (0-based). + Demo +

+ +@Html.Partial("_PropertyDescription", Model) + +

Types

+ + + + + + + + + + + + + +
TypeValues
int all
+ +

Default Value

+ +1 \ No newline at end of file diff --git a/Documentation/input/reference/property/display-staveprofile.cshtml b/Documentation/input/reference/property/display-staveprofile.cshtml new file mode 100644 index 000000000..2673538e7 --- /dev/null +++ b/Documentation/input/reference/property/display-staveprofile.cshtml @@ -0,0 +1,63 @@ +Title: Display.StaveProfile +JsName: display.staveProfile;staveProfile +JsonName: display.staveProfile;staveProfile +DataAttribute: data-display-staveprofile, data-staveprofile +Category: Display +Description: The stave profile defining which staves are shown for the music sheet. +ShowInSideBar: false +Since: 0.9.6 +--- + +

Description

+

+ AlphaTab has various stave profiles that define which staves will be shown in for the rendered tracks. +

+ +@Html.Partial("_PropertyDescription", Model) + +

Types

+ + + + + + + + + + + + + + + + + + + + + + +
TypeValues
AlphaTab.StaveProfile .net + Default - The profile is auto detected by the track configurations.
+ ScoreTab - Standard music notation and guitar tablature are rendered.
+ Score - Only standard music notation is rendered.
+ Tab - Only guitar tablature is rendered.
+ TabMixed - Only guitar tablature is rendered, but also rests and time signatures are not shown. This profile is typically used in multi-track scenarios.
+
string JavaScript & HTML + default
+ scoretab
+ score
+ tab
+ tabmixed +
int JavaScript & HTML + 0 - Default
+ 1 - ScoreTab
+ 2 - Score
+ 3 - Tab
+ 4 - TabMixed +
+ +

Default Value

+ +Default diff --git a/Documentation/input/reference/property/stretchforce.cshtml b/Documentation/input/reference/property/display-stretchforce.cshtml similarity index 57% rename from Documentation/input/reference/property/stretchforce.cshtml rename to Documentation/input/reference/property/display-stretchforce.cshtml index cde39f977..5911a7786 100644 --- a/Documentation/input/reference/property/stretchforce.cshtml +++ b/Documentation/input/reference/property/display-stretchforce.cshtml @@ -1,10 +1,11 @@ -Title: StretchForce -JsName: stretchForce -DataAttribute: data-stretch-force -Category: Core -Description: The default stretch force to use for layouting. +Title: Display.StretchForce +JsName: display.stretchForce;stretchForce +JsonName: display.stretchForce;stretchForce +DataAttribute: data-display-stretchforce, data-stretchforce +Category: Display +Description: The default stretch force to use for layouting. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

Description

@@ -13,6 +14,7 @@ Since: 0.9.4 aligning elements. This setting controls the "strength" of the springs. The stronger the springs, the wider the spacing.

+@Html.Partial("_PropertyDescription", Model) @@ -29,6 +31,8 @@ Since: 0.9.4
+@Html.Partial("_PropertyDescription", Model) +

Types

@@ -40,9 +44,9 @@ Since: 0.9.4 - + @@ -51,35 +55,4 @@ Since: 0.9.4
float allfloat all - 1.0 + 1.0
1.5
0.5

Default Value

- -1.0 - -

Example - C#

- -
-
-var settings = Settings.Defaults;
-settings.StretchForce = 0.5f;
-
-
- - -

Example - JavaScript

- -
-
-var settings = {
-    stretch: 0.5
-};
-var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
-var japi = $('#alphaTab').alphaTab(settings);
-
-
- -

Example - HTML

- -
-
-<div id="alphaTab" data-stretch-force="0.5"></div>
-
-
+1.0 \ No newline at end of file diff --git a/Documentation/input/reference/property/enablecursor.cshtml b/Documentation/input/reference/property/enablecursor.cshtml deleted file mode 100644 index f872202ee..000000000 --- a/Documentation/input/reference/property/enablecursor.cshtml +++ /dev/null @@ -1,57 +0,0 @@ -Title: EnableCursor -JsName: cursor -DataAttribute: data-cursor -Category: Player -Description: Gets or sets whether playback cursors should be displayed. -ShowInSideBar: false -Since: 0.9.4 ---- - -

Description

-

- This setting configures whether the playback cursors are shown or not. In case a developer decides to built an own cursor system the default one can be disabled with this setting. -

- -

Types

- - - - - - - -
bool
- -

Default Value

- -true - -

Example - C#

- -
-
-var settings = Settings.Defaults;
-settings.EnableCursor = false;
-
-
- - -

Example - JavaScript

- -
-
-var settings = {
-    cursor: false
-};
-var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
-var japi = $('#alphaTab').alphaTab(settings);
-
-
- -

Example - HTML

- -
-
-<div id="alphaTab" data-cursor="false"></div>
-
-
diff --git a/Documentation/input/reference/property/enableplayer.cshtml b/Documentation/input/reference/property/enableplayer.cshtml deleted file mode 100644 index 2c3e49613..000000000 --- a/Documentation/input/reference/property/enableplayer.cshtml +++ /dev/null @@ -1,61 +0,0 @@ -Title: EnablePlayer -JsName: player -DataAttribute: data-player -Category: Player -Description: Gets or sets whether the player should be enabled. -ShowInSideBar: false -Since: 0.9.4 ---- - -

Description

-

- This setting configures whether the player feature is enabled or not. Depending on the platform enabling the player needs some additional actions of the developer. - For the JavaScript version the player property must be set to the URL of the sound font that should be used. - For .net manually the sound font must be loaded. -

- -

Types

- - - - - - - - - - -
bool .net
string JavaScript and HTML
- -

Default Value

- -true - -

Example - C#

- -
-
-var settings = Settings.Defaults;
-settings.EnablePlayer = true;
-
-
- -

Example - JavaScript

- -
-
-var settings = {
-    player: "/assets/soundfont.sf2"
-};
-var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
-var japi = $('#alphaTab').alphaTab(settings);
-
-
- -

Example - HTML

- -
-
-<div id="alphaTab" data-player="/assets/soundfont.sf2"></div>
-
-
\ No newline at end of file diff --git a/Documentation/input/reference/property/forcepianofingering.cshtml b/Documentation/input/reference/property/forcepianofingering.cshtml deleted file mode 100644 index 60410417e..000000000 --- a/Documentation/input/reference/property/forcepianofingering.cshtml +++ /dev/null @@ -1,58 +0,0 @@ -Title: ForcePianoFingering -JsName: forcePianoFingering -DataAttribute: data-force-piano-fingering -Category: Core -Description: Forces the fingering rendering to use always the piano finger style. -ShowInSideBar: false -Since: 0.9.4 ---- - -

Description

-

- The fingering information for piano is annotated as 1-5 for the individual fingers. For some other instruments like guitars it usually is rendered as p,i,m,a,c and T,1,2,3,4 depending on the hand. - This setting allows enforcing of the piano fingering for all instruments. -

- -

Types

- - - - - - - -
bool
- -

Default Value

- -false - -

Example - C#

- -
-
-var settings = Settings.Defaults; 
-settings.ForcePianoFingering = true;
-
-
- - -

Example - JavaScript

- -
-
-var settings = {
-    forcePianoFingering: 'true'
-};
-var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
-var japi = $('#alphaTab').alphaTab(settings);
-
-
- -

Example - HTML

- -
-
-<div id="alphaTab" data-force-piano-fingering="true"></div>
-
-
\ No newline at end of file diff --git a/Documentation/input/reference/property/importersettingsencoding.cshtml b/Documentation/input/reference/property/importer-encoding.cshtml similarity index 56% rename from Documentation/input/reference/property/importersettingsencoding.cshtml rename to Documentation/input/reference/property/importer-encoding.cshtml index ab22f60cf..dbccdf93e 100644 --- a/Documentation/input/reference/property/importersettingsencoding.cshtml +++ b/Documentation/input/reference/property/importer-encoding.cshtml @@ -1,9 +1,10 @@ -Title: Layout.ImporterSettings["encoding"] +Title: Importer.Encoding JsName: importer.encoding +JsonName: importer.encoding DataAttribute: data-importer-encoding Category: Importer Description: The text encoding to use when decoding strings. -Since: 0.9.4 +Since: 0.9.6 ShowInSideBar: false --- @@ -21,6 +22,8 @@ ShowInSideBar: false
  • MusicXML
  • +@Html.Partial("_PropertyDescription", Model) +

    Types

    @@ -32,7 +35,7 @@ ShowInSideBar: false - +
    string allstring all utf-8
    Windows-1252 @@ -43,36 +46,4 @@ ShowInSideBar: false

    Default Value

    -utf-8 - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults;
    -settings.ImporterSettings["encoding"] = "Windows-1252";
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    importerSettings: {
    -        encoding: "Windows-1252"
    -    }    
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-importer-encoding="Windows-1252"></div>
    -
    -
    +utf-8 \ No newline at end of file diff --git a/Documentation/input/reference/property/importer-mergepartgroupsinmusicxml.cshtml b/Documentation/input/reference/property/importer-mergepartgroupsinmusicxml.cshtml new file mode 100644 index 000000000..8078ce710 --- /dev/null +++ b/Documentation/input/reference/property/importer-mergepartgroupsinmusicxml.cshtml @@ -0,0 +1,29 @@ +Title: Importer.MergePartGroupsInMusicXml +JsName: importer.mergePartGroupsInMusicXml +JsonName: importer.mergePartGroupsInMusicXml +DataAttribute: data-importer-mergepartgroupsinmusicxml +Category: Importer +Description: If part-groups should be merged into a single track (MusicXML). +Since: 0.9.6 +ShowInSideBar: false +--- + +

    Description

    +

    + This setting controls whether multiple part-group tags will result into a single track with multiple staves. +

    + +@Html.Partial("_PropertyDescription", Model) + +

    Types

    + + + + + + + +
    bool
    + +

    Default Value

    +false diff --git a/Documentation/input/reference/property/importermusicxmlmergepartgroups.cshtml b/Documentation/input/reference/property/importermusicxmlmergepartgroups.cshtml deleted file mode 100644 index 8b80ebe57..000000000 --- a/Documentation/input/reference/property/importermusicxmlmergepartgroups.cshtml +++ /dev/null @@ -1,59 +0,0 @@ -Title: Layout.ImporterSettings["musicXMLMergePartGroups"] -JsName: importer.musicXMLMergePartGroups -DataAttribute: data-importer-musicxml-merge-part-groups -Category: Importer -Description: If part-groups should be merged into a single track (MusicXML). -Since: 0.9.4 -ShowInSideBar: false ---- - -

    Description

    -

    - This setting controls whether multiple part-group tags will result into a single track with multiple staves. -

    - -

    Types

    - - - - - - - -
    bool
    - -

    Default Value

    - -false - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults;
    -settings.ImporterSettings["musicXMLMergePartGroups"] = true;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    importerSettings: {
    -        musicXMLMergePartGroups: true
    -    }    
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-musicxml-merge-part-groups="true"></div>
    -
    -
    diff --git a/Documentation/input/reference/property/importersettings.cshtml b/Documentation/input/reference/property/importersettings.cshtml deleted file mode 100644 index 4f21fa92b..000000000 --- a/Documentation/input/reference/property/importersettings.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: ImporterSettings -JsName: importer.* -DataAttribute: data-importer-* -Category: Importer -Description: Specific settings for importers. Keys are specific for the importers -Since: 0.9.4 -ShowInSideBar: false ---- - -

    Description

    -

    - The importer settings control the behavior while reading the input files. The settings are specific to the importers. -

    \ No newline at end of file diff --git a/Documentation/input/reference/property/index.cshtml b/Documentation/input/reference/property/index.cshtml index 63e2580b6..6bddeb2d2 100644 --- a/Documentation/input/reference/property/index.cshtml +++ b/Documentation/input/reference/property/index.cshtml @@ -5,6 +5,37 @@ Order: 1

    @Html.Raw(Model.String(DocsKeys.Description))

    +

    + There are multiple ways how settings in alphaTab can be specified. For .net simply the normal classes are used and + changes are signaled via `UpdateSettings` call. For JavaScript the interaction with the settings is a bit more sensitive + due to the lack of type safety and the support of JSON based settings. + +
    + Not all settings contain reasonable examples as they often just activate something within alphaTab + or change the display of some notation. If you have questions on certain settings feel free to open a + issue on GitHub. + +
    + The first and most important rule is: when interacting with the settings object directly, the correct structure and data types + must be followed not to break alphaTab or make the changes useless. In order to simplify things when configuring alphaTab via JavaScript + there are 2 additional features: + +

    + +

    + 1. AlphaTab can be configured via a simple plain JSON object
    + This JSON format supports some aliases and also some value conversions like for enums, fonts and colors. + This JSON schema can only be used at selected places. When attempting to set JSON values on the derives alphaTab.Settings object, + this can lead to unexpected side effects. The JSON schema can be used when initializing alphaTab or by calling settings.fillFromJson({ .. }. +

    + +

    + 2. AlphaTab can be configured via HTML data attributes
    + All settings can also be added as data attributes on the element for which alphaTab is initialized. This is especially useful + when multiple different instances of alphaTab are running on the same site but the main code to setup alphaTab should be shared. + Individual settings can be specified on HTML elements. +

    + The following table contains all the properties as they can be set on the general settings object. @@ -19,6 +50,7 @@ The following table contains all the properties as they can be set on the genera @{ IEnumerable propertyPages = Model.DocumentList(Keys.Children); IList> propertyPagesGroups = propertyPages + .Where(x => x.Bool("ShowInTable", true)) .GroupBy(x => x.String(DocsKeys.Category)) .OrderBy(x => x.Key) .ToList(); @@ -46,24 +78,42 @@ The following table contains all the properties as they can be set on the genera { url = Context.GetLink(child); } - + string dotNetName = child.String("Title"); + string[] jsNames = child.String("JsName", "").Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries); + string[] jsonNames = child.String("JsonName", "").Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries); + string[] dataAttributeNames = child.String("DataAttribute", "").Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries); + + diff --git a/Documentation/input/reference/property/layoutadditionalsettings.cshtml b/Documentation/input/reference/property/layoutadditionalsettings.cshtml deleted file mode 100644 index d8826af67..000000000 --- a/Documentation/input/reference/property/layoutadditionalsettings.cshtml +++ /dev/null @@ -1,14 +0,0 @@ -Title: Layout.AdditionalSettings -JsName: layout.mode.additionalSettings -DataAttribute: data-layout-* -Category: Layout -Description: Additional layout mode specific settings. -Since: 0.9.4 -ShowInSideBar: false ---- - - -

    Description

    -

    - The layout settings allow configuring how the internal layout engine should behave. -

    \ No newline at end of file diff --git a/Documentation/input/reference/property/layoutadditionalsettingsbarsperrow.cshtml b/Documentation/input/reference/property/layoutadditionalsettingsbarsperrow.cshtml deleted file mode 100644 index 4c1dd405b..000000000 --- a/Documentation/input/reference/property/layoutadditionalsettingsbarsperrow.cshtml +++ /dev/null @@ -1,72 +0,0 @@ -Title: Layout.AdditionalSettings["barsPerRow"] -JsName: layout.mode.additionalSettings.barsPerRow -DataAttribute: data-layout-bars-per-row -Category: Layout -Description: Limit the displayed bars per row. -Since: 0.9.4 -ShowInSideBar: false ---- - -

    Description

    -

    - This setting sets the number of bars that should be put into one row. - Demo -

    - -

    Types

    - -
    - - @Html.Raw(child.WithoutSettings.String(Keys.Title, childTreePath.Last().ToString())) - .net - -
    - - @Html.Raw(child.String("JsName")) - JSON - -
    - - @Html.Raw(child.String("DataAttribute")) - HTML + + @dotNetName + .net + @if(jsNames.Length > 0) {
    } + @foreach(var name in jsNames) + { + + @name JavaScript + + } + + @if(jsonNames.Length > 0) {
    } + @foreach(var name in jsonNames) + { + + @name JSON + + } + + @if(dataAttributeNames.Length > 0) {
    } + @foreach(var name in dataAttributeNames) + { + + @name HTML + + }
    @(child.String(DocsKeys.Description))
    - - - - - - - - - - - - -
    TypeValues
    int all - -1/code> - Automatic
    - 5 -
    - -

    Default Value

    - --5 - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults;
    -settings.Layout.AdditionalSettings["barsPerRow"] = 5;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    layout: {
    -        additionalSettings: {
    -            barsPerRow: 5
    -        }
    -    }    
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-layout-bars-per-row="5"></div>
    -
    -
    diff --git a/Documentation/input/reference/property/layoutadditionalsettingscount.cshtml b/Documentation/input/reference/property/layoutadditionalsettingscount.cshtml deleted file mode 100644 index 02667bf13..000000000 --- a/Documentation/input/reference/property/layoutadditionalsettingscount.cshtml +++ /dev/null @@ -1,72 +0,0 @@ -Title: Layout.AdditionalSettings["count"] -JsName: layout.mode.additionalSettings.count -DataAttribute: data-layout-count -Category: Layout -Description: The amount of bars to render overall. -Since: 0.9.4 -ShowInSideBar: false ---- - -

    Description

    -

    - This setting sets the number of bars that should be rendered from the overall song. - Demo -

    - -

    Types

    - - - - - - - - - - - - - - -
    TypeValues
    int all - -1/code> - Automatic
    - 5 -
    - -

    Default Value

    - --1 - All bars from start - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults;
    -settings.Layout.AdditionalSettings["count"] = 5;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    layout: {
    -        additionalSettings: {
    -            count: 5
    -        }
    -    }    
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-layout-count="5"></div>
    -
    -
    diff --git a/Documentation/input/reference/property/layoutadditionalsettingshdietracknames.cshtml b/Documentation/input/reference/property/layoutadditionalsettingshdietracknames.cshtml deleted file mode 100644 index 2ad95b964..000000000 --- a/Documentation/input/reference/property/layoutadditionalsettingshdietracknames.cshtml +++ /dev/null @@ -1,61 +0,0 @@ -Title: Layout.AdditionalSettings["hideTrackNames"] -JsName: layout.mode.additionalSettings.hideTrackNames -DataAttribute: data-layout-hide-track-names -Category: Layout -Description: Render the track names or not. -Since: 0.9.4 -ShowInSideBar: false ---- - -

    Description

    -

    - This setting controls whether the track names are shown at the beginning of the staff or not. -

    - -

    Types

    - - - - - - - -
    bool
    - -

    Default Value

    - -false - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults;
    -settings.Layout.AdditionalSettings["hideTrackNames"] = true;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    layout: {
    -        additionalSettings: {
    -            hideTrackNames: true
    -        }
    -    }    
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-layout-hide-track-names="true"></div>
    -
    -
    diff --git a/Documentation/input/reference/property/layoutadditionalsettingshideinfo.cshtml b/Documentation/input/reference/property/layoutadditionalsettingshideinfo.cshtml deleted file mode 100644 index cabfdf8eb..000000000 --- a/Documentation/input/reference/property/layoutadditionalsettingshideinfo.cshtml +++ /dev/null @@ -1,61 +0,0 @@ -Title: Layout.AdditionalSettings["hideInfo"] -JsName: layout.mode.additionalSettings.hideInfo -DataAttribute: data-layout-hide-info -Category: Layout -Description: Render the song information or not. -Since: 0.9.4 -ShowInSideBar: false ---- - -

    Description

    -

    - This setting controls whether the the general song information is shown above the staves as page header or not. -

    - -

    Types

    - - - - - - - -
    bool
    - -

    Default Value

    - -false - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults;
    -settings.Layout.AdditionalSettings["hideInfo"] = true;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    layout: {
    -        additionalSettings: {
    -            hideInfo: true
    -        }
    -    }    
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-layout-hide-info="true"></div>
    -
    -
    diff --git a/Documentation/input/reference/property/layoutadditionalsettingshidetuning.cshtml b/Documentation/input/reference/property/layoutadditionalsettingshidetuning.cshtml deleted file mode 100644 index 15ab27dec..000000000 --- a/Documentation/input/reference/property/layoutadditionalsettingshidetuning.cshtml +++ /dev/null @@ -1,61 +0,0 @@ -Title: Layout.AdditionalSettings["hideTuning"] -JsName: layout.mode.additionalSettings.hideTuning -DataAttribute: data-layout-hide-tuning -Category: Layout -Description: Render the tuning information or not. -Since: 0.9.4 -ShowInSideBar: false ---- - -

    Description

    -

    - This setting controls whether the the song tuning is shown above the staves or not. -

    - -

    Types

    - - - - - - - -
    bool
    - -

    Default Value

    - -false - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults;
    -settings.Layout.AdditionalSettings["hideTuning"] = true;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    layout: {
    -        additionalSettings: {
    -            hideTuning: true
    -        }
    -    }    
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-layout-hide-tuning="true"></div>
    -
    -
    diff --git a/Documentation/input/reference/property/layoutadditionalsettingsstart.cshtml b/Documentation/input/reference/property/layoutadditionalsettingsstart.cshtml deleted file mode 100644 index eef84aa14..000000000 --- a/Documentation/input/reference/property/layoutadditionalsettingsstart.cshtml +++ /dev/null @@ -1,73 +0,0 @@ -Title: Layout.AdditionalSettings["start"] -JsName: layout.mode.additionalSettings.start -DataAttribute: data-layout-start -Category: Layout -Description: The bar start index to start layouting with. -Since: 0.9.4 -ShowInSideBar: false ---- - -

    Description

    -

    - This setting sets the bar number from which to start rendering the song. This allows limiting the section of the song that is shown. - Demo. Please note that this is - the bar number as shown in the music sheet (1-based) not the array index (0-based). -

    - -

    Types

    - - - - - - - - - - - - - - -
    TypeValues
    int all - 1 - Automatic
    - 5 -
    - -

    Default Value

    - -1 - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults;
    -settings.Layout.AdditionalSettings["start"] = 5;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    layout: {
    -        additionalSettings: {
    -            start: 5
    -        }
    -    }    
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-layout-start="5"></div>
    -
    -
    \ No newline at end of file diff --git a/Documentation/input/reference/property/layoutmode.cshtml b/Documentation/input/reference/property/layoutmode.cshtml deleted file mode 100644 index db0fc26bd..000000000 --- a/Documentation/input/reference/property/layoutmode.cshtml +++ /dev/null @@ -1,71 +0,0 @@ -Title: Layout.Mode -JsName: layout.mode -DataAttribute: data-layout -Category: Layout -Description: The layouting mode used to arrange the the notation. -Since: 0.9.4 -ShowInSideBar: false ---- - -

    Description

    -

    - AlphaTab has various layout engines that arrange the rendered bars differently. This setting controls which layout mode is used. -

    - -

    Types

    - - - - - - - - - - - - - - -
    TypeValues
    string all - page - The bars are aligned in a page-style fashion
    - horizontal - The bars are aligned in a left-to-right fashion. -
    - -

    Default Value

    - -page - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults; 
    -settings.Layout.Mode = "horizontal";
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    layout: {
    -        mode: 'horizontal'
    -    }
    -    // or shorthand if no additional settings are needed: 
    -    layout: 'horizontal'
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-layout="horizontal"></div>
    -
    -
    \ No newline at end of file diff --git a/Documentation/input/reference/property/displaytranspositionpitches.cshtml b/Documentation/input/reference/property/notation-displaytranspositionpitches.cshtml similarity index 57% rename from Documentation/input/reference/property/displaytranspositionpitches.cshtml rename to Documentation/input/reference/property/notation-displaytranspositionpitches.cshtml index 403f6b6b5..5f2d7b5fb 100644 --- a/Documentation/input/reference/property/displaytranspositionpitches.cshtml +++ b/Documentation/input/reference/property/notation-displaytranspositionpitches.cshtml @@ -1,10 +1,11 @@ -Title: DisplayTranspositionPitches -JsName: displayTranspositionPitches -DataAttribute: data-display-transposition-pitches -Category: Core +Title: Notation.DisplayTranspositionPitches +JsName: notation.displayTranspositionPitches +JsonName: notation.displayTranspositionPitches +DataAttribute: data-notation-displaytranspositionpitches +Category: Notation Description: The transposition pitch offsets for the individual tracks used for rendering only. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

    Description

    @@ -19,6 +20,8 @@ Since: 0.9.4 The transposition is defined as number of semitones and one value per track of the song can be defined.

    +@Html.Partial("_PropertyDescription", Model) +

    Types

    @@ -29,45 +32,14 @@ Since: 0.9.4 - + - +
    int[] .netint[] .net
    Array JavaScriptArray JavaScript

    Default Value

    -(empty) - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults;
    -settings.DisplayTranspositionPitches = new int[] { 12, -12, 6, -6 };
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    displayTranspositionPitches: [ 12, -12, 6, -6 ]
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-display-transposition-pitches="[ 12, -12, 6, -6 ]"></div>
    -
    -
    - +(empty) \ No newline at end of file diff --git a/Documentation/input/reference/property/extendbendarrowsontiednotes.cshtml b/Documentation/input/reference/property/notation-extendbendarrowsontiednotes.cshtml similarity index 56% rename from Documentation/input/reference/property/extendbendarrowsontiednotes.cshtml rename to Documentation/input/reference/property/notation-extendbendarrowsontiednotes.cshtml index 617c95c61..5ce32aff6 100644 --- a/Documentation/input/reference/property/extendbendarrowsontiednotes.cshtml +++ b/Documentation/input/reference/property/notation-extendbendarrowsontiednotes.cshtml @@ -1,10 +1,11 @@ -Title: ExtendBendArrowsOnTiedNotes -JsName: extendBendArrowsOnTiedNotes -DataAttribute: data-extend-bend-arrows-on-tied-notes -Category: Core +Title: Notation.ExtendBendArrowsOnTiedNotes +JsName: notation.extendBendArrowsOnTiedNotes +JsonName: notation.extendBendArrowsOnTiedNotes +DataAttribute: data-notation-extendbendarrowsontiednotes +Category: Notation Description: If set to true bend arrows expand to the end of the last tied note of the string. Otherwise they end on the next beat. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

    Description

    @@ -13,6 +14,8 @@ Since: 0.9.4 There the bend only is drawn to the next beat.

    +@Html.Partial("_PropertyDescription", Model) + @@ -33,41 +36,11 @@ Since: 0.9.4
    - +
    boolbool

    Default Value

    -true - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults; 
    -settings.ExtendBendArrowsOnTiedNotes = true;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    extendBendArrowsOnTiedNotes: 'true'
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-extend-bend-arrows-on-tied-notes="true"></div>
    -
    -
    \ No newline at end of file +true \ No newline at end of file diff --git a/Documentation/input/reference/property/extendlineeffectstobeatend.cshtml b/Documentation/input/reference/property/notation-extendlineeffectstobeatend.cshtml similarity index 55% rename from Documentation/input/reference/property/extendlineeffectstobeatend.cshtml rename to Documentation/input/reference/property/notation-extendlineeffectstobeatend.cshtml index e5378917c..413877ca3 100644 --- a/Documentation/input/reference/property/extendlineeffectstobeatend.cshtml +++ b/Documentation/input/reference/property/notation-extendlineeffectstobeatend.cshtml @@ -1,10 +1,11 @@ -Title: ExtendLineEffectsToBeatEnd -JsName: extendLineEffectsToBeatEnd -DataAttribute: data-extend-line-effects-to-beat-end -Category: Core +Title: Notation.ExtendLineEffectsToBeatEnd +JsName: notation.extendLineEffectsToBeatEnd +JsonName: notation.extendLineEffectsToBeatEnd +DataAttribute: data-notation-extendlineeffectstobeatend +Category: Notation Description: If set to true, line effects like w/bar and let-ring are drawn until the end of the beat instead of the start ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 --- @@ -14,6 +15,8 @@ Since: 0.9.4 these effects are drawn to the end of this beat.

    +@Html.Partial("_PropertyDescription", Model) + @@ -34,41 +37,10 @@ Since: 0.9.4
    - +
    boolbool

    Default Value

    - -false - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults; 
    -settings.ExtendLineEffectsToBeatEnd = true;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    extendLineEffectsToBeatEnd: 'true'
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-extend-line-effects-to-beat-end="true"></div>
    -
    -
    \ No newline at end of file +false \ No newline at end of file diff --git a/Documentation/input/reference/property/fingeringmode.cshtml b/Documentation/input/reference/property/notation-fingeringmode.cshtml similarity index 62% rename from Documentation/input/reference/property/fingeringmode.cshtml rename to Documentation/input/reference/property/notation-fingeringmode.cshtml index 18fae00c4..673e60e77 100644 --- a/Documentation/input/reference/property/fingeringmode.cshtml +++ b/Documentation/input/reference/property/notation-fingeringmode.cshtml @@ -1,10 +1,11 @@ -Title: FingeringMode -JsName: fingeringMode -DataAttribute: data-fingering-mode -Category: Core +Title: Notation.FingeringMode +JsName: notation.fingeringMode +JsonName: notation.fingeringMode +DataAttribute: data-notation-fingeringmode +Category: Notation Description: Gets or sets the fingering mode to use. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

    Description

    @@ -13,6 +14,8 @@ AlphaTab supports multiple modes on how to display fingering information in the directly in the score along the notes. For some use cases of training courses and for beginners this notation might be hard to read. The effect band mode allows to show a single finger information above the staff.

    +@Html.Partial("_PropertyDescription", Model) + @@ -40,21 +43,21 @@ directly in the score along the notes. For some use cases of training courses an - + - + - +
    AlphaTab.FingeringMode .netAlphaTab.FingeringMode .net Score
    SingleNoteEffectBand
    string JavaScript & HTMLstring JavaScript & HTML score
    effectband
    int JavaScript & HTMLint JavaScript & HTML 0 - Score
    1 - SingleNoteEffectBand @@ -65,35 +68,4 @@ directly in the score along the notes. For some use cases of training courses an

    Default Value

    -GuitarPro - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults; 
    -settings.FingeringMode = FingeringMode.SingleNoteEffectBand;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    fingeringMode: 'effectband'
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-fingering-mode="effectband"></div>
    -
    -
    - +GuitarPro \ No newline at end of file diff --git a/Documentation/input/reference/property/notation-hidechorddiagrams.cshtml b/Documentation/input/reference/property/notation-hidechorddiagrams.cshtml new file mode 100644 index 000000000..aa61ee822 --- /dev/null +++ b/Documentation/input/reference/property/notation-hidechorddiagrams.cshtml @@ -0,0 +1,30 @@ +Title: Notation.HideChordDiagrams +JsName: notation.hideChordDiagrams +JsonName: notation.hideChordDiagrams +DataAttribute: data-notation-hidechorddiagrams +Category: Notation +Description: Show or hide the chord diagrams. +Since: 0.9.6 +ShowInSideBar: false +--- + +

    Description

    +

    + This setting controls whether the the chord diagrams is shown above the staves as page header or not. +

    + +@Html.Partial("_PropertyDescription", Model) + +

    Types

    + + + + + + + +
    bool
    + +

    Default Value

    + +false \ No newline at end of file diff --git a/Documentation/input/reference/property/notation-hideinfo.cshtml b/Documentation/input/reference/property/notation-hideinfo.cshtml new file mode 100644 index 000000000..c4a6d92c5 --- /dev/null +++ b/Documentation/input/reference/property/notation-hideinfo.cshtml @@ -0,0 +1,30 @@ +Title: Notation.HideInfo +JsName: notation.hideInfo +JsonName: notation.hideInfo +DataAttribute: data-notation-hideinfo +Category: Notation +Description: Render the song information or not. +Since: 0.9.6 +ShowInSideBar: false +--- + +

    Description

    +

    + This setting controls whether the the general song information is shown above the staves as page header or not. +

    + +@Html.Partial("_PropertyDescription", Model) + +

    Types

    + + + + + + + +
    bool
    + +

    Default Value

    + +false \ No newline at end of file diff --git a/Documentation/input/reference/property/notation-hidetracknames.cshtml b/Documentation/input/reference/property/notation-hidetracknames.cshtml new file mode 100644 index 000000000..ea733d991 --- /dev/null +++ b/Documentation/input/reference/property/notation-hidetracknames.cshtml @@ -0,0 +1,30 @@ +Title: Notation.HideTrackNames +JsName: notation.hideTrackNames +JsonName: notation.hideTrackNames +DataAttribute: data-notation-hidetracknames +Category: Notation +Description: Render the track names or not. +Since: 0.9.6 +ShowInSideBar: false +--- + +

    Description

    +

    + This setting controls whether the track names are shown at the beginning of the staff or not. +

    + +@Html.Partial("_PropertyDescription", Model) + +

    Types

    + + + + + + + +
    bool
    + +

    Default Value

    + +false \ No newline at end of file diff --git a/Documentation/input/reference/property/notation-hidetuning.cshtml b/Documentation/input/reference/property/notation-hidetuning.cshtml new file mode 100644 index 000000000..f78e054b6 --- /dev/null +++ b/Documentation/input/reference/property/notation-hidetuning.cshtml @@ -0,0 +1,31 @@ +Title: Notation.HideTuning +JsName: notation.hideTuning +JsonName: notation.hideTuning +DataAttribute: data-notation-hidetuning +Category: Notation +Description: Render the tuning information or not. +Since: 0.9.6 +ShowInSideBar: false +--- + +

    Description

    +

    + This setting controls whether the the song tuning is shown above the staves or not. +

    + +@Html.Partial("_PropertyDescription", Model) + + +

    Types

    + + + + + + + +
    bool
    + +

    Default Value

    + +false \ No newline at end of file diff --git a/Documentation/input/reference/property/displaymode.cshtml b/Documentation/input/reference/property/notation-notationmode.cshtml similarity index 71% rename from Documentation/input/reference/property/displaymode.cshtml rename to Documentation/input/reference/property/notation-notationmode.cshtml index 6eae1da6a..6557351b6 100644 --- a/Documentation/input/reference/property/displaymode.cshtml +++ b/Documentation/input/reference/property/notation-notationmode.cshtml @@ -1,10 +1,11 @@ -Title: DisplayMode -JsName: displayMode -DataAttribute: data-display-mode -Category: Core +Title: Notation.NotationMode +JsName: notation.notationMode +JsonName: notation.notationMode +DataAttribute: data-notation-notationmode +Category: Notation Description: Gets or sets the mode to use for display and play music notation elements. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

    Description

    @@ -62,6 +63,8 @@ The main differences in the Songbook display mode are: +@Html.Partial("_PropertyDescription", Model) +

    Types

    @@ -73,21 +76,21 @@ The main differences in the Songbook display mode are: - + - + - +
    AlphaTab.DisplayMode .netAlphaTab.DisplayMode .net SongBook
    GuitarPro
    string JavaScript & HTMLstring JSON & HTML SongBook
    GuitarPro
    int JavaScript & HTMLint JavaScript & HTML 0 (SongBook)
    1 (GuitarPro) @@ -98,37 +101,4 @@ The main differences in the Songbook display mode are:

    Default Value

    -GuitarPro - -

    Example - C#

    - -
    -
    -var guitarPro = Settings.Defaults; // defaults with Guitar Pro 
    -var songBook = Settings.SongBook;  // SongBook display mode + specific settings
    -var displayModeOnly = Settings.Defaults; 
    -displayModeOnly.DisplayMode = DisplayMode.SongBook; // will not apply songbook specific settings
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    displayMode: 'songbook'
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-display-mode="songbook"></div>
    -
    -
    - +GuitarPro \ No newline at end of file diff --git a/Documentation/input/reference/property/notation-rhythmheight.cshtml b/Documentation/input/reference/property/notation-rhythmheight.cshtml new file mode 100644 index 000000000..4358b38e8 --- /dev/null +++ b/Documentation/input/reference/property/notation-rhythmheight.cshtml @@ -0,0 +1,30 @@ +Title: Notation.RhythmHeight +JsName: notation.RhythmHeight +JsonName: notation.RhythmHeight +DataAttribute: data-notation-rhythmheight +Category: Notation +Description: Controls how high the ryhthm notation is rendered below the tab staff +ShowInSideBar: false +Since: 0.9.6 +--- + +

    Description

    +

    + This setting can be used in combination with the RhythmMode setting to control how high the rhythm notation should be rendered below the tab staff. Demo +

    + +@Html.Partial("_PropertyDescription", Model) + +

    Types

    + + + + + + + +
    bool
    + +

    Default Value

    + +15 \ No newline at end of file diff --git a/Documentation/input/reference/property/notation-rhythmmode.cshtml b/Documentation/input/reference/property/notation-rhythmmode.cshtml new file mode 100644 index 000000000..5dc0b519a --- /dev/null +++ b/Documentation/input/reference/property/notation-rhythmmode.cshtml @@ -0,0 +1,58 @@ +Title: Notation.RhythmMode +JsName: notation.rhythmMode +JsonName: notation.rhythmMode +DataAttribute: data-notation-rhythmmode +Category: Notation +Description: Controls how the rhythm notation is rendered for tab staves. +ShowInSideBar: false +Since: 0.9.6 +--- + +

    Description

    +

    + This setting enables the display of rhythm notation on tab staffs. Demo +

    + +@Html.Partial("_PropertyDescription", Model) + +

    Types

    + + + + + + + + + + + + + + + + + + + + + + +
    TypeValues
    AlphaTab.TabRhythmMode .net + Hidden - No rhythm notation is shown
    + ShowWithBeams - Rhythm notation is rendered with all beats having individual beams
    + ShowWithBars - Rhythm notation is rendered with normal bars like on standard notation
    +
    string JSON & HTML + hidden
    + showwithbeams
    + showwithbars +
    int JavaScript & HTML + 0 - Hidden
    + 1 - ShowWithBeams
    + 2 - ShowWithBars +
    + + +

    Default Value

    + +hidden diff --git a/Documentation/input/reference/property/showparenthesisfortiedbends.cshtml b/Documentation/input/reference/property/notation-showparenthesisfortiedbends.cshtml similarity index 52% rename from Documentation/input/reference/property/showparenthesisfortiedbends.cshtml rename to Documentation/input/reference/property/notation-showparenthesisfortiedbends.cshtml index bc8193db0..e1cb05816 100644 --- a/Documentation/input/reference/property/showparenthesisfortiedbends.cshtml +++ b/Documentation/input/reference/property/notation-showparenthesisfortiedbends.cshtml @@ -1,10 +1,11 @@ -Title: ShowParenthesisForTiedBends -JsName: showParenthesisForTiedBends -DataAttribute: data-show-parenthesis-for-tied-bends -Category: Core +Title: Notation.ShowParenthesisForTiedBends +JsName: notation.showParenthesisForTiedBends +JsonName: notation.showParenthesisForTiedBends +DataAttribute: data-notation-showparenthesisfortiedbends +Category: Notation Description: If set to true the note heads on tied notes will have parenthesis if they are preceeded by bends. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

    Description

    @@ -12,6 +13,8 @@ Since: 0.9.4 By default, tied notes after bends have parenthesis around the note head. This setting can be used to hide them.

    +@Html.Partial("_PropertyDescription", Model) + @@ -32,41 +35,11 @@ Since: 0.9.4
    - +
    boolbool

    Default Value

    -true - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults; 
    -settings.ShowParenthesisForTiedBends = true;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    showParenthesisForTiedBends: 'true'
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-show-parenthesis-for-tied-bends="true"></div>
    -
    -
    \ No newline at end of file +true \ No newline at end of file diff --git a/Documentation/input/reference/property/showtabnoteontiedbend.cshtml b/Documentation/input/reference/property/notation-showtabnoteontiedbend.cshtml similarity index 55% rename from Documentation/input/reference/property/showtabnoteontiedbend.cshtml rename to Documentation/input/reference/property/notation-showtabnoteontiedbend.cshtml index 996594ed4..b3f2b0e8a 100644 --- a/Documentation/input/reference/property/showtabnoteontiedbend.cshtml +++ b/Documentation/input/reference/property/notation-showtabnoteontiedbend.cshtml @@ -1,10 +1,11 @@ -Title: ShowTabNoteOnTiedBend -JsName: showTabNoteOnTiedBend -DataAttribute: data-show-tab-note-on-tied-bend -Category: Core +Title: Notation.ShowTabNoteOnTiedBend +JsName: notation.showTabNoteOnTiedBend +JsonName: notation.showTabNoteOnTiedBend +DataAttribute: data-notation-showtabnoteontiedbend +Category: Notation Description: If set to true a tab number will be shown in case a bend is increased on a tied note. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

    Description

    @@ -12,6 +13,8 @@ Since: 0.9.4 By default tab notes are hidden in case they are tied notes. In case they have a bend on it, they are shown again with parenthesis. To also hide tied tab notes in case they have bends, this setting can be set to false.

    +@Html.Partial("_PropertyDescription", Model) + @@ -32,41 +35,11 @@ Since: 0.9.4
    - +
    boolbool

    Default Value

    -true - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults; 
    -settings.ShowTabNoteOnTiedBend = true;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    showTabNoteOnTiedBend: 'true'
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-show-tab-note-on-tied-bend="true"></div>
    -
    -
    \ No newline at end of file +true \ No newline at end of file diff --git a/Documentation/input/reference/property/showzeroondivewhammy.cshtml b/Documentation/input/reference/property/notation-showzeroondivewhammy.cshtml similarity index 52% rename from Documentation/input/reference/property/showzeroondivewhammy.cshtml rename to Documentation/input/reference/property/notation-showzeroondivewhammy.cshtml index 2ff733f81..a0c50e07a 100644 --- a/Documentation/input/reference/property/showzeroondivewhammy.cshtml +++ b/Documentation/input/reference/property/notation-showzeroondivewhammy.cshtml @@ -1,10 +1,11 @@ -Title: ShowZeroOnDiveWhammy -JsName: showZeroOnDiveWhammy -DataAttribute: data-show-zero-on-dive-whammy -Category: Core +Title: Notation.ShowZeroOnDiveWhammy +JsName: notation.showZeroOnDiveWhammy +JsonName: notation.showZeroOnDiveWhammy +DataAttribute: data-notation-showzeroondivewhammy +Category: Notation Description: If set to true, 0 is shown on dive whammy bars. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

    Description

    @@ -12,6 +13,8 @@ Since: 0.9.4 By default there are no 0 values shown on dive whammy bar effects. If this setting is set to true, they are shown.

    +@Html.Partial("_PropertyDescription", Model) + @@ -32,41 +35,11 @@ Since: 0.9.4
    - +
    boolbool

    Default Value

    -false - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults; 
    -settings.ShowZeroOnDiveWhammy = true;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    showZeroOnDiveWhammy: 'true'
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-show-zero-on-dive-whammy="true"></div>
    -
    -
    \ No newline at end of file +false \ No newline at end of file diff --git a/Documentation/input/reference/property/slurheight.cshtml b/Documentation/input/reference/property/notation-slurheight.cshtml similarity index 65% rename from Documentation/input/reference/property/slurheight.cshtml rename to Documentation/input/reference/property/notation-slurheight.cshtml index 8dce89979..6ef5cc2f4 100644 --- a/Documentation/input/reference/property/slurheight.cshtml +++ b/Documentation/input/reference/property/notation-slurheight.cshtml @@ -1,10 +1,11 @@ -Title: SlurHeight -JsName: slurHeight -DataAttribute: data-slur-height -Category: Core +Title: Notation.SlurHeight +JsName: notation.slurHeight +JsonName: notation.slurHeight +DataAttribute: data-notation.slurheight +Category: Notation Description: The height scale factor for slurs ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

    Description

    @@ -14,6 +15,8 @@ Since: 0.9.4 only has a simplified version of the slur positioning as of today. This setting allows adjusting the slur height to avoid collisions. The factor defined by this setting, is multiplied with the logarithmic sitance between start and end.

    +@Html.Partial("_PropertyDescription", Model) + @@ -40,7 +43,7 @@ Since: 0.9.4 - +
    float allfloat all 7 14 @@ -51,35 +54,4 @@ Since: 0.9.4

    Default Value

    - -7 - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults;
    -settings.SlurHeight = 14f;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    slurHeight: 14
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-slur-height=14"></div>
    -
    -
    +7 \ No newline at end of file diff --git a/Documentation/input/reference/property/smallgracetabnotes.cshtml b/Documentation/input/reference/property/notation-smallgracetabnotes.cshtml similarity index 55% rename from Documentation/input/reference/property/smallgracetabnotes.cshtml rename to Documentation/input/reference/property/notation-smallgracetabnotes.cshtml index 558be489d..b5bf6fa94 100644 --- a/Documentation/input/reference/property/smallgracetabnotes.cshtml +++ b/Documentation/input/reference/property/notation-smallgracetabnotes.cshtml @@ -1,10 +1,11 @@ -Title: SmallGraceTabNotes -JsName: smallGraceTabNotes -DataAttribute: data-small-grace-tab-notes -Category: Core +Title: Notation.SmallGraceTabNotes +JsName: notation.smallGraceTabNotes +JsonName: notation.smallGraceTabNotes +DataAttribute: data-notation-smallgracetabnotes +Category: Notation Description: If set to true the guitar tabs on grace beats are rendered smaller. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

    Description

    @@ -12,6 +13,8 @@ Since: 0.9.4 By default, grace notes are drawn smaller on the guitar tabs than the other numbers. With this setting alphaTab can be configured to show grace tab notes with normal text size.

    +@Html.Partial("_PropertyDescription", Model) + @@ -32,41 +35,11 @@ Since: 0.9.4
    - +
    boolbool

    Default Value

    -true - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults; 
    -settings.SmallGraceTabNotes = true;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    smallGraceTabNotes: 'true'
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-small-grace-tab-notes="true"></div>
    -
    -
    \ No newline at end of file +true \ No newline at end of file diff --git a/Documentation/input/reference/property/notation-transpositionpitches.cshtml b/Documentation/input/reference/property/notation-transpositionpitches.cshtml new file mode 100644 index 000000000..80f2cb14c --- /dev/null +++ b/Documentation/input/reference/property/notation-transpositionpitches.cshtml @@ -0,0 +1,39 @@ +Title: Notation.TranspositionPitches +JsName: notation.transpositionPitches +JsonName: notation.transpositionPitches +DataAttribute: data-notation-transpositionpitches +Category: Notation +Description: The transposition pitch offsets for the individual tracks used for rendering and playback. +ShowInSideBar: false +Since: 0.9.6 +--- + +

    Description

    +

    + This setting allows transposing of tracks for display and playback. + The TranspositionPitches setting allows defining an additional pitch offset per track, that is then considered when displaying the music sheet. +

    + +@Html.Partial("_PropertyDescription", Model) + +

    Types

    + + + + + + + + + + + + + + + +
    Type
    int[] .net
    Array JavaScript
    + +

    Default Value

    + +(empty) \ No newline at end of file diff --git a/Documentation/input/reference/property/noteslightlength.cshtml b/Documentation/input/reference/property/noteslightlength.cshtml deleted file mode 100644 index 88bdb0bac..000000000 --- a/Documentation/input/reference/property/noteslightlength.cshtml +++ /dev/null @@ -1,10 +0,0 @@ -Title: Vibrato.NoteSlightLength -JsName: vibrato.noteSlightLength -DataAttribute: data-vibrato-note-slight-length -Category: Vibrato -Description: The wavelength of the note-slight vibrato in midi ticks. -Since: 0.9.4 -ShowInSideBar: false -Todo: true ---- -TODO \ No newline at end of file diff --git a/Documentation/input/reference/property/player-enablecursor.cshtml b/Documentation/input/reference/property/player-enablecursor.cshtml new file mode 100644 index 000000000..bf1761904 --- /dev/null +++ b/Documentation/input/reference/property/player-enablecursor.cshtml @@ -0,0 +1,30 @@ +Title: Player.EnableCursor +JsName: player.enableCursor +JsonName: player.enableCursor +DataAttribute: data-player-enablecursor +Category: Player +Description: Gets or sets whether playback cursors should be displayed. +ShowInSideBar: false +Since: 0.9.6 +--- + +

    Description

    +

    + This setting configures whether the playback cursors are shown or not. In case a developer decides to built an own cursor system the default one can be disabled with this setting. Enabling the cursor also requires the player to be active. +

    + +@Html.Partial("_PropertyDescription", Model) + +

    Types

    + + + + + + + +
    bool
    + +

    Default Value

    + +true \ No newline at end of file diff --git a/Documentation/input/reference/property/player-enableplayer.cshtml b/Documentation/input/reference/property/player-enableplayer.cshtml new file mode 100644 index 000000000..bef92e2d9 --- /dev/null +++ b/Documentation/input/reference/property/player-enableplayer.cshtml @@ -0,0 +1,34 @@ +Title: Player.EnablePlayer +JsName: player.enablePlayer +JsonName: player.enablePlayer +DataAttribute: data-player-enableplayer +Category: Player +Description: Gets or sets whether the player should be enabled. +ShowInSideBar: false +Since: 0.9.6 +--- + +

    Description

    +

    + This setting configures whether the player feature is enabled or not. Depending on the platform enabling the player needs some additional actions of the developer. + For the JavaScript version the Player.SoundFont property must be set to the URL of the sound font that should be used or it must be loaded manually via API. + For .net manually the soundfont must be loaded. +
    + AlphaTab does not ship a default UI for the player. The API must be hooked up to some UI controls to allow the user to interact with the player. +

    + +@Html.Partial("_PropertyDescription", Model) + +

    Types

    + + + + + + + +
    bool
    + +

    Default Value

    + +false \ No newline at end of file diff --git a/Documentation/input/reference/property/player-playtripletfeel.cshtml b/Documentation/input/reference/property/player-playtripletfeel.cshtml new file mode 100644 index 000000000..7985b324f --- /dev/null +++ b/Documentation/input/reference/property/player-playtripletfeel.cshtml @@ -0,0 +1,30 @@ +Title: Player.PlayTripletFeel +JsName: player.playTripletFeel +JsonName: player.playTripletFeel +DataAttribute: data-player-playtripletfeel +Category: Player +Description: Gets or sets whether the triplet feel should be played or only displayed. +ShowInSideBar: false +Since: 0.9.6 +--- + +

    Description

    +

    + If this setting is enabled alphaTab will play the triplet feels accordingly, if it is disabled the triplet feel is only displayed but not played. +

    + +@Html.Partial("_PropertyDescription", Model) + +

    Types

    + + + + + + + +
    bool
    + +

    Default Value

    + +true \ No newline at end of file diff --git a/Documentation/input/reference/property/player-scrollelement.cshtml b/Documentation/input/reference/property/player-scrollelement.cshtml new file mode 100644 index 000000000..8a1057874 --- /dev/null +++ b/Documentation/input/reference/property/player-scrollelement.cshtml @@ -0,0 +1,38 @@ +Title: Player.ScrollElement +JsName: player.scrollElement +JsonName: player.scrollElement +DataAttribute: data-player-scrollelement +Category: Player - JavaScript Specific +Description: The element to apply the scrolling on. +ShowInSideBar: false +Since: 0.9.6 +--- + +

    Description

    +

    + When the player is active, it by default automatically scrolls the browser window to the currently played bar. This setting + defines which elements should be scrolled to bring the played bar into the view port. By default scrolling happens on the html,body + selector. +

    + +@Html.Partial("_PropertyDescription", Model) + +

    Types

    + + + + + + + + + + + + + +
    bool .net
    string JSON, JavaScript & HTML
    DOM Element JavaScript
    + +

    Default Value

    + +html,body \ No newline at end of file diff --git a/Documentation/input/reference/property/scrollmode.cshtml b/Documentation/input/reference/property/player-scrollmode.cshtml similarity index 55% rename from Documentation/input/reference/property/scrollmode.cshtml rename to Documentation/input/reference/property/player-scrollmode.cshtml index b967d44b7..f46fea5a1 100644 --- a/Documentation/input/reference/property/scrollmode.cshtml +++ b/Documentation/input/reference/property/player-scrollmode.cshtml @@ -1,10 +1,11 @@ -Title: ScrollMode -JsName: autoScroll -DataAttribute: data-auto-scroll +Title: Player.ScrollMode +JsName: player.scrollMode +JsonName: player.scrollMode +DataAttribute: data-player-scrollmode Category: Player Description: Gets or sets the mode how to scroll. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

    Description

    @@ -12,6 +13,8 @@ Since: 0.9.4 This setting controls how alphaTab behaves for scrolling. It supports 3 modes:

    +@Html.Partial("_PropertyDescription", Model) +

    Types

    @@ -23,7 +26,7 @@ This setting controls how alphaTab behaves for scrolling. It supports 3 modes: - + - + - +
    AlphaTab.ScrollMode .netAlphaTab.ScrollMode .net Off - No automatic scrolling is done
    Continuous - Scrolling happens as soon the offsets of the cursors change
    @@ -31,7 +34,7 @@ This setting controls how alphaTab behaves for scrolling. It supports 3 modes:
    string JavaScript & HTMLstring JSON & HTML off
    continuous
    @@ -39,7 +42,7 @@ This setting controls how alphaTab behaves for scrolling. It supports 3 modes:
    int JavaScript & HTMLint JavaScript & HTML 0 - Off
    1 - Continuous
    @@ -51,35 +54,4 @@ This setting controls how alphaTab behaves for scrolling. It supports 3 modes:

    Default Value

    -GuitarPro - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults; 
    -settings.ScrollMode = ScrollMode.Off;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    autoScroll: 'off'
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-auto-scroll="off"></div>
    -
    -
    - +Continuous \ No newline at end of file diff --git a/Documentation/input/reference/property/player-scrolloffsetx.cshtml b/Documentation/input/reference/property/player-scrolloffsetx.cshtml new file mode 100644 index 000000000..0e860f307 --- /dev/null +++ b/Documentation/input/reference/property/player-scrolloffsetx.cshtml @@ -0,0 +1,42 @@ +Title: Player.ScrollOffsetX +JsName: player.playerOffsetX +JsonName: player.playerOffsetX +DataAttribute: data-player-playeroffsetx +Category: Player +Description: Gets or sets the X-offset to add when scrolling. +ShowInSideBar: false +Since: 0.9.6 +--- + +

    Description

    +

    +When alphaTab does an auto-scrolling to the displayed bar, it will try to align the view port to the displayed bar. If due to +some layout specifics or for aesthetics a small padding is needed, this setting allows an additional X-offset that is added to the +scroll position. +

    + +@Html.Partial("_PropertyDescription", Model) + +

    Types

    + + + + + + + + + + + + + + +
    TypeValues
    int all + -10
    + 20 +
    + +

    Default Value

    + +0 \ No newline at end of file diff --git a/Documentation/input/reference/property/player-scrolloffsety.cshtml b/Documentation/input/reference/property/player-scrolloffsety.cshtml new file mode 100644 index 000000000..b3b221349 --- /dev/null +++ b/Documentation/input/reference/property/player-scrolloffsety.cshtml @@ -0,0 +1,42 @@ +Title: Player.ScrollOffsetY +JsName: player.scrollOffsetY +JsonName: player.scrollOffsetY +DataAttribute: data-player-scrolloffsety +Category: Player +Description: Gets or sets the Y-offset to add when scrolling. +ShowInSideBar: false +Since: 0.9.6 +--- + +

    Description

    +

    +When alphaTab does an auto-scrolling to the displayed bar, it will try to align the view port to the displayed bar. If due to +some layout specifics or for aesthetics a small padding is needed, this setting allows an additional Y-offset that is added to the +scroll position. +

    + +@Html.Partial("_PropertyDescription", Model) + +

    Types

    + + + + + + + + + + + + + + +
    TypeValues
    int all + -10
    + 20 +
    + +

    Default Value

    + +0 \ No newline at end of file diff --git a/Documentation/input/reference/property/scrollspeed.cshtml b/Documentation/input/reference/property/player-scrollspeed.cshtml similarity index 50% rename from Documentation/input/reference/property/scrollspeed.cshtml rename to Documentation/input/reference/property/player-scrollspeed.cshtml index 3b28b3ecb..5c820ba68 100644 --- a/Documentation/input/reference/property/scrollspeed.cshtml +++ b/Documentation/input/reference/property/player-scrollspeed.cshtml @@ -1,10 +1,11 @@ -Title: ScrollSpeed -JsName: scrollSpeed -DataAttribute: data-scroll-speed +Title: Player.ScrollSpeed +JsName: player.scrollSpeed +JsonName: player.scrollSpeed +DataAttribute: data-player-scrollspeed Category: Player Description: Gets or sets how fast the scrolling to the new position should happen. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

    Description

    @@ -12,6 +13,8 @@ Since: 0.9.4 If possible from the platform, alphaTab will try to do a smooth scrolling to the played bar. This setting defines the speed of scrolling in milliseconds.

    +@Html.Partial("_PropertyDescription", Model) +

    Types

    @@ -23,7 +26,7 @@ Since: 0.9.4 - +
    int allint all 200
    300
    @@ -34,35 +37,4 @@ Since: 0.9.4

    Default Value

    - 300 - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults;
    -settings.ScrollSpeed = 100;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    scrollSpeed: 120
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-scroll-speed="100"></div>
    -
    -
    diff --git a/Documentation/input/reference/property/songbookbendduration.cshtml b/Documentation/input/reference/property/player-songbookbendduration.cshtml similarity index 56% rename from Documentation/input/reference/property/songbookbendduration.cshtml rename to Documentation/input/reference/property/player-songbookbendduration.cshtml index c69eebeba..3a3268136 100644 --- a/Documentation/input/reference/property/songbookbendduration.cshtml +++ b/Documentation/input/reference/property/player-songbookbendduration.cshtml @@ -1,10 +1,11 @@ -Title: SongBookBendDuration -JsName: songBookBendDuration -DataAttribute: data-song-book-bend-duration -Category: Core +Title: Player.SongBookBendDuration +JsName: player.songBookBendDuration +JsonName: player.songBookBendDuration +DataAttribute: data-player-songbookbendduration +Category: Player Description: The bend duration in milliseconds for songbook bends. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

    Description

    @@ -14,6 +15,8 @@ Since: 0.9.4 the bends should always be played in the same speed, regardless of the song tempo. Midi ticks are tempo dependent.

    +@Html.Partial("_PropertyDescription", Model) +

    Types

    @@ -25,7 +28,7 @@ Since: 0.9.4 - +
    int allint all 75
    120
    @@ -37,34 +40,4 @@ Since: 0.9.4

    Default Value

    -75 - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults;
    -settings.SongBookBendDuration = 120;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    songBookBendDuration: 120
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-song-book-bend-duration="120"></div>
    -
    -
    +75 \ No newline at end of file diff --git a/Documentation/input/reference/property/songbookdipduration.cshtml b/Documentation/input/reference/property/player-songbookdipduration.cshtml similarity index 56% rename from Documentation/input/reference/property/songbookdipduration.cshtml rename to Documentation/input/reference/property/player-songbookdipduration.cshtml index 8b1d8fbd1..75a86a843 100644 --- a/Documentation/input/reference/property/songbookdipduration.cshtml +++ b/Documentation/input/reference/property/player-songbookdipduration.cshtml @@ -1,10 +1,11 @@ -Title: SongBookDipDuration -JsName: songBookDipDuration -DataAttribute: data-song-book-dip-duration -Category: Core +Title: Player.SongBookDipDuration +JsName: player.songBookDipDuration +JsonName: player.songBookDipDuration +DataAttribute: data-player-songbookdipduration +Category: Player Description: The duration of whammy dips in milliseconds for songbook whammys. ShowInSideBar: false -Since: 0.9.4 +Since: 0.9.6 ---

    Description

    @@ -14,6 +15,8 @@ Since: 0.9.4 the whammy should always be pressed in the same speed, regardless of the song tempo. Midi ticks are tempo dependent.

    +@Html.Partial("_PropertyDescription", Model) +

    Types

    @@ -25,7 +28,7 @@ Since: 0.9.4 - +
    int allint all 75
    120
    @@ -37,34 +40,4 @@ Since: 0.9.4

    Default Value

    -150 - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults;
    -settings.SongBookDipDuration = 120;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    songBookDipDuration: 120
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-song-book-dip-duration="120"></div>
    -
    -
    +150 \ No newline at end of file diff --git a/Documentation/input/reference/property/player-soundfont.cshtml b/Documentation/input/reference/property/player-soundfont.cshtml new file mode 100644 index 000000000..8555d01a6 --- /dev/null +++ b/Documentation/input/reference/property/player-soundfont.cshtml @@ -0,0 +1,29 @@ +Title: Player.SoundFont +JsName: player.soundFont +JsonName: player.soundFont +DataAttribute: data-player-soundfont +Category: Player - JavaScript Specific +Description: The sound font file to load for the player. +ShowInSideBar: false +Since: 0.9.6 +--- + +

    Description

    +

    + When the player is enabled the soundfont from this URL will be loaded automatically after the player is ready. +

    + +@Html.Partial("_PropertyDescription", Model) + +

    Types

    + + + + + + + +
    string
    + +

    Default Value

    +null \ No newline at end of file diff --git a/Documentation/input/reference/property/player-vibrato-beatslightamplitude.cshtml b/Documentation/input/reference/property/player-vibrato-beatslightamplitude.cshtml new file mode 100644 index 000000000..2e4ba708e --- /dev/null +++ b/Documentation/input/reference/property/player-vibrato-beatslightamplitude.cshtml @@ -0,0 +1,14 @@ +Title: Player.Vibrato.BeatSlightAmplitude +JsName: player.vibrato.beatSlightAmplitude +JsonName: player.vibrato.beatSlightAmplitude +DataAttribute: data-player-vibrato-beatslightamplitude +Category: Player +Type: int +DefaultValue: 3 +Description: The amplitude for the beat-slight vibrato in semitones. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/player-vibrato +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/player-vibrato-beatslightlength.cshtml b/Documentation/input/reference/property/player-vibrato-beatslightlength.cshtml new file mode 100644 index 000000000..6f5fa40a3 --- /dev/null +++ b/Documentation/input/reference/property/player-vibrato-beatslightlength.cshtml @@ -0,0 +1,14 @@ +Title: Player.Vibrato.BeatSlightLength +JsName: player.vibrato.beatSlightLength +JsonName: player.vibrato.beatSlightLength +DataAttribute: data-player-vibrato-beatslightlength +Category: Player +Type: int +DefaultValue: 240 +Description: The wavelength of the beat-slight vibrato in midi ticks. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/player-vibrato +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/player-vibrato-beatwideamplitude.cshtml b/Documentation/input/reference/property/player-vibrato-beatwideamplitude.cshtml new file mode 100644 index 000000000..d1ac452d9 --- /dev/null +++ b/Documentation/input/reference/property/player-vibrato-beatwideamplitude.cshtml @@ -0,0 +1,14 @@ +Title: Player.Vibrato.BeatWideAmplitude +JsName: player.vibrato.beatWideAmplitude +JsonName: player.vibrato.beatWideAmplitude +DataAttribute: data-player-vibrato-beatwideamplitude +Category: Player +Type: int +DefaultValue: 3 +Description: The amplitude for the beat-wide vibrato in semitones. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/player-vibrato +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/player-vibrato-beatwidelength.cshtml b/Documentation/input/reference/property/player-vibrato-beatwidelength.cshtml new file mode 100644 index 000000000..608726265 --- /dev/null +++ b/Documentation/input/reference/property/player-vibrato-beatwidelength.cshtml @@ -0,0 +1,14 @@ +Title: Player.Vibrato.BeatWideLength +JsName: player.vibrato.beatWideLength +JsonName: player.vibrato.beatWideLength +DataAttribute: data-player-vibrato-beatwidelength +Category: Player +Type: int +DefaultValue: 240 +Description: The wavelength of the beat-wide vibrato in midi ticks. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/player-vibrato +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/player-vibrato-noteslightamplitude.cshtml b/Documentation/input/reference/property/player-vibrato-noteslightamplitude.cshtml new file mode 100644 index 000000000..cbab2c625 --- /dev/null +++ b/Documentation/input/reference/property/player-vibrato-noteslightamplitude.cshtml @@ -0,0 +1,14 @@ +Title: Player.Vibrato.NoteSlightAmplitude +JsName: player.vibrato.noteSlightAmplitude +JsonName: player.vibrato.noteSlightAmplitude +DataAttribute: data-player-vibrato-noteslightamplitude +Category: Player +Type: int +DefaultValue: 2 +Description: The amplitude for the note-slight vibrato in semitones. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/player-vibrato +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/player-vibrato-noteslightlength.cshtml b/Documentation/input/reference/property/player-vibrato-noteslightlength.cshtml new file mode 100644 index 000000000..7b29dc713 --- /dev/null +++ b/Documentation/input/reference/property/player-vibrato-noteslightlength.cshtml @@ -0,0 +1,14 @@ +Title: Player.Vibrato.NoteSlightLength +JsName: player.vibrato.noteSlightLength +JsonName: player.vibrato.noteSlightLength +DataAttribute: data-player-vibrato-noteslightlength +Category: Player +Type: int +DefaultValue: 480 +Description: The wavelength of the note-slight vibrato in midi ticks. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/player-vibrato +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/player-vibrato-notewideamplitude.cshtml b/Documentation/input/reference/property/player-vibrato-notewideamplitude.cshtml new file mode 100644 index 000000000..03f3ecd44 --- /dev/null +++ b/Documentation/input/reference/property/player-vibrato-notewideamplitude.cshtml @@ -0,0 +1,13 @@ +Title: Player.Vibrato.NoteWideAmplitude +JsName: player.vibrato.noteWideAmplitude +JsonName: player.vibrato.noteWideAmplitude +DataAttribute: data-player-vibrato-notewideamplitude +Category: Player +Type: int +DefaultValue: 2 +Description: The amplitude for the note-wide vibrato in semitones. +ShowInSideBar: false +Since: 0.9.6 +Link: /reference/property/player-vibrato +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/player-vibrato-notewidelength.cshtml b/Documentation/input/reference/property/player-vibrato-notewidelength.cshtml new file mode 100644 index 000000000..031a04775 --- /dev/null +++ b/Documentation/input/reference/property/player-vibrato-notewidelength.cshtml @@ -0,0 +1,14 @@ +Title: Player.Vibrato.NoteWideLength +JsName: player.vibrato.noteWideLength +JsonName: player.vibrato.noteWideLength +DataAttribute: data-player-vibrato-notewidelength +Category: Player +Type: int +DefaultValue: 480 +Description: The wavelength of the note-wide vibrato in midi ticks. +ShowInSideBar: false +ShowInTable: false +Since: 0.9.6 +Link: /reference/property/player-vibrato +--- +See here \ No newline at end of file diff --git a/Documentation/input/reference/property/player-vibrato.cshtml b/Documentation/input/reference/property/player-vibrato.cshtml new file mode 100644 index 000000000..574653b91 --- /dev/null +++ b/Documentation/input/reference/property/player-vibrato.cshtml @@ -0,0 +1,116 @@ +Title: Player.Vibrato +JsName: player.vibrato +JsonName: player.vibrato +DataAttribute: data-player-vibrato-* +Category: Player +Description: The Vibrato settings allow control how the different vibrato types are generated for audio. +ShowInSideBar: false +Since: 0.9.6 +--- + +@functions { + IEnumerable GetDocumentsAtPath(string relativePath) + { + return Documents.Where(d => + string.Join("/", d.Get(Keys.TreePath) ?? new object[0]) + .StartsWith(relativePath) + ); + } +} + +

    Description

    +

    + AlphaTab supports 4 types of vibratos, for each vibrato the amplitude and the wavelength can be configured. The amplitude controls how many semitones + the vibrato changes the pitch up and down while playback. The wavelength controls how many midi ticks it will take to complete one up and down vibrato. + The 4 vibrato types are: +

    + +
      +
    1. Beat Slight - A fast vibrato on the whole beat. This vibrato is usually done with the whammy bar.
    2. +
    3. Beat Wide - A slow vibrato on the whole beat. This vibrato is usually done with the whammy bar.
    4. +
    5. Note Slight - A fast vibrato on a single note. This vibrato is usually done with the finger on the fretboard.
    6. +
    7. Note Wide - A slow vibrato on a single note. This vibrato is usually done with the finger on the fretboard.
    8. +
    + +

    Vibrato Settings

    + + + + + + + + + + + + @foreach(IDocument child in GetDocumentsAtPath("reference/property/player-vibrato-")) + { + var prefixes = new [] { + "display.resources.", "resources.", + "data-display-resources-", "data-resources-" + }; + Func simplifyNames = array => + { + for(var i = 0; i < array.Length; i++) + { + foreach(var prefix in prefixes) + { + if(array[i].StartsWith(prefix)) + { + array[i] = array[i].Substring(prefix.Length); + break; + } + } + } + return array.Distinct().ToArray(); + }; + + object[] childTreePath = child.Get(Keys.TreePath); + string dotNetName = simplifyNames(new[]{child.String("Title")})[0]; + string[] jsNames = simplifyNames(child.String("JsName").Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries)); + string[] jsonNames = simplifyNames(child.String("JsonName").Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries)); + string[] dataAttributeNames = simplifyNames(child.String("DataAttribute").Split(new []{';'}, StringSplitOptions.RemoveEmptyEntries)); + + + + + + + + } + +
    SettingTypeDefaultSummary
    + + @dotNetName + .net + + @foreach(var name in jsNames) + { +
    + + @name JavaScript + + } + @foreach(var name in jsonNames) + { +
    + + @name JSON + + } + @foreach(var name in dataAttributeNames) + { +
    + + @name HTML + + } +
    + + @Html.Raw(child.String("Type")) + all + + @Html.Raw(child.String("DefaultValue")) + @(child.String(DocsKeys.Description)) +
    \ No newline at end of file diff --git a/Documentation/input/reference/property/playtripletfeel.cshtml b/Documentation/input/reference/property/playtripletfeel.cshtml deleted file mode 100644 index 22dfa7ebb..000000000 --- a/Documentation/input/reference/property/playtripletfeel.cshtml +++ /dev/null @@ -1,57 +0,0 @@ -Title: PlayTripletFeel -JsName: playTripletFeel -DataAttribute: data-play-triplet-feel -Category: Core -Description: Gets or sets whether in the triplet feel should be applied during playback. -Since: 0.9.5 -ShowInSideBar: false ---- - -

    Description

    -

    - If this setting is enabled alphaTab will consider the triplet feel during playback not only for display above the notation. -

    - -

    Types

    - - - - - - - -
    bool
    - -

    Default Value

    - -true - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults; 
    -settings.PlayTripletFeel = false;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    playTripletFeel: false
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-play-triplet-feel="true"></div>
    -
    -
    \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-barnumbercolor.cshtml b/Documentation/input/reference/property/renderingresources-barnumbercolor.cshtml deleted file mode 100644 index c13b1971c..000000000 --- a/Documentation/input/reference/property/renderingresources-barnumbercolor.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.BarNumberColor -JsName: resources.barNumberColor -DataAttribute: data-resources-bar-number-color -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Color -JsType: string;int -DefaultValue: rgb(200, 0, 0) -Description: The color to use for displaying the bar numbers above the music sheet. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-barnumberfont.cshtml b/Documentation/input/reference/property/renderingresources-barnumberfont.cshtml deleted file mode 100644 index cc477b6b5..000000000 --- a/Documentation/input/reference/property/renderingresources-barnumberfont.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.BarNumberFont -JsName: resources.barNumberFont -DataAttribute: data-resources-bar-number-font -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Font -JsType: string -DefaultValue: Arial 11px -Description: The font to use for displaying the bar numbers above the music sheet. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-barseparatorcolor.cshtml b/Documentation/input/reference/property/renderingresources-barseparatorcolor.cshtml deleted file mode 100644 index 119dedfb4..000000000 --- a/Documentation/input/reference/property/renderingresources-barseparatorcolor.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.BarSeparatorColor -JsName: resources.barSeparatorColor -DataAttribute: data-resources-bar-separator-color -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Color -JsType: string;int -DefaultValue: rgb(34, 34, 17) -Description: The color to use for rendering bar separators, the accolade and repeat signs. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-copyrightfont.cshtml b/Documentation/input/reference/property/renderingresources-copyrightfont.cshtml deleted file mode 100644 index 52f49689b..000000000 --- a/Documentation/input/reference/property/renderingresources-copyrightfont.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.CopyrightFont -JsName: resources.copyrightFont -DataAttribute: data-resources-copyright-font -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Font -JsType: string -DefaultValue: Arial 12px bold -Description: The font to use for displaying the songs copyright information in the header of the music sheet. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-effectfont.cshtml b/Documentation/input/reference/property/renderingresources-effectfont.cshtml deleted file mode 100644 index ffe58d912..000000000 --- a/Documentation/input/reference/property/renderingresources-effectfont.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.EffectFont -JsName: resources.effectFont -DataAttribute: data-resources-effect-font -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Font -JsType: string -DefaultValue: Georgia 12px italic -Description: The font to use for displaying certain effect related elements in the music sheet. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-fingeringfont.cshtml b/Documentation/input/reference/property/renderingresources-fingeringfont.cshtml deleted file mode 100644 index 7f358611f..000000000 --- a/Documentation/input/reference/property/renderingresources-fingeringfont.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.FingeringFont -JsName: resources.fingeringFont -DataAttribute: data-resources-fingering-font -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Font -JsType: string -DefaultValue: Georgia 14px -Description: The font to use for displaying finger information in the music sheet. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-fretboardnumberfont.cshtml b/Documentation/input/reference/property/renderingresources-fretboardnumberfont.cshtml deleted file mode 100644 index ad0914d12..000000000 --- a/Documentation/input/reference/property/renderingresources-fretboardnumberfont.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.FretboardNumberFont -JsName: resources.fretboardNumberFont -DataAttribute: data-resources-fretboard-number-font -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Font -JsType: string -DefaultValue: Arial 11px -Description: The font to use for displaying the fretboard numbers in chord diagrams. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-gracefont.cshtml b/Documentation/input/reference/property/renderingresources-gracefont.cshtml deleted file mode 100644 index 4002ee328..000000000 --- a/Documentation/input/reference/property/renderingresources-gracefont.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.GraceFont -JsName: resources.graceFont -DataAttribute: data-resources-grace-font -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Font -JsType: string -DefaultValue: Arial 11px -Description: The font to use for grace notation related texts in the music sheet. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-mainglyphcolor.cshtml b/Documentation/input/reference/property/renderingresources-mainglyphcolor.cshtml deleted file mode 100644 index 7ef80c8ef..000000000 --- a/Documentation/input/reference/property/renderingresources-mainglyphcolor.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.MainGlyphColor -JsName: resources.mainGlyphColor -DataAttribute: data-resources-main-glyph-color -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Color -JsType: string;int -DefaultValue: rgb(0, 0, 0) -Description: The color to use for music notation elements of the primary voice. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-markerfont.cshtml b/Documentation/input/reference/property/renderingresources-markerfont.cshtml deleted file mode 100644 index 459a27ca2..000000000 --- a/Documentation/input/reference/property/renderingresources-markerfont.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.MarkerFont -JsName: resources.markerFont -DataAttribute: data-resources-marker-font -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Font -JsType: string -DefaultValue: Georgia 14px bold -Description: The font to use for section marker labels shown above the music sheet. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-scoreinfocolor.cshtml b/Documentation/input/reference/property/renderingresources-scoreinfocolor.cshtml deleted file mode 100644 index 1adea45e6..000000000 --- a/Documentation/input/reference/property/renderingresources-scoreinfocolor.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.ScoreInfoColor -JsName: resources.scoreInfoColor -DataAttribute: data-resources-score-info-color -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Color -JsType: string;int -DefaultValue: rgb(0, 0, 0) -Description: The color to use for displaying the song information above the music sheets. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-secondaryglyphcolor.cshtml b/Documentation/input/reference/property/renderingresources-secondaryglyphcolor.cshtml deleted file mode 100644 index f6c8d1711..000000000 --- a/Documentation/input/reference/property/renderingresources-secondaryglyphcolor.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.SecondaryGlyphColor -JsName: resources.secondaryGlyphColor -DataAttribute: data-resources-secondary-glyph-color -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Color -JsType: string;int -DefaultValue: rgb(0,0,0,0.4) -Description: The color to use for music notation elements of the secondary voices. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-stafflinecolor.cshtml b/Documentation/input/reference/property/renderingresources-stafflinecolor.cshtml deleted file mode 100644 index b6273cb78..000000000 --- a/Documentation/input/reference/property/renderingresources-stafflinecolor.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.StaffLineColor -JsName: resources.staffLineColor -DataAttribute: data-resources-staff-line-color -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Color -JsType: string;int -DefaultValue: rgb(165, 165, 165) -Description: The color to use for rendering the lines of staves. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-subtitlefont.cshtml b/Documentation/input/reference/property/renderingresources-subtitlefont.cshtml deleted file mode 100644 index 764ac0a0a..000000000 --- a/Documentation/input/reference/property/renderingresources-subtitlefont.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.SubTitleFont -JsName: resources.subTitleFont -DataAttribute: data-resources-subtitle-font -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Font -JsType: string -DefaultValue: Georgia 20px -Description: The font to use for displaying the songs subtitle in the header of the music sheet. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-tablaturefont.cshtml b/Documentation/input/reference/property/renderingresources-tablaturefont.cshtml deleted file mode 100644 index 501a2fb1a..000000000 --- a/Documentation/input/reference/property/renderingresources-tablaturefont.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.TablatureFont -JsName: resources.tablatureFont -DataAttribute: data-resources-tablature-font -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Font -JsType: string -DefaultValue: Arial 13px -Description: The font to use for displaying the guitar tablature numbers in the music sheet. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-titlefont.cshtml b/Documentation/input/reference/property/renderingresources-titlefont.cshtml deleted file mode 100644 index 836fdeb0f..000000000 --- a/Documentation/input/reference/property/renderingresources-titlefont.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.TitleFont -JsName: resources.titleFont -DataAttribute: data-resources-title-font -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Font -JsType: string -DefaultValue: Georgia 32px -Description: The font to use for displaying the songs title in the header of the music sheet. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources-wordsfont.cshtml b/Documentation/input/reference/property/renderingresources-wordsfont.cshtml deleted file mode 100644 index 1462ca275..000000000 --- a/Documentation/input/reference/property/renderingresources-wordsfont.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -Title: RenderingResources.WordsFont -JsName: resources.wordsFont -DataAttribute: data-resources-words-font -Category: Rendering Resources -Type: AlphaTab.Platform.Model.Font -JsType: string -DefaultValue: Arial 15px -Description: The font to use for displaying the lyrics information in the header of the music sheet. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/renderingresources ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/renderingresources.cshtml b/Documentation/input/reference/property/renderingresources.cshtml deleted file mode 100644 index c0d67eeb4..000000000 --- a/Documentation/input/reference/property/renderingresources.cshtml +++ /dev/null @@ -1,190 +0,0 @@ -Title: RenderingResources -JsName: resources -DataAttribute: data-resources-* -Category: Rendering Resources -Description: The rendering resources that allow adjusting the display. -Since: 0.9.4 -ShowInSideBar: false ---- - -@functions { - IEnumerable GetDocumentsAtPath(string relativePath) - { - return Documents.Where(d => - string.Join("/", d.Get(Keys.TreePath) ?? new object[0]) - .StartsWith(relativePath) - ); - } -} - -

    Description

    -

    - AlphaTab allows configuring the colors and fonts used for rendering via the rendering resources settings. Please note that as of today - this is the primary way of changing the way how alphaTab styles elements. CSS styling in the browser cannot be guaranteed to work due to its flexibility. -

    -

    -Due to space reasons in the following table the common prefix of the settings are removed. Please refer to these examples to eliminate confusion on the usage: -

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    PlatformPrefixExample Usage
    .netRenderingResources.settings.RenderingResources.WordsFonts = ...
    JavaScriptresources. - var settings = { resources: { wordsFonts: '...'} }; or
    - settings.resources.wordsFont = '...' -
    HTMLdata-resources- - <div data-resources-words-font="..."> -
    - -

    Resources

    -Following resources exist for adjusting the style. - - - - - - - - - - - - @foreach(IDocument child in GetDocumentsAtPath("reference/property/renderingresources-")) - { - object[] childTreePath = child.Get(Keys.TreePath); - string[] jsTypes = child.String("JsType").Split(';'); - string name = child.WithoutSettings.String(Keys.Title, childTreePath.Last().ToString()); - string jsName = child.String("JsName"); - string dataAttribute = child.String("DataAttribute"); - if(name.StartsWith("RenderingResources")) { name = name.Substring("RenderingResources".Length); } - if(jsName.StartsWith("resources")) { jsName = jsName.Substring("resources".Length); } - if(dataAttribute.StartsWith("data-resources")) { dataAttribute = dataAttribute.Substring("data-resources".Length); } - - - - - - - - } - -
    ResourceTypeDefaultSummary
    - - @name - .net - -
    - - @jsName - JSON - -
    - - @dataAttribute - HTML - -
    - - @Html.Raw(child.String("Type")) - .net - - @for(int i = 0; i < jsTypes.Length; i++) - { -
    - @(jsTypes[i]) JavaScript & HTML - } -
    @Html.Raw(child.String("DefaultValue")) - @(child.String(DocsKeys.Description)) -
    - -

    Types

    - -

    Fonts

    -

    -For the .net platform any installed font on the system can be used. Simply construct the Font object to configure your desired fonts. -

    -

    -For the JavaScript platform any font that might be installed on the client machines can be used. Any additional fonts can be added via WebFonts. The rendering of the score will be delayed until it is detected that the font was loaded. Simply use any CSS font property compliant string as configuration. Relative font sizes with percentual values are not supported, remaining values will be considered if supported. -

    - - -

    Colors

    -

    -On .net simply construct the Color object to configure your desired color. For JavaScript you can use any CSS font property compliant string. (#RGB, #RGBA, #RRGGBB, #RRGGBBAA, rgb(r,g,b), rgba(r,g,b,a) ) -

    - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults; 
    -settings.RenderingResources.EffectFont = new Font("Roboto Slab", 12f, FontStyle.Italic);
    -settings.RenderingResources.CopyrightFont = new Font("Roboto", 12f, FontStyle.Bold);
    -settings.RenderingResources.FretboardNumberFont = new Font("Roboto", 11f, FontStyle.Plain);
    -settings.RenderingResources.TitleFont = new Font("Roboto Slab", 32f, FontStyle.Plain);
    -settings.RenderingResources.SubTitleFont = new Font("Roboto Slab", 20f, FontStyle.Plain);
    -settings.RenderingResources.WordsFont = new Font("Roboto Slab", 15f, FontStyle.Plain);
    -settings.RenderingResources.TablatureFont = new Font("Roboto", 13f, FontStyle.Plain);
    -settings.RenderingResources.GraceFont = new Font("Roboto", 11f, FontStyle.Plain);
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    resources: {
    -        effectFont: "italic 12px 'Roboto Slab'",
    -        copyrightFont: "bold 12px Roboto",
    -        fretboardNumberFont: "11px Roboto",
    -        titleFont: "32px 'Roboto Slab'",
    -        subTitleFont: "20px 'Roboto Slab'",
    -        wordsFont: "15px 'Roboto Slab'",
    -        tablatureFont: "13px 'Roboto Slab'",
    -        graceFont: "11px 'Roboto Slab'"
    -    }
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" 
    -        data-resources-effect-font="italic 12px 'Roboto Slab'"
    -        data-resources-copyright-font="bold 12px Roboto"
    -        data-resources-fretboard-number-font="11px Roboto"
    -        data-resources-title-font="32px 'Roboto Slab'"
    -        data-resources-sub-title-font="20px 'Roboto Slab'"
    -        data-resources-words-font="15px 'Roboto Slab'"
    -        data-resources-tablature-font="13px 'Roboto Slab'"
    -        data-resources-grace-font="1px 'Roboto Slab'"
    -></div>
    -
    -
    \ No newline at end of file diff --git a/Documentation/input/reference/property/scrollelement.cshtml b/Documentation/input/reference/property/scrollelement.cshtml deleted file mode 100644 index 698170a43..000000000 --- a/Documentation/input/reference/property/scrollelement.cshtml +++ /dev/null @@ -1,49 +0,0 @@ -Title: ScrollElement -JsName: scrollElement -DataAttribute: data-scroll-element -Category: JavaScript Specific -Description: The element to apply the scrolling on. -ShowInSideBar: false -Since: 0.9.4 ---- - -

    Description

    -

    - When the player is active, it by default automatically scrolls the browser window to the currently played bar. This setting - defines which elements should be scrolled to bring the played bar into the view port. By default scrolling happens on the html,body - selector. -

    - -

    Types

    - - - - - - - -
    string
    - -

    Default Value

    - -html,body - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    scrollElement: "#container"
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-scroll-element="#container"></div>
    -
    -
    \ No newline at end of file diff --git a/Documentation/input/reference/property/scrolloffsetx.cshtml b/Documentation/input/reference/property/scrolloffsetx.cshtml deleted file mode 100644 index 984b34118..000000000 --- a/Documentation/input/reference/property/scrolloffsetx.cshtml +++ /dev/null @@ -1,73 +0,0 @@ -Title: ScrollOffsetX -JsName: playerOffset -DataAttribute: data-player-offset -Category: Player -Description: Gets or sets the X-offset to add when scrolling. -ShowInSideBar: false -Since: 0.9.4 ---- - -

    Description

    -

    -When alphaTab does an auto-scrolling to the displayed bar, it will try to align the view port to the displayed bar. If due to -some layout specifics or for aesthetics a small padding is needed, this setting allows an additional X-offset that is added to the -scroll position. -

    -

    - For JavaScript and HTML the X/Y offsets are set at once in an array fashion. -

    - -

    Types

    - - - - - - - - - - - - - - -
    TypeValues
    int all - -10
    - 20 -
    - -

    Default Value

    - -0 - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults; 
    -settings.ScrollOffsetX = -10;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    playerOffset: [-10, 0]
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-player-offset="[-10, 0]"></div>
    -
    -
    - diff --git a/Documentation/input/reference/property/scrolloffsety.cshtml b/Documentation/input/reference/property/scrolloffsety.cshtml deleted file mode 100644 index 9c9131953..000000000 --- a/Documentation/input/reference/property/scrolloffsety.cshtml +++ /dev/null @@ -1,73 +0,0 @@ -Title: ScrollOffsetY -JsName: playerOffset -DataAttribute: data-player-offset -Category: Player -Description: Gets or sets the Y-offset to add when scrolling. -ShowInSideBar: false -Since: 0.9.4 ---- - -

    Description

    -

    -When alphaTab does an auto-scrolling to the displayed bar, it will try to align the view port to the displayed bar. If due to -some layout specifics or for aesthetics a small padding is needed, this setting allows an additional Y-offset that is added to the -scroll position. -

    -

    - For JavaScript and HTML the X/Y offsets are set at once in an array fashion. -

    - -

    Types

    - - - - - - - - - - - - - - -
    TypeValues
    int all - -10
    - 20 -
    - -

    Default Value

    - -0 - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults; 
    -settings.ScrollOffsetY = -10;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    playerOffset: [0, -10]
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-player-offset="[0, -10]"></div>
    -
    -
    - diff --git a/Documentation/input/reference/property/soundfontfile.cshtml b/Documentation/input/reference/property/soundfontfile.cshtml deleted file mode 100644 index 0de346ca9..000000000 --- a/Documentation/input/reference/property/soundfontfile.cshtml +++ /dev/null @@ -1,47 +0,0 @@ -Title: SoundFontFile -JsName: player -DataAttribute: data-player -Category: JavaScript Specific -Description: The sound font file to load for the player. -ShowInSideBar: false -Since: 0.9.4 ---- - -

    Description

    -

    - This setting enables the player feature and also defines which SoundFont file to use for playback. -

    - -

    Types

    - - - - - - - -
    string
    - -

    Default Value

    - -null - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    player: "/assets/soundfont.sf2"
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-player="/assets/soundfont.sf2"></div>
    -
    -
    \ No newline at end of file diff --git a/Documentation/input/reference/property/stavesadditionalsettings.cshtml b/Documentation/input/reference/property/stavesadditionalsettings.cshtml deleted file mode 100644 index c8be5c8e8..000000000 --- a/Documentation/input/reference/property/stavesadditionalsettings.cshtml +++ /dev/null @@ -1,14 +0,0 @@ -Title: Staves.AdditionalSettings -JsName: staves.additionalSettings -DataAttribute: data-staves-* -Category: Staves -Description: Additional staff specific settings. -ShowInSideBar: false -Since: 0.9.4 ---- - - -

    Description

    -

    - These settings allow additional configuration of staff specifics. -

    \ No newline at end of file diff --git a/Documentation/input/reference/property/stavesadditionalsettingsrhythm.cshtml b/Documentation/input/reference/property/stavesadditionalsettingsrhythm.cshtml deleted file mode 100644 index a8d7d2400..000000000 --- a/Documentation/input/reference/property/stavesadditionalsettingsrhythm.cshtml +++ /dev/null @@ -1,59 +0,0 @@ -Title: Staves.AdditionalSettings["rhythm"] -JsName: staves.additionalSettings.rhythm -DataAttribute: data-staves-rhythm -Category: Staves -Description: Renders rhythm annotations to tablature notes. -ShowInSideBar: false -Since: 0.9.4 ---- - -

    Description

    -

    - This setting enables the display of rhythm notation on tab staffs. Demo -

    - - - - - - - -
    bool
    - -

    Default Value

    - -false - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults;
    -settings.Staves.AdditionalSettings["rhythm"] = true;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    staves: {
    -        additionalSettings: {
    -            rhythm: true
    -        }
    -    }    
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-staves-rhythm="true"></div>
    -
    -
    diff --git a/Documentation/input/reference/property/stavesadditionalsettingsrhythmbeams.cshtml b/Documentation/input/reference/property/stavesadditionalsettingsrhythmbeams.cshtml deleted file mode 100644 index 05707604e..000000000 --- a/Documentation/input/reference/property/stavesadditionalsettingsrhythmbeams.cshtml +++ /dev/null @@ -1,59 +0,0 @@ -Title: Staves.AdditionalSettings["rhythmBeams"] -JsName: staves.additionalSettings.rhythmBeams -DataAttribute: data-staves-rhythm-beams -Category: Staves -Description: Enforces beams on the rhythm annotations -ShowInSideBar: false -Since: 0.9.4 ---- - -

    Description

    -

    - This setting can be used in combination with the rhythm setting to enforce that all notes have an individual beam and they are not grouped with bars like in standard notation. Demo -

    - - - - - - - -
    bool
    - -

    Default Value

    - -false - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults;
    -settings.Staves.AdditionalSettings["rhythmBeams"] = true;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    staves: {
    -        additionalSettings: {
    -            rhythmBeams: true
    -        }
    -    }    
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-staves-rhythm-beams="true"></div>
    -
    -
    diff --git a/Documentation/input/reference/property/stavesid.cshtml b/Documentation/input/reference/property/stavesid.cshtml deleted file mode 100644 index bebe13f5c..000000000 --- a/Documentation/input/reference/property/stavesid.cshtml +++ /dev/null @@ -1,74 +0,0 @@ -Title: Staves.Id -JsName: staves;staves.id -DataAttribute: data-staves -Category: Staves -Description: The stave profile name to use for display. -ShowInSideBar: false -Since: 0.9.4 ---- - -

    Description

    -

    - AlphaTab has various stave profiles that define which staves will be shown in for the rendered tracks. -

    - -

    Types

    - - - - - - - - - - - - - - -
    TypeValues
    string all - default - Score and Tab (if available) staves are shown
    - score - Only Score staff are shown
    - tab - Only Tab staff is shown with additional details compared to a mixed score/tab staff
    - tab-mixed - Only Tab staff is shown the way it would be shown combined with a score staff.
    - horizontal - The bars are aligned in a left-to-right fashion. -
    - -

    Default Value

    - -page - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults; 
    -settings.Staves.Id = "score";
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    staves: {
    -        id: 'score'
    -    }
    -    // or shorthand if no additional settings are needed: 
    -    staves: 'score'
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-staves="score"></div>
    -
    -
    \ No newline at end of file diff --git a/Documentation/input/reference/property/transpositionpitches.cshtml b/Documentation/input/reference/property/transpositionpitches.cshtml deleted file mode 100644 index 020260b93..000000000 --- a/Documentation/input/reference/property/transpositionpitches.cshtml +++ /dev/null @@ -1,67 +0,0 @@ -Title: TranspositionPitches -JsName: transpositionPitches -DataAttribute: data-transposition-pitches -Category: Core -Description: The transposition pitch offsets for the individual tracks used for rendering and playback. -ShowInSideBar: false -Since: 0.9.4 ---- - -

    Description

    -

    - This setting allows transposing of tracks for display and playback. - The TranspositionPitches setting allows defining an additional pitch offset per track, that is then considered when displaying the music sheet. -

    - -

    Types

    - - - - - - - - - - - - - - - -
    Type
    int[] .net
    Array JavaScript
    - -

    Default Value

    - -(empty) - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults;
    -settings.TranspositionPitches = new int[] { 12, -12, 6, -6 };
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    transpositionPitches: [ 12, -12, 6, -6 ]
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-transposition-pitches="[ 12, -12, 6, -6 ]"></div>
    -
    -
    - diff --git a/Documentation/input/reference/property/useworkers.cshtml b/Documentation/input/reference/property/useworkers.cshtml deleted file mode 100644 index 740de7b5b..000000000 --- a/Documentation/input/reference/property/useworkers.cshtml +++ /dev/null @@ -1,58 +0,0 @@ -Title: UseWorkers -JsName: useWorker -DataAttribute: data-use-worker -Category: Core -Description: Gets or sets whether the rendering should be done in a worker if possible. -ShowInSideBar: false -Since: 0.9.4 ---- - -

    Description

    -

    - AlphaTab normally tries to render the music sheet asynchronously in a worker. This reduces the load on the UI side and avoids hanging. However sometimes it might be more desirable to have - a synchronous rendering behavior. This setting can be set to false to synchronously render the music sheet on the UI side. -

    - -

    Types

    - - - - - - - -
    bool
    - -

    Default Value

    - -true - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults; 
    -settings.UseWorker = false;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    useWorker: false
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" data-use-worker="false"></div>
    -
    -
    \ No newline at end of file diff --git a/Documentation/input/reference/property/vibrato-beatslightamplitude.cshtml b/Documentation/input/reference/property/vibrato-beatslightamplitude.cshtml deleted file mode 100644 index c234d8bcc..000000000 --- a/Documentation/input/reference/property/vibrato-beatslightamplitude.cshtml +++ /dev/null @@ -1,12 +0,0 @@ -Title: Vibrato.BeatSlightAmplitude -JsName: vibrato.beatSlightAmplitude -DataAttribute: data-vibrato-beat-slight-amplitude -Category: Vibrato -Type: int -DefaultValue: 3 -Description: The amplitude for the beat-slight vibrato in semitones. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/vibrato ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/vibrato-beatslightlength.cshtml b/Documentation/input/reference/property/vibrato-beatslightlength.cshtml deleted file mode 100644 index b4f6db484..000000000 --- a/Documentation/input/reference/property/vibrato-beatslightlength.cshtml +++ /dev/null @@ -1,12 +0,0 @@ -Title: Vibrato.BeatSlightLength -JsName: vibrato.beatSlightLength -DataAttribute: data-vibrato-beat-slight-length -Category: Vibrato -Type: int -DefaultValue: 240 -Description: The wavelength of the beat-slight vibrato in midi ticks. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/vibrato ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/vibrato-beatwideamplitude.cshtml b/Documentation/input/reference/property/vibrato-beatwideamplitude.cshtml deleted file mode 100644 index 7b61d4392..000000000 --- a/Documentation/input/reference/property/vibrato-beatwideamplitude.cshtml +++ /dev/null @@ -1,12 +0,0 @@ -Title: Vibrato.BeatWideAmplitude -JsName: vibrato.beatWideAmplitude -DataAttribute: data-vibrato-beat-wide-amplitude -Category: Vibrato -Type: int -DefaultValue: 3 -Description: The amplitude for the beat-wide vibrato in semitones. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/vibrato ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/vibrato-beatwidelength.cshtml b/Documentation/input/reference/property/vibrato-beatwidelength.cshtml deleted file mode 100644 index 3958e3b03..000000000 --- a/Documentation/input/reference/property/vibrato-beatwidelength.cshtml +++ /dev/null @@ -1,12 +0,0 @@ -Title: Vibrato.BeatWideLength -JsName: vibrato.beatWideLength -DataAttribute: data-vibrato-beat-wide-length -Category: Vibrato -Type: int -DefaultValue: 240 -Description: The wavelength of the beat-wide vibrato in midi ticks. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/vibrato ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/vibrato-noteslightamplitude.cshtml b/Documentation/input/reference/property/vibrato-noteslightamplitude.cshtml deleted file mode 100644 index 40f0b1f32..000000000 --- a/Documentation/input/reference/property/vibrato-noteslightamplitude.cshtml +++ /dev/null @@ -1,12 +0,0 @@ -Title: Vibrato.NoteSlightAmplitude -JsName: vibrato.noteSlightAmplitude -DataAttribute: data-vibrato-note-slight-amplitude -Category: Vibrato -Type: int -DefaultValue: 2 -Description: The amplitude for the note-slight vibrato in semitones. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/vibrato ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/vibrato-noteslightlength.cshtml b/Documentation/input/reference/property/vibrato-noteslightlength.cshtml deleted file mode 100644 index 2e30071e5..000000000 --- a/Documentation/input/reference/property/vibrato-noteslightlength.cshtml +++ /dev/null @@ -1,12 +0,0 @@ -Title: Vibrato.NoteSlightLength -JsName: vibrato.noteSlightLength -DataAttribute: data-vibrato-note-slight-length -Category: Vibrato -Type: int -DefaultValue: 480 -Description: The wavelength of the note-slight vibrato in midi ticks. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/vibrato ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/vibrato-notewideamplitude.cshtml b/Documentation/input/reference/property/vibrato-notewideamplitude.cshtml deleted file mode 100644 index bdd05f250..000000000 --- a/Documentation/input/reference/property/vibrato-notewideamplitude.cshtml +++ /dev/null @@ -1,12 +0,0 @@ -Title: Vibrato.NoteWideAmplitude -JsName: vibrato.noteWideAmplitude -DataAttribute: data-vibrato-note-wide-amplitude -Category: Vibrato -Type: int -DefaultValue: 2 -Description: The amplitude for the note-wide vibrato in semitones. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/vibrato ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/vibrato-notewidelength.cshtml b/Documentation/input/reference/property/vibrato-notewidelength.cshtml deleted file mode 100644 index a9164d858..000000000 --- a/Documentation/input/reference/property/vibrato-notewidelength.cshtml +++ /dev/null @@ -1,12 +0,0 @@ -Title: Vibrato.NoteWideLength -JsName: vibrato.noteWideLength -DataAttribute: data-vibrato-note-wide-length -Category: Vibrato -Type: int -DefaultValue: 480 -Description: The wavelength of the note-wide vibrato in midi ticks. -ShowInSideBar: false -Since: 0.9.4 -Link: /reference/property/vibrato ---- -See here \ No newline at end of file diff --git a/Documentation/input/reference/property/vibrato.cshtml b/Documentation/input/reference/property/vibrato.cshtml deleted file mode 100644 index cc9ec3415..000000000 --- a/Documentation/input/reference/property/vibrato.cshtml +++ /dev/null @@ -1,123 +0,0 @@ -Title: Vibrato -JsName: vibrato -DataAttribute: data-vibrato-* -Category: Vibrato -Description: The Vibrato settings allow control how the different vibrato types are generated for audio. -ShowInSideBar: false -Since: 0.9.4 ---- - -@functions { - IEnumerable GetDocumentsAtPath(string relativePath) - { - return Documents.Where(d => - string.Join("/", d.Get(Keys.TreePath) ?? new object[0]) - .StartsWith(relativePath) - ); - } -} - -

    Description

    -

    - AlphaTab supports 4 types of vibratos, for each vibrato the amplitude and the wavelength can be configured. The amplitude controls how many semitones - the vibrato changes the pitch up and down while playback. The wavelength controls how many midi ticks it will take to complete one up and down vibrato. - The 4 vibrato types are: -

    - -
      -
    1. Beat Slight - A fast vibrato on the whole beat. This vibrato is usually done with the whammy bar.
    2. -
    3. Beat Wide - A slow vibrato on the whole beat. This vibrato is usually done with the whammy bar.
    4. -
    5. Note Slight - A fast vibrato on a single note. This vibrato is usually done with the finger on the fretboard.
    6. -
    7. Note Wide - A slow vibrato on a single note. This vibrato is usually done with the finger on the fretboard.
    8. -
    - -

    Vibrato Settings

    - - - - - - - - - - - - @foreach(IDocument child in GetDocumentsAtPath("reference/property/vibrato-")) - { - object[] childTreePath = child.Get(Keys.TreePath); - string name = child.WithoutSettings.String(Keys.Title, childTreePath.Last().ToString()); - string jsName = child.String("JsName"); - string dataAttribute = child.String("DataAttribute"); - if(name.StartsWith("RenderingResources")) { name = name.Substring("RenderingResources".Length); } - if(jsName.StartsWith("resources")) { jsName = jsName.Substring("resources".Length); } - if(dataAttribute.StartsWith("data-resources")) { dataAttribute = dataAttribute.Substring("data-resources".Length); } - - - - - - - - } - -
    SettingTypeDefaultSummary
    - - @name - .net - -
    - - @jsName - JSON - -
    - - @dataAttribute - HTML - -
    - - @Html.Raw(child.String("Type")) - all - - @Html.Raw(child.String("DefaultValue")) - @(child.String(DocsKeys.Description)) -
    - -

    Example - C#

    - -
    -
    -var settings = Settings.Defaults; 
    -settings.Vibrato.NoteSlightLength = 240;
    -settings.Vibrato.BeatSlightLength = 120;
    -
    -
    - - -

    Example - JavaScript

    - -
    -
    -var settings = {
    -    vibrato: {
    -        noteSlightLength: 240,
    -        beatSlightLength: 120
    -    }
    -};
    -var api = new alphaTab.platform.javaScript.AlphaTabApi(document.querySelector('#alphaTab'), settings);
    -var japi = $('#alphaTab').alphaTab(settings);
    -
    -
    - -

    Example - HTML

    - -
    -
    -<div id="alphaTab" 
    -        data-vibrato-note-slight-length="240"
    -        data-vibrato-beat-slight-length="120"
    -></div>
    -
    -
    \ No newline at end of file diff --git a/Phase/Mscorlib/system/ByteArray.hx b/Phase/Mscorlib/system/ByteArray.hx index 79c2b1de2..e02f2c702 100644 --- a/Phase/Mscorlib/system/ByteArray.hx +++ b/Phase/Mscorlib/system/ByteArray.hx @@ -12,6 +12,8 @@ abstract ByteArray(js.html.Uint8Array) public var length(get, never):Int32; public inline function get_length() : Int32 return this.length; + + public inline function clone() : ByteArray return untyped this.slice(); @:op([]) public inline function get(index:Int32):Byte return this[index.toHaxeInt()]; @:op([]) public inline function set(index:Int32, val:Byte):Byte return this[index.toHaxeInt()] = val.toHaxeInt(); diff --git a/Phase/Mscorlib/system/CharArray.hx b/Phase/Mscorlib/system/CharArray.hx index f2b95d184..7cab3f739 100644 --- a/Phase/Mscorlib/system/CharArray.hx +++ b/Phase/Mscorlib/system/CharArray.hx @@ -9,6 +9,8 @@ abstract CharArray(js.html.Uint16Array) public var length(get, never):Int32; public inline function get_length() : Int32 return this.length; + + public inline function clone() : CharArray return untyped this.slice(); @:op([]) public inline function get(index:Int32):Char return this[index.toHaxeInt()]; @:op([]) public inline function set(index:Int32, val:Char):Char return this[index.toHaxeInt()] = val.toHaxeInt(); diff --git a/Phase/Mscorlib/system/CsType.hx b/Phase/Mscorlib/system/CsType.hx index 41a362853..72ada7878 100644 --- a/Phase/Mscorlib/system/CsType.hx +++ b/Phase/Mscorlib/system/CsType.hx @@ -1,8 +1,8 @@ package system; -abstract CsType(Class) from Class to Class +abstract CsType(Class) from Class to Class { - public function new(cls : Class) this = cls; + public function new(cls : Class) this = cls; public var name(get,never):CsString; public function get_name() : CsString @@ -11,9 +11,9 @@ abstract CsType(Class) from Class to Class var i = fullName.lastIndexOf("."); return i >= 0 ? fullName.substring(i + 1) : fullName; } + + @:op(A == B) public inline static function eq(lhs : CsType, rhs : CsType) : system.Boolean return Type.getClassName(lhs) == Type.getClassName(rhs); - @:op(A == B) public inline static function eq(lhs : CsType, rhs : CsType) : system.Boolean return Type.getClassName(lhs) == Type.getClassName(rhs); - - @:op(A != B) public inline static function neq(lhs : CsType, rhs : CsType) : system.Boolean return Type.getClassName(lhs) != Type.getClassName(rhs); + @:op(A != B) public inline static function neq(lhs : CsType, rhs : CsType) : system.Boolean return Type.getClassName(lhs) != Type.getClassName(rhs); } \ No newline at end of file diff --git a/Phase/Mscorlib/system/DoubleArray.hx b/Phase/Mscorlib/system/DoubleArray.hx index 4774eff14..7acc5c79f 100644 --- a/Phase/Mscorlib/system/DoubleArray.hx +++ b/Phase/Mscorlib/system/DoubleArray.hx @@ -9,6 +9,8 @@ abstract DoubleArray(js.html.Float64Array) public var length(get, never):Int32; public inline function get_length() : Int32 return this.length; + + public inline function clone() : DoubleArray return untyped this.slice(); @:op([]) public inline function get(index:Int32):Double return this[index.toHaxeInt()]; @:op([]) public inline function set(index:Int32, val:Double):Double return this[index.toHaxeInt()] = val.toHaxeFloat(); diff --git a/Phase/Mscorlib/system/FixedArray.hx b/Phase/Mscorlib/system/FixedArray.hx index 6344f58e2..baf18db17 100644 --- a/Phase/Mscorlib/system/FixedArray.hx +++ b/Phase/Mscorlib/system/FixedArray.hx @@ -14,6 +14,8 @@ abstract FixedArray(Array) to Array public var length(get, never):Int32; public inline function get_length() : Int32 return this.length; + + public inline function clone() : FixedArray return this.slice(0); @:op([]) public inline function get(index:Int32):T return this[index.toHaxeInt()]; @:op([]) public inline function set(index:Int32, val:T):T return this[index.toHaxeInt()] = val; diff --git a/Phase/Mscorlib/system/Int16Array.hx b/Phase/Mscorlib/system/Int16Array.hx index 3a9716263..23c45932f 100644 --- a/Phase/Mscorlib/system/Int16Array.hx +++ b/Phase/Mscorlib/system/Int16Array.hx @@ -9,6 +9,8 @@ abstract Int16Array(js.html.Int16Array) public var length(get, never):Int32; public inline function get_length() : Int32 return this.length; + + public inline function clone() : Int16Array return untyped this.slice(); @:op([]) public inline function get(index:Int32):Int16 return this[index.toHaxeInt()]; @:op([]) public inline function set(index:Int32, val:Int16):Int16 return this[index.toHaxeInt()] = val.toHaxeInt(); diff --git a/Phase/Mscorlib/system/Int32Array.hx b/Phase/Mscorlib/system/Int32Array.hx index cab8ab57c..c068a8571 100644 --- a/Phase/Mscorlib/system/Int32Array.hx +++ b/Phase/Mscorlib/system/Int32Array.hx @@ -9,6 +9,8 @@ abstract Int32Array(js.html.Int32Array) public var length(get, never):Int32; public inline function get_length() : Int32 return this.length; + + public inline function clone() : Int32Array return untyped this.slice(); @:op([]) public inline function get(index:Int32):Int32 return this[index.toHaxeInt()]; @:op([]) public inline function set(index:Int32, val:Int32):Int32 return this[index.toHaxeInt()] = val.toHaxeInt(); diff --git a/Phase/Mscorlib/system/Int64Array.hx b/Phase/Mscorlib/system/Int64Array.hx index ede43ffa9..6e694b07d 100644 --- a/Phase/Mscorlib/system/Int64Array.hx +++ b/Phase/Mscorlib/system/Int64Array.hx @@ -9,6 +9,8 @@ abstract Int64Array(js.html.Int32Array) public var length(get, never):Int32; public inline function get_length() : Int32 return this.length; + + public inline function clone() : Int64Array return untyped this.slice(); @:op([]) public inline function get(index:Int32):Int64 return this[index.toHaxeInt()]; @:op([]) public inline function set(index:Int32, val:Int64):Int64 return this[index.toHaxeInt()] = val.toHaxeFloat(); diff --git a/Phase/Mscorlib/system/ObjectExtensions.hx b/Phase/Mscorlib/system/ObjectExtensions.hx index 9d0a65ceb..cf2a60338 100644 --- a/Phase/Mscorlib/system/ObjectExtensions.hx +++ b/Phase/Mscorlib/system/ObjectExtensions.hx @@ -4,7 +4,10 @@ class ObjectExtensions { public static inline function toString(v:system.Object) : CsString return Std.string(v); public static inline function referenceEquals(a:system.Object, b:system.Object) : system.Boolean return a == b; - public static inline function getType(a:T) : system.CsType return new system.CsType(Type.getClass(a)); + public static inline function getType(a:T) : system.CsType return new system.CsType(Type.getClass(a)); + + public static inline function forIn(obj:Any, body:CsString->Void) : Void + untyped __js__( "for( var $k in {0} ) {1}", obj, body(untyped $k) ); public static function equals_Object(left:T1, right:T2) : Bool { diff --git a/Phase/Mscorlib/system/SByteArray.hx b/Phase/Mscorlib/system/SByteArray.hx index e9c1e1b27..d77b6b1bd 100644 --- a/Phase/Mscorlib/system/SByteArray.hx +++ b/Phase/Mscorlib/system/SByteArray.hx @@ -9,6 +9,8 @@ abstract SByteArray(js.html.Int8Array) public var length(get, never):Int32; public inline function get_length() : Int32 return this.length; + + public inline function clone() : SByteArray return untyped this.slice(); @:op([]) public inline function get(index:Int32):SByte return this[index.toHaxeInt()]; @:op([]) public inline function set(index:Int32, val:SByte):SByte return this[index.toHaxeInt()] = val.toHaxeFloat(); diff --git a/Phase/Mscorlib/system/SingleArray.hx b/Phase/Mscorlib/system/SingleArray.hx index 115784c23..60cd666b9 100644 --- a/Phase/Mscorlib/system/SingleArray.hx +++ b/Phase/Mscorlib/system/SingleArray.hx @@ -9,6 +9,8 @@ abstract SingleArray(js.html.Float32Array) public var length(get, never):Int32; public inline function get_length() : Int32 return this.length; + + public inline function clone() : SingleArray return untyped this.slice(); @:op([]) public inline function get(index:Int32):Single return this[index.toHaxeInt()]; @:op([]) public inline function set(index:Int32, val:Single):Single return this[index.toHaxeInt()] = val.toHaxeFloat(); diff --git a/Phase/Mscorlib/system/UInt16Array.hx b/Phase/Mscorlib/system/UInt16Array.hx index 9024e3c34..77d2e2943 100644 --- a/Phase/Mscorlib/system/UInt16Array.hx +++ b/Phase/Mscorlib/system/UInt16Array.hx @@ -10,6 +10,8 @@ abstract UInt16Array(js.html.Uint16Array) public var length(get, never):Int32; public inline function get_length() : Int32 return this.length; + public inline function clone() : UInt16Array return untyped this.slice(); + @:op([]) public inline function get(index:Int32):UInt16 return this[index.toHaxeInt()]; @:op([]) public inline function set(index:Int32, val:UInt16):UInt16 return this[index.toHaxeInt()] = val.toHaxeFloat(); diff --git a/Phase/Mscorlib/system/UInt32Array.hx b/Phase/Mscorlib/system/UInt32Array.hx index 288ba66b2..28c32a90e 100644 --- a/Phase/Mscorlib/system/UInt32Array.hx +++ b/Phase/Mscorlib/system/UInt32Array.hx @@ -9,6 +9,8 @@ abstract UInt32Array(js.html.Uint32Array) public var length(get, never):Int32; public inline function get_length() : Int32 return this.length; + + public inline function clone() : UInt32Array return untyped this.slice(); @:op([]) public inline function get(index:Int32):UInt32 return this[index.toHaxeInt()]; @:op([]) public inline function set(index:Int32, val:UInt32):UInt32 return this[index.toHaxeInt()] = val.toHaxeFloat(); diff --git a/Phase/Mscorlib/system/UInt64Array.hx b/Phase/Mscorlib/system/UInt64Array.hx index c07460707..7ea3f6bd6 100644 --- a/Phase/Mscorlib/system/UInt64Array.hx +++ b/Phase/Mscorlib/system/UInt64Array.hx @@ -9,6 +9,8 @@ abstract UInt64Array(js.html.UInt32Array) public var length(get, never):Int32; public inline function get_length() : Int32 return this.length; + + public inline function clone() : UInt64Array return untyped this.slice(); @:op([]) public inline function get(index:Int32):UInt64 return this[index.toHaxeInt()]; @:op([]) public inline function set(index:Int32, val:UInt64):UInt64 return this[index.toHaxeInt()] = val.toHaxeFloat(); diff --git a/Samples/CSharp/AlphaTab.Samples.PngDump/Program.cs b/Samples/CSharp/AlphaTab.Samples.PngDump/Program.cs index f1da2231c..f3b685fa7 100644 --- a/Samples/CSharp/AlphaTab.Samples.PngDump/Program.cs +++ b/Samples/CSharp/AlphaTab.Samples.PngDump/Program.cs @@ -22,8 +22,8 @@ private static void Main(string[] args) var score = ScoreLoader.LoadScoreFromBytes(File.ReadAllBytes(args[0])); // render score with svg engine and desired rendering width - var settings = Settings.Defaults; - settings.Engine = "skia"; + var settings = new Settings(); + settings.Core.Engine = "skia"; var renderer = new ScoreRenderer(settings); renderer.Width = 970; diff --git a/Source/AlphaTab.CSharp/Platform/CSharp/GdiCanvas.cs b/Source/AlphaTab.CSharp/Platform/CSharp/GdiCanvas.cs index 152f9b90b..c590dfda5 100644 --- a/Source/AlphaTab.CSharp/Platform/CSharp/GdiCanvas.cs +++ b/Source/AlphaTab.CSharp/Platform/CSharp/GdiCanvas.cs @@ -148,7 +148,7 @@ public Font Font fs |= FontStyle.Italic; } - return new Font(_font.FontFamily.Name, _font.Size * Settings.Scale, fs); + return new Font(_font.FontFamily.Name, _font.Size * Settings.Display.Scale, fs); } set { @@ -163,7 +163,7 @@ public Font Font fontStyle = GdiFontStyle.Italic; } - _font = new GdiFont(value.Family, value.Size * Settings.Scale, fontStyle, GraphicsUnit.Pixel); + _font = new GdiFont(value.Family, value.Size * Settings.Display.Scale, fontStyle, GraphicsUnit.Pixel); } } diff --git a/Source/AlphaTab.CSharp/Platform/CSharp/ManagedUiFacade.cs b/Source/AlphaTab.CSharp/Platform/CSharp/ManagedUiFacade.cs index 9bde2fa7c..26171c332 100644 --- a/Source/AlphaTab.CSharp/Platform/CSharp/ManagedUiFacade.cs +++ b/Source/AlphaTab.CSharp/Platform/CSharp/ManagedUiFacade.cs @@ -40,7 +40,7 @@ public IScoreRenderer CreateWorkerRenderer() public IAlphaSynth CreateWorkerPlayer() { - var player = new ManagedThreadAlphaSynthWorkerApi(CreateSynthOutput(), Api.Settings.LogLevel, BeginInvoke); + var player = new ManagedThreadAlphaSynthWorkerApi(CreateSynthOutput(), Api.Settings.Core.LogLevel, BeginInvoke); player.Ready += () => { using (var sf = diff --git a/Source/AlphaTab.CSharp/Platform/CSharp/SkiaCanvas.cs b/Source/AlphaTab.CSharp/Platform/CSharp/SkiaCanvas.cs index 4eb319c89..7d8c99617 100644 --- a/Source/AlphaTab.CSharp/Platform/CSharp/SkiaCanvas.cs +++ b/Source/AlphaTab.CSharp/Platform/CSharp/SkiaCanvas.cs @@ -74,14 +74,14 @@ public SKTypeface TypeFace { get { - if (_typeFaceCache != Font.ToCssString(Settings.Scale)) + if (_typeFaceCache != Font.ToCssString(Settings.Display.Scale)) { if (_typeFace != null) { _typeFace.Dispose(); } - _typeFaceCache = Font.ToCssString(Settings.Scale); + _typeFaceCache = Font.ToCssString(Settings.Display.Scale); _typeFace = SKTypeface.FromFamilyName(Font.Family, Font.IsBold ? SKFontStyleWeight.Bold : SKFontStyleWeight.Normal, SKFontStyleWidth.Normal, @@ -242,7 +242,7 @@ public void FillText(string text, float x, float y) using (var paint = CreatePaint()) { paint.Typeface = TypeFace; - paint.TextSize = Font.Size * Settings.Scale; + paint.TextSize = Font.Size * Settings.Display.Scale; switch (TextAlign) { case TextAlign.Left: diff --git a/Source/AlphaTab.CSharp/Platform/CSharp/WinForms/AlphaTabControl.cs b/Source/AlphaTab.CSharp/Platform/CSharp/WinForms/AlphaTabControl.cs index d5382f387..cd48a6426 100644 --- a/Source/AlphaTab.CSharp/Platform/CSharp/WinForms/AlphaTabControl.cs +++ b/Source/AlphaTab.CSharp/Platform/CSharp/WinForms/AlphaTabControl.cs @@ -72,9 +72,9 @@ public AlphaTabControl() AutoScroll = true; Controls.Add(_layoutPanel); - Settings = Settings.Defaults; - Settings.EnablePlayer = true; - Settings.EnableCursor = true; + Settings = new Settings(); + Settings.Player.EnablePlayer = true; + Settings.Player.EnableCursor = true; Api = new AlphaTabApi(new WinFormsUiFacade(this, _layoutPanel), this); } diff --git a/Source/AlphaTab.CSharp/Platform/CSharp/Wpf/AlphaTab.cs b/Source/AlphaTab.CSharp/Platform/CSharp/Wpf/AlphaTab.cs index d84b946a9..aa8e67dcb 100644 --- a/Source/AlphaTab.CSharp/Platform/CSharp/Wpf/AlphaTab.cs +++ b/Source/AlphaTab.CSharp/Platform/CSharp/Wpf/AlphaTab.cs @@ -67,7 +67,7 @@ public IEnumerable Tracks #region Settings public static readonly DependencyProperty SettingsProperty = DependencyProperty.Register( - "Settings", typeof(Settings), typeof(AlphaTab), new PropertyMetadata(Settings.Defaults, OnSettingsChanged)); + "Settings", typeof(Settings), typeof(AlphaTab), new PropertyMetadata(new Settings(), OnSettingsChanged)); private static void OnSettingsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { @@ -127,9 +127,9 @@ public Brush SelectionFill public AlphaTab() { SnapsToDevicePixels = true; - Settings = Settings.Defaults; - Settings.EnablePlayer = true; - Settings.EnableCursor = true; + Settings = new Settings(); + Settings.Player.EnablePlayer = true; + Settings.Player.EnableCursor = true; } public override void OnApplyTemplate() diff --git a/Source/AlphaTab.CSharp/Settings.cs b/Source/AlphaTab.CSharp/Settings.cs deleted file mode 100644 index 9c49ea569..000000000 --- a/Source/AlphaTab.CSharp/Settings.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace AlphaTab -{ - /// - /// This public class contains instance specific settings for alphaTab - /// - public partial class Settings - { - // ReSharper disable once UnusedParameter.Local - private static void SetDefaults(Settings settings) - { - } - } -} diff --git a/Source/AlphaTab.JavaScript/Importer/ScoreLoader.cs b/Source/AlphaTab.JavaScript/Importer/ScoreLoader.cs index cd2f99172..0144c49f3 100644 --- a/Source/AlphaTab.JavaScript/Importer/ScoreLoader.cs +++ b/Source/AlphaTab.JavaScript/Importer/ScoreLoader.cs @@ -26,6 +26,10 @@ public static void LoadScoreAsync( Action error, Settings settings = null) { + if (settings == null) + { + settings = new Settings(); + } var xhr = new XMLHttpRequest(); xhr.Open("GET", path, true); xhr.ResponseType = XMLHttpRequestResponseType.ARRAYBUFFER; diff --git a/Source/AlphaTab.JavaScript/PhaseCompilerExtension.cs b/Source/AlphaTab.JavaScript/PhaseCompilerExtension.cs new file mode 100644 index 000000000..55f086998 --- /dev/null +++ b/Source/AlphaTab.JavaScript/PhaseCompilerExtension.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using AlphaTab.Util; +using Phase.Attributes; +using Phase.CompilerServices; + +namespace AlphaTab +{ + [External] + public class PhaseCompilerExtension : ICompilerExtension + { + public void Run(ICompilerContext context) + { + context.Attributes.Type() + .Add(new MetaAttribute("@json"), new ExternalAttribute()); + context.Attributes.Type() + .Add(new MetaAttribute("@immutable"), new ExternalAttribute()); + context.Attributes.Type() + .Add(new MetaAttribute("@:build(alphaTab.JsonSerializationBuilder.build())"), new ExternalAttribute()); + } + } +} diff --git a/Source/AlphaTab.JavaScript/Platform/JavaScript/AlphaTabApi.cs b/Source/AlphaTab.JavaScript/Platform/JavaScript/AlphaTabApi.cs index 6d13704b2..7b8c997b8 100644 --- a/Source/AlphaTab.JavaScript/Platform/JavaScript/AlphaTabApi.cs +++ b/Source/AlphaTab.JavaScript/Platform/JavaScript/AlphaTabApi.cs @@ -46,7 +46,7 @@ public void Print(string width) } else { - if (Settings.Layout.Mode == "horizontal") + if (Settings.Display.LayoutMode == LayoutMode.Horizontal) { a4.Style.Width = "297mm"; } @@ -86,13 +86,14 @@ public void Print(string width) preview.Focus(); // render alphaTab - var settings = Settings.Defaults; - settings.ScriptFile = Settings.ScriptFile; - settings.FontDirectory = Settings.FontDirectory; - settings.Scale = 0.8f; - settings.StretchForce = 0.8f; - settings.EnableLazyLoading = false; - settings.UseWorkers = false; + var settings = new Settings(); + settings.Core.ScriptFile = Settings.Core.ScriptFile; + settings.Core.FontDirectory = Settings.Core.FontDirectory; + settings.Core.EnableLazyLoading = false; + settings.Core.UseWorkers = false; + + settings.Display.Scale = 0.8f; + settings.Display.StretchForce = 0.8f; var alphaTab = new AlphaTabApi(a4, settings); alphaTab.Renderer.PostRenderFinished += () => @@ -103,16 +104,6 @@ public void Print(string width) alphaTab.RenderTracks(Tracks); } - public override void UpdateLayout(LayoutSettings layoutSettings) - { - if (!(layoutSettings is LayoutSettings)) - { - layoutSettings = Settings.LayoutFromJson(layoutSettings); - } - - base.UpdateLayout(layoutSettings); - } - public void DownloadMidi() { var midiFile = new MidiFile(); @@ -169,11 +160,21 @@ private Track[] TrackIndexesToTracks(int[] trackIndexes) } var tracks = new FastList(); - foreach (var index in trackIndexes) + if (trackIndexes.Length == 1 && trackIndexes[0] == -1) + { + foreach (var track in Score.Tracks) + { + tracks.Add(track); + } + } + else { - if (index >= 0 && index < Score.Tracks.Count) + foreach (var index in trackIndexes) { - tracks.Add(Score.Tracks[index]); + if (index >= 0 && index < Score.Tracks.Count) + { + tracks.Add(Score.Tracks[index]); + } } } diff --git a/Source/AlphaTab.JavaScript/Platform/JavaScript/AlphaTabWebWorker.cs b/Source/AlphaTab.JavaScript/Platform/JavaScript/AlphaTabWebWorker.cs index 4096ec682..9e5f62bc3 100644 --- a/Source/AlphaTab.JavaScript/Platform/JavaScript/AlphaTabWebWorker.cs +++ b/Source/AlphaTab.JavaScript/Platform/JavaScript/AlphaTabWebWorker.cs @@ -1,8 +1,10 @@ using System; +using AlphaTab.Collections; using AlphaTab.Haxe; using AlphaTab.Haxe.Js; using AlphaTab.Haxe.Js.Html; using AlphaTab.Model; +using AlphaTab.Platform.Svg; using AlphaTab.Rendering; using AlphaTab.Util; @@ -31,8 +33,9 @@ private void HandleMessage(Event e) switch (cmd) { case "alphaTab.initialize": - Settings settings = Settings.FromJson(data.settings, null); - Logger.LogLevel = settings.LogLevel; + var settings = new Settings(); + settings.FillFromJson(data.settings); + Logger.LogLevel = settings.Core.LogLevel; _renderer = new ScoreRenderer(settings); _renderer.PartialRenderFinished += result => _main.PostMessage(new { @@ -66,6 +69,7 @@ private void HandleMessage(Event e) _renderer.Width = data.width; break; case "alphaTab.renderScore": + UpdateFontSizes(data.fontSizes); var score = JsonConverter.JsObjectToScore(data.score, _renderer.Settings); RenderMultiple(score, data.trackIndexes); break; @@ -75,9 +79,26 @@ private void HandleMessage(Event e) } } - private void UpdateSettings(object settings) + private void UpdateFontSizes(object fontSizes) { - _renderer.UpdateSettings(Settings.FromJson(settings, null)); + if (fontSizes != null) + { + if (FontSizes.FontSizeLookupTables == null) + { + FontSizes.FontSizeLookupTables = new FastDictionary(); + } + + var keys = Platform.JsonKeys(fontSizes); + foreach (var font in keys) + { + FontSizes.FontSizeLookupTables[font] = fontSizes.Member(font); + } + } + } + + private void UpdateSettings(object json) + { + _renderer.Settings.FillFromJson(json); } private void RenderMultiple(Score score, int[] trackIndexes) diff --git a/Source/AlphaTab.JavaScript/Platform/JavaScript/AlphaTabWorkerScoreRenderer.cs b/Source/AlphaTab.JavaScript/Platform/JavaScript/AlphaTabWorkerScoreRenderer.cs index 337c633ea..0e3494579 100644 --- a/Source/AlphaTab.JavaScript/Platform/JavaScript/AlphaTabWorkerScoreRenderer.cs +++ b/Source/AlphaTab.JavaScript/Platform/JavaScript/AlphaTabWorkerScoreRenderer.cs @@ -1,6 +1,8 @@ using System; +using System.Configuration; using AlphaTab.Haxe.Js.Html; using AlphaTab.Model; +using AlphaTab.Platform.Svg; using AlphaTab.Rendering; using AlphaTab.Rendering.Utils; using AlphaTab.Util; @@ -21,14 +23,14 @@ public AlphaTabWorkerScoreRenderer(AlphaTabApi api, Settings settings) _api = api; try { - _worker = new Worker(settings.ScriptFile); + _worker = new Worker(settings.Core.ScriptFile); } catch { // fallback to blob worker try { - HaxeString script = "importScripts('" + settings.ScriptFile + "')"; + HaxeString script = "importScripts('" + settings.Core.ScriptFile + "')"; var blob = new Blob(new[] { script @@ -45,7 +47,7 @@ public AlphaTabWorkerScoreRenderer(AlphaTabApi api, Settings settings) _worker.PostMessage(new { cmd = "alphaTab.initialize", - settings = settings.ToJson() + settings = SerializeSettingsForWorker(settings) }); _worker.AddEventListener("message", (Action)(HandleWorkerMessage)); } @@ -60,10 +62,20 @@ public void UpdateSettings(Settings settings) _worker.PostMessage(new { cmd = "alphaTab.updateSettings", - settings = settings.ToJson() + settings = SerializeSettingsForWorker(settings) }); } + private object SerializeSettingsForWorker(Settings settings) + { + dynamic json = Settings.ToJson(settings); + + // cut out player settings, they are only needed on UI thread side + json.player = null; + + return json; + } + public void Render() { _worker.PostMessage(new @@ -126,7 +138,8 @@ public void RenderScore(Score score, int[] trackIndexes) { cmd = "alphaTab.renderScore", score = jsObject, - trackIndexes = trackIndexes + trackIndexes = trackIndexes, + fontSizes = FontSizes.FontSizeLookupTables }); } diff --git a/Source/AlphaTab.JavaScript/Platform/JavaScript/Html5Canvas.cs b/Source/AlphaTab.JavaScript/Platform/JavaScript/Html5Canvas.cs index a852cbdbe..cfbfed9f1 100644 --- a/Source/AlphaTab.JavaScript/Platform/JavaScript/Html5Canvas.cs +++ b/Source/AlphaTab.JavaScript/Platform/JavaScript/Html5Canvas.cs @@ -172,10 +172,10 @@ public Font Font _font = value; if (_context != null) { - _context.Font = value.ToCssString(Settings.Scale); + _context.Font = value.ToCssString(Settings.Display.Scale); } - _measureContext.Font = value.ToCssString(Settings.Scale); + _measureContext.Font = value.ToCssString(Settings.Display.Scale); } } diff --git a/Source/AlphaTab.JavaScript/Platform/JavaScript/JQueryAlphaTab.cs b/Source/AlphaTab.JavaScript/Platform/JavaScript/JQueryAlphaTab.cs index ca8e7c454..325c19246 100644 --- a/Source/AlphaTab.JavaScript/Platform/JavaScript/JQueryAlphaTab.cs +++ b/Source/AlphaTab.JavaScript/Platform/JavaScript/JQueryAlphaTab.cs @@ -121,22 +121,8 @@ public void Tex(JQuery element, AlphaTabApi context, string tex, int[] tracks) context.Tex(tex, tracks); } - [Name("updateLayout")] - public void UpdateLayout(JQuery element, AlphaTabApi context, LayoutSettings layout) - { - context.UpdateLayout(layout); - } - - [Name("updateSettings")] - public void UpdateLayout(JQuery element, AlphaTabApi context) - { - context.UpdateSettings(); - } - #endregion - - #region Player [Name("muteTrack")] diff --git a/Source/AlphaTab.JavaScript/Platform/Model/Color.cs b/Source/AlphaTab.JavaScript/Platform/Model/Color.cs new file mode 100644 index 000000000..6f4e2c5ad --- /dev/null +++ b/Source/AlphaTab.JavaScript/Platform/Model/Color.cs @@ -0,0 +1,113 @@ +using AlphaTab.Util; +using AlphaTab.Utils; +using Phase; + +namespace AlphaTab.Platform.Model +{ + [JsonImmutable] + public partial class Color + { + public static Color FromJson(object json) + { + if (json == null) + { + return null; + } + + if (json is Color) + { + return (Color)json; + } + + switch (Platform.TypeOf(json)) + { + case "number": + var c = new Color(0, 0, 0, 0); + var raw = json.As(); + c.Raw = (int)raw; + c.UpdateRgba(); + return c; + case "string": + var s = json.As(); + if (s.StartsWith("#")) + { + if (s.Length == 4) // #RGB + { + return new Color( + (byte)(Platform.ParseHex(s.Substring(1, 1)) * 17), + (byte)(Platform.ParseHex(s.Substring(2, 1)) * 17), + (byte)(Platform.ParseHex(s.Substring(3, 1)) * 17) + ); + } + + if (s.Length == 5) // #RGBA + { + return new Color( + (byte)(Platform.ParseHex(s.Substring(1, 1)) * 17), + (byte)(Platform.ParseHex(s.Substring(2, 1)) * 17), + (byte)(Platform.ParseHex(s.Substring(3, 1)) * 17), + (byte)(Platform.ParseHex(s.Substring(4, 1)) * 17) + ); + } + + if (s.Length == 7) // #RRGGBB + { + return new Color( + (byte)Platform.ParseHex(s.Substring(1, 2)), + (byte)Platform.ParseHex(s.Substring(3, 2)), + (byte)Platform.ParseHex(s.Substring(5, 2)) + ); + } + + if (s.Length == 9) // #RRGGBBAA + { + return new Color( + (byte)Platform.ParseHex(s.Substring(1, 2)), + (byte)Platform.ParseHex(s.Substring(3, 2)), + (byte)Platform.ParseHex(s.Substring(5, 2)), + (byte)Platform.ParseHex(s.Substring(7, 2)) + ); + } + } + else if (s.StartsWith("rgba") || s.StartsWith("rgb")) + { + var start = s.IndexOf("("); + var end = s.LastIndexOf(")"); + if (start == -1 || end == -1) + { + throw new SerializationException("No values specified for rgb/rgba function"); + } + + var numbers = s.Substring(start + 1, end - start - 1).Split(','); + if (numbers.Length == 3) + { + return new Color( + (byte)Platform.ParseInt(numbers[0]), + (byte)Platform.ParseInt(numbers[1]), + (byte)Platform.ParseInt(numbers[2]) + ); + } + + if (numbers.Length == 4) + { + return new Color( + (byte)Platform.ParseInt(numbers[0]), + (byte)Platform.ParseInt(numbers[1]), + (byte)Platform.ParseInt(numbers[2]), + (byte)(Platform.ParseFloat(numbers[3]) * 255) + ); + } + } + + break; + } + + throw new SerializationException("Unsupported format for color"); + } + + public static object ToJson(Color obj) + { + return obj.Raw; + } + } +} diff --git a/Source/AlphaTab.JavaScript/Platform/Model/Font.cs b/Source/AlphaTab.JavaScript/Platform/Model/Font.cs new file mode 100644 index 000000000..c27822c75 --- /dev/null +++ b/Source/AlphaTab.JavaScript/Platform/Model/Font.cs @@ -0,0 +1,141 @@ +using System; +using AlphaTab.Collections; +using AlphaTab.Haxe.Js; +using AlphaTab.Util; +using AlphaTab.Utils; +using Phase; + +namespace AlphaTab.Platform.Model +{ + public partial class Font + { + public static Font FromJson(object value) + { + if (value == null) + { + return null; + } + + if (value is Font) + { + return (Font)value; + } + + if (Platform.TypeOf(value) == "object" && value.Member("family")) + { + return new Font(value.Member("family"), + value.Member("size"), + (FontStyle)value.Member("style")); + } + + if (Platform.TypeOf(value) == "string" && Lib.Global.document) + { + var fontText = value.As(); + var el = Browser.Document.CreateElement("span"); + el.SetAttribute("style", "font: " + fontText); + + var style = el.Style; + + if (string.IsNullOrEmpty(style.FontFamily)) + { + style.FontFamily = "sans-serif"; + } + + string family = style.FontFamily; + if (family.StartsWith("'") && family.EndsWith("'") || family.StartsWith("\"") && family.EndsWith("\"")) + { + family = family.Substring(1, family.Length - 2); + } + + string fontSizeString = style.FontSize.ToLowerCase(); + float fontSize; + // as per https://websemantics.uk/articles/font-size-conversion/ + switch (fontSizeString) + { + case "xx-small": + fontSize = 7; + break; + case "x-small": + fontSize = 10; + break; + case "small": + case "smaller": + fontSize = 13; + break; + case "medium": + fontSize = 16; + break; + case "large": + case "larger": + fontSize = 18; + break; + case "x-large": + fontSize = 24; + break; + case "xx-large": + fontSize = 32; + break; + default: + try + { + if (fontSizeString.EndsWith("em")) + { + fontSize = Platform.ParseFloat( + fontSizeString.Substring(0, fontSizeString.Length - 2)) * 16; + } + else if (fontSizeString.EndsWith("pt")) + { + fontSize = Platform.ParseFloat( + fontSizeString.Substring(0, fontSizeString.Length - 2)) * 16.0f / 12.0f; + } + else if (fontSizeString.EndsWith("px")) + { + fontSize = Platform.ParseFloat( + fontSizeString.Substring(0, fontSizeString.Length - 2)); + } + else + { + fontSize = 12; + } + } + catch + { + fontSize = 12; + } + + break; + } + + var fontStyle = FontStyle.Plain; + if (style.FontStyle == "italic") + { + fontStyle |= FontStyle.Italic; + } + + string fontWeightString = style.FontWeight.ToLowerCase(); + switch (fontWeightString) + { + case "normal": + case "lighter": + break; + default: + fontStyle |= FontStyle.Bold; + break; + } + + return new Font(family, fontSize, fontStyle); + } + + throw new SerializationException("Unsupported value for Font"); + } + + public static object ToJson(Font font) + { + var json = Platform.NewObject(); + json.family = font.Family; + json.size = font.Size; + json.style = (int)font.Style; + return json; + } + } +} diff --git a/Source/AlphaTab.JavaScript/Platform/Platform.cs b/Source/AlphaTab.JavaScript/Platform/Platform.cs index 88db5c9ac..401bdde65 100644 --- a/Source/AlphaTab.JavaScript/Platform/Platform.cs +++ b/Source/AlphaTab.JavaScript/Platform/Platform.cs @@ -43,6 +43,32 @@ public static string GetCallerName() return Script.Write("untyped __js__(\"arguments.callee.caller.caller.name\")"); } + public static bool EqualsAny(string value, string[] values) + { + foreach (var x in values) + { + if (value == x) + { + return true; + } + } + + return false; + } + + public static string FindStartsWith(string value, string[] values) + { + foreach (var x in values) + { + if (value.StartsWith(x)) + { + return x; + } + } + + return null; + } + public static void Log(LogLevel logLevel, string category, string msg, object details = null) { // ReSharper disable once RedundantAssignment diff --git a/Source/AlphaTab.JavaScript/Settings.cs b/Source/AlphaTab.JavaScript/Settings.cs index f40beeade..d8a8d3bb1 100644 --- a/Source/AlphaTab.JavaScript/Settings.cs +++ b/Source/AlphaTab.JavaScript/Settings.cs @@ -1,1149 +1,66 @@ -using AlphaTab.Collections; +using AlphaTab.Collections; using AlphaTab.Haxe.Js; -using AlphaTab.Platform; -using AlphaTab.Platform.Model; -using AlphaTab.Platform.Svg; -using AlphaTab.Rendering; using AlphaTab.Util; using Phase; namespace AlphaTab { - /// - /// This public class contains instance specific settings for alphaTab - /// - public partial class Settings - { - public string ScriptFile - { - get; - set; - } - - public string FontDirectory - { - get; - set; - } - - /// - /// Gets or sets whether lazy loading for displayed elements is enabled. - /// - public bool EnableLazyLoading { get; set; } - - public string SoundFontFile - { - get; - set; - } - - public string ScrollElement - { - get; - set; - } - - private static void SetDefaults(Settings settings) - { - settings.ScrollElement = "html,body"; - settings.EnableLazyLoading = true; - } - - public static void FillPlayerOptions( - Settings settings, - dynamic json, - bool setDefaults, - FastDictionary dataAttributes = null) - { - if (Platform.Platform.JsonExists(json, "cursor")) - { - settings.EnableCursor = json.cursor; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("cursor")) - { - settings.EnableCursor = (bool)dataAttributes["cursor"]; - } - else if (setDefaults) - { - settings.EnableCursor = true; - } - - if (settings.EnableCursor) - { - if (Platform.Platform.JsonExists(json, "playerOffset")) - { - FillCursorOffset(settings, json.playerOffset); - } - else if (dataAttributes != null && dataAttributes.ContainsKey("playerOffset")) - { - FillCursorOffset(settings, dataAttributes["playerOffset"]); - } - } - - if (Platform.Platform.JsonExists(json, "autoScroll")) - { - settings.ScrollMode = DecodeScrollMode(json.autoScroll); - } - else if (dataAttributes != null && dataAttributes.ContainsKey("autoScroll")) - { - settings.ScrollMode = DecodeScrollMode(dataAttributes["autoScroll"]); - } - - if (Platform.Platform.JsonExists(json, "scrollSpeed")) - { - settings.ScrollSpeed = json.scrollSpeed; - } - else if (setDefaults) - { - settings.ScrollSpeed = 300; - } - - if (Platform.Platform.JsonExists(json, "scrollElement")) - { - settings.ScrollElement = json.scrollElement; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("scrollElement")) - { - settings.ScrollElement = (string)dataAttributes["scrollElement"]; - } - else if (setDefaults) - { - settings.ScrollElement = "html,body"; - } - - if (Platform.Platform.JsonExists(json, "beatCursorWidth")) - { - settings.BeatCursorWidth = json.beatCursorWidth; - } - else if (setDefaults) - { - settings.BeatCursorWidth = 3; - } - } - - public dynamic ToJson() - { - var json = Platform.Platform.NewObject(); - - json.useWorker = UseWorkers; - json.scale = Scale; - json.slurHeight = SlurHeight; - json.engine = Engine; - json.stretchForce = StretchForce; - json.forcePianoFingering = ForcePianoFingering; - json.transpositionPitches = TranspositionPitches; - json.displayTranspositionPitches = DisplayTranspositionPitches; - json.logging = LogLevel; - json.smallGraceTabNotes = SmallGraceTabNotes; - json.extendBendArrowsOnTiedNotes = ExtendBendArrowsOnTiedNotes; - json.showParenthesisForTiedBends = ShowParenthesisForTiedBends; - json.showTabNoteOnTiedBend = ShowTabNoteOnTiedBend; - json.displayMode = DisplayMode; - json.fingeringMode = FingeringMode; - json.showZeroOnDiveWhammy = ShowZeroOnDiveWhammy; - json.extendLineEffectsToBeatEnd = ExtendLineEffectsToBeatEnd; - json.songBookBendDuration = SongBookBendDuration; - json.songBookDipDuration = SongBookDipDuration; - - json.scriptFile = ScriptFile; - json.fontDirectory = FontDirectory; - json.lazy = EnableLazyLoading; - - json.includeNoteBounds = IncludeNoteBounds; - - json.playTripletFeel = PlayTripletFeel; - json.vibrato = Platform.Platform.NewObject(); - json.noteSlightAmplitude = Vibrato.NoteSlightAmplitude; - json.noteWideAmplitude = Vibrato.NoteWideAmplitude; - json.noteSlightLength = Vibrato.NoteSlightLength; - json.noteWideLength = Vibrato.NoteWideLength; - json.beatSlightAmplitude = Vibrato.BeatSlightAmplitude; - json.beatWideAmplitude = Vibrato.BeatWideAmplitude; - json.beatSlightLength = Vibrato.BeatSlightLength; - json.beatWideLength = Vibrato.BeatWideLength; - - json.layout = Platform.Platform.NewObject(); - json.layout.mode = Layout.Mode; - json.layout.additionalSettings = Platform.Platform.NewObject(); - foreach (var setting in Layout.AdditionalSettings) - { - json.layout.additionalSettings[setting] = Layout.AdditionalSettings[setting]; - } - - json.importer = Platform.Platform.NewObject(); - foreach (var setting in ImporterSettings) - { - json.importer[setting] = ImporterSettings[setting]; - } - - json.staves = Platform.Platform.NewObject(); - json.staves.id = Staves.Id; - json.staves.additionalSettings = Platform.Platform.NewObject(); - - foreach (var additionalSetting in Staves.AdditionalSettings) - { - json.staves.additionalSettings[additionalSetting] = Staves.AdditionalSettings[additionalSetting]; - } - - json.resources = Platform.Platform.NewObject(); - json.resources.CopyrightFont = EncodeFont(RenderingResources.CopyrightFont); - json.resources.TitleFont = EncodeFont(RenderingResources.TitleFont); - json.resources.SubTitleFont = EncodeFont(RenderingResources.SubTitleFont); - json.resources.WordsFont = EncodeFont(RenderingResources.WordsFont); - json.resources.EffectFont = EncodeFont(RenderingResources.EffectFont); - json.resources.FretboardNumberFont = EncodeFont(RenderingResources.FretboardNumberFont); - json.resources.TablatureFont = EncodeFont(RenderingResources.TablatureFont); - json.resources.GraceFont = EncodeFont(RenderingResources.GraceFont); - json.resources.BarNumberFont = EncodeFont(RenderingResources.BarNumberFont); - json.resources.FingeringFont = EncodeFont(RenderingResources.FingeringFont); - json.resources.MarkerFont = EncodeFont(RenderingResources.MarkerFont); - json.resources.StaffLineColor = EncodeColor(RenderingResources.StaffLineColor); - json.resources.BarNumberColor = EncodeColor(RenderingResources.BarNumberColor); - json.resources.BarSeparatorColor = EncodeColor(RenderingResources.BarSeparatorColor); - json.resources.MainGlyphColor = EncodeColor(RenderingResources.MainGlyphColor); - json.resources.SecondaryGlyphColor = EncodeColor(RenderingResources.SecondaryGlyphColor); - json.resources.ScoreInfoColor = EncodeColor(RenderingResources.ScoreInfoColor); - - // include font sizes in serialization! - json.fontSizes = FontSizes.FontSizeLookupTables; - - return json; - } - - public static Settings FromJson(dynamic json, FastDictionary dataAttributes) - { - if (json is Settings) - { - return (Settings)json; - } - - var settings = Defaults; - settings.ScriptFile = Environment.ScriptFile; - - FillFromJson(settings, json, dataAttributes); - - if (json && json.fontSizes) - { - if (FontSizes.FontSizeLookupTables == null) - { - FontSizes.FontSizeLookupTables = new FastDictionary(); - } - - string[] keys = Platform.Platform.JsonKeys(json.fontSizes); - foreach (var font in keys) - { - FontSizes.FontSizeLookupTables[font] = json.fontSizes[font]; - } - } - - return settings; - } - - public static void FillFromJson(Settings settings, dynamic json, FastDictionary dataAttributes) - { - var global = Script.Write("js.Lib.global"); - - // System Settings - - if (global.document && global.ALPHATAB_ROOT) - { - settings.ScriptFile = global.ALPHATAB_ROOT; - settings.ScriptFile = EnsureFullUrl(settings.ScriptFile); - settings.ScriptFile = AppendScriptName(settings.ScriptFile); - } - else - { - settings.ScriptFile = Environment.ScriptFile; - } - - if (global.document && global.ALPHATAB_FONT) - { - settings.FontDirectory = global.ALPHATAB_FONT; - settings.FontDirectory = EnsureFullUrl(settings.FontDirectory); - } - else - { - settings.FontDirectory = settings.ScriptFile; - if (!string.IsNullOrEmpty(settings.FontDirectory)) - { - var lastSlash = settings.FontDirectory.LastIndexOf('/'); - if (lastSlash >= 0) - { - settings.FontDirectory = settings.FontDirectory.Substring(0, lastSlash) + "/Font/"; - } - } - } - - if (Platform.Platform.JsonExists(json, "logging")) - { - settings.LogLevel = DecodeLogLevel(json.logging); - } - else if (dataAttributes != null && dataAttributes.ContainsKey("logging")) - { - settings.LogLevel = DecodeLogLevel(dataAttributes["logging"]); - } - - if (Platform.Platform.JsonExists(json, "useWorker")) - { - settings.UseWorkers = json.useWorker; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("useWorker")) - { - settings.UseWorkers = dataAttributes["useWorker"].IsTruthy(); - } - - // Display settings - - if (Platform.Platform.JsonExists(json, "displayMode")) - { - settings.DisplayMode = DecodeDisplayMode(json.displayMode); - } - else if (dataAttributes != null && dataAttributes.ContainsKey("displayMode")) - { - settings.DisplayMode = DecodeDisplayMode(dataAttributes["displayMode"]); - } - - // Override some defaults on songbook mode - if (settings.DisplayMode == DisplayMode.SongBook) - { - settings.ApplySongBookDefaults(); - } - - if (Platform.Platform.JsonExists(json, "scale")) - { - settings.Scale = json.scale; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("scale")) - { - settings.Scale = dataAttributes["scale"].As(); - } - - if (Platform.Platform.JsonExists(json, "slurHeight")) - { - settings.SlurHeight = json.slurHeight; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("slurHeight")) - { - settings.SlurHeight = dataAttributes["slurHeight"].As(); - } - - if (Platform.Platform.JsonExists(json, "engine")) - { - settings.Engine = json.engine; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("engine")) - { - settings.Engine = dataAttributes["engine"].As(); - } - - if (Platform.Platform.JsonExists(json, "stretchForce")) - { - settings.StretchForce = json.stretchForce; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("stretchForce")) - { - settings.StretchForce = dataAttributes["stretchForce"].As(); - } - - if (Platform.Platform.JsonExists(json, "forcePianoFingering")) - { - settings.ForcePianoFingering = json.forcePianoFingering; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("forcePianoFingering")) - { - settings.ForcePianoFingering = dataAttributes["forcePianoFingering"].As(); - } - - if (Platform.Platform.JsonExists(json, "lazy")) - { - settings.EnableLazyLoading = json.lazy; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("lazy")) - { - settings.EnableLazyLoading = dataAttributes["lazy"].IsTruthy(); - } - - if (Platform.Platform.JsonExists(json, "transpositionPitches")) - { - settings.TranspositionPitches = json.transpositionPitches; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("transpositionPitches")) - { - var pitchOffsets = dataAttributes["transpositionPitches"]; - if (pitchOffsets != null && pitchOffsets.Member("length")) - { - settings.TranspositionPitches = (int[])pitchOffsets; - } - } - - if (Platform.Platform.JsonExists(json, "displayTranspositionPitches")) - { - settings.DisplayTranspositionPitches = json.displayTranspositionPitches; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("displayTranspositionPitches")) - { - var pitchOffsets = dataAttributes["displayTranspositionPitches"]; - if (pitchOffsets != null && pitchOffsets.Member("length")) - { - settings.DisplayTranspositionPitches = (int[])pitchOffsets; - } - } - - if (Platform.Platform.JsonExists(json, "scriptFile")) - { - settings.ScriptFile = EnsureFullUrl(json.scriptFile); - settings.ScriptFile = AppendScriptName(settings.ScriptFile); - } - else if (dataAttributes != null && dataAttributes.ContainsKey("scriptFile")) - { - settings.ScriptFile = EnsureFullUrl((string)dataAttributes["scriptFile"]); - settings.ScriptFile = AppendScriptName(settings.ScriptFile); - } - - if (Platform.Platform.JsonExists(json, "fontDirectory")) - { - settings.FontDirectory = EnsureFullUrl(json.fontDirectory); - } - else if (dataAttributes != null && dataAttributes.ContainsKey("fontDirectory")) - { - settings.FontDirectory = (string)dataAttributes["fontDirectory"]; - } - - if (Platform.Platform.JsonExists(json, "smallGraceTabNotes")) - { - settings.SmallGraceTabNotes = json.smallGraceTabNotes; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("smallGraceTabNotes")) - { - settings.SmallGraceTabNotes = (bool)dataAttributes["smallGraceTabNotes"]; - } - - if (Platform.Platform.JsonExists(json, "fingeringMode")) - { - settings.FingeringMode = DecodeFingeringMode(json.fingeringMode); - } - else if (dataAttributes != null && dataAttributes.ContainsKey("fingeringMode")) - { - settings.FingeringMode = DecodeFingeringMode(dataAttributes["fingeringMode"]); - } - - if (Platform.Platform.JsonExists(json, "extendBendArrowsOnTiedNotes")) - { - settings.ExtendBendArrowsOnTiedNotes = json.extendBendArrowsOnTiedNotes; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("extendBendArrowsOnTiedNotes")) - { - settings.ExtendBendArrowsOnTiedNotes = (bool)dataAttributes["extendBendArrowsOnTiedNotes"]; - } - - if (Platform.Platform.JsonExists(json, "showParenthesisForTiedBends")) - { - settings.ShowParenthesisForTiedBends = json.showParenthesisForTiedBends; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("showParenthesisForTiedBends")) - { - settings.ShowParenthesisForTiedBends = (bool)dataAttributes["showParenthesisForTiedBends"]; - } - - if (Platform.Platform.JsonExists(json, "showTabNoteOnTiedBend")) - { - settings.ShowTabNoteOnTiedBend = json.showTabNoteOnTiedBend; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("showTabNoteOnTiedBend")) - { - settings.ShowTabNoteOnTiedBend = (bool)dataAttributes["showTabNoteOnTiedBend"]; - } - - if (Platform.Platform.JsonExists(json, "showZeroOnDiveWhammy")) - { - settings.ShowZeroOnDiveWhammy = json.showZeroOnDiveWhammy; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("showZeroOnDiveWhammy")) - { - settings.ShowZeroOnDiveWhammy = (bool)dataAttributes["showZeroOnDiveWhammy"]; - } - - if (Platform.Platform.JsonExists(json, "extendLineEffectsToBeatEnd")) - { - settings.ExtendLineEffectsToBeatEnd = json.extendLineEffectsToBeatEnd; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("extendLineEffectsToBeatEnd")) - { - settings.ExtendLineEffectsToBeatEnd = (bool)dataAttributes["extendLineEffectsToBeatEnd"]; - } - - if (Platform.Platform.JsonExists(json, "songBookBendDuration")) - { - settings.SongBookBendDuration = json.songBookBendDuration; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("songBookBendDuration")) - { - settings.SongBookBendDuration = (int)dataAttributes["songBookBendDuration"]; - } - - - if (Platform.Platform.JsonExists(json, "songBookDipDuration")) - { - settings.SongBookDipDuration = json.songBookDipDuration; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("songBookDipDuration")) - { - settings.SongBookDipDuration = (int)dataAttributes["songBookDipDuration"]; - } - - if (Platform.Platform.JsonExists(json, "layout")) - { - settings.Layout = LayoutFromJson(json.layout); - } - else if (dataAttributes != null && dataAttributes.ContainsKey("layout")) - { - settings.Layout = LayoutFromJson(dataAttributes["layout"]); - } - - if (dataAttributes != null) - { - foreach (var key in dataAttributes) - { - if (key.StartsWith("layout")) - { - var property = key.Substring(6); - settings.Layout.AdditionalSettings[property.ToLower()] = dataAttributes[key]; - } - } - } - - - if (Platform.Platform.JsonExists(json, "includeNoteBounds")) - { - settings.IncludeNoteBounds = json.includeNoteBounds; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("includeNoteBounds")) - { - settings.IncludeNoteBounds = (bool)dataAttributes["includeNoteBounds"]; - } - - if (Platform.Platform.JsonExists(json, "playTripletFeel")) - { - settings.PlayTripletFeel = json.playTripletFeel; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("playTripletFeel")) - { - settings.PlayTripletFeel = (bool)dataAttributes["playTripletFeel"]; - } - - if (Platform.Platform.JsonExists(json, "vibrato")) - { - var vibrato = json.vibrato; - if (vibrato.noteSlightAmplitude) - { - settings.Vibrato.NoteSlightAmplitude = vibrato.noteSlightAmplitude; - } - - if (vibrato.noteWideAmplitude) - { - settings.Vibrato.NoteWideAmplitude = vibrato.noteWideAmplitude; - } - - if (vibrato.noteSlightLength) - { - settings.Vibrato.NoteSlightLength = vibrato.noteSlightLength; - } - - if (vibrato.noteWideLength) - { - settings.Vibrato.NoteWideLength = vibrato.noteWideLength; - } - - if (vibrato.beatSlightAmplitude) - { - settings.Vibrato.BeatSlightAmplitude = vibrato.beatSlightAmplitude; - } - - if (vibrato.beatWideAmplitude) - { - settings.Vibrato.BeatWideAmplitude = vibrato.beatWideAmplitude; - } - - if (vibrato.beatSlightLength) - { - settings.Vibrato.BeatSlightLength = vibrato.beatSlightLength; - } - - if (vibrato.beatWideLength) - { - settings.Vibrato.BeatWideLength = vibrato.beatWideLength; - } - } - else if (dataAttributes != null) - { - if (dataAttributes.ContainsKey("vibratoNoteSlightLength")) - { - settings.Vibrato.NoteSlightLength = (int)dataAttributes["vibratoNoteSlightLength"]; - } - - if (dataAttributes.ContainsKey("vibratoNoteSlightAmplitude")) - { - settings.Vibrato.NoteSlightAmplitude = (int)dataAttributes["vibratoNoteSlightAmplitude"]; - } - - if (dataAttributes.ContainsKey("vibratoNoteWideLength")) - { - settings.Vibrato.NoteWideLength = (int)dataAttributes["vibratoNoteWideLength"]; - } - - if (dataAttributes.ContainsKey("vibratoNoteWideAmplitude")) - { - settings.Vibrato.NoteWideAmplitude = (int)dataAttributes["vibratoNoteWideAmplitude"]; - } - - if (dataAttributes.ContainsKey("vibratoBeatSlightLength")) - { - settings.Vibrato.BeatSlightLength = (int)dataAttributes["vibratoBeatSlightLength"]; - } - - if (dataAttributes.ContainsKey("vibratoBeatSlightAmplitude")) - { - settings.Vibrato.BeatSlightAmplitude = (int)dataAttributes["vibratoBeatSlightAmplitude"]; - } - - if (dataAttributes.ContainsKey("vibratoBeatWideLength")) - { - settings.Vibrato.BeatWideLength = (int)dataAttributes["vibratoBeatWideLength"]; - } - - if (dataAttributes.ContainsKey("vibratoBeatWideAmplitude")) - { - settings.Vibrato.BeatWideAmplitude = (int)dataAttributes["vibratoBeatWideAmplitude"]; - } - } - - - if (Platform.Platform.JsonExists(json, "staves")) - { - settings.Staves = StavesFromJson(json.staves); - } - else if (dataAttributes != null && dataAttributes.ContainsKey("staves")) - { - settings.Staves = StavesFromJson(dataAttributes["staves"]); - } - - if (dataAttributes != null) - { - foreach (var key in dataAttributes) - { - if (key.StartsWith("staves")) - { - var property = key.Substring(6); - settings.Staves.AdditionalSettings[property.ToLower()] = dataAttributes[key]; - } - } - } - - if (Platform.Platform.JsonExists(json, "player")) - { - settings.EnablePlayer = true; - settings.SoundFontFile = json.player; - } - else if (dataAttributes != null && dataAttributes.ContainsKey("player")) - { - settings.EnablePlayer = true; - settings.SoundFontFile = (string)dataAttributes["player"]; - } - - if (settings.EnablePlayer) - { - FillPlayerOptions(settings, json, true, dataAttributes); - } - - if (Platform.Platform.JsonExists(json, "importer")) - { - string[] keys = Platform.Platform.JsonKeys(json.importer); - foreach (var key in keys) - { - settings.ImporterSettings[key.ToLower()] = json.importer[key]; - } - } - else if (dataAttributes != null) - { - foreach (var key in dataAttributes) - { - if (key.StartsWith("importer")) - { - var property = key.Substring(8); - settings.ImporterSettings[property.ToLower()] = dataAttributes[key]; - } - } - } - - if (Platform.Platform.JsonExists(json, "resources")) - { - string[] keys = Platform.Platform.JsonKeys(json.resources); - foreach (var key in keys) - { - DecodeResource(settings.RenderingResources, key, json.resources[key]); - } - } - else if (dataAttributes != null) - { - foreach (var key in dataAttributes) - { - if (key.StartsWith("resources")) - { - var property = key.Substring(9); - DecodeResource(settings.RenderingResources, property, dataAttributes[key]); - } - } - } - } - - private static void DecodeResource(RenderingResources resources, string key, object value) - { - switch (key.ToLower()) - { - case "copyrightfont": - resources.CopyrightFont = DecodeFont(value, resources.CopyrightFont); - break; - case "titlefont": - resources.TitleFont = DecodeFont(value, resources.TitleFont); - break; - case "subtitlefont": - resources.SubTitleFont = DecodeFont(value, resources.SubTitleFont); - break; - case "wordsfont": - resources.WordsFont = DecodeFont(value, resources.WordsFont); - break; - case "effectfont": - resources.EffectFont = DecodeFont(value, resources.EffectFont); - break; - case "fretboardnumberfont": - resources.FretboardNumberFont = DecodeFont(value, resources.FretboardNumberFont); - break; - case "tablaturefont": - resources.TablatureFont = DecodeFont(value, resources.TablatureFont); - break; - case "gracefont": - resources.GraceFont = DecodeFont(value, resources.GraceFont); - break; - case "barnumberfont": - resources.BarNumberFont = DecodeFont(value, resources.BarNumberFont); - break; - case "fingeringfont": - resources.FingeringFont = DecodeFont(value, resources.FingeringFont); - break; - case "markerfont": - resources.MarkerFont = DecodeFont(value, resources.MarkerFont); - break; - - case "stafflinecolor": - resources.StaffLineColor = DecodeColor(value, resources.StaffLineColor); - break; - case "barnumbercolor": - resources.BarNumberColor = DecodeColor(value, resources.BarNumberColor); - break; - case "barseparatorcolor": - resources.BarSeparatorColor = DecodeColor(value, resources.BarSeparatorColor); - break; - case "mainglyphcolor": - resources.MainGlyphColor = DecodeColor(value, resources.MainGlyphColor); - break; - case "secondaryglyphcolor": - resources.SecondaryGlyphColor = DecodeColor(value, resources.SecondaryGlyphColor); - break; - case "scoreinfocolor": - resources.ScoreInfoColor = DecodeColor(value, resources.ScoreInfoColor); - break; - } - } - - private static int EncodeColor(Color value) - { - return value.Raw; - } - - private static Color DecodeColor(object value, Color defaultColor) - { - if (value == null) - { - return defaultColor; - } - - switch (Platform.Platform.TypeOf(value)) - { - case "number": - var c = new Color(0, 0, 0, 0); - var raw = value.As(); - c.Raw = (int)raw; - c.UpdateRgba(); - return c; - case "string": - var s = value.As(); - if (s.StartsWith("#")) - { - if (s.Length == 4) // #RGB - { - return new Color( - (byte)(Platform.Platform.ParseHex(s.Substring(1, 1)) * 17), - (byte)(Platform.Platform.ParseHex(s.Substring(2, 1)) * 17), - (byte)(Platform.Platform.ParseHex(s.Substring(3, 1)) * 17) - ); - } - - if (s.Length == 5) // #RGBA - { - return new Color( - (byte)(Platform.Platform.ParseHex(s.Substring(1, 1)) * 17), - (byte)(Platform.Platform.ParseHex(s.Substring(2, 1)) * 17), - (byte)(Platform.Platform.ParseHex(s.Substring(3, 1)) * 17), - (byte)(Platform.Platform.ParseHex(s.Substring(4, 1)) * 17) - ); - } - - if (s.Length == 7) // #RRGGBB - { - return new Color( - (byte)Platform.Platform.ParseHex(s.Substring(1, 2)), - (byte)Platform.Platform.ParseHex(s.Substring(3, 2)), - (byte)Platform.Platform.ParseHex(s.Substring(5, 2)) - ); - } - - if (s.Length == 9) // #RRGGBBAA - { - return new Color( - (byte)Platform.Platform.ParseHex(s.Substring(1, 2)), - (byte)Platform.Platform.ParseHex(s.Substring(3, 2)), - (byte)Platform.Platform.ParseHex(s.Substring(5, 2)), - (byte)Platform.Platform.ParseHex(s.Substring(7, 2)) - ); - } - } - else if (s.StartsWith("rgba") || s.StartsWith("rgb")) - { - var start = s.IndexOf("("); - var end = s.LastIndexOf(")"); - if (start == -1 || end == -1) - { - return defaultColor; - } - - var numbers = s.Substring(start + 1, end - start - 1).Split(','); - if (numbers.Length == 3) - { - return new Color( - (byte)Platform.Platform.ParseInt(numbers[0]), - (byte)Platform.Platform.ParseInt(numbers[1]), - (byte)Platform.Platform.ParseInt(numbers[2]) - ); - } - - if (numbers.Length == 4) - { - return new Color( - (byte)Platform.Platform.ParseInt(numbers[0]), - (byte)Platform.Platform.ParseInt(numbers[1]), - (byte)Platform.Platform.ParseInt(numbers[2]), - (byte)(Platform.Platform.ParseFloat(numbers[3]) * 255) - ); - } - } - - break; - } - - return defaultColor; - } - - private static object EncodeFont(Font value) - { - var font = Platform.Platform.NewObject(); - font.family = value.Family; - font.size = value.Size; - font.style = (int)value.Style; - return font; - } - - private static Font DecodeFont(object value, Font defaultFont) - { - if (value == null) - { - return defaultFont; - } - - if (Platform.Platform.TypeOf(value) == "object" && value.Member("family")) - { - return new Font(value.Member("family"), - value.Member("size"), - (FontStyle)value.Member("style")); - } - - if (Platform.Platform.TypeOf(value) == "string" && Lib.Global.document) - { - var fontText = value.As(); - var el = Browser.Document.CreateElement("span"); - el.SetAttribute("style", "font: " + fontText); - - var style = el.Style; - - if (string.IsNullOrEmpty(style.FontFamily)) - { - return defaultFont; - } - - string family = style.FontFamily; - if (family.StartsWith("'") && family.EndsWith("'") || family.StartsWith("\"") && family.EndsWith("\"")) - { - family = family.Substring(1, family.Length - 2); - } - - string fontSizeString = style.FontSize.ToLowerCase(); - float fontSize; - // as per https://websemantics.uk/articles/font-size-conversion/ - switch (fontSizeString) - { - case "xx-small": - fontSize = 7; - break; - case "x-small": - fontSize = 10; - break; - case "small": - case "smaller": - fontSize = 13; - break; - case "medium": - fontSize = 16; - break; - case "large": - case "larger": - fontSize = 18; - break; - case "x-large": - fontSize = 24; - break; - case "xx-large": - fontSize = 32; - break; - default: - try - { - if (fontSizeString.EndsWith("%")) - { - // percent values not supported - fontSize = defaultFont.Size; - } - else if (fontSizeString.EndsWith("em")) - { - fontSize = Platform.Platform.ParseFloat( - fontSizeString.Substring(0, fontSizeString.Length - 2)) * 16; - } - else if (fontSizeString.EndsWith("pt")) - { - fontSize = Platform.Platform.ParseFloat( - fontSizeString.Substring(0, fontSizeString.Length - 2)) * 16.0f / 12.0f; - } - else if (fontSizeString.EndsWith("px")) - { - fontSize = Platform.Platform.ParseFloat( - fontSizeString.Substring(0, fontSizeString.Length - 2)); - } - else - { - fontSize = defaultFont.Size; - } - } - catch - { - fontSize = defaultFont.Size; - } - - break; - } - - var fontStyle = FontStyle.Plain; - if (style.FontStyle == "italic") - { - fontStyle |= FontStyle.Italic; - } - - string fontWeightString = style.FontWeight.ToLowerCase(); - switch (fontWeightString) - { - case "normal": - case "lighter": - break; - default: - fontStyle |= FontStyle.Bold; - break; - } - - return new Font(family, fontSize, fontStyle); - } - - - return defaultFont; - } - - - private static DisplayMode DecodeDisplayMode(object mode) - { - if (Platform.Platform.TypeOf(mode) == "number") - { - return (DisplayMode)mode; - } - - if (Platform.Platform.TypeOf(mode) == "string") - { - var s = (string)mode; - switch (s.ToLower()) - { - case "songbook": - return DisplayMode.SongBook; - case "guitarpro": - return DisplayMode.GuitarPro; - } - } - - return DisplayMode.GuitarPro; - } - - private static FingeringMode DecodeFingeringMode(object mode) - { - if (Platform.Platform.TypeOf(mode) == "number") - { - return (FingeringMode)mode; - } - - if (Platform.Platform.TypeOf(mode) == "string") - { - var s = (string)mode; - switch (s.ToLower()) - { - case "score": - return FingeringMode.Score; - case "effectband": - return FingeringMode.SingleNoteEffectBand; - } - } - - return FingeringMode.Score; - } - - private static LogLevel DecodeLogLevel(object log) - { - if (Platform.Platform.TypeOf(log) == "number") - { - return (LogLevel)log; - } - - if (Platform.Platform.TypeOf(log) == "string") - { - var s = (string)log; - switch (s.ToLower()) - { - case "none": - return LogLevel.None; - case "debug": - return LogLevel.Debug; - case "info": - return LogLevel.Info; - case "warning": - return LogLevel.Warning; - case "error": - return LogLevel.Error; - } - } + public partial class CoreSettings + { + /// + /// Gets or sets the script file url that will be used to spawn the workers. + /// + [JsonName("scriptFile")] + public string ScriptFile { get; set; } - return LogLevel.Info; - } + /// + /// Gets or sets the url to the fonts that will be used to generate the alphaTab font style. + /// + [JsonName("fontDirectory")] + public string FontDirectory { get; set; } - private static void FillCursorOffset(Settings settings, object playerOffset) - { - if (Platform.Platform.TypeOf(playerOffset) == "number") - { - settings.ScrollOffsetX = (int)playerOffset; - settings.ScrollOffsetY = (int)playerOffset; - } - else if (Platform.Platform.JsonExists(playerOffset, "length")) - { - var offsets = (int[])playerOffset; - settings.ScrollOffsetX = offsets[0]; - settings.ScrollOffsetY = offsets[1]; - } - } + /// + /// Gets or sets whether lazy loading for displayed elements is enabled. + /// + [JsonName("enableLazyLoading")] + public bool EnableLazyLoading { get; set; } = true; - private static StaveSettings StavesFromJson(dynamic json) + public CoreSettings() { - StaveSettings staveSettings; - if (Script.Write("untyped __typeof__(json) == \"string\"")) - { - staveSettings = new StaveSettings(json); - } - else if (json.id) + var global = Lib.Global; + if (global.document && global.ALPHATAB_ROOT) { - staveSettings = new StaveSettings(json.id); - if (json.additionalSettings) - { - string[] keys2 = Platform.Platform.JsonKeys(json.additionalSettings); - foreach (var key2 in keys2) - { - staveSettings.AdditionalSettings[key2.ToLower()] = json.additionalSettings[key2]; - } - } + ScriptFile = global.ALPHATAB_ROOT; + ScriptFile = EnsureFullUrl(ScriptFile); + ScriptFile = AppendScriptName(ScriptFile); } else { - return new StaveSettings("score-tab"); + ScriptFile = Environment.ScriptFile; } - return staveSettings; - } - - public static LayoutSettings LayoutFromJson(dynamic json) - { - var layout = new LayoutSettings(); - if (Script.Write("untyped __typeof__(json) == \"string\"")) + if (global.document && global.ALPHATAB_FONT) { - layout.Mode = json; + FontDirectory = global.ALPHATAB_FONT; + FontDirectory = EnsureFullUrl(FontDirectory); } else { - if (json.mode) - { - layout.Mode = json.mode; - } - - if (json.additionalSettings) + FontDirectory = ScriptFile; + if (!string.IsNullOrEmpty(FontDirectory)) { - string[] keys = Platform.Platform.JsonKeys(json.additionalSettings); - foreach (var key in keys) + var lastSlash = FontDirectory.LastIndexOf('/'); + if (lastSlash >= 0) { - layout.AdditionalSettings[key.ToLower()] = json.additionalSettings[key]; + FontDirectory = FontDirectory.Substring(0, lastSlash) + "/Font/"; } } } - - return layout; - } - - private static string AppendScriptName(string url) - { - // append script name - if (!string.IsNullOrEmpty(url) && !url.EndsWith(".js")) - { - if (!url.EndsWith("/")) - { - url += "/"; - } - - url += "AlphaTab.js"; - } - - return url; } private static string EnsureFullUrl(string relativeUrl) { - var global = Script.Write("js.Lib.global"); + var global = Lib.Global; if (!relativeUrl.StartsWith("http") && !relativeUrl.StartsWith("https") && !relativeUrl.StartsWith("file")) { var root = new StringBuilder(); @@ -1187,46 +104,74 @@ private static string EnsureFullUrl(string relativeUrl) return relativeUrl; } - public static string EncodeScrollMode(ScrollMode mode) + private static string AppendScriptName(string url) { - // TOOD: check why tostring is not working - switch (mode) + // append script name + if (!string.IsNullOrEmpty(url) && !url.EndsWith(".js")) { - case ScrollMode.Off: - return "off"; - case ScrollMode.OffScreen: - return "offScreen"; - default: - case ScrollMode.Continuous: - return "continuous"; + if (!url.EndsWith("/")) + { + url += "/"; + } + + url += "AlphaTab.js"; } + + return url; + } + + } + + public partial class PlayerSettings + { + /// + /// Gets or sets the URl of the sound font to be loaded. + /// + [JsonName("soundFont")] + public string SoundFont { get; set; } + + /// + /// Gets or sets the element that should be used for scrolling. + /// + [JsonName("scrollElement")] + public string ScrollElement { get; set; } = "html,body"; + } + + /// + /// This public class contains instance specific settings for alphaTab + /// + public partial class Settings + { + public static Settings FromJson(dynamic json) + { + return null; // dynamically implemented via macro } - public static ScrollMode DecodeScrollMode(object mode) + public void FillFromJson(dynamic json) { - if (Platform.Platform.TypeOf(mode) == "number") - { - return (ScrollMode)mode; - } + // dynamically implemented via macro + } + + public static object ToJson(Settings settings) + { + return null; // dynamically implemented via macro + } - if (Platform.Platform.TypeOf(mode) == "string") + public void FillFromDataAttributes(dynamic dataAttributes) + { + object dataAttributesObject = dataAttributes; + var keys = Platform.Platform.JsonKeys(dataAttributesObject); + foreach (var key in keys) { - var s = (string)mode; - switch (s.ToLower()) - { - case "off": - return ScrollMode.Off; - case "vertical": - case "horizontal-bar": - case "continuous": - return ScrollMode.Continuous; - case "horizontal-offscreen": - case "offscreen": - return ScrollMode.OffScreen; - } + SetProperty(key.ToLower(), dataAttributes[key]); } + } - return ScrollMode.Continuous; + public bool SetProperty(string property, dynamic value) + { + // dynamically implemented via macro + return false; } + } } diff --git a/Source/AlphaTab.JavaScript/UI/BrowserUiFacade.cs b/Source/AlphaTab.JavaScript/UI/BrowserUiFacade.cs index 4ec3a80b8..b674c6c9c 100644 --- a/Source/AlphaTab.JavaScript/UI/BrowserUiFacade.cs +++ b/Source/AlphaTab.JavaScript/UI/BrowserUiFacade.cs @@ -1,5 +1,4 @@ -using System; -using System.Runtime.InteropServices; +using System; using AlphaTab.Audio.Synth; using AlphaTab.Collections; using AlphaTab.Haxe; @@ -133,10 +132,18 @@ public void Initialize(AlphaTabApi api, object raw) { _api = api; + var settings = new Settings(); + settings.FillFromJson(raw); var dataAttributes = GetDataAttributes(); - var settings = Settings.FromJson(raw, dataAttributes); + settings.FillFromDataAttributes(dataAttributes); + + if (settings.Notation.NotationMode == NotationMode.SongBook) + { + settings.SetSongBookModeSettings(); + } + api.Settings = settings; - if (settings.Engine == "default" || settings.Engine == "svg") + if (settings.Core.Engine == "default" || settings.Core.Engine == "svg") { api.Container.Scroll += ShowSvgsInViewPort; api.Container.Resize += ShowSvgsInViewPort; @@ -197,17 +204,17 @@ public void Initialize(AlphaTabApi api, object raw) private void SetupFontCheckers(Settings settings) { - RegisterFontChecker(settings.RenderingResources.CopyrightFont); - RegisterFontChecker(settings.RenderingResources.EffectFont); - RegisterFontChecker(settings.RenderingResources.FingeringFont); - RegisterFontChecker(settings.RenderingResources.GraceFont); - RegisterFontChecker(settings.RenderingResources.MarkerFont); - RegisterFontChecker(settings.RenderingResources.TablatureFont); - RegisterFontChecker(settings.RenderingResources.TitleFont); - RegisterFontChecker(settings.RenderingResources.WordsFont); - RegisterFontChecker(settings.RenderingResources.BarNumberFont); - RegisterFontChecker(settings.RenderingResources.FretboardNumberFont); - RegisterFontChecker(settings.RenderingResources.SubTitleFont); + RegisterFontChecker(settings.Display.Resources.CopyrightFont); + RegisterFontChecker(settings.Display.Resources.EffectFont); + RegisterFontChecker(settings.Display.Resources.FingeringFont); + RegisterFontChecker(settings.Display.Resources.GraceFont); + RegisterFontChecker(settings.Display.Resources.MarkerFont); + RegisterFontChecker(settings.Display.Resources.TablatureFont); + RegisterFontChecker(settings.Display.Resources.TitleFont); + RegisterFontChecker(settings.Display.Resources.WordsFont); + RegisterFontChecker(settings.Display.Resources.BarNumberFont); + RegisterFontChecker(settings.Display.Resources.FretboardNumberFont); + RegisterFontChecker(settings.Display.Resources.SubTitleFont); } private void RegisterFontChecker(Font font) @@ -230,7 +237,7 @@ public IContainer CreateCanvasElement() { var canvasElement = Browser.Document.CreateElement("div"); - canvasElement.ClassName = "alphaTabSurface"; + canvasElement.ClassName = "at-surface"; canvasElement.Style.FontSize = "0"; canvasElement.Style.Overflow = "hidden"; canvasElement.Style.LineHeight = "0"; @@ -365,7 +372,7 @@ private void CreateStyleElement(Settings settings) var styleElement = (StyleElement)elementDocument.GetElementById("alphaTabStyle"); if (styleElement == null) { - var fontDirectory = settings.FontDirectory; + var fontDirectory = settings.Core.FontDirectory; styleElement = (StyleElement)elementDocument.CreateElement("style"); styleElement.Id = "alphaTabStyle"; styleElement.Type = "text/css"; @@ -380,8 +387,9 @@ private void CreateStyleElement(Settings settings) css.AppendLine(" font-weight: normal;"); css.AppendLine(" font-style: normal;"); css.AppendLine("}"); - css.AppendLine(".alphaTabSurface * {"); + css.AppendLine(".at-surface * {"); css.AppendLine(" cursor: default;"); + css.AppendLine(" vertical-align: top;"); css.AppendLine("}"); css.AppendLine(".at {"); css.AppendLine(" font-family: 'alphaTab';"); @@ -418,7 +426,10 @@ public int[] ParseTracks(object tracksData) { if (tracksData == "all") { - return null; + return new int[] + { + -1 + }; } tracksData = Json.Parse((string)tracksData); @@ -551,7 +562,7 @@ public void BeginAppendRenderResults(RenderFinishedEventArgs renderResult) } // directly show the elements in the viewport once we're done. - if (_api.Settings.EnableLazyLoading) + if (_api.Settings.Core.EnableLazyLoading) { ShowSvgsInViewPort(); } @@ -577,7 +588,7 @@ public void BeginAppendRenderResults(RenderFinishedEventArgs renderResult) placeholder.Style.Height = renderResult.Height + "px"; placeholder.Style.Display = "inline-block"; - if (IsElementInViewPort(placeholder) || !_api.Settings.EnableLazyLoading) + if (IsElementInViewPort(placeholder) || !_api.Settings.Core.EnableLazyLoading) { var bodyHtml = (string)body; placeholder.OuterHTML = bodyHtml; @@ -634,14 +645,14 @@ public IAlphaSynth CreateWorkerPlayer() Logger.Info("Player", "Will use webworkers for synthesizing and web audio api for playback"); player = new AlphaSynthWebWorkerApi(new AlphaSynthWebAudioOutput(), alphaSynthScriptFile, - _api.Settings.LogLevel); + _api.Settings.Core.LogLevel); } else if (supportsWebWorkers) { Logger.Info("Player", "Will use webworkers for synthesizing and flash for playback"); player = new AlphaSynthWebWorkerApi(new AlphaSynthFlashOutput(alphaSynthScriptFile), alphaSynthScriptFile, - _api.Settings.LogLevel); + _api.Settings.Core.LogLevel); } if (player == null) @@ -652,9 +663,9 @@ public IAlphaSynth CreateWorkerPlayer() { player.Ready += () => { - if (!string.IsNullOrEmpty(_api.Settings.SoundFontFile)) + if (!string.IsNullOrEmpty(_api.Settings.Player.SoundFont)) { - ((AlphaTabApi)_api).LoadSoundFontFromUrl(_api.Settings.SoundFontFile); + ((AlphaTabApi)_api).LoadSoundFontFromUrl(_api.Settings.Player.SoundFont); } }; } @@ -767,9 +778,9 @@ public Bounds GetOffset(IContainer scrollContainer, IContainer container) public IContainer GetScrollContainer() { - var scrollElement = Platform.Platform.TypeOf(_api.Settings.ScrollElement) == "string" - ? Browser.Document.QuerySelector(_api.Settings.ScrollElement) - : _api.Settings.ScrollElement.As(); + var scrollElement = Platform.Platform.TypeOf(_api.Settings.Player.ScrollElement) == "string" + ? Browser.Document.QuerySelector(_api.Settings.Player.ScrollElement) + : _api.Settings.Player.ScrollElement.As(); var nodeName = scrollElement.NodeName.ToLowerCase(); if (nodeName == "html" || nodeName == "body") diff --git a/Source/AlphaTab.JavaScript/Utils/SerializationException.cs b/Source/AlphaTab.JavaScript/Utils/SerializationException.cs new file mode 100644 index 000000000..cfbf3d33b --- /dev/null +++ b/Source/AlphaTab.JavaScript/Utils/SerializationException.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AlphaTab.Utils +{ + public class SerializationException : AlphaTabException + { + public SerializationException(string message) : base(message) + { + } + } +} diff --git a/Source/AlphaTab.Test.Js/test/alphaTab.tests.specs.js b/Source/AlphaTab.Test.Js/test/alphaTab.tests.specs.js index d9afaf41b..3b3d235e7 100644 --- a/Source/AlphaTab.Test.Js/test/alphaTab.tests.specs.js +++ b/Source/AlphaTab.Test.Js/test/alphaTab.tests.specs.js @@ -108,11 +108,6 @@ describe("alphaTab.test.importer.AlphaTexImporterTest", function() { __instance.grace_Issue79(); done(); }); - it("bendRendering_Issue79", function(done) { - alphaTab.test.TestPlatform.Done = done; - __instance.bendRendering_Issue79(); - done(); - }); it("testLeftHandFingerSingleNote", function(done) { alphaTab.test.TestPlatform.Done = done; __instance.testLeftHandFingerSingleNote(); diff --git a/Source/AlphaTab.Test/Audio/AlphaSynthTests.cs b/Source/AlphaTab.Test/Audio/AlphaSynthTests.cs index eba8f6721..2ad68e649 100644 --- a/Source/AlphaTab.Test/Audio/AlphaSynthTests.cs +++ b/Source/AlphaTab.Test/Audio/AlphaSynthTests.cs @@ -24,7 +24,7 @@ public void TestPcmGeneration() " (0.4 0.3).8 r.8(3.4 3.3).8 r.8(5.4 5.3).4 r.8(3.4 3.3).8 | " + "r.8(0.4 0.3).8(-.3 - .4).2 { d } | "; var importer = new AlphaTexImporter(); - importer.Init(TestPlatform.CreateStringReader(tex)); + importer.Init(TestPlatform.CreateStringReader(tex), new Settings()); var score = importer.ReadScore(); var midi = new MidiFile(); diff --git a/Source/AlphaTab.Test/Audio/MidiFileGeneratorTest.cs b/Source/AlphaTab.Test/Audio/MidiFileGeneratorTest.cs index bd3c96d50..6eac2b0a1 100644 --- a/Source/AlphaTab.Test/Audio/MidiFileGeneratorTest.cs +++ b/Source/AlphaTab.Test/Audio/MidiFileGeneratorTest.cs @@ -20,7 +20,7 @@ public class MidiFileGeneratorTest private Score ParseTex(string tex) { var importer = new AlphaTexImporter(); - importer.Init(TestPlatform.CreateStringReader(tex)); + importer.Init(TestPlatform.CreateStringReader(tex), new Settings()); return importer.ReadScore(); } @@ -30,7 +30,7 @@ public void TestFullSong() TestPlatform.LoadFile("TestFiles/GuitarPro5/NightWish.gp5", buffer => { var readerBase = new Gp3To5Importer(); - readerBase.Init(ByteBuffer.FromBuffer(buffer)); + readerBase.Init(ByteBuffer.FromBuffer(buffer), new Settings()); var score = readerBase.ReadScore(); var generator = new MidiFileGenerator(score, null, new FlatMidiEventGenerator()); diff --git a/Source/AlphaTab.Test/Importer/AlphaTexImporterTest.cs b/Source/AlphaTab.Test/Importer/AlphaTexImporterTest.cs index 39e8c364a..344238fa3 100644 --- a/Source/AlphaTab.Test/Importer/AlphaTexImporterTest.cs +++ b/Source/AlphaTab.Test/Importer/AlphaTexImporterTest.cs @@ -24,7 +24,7 @@ public class AlphaTexImporterTest private Score ParseTex(string tex) { var importer = new AlphaTexImporter(); - importer.Init(TestPlatform.CreateStringReader(tex)); + importer.Init(TestPlatform.CreateStringReader(tex), new Settings()); return importer.ReadScore(); } @@ -101,7 +101,6 @@ public void EnsureMetadataParsing_Issue73() Assert.AreEqual(Duration.Half, score.Tracks[0].Staves[0].Bars[1].Voices[0].Beats[4].Duration); Assert.AreEqual(true, score.Tracks[0].Staves[0].Bars[1].Voices[0].Beats[4].IsRest); } - } @@ -114,7 +113,8 @@ public void TestTuning() var score = ParseTex(tex); - Assert.AreEqual(string.Join(",", Tuning.GetDefaultTuningFor(6).Tunings), string.Join(",", score.Tracks[0].Staves[0].Tuning)); + Assert.AreEqual(string.Join(",", Tuning.GetDefaultTuningFor(6).Tunings), + string.Join(",", score.Tracks[0].Staves[0].Tuning)); } [TestMethod] @@ -157,7 +157,8 @@ public void Trill_Issue79() Assert.AreEqual(1, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats.Count); Assert.AreEqual(3, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].Fret); Assert.AreEqual(true, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].IsTrill); - Assert.AreEqual(Duration.Sixteenth, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].TrillSpeed); + Assert.AreEqual(Duration.Sixteenth, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].TrillSpeed); Assert.AreEqual(5, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].TrillFret); } @@ -173,7 +174,8 @@ public void Tremolo_Issue79() Assert.AreEqual(1, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats.Count); Assert.AreEqual(3, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].Fret); Assert.AreEqual(true, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].IsTrill); - Assert.AreEqual(Duration.Sixteenth, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].TrillSpeed); + Assert.AreEqual(Duration.Sixteenth, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].TrillSpeed); Assert.AreEqual(5, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].TrillFret); } @@ -189,7 +191,8 @@ public void TremoloPicking_Issue79() Assert.AreEqual(1, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats.Count); Assert.AreEqual(3, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].Fret); Assert.AreEqual(true, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].IsTremolo); - Assert.AreEqual(Duration.Sixteenth, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].TremoloSpeed.Value); + Assert.AreEqual(Duration.Sixteenth, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].TremoloSpeed.Value); } [TestMethod] @@ -201,11 +204,16 @@ public void Hamonics_Issue79() Assert.AreEqual(1, score.Tracks.Count); Assert.AreEqual(1, score.MasterBars.Count); Assert.AreEqual(5, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats.Count); - Assert.AreEqual(HarmonicType.Natural, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].HarmonicType); - Assert.AreEqual(HarmonicType.Artificial, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[1].Notes[0].HarmonicType); - Assert.AreEqual(HarmonicType.Tap, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[2].Notes[0].HarmonicType); - Assert.AreEqual(HarmonicType.Pinch, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[3].Notes[0].HarmonicType); - Assert.AreEqual(HarmonicType.Semi, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[4].Notes[0].HarmonicType); + Assert.AreEqual(HarmonicType.Natural, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].HarmonicType); + Assert.AreEqual(HarmonicType.Artificial, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[1].Notes[0].HarmonicType); + Assert.AreEqual(HarmonicType.Tap, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[2].Notes[0].HarmonicType); + Assert.AreEqual(HarmonicType.Pinch, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[3].Notes[0].HarmonicType); + Assert.AreEqual(HarmonicType.Semi, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[4].Notes[0].HarmonicType); } [TestMethod] @@ -214,20 +222,9 @@ public void HamonicsRenderingText_Issue79() var tex = @":8 3.3{nh} 3.3{ah} 3.3{th} 3.3{ph} 3.3{sh}"; var score = ParseTex(tex); - Environment.StaveProfiles["harmonics"] = new BarRendererFactory[] - { - new EffectBarRendererFactory("n-harmonics", new IEffectBarRendererInfo[] {new HarmonicsEffectInfo(HarmonicType.Natural)}), - new EffectBarRendererFactory("a-harmonics", new IEffectBarRendererInfo[] {new HarmonicsEffectInfo(HarmonicType.Artificial)}), - new EffectBarRendererFactory("t-harmonics", new IEffectBarRendererInfo[] {new HarmonicsEffectInfo(HarmonicType.Tap)}), - new EffectBarRendererFactory("p-harmonics", new IEffectBarRendererInfo[] {new HarmonicsEffectInfo(HarmonicType.Pinch)}), - new EffectBarRendererFactory("s-harmonics", new IEffectBarRendererInfo[] {new HarmonicsEffectInfo(HarmonicType.Semi)}), - new EffectBarRendererFactory("f-harmonics", new IEffectBarRendererInfo[] {new HarmonicsEffectInfo(HarmonicType.Feedback)}), - }; - - - var settings = Settings.Defaults; - settings.Engine = "svg"; - settings.Staves = new StaveSettings("harmonics"); + var settings = new Settings(); + settings.Core.Engine = "svg"; + settings.Display.StaveProfile = StaveProfile.ScoreTab; var renderer = new ScoreRenderer(settings); renderer.Width = 970; @@ -236,15 +233,24 @@ public void HamonicsRenderingText_Issue79() { svg += r.RenderResult.ToString(); }; - renderer.RenderScore(score, new[] { 0 }); + renderer.RenderScore(score, + new[] + { + 0 + }); var regexTemplate = @"]+>\s*{0}\s*"; - Assert.IsTrue(TestPlatform.IsMatch(svg, string.Format(regexTemplate, HarmonicsEffectInfo.HarmonicToString(HarmonicType.Natural)))); - Assert.IsTrue(TestPlatform.IsMatch(svg, string.Format(regexTemplate, HarmonicsEffectInfo.HarmonicToString(HarmonicType.Artificial)))); - Assert.IsTrue(TestPlatform.IsMatch(svg, string.Format(regexTemplate, HarmonicsEffectInfo.HarmonicToString(HarmonicType.Tap)))); - Assert.IsTrue(TestPlatform.IsMatch(svg, string.Format(regexTemplate, HarmonicsEffectInfo.HarmonicToString(HarmonicType.Pinch)))); - Assert.IsTrue(TestPlatform.IsMatch(svg, string.Format(regexTemplate, HarmonicsEffectInfo.HarmonicToString(HarmonicType.Semi)))); + Assert.IsTrue(TestPlatform.IsMatch(svg, + string.Format(regexTemplate, HarmonicsEffectInfo.HarmonicToString(HarmonicType.Natural)))); + Assert.IsTrue(TestPlatform.IsMatch(svg, + string.Format(regexTemplate, HarmonicsEffectInfo.HarmonicToString(HarmonicType.Artificial)))); + Assert.IsTrue(TestPlatform.IsMatch(svg, + string.Format(regexTemplate, HarmonicsEffectInfo.HarmonicToString(HarmonicType.Tap)))); + Assert.IsTrue(TestPlatform.IsMatch(svg, + string.Format(regexTemplate, HarmonicsEffectInfo.HarmonicToString(HarmonicType.Pinch)))); + Assert.IsTrue(TestPlatform.IsMatch(svg, + string.Format(regexTemplate, HarmonicsEffectInfo.HarmonicToString(HarmonicType.Semi)))); } [TestMethod] @@ -260,68 +266,6 @@ public void Grace_Issue79() Assert.AreEqual(GraceType.OnBeat, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[1].GraceType); } - - [TestMethod] - public void BendRendering_Issue79() - { - var tex = @":4 15.6{b(0 4)} 18.6{b(0 6)} 17.6{b(0 8)} 16.6{b(0 3 0)} | 15.6{b(0 8 4)} 14.6{b(4 4)} 13.6{b(4 6)} 14.6{b(4 0)}"; - var score = ParseTex(tex); - - Environment.StaveProfiles["tabOnly"] = new BarRendererFactory[] - { - new TabBarRendererFactory(false, false, false), - }; - - var settings = Settings.Defaults; - settings.Engine = "svg"; - settings.Layout.Mode = "horizontal"; - settings.Staves = new StaveSettings("tabOnly"); - settings.UseWorkers = false; - - var renderer = new ScoreRenderer(settings); - renderer.Width = 970; - var partials = new FastList(); - renderer.Error += (o, e) => - { - Assert.Fail(e.Message); - }; - renderer.PartialRenderFinished += r => - { - partials.Add(r.RenderResult.ToString()); - }; - renderer.RenderScore(score, new[] { 0 }); - - var tab = new XmlDocument(partials[0]); - - var textTags = tab.GetElementsByTagName("text", true); - var texts = new string[textTags.Length]; - for (var i = 0; i < textTags.Length; i++) - { - texts[i] = textTags[i].InnerText.Trim(); - } - - var expectedTexts = new[] - { - Platform.Platform.StringFromCharCode((int)MusicFontSymbol.ClefTab), // clef - - "1", // bar number - - "15", "full", - "18", "1½", - "17", "2", - "16", "¾", - - "2", // bar number - - "15", "2", "full", - "14", "full", - "13", "full", "1½", - "14", "full" - }; - - Assert.AreEqual(string.Join(", ", expectedTexts), string.Join(", ", texts)); - } - [TestMethod] public void TestLeftHandFingerSingleNote() { @@ -331,11 +275,16 @@ public void TestLeftHandFingerSingleNote() Assert.AreEqual(1, score.Tracks.Count); Assert.AreEqual(1, score.MasterBars.Count); Assert.AreEqual(5, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats.Count); - Assert.AreEqual(Fingers.Thumb, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].LeftHandFinger); - Assert.AreEqual(Fingers.IndexFinger, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[1].Notes[0].LeftHandFinger); - Assert.AreEqual(Fingers.MiddleFinger, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[2].Notes[0].LeftHandFinger); - Assert.AreEqual(Fingers.AnnularFinger, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[3].Notes[0].LeftHandFinger); - Assert.AreEqual(Fingers.LittleFinger, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[4].Notes[0].LeftHandFinger); + Assert.AreEqual(Fingers.Thumb, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].LeftHandFinger); + Assert.AreEqual(Fingers.IndexFinger, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[1].Notes[0].LeftHandFinger); + Assert.AreEqual(Fingers.MiddleFinger, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[2].Notes[0].LeftHandFinger); + Assert.AreEqual(Fingers.AnnularFinger, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[3].Notes[0].LeftHandFinger); + Assert.AreEqual(Fingers.LittleFinger, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[4].Notes[0].LeftHandFinger); } [TestMethod] @@ -347,11 +296,16 @@ public void TestRightHandFingerSingleNote() Assert.AreEqual(1, score.Tracks.Count); Assert.AreEqual(1, score.MasterBars.Count); Assert.AreEqual(5, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats.Count); - Assert.AreEqual(Fingers.Thumb, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].RightHandFinger); - Assert.AreEqual(Fingers.IndexFinger, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[1].Notes[0].RightHandFinger); - Assert.AreEqual(Fingers.MiddleFinger, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[2].Notes[0].RightHandFinger); - Assert.AreEqual(Fingers.AnnularFinger, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[3].Notes[0].RightHandFinger); - Assert.AreEqual(Fingers.LittleFinger, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[4].Notes[0].RightHandFinger); + Assert.AreEqual(Fingers.Thumb, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].RightHandFinger); + Assert.AreEqual(Fingers.IndexFinger, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[1].Notes[0].RightHandFinger); + Assert.AreEqual(Fingers.MiddleFinger, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[2].Notes[0].RightHandFinger); + Assert.AreEqual(Fingers.AnnularFinger, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[3].Notes[0].RightHandFinger); + Assert.AreEqual(Fingers.LittleFinger, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[4].Notes[0].RightHandFinger); } [TestMethod] @@ -364,11 +318,16 @@ public void TestLeftHandFingerChord() Assert.AreEqual(1, score.MasterBars.Count); Assert.AreEqual(1, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats.Count); Assert.AreEqual(5, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes.Count); - Assert.AreEqual(Fingers.Thumb, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].LeftHandFinger); - Assert.AreEqual(Fingers.IndexFinger, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[1].LeftHandFinger); - Assert.AreEqual(Fingers.MiddleFinger, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[2].LeftHandFinger); - Assert.AreEqual(Fingers.AnnularFinger, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[3].LeftHandFinger); - Assert.AreEqual(Fingers.LittleFinger, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[4].LeftHandFinger); + Assert.AreEqual(Fingers.Thumb, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].LeftHandFinger); + Assert.AreEqual(Fingers.IndexFinger, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[1].LeftHandFinger); + Assert.AreEqual(Fingers.MiddleFinger, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[2].LeftHandFinger); + Assert.AreEqual(Fingers.AnnularFinger, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[3].LeftHandFinger); + Assert.AreEqual(Fingers.LittleFinger, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[4].LeftHandFinger); } [TestMethod] @@ -381,11 +340,16 @@ public void TestRightHandFingerChord() Assert.AreEqual(1, score.MasterBars.Count); Assert.AreEqual(1, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats.Count); Assert.AreEqual(5, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes.Count); - Assert.AreEqual(Fingers.Thumb, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].RightHandFinger); - Assert.AreEqual(Fingers.IndexFinger, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[1].RightHandFinger); - Assert.AreEqual(Fingers.MiddleFinger, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[2].RightHandFinger); - Assert.AreEqual(Fingers.AnnularFinger, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[3].RightHandFinger); - Assert.AreEqual(Fingers.LittleFinger, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[4].RightHandFinger); + Assert.AreEqual(Fingers.Thumb, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].RightHandFinger); + Assert.AreEqual(Fingers.IndexFinger, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[1].RightHandFinger); + Assert.AreEqual(Fingers.MiddleFinger, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[2].RightHandFinger); + Assert.AreEqual(Fingers.AnnularFinger, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[3].RightHandFinger); + Assert.AreEqual(Fingers.LittleFinger, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[4].RightHandFinger); } @@ -529,7 +493,8 @@ public void TestMultiTrack() [TestMethod] public void TestMultiTrackNames() { - var tex = @"\track 1.1 | 1.1 | \track ""Only Long Name"" 2.2 | 2.2 | \track ""Very Long Name"" ""shrt"" 3.3 | 3.3 "; + var tex = + @"\track 1.1 | 1.1 | \track ""Only Long Name"" 2.2 | 2.2 | \track ""Very Long Name"" ""shrt"" 3.3 | 3.3 "; var score = ParseTex(tex); Assert.AreEqual(3, score.Tracks.Count); @@ -567,7 +532,7 @@ public void TestMultiTrackNames() public void TestMultiTrackMultiStaff() { var tex = - @"\track ""Piano"" + @"\track ""Piano"" \staff{score} \tuning piano \instrument acousticgrandpiano c4 d4 e4 f4 | @@ -654,7 +619,7 @@ 1.2 3.2 0.1 1.1 public void TestMultiTrackMultiStaffInconsistentBars() { var tex = - @"\track ""Piano"" + @"\track ""Piano"" \staff{score} \tuning piano \instrument acousticgrandpiano c4 d4 e4 f4 | @@ -760,18 +725,24 @@ public void TestSlides() Assert.AreEqual(4, score.MasterBars.Count); Assert.AreEqual(SlideType.Legato, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].SlideType); - Assert.AreEqual(score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[1].Notes[0].Id, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].SlideTarget.Id); + Assert.AreEqual(score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[1].Notes[0].Id, + score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0].SlideTarget.Id); Assert.AreEqual(SlideType.Shift, score.Tracks[0].Staves[0].Bars[1].Voices[0].Beats[0].Notes[0].SlideType); - Assert.AreEqual(score.Tracks[0].Staves[0].Bars[1].Voices[0].Beats[1].Notes[0].Id, score.Tracks[0].Staves[0].Bars[1].Voices[0].Beats[0].Notes[0].SlideTarget.Id); + Assert.AreEqual(score.Tracks[0].Staves[0].Bars[1].Voices[0].Beats[1].Notes[0].Id, + score.Tracks[0].Staves[0].Bars[1].Voices[0].Beats[0].Notes[0].SlideTarget.Id); - Assert.AreEqual(SlideType.IntoFromBelow, score.Tracks[0].Staves[0].Bars[2].Voices[0].Beats[0].Notes[0].SlideType); - Assert.AreEqual(SlideType.IntoFromAbove, score.Tracks[0].Staves[0].Bars[2].Voices[0].Beats[1].Notes[0].SlideType); + Assert.AreEqual(SlideType.IntoFromBelow, + score.Tracks[0].Staves[0].Bars[2].Voices[0].Beats[0].Notes[0].SlideType); + Assert.AreEqual(SlideType.IntoFromAbove, + score.Tracks[0].Staves[0].Bars[2].Voices[0].Beats[1].Notes[0].SlideType); Assert.AreEqual(SlideType.OutUp, score.Tracks[0].Staves[0].Bars[2].Voices[0].Beats[2].Notes[0].SlideType); Assert.AreEqual(SlideType.OutDown, score.Tracks[0].Staves[0].Bars[2].Voices[0].Beats[3].Notes[0].SlideType); - Assert.AreEqual(SlideType.PickSlideDown, score.Tracks[0].Staves[0].Bars[3].Voices[0].Beats[0].Notes[0].SlideType); - Assert.AreEqual(SlideType.PickSlideUp, score.Tracks[0].Staves[0].Bars[3].Voices[0].Beats[1].Notes[0].SlideType); + Assert.AreEqual(SlideType.PickSlideDown, + score.Tracks[0].Staves[0].Bars[3].Voices[0].Beats[0].Notes[0].SlideType); + Assert.AreEqual(SlideType.PickSlideUp, + score.Tracks[0].Staves[0].Bars[3].Voices[0].Beats[1].Notes[0].SlideType); } [TestMethod] @@ -827,7 +798,8 @@ public void TestTripletFeelNumeric() [TestMethod] public void TestTripletFeelLongNames() { - var tex = @"\tf none | \tf triplet-16th | \tf triplet-8th | \tf dotted-16th | \tf dotted-8th | \tf scottish-16th | \tf scottish-8th"; + var tex = + @"\tf none | \tf triplet-16th | \tf triplet-8th | \tf dotted-16th | \tf dotted-8th | \tf scottish-16th | \tf scottish-8th"; var score = ParseTex(tex); Assert.AreEqual(TripletFeel.NoTripletFeel, score.MasterBars[0].TripletFeel); @@ -881,9 +853,7 @@ public void TestTupletRepeat() var durations = new[] { - Duration.Eighth, - Duration.Eighth, - Duration.Eighth, + Duration.Eighth, Duration.Eighth, Duration.Eighth, }; var tuplets = new[] @@ -904,6 +874,7 @@ public void TestTupletRepeat() { Assert.AreEqual(tuplets[i], b.TupletNumerator, "Tuplet on beat " + i + " was wrong"); } + b = b.NextBeat; i++; } diff --git a/Source/AlphaTab.Test/Importer/Gp7ImporterTest.cs b/Source/AlphaTab.Test/Importer/Gp7ImporterTest.cs index 9b1973c4f..442d5c4fa 100644 --- a/Source/AlphaTab.Test/Importer/Gp7ImporterTest.cs +++ b/Source/AlphaTab.Test/Importer/Gp7ImporterTest.cs @@ -26,7 +26,7 @@ internal void PrepareGp7ImporterWithFile(string name, Action ready) internal Gp7Importer PrepareGp7ImporterWithBytes(byte[] buffer) { var readerBase = new Gp7Importer(); - readerBase.Init(ByteBuffer.FromBuffer(buffer)); + readerBase.Init(ByteBuffer.FromBuffer(buffer), new Settings()); return readerBase; } diff --git a/Source/AlphaTab.Test/Importer/GpImporterTestBase.cs b/Source/AlphaTab.Test/Importer/GpImporterTestBase.cs index 736b2ff8c..70d713bf7 100644 --- a/Source/AlphaTab.Test/Importer/GpImporterTestBase.cs +++ b/Source/AlphaTab.Test/Importer/GpImporterTestBase.cs @@ -26,7 +26,7 @@ internal void PrepareImporterWithFile(string name, Action ready) internal Gp3To5Importer PrepareImporterWithBytes(byte[] buffer) { var readerBase = new Gp3To5Importer(); - readerBase.Init(ByteBuffer.FromBuffer(buffer)); + readerBase.Init(ByteBuffer.FromBuffer(buffer), new Settings()); return readerBase; } @@ -532,8 +532,8 @@ protected void Render(Score score, [CallerFilePath] string callerFile = null, [C throw new ArgumentNullException(nameof(caller), "svg rendering failed because caller info was missing"); } #if !PHASE - var settings = Settings.Defaults; - settings.Engine = "svg"; + var settings = new Settings(); + settings.Core.Engine = "svg"; var renderer = new ScoreRenderer(settings); for (var i = 0; i < score.Tracks.Count; i++) { diff --git a/Source/AlphaTab.Test/Importer/GpxImporterTest.cs b/Source/AlphaTab.Test/Importer/GpxImporterTest.cs index 654fd577f..2ca0a11ee 100644 --- a/Source/AlphaTab.Test/Importer/GpxImporterTest.cs +++ b/Source/AlphaTab.Test/Importer/GpxImporterTest.cs @@ -25,7 +25,7 @@ internal void PrepareGpxImporterWithFile(string name, Action ready) internal GpxImporter PrepareGpxImporterWithBytes(byte[] buffer) { var readerBase = new GpxImporter(); - readerBase.Init(ByteBuffer.FromBuffer(buffer)); + readerBase.Init(ByteBuffer.FromBuffer(buffer), new Settings()); return readerBase; } diff --git a/Source/AlphaTab.Test/Importer/MusicXmlImporterTestBase.cs b/Source/AlphaTab.Test/Importer/MusicXmlImporterTestBase.cs index ba43e7ba1..31dfc5268 100644 --- a/Source/AlphaTab.Test/Importer/MusicXmlImporterTestBase.cs +++ b/Source/AlphaTab.Test/Importer/MusicXmlImporterTestBase.cs @@ -22,7 +22,7 @@ public class MusicXmlImporterTestBase internal MusicXmlImporter PrepareImporterWithBytes(byte[] buffer) { var readerBase = new MusicXmlImporter(); - readerBase.Init(ByteBuffer.FromBuffer(buffer)); + readerBase.Init(ByteBuffer.FromBuffer(buffer), new Settings()); return readerBase; } @@ -75,7 +75,7 @@ internal MusicXmlImporter PrepareImporterWithBytes(byte[] buffer) // }, false); // } - protected void TestReferenceFile(string file, Action done = null, string renderLayout = "page", bool renderAllTracks = false) + protected void TestReferenceFile(string file, Action done = null, LayoutMode renderLayout = LayoutMode.Page, bool renderAllTracks = false) { TestPlatform.LoadFile(file, fileData => { @@ -385,14 +385,11 @@ protected void AreEqual(Section expected, Section actual) } #if !PHASE - protected void Render(Track[] tracks, string path, string renderLayout) + protected void Render(Track[] tracks, string path, LayoutMode renderLayout) { - var settings = Settings.Defaults; - settings.Engine = "gdi"; - settings.Layout = new LayoutSettings - { - Mode = renderLayout - }; + var settings = new Settings(); + settings.Core.Engine = "gdi"; + settings.Display.LayoutMode = renderLayout; var renderer = new ScoreRenderer(settings); renderer.Width = 800; var images = new FastList(); diff --git a/Source/AlphaTab.Test/Model/LyricsTest.cs b/Source/AlphaTab.Test/Model/LyricsTest.cs index ee966cc42..a4f2968ca 100644 --- a/Source/AlphaTab.Test/Model/LyricsTest.cs +++ b/Source/AlphaTab.Test/Model/LyricsTest.cs @@ -18,7 +18,7 @@ internal void LoadLyricsTemplateFile(Action loaded) { var buffer = ByteBuffer.FromBuffer(data); var importer = new GpxImporter(); - importer.Init(buffer); + importer.Init(buffer, new Settings()); loaded(importer.ReadScore()); }); } diff --git a/Source/AlphaTab.Test/VisualTests/Features/EffectsAndAnnotationsTests.cs b/Source/AlphaTab.Test/VisualTests/Features/EffectsAndAnnotationsTests.cs index 5ed0656ad..c2d4c6cc8 100644 --- a/Source/AlphaTab.Test/VisualTests/Features/EffectsAndAnnotationsTests.cs +++ b/Source/AlphaTab.Test/VisualTests/Features/EffectsAndAnnotationsTests.cs @@ -8,121 +8,121 @@ public class EffectsAndAnnotationsTests : VisualTestBase [TestMethod, AsyncTestMethod] public void Markers() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Markers.gp5", "TestFiles/VisualTests/Features/EffectsAndAnnotations/Markers.png"); } [TestMethod, AsyncTestMethod] public void Tempo() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Tempo.gp5", "TestFiles/VisualTests/Features/EffectsAndAnnotations/Tempo.png"); } [TestMethod, AsyncTestMethod] public void Text() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Text.gp5", "TestFiles/VisualTests/Features/EffectsAndAnnotations/Text.png"); } [TestMethod, AsyncTestMethod] public void Chords() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Chords.gp5", "TestFiles/VisualTests/Features/EffectsAndAnnotations/Chords.png"); } [TestMethod, AsyncTestMethod] public void Vibrato() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Vibrato.gp5", "TestFiles/VisualTests/Features/EffectsAndAnnotations/Vibrato.png"); } [TestMethod, AsyncTestMethod] public void Dynamics() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Dynamics.gp5", "TestFiles/VisualTests/Features/EffectsAndAnnotations/Dynamics.png"); } [TestMethod, AsyncTestMethod] public void Tap() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Tap.gp5", "TestFiles/VisualTests/Features/EffectsAndAnnotations/Tap.png"); } [TestMethod, AsyncTestMethod] public void FadeIn() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/FadeIn.gp5", "TestFiles/VisualTests/Features/EffectsAndAnnotations/FadeIn.png"); } [TestMethod, AsyncTestMethod] public void LetRing() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/LetRing.gp5", "TestFiles/VisualTests/Features/EffectsAndAnnotations/LetRing.png"); } [TestMethod, AsyncTestMethod] public void PalmMute() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/PalmMute.gp5", "TestFiles/VisualTests/Features/EffectsAndAnnotations/PalmMute.png"); } [TestMethod, AsyncTestMethod] public void Bends() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Bends.gp", "TestFiles/VisualTests/Features/EffectsAndAnnotations/Bends.png"); } [TestMethod, AsyncTestMethod] public void TremoloBar() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Whammy.gp", "TestFiles/VisualTests/Features/EffectsAndAnnotations/TremoloBar.png"); } [TestMethod, AsyncTestMethod] public void TremoloPicking() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/TremoloPicking.gp5", "TestFiles/VisualTests/Features/EffectsAndAnnotations/TremoloPicking.png"); } [TestMethod, AsyncTestMethod] public void Brush() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Brush.gp5", "TestFiles/VisualTests/Features/EffectsAndAnnotations/Brush.png"); } [TestMethod, AsyncTestMethod] public void Slides() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Slides.gp5", "TestFiles/VisualTests/Features/EffectsAndAnnotations/Slides.png"); } [TestMethod, AsyncTestMethod] public void Trill() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Trill.gp5", "TestFiles/VisualTests/Features/EffectsAndAnnotations/Trill.png"); } [TestMethod, AsyncTestMethod] public void PickStroke() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/PickStroke.gp5", "TestFiles/VisualTests/Features/EffectsAndAnnotations/PickStroke.png"); } [TestMethod, AsyncTestMethod] public void Tuplets() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Tuplets.gp5", "TestFiles/VisualTests/Features/EffectsAndAnnotations/Tuplets.png"); } [TestMethod, AsyncTestMethod] public void Fingering() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Fingering.gpx", "TestFiles/VisualTests/Features/EffectsAndAnnotations/Fingering.png"); } [TestMethod, AsyncTestMethod] public void TripletFeel() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/TripletFeel.gpx", "TestFiles/VisualTests/Features/EffectsAndAnnotations/TripletFeel.png"); } } diff --git a/Source/AlphaTab.Test/VisualTests/Features/GeneralTests.cs b/Source/AlphaTab.Test/VisualTests/Features/GeneralTests.cs index a554735ca..beaf0d8ec 100644 --- a/Source/AlphaTab.Test/VisualTests/Features/GeneralTests.cs +++ b/Source/AlphaTab.Test/VisualTests/Features/GeneralTests.cs @@ -11,30 +11,30 @@ public class GeneralTests : VisualTestBase [TestMethod, AsyncTestMethod] public void SongDetails() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new []{0}, "TestFiles/Docs/features/SongDetails.gp5", "TestFiles/VisualTests/Features/General/SongDetails.png"); } [TestMethod, AsyncTestMethod] public void Repeats() { - var settings = Settings.Defaults; - settings.Staves.Id = "score"; + var settings = new Settings(); + settings.Display.StaveProfile = StaveProfile.Score; RunVisualTest(settings, new []{0}, "TestFiles/Docs/features/Repeats.gp5", "TestFiles/VisualTests/Features/General/Repeats.png"); } [TestMethod, AsyncTestMethod] public void AlternateEndings() { - var settings = Settings.Defaults; - settings.Staves.Id = "score"; + var settings = new Settings(); + settings.Display.StaveProfile = StaveProfile.Score; RunVisualTest(settings, new []{0}, "TestFiles/Docs/features/AlternateEndings.gp5", "TestFiles/VisualTests/Features/General/AlternateEndings.png"); } [TestMethod, AsyncTestMethod] public void Tuning() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new []{0}, "TestFiles/Docs/features/Tuning.gp5", "TestFiles/VisualTests/Features/General/Tuning.png"); } } diff --git a/Source/AlphaTab.Test/VisualTests/Features/GuitarTabsTests.cs b/Source/AlphaTab.Test/VisualTests/Features/GuitarTabsTests.cs index d803bc616..1f44710db 100644 --- a/Source/AlphaTab.Test/VisualTests/Features/GuitarTabsTests.cs +++ b/Source/AlphaTab.Test/VisualTests/Features/GuitarTabsTests.cs @@ -12,27 +12,26 @@ public class GuitarTabsTests : VisualTestBase [TestMethod, AsyncTestMethod] public void Rhythm() { - var settings = Settings.Defaults; - settings.Staves.Id = "tab"; - settings.Staves.AdditionalSettings["rhythm"] = true; + var settings = new Settings(); + settings.Display.StaveProfile = StaveProfile.Tab; + settings.Notation.RhythmMode = TabRhythmMode.ShowWithBars; RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Rhythm.gp5", "TestFiles/VisualTests/Features/GuitarTabs/Rhythm.png"); } [TestMethod, AsyncTestMethod] public void RhythmWithBeams() { - var settings = Settings.Defaults; - settings.Staves.Id = "tab"; - settings.Staves.AdditionalSettings["rhythm"] = true; - settings.Staves.AdditionalSettings["rhythmBeams"] = true; + var settings = new Settings(); + settings.Display.StaveProfile = StaveProfile.Tab; + settings.Notation.RhythmMode = TabRhythmMode.ShowWithBeams; RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Rhythm.gp5", "TestFiles/VisualTests/Features/GuitarTabs/RhythmWithBeams.png"); } [TestMethod, AsyncTestMethod] public void StringVariations() { - var settings = Settings.Defaults; - settings.Staves.Id = "tab"; + var settings = new Settings(); + settings.Display.StaveProfile = StaveProfile.Tab; RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Tabs.gp5", "TestFiles/VisualTests/Features/GuitarTabs/StringVariations.png"); } diff --git a/Source/AlphaTab.Test/VisualTests/Features/LayoutTests.cs b/Source/AlphaTab.Test/VisualTests/Features/LayoutTests.cs index c632eae9e..3ec9fd736 100644 --- a/Source/AlphaTab.Test/VisualTests/Features/LayoutTests.cs +++ b/Source/AlphaTab.Test/VisualTests/Features/LayoutTests.cs @@ -12,14 +12,14 @@ public class LayoutTests : VisualTestBase [TestMethod, AsyncTestMethod] public void PageLayout() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/features/Skillet.gp5", "TestFiles/VisualTests/Features/Layout/PageLayout.png"); } [TestMethod, AsyncTestMethod] public void MultiTrack() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0, 3 }, "TestFiles/Docs/features/Skillet.gp5", "TestFiles/VisualTests/Features/Layout/MultiTrack.png"); } @@ -27,37 +27,37 @@ public void MultiTrack() [TestMethod, AsyncTestMethod] public void PageLayout5BarsPerRow() { - var settings = Settings.Defaults; - settings.Layout.Mode = "page"; - settings.Layout.AdditionalSettings["barsPerRow"] = 5; + var settings = new Settings(); + settings.Display.LayoutMode = LayoutMode.Page; + settings.Display.BarsPerRow = 5; RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/features/Skillet.gp5", "TestFiles/VisualTests/Features/Layout/PageLayout5BarsPerRow.png"); } [TestMethod, AsyncTestMethod] public void PageLayoutBar5To8() { - var settings = Settings.Defaults; - settings.Layout.Mode = "page"; - settings.Layout.AdditionalSettings["start"] = 5; - settings.Layout.AdditionalSettings["count"] = 4; + var settings = new Settings(); + settings.Display.LayoutMode = LayoutMode.Page; + settings.Display.StartBar = 5; + settings.Display.BarCount = 4; RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/features/Skillet.gp5", "TestFiles/VisualTests/Features/Layout/PageLayoutBar5To8.png"); } [TestMethod, AsyncTestMethod] public void HorizontalLayout() { - var settings = Settings.Defaults; - settings.Layout.Mode = "horizontal"; + var settings = new Settings(); + settings.Display.LayoutMode = LayoutMode.Horizontal; RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/features/Skillet.gp5", "TestFiles/VisualTests/Features/Layout/HorizontalLayout.png"); } [TestMethod, AsyncTestMethod] public void HorizontalLayoutBar5To8() { - var settings = Settings.Defaults; - settings.Layout.Mode = "horizontal"; - settings.Layout.AdditionalSettings["start"] = 5; - settings.Layout.AdditionalSettings["count"] = 4; + var settings = new Settings(); + settings.Display.LayoutMode = LayoutMode.Horizontal; + settings.Display.StartBar = 5; + settings.Display.BarCount = 4; RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/features/Skillet.gp5", "TestFiles/VisualTests/Features/Layout/HorizontalLayoutBar5To8.png"); } diff --git a/Source/AlphaTab.Test/VisualTests/Features/MusicNotationTests.cs b/Source/AlphaTab.Test/VisualTests/Features/MusicNotationTests.cs index a18247f4d..3e651b6e8 100644 --- a/Source/AlphaTab.Test/VisualTests/Features/MusicNotationTests.cs +++ b/Source/AlphaTab.Test/VisualTests/Features/MusicNotationTests.cs @@ -1,5 +1,4 @@ - -using System; +using System; using System.Collections.Generic; using System.Text; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -12,47 +11,79 @@ public class MusicNotationTests : VisualTestBase [TestMethod, AsyncTestMethod] public void Clefs() { - var settings = Settings.Defaults; - settings.Staves.Id = "score"; - settings.Layout.Mode = "page"; - settings.Layout.AdditionalSettings["hideInfo"] = true; + var settings = new Settings(); + settings.Display.StaveProfile = StaveProfile.Score; + settings.Display.LayoutMode = LayoutMode.Page; + settings.Notation.HideInfo = true; var tex = @"\title ""Clefs"" . \clef G2 | \clef F4 | \clef C3 | \clef C4"; - RunVisualTestTex(settings, new[] { 0 }, tex, "TestFiles/VisualTests/Features/MusicNotation/Clefs.png"); + RunVisualTestTex(settings, + new[] + { + 0 + }, + tex, + "TestFiles/VisualTests/Features/MusicNotation/Clefs.png"); } [TestMethod, AsyncTestMethod] public void KeySignatures() { - var settings = Settings.Defaults; - settings.Staves.Id = "score"; - RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/features/KeySignatures.gp5", "TestFiles/VisualTests/Features/MusicNotation/KeySignatures.png"); + var settings = new Settings(); + settings.Display.StaveProfile = StaveProfile.Score; + + RunVisualTest(settings, + new[] + { + 0 + }, + "TestFiles/Docs/features/KeySignatures.gp5", + "TestFiles/VisualTests/Features/MusicNotation/KeySignatures.png"); } [TestMethod, AsyncTestMethod] public void TimeSignatures() { - var settings = Settings.Defaults; - settings.Staves.Id = "score"; - RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/features/TimeSignatures.gp5", "TestFiles/VisualTests/Features/MusicNotation/TimeSignatures.png"); + var settings = new Settings(); + settings.Display.StaveProfile = StaveProfile.Score; + + RunVisualTest(settings, + new[] + { + 0 + }, + "TestFiles/Docs/features/TimeSignatures.gp5", + "TestFiles/VisualTests/Features/MusicNotation/TimeSignatures.png"); } [TestMethod, AsyncTestMethod] public void NotesRestsBeams() { - var settings = Settings.Defaults; - settings.Staves.Id = "score"; - RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/features/Beams.gp5", "TestFiles/VisualTests/Features/MusicNotation/NotesRestsBeams.png"); + var settings = new Settings(); + settings.Display.StaveProfile = StaveProfile.Score; + + RunVisualTest(settings, + new[] + { + 0 + }, + "TestFiles/Docs/features/Beams.gp5", + "TestFiles/VisualTests/Features/MusicNotation/NotesRestsBeams.png"); } [TestMethod, AsyncTestMethod] public void Accidentals() { - var settings = Settings.Defaults; - settings.Staves.Id = "score"; - RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/features/Accidentals.gp5", "TestFiles/VisualTests/Features/MusicNotation/Accidentals.png"); - } - + var settings = new Settings(); + settings.Display.StaveProfile = StaveProfile.Score; + RunVisualTest(settings, + new[] + { + 0 + }, + "TestFiles/Docs/features/Accidentals.gp5", + "TestFiles/VisualTests/Features/MusicNotation/Accidentals.png"); + } } } diff --git a/Source/AlphaTab.Test/VisualTests/Features/SpecialNotesTests.cs b/Source/AlphaTab.Test/VisualTests/Features/SpecialNotesTests.cs index 6c22f448e..7f4da1834 100644 --- a/Source/AlphaTab.Test/VisualTests/Features/SpecialNotesTests.cs +++ b/Source/AlphaTab.Test/VisualTests/Features/SpecialNotesTests.cs @@ -12,30 +12,30 @@ public class SpecialNotesTests : VisualTestBase [TestMethod, AsyncTestMethod] public void TiedNotes() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/TiedNotes.gp5", "TestFiles/VisualTests/Features/SpecialNotes/TiedNotes.png"); } [TestMethod, AsyncTestMethod] public void GraceNotes() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/GraceNotes.gp5", "TestFiles/VisualTests/Features/SpecialNotes/GraceNotes.png"); } [TestMethod, AsyncTestMethod] public void DeadNotes() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/DeadNotes.gp5", "TestFiles/VisualTests/Features/SpecialNotes/DeadNotes.png"); } [TestMethod, AsyncTestMethod] public void GhostNotes() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/GhostNotes.gp5", "TestFiles/VisualTests/Features/SpecialNotes/GhostNotes.png"); } - + } } diff --git a/Source/AlphaTab.Test/VisualTests/Features/SpecialTracksTests.cs b/Source/AlphaTab.Test/VisualTests/Features/SpecialTracksTests.cs index 9ab34f9ff..61e9c8300 100644 --- a/Source/AlphaTab.Test/VisualTests/Features/SpecialTracksTests.cs +++ b/Source/AlphaTab.Test/VisualTests/Features/SpecialTracksTests.cs @@ -12,13 +12,13 @@ public class SpecialTracksTests : VisualTestBase [TestMethod, AsyncTestMethod] public void DrumTabs() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Drums.gp5", "TestFiles/VisualTests/Features/SpecialTracks/DrumTabs.png"); } [TestMethod, AsyncTestMethod] public void GrandStaff() { - var settings = Settings.Defaults; + var settings = new Settings(); RunVisualTest(settings, new[] { 0 }, "TestFiles/Docs/Features/Piano.gpx", "TestFiles/VisualTests/Features/SpecialTracks/GrandStaff.png"); } } diff --git a/Source/AlphaTab/AlphaTab.Shared.projitems b/Source/AlphaTab/AlphaTab.Shared.projitems index 2fa1e44dc..ef013464c 100644 --- a/Source/AlphaTab/AlphaTab.Shared.projitems +++ b/Source/AlphaTab/AlphaTab.Shared.projitems @@ -63,7 +63,7 @@ - + @@ -92,7 +92,6 @@ - @@ -272,7 +271,6 @@ - @@ -292,14 +290,13 @@ - + - diff --git a/Source/AlphaTab/AlphaTabApi.cs b/Source/AlphaTab/AlphaTabApi.cs index c39511e88..56c0902ef 100644 --- a/Source/AlphaTab/AlphaTabApi.cs +++ b/Source/AlphaTab/AlphaTabApi.cs @@ -71,7 +71,7 @@ public AlphaTabApi(IUiFacade uiFacade, TSettings settings) Container = uiFacade.RootContainer; uiFacade.Initialize(this, settings); - Logger.LogLevel = Settings.LogLevel; + Logger.LogLevel = Settings.Core.LogLevel; CanvasElement = uiFacade.CreateCanvasElement(); Container.AppendChild(CanvasElement); @@ -86,7 +86,7 @@ public AlphaTabApi(IUiFacade uiFacade, TSettings settings) }, uiFacade.ResizeThrottle); - if (Settings.UseWorkers && UiFacade.AreWorkersSupported && + if (Settings.Core.UseWorkers && UiFacade.AreWorkersSupported && Environment.GetRenderEngineFactory(Settings).SupportsWorkers) { Renderer = UiFacade.CreateWorkerRenderer(); @@ -122,7 +122,7 @@ public AlphaTabApi(IUiFacade uiFacade, TSettings settings) }; Renderer.Error += OnError; - if (Settings.EnablePlayer) + if (Settings.Player.EnablePlayer) { SetupPlayer(); } @@ -156,7 +156,7 @@ public void UpdateSettings() Renderer.UpdateSettings(Settings); // enable/disable player if needed - if (Settings.EnablePlayer) + if (Settings.Player.EnablePlayer) { SetupPlayer(); } @@ -214,21 +214,30 @@ public void RenderScore(Score score, int[] trackIndexes = null) tracks.Add(score.Tracks[0]); } } - - if (trackIndexes.Length == 0) + else { - if (score.Tracks.Count > 0) + if (trackIndexes.Length == 0) { - tracks.Add(score.Tracks[0]); + if (score.Tracks.Count > 0) + { + tracks.Add(score.Tracks[0]); + } } - } - else - { - foreach (var index in trackIndexes) + else if (trackIndexes.Length == 1 && trackIndexes[0] == -1) { - if (index >= 0 && index <= score.Tracks.Count) + foreach (var track in score.Tracks) { - tracks.Add(score.Tracks[index]); + tracks.Add(track); + } + } + else + { + foreach (var index in trackIndexes) + { + if (index >= 0 && index <= score.Tracks.Count) + { + tracks.Add(score.Tracks[index]); + } } } } @@ -664,7 +673,7 @@ private void SetupPlayer() Player.PositionChanged += OnPlayerPositionChanged; Player.Finished += OnPlayerFinished; - if (Settings.EnableCursor) + if (Settings.Player.EnableCursor) { SetupCursors(); } @@ -858,7 +867,6 @@ private void SetupCursors() // // Hook into events - //var surface = Element.QuerySelector(".alphaTabSurface"); _previousTick = 0; _playerState = PlayerState.Paused; // we need to update our position caches if we render a tablature @@ -964,7 +972,6 @@ private void CursorUpdateBeat(Beat beat, Beat nextBeat, double duration, bool st beatCursor.StopAnimation(); beatCursor.Top = barBounds.Y; beatCursor.Left = beatBoundings.VisualBounds.X; - beatCursor.Width = Settings.BeatCursorWidth; beatCursor.Height = barBounds.H; // if playing, animate the cursor to the next beat @@ -1007,12 +1014,12 @@ private void CursorUpdateBeat(Beat beat, Beat nextBeat, double duration, bool st }); } - if (!_selecting && Settings.ScrollMode != ScrollMode.Off) + if (!_selecting && Settings.Player.ScrollMode != ScrollMode.Off) { //// calculate position of whole music wheet within the scroll parent var scrollElement = UiFacade.GetScrollContainer(); var isVertical = Environment.GetLayoutEngineFactory(Settings).Vertical; - var mode = Settings.ScrollMode; + var mode = Settings.Player.ScrollMode; var elementOffset = UiFacade.GetOffset(scrollElement, Container); @@ -1021,11 +1028,11 @@ private void CursorUpdateBeat(Beat beat, Beat nextBeat, double duration, bool st switch (mode) { case ScrollMode.Continuous: - var y = (int)(elementOffset.Y + barBoundings.RealBounds.Y + Settings.ScrollOffsetY); + var y = (int)(elementOffset.Y + barBoundings.RealBounds.Y + Settings.Player.ScrollOffsetY); if (y != _lastScroll) { _lastScroll = y; - UiFacade.ScrollToY(scrollElement, y, Settings.ScrollSpeed); + UiFacade.ScrollToY(scrollElement, y, Settings.Player.ScrollSpeed); } break; @@ -1034,9 +1041,9 @@ private void CursorUpdateBeat(Beat beat, Beat nextBeat, double duration, bool st if (barBoundings.VisualBounds.Y + barBoundings.VisualBounds.H >= elementBottom || barBoundings.VisualBounds.Y < scrollElement.ScrollTop) { - var scrollTop = barBoundings.RealBounds.Y + Settings.ScrollOffsetY; + var scrollTop = barBoundings.RealBounds.Y + Settings.Player.ScrollOffsetY; _lastScroll = (int)barBoundings.VisualBounds.X; - UiFacade.ScrollToY(scrollElement, (int)scrollTop, Settings.ScrollSpeed); + UiFacade.ScrollToY(scrollElement, (int)scrollTop, Settings.Player.ScrollSpeed); } break; @@ -1050,9 +1057,9 @@ private void CursorUpdateBeat(Beat beat, Beat nextBeat, double duration, bool st var x = (int)barBoundings.VisualBounds.X; if (x != _lastScroll) { - var scrollLeft = (int)(barBoundings.RealBounds.X + Settings.ScrollOffsetX); + var scrollLeft = (int)(barBoundings.RealBounds.X + Settings.Player.ScrollOffsetX); _lastScroll = (int)barBoundings.VisualBounds.X; - UiFacade.ScrollToX(scrollElement, scrollLeft, Settings.ScrollSpeed); + UiFacade.ScrollToX(scrollElement, scrollLeft, Settings.Player.ScrollSpeed); } break; @@ -1061,9 +1068,9 @@ private void CursorUpdateBeat(Beat beat, Beat nextBeat, double duration, bool st if (barBoundings.VisualBounds.X + barBoundings.VisualBounds.W >= elementRight || barBoundings.VisualBounds.X < scrollElement.ScrollLeft) { - var scrollLeft = barBoundings.RealBounds.X + Settings.ScrollOffsetX; + var scrollLeft = barBoundings.RealBounds.X + Settings.Player.ScrollOffsetX; _lastScroll = (int)barBoundings.VisualBounds.X; - UiFacade.ScrollToX(scrollElement, (int)scrollLeft, Settings.ScrollSpeed); + UiFacade.ScrollToX(scrollElement, (int)scrollLeft, Settings.Player.ScrollSpeed); } break; @@ -1104,7 +1111,7 @@ private void SetupClickHandling() { CanvasElement.MouseDown += e => { - if (!e.IsLeftMouseButton || !Settings.EnablePlayer || !Settings.EnableCursor) + if (!e.IsLeftMouseButton || !Settings.Player.EnablePlayer || !Settings.Player.EnableCursor) { return; } @@ -1124,7 +1131,7 @@ private void SetupClickHandling() CanvasElement.MouseMove += e => { - if (!_selecting || !Settings.EnablePlayer || !Settings.EnableCursor) + if (!_selecting || !Settings.Player.EnablePlayer || !Settings.Player.EnableCursor) { return; } @@ -1141,7 +1148,7 @@ private void SetupClickHandling() CanvasElement.MouseUp += e => { - if (!_selecting || !Settings.EnablePlayer || !Settings.EnableCursor) + if (!_selecting || !Settings.Player.EnablePlayer || !Settings.Player.EnableCursor) { return; } @@ -1195,7 +1202,7 @@ private void SetupClickHandling() Renderer.PostRenderFinished += () => { - if (_selectionStart == null || !Settings.EnablePlayer || !Settings.EnableCursor) + if (_selectionStart == null || !Settings.Player.EnablePlayer || !Settings.Player.EnableCursor) { return; } @@ -1203,18 +1210,6 @@ private void SetupClickHandling() }; } - /// - /// Updates the layout settings and triggers a re-rendering. - /// - /// The new layout settings to apply - public virtual void UpdateLayout(LayoutSettings layoutSettings) - { - Settings.Layout = layoutSettings; - Renderer.UpdateSettings(Settings); - Renderer.Render(); - } - - private void CursorSelectRange(SelectionInfo startBeat, SelectionInfo endBeat) { var cache = Renderer.BoundsLookup; diff --git a/Source/AlphaTab/Audio/Generator/MidiFileGenerator.cs b/Source/AlphaTab/Audio/Generator/MidiFileGenerator.cs index b35a74046..2b1c27b41 100644 --- a/Source/AlphaTab/Audio/Generator/MidiFileGenerator.cs +++ b/Source/AlphaTab/Audio/Generator/MidiFileGenerator.cs @@ -42,7 +42,7 @@ public class MidiFileGenerator public MidiFileGenerator(Score score, Settings settings, IMidiFileHandler handler) { _score = score; - _settings = settings == null ? Settings.Defaults : settings; + _settings = settings == null ? new Settings() : settings; _currentTempo = _score.Tempo; _handler = handler; TickLookup = new MidiTickLookup(); @@ -241,7 +241,7 @@ private void GenerateBeat(Beat beat, int barStartTick, Bar realBar) { audioDuration = beat.Voice.Bar.MasterBar.CalculateDuration(); } - else if (beat.Voice.Bar.MasterBar.TripletFeel != TripletFeel.NoTripletFeel && (_settings == null || _settings.PlayTripletFeel)) + else if (beat.Voice.Bar.MasterBar.TripletFeel != TripletFeel.NoTripletFeel && _settings.Player.PlayTripletFeel) { if (_currentTripletFeel != null) { @@ -321,12 +321,12 @@ private void GenerateBeat(Beat beat, int barStartTick, Bar realBar) switch (beat.Vibrato) { case VibratoType.Slight: - phaseLength = _settings.Vibrato.BeatSlightLength; - bendAmplitude = _settings.Vibrato.BeatSlightAmplitude; + phaseLength = _settings.Player.Vibrato.BeatSlightLength; + bendAmplitude = _settings.Player.Vibrato.BeatSlightAmplitude; break; case VibratoType.Wide: - phaseLength = _settings.Vibrato.BeatWideLength; - bendAmplitude = _settings.Vibrato.BeatWideAmplitude; + phaseLength = _settings.Player.Vibrato.BeatWideLength; + bendAmplitude = _settings.Player.Vibrato.BeatWideAmplitude; break; } @@ -569,7 +569,7 @@ private MidiNoteDuration GetNoteDuration(Note note, int duration) } } - if (note.IsLetRing && (_settings == null || _settings.DisplayMode == DisplayMode.GuitarPro)) + if (note.IsLetRing && _settings.Notation.NotationMode == NotationMode.GuitarPro) { // LetRing ends when: // - rest @@ -707,12 +707,12 @@ private void GenerateVibrato(Note note, int noteStart, MidiNoteDuration noteDura switch (note.Vibrato) { case VibratoType.Slight: - phaseLength = _settings.Vibrato.NoteSlightLength; - bendAmplitude = _settings.Vibrato.NoteSlightAmplitude; + phaseLength = _settings.Player.Vibrato.NoteSlightLength; + bendAmplitude = _settings.Player.Vibrato.NoteSlightAmplitude; break; case VibratoType.Wide: - phaseLength = _settings.Vibrato.NoteWideLength; - bendAmplitude = _settings.Vibrato.NoteWideAmplitude; + phaseLength = _settings.Player.Vibrato.NoteWideLength; + bendAmplitude = _settings.Player.Vibrato.NoteWideAmplitude; break; default: return; @@ -770,7 +770,7 @@ private void GenerateBend(Note note, int noteStart, MidiNoteDuration noteDuratio // Bends are spread across all tied notes unless they have a bend on their own. double duration; - if (note.IsTieOrigin && _settings.ExtendBendArrowsOnTiedNotes) + if (note.IsTieOrigin && _settings.Notation.ExtendBendArrowsOnTiedNotes) { var endNote = note; while (endNote.IsTieOrigin && !endNote.TieDestination.HasBend) @@ -798,7 +798,7 @@ private void GenerateBend(Note note, int noteStart, MidiNoteDuration noteDuratio } duration = Math.Max(noteDuration.NoteOnly, - MidiUtils.MillisToTicks(_settings.SongBookBendDuration, _currentTempo)); + MidiUtils.MillisToTicks(_settings.Player.SongBookBendDuration, _currentTempo)); } else { @@ -812,7 +812,7 @@ private void GenerateBend(Note note, int noteStart, MidiNoteDuration noteDuratio } var bendDuration = Math.Min(duration, - MidiUtils.MillisToTicks(_settings.SongBookBendDuration, _currentTempo)); + MidiUtils.MillisToTicks(_settings.Player.SongBookBendDuration, _currentTempo)); var playedBendPoints = new FastList(); switch (note.BendType) @@ -1025,7 +1025,7 @@ private void GenerateWhammy(Beat beat, int noteStart, MidiNoteDuration noteDurat break; case BendStyle.Fast: var whammyDuration = Math.Min(duration, - MidiUtils.MillisToTicks(_settings.SongBookBendDuration, _currentTempo)); + MidiUtils.MillisToTicks(_settings.Player.SongBookBendDuration, _currentTempo)); GenerateSongBookWhammyOrBend(noteStart, channel, duration, @@ -1053,7 +1053,7 @@ private void GenerateWhammy(Beat beat, int noteStart, MidiNoteDuration noteDurat break; case BendStyle.Fast: var whammyDuration = Math.Min(duration, - MidiUtils.MillisToTicks(_settings.SongBookDipDuration, _currentTempo)); + MidiUtils.MillisToTicks(_settings.Player.SongBookDipDuration, _currentTempo)); GenerateSongBookWhammyOrBend(noteStart, channel, duration, @@ -1090,7 +1090,7 @@ private void GenerateWhammy(Beat beat, int noteStart, MidiNoteDuration noteDurat _handler.AddBend(track.Index, noteStart, (byte)channel, (int)preDiveValue); var whammyDuration = Math.Min(duration, - MidiUtils.MillisToTicks(_settings.SongBookBendDuration, _currentTempo)); + MidiUtils.MillisToTicks(_settings.Player.SongBookBendDuration, _currentTempo)); GenerateSongBookWhammyOrBend(noteStart, channel, duration, diff --git a/Source/AlphaTab/Environment.cs b/Source/AlphaTab/Environment.cs index 37be35c81..cf5e275e1 100644 --- a/Source/AlphaTab/Environment.cs +++ b/Source/AlphaTab/Environment.cs @@ -14,12 +14,8 @@ namespace AlphaTab internal partial class Environment { public static FastDictionary RenderEngines; - public static FastDictionary LayoutEngines; - public static FastDictionary StaveProfiles; - public const string StaveProfileScoreTab = "score-tab"; - public const string StaveProfileTab = "tab"; - public const string StaveProfileTabMixed = "tab-mixed"; - public const string StaveProfileScore = "score"; + public static FastDictionary LayoutEngines; + public static FastDictionary StaveProfiles; static Environment() { @@ -33,39 +29,33 @@ public static IScoreRenderer CreateScoreRenderer(Settings settings) public static RenderEngineFactory GetRenderEngineFactory(Settings settings) { - if (settings.Engine == null || !RenderEngines.ContainsKey(settings.Engine)) + if (settings.Core.Engine == null || !RenderEngines.ContainsKey(settings.Core.Engine)) { return RenderEngines["default"]; } - return RenderEngines[settings.Engine]; + return RenderEngines[settings.Core.Engine]; } public static LayoutEngineFactory GetLayoutEngineFactory(Settings settings) { - if (settings.Layout.Mode == null || !LayoutEngines.ContainsKey(settings.Layout.Mode)) - { - return LayoutEngines["default"]; - } - - return LayoutEngines[settings.Layout.Mode]; + return LayoutEngines[settings.Display.LayoutMode]; } public static void Init() { RenderEngines = new FastDictionary(); - LayoutEngines = new FastDictionary(); - StaveProfiles = new FastDictionary(); + LayoutEngines = new FastDictionary(); + StaveProfiles = new FastDictionary(); PlatformInit(); // default layout engines - LayoutEngines["page"] = new LayoutEngineFactory(true, r => new PageViewLayout(r)); - LayoutEngines["horizontal"] = new LayoutEngineFactory(false, r => new HorizontalScreenLayout(r)); - LayoutEngines["default"] = LayoutEngines["page"]; + LayoutEngines[LayoutMode.Page] = new LayoutEngineFactory(true, r => new PageViewLayout(r)); + LayoutEngines[LayoutMode.Horizontal] = new LayoutEngineFactory(false, r => new HorizontalScreenLayout(r)); // default combinations of stave textprofiles - StaveProfiles["default"] = StaveProfiles[StaveProfileScoreTab] = new BarRendererFactory[] + StaveProfiles[StaveProfile.ScoreTab] = new BarRendererFactory[] { new EffectBarRendererFactory("score-effects", new IEffectBarRendererInfo[] @@ -93,7 +83,7 @@ public static void Init() new TabBarRendererFactory(false, false, false) }; - StaveProfiles[StaveProfileScore] = new BarRendererFactory[] + StaveProfiles[StaveProfile.Score] = new BarRendererFactory[] { new EffectBarRendererFactory("score-effects", new IEffectBarRendererInfo[] @@ -143,7 +133,7 @@ public static void Init() new AlternateEndingsEffectInfo() }; - StaveProfiles[StaveProfileTab] = new BarRendererFactory[] + StaveProfiles[StaveProfile.Tab] = new BarRendererFactory[] { new EffectBarRendererFactory("tab-effects", tabEffectInfos), new TabBarRendererFactory(true, true, true), new EffectBarRendererFactory("tab-bottom-effects", @@ -153,7 +143,7 @@ public static void Init() }) }; - StaveProfiles[StaveProfileTabMixed] = new BarRendererFactory[] + StaveProfiles[StaveProfile.TabMixed] = new BarRendererFactory[] { new EffectBarRendererFactory("tab-effects",tabEffectInfos), new TabBarRendererFactory(false, false, false), new EffectBarRendererFactory("tab-bottom-effects", diff --git a/Source/AlphaTab/FingeringMode.cs b/Source/AlphaTab/FingeringMode.cs index a5fa8b5d8..7338d46d8 100644 --- a/Source/AlphaTab/FingeringMode.cs +++ b/Source/AlphaTab/FingeringMode.cs @@ -1,19 +1,35 @@ +using AlphaTab.Util; + namespace AlphaTab { /// /// Lists all modes on how fingerings should be displayed. /// + [JsonSerializable] public enum FingeringMode { /// - /// Fingerings will be shown in the standard notation staff. + /// Fingerings will be shown in the standard notation staff. + /// + ScoreDefault, + + /// + /// Fingerings will be shown in the standard notation staff. Piano finger style is enforced, where + /// fingers are rendered as 1-5 instead of p,i,m,a,c and T,1,2,3,4. /// - Score, + ScoreForcePiano, /// /// Fingerings will be shown in a effect band above the tabs in case /// they have only a single note on the beat. /// - SingleNoteEffectBand + SingleNoteEffectBand, + + /// + /// Fingerings will be shown in a effect band above the tabs in case + /// they have only a single note on the beat. Piano finger style is enforced, where + /// fingers are rendered as 1-5 instead of p,i,m,a,c and T,1,2,3,4. + /// + SingleNoteEffectBandForcePiano } } diff --git a/Source/AlphaTab/Importer/Gp3To5Importer.cs b/Source/AlphaTab/Importer/Gp3To5Importer.cs index c1155d722..357ab0e74 100644 --- a/Source/AlphaTab/Importer/Gp3To5Importer.cs +++ b/Source/AlphaTab/Importer/Gp3To5Importer.cs @@ -30,7 +30,7 @@ internal class Gp3To5Importer : ScoreImporter public override Score ReadScore() { - _encoding = GetSetting("encoding", "utf-8"); + _encoding = Settings.Importer.Encoding; ReadVersion(); _score = new Score(); @@ -283,7 +283,7 @@ public void ReadMasterBar() if (_versionNumber < 500) { var currentMasterBar = previousMasterBar; - // get the already existing alternatives to ignore them + // get the already existing alternatives to ignore them var existentAlternatives = 0; while (currentMasterBar != null) { @@ -444,7 +444,7 @@ public void ReadTrack() if (_versionNumber >= 500) { - // flags for + // flags for // 0x01 -> show tablature // 0x02 -> show standard notation Data.ReadByte(); @@ -911,7 +911,7 @@ public void ReadMixTableChange(Beat beat) tableChange.Instrument = Data.ReadSignedByte(); if (_versionNumber >= 500) { - Data.Skip(16); // Rse Info + Data.Skip(16); // Rse Info } tableChange.Volume = Data.ReadSignedByte(); @@ -1055,7 +1055,7 @@ public void ReadNote(Track track, Bar bar, Voice voice, Beat beat, int stringInd if ((flags & 0x01) != 0 && _versionNumber < 500) { - Data.ReadByte(); // duration + Data.ReadByte(); // duration Data.ReadByte(); // tuplet } @@ -1351,7 +1351,7 @@ public void ReadArtificialHarmonic(Note note) note.HarmonicType = HarmonicType.Artificial; // ReSharper restore UnusedVariable break; - // TODO: how to calculate the harmonic value? + // TODO: how to calculate the harmonic value? case 3: note.HarmonicType = HarmonicType.Tap; note.HarmonicValue = DeltaFretToHarmonicValue(Data.ReadByte()); diff --git a/Source/AlphaTab/Importer/Gp7Importer.cs b/Source/AlphaTab/Importer/Gp7Importer.cs index 1fb5bbf95..4cee2ed6d 100644 --- a/Source/AlphaTab/Importer/Gp7Importer.cs +++ b/Source/AlphaTab/Importer/Gp7Importer.cs @@ -14,7 +14,7 @@ internal class Gp7Importer : ScoreImporter public override Score ReadScore() { - // at first we need to load the binary file system + // at first we need to load the binary file system // from the GPX container Logger.Info(Name, "Loading ZIP entries"); var fileSystem = new ZipFile(); @@ -42,7 +42,7 @@ public override Score ReadScore() switch (entry.FileName) { case GpxFileSystem.ScoreGpif: - xml = Platform.Platform.ToString(entry.Data, GetSetting("encoding", "utf-8")); + xml = Platform.Platform.ToString(entry.Data, Settings.Importer.Encoding); break; case GpxFileSystem.BinaryStylesheet: binaryStylesheet = entry.Data; diff --git a/Source/AlphaTab/Importer/GpxImporter.cs b/Source/AlphaTab/Importer/GpxImporter.cs index b76f94826..ee072426a 100644 --- a/Source/AlphaTab/Importer/GpxImporter.cs +++ b/Source/AlphaTab/Importer/GpxImporter.cs @@ -12,7 +12,7 @@ internal class GpxImporter : ScoreImporter public override Score ReadScore() { - // at first we need to load the binary file system + // at first we need to load the binary file system // from the GPX container Logger.Info(Name, "Loading GPX filesystem"); var fileSystem = new GpxFileSystem(); @@ -32,7 +32,7 @@ public override Score ReadScore() switch (entry.FileName) { case GpxFileSystem.ScoreGpif: - xml = Platform.Platform.ToString(entry.Data, GetSetting("encoding", "utf-8")); + xml = Platform.Platform.ToString(entry.Data, Settings.Importer.Encoding); break; case GpxFileSystem.BinaryStylesheet: binaryStylesheet = entry.Data; diff --git a/Source/AlphaTab/Importer/MusicXmlImporter.cs b/Source/AlphaTab/Importer/MusicXmlImporter.cs index a3063b475..6caab3418 100644 --- a/Source/AlphaTab/Importer/MusicXmlImporter.cs +++ b/Source/AlphaTab/Importer/MusicXmlImporter.cs @@ -9,8 +9,6 @@ namespace AlphaTab.Importer { internal class MusicXmlImporter : ScoreImporter { - public const string MergePartGroupsSetting = "musicXMLMergePartGroups"; - private Score _score; private FastDictionary _trackById; private FastDictionary> _partGroups; @@ -34,7 +32,7 @@ public override Score ReadScore() _tieStarts = new FastList(); _tieStartIds = new FastDictionary(); _slurStarts = new FastDictionary(); - var xml = Platform.Platform.ToString(Data.ReadAll(), GetSetting("encoding", "utf-8")); + var xml = Platform.Platform.ToString(Data.ReadAll(), Settings.Importer.Encoding); XmlDocument dom; try { @@ -50,7 +48,7 @@ public override Score ReadScore() ParseDom(dom); // merge partgroups into a single track with multiple staves - if (GetSetting(MergePartGroupsSetting, false)) + if (Settings.Importer.MergePartGroupsInMusicXml) { MergePartGroups(); } diff --git a/Source/AlphaTab/Importer/ScoreImporter.cs b/Source/AlphaTab/Importer/ScoreImporter.cs index 37ae2b046..137281bc1 100644 --- a/Source/AlphaTab/Importer/ScoreImporter.cs +++ b/Source/AlphaTab/Importer/ScoreImporter.cs @@ -37,29 +37,12 @@ public static ScoreImporter[] BuildImporters() /// /// /// - public void Init(IReadable data, Settings settings = null) + public void Init(IReadable data, Settings settings) { Data = data; Settings = settings; } - /// - /// Gets the importer specific setting using the specified key. - /// - /// The key of the setting to load the value for. - /// The default value to load if no setting was specified. - /// The importer setting specified by the user, or the given defaultValue if the key was not contained. - protected T GetSetting(string key, T defaultValue = default(T)) - { - key = key.ToLower(); - if (Settings == null || Settings.ImporterSettings == null || !Settings.ImporterSettings.ContainsKey(key)) - { - return defaultValue; - } - - return (T)Settings.ImporterSettings[key]; - } - /// /// Get the human readable name of the importer. /// diff --git a/Source/AlphaTab/LayoutSettings.cs b/Source/AlphaTab/LayoutSettings.cs deleted file mode 100644 index a783e38ef..000000000 --- a/Source/AlphaTab/LayoutSettings.cs +++ /dev/null @@ -1,74 +0,0 @@ -using AlphaTab.Collections; - -namespace AlphaTab -{ - /// - /// Represents the layout specific settings. - /// - public class LayoutSettings - { - /// - /// The layouting mode used to arrange the the notation. - ///
      - ///
    • page - Bars are aligned in rows using a fixed width
    • - ///
    • horizontal - Bars are aligned horizontally in one row
    • - ///
    - ///
    - public string Mode { get; set; } - - /// - /// Additional layout mode specific settings. - /// mode=page - ///
      - ///
    • barsPerRow - Limit the displayed bars per row, -1 for sized based limit (integer, default:-1)
    • - ///
    • start - The bar start index to start layouting with (integer: default: 0)
    • - ///
    • count - The amount of bars to render overall, -1 for all till the end (integer, default:-1)
    • - ///
    • hideInfo - Render the song information or not (boolean, default:false)
    • - ///
    • hideTuning - Render the tuning information or not (boolean, default:false)
    • - ///
    • hideTrackNames - Render the track names or not (boolean, default:false)
    • - ///
    - /// mode=horizontal - ///
      - ///
    • start - The bar start index to start layouting with (integer: default: 0)
    • - ///
    • count - The amount of bars to render overall, -1 for all till the end (integer, default:-1)
    • - ///
    • hideTrackNames - Render the track names or not (boolean, default:false)
    • - ///
    - ///
    - public FastDictionary AdditionalSettings { get; set; } - - internal T Get(string key, T def) - { - if (AdditionalSettings.ContainsKey(key.ToLower())) - { - return (T)AdditionalSettings[key.ToLower()]; - } - - if (AdditionalSettings.ContainsKey(key)) - { - return (T)AdditionalSettings[key]; - } - - return def; - } - - /// - /// Initializes a new instance of the class. - /// - public LayoutSettings() - { - AdditionalSettings = new FastDictionary(); - } - - internal static LayoutSettings Defaults - { - get - { - var settings = new LayoutSettings - { - Mode = "page" - }; - return settings; - } - } - } -} diff --git a/Source/AlphaTab/Model/Beat.cs b/Source/AlphaTab/Model/Beat.cs index 309c4f668..fb61f5d83 100644 --- a/Source/AlphaTab/Model/Beat.cs +++ b/Source/AlphaTab/Model/Beat.cs @@ -652,9 +652,9 @@ internal void FinishTuplet() internal void Finish(Settings settings) { - var displayMode = settings == null ? DisplayMode.GuitarPro : settings.DisplayMode; + var displayMode = settings == null ? NotationMode.GuitarPro : settings.Notation.NotationMode; var isGradual = Text == "grad" || Text == "grad."; - if (isGradual && displayMode == DisplayMode.SongBook) + if (isGradual && displayMode == NotationMode.SongBook) { Text = ""; } @@ -682,7 +682,7 @@ internal void Finish(Settings settings) IsPalmMute = true; } - if (displayMode == DisplayMode.SongBook && note.HasBend && GraceType != GraceType.BendGrace) + if (displayMode == NotationMode.SongBook && note.HasBend && GraceType != GraceType.BendGrace) { if (!note.IsTieOrigin) { @@ -782,7 +782,7 @@ internal void Finish(Settings settings) // if beat is a rest implicitely take over letring/palmmute // from the previous beat gets cleaned later in case we flagged it wrong. else if (IsRest && PreviousBeat != null && settings != null && - settings.DisplayMode == DisplayMode.GuitarPro) + settings.Notation.NotationMode == NotationMode.GuitarPro) { if (PreviousBeat.IsLetRing) { @@ -800,7 +800,7 @@ internal void Finish(Settings settings) // Guitar Pro 6 and above (gpif.xml) uses exactly 4 points to define all whammys if (WhammyBarPoints.Count > 0 && WhammyBarType == WhammyType.Custom) { - if (displayMode == DisplayMode.SongBook) + if (displayMode == NotationMode.SongBook) { WhammyStyle = isGradual ? BendStyle.Gradual : BendStyle.Fast; } @@ -837,7 +837,7 @@ internal void Finish(Settings settings) origin.Value < middle1.Value && middle1.Value > destination.Value) { WhammyBarType = WhammyType.Dip; - if (middle1.Offset == middle2.Offset || displayMode == DisplayMode.SongBook) + if (middle1.Offset == middle2.Offset || displayMode == NotationMode.SongBook) { WhammyBarPoints.RemoveAt(2); } diff --git a/Source/AlphaTab/Model/ModelUtils.cs b/Source/AlphaTab/Model/ModelUtils.cs index 661979980..f8d14552f 100644 --- a/Source/AlphaTab/Model/ModelUtils.cs +++ b/Source/AlphaTab/Model/ModelUtils.cs @@ -38,19 +38,19 @@ public static void ApplyPitchOffsets(Settings settings, Score score) { for (var i = 0; i < score.Tracks.Count; i++) { - if (i < settings.DisplayTranspositionPitches.Length) + if (i < settings.Notation.DisplayTranspositionPitches.Length) { foreach (var staff in score.Tracks[i].Staves) { - staff.DisplayTranspositionPitch = -settings.DisplayTranspositionPitches[i]; + staff.DisplayTranspositionPitch = -settings.Notation.DisplayTranspositionPitches[i]; } } - if (i < settings.TranspositionPitches.Length) + if (i < settings.Notation.TranspositionPitches.Length) { foreach (var staff in score.Tracks[i].Staves) { - staff.TranspositionPitch = -settings.TranspositionPitches[i]; + staff.TranspositionPitch = -settings.Notation.TranspositionPitches[i]; } } } @@ -58,7 +58,9 @@ public static void ApplyPitchOffsets(Settings settings, Score score) public static string FingerToString(Settings settings, Beat beat, Fingers finger, bool leftHand) { - if (settings.ForcePianoFingering || GeneralMidi.IsPiano(beat.Voice.Bar.Staff.Track.PlaybackInfo.Program)) + if (settings.Notation.FingeringMode == FingeringMode.ScoreForcePiano || + settings.Notation.FingeringMode == FingeringMode.SingleNoteEffectBandForcePiano || + GeneralMidi.IsPiano(beat.Voice.Bar.Staff.Track.PlaybackInfo.Program)) { switch (finger) { diff --git a/Source/AlphaTab/Model/Note.cs b/Source/AlphaTab/Model/Note.cs index fcb4edb47..bba8109f5 100644 --- a/Source/AlphaTab/Model/Note.cs +++ b/Source/AlphaTab/Model/Note.cs @@ -726,7 +726,7 @@ internal void Finish(Settings settings) { var nextNoteOnLine = new Util.Lazy(() => NextNoteOnSameLine(this)); - var isSongBook = settings != null && settings.DisplayMode == DisplayMode.SongBook; + var isSongBook = settings != null && settings.Notation.NotationMode == NotationMode.SongBook; // connect ties if (IsTieDestination) diff --git a/Source/AlphaTab/DisplayMode.cs b/Source/AlphaTab/NotationMode.cs similarity index 95% rename from Source/AlphaTab/DisplayMode.cs rename to Source/AlphaTab/NotationMode.cs index 53a5e89ba..32570ca57 100644 --- a/Source/AlphaTab/DisplayMode.cs +++ b/Source/AlphaTab/NotationMode.cs @@ -1,9 +1,12 @@ +using AlphaTab.Util; + namespace AlphaTab { /// /// Lists all modes on how alphaTab can handle the display and playback of music notation. /// - public enum DisplayMode + [JsonSerializable] + public enum NotationMode { /// /// Music elements will be displayed and played as in Guitar Pro. diff --git a/Source/AlphaTab/Platform/Model/Color.cs b/Source/AlphaTab/Platform/Model/Color.cs index 7bb5c105c..38588641e 100644 --- a/Source/AlphaTab/Platform/Model/Color.cs +++ b/Source/AlphaTab/Platform/Model/Color.cs @@ -1,9 +1,11 @@ -namespace AlphaTab.Platform.Model +using AlphaTab.Util; + +namespace AlphaTab.Platform.Model { /// /// A color object which allows accessing each color component individually. /// - public class Color + public partial class Color { /// /// Gets the hex string for black. diff --git a/Source/AlphaTab/Platform/Model/Font.cs b/Source/AlphaTab/Platform/Model/Font.cs index 81481f729..ad9557a00 100644 --- a/Source/AlphaTab/Platform/Model/Font.cs +++ b/Source/AlphaTab/Platform/Model/Font.cs @@ -1,12 +1,14 @@ -using System; +using System; using AlphaTab.Collections; +using AlphaTab.Util; namespace AlphaTab.Platform.Model { /// /// This container public class can store the definition for a font and it's style. /// - public class Font + [JsonImmutable] + public partial class Font { private string _css; private float _cssScale; diff --git a/Source/AlphaTab/Platform/Svg/SvgCanvas.cs b/Source/AlphaTab/Platform/Svg/SvgCanvas.cs index fe7247b41..376b05dc4 100644 --- a/Source/AlphaTab/Platform/Svg/SvgCanvas.cs +++ b/Source/AlphaTab/Platform/Svg/SvgCanvas.cs @@ -41,7 +41,7 @@ public virtual void BeginRender(float width, float height) Buffer.Append(width); Buffer.Append("px\" height=\""); Buffer.Append((int)height); - Buffer.Append("px\" class=\"alphaTabSurfaceSvg\">\n"); + Buffer.Append("px\" class=\"at-surface-svg\">\n"); _currentPath = new StringBuilder(); _currentPathIsEmpty = true; } @@ -175,7 +175,7 @@ public void FillText(string text, float x, float y) } var s = " - /// Gets or sets whether this renderer is linked to the next one + /// Gets or sets whether this renderer is linked to the next one /// by some glyphs like a vibrato effect /// public bool IsLinkedToPrevious { get; set; } /// /// Gets or sets whether this renderer can wrap to the next line - /// or it needs to stay connected to the previous one. + /// or it needs to stay connected to the previous one. /// (e.g. when having double bar repeats we must not separate the 2 bars) /// public bool CanWrap { get; set; } @@ -110,7 +110,7 @@ public virtual void ScaleToWidth(float width) Width = width; } - public RenderingResources Resources => Settings.RenderingResources; + public RenderingResources Resources => Settings.Display.Resources; public ScoreRenderer ScoreRenderer { @@ -120,7 +120,7 @@ public ScoreRenderer ScoreRenderer public Settings Settings => ScoreRenderer.Settings; - public float Scale => Settings.Scale; + public float Scale => Settings.Display.Scale; private bool _wasFirstOfLine; public bool IsFirstOfLine => Index == 0; @@ -196,7 +196,7 @@ public virtual void FinalizeRenderer() } /// - /// Gets the top padding for the main content of the renderer. + /// Gets the top padding for the main content of the renderer. /// Can be used to specify where i.E. the score lines of the notation start. /// /// @@ -207,7 +207,7 @@ public float TopPadding } /// - /// Gets the bottom padding for the main content of the renderer. + /// Gets the bottom padding for the main content of the renderer. /// Can be used to specify where i.E. the score lines of the notation end. /// public float BottomPadding @@ -499,17 +499,17 @@ internal enum BeatXPosition PreNotes, /// - /// Gets the on-notes position which is located after the accidentals but before the note heads. + /// Gets the on-notes position which is located after the accidentals but before the note heads. /// OnNotes, /// - /// Gets the middel-notes position which is located after in the middle the note heads. + /// Gets the middel-notes position which is located after in the middle the note heads. /// MiddleNotes, /// - /// Get the post-notes position which is located at after the note heads. + /// Get the post-notes position which is located at after the note heads. /// PostNotes, diff --git a/Source/AlphaTab/Rendering/BarRendererFactory.cs b/Source/AlphaTab/Rendering/BarRendererFactory.cs index ff72a6773..0b14b4274 100644 --- a/Source/AlphaTab/Rendering/BarRendererFactory.cs +++ b/Source/AlphaTab/Rendering/BarRendererFactory.cs @@ -24,6 +24,6 @@ public virtual bool CanCreate(Track track, Staff staff) return !HideOnPercussionTrack || !staff.IsPercussion; } - public abstract BarRendererBase Create(ScoreRenderer renderer, Bar bar, StaveSettings staveSettings); + public abstract BarRendererBase Create(ScoreRenderer renderer, Bar bar); } } diff --git a/Source/AlphaTab/Rendering/EffectBarRendererFactory.cs b/Source/AlphaTab/Rendering/EffectBarRendererFactory.cs index 287177696..38a84d152 100644 --- a/Source/AlphaTab/Rendering/EffectBarRendererFactory.cs +++ b/Source/AlphaTab/Rendering/EffectBarRendererFactory.cs @@ -16,7 +16,7 @@ public EffectBarRendererFactory(string staffId, IEffectBarRendererInfo[] infos) IsInAccolade = false; } - public override BarRendererBase Create(ScoreRenderer renderer, Bar bar, StaveSettings staveSettings) + public override BarRendererBase Create(ScoreRenderer renderer, Bar bar) { return new EffectBarRenderer(renderer, bar, _infos); } diff --git a/Source/AlphaTab/Rendering/Effects/FingeringEffectInfo.cs b/Source/AlphaTab/Rendering/Effects/FingeringEffectInfo.cs index 5755fb5c7..0a6770bd5 100644 --- a/Source/AlphaTab/Rendering/Effects/FingeringEffectInfo.cs +++ b/Source/AlphaTab/Rendering/Effects/FingeringEffectInfo.cs @@ -13,7 +13,10 @@ internal class FingeringEffectInfo : IEffectBarRendererInfo public bool ShouldCreateGlyph(Settings settings, Beat beat) { - if (beat.Voice.Index != 0 || beat.IsRest || settings.FingeringMode != FingeringMode.SingleNoteEffectBand) + if (beat.Voice.Index != 0 || + beat.IsRest || + settings.Notation.FingeringMode != FingeringMode.SingleNoteEffectBand || + settings.Notation.FingeringMode != FingeringMode.SingleNoteEffectBandForcePiano) { return false; } diff --git a/Source/AlphaTab/Rendering/Glyphs/GhostNoteContainerGlyph.cs b/Source/AlphaTab/Rendering/Glyphs/GhostNoteContainerGlyph.cs index 06fee366b..069fd8fb8 100644 --- a/Source/AlphaTab/Rendering/Glyphs/GhostNoteContainerGlyph.cs +++ b/Source/AlphaTab/Rendering/Glyphs/GhostNoteContainerGlyph.cs @@ -37,7 +37,7 @@ public void AddParenthesis(Note n) { var sr = (ScoreBarRenderer)Renderer; var line = sr.GetNoteLine(n); - var hasParenthesis = n.IsGhost || IsTiedBend(n) && sr.Settings.ShowParenthesisForTiedBends; + var hasParenthesis = n.IsGhost || IsTiedBend(n) && sr.Settings.Notation.ShowParenthesisForTiedBends; AddParenthesisOnLine(line, hasParenthesis); } diff --git a/Source/AlphaTab/Rendering/Glyphs/LineRangedGlyph.cs b/Source/AlphaTab/Rendering/Glyphs/LineRangedGlyph.cs index 68ed88241..2737be6d1 100644 --- a/Source/AlphaTab/Rendering/Glyphs/LineRangedGlyph.cs +++ b/Source/AlphaTab/Rendering/Glyphs/LineRangedGlyph.cs @@ -20,7 +20,7 @@ public LineRangedGlyph(string label) public override void DoLayout() { - if (Renderer.Settings.ExtendLineEffectsToBeatEnd) + if (Renderer.Settings.Notation.ExtendLineEffectsToBeatEnd) { EndPosition = BeatXPosition.EndBeat; ForceGroupedRendering = true; diff --git a/Source/AlphaTab/Rendering/Glyphs/NoteNumberGlyph.cs b/Source/AlphaTab/Rendering/Glyphs/NoteNumberGlyph.cs index 819172657..578948bb6 100644 --- a/Source/AlphaTab/Rendering/Glyphs/NoteNumberGlyph.cs +++ b/Source/AlphaTab/Rendering/Glyphs/NoteNumberGlyph.cs @@ -51,7 +51,7 @@ public override void DoLayout() } } else if (n.Beat.Index == 0 || - ((n.BendType == BendType.Bend || n.BendType == BendType.BendRelease) && Renderer.Settings.ShowTabNoteOnTiedBend)) + ((n.BendType == BendType.Bend || n.BendType == BendType.BendRelease) && Renderer.Settings.Notation.ShowTabNoteOnTiedBend)) { _noteString = "(" + (n.TieOrigin.Fret - n.Beat.Voice.Bar.Staff.TranspositionPitch) + ")"; } @@ -128,7 +128,7 @@ public override void Paint(float cx, float cy, ICanvas canvas) canvas.FillText(_noteString, x, cy + Y); - if (Renderer.Settings.IncludeNoteBounds) + if (Renderer.Settings.Core.IncludeNoteBounds) { var noteBounds = new NoteBounds(); noteBounds.Note = _note; diff --git a/Source/AlphaTab/Rendering/Glyphs/ScoreNoteChordGlyph.cs b/Source/AlphaTab/Rendering/Glyphs/ScoreNoteChordGlyph.cs index cd4de1dad..5fe98eeb4 100644 --- a/Source/AlphaTab/Rendering/Glyphs/ScoreNoteChordGlyph.cs +++ b/Source/AlphaTab/Rendering/Glyphs/ScoreNoteChordGlyph.cs @@ -133,7 +133,7 @@ public override void Paint(float cx, float cy, ICanvas canvas) effectY += effectSpacing; } - if (Renderer.Settings.IncludeNoteBounds) + if (Renderer.Settings.Core.IncludeNoteBounds) { foreach (var note in _notes) { diff --git a/Source/AlphaTab/Rendering/Glyphs/ScoreSlurGlyph.cs b/Source/AlphaTab/Rendering/Glyphs/ScoreSlurGlyph.cs index 42c9312ea..9a36b919f 100644 --- a/Source/AlphaTab/Rendering/Glyphs/ScoreSlurGlyph.cs +++ b/Source/AlphaTab/Rendering/Glyphs/ScoreSlurGlyph.cs @@ -12,7 +12,7 @@ public ScoreSlurGlyph(Note startNote, Note endNote, bool forEnd = false) protected override float GetTieHeight(float startX, float startY, float endX, float endY) { - return (float)Math.Log(endX - startX + 1) * Renderer.Settings.SlurHeight; + return (float)Math.Log(endX - startX + 1) * Renderer.Settings.Notation.SlurHeight; } } } diff --git a/Source/AlphaTab/Rendering/Glyphs/ScoreWhammyBarGlyph.cs b/Source/AlphaTab/Rendering/Glyphs/ScoreWhammyBarGlyph.cs index acf35d0be..8f8336313 100644 --- a/Source/AlphaTab/Rendering/Glyphs/ScoreWhammyBarGlyph.cs +++ b/Source/AlphaTab/Rendering/Glyphs/ScoreWhammyBarGlyph.cs @@ -17,7 +17,7 @@ public ScoreWhammyBarGlyph(Beat beat) public override void DoLayout() { - var whammyMode = Renderer.Settings.DisplayMode; + var whammyMode = Renderer.Settings.Notation.NotationMode; switch (_beat.WhammyBarType) { case WhammyType.None: @@ -45,7 +45,7 @@ public override void DoLayout() break; case WhammyType.Dip: { - if (whammyMode == DisplayMode.SongBook) + if (whammyMode == NotationMode.SongBook) { var res = Renderer.Resources; ((ScoreBarRenderer)Renderer).SimpleWhammyOverflow = @@ -55,7 +55,7 @@ public override void DoLayout() { var middleGlyphs = new BendNoteHeadGroupGlyph(_beat); middleGlyphs.Renderer = Renderer; - if (Renderer.Settings.DisplayMode == DisplayMode.GuitarPro) + if (Renderer.Settings.Notation.NotationMode == NotationMode.GuitarPro) { var middleBendPoint = _beat.WhammyBarPoints[1]; foreach (var note in _beat.Notes) @@ -70,7 +70,7 @@ public override void DoLayout() var endGlyphs = new BendNoteHeadGroupGlyph(_beat); endGlyphs.Renderer = Renderer; - if (Renderer.Settings.DisplayMode == DisplayMode.GuitarPro) + if (Renderer.Settings.Notation.NotationMode == NotationMode.GuitarPro) { var lastBendPoint = _beat.WhammyBarPoints[_beat.WhammyBarPoints.Count - 1]; foreach (var note in _beat.Notes) @@ -102,7 +102,7 @@ public override void Paint(float cx, float cy, ICanvas canvas) return; } - var whammyMode = Renderer.Settings.DisplayMode; + var whammyMode = Renderer.Settings.Notation.NotationMode; var startNoteRenderer = Renderer.ScoreRenderer.Layout.GetRendererForBar(Renderer.Staff.StaveId, beat.Voice.Bar); @@ -248,7 +248,7 @@ public override void Paint(float cx, float cy, ICanvas canvas) break; case WhammyType.Dip: - if (whammyMode == DisplayMode.SongBook) + if (whammyMode == NotationMode.SongBook) { if (i == 0) { @@ -387,7 +387,7 @@ public override void Paint(float cx, float cy, ICanvas canvas) private int GetBendNoteValue(Note note, BendPoint bendPoint) { - // NOTE: bendpoints are in 1/4 tones, but the note values are in 1/2 notes. + // NOTE: bendpoints are in 1/4 tones, but the note values are in 1/2 notes. return note.DisplayValueWithoutBend + bendPoint.Value / 2; } } diff --git a/Source/AlphaTab/Rendering/Glyphs/TabBeatGlyph.cs b/Source/AlphaTab/Rendering/Glyphs/TabBeatGlyph.cs index 8f5ad0a74..887273ee6 100644 --- a/Source/AlphaTab/Rendering/Glyphs/TabBeatGlyph.cs +++ b/Source/AlphaTab/Rendering/Glyphs/TabBeatGlyph.cs @@ -14,7 +14,8 @@ public override void DoLayout() { // // Note numbers - var isGrace = Renderer.Settings.SmallGraceTabNotes && Container.Beat.GraceType != GraceType.None; + var isGrace = Renderer.Settings.Notation.SmallGraceTabNotes && + Container.Beat.GraceType != GraceType.None; NoteNumbers = new TabNoteChordGlyph(0, 0, isGrace); NoteNumbers.Beat = Container.Beat; NoteNumbers.BeamingHelper = BeamingHelper; @@ -66,13 +67,14 @@ public override void DoLayout() // // Note dots // - if (Container.Beat.Dots > 0 && tabRenderer.RenderRhythm) + if (Container.Beat.Dots > 0 && tabRenderer.Settings.Notation.RhythmMode != TabRhythmMode.Hidden) { AddGlyph(new SpacingGlyph(0, 0, 5 * Scale)); for (var i = 0; i < Container.Beat.Dots; i++) { AddGlyph(new CircleGlyph(0, - tabRenderer.LineOffset * tabRenderer.Bar.Staff.Tuning.Length + tabRenderer.RhythmHeight, + tabRenderer.LineOffset * tabRenderer.Bar.Staff.Tuning.Length + + tabRenderer.Settings.Notation.RhythmHeight * tabRenderer.Scale, 1.5f * Scale)); } } diff --git a/Source/AlphaTab/Rendering/Glyphs/TabBendGlyph.cs b/Source/AlphaTab/Rendering/Glyphs/TabBendGlyph.cs index 7ff81fda4..16f159f1a 100644 --- a/Source/AlphaTab/Rendering/Glyphs/TabBendGlyph.cs +++ b/Source/AlphaTab/Rendering/Glyphs/TabBendGlyph.cs @@ -320,7 +320,7 @@ public override void Paint(float cx, float cy, ICanvas canvas) endNote = nextNote; isMultiBeatBend = true; - if (endNote.HasBend || !Renderer.Settings.ExtendBendArrowsOnTiedNotes) + if (endNote.HasBend || !Renderer.Settings.Notation.ExtendBendArrowsOnTiedNotes) { endNoteHasBend = true; break; @@ -332,7 +332,7 @@ public override void Paint(float cx, float cy, ICanvas canvas) Renderer.ScoreRenderer.Layout.GetRendererForBar(Renderer.Staff.StaveId, endBeat.Voice.Bar); - if (endBeat.IsLastOfVoice && !endNote.HasBend && Renderer.Settings.ExtendBendArrowsOnTiedNotes) + if (endBeat.IsLastOfVoice && !endNote.HasBend && Renderer.Settings.Notation.ExtendBendArrowsOnTiedNotes) { endBeat = null; } diff --git a/Source/AlphaTab/Rendering/Glyphs/TabSlurGlyph.cs b/Source/AlphaTab/Rendering/Glyphs/TabSlurGlyph.cs index d1cb40498..b2bebd3f1 100644 --- a/Source/AlphaTab/Rendering/Glyphs/TabSlurGlyph.cs +++ b/Source/AlphaTab/Rendering/Glyphs/TabSlurGlyph.cs @@ -17,7 +17,7 @@ public TabSlurGlyph(Note startNote, Note endNote, bool forSlide, bool forEnd = f protected override float GetTieHeight(float startX, float startY, float endX, float endY) { - return (float)Math.Log(endX - startX + 1) * Renderer.Settings.SlurHeight; + return (float)Math.Log(endX - startX + 1) * Renderer.Settings.Notation.SlurHeight; } public bool TryExpand(Note startNote, Note endNote, bool forSlide, bool forEnd) diff --git a/Source/AlphaTab/Rendering/Glyphs/TabWhammyBarGlyph.cs b/Source/AlphaTab/Rendering/Glyphs/TabWhammyBarGlyph.cs index 70369a4fa..ca391b9ac 100644 --- a/Source/AlphaTab/Rendering/Glyphs/TabWhammyBarGlyph.cs +++ b/Source/AlphaTab/Rendering/Glyphs/TabWhammyBarGlyph.cs @@ -34,9 +34,9 @@ private FastList CreateRenderingPoints(Beat beat) var renderingPoints = new FastList(); - // Guitar Pro Rendering Note: - // Last point of bend is always at end of the beat even - // though it might not be 100% correct from timing perspective. + // Guitar Pro Rendering Note: + // Last point of bend is always at end of the beat even + // though it might not be 100% correct from timing perspective. switch (beat.WhammyBarType) { @@ -63,10 +63,10 @@ public override void DoLayout() { base.DoLayout(); - _isSimpleDip = Renderer.Settings.DisplayMode == DisplayMode.SongBook && + _isSimpleDip = Renderer.Settings.Notation.NotationMode == NotationMode.SongBook && _beat.WhammyBarType == WhammyType.Dip; - // + // // Get the min and max values for all combined whammys BendPoint minValue = null; BendPoint maxValue = null; @@ -89,7 +89,7 @@ public override void DoLayout() var topOffset = maxValue.Value > 0 ? Math.Abs(GetOffset(maxValue.Value)) : 0; - if (topOffset > 0 || _beat.WhammyBarPoints[0].Value != 0 || Renderer.Settings.ShowZeroOnDiveWhammy) + if (topOffset > 0 || _beat.WhammyBarPoints[0].Value != 0 || Renderer.Settings.Notation.ShowZeroOnDiveWhammy) { topOffset += Renderer.Resources.TablatureFont.Size * 2f; } @@ -146,7 +146,7 @@ public override void Paint(float cx, float cy, ICanvas canvas) else { endXPositionType = endBeat.HasWhammyBar - && (startNoteRenderer.Settings.DisplayMode != DisplayMode.SongBook || + && (startNoteRenderer.Settings.Notation.NotationMode != NotationMode.SongBook || endBeat.WhammyBarType != WhammyType.Dip) ? BeatXPosition.MiddleNotes : BeatXPosition.PreNotes; @@ -190,7 +190,7 @@ public override void Paint(float cx, float cy, ICanvas canvas) var nextPt = i < j - 2 ? _renderPoints[i + 2] : null; var isFirst = i == 0; - // draw pre-bend if previous + // draw pre-bend if previous if (i == 0 && firstPt.Value != 0 && !_beat.IsContinuedWhammy) { PaintWhammy(false, new BendPoint(), firstPt, secondPt, startX, zeroY, dx, canvas); @@ -287,7 +287,7 @@ private void PaintWhammy( { var y = y1; y -= res.TablatureFont.Size + 2 * Scale; - if (Renderer.Settings.ShowZeroOnDiveWhammy) + if (Renderer.Settings.Notation.ShowZeroOnDiveWhammy) { canvas.FillText("0", x1, y); } @@ -300,7 +300,7 @@ private void PaintWhammy( } var dV = Math.Abs(secondPt.Value); - if ((dV != 0 || Renderer.Settings.ShowZeroOnDiveWhammy && !_isSimpleDip) && firstPt.Value != secondPt.Value) + if ((dV != 0 || Renderer.Settings.Notation.ShowZeroOnDiveWhammy && !_isSimpleDip) && firstPt.Value != secondPt.Value) { var s = ""; if (secondPt.Value < 0) diff --git a/Source/AlphaTab/Rendering/Glyphs/VoiceContainerGlyph.cs b/Source/AlphaTab/Rendering/Glyphs/VoiceContainerGlyph.cs index ffff77a48..734f4aae4 100644 --- a/Source/AlphaTab/Rendering/Glyphs/VoiceContainerGlyph.cs +++ b/Source/AlphaTab/Rendering/Glyphs/VoiceContainerGlyph.cs @@ -81,7 +81,7 @@ public void ApplyLayoutingInfo(BarLayoutingInfo info) b.ApplyLayoutingInfo(info); } - ScaleToForce(Math.Max(Renderer.Settings.StretchForce, info.MinStretchForce)); + ScaleToForce(Math.Max(Renderer.Settings.Display.StretchForce, info.MinStretchForce)); } public override void AddGlyph(Glyph g) diff --git a/Source/AlphaTab/Rendering/Layout/HorizontalScreenLayout.cs b/Source/AlphaTab/Rendering/Layout/HorizontalScreenLayout.cs index 1ee3f754d..7946d959d 100644 --- a/Source/AlphaTab/Rendering/Layout/HorizontalScreenLayout.cs +++ b/Source/AlphaTab/Rendering/Layout/HorizontalScreenLayout.cs @@ -50,7 +50,12 @@ public override void Resize() protected override void DoLayoutAndRender() { - _pagePadding = Renderer.Settings.Layout.Get("padding", PagePadding); + _pagePadding = Renderer.Settings.Display.Padding; + if (_pagePadding == null) + { + _pagePadding = PagePadding; + } + if (_pagePadding.Length == 1) { _pagePadding = new[] @@ -69,13 +74,13 @@ protected override void DoLayoutAndRender() var score = Renderer.Score; var canvas = Renderer.Canvas; - var startIndex = Renderer.Settings.Layout.Get("start", 1); + var startIndex = Renderer.Settings.Display.StartBar; startIndex--; // map to array index startIndex = Math.Min(score.MasterBars.Count - 1, Math.Max(0, startIndex)); var currentBarIndex = startIndex; - var endBarIndex = Renderer.Settings.Layout.Get("count", score.MasterBars.Count); - if (endBarIndex < 0) + var endBarIndex = Renderer.Settings.Display.BarCount; + if (endBarIndex <= 0) { endBarIndex = score.MasterBars.Count; } @@ -88,7 +93,7 @@ protected override void DoLayoutAndRender() _group.X = _pagePadding[0]; _group.Y = _pagePadding[1]; - var countPerPartial = Renderer.Settings.Layout.Get("countPerPartial", 10); + var countPerPartial = Renderer.Settings.Display.BarCountPerPartial; var partials = new FastList(); var currentPartial = new HorizontalScreenLayoutPartialInfo(); @@ -97,7 +102,7 @@ protected override void DoLayoutAndRender() var result = _group.AddBars(Renderer.Tracks, currentBarIndex); // if we detect that the new renderer is linked to the previous - // renderer, we need to put it into the previous partial + // renderer, we need to put it into the previous partial if (currentPartial.MasterBars.Count == 0 && result.IsLinkedToPrevious && partials.Count > 0) { var previousPartial = partials[partials.Count - 1]; @@ -151,7 +156,7 @@ protected override void DoLayoutAndRender() { var partial = partials[i]; canvas.BeginRender(partial.Width, Height); - canvas.Color = Renderer.Settings.RenderingResources.MainGlyphColor; + canvas.Color = Renderer.Settings.Display.Resources.MainGlyphColor; canvas.TextAlign = TextAlign.Left; var renderX = _group.GetBarX(partial.MasterBars[0].Index) + _group.AccoladeSpacing; diff --git a/Source/AlphaTab/Rendering/Layout/PageViewLayout.cs b/Source/AlphaTab/Rendering/Layout/PageViewLayout.cs index 624062e44..84f14f87c 100644 --- a/Source/AlphaTab/Rendering/Layout/PageViewLayout.cs +++ b/Source/AlphaTab/Rendering/Layout/PageViewLayout.cs @@ -35,7 +35,12 @@ public PageViewLayout(ScoreRenderer renderer) protected override void DoLayoutAndRender() { - _pagePadding = Renderer.Settings.Layout.Get("padding", PagePadding); + _pagePadding = Renderer.Settings.Display.Padding; + if (_pagePadding == null) + { + _pagePadding = PagePadding; + } + if (_pagePadding.Length == 1) { _pagePadding = new[] @@ -102,7 +107,7 @@ private float LayoutAndRenderChordDiagrams(float y, float totalHeight = -1) return y; } - var res = Renderer.Settings.RenderingResources; + var res = Renderer.Settings.Display.Resources; ChordDiagrams.Width = Width; ChordDiagrams.DoLayout(); @@ -135,7 +140,7 @@ private float LayoutAndRenderScoreInfo(float x, float y, float totalHeight = -1) Logger.Debug(Name, "Layouting score info"); var scale = Scale; - var res = Renderer.Settings.RenderingResources; + var res = Renderer.Settings.Display.Resources; var centeredGlyphs = new[] { @@ -226,7 +231,7 @@ private float ResizeAndRenderScore(float x, float y, float oldHeight) var canvas = Renderer.Canvas; // if we have a fixed number of bars per row, we only need to refit them. - if (Renderer.Settings.Layout.Get("barsPerRow", -1) != -1) + if (Renderer.Settings.Display.BarsPerRow != -1) { for (var i = 0; i < _groups.Count; i++) { @@ -335,7 +340,7 @@ private float PaintGroup(StaveGroup group, float totalHeight, ICanvas canvas) // paint into canvas var height = group.Height + GroupSpacing * Scale; canvas.BeginRender(Width, height); - Renderer.Canvas.Color = Renderer.Settings.RenderingResources.MainGlyphColor; + Renderer.Canvas.Color = Renderer.Settings.Display.Resources.MainGlyphColor; Renderer.Canvas.TextAlign = TextAlign.Left; // NOTE: we use this negation trick to make the group paint itself to 0/0 coordinates // since we use partial drawing @@ -377,7 +382,7 @@ private StaveGroup CreateStaveGroup(int currentBarIndex, int endIndex) var group = CreateEmptyStaveGroup(); group.Index = _groups.Count; - var barsPerRow = Renderer.Settings.Layout.Get("barsPerRow", -1); + var barsPerRow = Renderer.Settings.Display.BarsPerRow; var maxWidth = MaxWidth; var end = endIndex + 1; diff --git a/Source/AlphaTab/Rendering/Layout/ScoreLayout.cs b/Source/AlphaTab/Rendering/Layout/ScoreLayout.cs index e18ae30d8..5ca379139 100644 --- a/Source/AlphaTab/Rendering/Layout/ScoreLayout.cs +++ b/Source/AlphaTab/Rendering/Layout/ScoreLayout.cs @@ -40,12 +40,12 @@ protected ScoreLayout(ScoreRenderer renderer) public void LayoutAndRender() { var score = Renderer.Score; - var startIndex = Renderer.Settings.Layout.Get("start", 1); + var startIndex = Renderer.Settings.Display.StartBar; startIndex--; // map to array index startIndex = Math.Min(score.MasterBars.Count - 1, Math.Max(0, startIndex)); FirstBarIndex = startIndex; - var endBarIndex = Renderer.Settings.Layout.Get("count", score.MasterBars.Count); + var endBarIndex = Renderer.Settings.Display.BarCount; if (endBarIndex < 0) { endBarIndex = score.MasterBars.Count; @@ -65,11 +65,11 @@ private void CreateScoreInfoGlyphs() { Logger.Info("ScoreLayout", "Creating score info glyphs"); - var flags = Renderer.Settings.Layout.Get("hideInfo", false) + var flags = Renderer.Settings.Notation.HideInfo ? HeaderFooterElements.None : HeaderFooterElements.All; var score = Renderer.Score; - var res = Renderer.Settings.RenderingResources; + var res = Renderer.Settings.Display.Resources; ScoreInfoGlyphs = new FastDictionary(); if (!string.IsNullOrEmpty(score.Title) && (flags & HeaderFooterElements.Title) != 0) @@ -126,7 +126,7 @@ private void CreateScoreInfoGlyphs() } } - if (!Renderer.Settings.Layout.Get("hideTuning", false)) + if (!Renderer.Settings.Notation.HideTuning) { Model.Staff staffWithTuning = null; foreach (var track in Renderer.Tracks) @@ -158,7 +158,7 @@ private void CreateScoreInfoGlyphs() } // chord diagram glyphs - if (!Renderer.Settings.Layout.Get("hideChordDiagram", false)) + if (!Renderer.Settings.Notation.HideChordDiagrams) { ChordDiagrams = new ChordDiagramContainerGlyph(0, 0); ChordDiagrams.Renderer = new BarRendererBase(Renderer, null); @@ -184,7 +184,7 @@ private void CreateScoreInfoGlyphs() } } - public float Scale => Renderer.Settings.Scale; + public float Scale => Renderer.Settings.Display.Scale; public int FirstBarIndex { get; private set; } public int LastBarIndex { get; private set; } @@ -214,35 +214,33 @@ protected StaveGroup CreateEmptyStaveGroup() var staff = track.Staves[staffIndex]; // use optimal profile for track - string staveProfile; + StaveProfile staveProfile; if (staff.IsPercussion) { - staveProfile = Environment.StaveProfileScore; + staveProfile = StaveProfile.Score; } - else if (Renderer.Settings.Staves.Id != "default") + else if (Renderer.Settings.Display.StaveProfile != StaveProfile.Default) { - staveProfile = Renderer.Settings.Staves.Id; + staveProfile = Renderer.Settings.Display.StaveProfile; } else if (staff.ShowTablature && staff.ShowStandardNotation) { - staveProfile = Environment.StaveProfileScoreTab; + staveProfile = StaveProfile.ScoreTab; } else if (staff.ShowTablature) { - staveProfile = hasScore ? Environment.StaveProfileTabMixed : Environment.StaveProfileTab; + staveProfile = hasScore ? StaveProfile.TabMixed : StaveProfile.Tab; } else if (staff.ShowStandardNotation) { - staveProfile = Environment.StaveProfileScore; + staveProfile = StaveProfile.Score; } else { continue; } - var profile = Environment.StaveProfiles.ContainsKey(staveProfile) - ? Environment.StaveProfiles[staveProfile] - : Environment.StaveProfiles["default"]; + var profile = Environment.StaveProfiles[staveProfile]; foreach (var factory in profile) { @@ -294,9 +292,9 @@ public void RenderAnnotation() var msg = "rendered by alphaTab (https://alphaTab.net)"; var canvas = Renderer.Canvas; - var resources = Renderer.Settings.RenderingResources; + var resources = Renderer.Settings.Display.Resources; - var size = 12 * Renderer.Settings.Scale; + var size = 12 * Renderer.Settings.Display.Scale; var height = size * 2; Height += height; var x = Width / 2; diff --git a/Source/AlphaTab/Rendering/RenderingResources.cs b/Source/AlphaTab/Rendering/RenderingResources.cs deleted file mode 100644 index 24359a546..000000000 --- a/Source/AlphaTab/Rendering/RenderingResources.cs +++ /dev/null @@ -1,128 +0,0 @@ -using AlphaTab.Platform.Model; - -namespace AlphaTab.Rendering -{ - /// - /// This public class contains central definitions for controlling the visual appearance. - /// - public class RenderingResources - { - /// - /// Gets or sets the font to use for displaying the songs copyright information in the header of the music sheet. - /// - public Font CopyrightFont { get; set; } - - /// - /// Gets or sets the font to use for displaying the songs title in the header of the music sheet. - /// - public Font TitleFont { get; set; } - - /// - /// Gets or sets the font to use for displaying the songs subtitle in the header of the music sheet. - /// - public Font SubTitleFont { get; set; } - - /// - /// Gets or sets the font to use for displaying the lyrics information in the header of the music sheet. - /// - public Font WordsFont { get; set; } - - /// - /// Gets or sets the font to use for displaying certain effect related elements in the music sheet. - /// - public Font EffectFont { get; set; } - - /// - /// Gets or sets the font to use for displaying the fretboard numbers in chord diagrams. - /// - public Font FretboardNumberFont { get; set; } - - /// - /// Gets or sets the font to use for displaying the guitar tablature numbers in the music sheet. - /// - public Font TablatureFont { get; set; } - - /// - /// Gets or sets the font to use for grace notation related texts in the music sheet. - /// - public Font GraceFont { get; set; } - - /// - /// Gets or sets the color to use for rendering the lines of staves. - /// - public Color StaffLineColor { get; set; } - - /// - /// Gets or sets the color to use for rendering bar separators, the accolade and repeat signs. - /// - public Color BarSeparatorColor { get; set; } - - /// - /// Gets or sets the font to use for displaying the bar numbers above the music sheet. - /// - public Font BarNumberFont { get; set; } - - /// - /// Gets or sets the color to use for displaying the bar numbers above the music sheet. - /// - public Color BarNumberColor { get; set; } - - /// - /// Gets or sets the font to use for displaying finger information in the music sheet. - /// - public Font FingeringFont { get; set; } - - /// - /// Gets or sets the font to use for section marker labels shown above the music sheet. - /// - public Font MarkerFont { get; set; } - - /// - /// Gets or sets the color to use for music notation elements of the primary voice. - /// - public Color MainGlyphColor { get; set; } - - /// - /// Gets or sets the color to use for music notation elements of the secondary voices. - /// - public Color SecondaryGlyphColor { get; set; } - - /// - /// Gets or sets the color to use for displaying the song information above the music sheet. - /// - public Color ScoreInfoColor { get; set; } - - /// - /// Initializes a new instance of the class. - /// - public RenderingResources() - { - const string sansFont = "Arial"; - const string serifFont = "Georgia"; - - EffectFont = new Font(serifFont, 12, FontStyle.Italic); - CopyrightFont = new Font(sansFont, 12, FontStyle.Bold); - FretboardNumberFont = new Font(sansFont, 11); - - TitleFont = new Font(serifFont, 32); - SubTitleFont = new Font(serifFont, 20); - WordsFont = new Font(serifFont, 15); - - TablatureFont = new Font(sansFont, 13); - GraceFont = new Font(sansFont, 11); - - StaffLineColor = new Color(165, 165, 165); - BarSeparatorColor = new Color(34, 34, 17); - - BarNumberFont = new Font(sansFont, 11); - BarNumberColor = new Color(200, 0, 0); - - FingeringFont = new Font(serifFont, 14); - MarkerFont = new Font(serifFont, 14, FontStyle.Bold); - - ScoreInfoColor = new Color(0, 0, 0); - MainGlyphColor = new Color(0, 0, 0); - SecondaryGlyphColor = new Color(0, 0, 0, 100); - } - } -} diff --git a/Source/AlphaTab/Rendering/ScoreBarRenderer.cs b/Source/AlphaTab/Rendering/ScoreBarRenderer.cs index fb9bd3385..81a88c7dd 100644 --- a/Source/AlphaTab/Rendering/ScoreBarRenderer.cs +++ b/Source/AlphaTab/Rendering/ScoreBarRenderer.cs @@ -9,7 +9,7 @@ namespace AlphaTab.Rendering { /// - /// This BarRenderer renders a bar using standard music notation. + /// This BarRenderer renders a bar using standard music notation. /// internal class ScoreBarRenderer : BarRendererBase, IBeamYCalculator { @@ -193,7 +193,7 @@ private void PaintBeamHelper(float cx, float cy, ICanvas canvas, BeamingHelper h ? Resources.MainGlyphColor : Resources.SecondaryGlyphColor; - // TODO: draw stem at least at the center of the score staff. + // TODO: draw stem at least at the center of the score staff. // check if we need to paint simple footer if (h.Beats.Count == 1) @@ -304,7 +304,7 @@ private void PaintTupletHelper(float cx, float cy, ICanvas canvas, TupletGroup h { var direction = firstBeamingHelper.Direction; - // + // // Calculate the overall area of the tuplet bracket var startX = firstBeamingHelper.GetBeatLineX(firstBeat) + Scale; @@ -316,7 +316,7 @@ private void PaintTupletHelper(float cx, float cy, ICanvas canvas, TupletGroup h var sw = canvas.MeasureText(s); var sp = 3 * Scale; - // + // // Calculate the offsets where to break the bracket var middleX = (startX + endX) / 2; var offset1X = middleX - sw / 2 - sp; @@ -485,7 +485,7 @@ private void PaintBar(float cx, float cy, ICanvas canvas, BeamingHelper h) var scaleMod = isGrace ? NoteHeadGlyph.GraceScale : 1; // - // draw line + // draw line // var beatLineX = h.GetBeatLineX(beat) + Scale; @@ -541,7 +541,7 @@ private void PaintBar(float cx, float cy, ICanvas canvas, BeamingHelper h) var barY = barStart + barIndex * barSpacing; - // + // // Bar to Next? // if (i < h.Beats.Count - 1) @@ -567,7 +567,7 @@ private void PaintBar(float cx, float cy, ICanvas canvas, BeamingHelper h) barEndY = barY + CalculateBeamY(h, barEndX); PaintSingleBar(canvas, cx + X + barStartX, barStartY, cx + X + barEndX, barEndY, barSize); } - // + // // Broken Bar to Previous? // else if (i > 0 && !BeamingHelper.IsFullBarJoin(beat, h.Beats[i - 1], barIndex)) @@ -599,7 +599,7 @@ private void PaintFooter(float cx, float cy, ICanvas canvas, BeamingHelper h) { var beat = h.Beats[0]; if (beat.GraceType == GraceType.BendGrace || - beat.GraceType != GraceType.None && Settings.DisplayMode == DisplayMode.SongBook) + beat.GraceType != GraceType.None && Settings.Notation.NotationMode == NotationMode.SongBook) { return; } @@ -608,7 +608,7 @@ private void PaintFooter(float cx, float cy, ICanvas canvas, BeamingHelper h) var scaleMod = isGrace ? NoteHeadGlyph.GraceScale : 1; // - // draw line + // draw line // var stemSize = GetFooterStemSize(h.ShortestDuration); @@ -671,7 +671,7 @@ private void PaintFooter(float cx, float cy, ICanvas canvas, BeamingHelper h) } // - // Draw beam + // Draw beam // if (beat.Duration > Duration.Quarter || isGrace) { @@ -685,7 +685,8 @@ private void PaintFooter(float cx, float cy, ICanvas canvas, BeamingHelper h) private void PaintFingering(ICanvas canvas, Beat beat, float beatLineX, BeamDirection direction, float topY) { var settings = Settings; - if (settings.FingeringMode != FingeringMode.Score) + if (settings.Notation.FingeringMode != FingeringMode.ScoreDefault && + settings.Notation.FingeringMode != FingeringMode.ScoreForcePiano) { return; } @@ -699,8 +700,8 @@ private void PaintFingering(ICanvas canvas, Beat beat, float beatLineX, BeamDire beatLineX += 3 * Scale; } - // sort notes ascending in their value to ensure - // we are drawing the numbers according to their order on the stave + // sort notes ascending in their value to ensure + // we are drawing the numbers according to their order on the stave var noteList = beat.Notes.Clone(); noteList.Sort((a, b) => a.RealValue - b.RealValue); @@ -936,7 +937,7 @@ public int GetNoteLine(Note n) } /// - /// Gets the relative y position of the given steps relative to first line. + /// Gets the relative y position of the given steps relative to first line. /// /// the amount of steps while 2 steps are one line /// diff --git a/Source/AlphaTab/Rendering/ScoreBarRendererFactory.cs b/Source/AlphaTab/Rendering/ScoreBarRendererFactory.cs index 4783e2cae..ce425e901 100644 --- a/Source/AlphaTab/Rendering/ScoreBarRendererFactory.cs +++ b/Source/AlphaTab/Rendering/ScoreBarRendererFactory.cs @@ -9,7 +9,7 @@ internal class ScoreBarRendererFactory : BarRendererFactory { public override string StaffId => ScoreBarRenderer.StaffId; - public override BarRendererBase Create(ScoreRenderer renderer, Bar bar, StaveSettings staveSettings) + public override BarRendererBase Create(ScoreRenderer renderer, Bar bar) { return new ScoreBarRenderer(renderer, bar); } diff --git a/Source/AlphaTab/Rendering/ScoreRenderer.cs b/Source/AlphaTab/Rendering/ScoreRenderer.cs index 6e23848f3..f4d1307b2 100644 --- a/Source/AlphaTab/Rendering/ScoreRenderer.cs +++ b/Source/AlphaTab/Rendering/ScoreRenderer.cs @@ -14,7 +14,7 @@ namespace AlphaTab.Rendering /// public class ScoreRenderer : IScoreRenderer { - private string _currentLayoutMode; + private LayoutMode? _currentLayoutMode; private string _currentRenderEngine; private Track[] _renderedTracks; @@ -53,10 +53,10 @@ public void Destroy() private bool RecreateCanvas() { - if (_currentRenderEngine != Settings.Engine) + if (_currentRenderEngine != Settings.Core.Engine) { Canvas = Environment.GetRenderEngineFactory(Settings).CreateCanvas(); - _currentRenderEngine = Settings.Engine; + _currentRenderEngine = Settings.Core.Engine; return true; } @@ -65,10 +65,10 @@ private bool RecreateCanvas() private bool RecreateLayout() { - if (_currentLayoutMode != Settings.Layout.Mode) + if (_currentLayoutMode != Settings.Display.LayoutMode) { Layout = Environment.GetLayoutEngineFactory(Settings).CreateLayout(this); - _currentLayoutMode = Settings.Layout.Mode; + _currentLayoutMode = Settings.Display.LayoutMode; return true; } @@ -154,7 +154,7 @@ public void Render() } RecreateCanvas(); - Canvas.LineWidth = Settings.Scale; + Canvas.LineWidth = Settings.Display.Scale; Canvas.Settings = Settings; Logger.Info("Rendering", "Rendering " + Tracks.Length + " tracks"); @@ -208,7 +208,7 @@ public void ResizeRender() private void LayoutAndRender() { - Logger.Info("Rendering", "Rendering at scale " + Settings.Scale + " with layout " + Layout.Name); + Logger.Info("Rendering", "Rendering at scale " + Settings.Display.Scale + " with layout " + Layout.Name); Layout.LayoutAndRender(); Layout.RenderAnnotation(); OnRenderFinished(); diff --git a/Source/AlphaTab/Rendering/Staves/Staff.cs b/Source/AlphaTab/Rendering/Staves/Staff.cs index 116cc8880..4e19a916f 100644 --- a/Source/AlphaTab/Rendering/Staves/Staff.cs +++ b/Source/AlphaTab/Rendering/Staves/Staff.cs @@ -6,8 +6,8 @@ namespace AlphaTab.Rendering.Staves { /// - /// A Staff represents a single line within a StaveGroup. - /// It stores BarRenderer instances created from a given factory. + /// A Staff represents a single line within a StaveGroup. + /// It stores BarRenderer instances created from a given factory. /// internal class Staff { @@ -27,9 +27,9 @@ internal class Staff public int StaffIndex { get; set; } /// - /// This is the index of the track being rendered. This is not the index of the track within the model, - /// but the n-th track being rendered. It is the index of the array defining - /// which tracks should be rendered. + /// This is the index of the track being rendered. This is not the index of the track within the model, + /// but the n-th track being rendered. It is the index of the array defining + /// which tracks should be rendered. /// For single-track rendering this will always be zero. /// public int TrackIndex { get; set; } @@ -39,7 +39,7 @@ internal class Staff /// /// This is the visual offset from top where the - /// Staff contents actually start. Used for grouping + /// Staff contents actually start. Used for grouping /// using a accolade /// public float StaveTop { get; set; } @@ -49,7 +49,7 @@ internal class Staff /// /// This is the visual offset from top where the - /// Staff contents actually ends. Used for grouping + /// Staff contents actually ends. Used for grouping /// using a accolade /// public float StaveBottom { get; set; } @@ -115,7 +115,7 @@ public void AddBar(Bar bar, BarLayoutingInfo layoutingInfo) } else { - renderer = _factory.Create(StaveGroup.Layout.Renderer, bar, StaveGroup.Layout.Renderer.Settings.Staves); + renderer = _factory.Create(StaveGroup.Layout.Renderer, bar); } renderer.Staff = this; @@ -141,7 +141,7 @@ public BarRendererBase RevertLastBar() public void ScaleToWidth(float width) { _sharedLayoutData = new FastDictionary(); - // Note: here we could do some "intelligent" distribution of + // Note: here we could do some "intelligent" distribution of // the space over the bar renderers, for now we evenly apply the space to all bars var difference = width - StaveGroup.Width; var spacePerBar = difference / BarRenderers.Count; diff --git a/Source/AlphaTab/Rendering/Staves/StaveGroup.cs b/Source/AlphaTab/Rendering/Staves/StaveGroup.cs index 604a3a240..c74c82b91 100644 --- a/Source/AlphaTab/Rendering/Staves/StaveGroup.cs +++ b/Source/AlphaTab/Rendering/Staves/StaveGroup.cs @@ -9,7 +9,7 @@ namespace AlphaTab.Rendering.Staves { /// /// A Staff consists of a list of different staves and groups - /// them using an accolade. + /// them using an accolade. /// internal class StaveGroup { @@ -28,7 +28,7 @@ internal class StaveGroup /// /// Indicates whether this line is full or not. If the line is full the - /// bars can be aligned to the maximum width. If the line is not full + /// bars can be aligned to the maximum width. If the line is not full /// the bars will not get stretched. /// public bool IsFull { get; set; } @@ -181,14 +181,14 @@ private void CalculateAccoladeSpacing(Track[] tracks) if (!_accoladeSpacingCalculated && Index == 0) { _accoladeSpacingCalculated = true; - if (Layout.Renderer.Settings.Layout.Get("hideTrackNames", false)) + if (Layout.Renderer.Settings.Notation.HideTrackNames) { AccoladeSpacing = 0; } else { var canvas = Layout.Renderer.Canvas; - var res = Layout.Renderer.Settings.RenderingResources.EffectFont; + var res = Layout.Renderer.Settings.Display.Resources.EffectFont; canvas.Font = res; foreach (var t in tracks) { @@ -284,13 +284,13 @@ public void PaintPartial(float cx, float cy, ICanvas canvas, int startIndex, int _allStaves[i].Paint(cx, cy, canvas, startIndex, count); } - var res = Layout.Renderer.Settings.RenderingResources; + var res = Layout.Renderer.Settings.Display.Resources; if (Staves.Count > 0 && startIndex == 0) { // // Draw start grouping - // + // canvas.Color = res.BarSeparatorColor; if (_firstStaffInAccolade != null && _lastStaffInAccolade != null) @@ -316,7 +316,7 @@ public void PaintPartial(float cx, float cy, ICanvas canvas, int startIndex, int // // Draw accolade for each track group - // + // canvas.Font = res.EffectFont; for (int i = 0, j = Staves.Count; i < j; i++) { @@ -331,14 +331,14 @@ public void PaintPartial(float cx, float cy, ICanvas canvas, int startIndex, int var acooladeX = cx + g.FirstStaffInAccolade.X; - var barSize = 3 * Layout.Renderer.Settings.Scale; + var barSize = 3 * Layout.Renderer.Settings.Display.Scale; var barOffset = barSize; var accoladeStart = firstStart - barSize * 4; var accoladeEnd = lastEnd + barSize * 4; // text - if (Index == 0 && !Layout.Renderer.Settings.Layout.Get("hideTrackNames", false)) + if (Index == 0 && !Layout.Renderer.Settings.Notation.HideTrackNames) { canvas.FillText(g.Track.ShortName, cx + AccoladeLabelSpacing * Layout.Scale, firstStart); } @@ -370,7 +370,7 @@ public void PaintPartial(float cx, float cy, ICanvas canvas, int startIndex, int canvas.ClosePath(); canvas.Fill(); - // bottom spike + // bottom spike canvas.BeginPath(); canvas.MoveTo(spikeStartX, accoladeEnd); canvas.BezierCurveTo(spikeStartX, diff --git a/Source/AlphaTab/Rendering/TabBarRenderer.cs b/Source/AlphaTab/Rendering/TabBarRenderer.cs index 4bf20c792..c3035647b 100644 --- a/Source/AlphaTab/Rendering/TabBarRenderer.cs +++ b/Source/AlphaTab/Rendering/TabBarRenderer.cs @@ -1,4 +1,5 @@ -using AlphaTab.Collections; +using System; +using AlphaTab.Collections; using AlphaTab.Model; using AlphaTab.Platform; using AlphaTab.Platform.Model; @@ -25,16 +26,10 @@ internal class TabBarRenderer : BarRendererBase public TabBarRenderer(ScoreRenderer renderer, Bar bar) : base(renderer, bar) { - RhythmHeight = 15 * renderer.Layout.Scale; - RhythmBeams = false; } public float LineOffset => (LineSpacing + 1) * Scale; - public bool RenderRhythm { get; set; } - public float RhythmHeight { get; set; } - public bool RhythmBeams { get; set; } - public override float GetNoteX(Note note, bool onEnd = true) { var beat = (TabBeatGlyph)GetOnNotesGlyphForBeat(note.Beat); @@ -66,10 +61,11 @@ protected override void UpdateSizes() BottomPadding = numberOverflow; Height = LineOffset * (Bar.Staff.Tuning.Length - 1) + numberOverflow * 2; - if (RenderRhythm) + + if (Settings.Notation.RhythmMode != TabRhythmMode.Hidden) { - Height += RhythmHeight; - BottomPadding += RhythmHeight; + Height += Settings.Notation.RhythmHeight * Settings.Display.Scale; + BottomPadding += Settings.Notation.RhythmHeight * Settings.Display.Scale; } base.UpdateSizes(); @@ -78,7 +74,7 @@ protected override void UpdateSizes() public override void DoLayout() { base.DoLayout(); - if (RenderRhythm) + if (Settings.Notation.RhythmMode != TabRhythmMode.Hidden) { var hasTuplets = false; foreach (var voice in Bar.Voices) @@ -260,7 +256,7 @@ protected override void PaintBackground(float cx, float cy, ICanvas canvas) } } - // if we have multiple voices we need to sort by X-position, otherwise have a wild mix in the list + // if we have multiple voices we need to sort by X-position, otherwise have a wild mix in the list // but painting relies on ascending X-position foreach (var line in tabNotes) { @@ -301,7 +297,7 @@ protected override void PaintBackground(float cx, float cy, ICanvas canvas) public override void Paint(float cx, float cy, ICanvas canvas) { base.Paint(cx, cy, canvas); - if (RenderRhythm) + if (Settings.Notation.RhythmMode != TabRhythmMode.Hidden) { PaintBeams(cx, cy, canvas); PaintTuplets(cx, cy, canvas); @@ -344,7 +340,7 @@ private void PaintBeamHelper(float cx, float cy, ICanvas canvas, BeamingHelper h : Resources.SecondaryGlyphColor; // check if we need to paint simple footer - if (h.Beats.Count == 1 || RhythmBeams) + if (h.Beats.Count == 1 || Settings.Notation.RhythmMode == TabRhythmMode.ShowWithBeams) { PaintFooter(cx, cy, canvas, h); } @@ -364,7 +360,7 @@ private void PaintBar(float cx, float cy, ICanvas canvas, BeamingHelper h) if (h.HasBeatLineX(beat)) { // - // draw line + // draw line // var beatLineX = h.GetBeatLineX(beat); var y1 = cy + Y; @@ -373,7 +369,7 @@ private void PaintBar(float cx, float cy, ICanvas canvas, BeamingHelper h) var startGlyph = (TabBeatGlyph)GetOnNotesGlyphForBeat(beat); if (startGlyph.NoteNumbers == null) { - y1 += Height - RhythmHeight - _tupletSize; + y1 += Height - Settings.Notation.RhythmHeight * Settings.Display.Scale - _tupletSize; } else { @@ -410,7 +406,7 @@ private void PaintBar(float cx, float cy, ICanvas canvas, BeamingHelper h) var barY = barStart + barIndex * barSpacing; - // + // // Broken Bar to Next // if (h.Beats.Count == 1) @@ -421,7 +417,7 @@ private void PaintBar(float cx, float cy, ICanvas canvas, BeamingHelper h) barEndY = barY; PaintSingleBar(canvas, cx + X + barStartX, barStartY, cx + X + barEndX, barEndY, barSize); } - // + // // Bar to Next? // else if (i < h.Beats.Count - 1) @@ -457,7 +453,7 @@ private void PaintBar(float cx, float cy, ICanvas canvas, BeamingHelper h) barEndY = barY; PaintSingleBar(canvas, cx + X + barStartX, barStartY, cx + X + barEndX, barEndY, barSize); } - // + // // Broken Bar to Previous? // else if (i > 0 && !BeamingHelper.IsFullBarJoin(beat, h.Beats[i - 1], barIndex)) @@ -575,7 +571,7 @@ private void PaintTupletHelper(float cx, float cy, ICanvas canvas, TupletGroup h var lastBeamingHelper = Helpers.BeamHelperLookup[h.Voice.Index][lastBeat.Index]; if (firstBeamingHelper != null && lastBeamingHelper != null) { - // + // // Calculate the overall area of the tuplet bracket var startX = firstBeamingHelper.GetBeatLineX(firstBeat); @@ -600,7 +596,7 @@ private void PaintTupletHelper(float cx, float cy, ICanvas canvas, TupletGroup h var sw = canvas.MeasureText(s); var sp = 3 * Scale; - // + // // Calculate the offsets where to break the bracket var middleX = (startX + endX) / 2; var offset1X = middleX - sw / 2 - sp; @@ -659,7 +655,7 @@ private void PaintFooter(float cx, float cy, ICanvas canvas, BeamingHelper h) // - // draw line + // draw line // var beatLineX = h.GetBeatLineX(beat); @@ -669,7 +665,7 @@ private void PaintFooter(float cx, float cy, ICanvas canvas, BeamingHelper h) var startGlyph = (TabBeatGlyph)GetOnNotesGlyphForBeat(beat); if (startGlyph.NoteNumbers == null) { - y1 += Height - RhythmHeight - _tupletSize; + y1 += Height - Settings.Notation.RhythmHeight * Settings.Display.Scale - _tupletSize; } else { @@ -691,7 +687,7 @@ private void PaintFooter(float cx, float cy, ICanvas canvas, BeamingHelper h) canvas.Stroke(); // - // Draw beam + // Draw beam // if (beat.Duration > Duration.Quarter) { diff --git a/Source/AlphaTab/Rendering/TabBarRendererFactory.cs b/Source/AlphaTab/Rendering/TabBarRendererFactory.cs index cb77ab2cd..ae75e2a71 100644 --- a/Source/AlphaTab/Rendering/TabBarRendererFactory.cs +++ b/Source/AlphaTab/Rendering/TabBarRendererFactory.cs @@ -25,16 +25,12 @@ public override bool CanCreate(Track track, Staff staff) return staff.Tuning.Length > 0 && base.CanCreate(track, staff); } - public override BarRendererBase Create(ScoreRenderer renderer, Bar bar, StaveSettings staveSettings) + public override BarRendererBase Create(ScoreRenderer renderer, Bar bar) { var tabBarRenderer = new TabBarRenderer(renderer, bar); tabBarRenderer.ShowRests = _showRests; tabBarRenderer.ShowTimeSignature = _showTimeSignature; tabBarRenderer.ShowTiedNotes = _showTiedNotes; - tabBarRenderer.RenderRhythm = staveSettings.Get("rhythm", tabBarRenderer.RenderRhythm); - tabBarRenderer.RhythmHeight = staveSettings.Get("rhythmHeight", tabBarRenderer.RhythmHeight); - tabBarRenderer.RhythmBeams = staveSettings.Get("rhythmBeams", tabBarRenderer.RhythmBeams); - return tabBarRenderer; } } diff --git a/Source/AlphaTab/ScrollMode.cs b/Source/AlphaTab/ScrollMode.cs index 9240643fa..0cdbb29a7 100644 --- a/Source/AlphaTab/ScrollMode.cs +++ b/Source/AlphaTab/ScrollMode.cs @@ -1,8 +1,11 @@ +using AlphaTab.Util; + namespace AlphaTab { /// /// Lists all modes how alphaTab can scroll the container during playback. /// + [JsonSerializable] public enum ScrollMode { /// diff --git a/Source/AlphaTab/Settings.cs b/Source/AlphaTab/Settings.cs index 24784662a..a1aad4b4b 100644 --- a/Source/AlphaTab/Settings.cs +++ b/Source/AlphaTab/Settings.cs @@ -1,4 +1,4 @@ -using AlphaTab.Collections; +using AlphaTab.Platform.Model; using AlphaTab.Rendering; using AlphaTab.Rendering.Utils; using AlphaTab.Util; @@ -6,15 +6,154 @@ namespace AlphaTab { /// - /// This public class contains instance specific settings for alphaTab + /// This public class contains central definitions for controlling the visual appearance. /// - public partial class Settings + [JsonSerializable] + public class RenderingResources { /// - /// Sets the zoom level of the rendered notation + /// Gets or sets the font to use for displaying the songs copyright information in the header of the music sheet. + /// + [JsonName("copyrightFont")] + public Font CopyrightFont { get; set; } + + /// + /// Gets or sets the font to use for displaying the songs title in the header of the music sheet. + /// + [JsonName("titleFont")] + public Font TitleFont { get; set; } + + /// + /// Gets or sets the font to use for displaying the songs subtitle in the header of the music sheet. + /// + [JsonName("subTitleFont")] + public Font SubTitleFont { get; set; } + + /// + /// Gets or sets the font to use for displaying the lyrics information in the header of the music sheet. + /// + [JsonName("wordsFont")] + public Font WordsFont { get; set; } + + /// + /// Gets or sets the font to use for displaying certain effect related elements in the music sheet. + /// + [JsonName("effectFont")] + public Font EffectFont { get; set; } + + /// + /// Gets or sets the font to use for displaying the fretboard numbers in chord diagrams. + /// + [JsonName("fretboardNumberFont")] + public Font FretboardNumberFont { get; set; } + + /// + /// Gets or sets the font to use for displaying the guitar tablature numbers in the music sheet. + /// + [JsonName("tablatureFont")] + public Font TablatureFont { get; set; } + + /// + /// Gets or sets the font to use for grace notation related texts in the music sheet. + /// + [JsonName("graceFont")] + public Font GraceFont { get; set; } + + /// + /// Gets or sets the color to use for rendering the lines of staves. + /// + [JsonName("staffLineColor")] + public Color StaffLineColor { get; set; } + + /// + /// Gets or sets the color to use for rendering bar separators, the accolade and repeat signs. + /// + [JsonName("barSeparatorColor")] + public Color BarSeparatorColor { get; set; } + + /// + /// Gets or sets the font to use for displaying the bar numbers above the music sheet. + /// + [JsonName("barNumberFont")] + public Font BarNumberFont { get; set; } + + /// + /// Gets or sets the color to use for displaying the bar numbers above the music sheet. + /// + [JsonName("barNumberColor")] + public Color BarNumberColor { get; set; } + + /// + /// Gets or sets the font to use for displaying finger information in the music sheet. + /// + [JsonName("fingeringFont")] + public Font FingeringFont { get; set; } + + /// + /// Gets or sets the font to use for section marker labels shown above the music sheet. + /// + [JsonName("markerFont")] + public Font MarkerFont { get; set; } + + /// + /// Gets or sets the color to use for music notation elements of the primary voice. /// - public float Scale { get; set; } + [JsonName("mainGlyphColor")] + public Color MainGlyphColor { get; set; } + /// + /// Gets or sets the color to use for music notation elements of the secondary voices. + /// + [JsonName("secondaryGlyphColor")] + public Color SecondaryGlyphColor { get; set; } + + /// + /// Gets or sets the color to use for displaying the song information above the music sheet. + /// + [JsonName("scoreInfoColor")] + public Color ScoreInfoColor { get; set; } + + /// + /// Initializes a new instance of the class. + /// + public RenderingResources() + { + const string sansFont = "Arial"; + const string serifFont = "Georgia"; + + EffectFont = new Font(serifFont, 12, FontStyle.Italic); + CopyrightFont = new Font(sansFont, 12, FontStyle.Bold); + FretboardNumberFont = new Font(sansFont, 11); + + TitleFont = new Font(serifFont, 32); + SubTitleFont = new Font(serifFont, 20); + WordsFont = new Font(serifFont, 15); + + TablatureFont = new Font(sansFont, 13); + GraceFont = new Font(sansFont, 11); + + StaffLineColor = new Color(165, 165, 165); + BarSeparatorColor = new Color(34, 34, 17); + + BarNumberFont = new Font(sansFont, 11); + BarNumberColor = new Color(200, 0, 0); + + FingeringFont = new Font(serifFont, 14); + MarkerFont = new Font(serifFont, 14, FontStyle.Bold); + + ScoreInfoColor = new Color(0, 0, 0); + MainGlyphColor = new Color(0, 0, 0); + SecondaryGlyphColor = new Color(0, 0, 0, 100); + } + } + + /// + /// The core settings control the general behavior of alphatab like + /// what modules are active. + /// + [JsonSerializable] + public partial class CoreSettings + { /// /// The engine which should be used to render the the tablature. ///
      @@ -23,278 +162,482 @@ public partial class Settings ///
    • svg - SVG
    • ///
    ///
    - public string Engine { get; set; } + [JsonName("engine")] + public string Engine { get; set; } = "default"; /// - /// The layout specific settings + /// The log level to use within alphaTab /// - public LayoutSettings Layout { get; set; } + [JsonName("logLevel")] + public LogLevel LogLevel { get; set; } = LogLevel.Info; /// - /// Specific settings for importers. Keys are specific for the importers. - /// General - ///
      - ///
    • encoding - The text encoding to use when decoding strings (string, default:utf-8)
    • - ///
    - /// MusicXML - ///
      - ///
    • musicxmlMergePartGroups - If part-groups should be merged into a single track (boolean, default:false)
    • - ///
    + /// Gets or sets whether the rendering should be done in a worker if possible. + ///
    + [JsonName("useWorkers")] + public bool UseWorkers { get; set; } = true; + + /// + /// Gets or sets whether in the also the + /// position and area of each individual note is provided. + /// + [JsonName("includeNoteBounds")] + public bool IncludeNoteBounds { get; set; } = false; + } + + /// + /// Lists all layout modes that are supported. + /// + [JsonSerializable] + public enum LayoutMode + { + /// + /// Bars are aligned in rows using a fixed width. + /// + Page, + + /// + /// Bars are aligned horizontally in one row + /// + Horizontal + } + + /// + /// Lists all stave profiles controlling which staves are shown. + /// + [JsonSerializable] + public enum StaveProfile + { + /// + /// The profile is auto detected by the track configurations. + /// + Default, + + /// + /// Standard music notation and guitar tablature are rendered. + /// + ScoreTab, + + /// + /// Only standard music notation is rendered. + /// + Score, + + /// + /// Only guitar tablature is rendered. + /// + Tab, + + /// + /// Only guitar tablature is rendered, but also rests and time signatures are not shown. + /// This profile is typically used in multi-track scenarios. + /// + TabMixed, + } + + /// + /// The display settings control how the general layout and display of alphaTab is done. + /// + [JsonSerializable] + public class DisplaySettings + { + /// + /// Sets the zoom level of the rendered notation /// - public FastDictionary ImporterSettings { get; set; } + [JsonName("scale")] + public float Scale { get; set; } = 1.0f; /// /// The default stretch force to use for layouting. /// - public float StretchForce { get; set; } + [JsonName("stretchForce")] + public float StretchForce { get; set; } = 1.0f; /// - /// Forces the fingering rendering to use always the piano finger stýle where - /// fingers are rendered as 1-5 instead of p,i,m,a,c and T,1,2,3,4. + /// The layouting mode used to arrange the the notation. /// - public bool ForcePianoFingering { get; set; } + [JsonName("layoutMode")] + public LayoutMode LayoutMode { get; set; } = LayoutMode.Page; /// - /// The staves that should be shown in the music sheet. - /// This is one of the profiles registered in the + /// The stave profile to use. /// - public StaveSettings Staves { get; set; } + [JsonName("staveProfile")] + public StaveProfile StaveProfile { get; set; } = StaveProfile.Default; /// - /// The transposition pitch offsets for the individual tracks. - /// They apply to rendering and playback. + /// Limit the displayed bars per row. + /// + [JsonName("barsPerRow")] + public int BarsPerRow { get; set; } = -1; + + /// + /// The bar start number to start layouting with. Note that this is the bar number and not an index! + /// + [JsonName("startBar")] + public int StartBar { get; set; } = 1; + + /// + /// The amount of bars to render overall. + /// + [JsonName("barCount")] + public int BarCount { get; set; } = -1; + + /// + /// The number of bars that should be rendered per partial. This setting is not used by all layouts. + /// + [JsonName("barCountPerPartial")] + public int BarCountPerPartial { get; set; } = 10; + + /// + /// Gets or sets the resources used during rendering. This defines all fonts and colors used. + /// + [JsonName("resources")] + public RenderingResources Resources { get; } = new RenderingResources(); + + /// + /// Gets or sets the padding between the music notation and the border. + /// + [JsonName("padding")] + public float[] Padding { get; set; } + } + + /// + /// Lists the different modes on how rhythm notation is shown on the tab staff. + /// + [JsonSerializable] + public enum TabRhythmMode + { + /// + /// Rhythm notation is hidden. /// - public int[] TranspositionPitches { get; set; } + Hidden, + + /// + /// Rhythm notation is shown with individual beams per beat. + /// + ShowWithBeams, + + /// + /// Rhythm notation is shown and behaves like normal score notation with connected bars. + /// + ShowWithBars + } + + /// + /// The notation settings control how various music notation elements are shown and behaving + /// + [JsonSerializable] + public class NotationSettings + { + /// + /// Gets or sets the mode to use for display and play music notation elements. + /// + [JsonName("notationMode")] + public NotationMode NotationMode { get; set; } = NotationMode.GuitarPro; + + /// + /// Gets or sets the fingering mode to use. + /// + [JsonName("fingeringMode")] + public FingeringMode FingeringMode { get; set; } = FingeringMode.ScoreDefault; + + /// + /// Whether to display the song information or not. + /// + [JsonName("hideInfo")] + public bool HideInfo { get; set; } = false; + + /// + /// Whether to display the tuning information or not. + /// + [JsonName("hideTuning")] + public bool HideTuning { get; set; } = false; + + /// + /// Whether to display the track names in the accolade or not. + /// + [JsonName("hideTrackNames")] + public bool HideTrackNames { get; set; } = false; + + /// + /// Whether to display the chord diagrams or not. + /// + [JsonName("hideChordDiagrams")] + public bool HideChordDiagrams { get; set; } = false; + + /// + /// Whether to show rhythm notation in the guitar tablature. + /// + [JsonName("rhythmMode")] + public TabRhythmMode RhythmMode { get; set; } = TabRhythmMode.Hidden; + + /// + /// The height of the rythm bars. + /// + [JsonName("rhythmHeight")] + public float RhythmHeight { get; set; } = 15; /// /// The transposition pitch offsets for the individual tracks. - /// They apply to rendering only. + /// They apply to rendering and playback. /// - public int[] DisplayTranspositionPitches { get; set; } + [JsonName("transpositionPitches")] + public int[] TranspositionPitches { get; set; } = new int[0]; /// - /// The log level to use within alphaTab + /// The transposition pitch offsets for the individual tracks. + /// They apply to rendering only. /// - public LogLevel LogLevel { get; set; } + [JsonName("displayTranspositionPitches")] + public int[] DisplayTranspositionPitches { get; set; } = new int[0]; /// /// If set to true the guitar tabs on grace beats are rendered smaller. /// - public bool SmallGraceTabNotes { get; set; } + [JsonName("smallGraceTabNotes")] + public bool SmallGraceTabNotes { get; set; } = true; /// /// If set to true bend arrows expand to the end of the last tied note /// of the string. Otherwise they end on the next beat. /// - public bool ExtendBendArrowsOnTiedNotes { get; set; } + [JsonName("extendBendArrowsOnTiedNotes")] + public bool ExtendBendArrowsOnTiedNotes { get; set; } = true; /// /// If set to true the note heads on tied notes /// will have parenthesis if they are preceeded by bends. /// - public bool ShowParenthesisForTiedBends { get; set; } + [JsonName("showParenthesisForTiedBends")] + public bool ShowParenthesisForTiedBends { get; set; } = true; /// /// If set to true a tab number will be shown in case /// a bend is increased on a tied note. /// - public bool ShowTabNoteOnTiedBend { get; set; } + [JsonName("showTabNoteOnTiedBend")] + public bool ShowTabNoteOnTiedBend { get; set; } = true; /// - /// Gets or sets the mode to use for display and play music notation elements. + /// If set to true, 0 is shown on dive whammy bars. /// - public DisplayMode DisplayMode { get; set; } + [JsonName("showZeroOnDiveWhammy")] + public bool ShowZeroOnDiveWhammy { get; set; } = false; /// - /// Gets or sets the fingering mode to use. + /// If set to true, line effects (like w/bar, let-ring etc) + /// are drawn until the end of the beat instead of the start. /// - public FingeringMode FingeringMode { get; set; } + [JsonName("extendLineEffectsToBeatEnd")] + public bool ExtendLineEffectsToBeatEnd { get; set; } = false; /// - /// If set to true, 0 is shown on dive whammy bars. + /// Gets or sets the height for slurs. The factor is multiplied with the a logarithmic distance + /// between slur start and end. /// - public bool ShowZeroOnDiveWhammy { get; set; } + [JsonName("slurHeight")] + public float SlurHeight { get; set; } = 7.0f; + } + /// + /// This object defines the details on how to generate the vibrato effects. + /// + [JsonSerializable] + public class VibratoPlaybackSettings + { /// - /// If set to true, line effects (like w/bar, let-ring etc) - /// are drawn until the end of the beat instead of the start. + /// Gets or sets the wavelength of the note-wide vibrato in midi ticks. /// - public bool ExtendLineEffectsToBeatEnd { get; set; } + [JsonName("noteWideLength")] + public int NoteWideLength { get; set; } = 480; /// - /// Gets or sets the settings on how the vibrato audio is generated. + /// Gets or sets the amplitude for the note-wide vibrato in semitones. /// - public VibratoPlaybackSettings Vibrato { get; set; } + [JsonName("noteWideAmplitude")] + public int NoteWideAmplitude { get; set; } = 2; /// - /// Gets or sets whether the triplet feel should be applied/played during audio playback. + /// Gets or sets the wavelength of the note-slight vibrato in midi ticks. /// - public bool PlayTripletFeel { get; set; } + [JsonName("noteSlightLength")] + public int NoteSlightLength { get; set; } = 480; /// - /// Gets or sets the height for slurs. The factor is multiplied with the a logarithmic distance - /// between slur start and end. + /// Gets or sets the amplitude for the note-slight vibrato in semitones. /// - public float SlurHeight { get; set; } + [JsonName("noteSlightAmplitude")] + public int NoteSlightAmplitude { get; set; } = 2; /// - /// Gets or sets the bend duration in milliseconds for songbook bends. + /// Gets or sets the wavelength of the beat-wide vibrato in midi ticks. /// - public int SongBookBendDuration { get; set; } + [JsonName("beatWideLength")] + public int BeatWideLength { get; set; } = 240; /// - /// Gets or sets the duration of whammy dips in milliseconds for songbook whammys. + /// Gets or sets the amplitude for the beat-wide vibrato in semitones. /// - public int SongBookDipDuration { get; set; } + [JsonName("beatWideAmplitude")] + public int BeatWideAmplitude { get; set; } = 3; /// - /// Gets or sets whether in the also the - /// position and area of each individual note is provided. + /// Gets or sets the wavelength of the beat-slight vibrato in midi ticks. /// - public bool IncludeNoteBounds { get; set; } + [JsonName("beatSlightLength")] + public int BeatSlightLength { get; set; } = 240; /// - /// Gets or sets whether the rendering should be done in a worker if possible. + /// Gets or sets the amplitude for the beat-slight vibrato in semitones. /// - public bool UseWorkers { get; set; } + [JsonName("beatSlightAmplitude")] + public int BeatSlightAmplitude { get; set; } = 3; + } + /// + /// All settings related to importers that decode file formats. + /// + [JsonSerializable] + public class ImporterSettings + { /// - /// Gets or sets whether the player should be enabled. + /// The text encoding to use when decoding strings. By default UTF-8 is used. /// - public bool EnablePlayer { get; set; } + [JsonName("encoding")] + public string Encoding { get; set; } = "utf-8"; /// - /// Gets or sets whether playback cursors should be displayed. + /// If part-groups should be merged into a single track. /// - public bool EnableCursor { get; set; } + [JsonName("mergePartGroupsInMusicXml")] + public bool MergePartGroupsInMusicXml { get; set; } = false; + } + /// + /// Contains all player related settings. + /// + [JsonSerializable] + public partial class PlayerSettings + { /// - /// Gets or sets the width of the beat cursor in pixels. + /// Gets or sets whether the player should be enabled. + /// + [JsonName("enablePlayer")] + public bool EnablePlayer { get; set; } = false; + + /// + /// Gets or sets whether playback cursors should be displayed. /// - public int BeatCursorWidth { get; set; } + [JsonName("enableCursor")] + public bool EnableCursor { get; set; } = true; /// /// Gets or sets the X-offset to add when scrolling. /// - public int ScrollOffsetX - { - get; - set; - } + [JsonName("scrollOffsetX")] + public int ScrollOffsetX { get; set; } = 0; /// /// Gets or sets the Y-offset to add when scrolling /// - public int ScrollOffsetY - { - get; - set; - } + [JsonName("scrollOffsetY")] + public int ScrollOffsetY { get; set; } = 0; /// /// Gets or sets the mode how to scroll. /// - public ScrollMode ScrollMode - { - get; - set; - } + [JsonName("scrollMode")] + + public ScrollMode ScrollMode { get; set; } = ScrollMode.Continuous; /// /// Gets or sets how fast the scrolling to the new position should happen (in milliseconds) /// - public int ScrollSpeed - { - get; - set; - } + [JsonName("scrollSpeed")] + public int ScrollSpeed { get; set; } = 300; /// - /// Gets or sets the resources used during rendering. This defines all fonts and colors used. + /// Gets or sets the bend duration in milliseconds for songbook bends. /// - public RenderingResources RenderingResources { get; set; } + [JsonName("songBookBendDuration")] + public int SongBookBendDuration { get; set; } = 75; /// - /// Gets the default settings for the songbook display mode. + /// Gets or sets the duration of whammy dips in milliseconds for songbook whammys. /// - public static Settings SongBook - { - get - { - var settings = Defaults; - settings.DisplayMode = DisplayMode.SongBook; - settings.ApplySongBookDefaults(); - return settings; - } - } - - private void ApplySongBookDefaults() - { - SmallGraceTabNotes = false; - FingeringMode = FingeringMode.SingleNoteEffectBand; - ExtendBendArrowsOnTiedNotes = false; - ShowParenthesisForTiedBends = false; - ShowTabNoteOnTiedBend = false; - ShowZeroOnDiveWhammy = true; - } + [JsonName("songBookDipDuration")] + public int SongBookDipDuration { get; set; } = 150; /// - /// Gets the default settings. + /// Gets or sets the settings on how the vibrato audio is generated. /// - public static Settings Defaults - { - get - { - var settings = new Settings(); - - settings.Scale = 1.0f; - settings.StretchForce = 1; - settings.Engine = "default"; - settings.TranspositionPitches = new int[0]; - settings.DisplayTranspositionPitches = new int[0]; - settings.SmallGraceTabNotes = true; - settings.ExtendBendArrowsOnTiedNotes = true; - settings.ShowParenthesisForTiedBends = true; - settings.ShowTabNoteOnTiedBend = true; - settings.DisplayMode = DisplayMode.GuitarPro; - settings.FingeringMode = FingeringMode.Score; - settings.ShowZeroOnDiveWhammy = false; - settings.ExtendLineEffectsToBeatEnd = false; - settings.SlurHeight = 7f; - - settings.ImporterSettings = new FastDictionary(); - - settings.Layout = LayoutSettings.Defaults; + [JsonName("vibrato")] + public VibratoPlaybackSettings Vibrato { get; } = new VibratoPlaybackSettings(); - settings.Staves = new StaveSettings("default"); - settings.LogLevel = LogLevel.Info; - - settings.Vibrato = new VibratoPlaybackSettings(); - settings.Vibrato.NoteSlightAmplitude = 2; - settings.Vibrato.NoteWideAmplitude = 2; - settings.Vibrato.NoteSlightLength = 480; - settings.Vibrato.NoteWideLength = 480; + /// + /// Gets or sets whether the triplet feel should be applied/played during audio playback. + /// + public bool PlayTripletFeel { get; set; } = true; + } - settings.Vibrato.BeatSlightAmplitude = 3; - settings.Vibrato.BeatWideAmplitude = 3; - settings.Vibrato.BeatSlightLength = 240; - settings.Vibrato.BeatWideLength = 240; + /// + /// This public class contains instance specific settings for alphaTab + /// + [JsonSerializable] + public partial class Settings + { + /// + /// The core settings control the general behavior of alphatab like + /// what modules are active. + /// + [JsonName("core", "")] + public CoreSettings Core { get; } = new CoreSettings(); - settings.PlayTripletFeel = true; + /// + /// The display settings control how the general layout and display of alphaTab is done. + /// + [JsonName("display", "")] + public DisplaySettings Display { get; } = new DisplaySettings(); - settings.SongBookBendDuration = 75; - settings.SongBookDipDuration = 150; - settings.IncludeNoteBounds = false; + /// + /// The notation settings control how various music notation elements are shown and behaving. + /// + [JsonName("notation")] + public NotationSettings Notation { get; } = new NotationSettings(); - settings.UseWorkers = true; - settings.BeatCursorWidth = 3; - settings.ScrollMode = ScrollMode.Continuous; - settings.ScrollSpeed = 300; + /// + ///All settings related to importers that decode file formats. + /// + [JsonName("importer")] + public ImporterSettings Importer { get; } = new ImporterSettings(); - settings.RenderingResources = new RenderingResources(); + /// + /// Contains all player related settings + /// + [JsonName("player")] + public PlayerSettings Player { get; } = new PlayerSettings(); - SetDefaults(settings); + internal void SetSongBookModeSettings() + { + Notation.NotationMode = NotationMode.SongBook; + Notation.SmallGraceTabNotes = false; + Notation.FingeringMode = FingeringMode.SingleNoteEffectBand; + Notation.ExtendBendArrowsOnTiedNotes = false; + Notation.ShowParenthesisForTiedBends = false; + Notation.ShowTabNoteOnTiedBend = false; + Notation.ShowZeroOnDiveWhammy = true; + } + /// + /// Gets the default settings for the songbook display mode. + /// + public static Settings SongBook + { + get + { + var settings = new Settings(); + settings.SetSongBookModeSettings(); return settings; } } diff --git a/Source/AlphaTab/StaveSettings.cs b/Source/AlphaTab/StaveSettings.cs deleted file mode 100644 index 26326a19b..000000000 --- a/Source/AlphaTab/StaveSettings.cs +++ /dev/null @@ -1,62 +0,0 @@ -using AlphaTab.Collections; - -namespace AlphaTab -{ - /// - /// Represents the stave specific settings. - /// - public class StaveSettings - { - /// - /// The stave profile name as it is registered in - /// Default Profiles: - ///
      - ///
    • score-tab - Standard music notation and guitar tablature are rendered (default)
    • - ///
    • score - Only standard music notation is rendered
    • - ///
    • tab - Only guitar tablature is rendered
    • - ///
    - ///
    - public string Id { get; set; } - - /// - /// Additional staffe specific settings - /// id=tab - ///
      - ///
    • rhythm - Renders rhythm beams to tablature notes
    • - ///
    - ///
    - public FastDictionary AdditionalSettings { get; set; } - - /// - /// Initializes a new instance of the class. - /// - /// The id of the settings defining the display mode. - public StaveSettings(string id) - { - Id = id; - AdditionalSettings = new FastDictionary(); - } - - /// - /// Gets the staff layout specific setting using the given key. - /// - /// The data type fo the stored value. - /// The key of the setting. - /// The default value to return if no setting was specified. - /// The user defined setting for the given key, or if the user did not specify a custom setting. - public T Get(string key, T def) - { - if (AdditionalSettings.ContainsKey(key.ToLower())) - { - return (T)AdditionalSettings[key.ToLower()]; - } - - if (AdditionalSettings.ContainsKey(key)) - { - return (T)AdditionalSettings[key]; - } - - return def; - } - } -} diff --git a/Source/AlphaTab/Util/JsonProperty.cs b/Source/AlphaTab/Util/JsonProperty.cs new file mode 100644 index 000000000..7efb84ab8 --- /dev/null +++ b/Source/AlphaTab/Util/JsonProperty.cs @@ -0,0 +1,25 @@ +using System; + +namespace AlphaTab.Util +{ + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Enum, Inherited = false, AllowMultiple = false)] + public sealed class JsonSerializableAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] + public sealed class JsonImmutableAttribute : Attribute + { + } + + [AttributeUsage(System.AttributeTargets.Property)] + public sealed class JsonNameAttribute : Attribute + { + public string[] Names { get; } + + public JsonNameAttribute(params string[] names) + { + Names = names; + } + } +} diff --git a/Source/AlphaTab/Util/Logger.cs b/Source/AlphaTab/Util/Logger.cs index 51680233e..156409a16 100644 --- a/Source/AlphaTab/Util/Logger.cs +++ b/Source/AlphaTab/Util/Logger.cs @@ -1,4 +1,4 @@ -namespace AlphaTab.Util +namespace AlphaTab.Util { internal class Logger { @@ -43,6 +43,7 @@ public static void Log(LogLevel logLevel, string category, string msg, object de /// /// Defines all loglevels. /// + [JsonSerializable] public enum LogLevel { /// diff --git a/Source/AlphaTab/VibratoPlaybackSettings.cs b/Source/AlphaTab/VibratoPlaybackSettings.cs deleted file mode 100644 index c1e701f29..000000000 --- a/Source/AlphaTab/VibratoPlaybackSettings.cs +++ /dev/null @@ -1,48 +0,0 @@ -namespace AlphaTab -{ - /// - /// This object defines the details on how to generate the vibrato effects. - /// - public class VibratoPlaybackSettings - { - /// - /// Gets or sets the wavelength of the note-wide vibrato in midi ticks. - /// - public int NoteWideLength { get; set; } - - /// - /// Gets or sets the amplitude for the note-wide vibrato in semitones. - /// - public int NoteWideAmplitude { get; set; } - - /// - /// Gets or sets the wavelength of the note-slight vibrato in midi ticks. - /// - public int NoteSlightLength { get; set; } - - /// - /// Gets or sets the amplitude for the note-slight vibrato in semitones. - /// - public int NoteSlightAmplitude { get; set; } - - /// - /// Gets or sets the wavelength of the beat-wide vibrato in midi ticks. - /// - public int BeatWideLength { get; set; } - - /// - /// Gets or sets the amplitude for the beat-wide vibrato in semitones. - /// - public int BeatWideAmplitude { get; set; } - - /// - /// Gets or sets the wavelength of the beat-slight vibrato in midi ticks. - /// - public int BeatSlightLength { get; set; } - - /// - /// Gets or sets the amplitude for the beat-slight vibrato in semitones. - /// - public int BeatSlightAmplitude { get; set; } - } -} diff --git a/TestData/Docs/player/demo.css b/TestData/Docs/player/demo.css index d76c3731e..b46624812 100644 --- a/TestData/Docs/player/demo.css +++ b/TestData/Docs/player/demo.css @@ -53,6 +53,7 @@ body { grid-area: viewport; border-bottom: 1px solid rgba(0, 0, 0, .12); overflow-y: auto; + padding-right:20px; /* scrollbar */ } .at-footer { @@ -254,6 +255,10 @@ a.active i.fas { width: 0; } +.at-speed-value { + font-size: 0.8rem; +} + /** Circular Progress Bar https://jsfiddle.net/bootstrapious/3xnomecr **/ .progress { width: 28px; diff --git a/TestData/Docs/player/player.html b/TestData/Docs/player/player.html index 1ef1ebb88..3b70953ee 100644 --- a/TestData/Docs/player/player.html +++ b/TestData/Docs/player/player.html @@ -42,7 +42,8 @@ } .at-cursor-beat { /* Defines the beat cursor */ - background: rgba(64, 64, 255, 0.75) + background: rgba(64, 64, 255, 0.75); + width: 3px; } .at-highlight * { /* Defines the color of the music symbols when they are being played (svg) */ @@ -77,8 +78,9 @@
    + data-player-scrolloffsety="-10" + data-player-enableplayer="true" + data-player-soundfont="../../js/alphaTab/default.sf2">
    @@ -131,7 +133,7 @@
    - Speed + Speed 100%
    @@ -385,7 +387,7 @@ } el.addEventListener('alphaTab.playedBeatChanged', function(e) { - updateMasterBarTimes(e.detail.beat.voice.bar.masterBar); + updateMasterBarTimes(e.detail.voice.bar.masterBar); }); // we also have some time related information shown in the UI @@ -456,11 +458,7 @@ e.stopPropagation(); at.playbackSpeed = e.target.value / 100.0; e.target.title = e.target.value + "%"; - if(e.target.value == "100") { - control.querySelector('.at-speed-label').innerText = "Speed"; - } else { - control.querySelector('.at-speed-label').innerText = "Speed (" + e.target.value + "%)"; - } + control.querySelector('.at-speed-value').innerText = e.target.value + "%"; }; control.querySelector('.at-loop').onclick = function(e) { @@ -495,15 +493,15 @@ switch(e.target.dataset.layout) { case 'page': - settings.layout.mode = 'page'; + settings.display.layoutMode = 'page'; settings.scrollMode = 1; break; case 'horizontal-bar': - settings.layout.mode = 'horizontal'; + settings.display.layoutMode = 'horizontal'; settings.scrollMode = 1; break; case 'horizontal-screen': - settings.layout.mode = 'horizontal'; + settings.display.layoutMode = 'horizontal'; settings.scrollMode = 2; break; } @@ -521,7 +519,9 @@ // depending on your own layout, you might want to set this to another element // that should be scrolled to keep alphaTab in the view // usually the scroll element should point to the next scrollable parent above alphaTab - scrollElement: control.querySelector('.at-viewport') + player: { + scrollElement: control.querySelector('.at-viewport') + } }; at = new alphaTab.platform.javaScript.AlphaTabApi(el, additionalSettings); diff --git a/appveyor.yml b/appveyor.yml index 98188ca7d..88d386087 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 0.9.5.{build} +version: 0.9.6.{build} # branches to build branches: only: