Comparing version 0.7.0 to 0.8.0
@@ -5,2 +5,8 @@ # Changelog | ||
## 0.8.0 - 2020-07-28 | ||
### Added | ||
* The `pageSize` (in pixels) field in position JSON (`measurePositions()` or `segmentPositions()`) | ||
## 0.7.0 - 2020-05-31 | ||
@@ -7,0 +13,0 @@ |
{ | ||
"name": "webmscore", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "MuseScore's libmscore in WebAssembly! Read mscz data, and generate audio/MIDI/MusicXML/SVG/PNG/PDF sheets right in browsers", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -34,4 +34,12 @@ | ||
interface ScorePageFormat { | ||
/** | ||
* page height in mm | ||
*/ | ||
height: number; | ||
/** | ||
* page width in mm | ||
*/ | ||
width: number; | ||
twosided: BoolString; | ||
@@ -136,3 +144,3 @@ } | ||
interface PositionElement { | ||
export interface PositionElement { | ||
/** | ||
@@ -148,3 +156,3 @@ * element index | ||
/** | ||
* The x coordinate (the top-left corner of the page to the top-left corner of the element) | ||
* The y coordinate (the top-left corner of the page to the top-left corner of the element) | ||
*/ | ||
@@ -198,2 +206,10 @@ y: number; | ||
events: PositionEvent[]; | ||
/** | ||
* The page size of the exported SVG/PNG/PDF file in pixels | ||
*/ | ||
pageSize: { | ||
height: number; | ||
width: number; | ||
}; | ||
} |
@@ -35,3 +35,3 @@ | ||
* Load the score data (from a MSCZ/MSCX file) | ||
* @param {'mscz' | 'mscx'} filetype | ||
* @param {'mscz' | 'mscx'} format | ||
* @param {Uint8Array} data | ||
@@ -41,3 +41,3 @@ * @param {Uint8Array[]} fonts load extra font files (CJK characters support) | ||
*/ | ||
static async load(filetype, data, fonts = [], doLayout = true) { | ||
static async load(format, data, fonts = [], doLayout = true) { | ||
await WebMscore.ready | ||
@@ -49,3 +49,3 @@ | ||
const filetypeptr = getStrPtr(filetype) | ||
const fileformatptr = getStrPtr(format) | ||
const dataptr = getTypedArrayPtr(data) | ||
@@ -57,6 +57,6 @@ | ||
['number', 'number', 'number', 'boolean'], // argument types | ||
[filetypeptr, dataptr, data.byteLength, doLayout] // arguments | ||
[fileformatptr, dataptr, data.byteLength, doLayout] // arguments | ||
) | ||
freePtr(filetypeptr) | ||
freePtr(fileformatptr) | ||
freePtr(dataptr) | ||
@@ -200,7 +200,7 @@ | ||
* Save part score as MSCZ/MSCX file | ||
* @param {'mscz' | 'mscx'} filetype | ||
* @param {'mscz' | 'mscx'} format | ||
* @returns {Promise<Uint8Array>} | ||
*/ | ||
async saveMsc(filetype = 'mscz') { | ||
const dataptr = Module.ccall('saveMsc', 'number', ['number', 'boolean', 'number'], [this.scoreptr, filetype == 'mscz', this.excerptId]) | ||
async saveMsc(format = 'mscz') { | ||
const dataptr = Module.ccall('saveMsc', 'number', ['number', 'boolean', 'number'], [this.scoreptr, format == 'mscz', this.excerptId]) | ||
return readData(dataptr) | ||
@@ -289,5 +289,5 @@ } | ||
* Export score as audio file (wav/ogg/flac) | ||
* @param {'wav' | 'ogg' | 'flac'} type | ||
* @param {'wav' | 'ogg' | 'flac'} format | ||
*/ | ||
async saveAudio(type) { | ||
async saveAudio(format) { | ||
if (!this.hasSoundfont) { | ||
@@ -297,9 +297,9 @@ throw new Error('The soundfont is not set.') | ||
const filetypeptr = getStrPtr(type) | ||
const fileformatptr = getStrPtr(format) | ||
const dataptr = Module.ccall('saveAudio', | ||
'number', | ||
['number', 'number', 'number'], | ||
[this.scoreptr, filetypeptr, this.excerptId] | ||
[this.scoreptr, fileformatptr, this.excerptId] | ||
) | ||
freePtr(filetypeptr) | ||
freePtr(fileformatptr) | ||
return readData(dataptr) | ||
@@ -306,0 +306,0 @@ } |
@@ -49,3 +49,3 @@ // @ts-check | ||
* Load the score (MSCZ/MSCX file) data | ||
* @param {'mscz' | 'mscx'} filetype | ||
* @param {'mscz' | 'mscx'} format | ||
* @param {Uint8Array} data | ||
@@ -55,6 +55,6 @@ * @param {Uint8Array[]} fonts load extra font files (CJK characters support) | ||
*/ | ||
static async load(filetype, data, fonts = [], doLayout = true) { | ||
static async load(format, data, fonts = [], doLayout = true) { | ||
const instance = new WebMscoreW() | ||
await instance.rpc('ready') | ||
await instance.rpc('load', [filetype, data, fonts, doLayout], [data.buffer, /** ...fonts.map(f => f.buffer) */]) | ||
await instance.rpc('load', [format, data, fonts, doLayout], [data.buffer, /** ...fonts.map(f => f.buffer) */]) | ||
return instance | ||
@@ -184,7 +184,7 @@ } | ||
* Save part score as MSCZ/MSCX file | ||
* @param {'mscz' | 'mscx'} filetype | ||
* @param {'mscz' | 'mscx'} format | ||
* @returns {Promise<Uint8Array>} | ||
*/ | ||
async saveMsc(filetype = 'mscz') { | ||
return this.rpc('saveMsc', [filetype]) | ||
async saveMsc(format = 'mscz') { | ||
return this.rpc('saveMsc', [format]) | ||
} | ||
@@ -244,10 +244,10 @@ | ||
* Export score as audio file (wav/ogg/flac) | ||
* @param {'wav' | 'ogg' | 'flac'} type | ||
* @param {'wav' | 'ogg' | 'flac'} format | ||
* @returns {Promise<Uint8Array>} | ||
*/ | ||
saveAudio(type) { | ||
saveAudio(format) { | ||
if (!this.hasSoundfont) { | ||
throw new Error('The soundfont is not set.') | ||
} | ||
return this.rpc('saveAudio', [type]) | ||
return this.rpc('saveAudio', [format]) | ||
} | ||
@@ -254,0 +254,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
29229745
5476
18