abcjs 6.0.0-beta.9 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/tests.yml +29 -0
- package/CODE_OF_CONDUCT.md +76 -0
- package/CONTRIBUTING.md +1 -0
- package/LICENSE.md +1 -1
- package/README.md +88 -7
- package/RELEASE.md +961 -1
- package/abcjs-audio.css +14 -5
- package/dist/.gitignore +1 -2
- package/dist/abcjs-basic-min.js +3 -0
- package/dist/abcjs-basic-min.js.LICENSE +23 -0
- package/dist/abcjs-basic.js +28232 -0
- package/dist/abcjs-basic.js.map +1 -0
- package/dist/abcjs-plugin-min.js +3 -0
- package/dist/abcjs-plugin-min.js.LICENSE +23 -0
- package/index.js +27 -2
- package/{static-wrappers/license.js → license.js} +1 -1
- package/package.json +26 -29
- package/{src/plugin/abc_plugin.js → plugin.js} +31 -19
- package/src/api/abc_animation.js +1 -17
- package/src/api/abc_tablatures.js +144 -0
- package/src/api/abc_timing_callbacks.js +216 -117
- package/src/api/abc_tunebook.js +18 -67
- package/src/api/abc_tunebook_svg.js +40 -48
- package/src/data/abc_tune.js +232 -972
- package/src/data/deline-tune.js +199 -0
- package/src/edit/abc_editarea.js +112 -0
- package/src/edit/abc_editor.js +95 -221
- package/src/midi/abc_midi_create.js +48 -50
- package/src/parse/abc_common.js +0 -14
- package/src/parse/abc_parse.js +167 -1321
- package/src/parse/abc_parse_book.js +62 -0
- package/src/parse/abc_parse_directive.js +164 -41
- package/src/parse/abc_parse_header.js +116 -145
- package/src/parse/abc_parse_key_voice.js +26 -20
- package/src/parse/abc_parse_music.js +1337 -0
- package/src/parse/abc_tokenizer.js +21 -15
- package/src/parse/abc_transpose.js +3 -15
- package/src/parse/tune-builder.js +896 -0
- package/src/parse/wrap_lines.js +205 -453
- package/src/synth/abc_midi_flattener.js +1292 -0
- package/src/{midi → synth}/abc_midi_renderer.js +44 -17
- package/src/synth/abc_midi_sequencer.js +648 -0
- package/src/synth/active-audio-context.js +3 -14
- package/src/synth/cents-to-factor.js +10 -0
- package/src/synth/create-note-map.js +21 -32
- package/src/synth/create-synth-control.js +20 -103
- package/src/synth/create-synth.js +185 -77
- package/src/synth/download-buffer.js +7 -21
- package/src/synth/get-midi-file.js +13 -20
- package/src/synth/images/{loading.svg → loading.svg.js} +4 -0
- package/src/synth/images/loop.svg.js +65 -0
- package/src/synth/images/pause.svg.js +10 -0
- package/src/synth/images/play.svg.js +9 -0
- package/src/synth/images/{reset.svg → reset.svg.js} +5 -1
- package/src/synth/instrument-index-to-name.js +1 -16
- package/src/synth/load-note.js +37 -76
- package/src/synth/pitch-to-note-name.js +0 -15
- package/src/synth/pitches-to-perc.js +64 -0
- package/src/synth/place-note.js +78 -68
- package/src/synth/play-event.js +17 -18
- package/src/synth/register-audio-context.js +11 -23
- package/src/synth/sounds-cache.js +0 -15
- package/src/synth/supports-audio.js +9 -23
- package/src/synth/synth-controller.js +80 -49
- package/src/synth/synth-sequence.js +20 -34
- package/src/tablatures/instruments/guitar/guitar-fonts.js +19 -0
- package/src/tablatures/instruments/guitar/guitar-patterns.js +23 -0
- package/src/tablatures/instruments/guitar/tab-guitar.js +50 -0
- package/src/tablatures/instruments/string-patterns.js +277 -0
- package/src/tablatures/instruments/string-tablature.js +56 -0
- package/src/tablatures/instruments/tab-note.js +282 -0
- package/src/tablatures/instruments/tab-notes.js +41 -0
- package/src/tablatures/instruments/violin/tab-violin.js +47 -0
- package/src/tablatures/instruments/violin/violin-fonts.js +19 -0
- package/src/tablatures/instruments/violin/violin-patterns.js +23 -0
- package/src/tablatures/tab-absolute-elements.js +310 -0
- package/src/tablatures/tab-common.js +29 -0
- package/src/tablatures/tab-renderer.js +243 -0
- package/src/tablatures/transposer.js +110 -0
- package/src/test/abc_midi_lint.js +5 -22
- package/src/test/abc_midi_sequencer_lint.js +11 -14
- package/src/test/abc_parser_lint.js +136 -32
- package/src/test/abc_vertical_lint.js +94 -32
- package/src/test/rendering-lint.js +38 -5
- package/src/write/abc_absolute_element.js +112 -120
- package/src/write/abc_abstract_engraver.js +102 -253
- package/src/write/abc_beam_element.js +30 -290
- package/src/write/abc_brace_element.js +12 -121
- package/src/write/abc_create_clef.js +21 -32
- package/src/write/abc_create_key_signature.js +8 -26
- package/src/write/abc_create_note_head.js +107 -0
- package/src/write/abc_create_time_signature.js +2 -21
- package/src/write/abc_crescendo_element.js +3 -50
- package/src/write/abc_decoration.js +7 -30
- package/src/write/abc_dynamic_decoration.js +3 -37
- package/src/write/abc_ending_element.js +1 -57
- package/src/write/abc_engraver_controller.js +111 -234
- package/src/write/abc_glyphs.js +8 -18
- package/src/write/abc_relative_element.js +57 -97
- package/src/write/abc_renderer.js +10 -832
- package/src/write/abc_spacing.js +0 -15
- package/src/write/abc_staff_group_element.js +14 -349
- package/src/write/abc_tempo_element.js +9 -117
- package/src/write/abc_tie_element.js +5 -68
- package/src/write/abc_triplet_element.js +6 -124
- package/src/write/abc_voice_element.js +7 -222
- package/src/write/add-chord.js +103 -0
- package/src/write/add-text-if.js +33 -0
- package/src/write/bottom-text.js +79 -0
- package/src/write/calcHeight.js +17 -0
- package/src/write/classes.js +100 -0
- package/src/write/draw/absolute.js +68 -0
- package/src/write/draw/beam.js +56 -0
- package/src/write/draw/brace.js +106 -0
- package/src/write/draw/crescendo.js +38 -0
- package/src/write/draw/debug-box.js +8 -0
- package/src/write/draw/draw.js +56 -0
- package/src/write/draw/dynamics.js +20 -0
- package/src/write/draw/ending.js +46 -0
- package/src/write/draw/group-elements.js +66 -0
- package/src/write/draw/horizontal-line.js +25 -0
- package/src/write/draw/non-music.js +50 -0
- package/src/write/draw/print-line.js +24 -0
- package/src/write/draw/print-path.js +7 -0
- package/src/write/draw/print-stem.js +30 -0
- package/src/write/draw/print-symbol.js +59 -0
- package/src/write/draw/print-vertical-line.js +18 -0
- package/src/write/draw/relative.js +77 -0
- package/src/write/draw/round-number.js +5 -0
- package/src/write/draw/selectables.js +59 -0
- package/src/write/draw/separator.js +16 -0
- package/src/write/draw/set-paper-size.js +45 -0
- package/src/write/{sprintf.js → draw/sprintf.js} +0 -0
- package/src/write/draw/staff-group.js +226 -0
- package/src/write/draw/staff-line.js +9 -0
- package/src/write/draw/staff.js +33 -0
- package/src/write/draw/tab-line.js +40 -0
- package/src/write/draw/tempo.js +45 -0
- package/src/write/draw/text.js +71 -0
- package/src/write/draw/tie.js +97 -0
- package/src/write/draw/triplet.js +46 -0
- package/src/write/draw/voice.js +102 -0
- package/src/write/format-jazz-chord.js +15 -0
- package/src/write/free-text.js +41 -0
- package/src/write/get-font-and-attr.js +37 -0
- package/src/write/get-text-size.js +56 -0
- package/src/write/highlight.js +11 -0
- package/src/write/layout/VoiceElements.js +121 -0
- package/src/write/layout/beam.js +213 -0
- package/src/write/layout/get-left-edge-of-staff.js +56 -0
- package/src/write/layout/getBarYAt.js +6 -0
- package/src/write/layout/layout.js +94 -0
- package/src/write/layout/setUpperAndLowerElements.js +232 -0
- package/src/write/layout/staffGroup.js +146 -0
- package/src/write/layout/triplet.js +75 -0
- package/src/write/layout/voice.js +137 -0
- package/src/write/selection.js +188 -70
- package/src/write/separator.js +10 -0
- package/src/write/set-class.js +21 -0
- package/src/write/subtitle.js +12 -0
- package/src/write/svg.js +95 -43
- package/src/write/top-text.js +54 -0
- package/src/write/unhighlight.js +11 -0
- package/test.js +27 -64
- package/types/index.d.ts +1095 -0
- package/version.js +1 -1
- package/.babelrc +0 -5
- package/.eslintrc +0 -3
- package/.gitmodules +0 -3
- package/Dockerfile +0 -8
- package/abcjs-midi.css +0 -166
- package/build-utils/loadPresets.js +0 -14
- package/build-utils/presets/webpack.analyze.js +0 -6
- package/build-utils/presets/webpack.optimize.js +0 -30
- package/build-utils/webpack.development.js +0 -14
- package/build-utils/webpack.production.js +0 -35
- package/deploy-docs.sh +0 -25
- package/docker-compose.yml +0 -13
- package/docs/README.md +0 -33
- package/fix-versions.sh +0 -23
- package/midi.js +0 -62
- package/src/api/abc_tunebook_midi.js +0 -116
- package/src/midi/abc_midi_controls.js +0 -701
- package/src/midi/abc_midi_flattener.js +0 -1119
- package/src/midi/abc_midi_js_preparer.js +0 -243
- package/src/midi/abc_midi_sequencer.js +0 -401
- package/src/midi/abc_midi_ui_generator.js +0 -86
- package/src/plugin/abc_plugin_midi.js +0 -220
- package/src/synth/images/loop.svg +0 -61
- package/src/synth/images/pause.svg +0 -6
- package/src/synth/images/play.svg +0 -5
- package/src/transform/abc2abc_write.js +0 -395
- package/static-wrappers/basic.js +0 -2
- package/static-wrappers/midi.js +0 -2
- package/static-wrappers/plugin-midi.js +0 -6
- package/static-wrappers/plugin.js +0 -6
- package/webpack.config.js +0 -29
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**!
|
|
2
|
+
Copyright (c) 2009-2022 Paul Rosen and Gregory Dyke
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
THE SOFTWARE.
|
|
21
|
+
|
|
22
|
+
**This text is from: http://opensource.org/licenses/MIT**
|
|
23
|
+
!**/
|
package/index.js
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
|
+
/**!
|
|
2
|
+
Copyright (c) 2009-2022 Paul Rosen and Gregory Dyke
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
THE SOFTWARE.
|
|
21
|
+
|
|
22
|
+
**This text is from: http://opensource.org/licenses/MIT**
|
|
23
|
+
!**/
|
|
1
24
|
var version = require('./version');
|
|
2
25
|
var animation = require('./src/api/abc_animation');
|
|
3
26
|
var tuneBook = require('./src/api/abc_tunebook');
|
|
27
|
+
var sequence = require('./src/synth/abc_midi_sequencer');
|
|
4
28
|
|
|
5
29
|
var abcjs = {};
|
|
6
30
|
|
|
@@ -44,9 +68,10 @@ abcjs.synth = {
|
|
|
44
68
|
supportsAudio: supportsAudio,
|
|
45
69
|
playEvent: playEvent,
|
|
46
70
|
getMidiFile: getMidiFile,
|
|
71
|
+
sequence: sequence,
|
|
47
72
|
};
|
|
48
73
|
|
|
49
|
-
|
|
50
|
-
abcjs['
|
|
74
|
+
abcjs['Editor'] = require('./src/edit/abc_editor');
|
|
75
|
+
abcjs['EditArea'] = require('./src/edit/abc_editarea');
|
|
51
76
|
|
|
52
77
|
module.exports = abcjs;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**!
|
|
2
|
-
Copyright (c) 2009-
|
|
2
|
+
Copyright (c) 2009-2022 Paul Rosen and Gregory Dyke
|
|
3
3
|
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
package/package.json
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "abcjs",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.2",
|
|
4
4
|
"description": "Renderer for abc music notation",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"types": "types/index.d.ts",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"webpack": "webpack",
|
|
8
|
-
"build": "npm run
|
|
9
|
-
"build:basic": "npm run webpack -- --
|
|
10
|
-
"build:basic-min": "npm run webpack -- --
|
|
11
|
-
"build:
|
|
12
|
-
"
|
|
13
|
-
"build:plugin-midi": "npm run webpack -- --env.mode production --env.type plugin-midi",
|
|
14
|
-
"fix-versions": "./fix-versions.sh 6.0.0-beta.9",
|
|
15
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
+
"build": "npm run build:basic && npm run webpack",
|
|
10
|
+
"build:basic": "npm run webpack -- --mode development --config-name basic",
|
|
11
|
+
"build:basic-min": "npm run webpack -- --mode production --config-name basic",
|
|
12
|
+
"build:plugin": "npm run webpack -- --mode production --config-name plugin",
|
|
13
|
+
"test": "mocha 'tests/**/*.js'",
|
|
16
14
|
"docs:dev": "vuepress dev docs",
|
|
17
15
|
"docs:build": "vuepress build docs",
|
|
18
|
-
"build:analyze": "npm run build:basic -- --env
|
|
16
|
+
"build:analyze": "npm run build:basic -- --env analyze"
|
|
19
17
|
},
|
|
20
18
|
"repository": {
|
|
21
19
|
"type": "git",
|
|
@@ -25,36 +23,35 @@
|
|
|
25
23
|
"abc",
|
|
26
24
|
"music",
|
|
27
25
|
"notation",
|
|
28
|
-
"midi"
|
|
26
|
+
"midi",
|
|
27
|
+
"webaudio"
|
|
29
28
|
],
|
|
30
29
|
"author": "Paul Rosen <paul@paulrosen.net> (https://abcjs.net)",
|
|
31
30
|
"contributors": [
|
|
32
31
|
"Gregory Dyke",
|
|
32
|
+
"Jean-Yves Mengant",
|
|
33
|
+
"Todd Brown",
|
|
33
34
|
"Thomas Chandelle"
|
|
34
35
|
],
|
|
35
36
|
"license": "MIT",
|
|
36
37
|
"bugs": {
|
|
37
38
|
"url": "https://github.com/paulrosen/abcjs/issues"
|
|
38
39
|
},
|
|
40
|
+
"funding": {
|
|
41
|
+
"type": "github",
|
|
42
|
+
"url": "https://github.com/sponsors/paulrosen"
|
|
43
|
+
},
|
|
39
44
|
"homepage": "https://abcjs.net",
|
|
40
45
|
"devDependencies": {
|
|
41
|
-
"@babel/core": "7.
|
|
42
|
-
"@babel/preset-env": "7.
|
|
43
|
-
"@
|
|
44
|
-
"babel-loader": "8.
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"webpack": "4.
|
|
50
|
-
"webpack-
|
|
51
|
-
"webpack-cli": "3.3.10",
|
|
52
|
-
"webpack-merge": "4.2.2",
|
|
53
|
-
"webpack-node-externals": "1.7.2",
|
|
54
|
-
"workbox-webpack-plugin": "4.3.1"
|
|
55
|
-
},
|
|
56
|
-
"dependencies": {
|
|
57
|
-
"abcjs": "6.0.0-beta.9",
|
|
58
|
-
"midi": "https://github.com/paulrosen/MIDI.js.git#abcjs"
|
|
46
|
+
"@babel/core": "7.14.3",
|
|
47
|
+
"@babel/preset-env": "7.14.4",
|
|
48
|
+
"@tarp/require": "1.4.3",
|
|
49
|
+
"babel-loader": "8.2.2",
|
|
50
|
+
"chai": "4.3.4",
|
|
51
|
+
"mocha": "8.4.0",
|
|
52
|
+
"vuepress": "2.0.0-beta.26",
|
|
53
|
+
"vuex": "4.0.0",
|
|
54
|
+
"webpack-bundle-analyzer": "4.4.2",
|
|
55
|
+
"webpack-cli": "4.9.0"
|
|
59
56
|
}
|
|
60
57
|
}
|
|
@@ -1,26 +1,34 @@
|
|
|
1
|
+
/**!
|
|
2
|
+
Copyright (c) 2009-2022 Paul Rosen and Gregory Dyke
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
THE SOFTWARE.
|
|
21
|
+
|
|
22
|
+
**This text is from: http://opensource.org/licenses/MIT**
|
|
23
|
+
!**/
|
|
1
24
|
// abc_plugin.js: Find everything which looks like abc and convert it
|
|
2
25
|
|
|
3
|
-
// Copyright (C) 2010-2020 Gregory Dyke (gregdyke at gmail dot com)
|
|
4
|
-
//
|
|
5
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
6
|
-
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
7
|
-
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
8
|
-
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
11
|
-
//
|
|
12
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
|
13
|
-
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
14
|
-
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
15
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17
|
-
|
|
18
26
|
/*global abcjs_is_user_script, abcjs_plugin_autostart */
|
|
19
27
|
"use strict";
|
|
20
28
|
|
|
21
|
-
var TuneBook = require('
|
|
22
|
-
var Parse = require('
|
|
23
|
-
var EngraverController = require('
|
|
29
|
+
var TuneBook = require('./src/api/abc_tunebook').TuneBook;
|
|
30
|
+
var Parse = require('./src/parse/abc_parse');
|
|
31
|
+
var EngraverController = require('./src/write/abc_engraver_controller');
|
|
24
32
|
|
|
25
33
|
var Plugin = function() {
|
|
26
34
|
"use strict";
|
|
@@ -239,4 +247,8 @@ if (autostart &&
|
|
|
239
247
|
}
|
|
240
248
|
}
|
|
241
249
|
|
|
242
|
-
|
|
250
|
+
var abcjs = {
|
|
251
|
+
plugin: Plugin
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
module.exports = abcjs;
|
package/src/api/abc_animation.js
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
// abc_animation.js: handles animating the music in real time.
|
|
2
|
-
|
|
3
|
-
//
|
|
4
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
5
|
-
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
6
|
-
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
7
|
-
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
-
//
|
|
9
|
-
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
-
//
|
|
11
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
|
12
|
-
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
13
|
-
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
14
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
15
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
16
|
-
|
|
17
|
-
var spacing = require('../write/abc_spacing');
|
|
18
|
-
var parseCommon = require('../parse/abc_common');
|
|
2
|
+
|
|
19
3
|
var TimingCallbacks = require('./abc_timing_callbacks');
|
|
20
4
|
|
|
21
5
|
var animation = {};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Tablature Plugins
|
|
3
|
+
* tablature are defined dynamically and registered inside abcjs
|
|
4
|
+
* by calling abcTablatures.register(plugin)
|
|
5
|
+
* where plugin represents a plugin instance
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
var ViolinTablature = require('../tablatures/instruments/violin/tab-violin');
|
|
9
|
+
var GuitarTablature = require('../tablatures/instruments/guitar/tab-guitar');
|
|
10
|
+
|
|
11
|
+
/* extend the table below when adding a new instrument plugin */
|
|
12
|
+
|
|
13
|
+
// Existing tab classes
|
|
14
|
+
var pluginTab = {
|
|
15
|
+
'violin': 'ViolinTab',
|
|
16
|
+
'guitar': 'GuitarTab'
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
var abcTablatures = {
|
|
20
|
+
|
|
21
|
+
inited: false,
|
|
22
|
+
plugins: {},
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* to be called once per plugin for registration
|
|
27
|
+
* @param {*} plugin
|
|
28
|
+
*/
|
|
29
|
+
register: function (plugin) {
|
|
30
|
+
var name = plugin.name;
|
|
31
|
+
var tablature = plugin.tablature;
|
|
32
|
+
this.plugins[name] = tablature;
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
setError: function (tune, msg) {
|
|
36
|
+
if (tune.warnings) {
|
|
37
|
+
tune.warning.push(msg);
|
|
38
|
+
} else {
|
|
39
|
+
tune.warnings = [msg];
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* handle params for current processed score
|
|
45
|
+
* @param {*} tune current tune
|
|
46
|
+
* @param {*} tuneNumber number in tune list
|
|
47
|
+
* @param {*} params params to be processed for tablature
|
|
48
|
+
* @return prepared tablatures plugin instances for current tune
|
|
49
|
+
*/
|
|
50
|
+
preparePlugins: function (tune, tuneNumber, params) {
|
|
51
|
+
var returned = null;
|
|
52
|
+
var nbPlugins = 0;
|
|
53
|
+
if (params.tablature) {
|
|
54
|
+
// validate requested plugins
|
|
55
|
+
var tabs = params.tablature;
|
|
56
|
+
returned = [];
|
|
57
|
+
for (var ii = 0; ii < tabs.length; ii++) {
|
|
58
|
+
var args = tabs[ii];
|
|
59
|
+
var instrument = args['instrument'];
|
|
60
|
+
if (instrument == null) {
|
|
61
|
+
this.setError(tune, "tablature 'instrument' is missing");
|
|
62
|
+
return returned;
|
|
63
|
+
}
|
|
64
|
+
var tabName = pluginTab[instrument];
|
|
65
|
+
var plugin = null;
|
|
66
|
+
if (tabName) {
|
|
67
|
+
plugin = this.plugins[tabName];
|
|
68
|
+
}
|
|
69
|
+
if (plugin) {
|
|
70
|
+
if (params.visualTranspose != 0) {
|
|
71
|
+
// populate transposition request to tabs
|
|
72
|
+
args.visualTranspose = params.visualTranspose;
|
|
73
|
+
}
|
|
74
|
+
args.abcSrc = params.tablature.abcSrc;
|
|
75
|
+
var pluginInstance = {
|
|
76
|
+
classz: plugin,
|
|
77
|
+
tuneNumber: tuneNumber,
|
|
78
|
+
params: args,
|
|
79
|
+
instance: null,
|
|
80
|
+
};
|
|
81
|
+
// proceed with tab plugin init
|
|
82
|
+
// plugin.init(tune, tuneNumber, args, ii);
|
|
83
|
+
returned.push(pluginInstance);
|
|
84
|
+
nbPlugins++;
|
|
85
|
+
} else {
|
|
86
|
+
// unknown tab plugin
|
|
87
|
+
//this.emit_error('Undefined tablature plugin: ' + tabName)
|
|
88
|
+
this.setError(tune, 'Undefined tablature plugin: ' + instrument);
|
|
89
|
+
return returned;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return returned;
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Call requested plugin
|
|
98
|
+
* @param {*} renderer
|
|
99
|
+
* @param {*} abcTune
|
|
100
|
+
*/
|
|
101
|
+
layoutTablatures: function (renderer, abcTune) {
|
|
102
|
+
var tabs = abcTune.tablatures;
|
|
103
|
+
// chack tabs request for each staffs
|
|
104
|
+
for (var ii = 0; ii < abcTune.lines.length; ii++) {
|
|
105
|
+
var line = abcTune.lines[ii];
|
|
106
|
+
var curStaff = line.staff;
|
|
107
|
+
if (curStaff) {
|
|
108
|
+
for (var jj = 0; jj < curStaff.length; jj++) {
|
|
109
|
+
if (tabs[jj]) {
|
|
110
|
+
// tablature requested for staff
|
|
111
|
+
var tabPlugin = tabs[jj];
|
|
112
|
+
if (tabPlugin.instance == null) {
|
|
113
|
+
tabPlugin.instance = new tabPlugin.classz();
|
|
114
|
+
// plugin.init(tune, tuneNumber, args, ii);
|
|
115
|
+
// call initer first
|
|
116
|
+
tabPlugin.instance.init(abcTune,
|
|
117
|
+
tabPlugin.tuneNumber,
|
|
118
|
+
tabPlugin.params,
|
|
119
|
+
jj
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
// render next
|
|
123
|
+
tabPlugin.instance.render(renderer, line, jj);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* called once internally to register internal plugins
|
|
132
|
+
*/
|
|
133
|
+
init: function () {
|
|
134
|
+
// just register plugin hosted by abcjs
|
|
135
|
+
if (!this.inited) {
|
|
136
|
+
this.register(new ViolinTablature());
|
|
137
|
+
this.register(new GuitarTablature());
|
|
138
|
+
this.inited = true;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
module.exports = abcTablatures ;
|