diff --git a/CHANGELOG.md b/CHANGELOG.md index a1563ab..63b9bda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,33 @@ # CHANGELOG -## version 10.0.0 - (unreleased) +## version 10.0.0 - 2020-01-07 Better handling of cue points and regions. -Features: -- setCuePoint() now can create both cue points and regions - -API Changes: -- listCuePoints() now returns a object with more information about each cue point -- setCuePoint() param is now a object with the cue point data +### API Changes: +- *listCuePoints()* now returns a list of objects with more information about each cue point: +```javascript +[ + { + position: 500, // the position in milliseconds + label: 'cue marker 1', + end: 1500, // the end position in milliseconds + dwName: 1, + dwPosition: 0, + fccChunk: 'data', + dwChunkStart: 0, + dwBlockStart: 0, + dwSampleOffset: 22050, // the position as a sample offset + dwSampleLength: 3646827, // the region length as a sample count + dwPurposeID: 544106354, + dwCountry: 0, + dwLanguage: 0, + dwDialect: 0, + dwCodePage: 0, + }, + //... +]; +``` +- *setCuePoint()* param is now a object with the cue point data: ```javascript // to create a cue point the position in milliseconds // is the only required attribute @@ -20,8 +39,17 @@ wav.setCuePoint({position: 1500, label: 'some label'}); // to create a cue region with a label: wav.setCuePoint({position: 1500, end: 2500, label: 'some label'}); ``` +Objects that define regions can also define the following optional properties: +- dwPurposeID +- dwCountry +- dwLanguage +- dwDialect +- dwCodePage + +### New Features: +- setCuePoint() now can create both cue points and regions. -Fixes: +### Fixes: - Fix setCuePoint() bug that caused some labels to display the wrong text diff --git a/README.md b/README.md index 470213f..97a100e 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ With **wavefile** you can: - Change the bit depth of the audio - Read and write RIFF tags - Set and delete cue points and their labels +- Create regions in wav files - Encode/decode files as ADPCM, A-Law and μ-Law - Turn RIFF files to RIFX and RIFX to RIFF - Create or edit BWF metadata ("bext" chunk) @@ -229,34 +230,67 @@ wav.deleteTag("ICMT"); ``` ### Add cue points to files -You can create cue points using the **WaveFile.setCuePoint()** method. The method takes a object with the cue point data and creates a cue point in the corresponding position of the file. The only required attribute of the object is 'position', a number representing the position of the point in milliseconds: +You can create cue points using the **WaveFile.setCuePoint()** method. The method takes a object with the cue point data and creates a cue point in the corresponding position of the file. The only required attribute of the object is *position*, a number representing the position of the point in milliseconds: ```javascript -// to create a cue point the position in milliseconds -// is the only required attribute in the cue point data object +// to create a cue point wav.setCuePoint({position: 1500}); ``` -You can also create cue points with labels by defining a 'label' attribute: +You can also create cue points with labels by defining a *label* attribute: ```javascript // to create a cue point with a label wav.setCuePoint({position: 1500, label: 'some label'}); ``` -To delete a cue point use **WaveFile.deleteCuePoint()** informing the index of the point. Points are ordered according to their position. The first point is indexed as 1. +To delete a cue point use **WaveFile.deleteCuePoint()** informing the index of the point. Points are ordered according to their position. **The first point is indexed as 1.** ```javascript wav.deleteCuePoint(1); ``` Mind that creating or deleting cue points will change the index of other points if they exist. +To list all the cue points in a file, in the order they appear: +```javascript +let cuePoints = wav.listCuePoints(); +``` +This method will return a list with cue points ordered as they appear in the file. +```javascript +[ + { + position: 500, // the position in milliseconds + label: 'cue marker 1', + end: 1500, // the end position in milliseconds + dwName: 1, + dwPosition: 0, + fccChunk: 'data', + dwChunkStart: 0, + dwBlockStart: 0, + dwSampleOffset: 22050, // the position as a sample offset + dwSampleLength: 3646827, // the region length as a sample count + dwPurposeID: 544106354, + dwCountry: 0, + dwLanguage: 0, + dwDialect: 0, + dwCodePage: 0, + }, + //... +]; +``` + ### Create regions in files You can create regions using the **WaveFile.setCuePoint()** method. Regions are cue points with extra data. -If you specify a 'end' attribute in the object describing the cue point, the point will be created as a region. The 'end' attribute is the end of the region, in milliseconds, counting from the start of the file: +If you define a not null *end* attribute in the object describing the cue point, the point will be created as a region. The *end* attribute should be the end of the region, in milliseconds, counting from the start of the file, and always greater than the *position* of the point: ```javascript // to create a region with a label: wav.setCuePoint({position: 1500, end: 2500, label: 'some label'}); ``` +You can also define the following optional properties when creating a region: +- dwPurposeID +- dwCountry +- dwLanguage +- dwDialect +- dwCodePage ### RIFX **wavefile** can handle existing RIFX files and create RIFX files from scratch. Files created from scratch will default to RIFF; to create a file as RIFX you must define the container: @@ -597,20 +631,9 @@ WaveFile.deleteCuePoint(index) {} /** * Return an array with all cue points in the file, in the order they appear * in the file. - * Objects representing standard cue points look like this: - * { - * milliseconds: 500 // the position in milliseconds - * label: 'cue marker 1', - * dwName: 1, - * dwPosition: 0, - * fccChunk: 'data', - * dwChunkStart: 0, - * dwBlockStart: 0, - * dwSampleOffset: 22050 // the position as a sample offset - * } - * Objects representing regions look like this: + * Objects representing cue points/regions look like this: * { - * milliseconds: 500 // the position in milliseconds + * position: 500, // the position in milliseconds * label: 'cue marker 1', * end: 1500, // the end position in milliseconds * dwName: 1, @@ -628,7 +651,7 @@ WaveFile.deleteCuePoint(index) {} * } * @return {!Array} */ -listCuePoints() {} +WaveFile.listCuePoints() {} /** * Update the label of a cue point. @@ -683,19 +706,25 @@ WaveFile.set_PMX(_PMXValue) {}; ``` #### WaveFile.listCuePoints() -This method returns a list of objects, each object representing a cue point. -The list looks like this: +This method returns a list of objects, each object representing a cue point or region. The list looks like this: ```javascript [ { - milliseconds: 500 + position: 500, // the position in milliseconds label: 'cue marker 1', + end: 1500, // the end position in milliseconds dwName: 1, dwPosition: 0, fccChunk: 'data', dwChunkStart: 0, dwBlockStart: 0, - dwSampleOffset: 22050 + dwSampleOffset: 22050, // the position as a sample offset + dwSampleLength: 3646827, // the region length as a sample count + dwPurposeID: 544106354, + dwCountry: 0, + dwLanguage: 0, + dwDialect: 0, + dwCodePage: 0 }, // ... ] diff --git a/dist/wavefile.js b/dist/wavefile.js index 7112b66..31cae5c 100644 --- a/dist/wavefile.js +++ b/dist/wavefile.js @@ -59,9 +59,9 @@ e;this.fmt.chunkSize=40;this.fmt.bitsPerSample=(parseInt(a,10)-1|7)+1;this.fmt.c this.fmt.audioFormat&&32===this.fmt.bitsPerSample?this.bitDepth="32f":6===this.fmt.audioFormat?this.bitDepth="8a":7===this.fmt.audioFormat?this.bitDepth="8m":this.bitDepth=this.fmt.bitsPerSample.toString()};t.prototype.ia=function(){if(!(this.M[this.bitDepth]||8parseInt(this.bitDepth,10)))throw Error("Invalid bit depth.");};t.prototype.V=function(){this.f={h:(parseInt(this.bitDepth,10)-1|7)+1,C:"32f"==this.bitDepth||"64"==this.bitDepth,A:"8"!=this.bitDepth,m:"RIFX"== this.container};-1<["4","8a","8m"].indexOf(this.bitDepth)&&(this.f.h=8,this.f.A=!1)};t.prototype.W=function(){this.ia();var a=this.fmt.numChannels;if(1>a||65535a||4294967295c.length)for(var d=0,e=4-c.length;da.dwSampleOffset&&!d?(this.B(a,e+1),this.B(b[e],e+2), -d=!0):this.B(b[e],d?e+2:e+1);d||this.B(a,this.cue.points.length+1)}this.cue.dwCuePoints=this.cue.points.length};k.prototype.deleteCuePoint=function(a){this.cue.chunkId="cue ";var b=this.J();this.H();var c=this.cue.points.length;this.cue.points=[];for(var d=0;da.dwSampleOffset&&!d?(this.B(a,e+1),this.B(b[e],e+2),d=!0):this.B(b[e], +d?e+2:e+1);d||this.B(a,this.cue.points.length+1)}this.cue.dwCuePoints=this.cue.points.length};k.prototype.deleteCuePoint=function(a){this.cue.chunkId="cue ";var b=this.J();this.H();var c=this.cue.points.length;this.cue.points=[];for(var d=0;dNotice
  • Change the bit depth of the audio
  • Read and write RIFF tags
  • Set and delete cue points and their labels
  • +
  • Create regions in wav files
  • Encode/decode files as ADPCM, A-Law and μ-Law
  • Turn RIFF files to RIFX and RIFX to RIFF
  • Create or edit BWF metadata ("bext" chunk)
  • @@ -254,25 +255,57 @@

    Add RIFF tags to files

    wav.deleteTag("ICMT");
     

    Add cue points to files

    -

    You can create cue points using the WaveFile.setCuePoint() method. The method takes a object with the cue point data and creates a cue point in the corresponding position of the file. The only required attribute of the object is 'position', a number representing the position of the point in milliseconds:

    -
    // to create a cue point the position in milliseconds
    -// is the only required attribute in the cue point data object
    +

    You can create cue points using the WaveFile.setCuePoint() method. The method takes a object with the cue point data and creates a cue point in the corresponding position of the file. The only required attribute of the object is position, a number representing the position of the point in milliseconds:

    +
    // to create a cue point
     wav.setCuePoint({position: 1500});
     
    -

    You can also create cue points with labels by defining a 'label' attribute:

    +

    You can also create cue points with labels by defining a label attribute:

    // to create a cue point with a label
     wav.setCuePoint({position: 1500, label: 'some label'});
     
    -

    To delete a cue point use WaveFile.deleteCuePoint() informing the index of the point. Points are ordered according to their position. The first point is indexed as 1.

    +

    To delete a cue point use WaveFile.deleteCuePoint() informing the index of the point. Points are ordered according to their position. The first point is indexed as 1.

    wav.deleteCuePoint(1);
     

    Mind that creating or deleting cue points will change the index of other points if they exist.

    +

    To list all the cue points in a file, in the order they appear:

    +
    let cuePoints = wav.listCuePoints();
    +
    +

    This method will return a list with cue points ordered as they appear in the file.

    +
    [
    +  {
    +    position: 500, // the position in milliseconds
    +    label: 'cue marker 1',
    +    end: 1500, // the end position in milliseconds
    +    dwName: 1,
    +    dwPosition: 0,
    +    fccChunk: 'data',
    +    dwChunkStart: 0,
    +    dwBlockStart: 0,
    +    dwSampleOffset: 22050, // the position as a sample offset
    +    dwSampleLength: 3646827, // the region length as a sample count
    +    dwPurposeID: 544106354,
    +    dwCountry: 0,
    +    dwLanguage: 0,
    +    dwDialect: 0,
    +    dwCodePage: 0,
    +  },
    +  //...
    +];
    +

    Create regions in files

    You can create regions using the WaveFile.setCuePoint() method. Regions are cue points with extra data.

    -

    If you specify a 'end' attribute in the object describing the cue point, the point will be created as a region. The 'end' attribute is the end of the region, in milliseconds, counting from the start of the file:

    +

    If you define a not null end attribute in the object describing the cue point, the point will be created as a region. The end attribute should be the end of the region, in milliseconds, counting from the start of the file, and always greater than the position of the point:

    // to create a region with a label:
     wav.setCuePoint({position: 1500, end: 2500, label: 'some label'});
     
    +

    You can also define the following optional properties when creating a region:

    +
      +
    • dwPurposeID
    • +
    • dwCountry
    • +
    • dwLanguage
    • +
    • dwDialect
    • +
    • dwCodePage
    • +

    RIFX

    wavefile can handle existing RIFX files and create RIFX files from scratch. Files created from scratch will default to RIFF; to create a file as RIFX you must define the container:

    wav.fromScratch(1, 48000, '16', [0, 1, -3278, 327], {"container": "RIFX"});
    @@ -573,20 +606,9 @@ 

    The WaveFile methods

    /** * Return an array with all cue points in the file, in the order they appear * in the file. - * Objects representing standard cue points look like this: - * { - * milliseconds: 500 // the position in milliseconds - * label: 'cue marker 1', - * dwName: 1, - * dwPosition: 0, - * fccChunk: 'data', - * dwChunkStart: 0, - * dwBlockStart: 0, - * dwSampleOffset: 22050 // the position as a sample offset - * } - * Objects representing regions look like this: + * Objects representing cue points/regions look like this: * { - * milliseconds: 500 // the position in milliseconds + * position: 500, // the position in milliseconds * label: 'cue marker 1', * end: 1500, // the end position in milliseconds * dwName: 1, @@ -604,7 +626,7 @@

    The WaveFile methods

    * } * @return {!Array<Object>} */ -listCuePoints() {} +WaveFile.listCuePoints() {} /** * Update the label of a cue point. @@ -658,18 +680,24 @@

    The WaveFile methods

    WaveFile.listCuePoints()

    -

    This method returns a list of objects, each object representing a cue point. -The list looks like this:

    +

    This method returns a list of objects, each object representing a cue point or region. The list looks like this:

    [
       {
    -    milliseconds: 500
    +    position: 500, // the position in milliseconds
         label: 'cue marker 1',
    +    end: 1500, // the end position in milliseconds
         dwName: 1,
         dwPosition: 0,
         fccChunk: 'data',
         dwChunkStart: 0,
         dwBlockStart: 0,
    -    dwSampleOffset: 22050
    +    dwSampleOffset: 22050, // the position as a sample offset
    +    dwSampleLength: 3646827, // the region length as a sample count
    +    dwPurposeID: 544106354,
    +    dwCountry: 0,
    +    dwLanguage: 0,
    +    dwDialect: 0,
    +    dwCodePage: 0
       },
       // ...
     ]
    diff --git a/docs/lib_wavefile-meta-editor.js.html b/docs/lib_wavefile-meta-editor.js.html
    index b4eaef8..b0ecde4 100644
    --- a/docs/lib_wavefile-meta-editor.js.html
    +++ b/docs/lib_wavefile-meta-editor.js.html
    @@ -164,20 +164,9 @@ 

    lib/wavefile-meta-editor.js

    /** * Return an array with all cue points in the file, in the order they appear * in the file. - * Objects representing standard cue points look like this: + * Objects representing cue points/regions look like this: * { - * milliseconds: 500 // the position in milliseconds - * label: 'cue marker 1', - * dwName: 1, - * dwPosition: 0, - * fccChunk: 'data', - * dwChunkStart: 0, - * dwBlockStart: 0, - * dwSampleOffset: 22050 // the position as a sample offset - * } - * Objects representing regions look like this: - * { - * milliseconds: 500 // the position in milliseconds + * position: 500, // the position in milliseconds * label: 'cue marker 1', * end: 1500, // the end position in milliseconds * dwName: 1, @@ -186,7 +175,7 @@

    lib/wavefile-meta-editor.js

    * dwChunkStart: 0, * dwBlockStart: 0, * dwSampleOffset: 22050, // the position as a sample offset - * dwSampleLength: 3646827, // the region length as a sample count + * dwSampleLength: 3646827, // length as a sample count, 0 if not a region * dwPurposeID: 544106354, * dwCountry: 0, * dwLanguage: 0, @@ -201,14 +190,18 @@

    lib/wavefile-meta-editor.js

    for (let i = 0, len = points.length; i < len; i++) { // Add attrs that should exist in the object - points[i].milliseconds = + points[i].position = (points[i].dwSampleOffset / this.fmt.sampleRate) * 1000; - // If it is a region, add the end attr + // If it is a region, calc the end + // position in milliseconds if (points[i].dwSampleLength) { points[i].end = (points[i].dwSampleLength / this.fmt.sampleRate) * 1000; - points[i].end += points[i].milliseconds; + points[i].end += points[i].position; + // If its not a region, end should be null + } else { + points[i].end = null; } // Remove attrs that should not go in the results diff --git a/docs/module-wavefile.WaveFile.html b/docs/module-wavefile.WaveFile.html index f7a3dff..c377c1c 100644 --- a/docs/module-wavefile.WaveFile.html +++ b/docs/module-wavefile.WaveFile.html @@ -373,7 +373,7 @@

    deleteC
    Source:
    @@ -1617,7 +1617,7 @@

    listCueP
    Source:
    @@ -1662,7 +1662,7 @@

    listCueP
    - Return an array with all cue points in the file, in the order they appear in the file. Objects representing standard cue points look like this: { milliseconds: 500 // the position in milliseconds label: 'cue marker 1', dwName: 1, dwPosition: 0, fccChunk: 'data', dwChunkStart: 0, dwBlockStart: 0, dwSampleOffset: 22050 // the position as a sample offset } Objects representing regions look like this: { milliseconds: 500 // the position in milliseconds label: 'cue marker 1', end: 1500, // the end position in milliseconds dwName: 1, dwPosition: 0, fccChunk: 'data', dwChunkStart: 0, dwBlockStart: 0, dwSampleOffset: 22050, // the position as a sample offset dwSampleLength: 3646827, // the region length as a sample count dwPurposeID: 544106354, dwCountry: 0, dwLanguage: 0, dwDialect: 0, dwCodePage: 0, } + Return an array with all cue points in the file, in the order they appear in the file. Objects representing cue points/regions look like this: { position: 500, // the position in milliseconds label: 'cue marker 1', end: 1500, // the end position in milliseconds dwName: 1, dwPosition: 0, fccChunk: 'data', dwChunkStart: 0, dwBlockStart: 0, dwSampleOffset: 22050, // the position as a sample offset dwSampleLength: 3646827, // length as a sample count, 0 if not a region dwPurposeID: 544106354, dwCountry: 0, dwLanguage: 0, dwDialect: 0, dwCodePage: 0, }
    @@ -1841,7 +1841,7 @@

    setCuePoin
    Source:
    @@ -3172,7 +3172,7 @@

    updateLabe
    Source:
    diff --git a/externs/wavefile.js b/externs/wavefile.js index 53c189f..3379140 100644 --- a/externs/wavefile.js +++ b/externs/wavefile.js @@ -114,7 +114,7 @@ WaveFile.prototype.cue = { dwChunkStart: 0, dwBlockStart: 0, dwSampleOffset: 0, - milliseconds: 0 + position: 0 }], }; /** @@ -521,20 +521,9 @@ WaveFile.prototype.listTags = function() {}; /** * Return an array with all cue points in the file, in the order they appear * in the file. - * Objects representing standard cue points look like this: + * Objects representing cue points/regions look like this: * { - * milliseconds: 500 // the position in milliseconds - * label: 'cue marker 1', - * dwName: 1, - * dwPosition: 0, - * fccChunk: 'data', - * dwChunkStart: 0, - * dwBlockStart: 0, - * dwSampleOffset: 22050 // the position as a sample offset - * } - * Objects representing regions look like this: - * { - * milliseconds: 500 // the position in milliseconds + * position: 500, // the position in milliseconds * label: 'cue marker 1', * end: 1500, // the end position in milliseconds * dwName: 1, diff --git a/index.d.ts b/index.d.ts index a9286d4..829abc4 100644 --- a/index.d.ts +++ b/index.d.ts @@ -293,20 +293,9 @@ declare module wavefile { /** * Return an array with all cue points in the file, in the order they appear * in the file. - * Objects representing standard cue points look like this: + * Objects representing cue points/regions look like this: * { - * milliseconds: 500 // the position in milliseconds - * label: 'cue marker 1', - * dwName: 1, - * dwPosition: 0, - * fccChunk: 'data', - * dwChunkStart: 0, - * dwBlockStart: 0, - * dwSampleOffset: 22050 // the position as a sample offset - * } - * Objects representing regions look like this: - * { - * milliseconds: 500 // the position in milliseconds + * position: 500, // the position in milliseconds * label: 'cue marker 1', * end: 1500, // the end position in milliseconds * dwName: 1, diff --git a/lib/wavefile-meta-editor.js b/lib/wavefile-meta-editor.js index 9f19f82..9aa60b0 100644 --- a/lib/wavefile-meta-editor.js +++ b/lib/wavefile-meta-editor.js @@ -120,20 +120,9 @@ export class WaveFileMetaEditor extends WaveFileCreator { /** * Return an array with all cue points in the file, in the order they appear * in the file. - * Objects representing standard cue points look like this: + * Objects representing cue points/regions look like this: * { - * milliseconds: 500 // the position in milliseconds - * label: 'cue marker 1', - * dwName: 1, - * dwPosition: 0, - * fccChunk: 'data', - * dwChunkStart: 0, - * dwBlockStart: 0, - * dwSampleOffset: 22050 // the position as a sample offset - * } - * Objects representing regions look like this: - * { - * milliseconds: 500 // the position in milliseconds + * position: 500, // the position in milliseconds * label: 'cue marker 1', * end: 1500, // the end position in milliseconds * dwName: 1, @@ -142,7 +131,7 @@ export class WaveFileMetaEditor extends WaveFileCreator { * dwChunkStart: 0, * dwBlockStart: 0, * dwSampleOffset: 22050, // the position as a sample offset - * dwSampleLength: 3646827, // the region length as a sample count + * dwSampleLength: 3646827, // length as a sample count, 0 if not a region * dwPurposeID: 544106354, * dwCountry: 0, * dwLanguage: 0, @@ -157,14 +146,18 @@ export class WaveFileMetaEditor extends WaveFileCreator { for (let i = 0, len = points.length; i < len; i++) { // Add attrs that should exist in the object - points[i].milliseconds = + points[i].position = (points[i].dwSampleOffset / this.fmt.sampleRate) * 1000; - // If it is a region, add the end attr + // If it is a region, calc the end + // position in milliseconds if (points[i].dwSampleLength) { points[i].end = (points[i].dwSampleLength / this.fmt.sampleRate) * 1000; - points[i].end += points[i].milliseconds; + points[i].end += points[i].position; + // If its not a region, end should be null + } else { + points[i].end = null; } // Remove attrs that should not go in the results diff --git a/test/dist/cue/16bit-read.js b/test/dist/cue/16bit-read.js index 5ebbc71..b2d3ed9 100644 --- a/test/dist/cue/16bit-read.js +++ b/test/dist/cue/16bit-read.js @@ -136,7 +136,7 @@ describe("16-bit cue reading (file with 2 markers)", function() { assert.equal(wav.listCuePoints()[0].label, "wave1"); }); it("read UTF8 in cue point markers", function() { - assert.equal(wav.listCuePoints()[0].milliseconds, 1500); + assert.equal(wav.listCuePoints()[0].position, 1500); }); // the cue points [1] it("read UTF8 in cue point markers", function() { @@ -146,24 +146,8 @@ describe("16-bit cue reading (file with 2 markers)", function() { assert.equal(wav.listCuePoints()[1].label, "wave2"); }); it("read UTF8 in cue point markers", function() { - assert.equal(wav.listCuePoints()[1].milliseconds, 4500); - }); - /* - it("reads the markers in the file", function() { - assert.deepEqual(wav.listCuePoints(), [ - { - dwPosition: 24000, - label: "wave1", - milliseconds: 1500 - }, - { - dwPosition: 72000, - label: "wave2", - milliseconds: 4500 - } - ]); - }); - */ + assert.equal(wav.listCuePoints()[1].position, 4500); + }); }); describe("16-bit cue reading (file with 1 UTF8 marker)", function() { @@ -177,20 +161,8 @@ describe("16-bit cue reading (file with 1 UTF8 marker)", function() { assert.equal(wav.listCuePoints()[0].label, "\u03A9"); }); it("read UTF8 in cue point markers", function() { - assert.equal(wav.listCuePoints()[0].milliseconds, 500); + assert.equal(wav.listCuePoints()[0].position, 500); }); - /* - it("read UTF8 in cue point markers", function() { - assert.deepEqual(wav.listCuePoints(), [ - { - dwPosition: 4000, - label: "\u03A9", - - milliseconds: 500 - } - ]); - }); - */ }); describe("16-bit cue reading (https://github.com/rochars/wavefile/issues/13)", function() { @@ -204,17 +176,6 @@ describe("16-bit cue reading (https://github.com/rochars/wavefile/issues/13)", f assert.equal(wav.listCuePoints()[0].label, "Marker 01 abcäöüß"); }); it("read UTF8 in cue point markers", function() { - assert.equal(wav.listCuePoints()[0].milliseconds, 500); + assert.equal(wav.listCuePoints()[0].position, 500); }); - /* - it("read UTF8 in cue point markers", function() { - assert.deepEqual(wav.listCuePoints(), [ - { - dwPosition: 4000, - label: "Marker 01 abcäöüß", - milliseconds: 500 - } - ]); - }); - */ }); \ No newline at end of file diff --git a/test/src/listCuePoints.js b/test/src/listCuePoints.js index 3e18425..5e1fd83 100644 --- a/test/src/listCuePoints.js +++ b/test/src/listCuePoints.js @@ -27,22 +27,22 @@ describe('listCuePoints() of a 16-bit wave files from scratch', function() { wav.setCuePoint({position: 2000, label: "cue marker 4"}); // assert.deepEqual(wav.listCuePoints()[0].dwPosition, 0); - assert.deepEqual(wav.listCuePoints()[0].milliseconds, 1000); + assert.deepEqual(wav.listCuePoints()[0].position, 1000); assert.deepEqual(wav.listCuePoints()[0].dwSampleOffset, 8000); assert.deepEqual(wav.listCuePoints()[0].label, "cue marker 2"); assert.deepEqual(wav.listCuePoints()[1].dwPosition, 0); - assert.deepEqual(wav.listCuePoints()[1].milliseconds, 1250); + assert.deepEqual(wav.listCuePoints()[1].position, 1250); assert.deepEqual(wav.listCuePoints()[1].dwSampleOffset, 10000); assert.deepEqual(wav.listCuePoints()[1].label, "cue marker 3"); - assert.deepEqual(wav.listCuePoints()[1].dwPosition, 0); - assert.deepEqual(wav.listCuePoints()[2].milliseconds, 1500); + assert.deepEqual(wav.listCuePoints()[2].dwPosition, 0); + assert.deepEqual(wav.listCuePoints()[2].position, 1500); assert.deepEqual(wav.listCuePoints()[2].dwSampleOffset, 12000); assert.deepEqual(wav.listCuePoints()[2].label, "cue marker 1"); assert.deepEqual(wav.listCuePoints()[3].dwPosition, 0); - assert.deepEqual(wav.listCuePoints()[3].milliseconds, 2000); + assert.deepEqual(wav.listCuePoints()[3].position, 2000); assert.deepEqual(wav.listCuePoints()[3].dwSampleOffset, 16000); assert.deepEqual(wav.listCuePoints()[3].label, "cue marker 4"); });