midifile-ts
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -653,3 +653,3 @@ var MIDIChannelEvents = { | ||
if (!Number.isInteger(data)) { | ||
throw new Error("\"" + data + "\" is not integer"); | ||
throw new Error("\"".concat(data, "\" is not integer")); | ||
} | ||
@@ -718,3 +718,15 @@ bytes.push(data); | ||
case "smpteOffset": { | ||
console.warn("not implemented yet"); | ||
var frameRateByte = { | ||
24: 0x00, | ||
25: 0x20, | ||
29: 0x40, | ||
30: 0x60, | ||
}; | ||
addNumbers([ | ||
frameRateByte[e.frameRate] + (0x1f & e.hour), | ||
e.min, | ||
e.sec, | ||
e.frame, | ||
e.subframe, | ||
]); | ||
break; | ||
@@ -721,0 +733,0 @@ } |
{ | ||
"name": "midifile-ts", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "", | ||
@@ -23,10 +23,10 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@types/jest": "27.0.2", | ||
"@types/node": "16.10.3", | ||
"@wessberg/rollup-plugin-ts": "1.3.8", | ||
"jest": "^27.2.4", | ||
"rollup": "2.58.0", | ||
"ts-jest": "^27.0.5", | ||
"typescript": "4.4.3" | ||
"@types/jest": "27.4.1", | ||
"@types/node": "17.0.30", | ||
"jest": "^27.5.1", | ||
"rollup": "2.71.1", | ||
"rollup-plugin-ts": "^2.0.7", | ||
"ts-jest": "^27.1.4", | ||
"typescript": "4.6.4" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import ts from "@wessberg/rollup-plugin-ts" | ||
import ts from "rollup-plugin-ts" | ||
@@ -3,0 +3,0 @@ export default { |
import assert from "assert" | ||
import { deserialize } from "./deserialize" | ||
import { SmpteOffsetEvent, TrackNameEvent } from "./event" | ||
import { serialize } from "./serialize" | ||
import { TrackNameEvent } from "./event" | ||
import { deserialize } from "./deserialize" | ||
import { Stream } from "./stream" | ||
@@ -13,3 +13,3 @@ | ||
type: "meta", | ||
deltaTime: 123 | ||
deltaTime: 123, | ||
} | ||
@@ -19,3 +19,35 @@ const bytes = serialize(e, true) | ||
assert.deepStrictEqual(e, e2) | ||
}) | ||
}), | ||
it("serializes smpteOffset events", () => { | ||
const e: SmpteOffsetEvent = { | ||
type: "meta", | ||
subtype: "smpteOffset", | ||
deltaTime: 0, | ||
frameRate: 24, | ||
hour: 1, | ||
min: 0, | ||
sec: 0, | ||
frame: 0, | ||
subframe: 0, | ||
} | ||
const bytes = serialize(e, true) | ||
const e2 = deserialize(new Stream(bytes), 0, () => {}) | ||
assert.deepStrictEqual(e, e2) | ||
}), | ||
it("serializes smpteOffset events with various time values", () => { | ||
const e: SmpteOffsetEvent = { | ||
type: "meta", | ||
subtype: "smpteOffset", | ||
deltaTime: 0, | ||
frameRate: 29, | ||
hour: 23, | ||
min: 59, | ||
sec: 58, | ||
frame: 20, | ||
subframe: 99, | ||
} | ||
const bytes = serialize(e, true) | ||
const e2 = deserialize(new Stream(bytes), 0, () => {}) | ||
assert.deepStrictEqual(e, e2) | ||
}) | ||
}) |
@@ -83,3 +83,15 @@ import { MIDIChannelEvents } from "./constants/MIDIChannelEvents" | ||
case "smpteOffset": { | ||
console.warn("not implemented yet") | ||
const frameRateByte = { | ||
24: 0x00, | ||
25: 0x20, | ||
29: 0x40, | ||
30: 0x60, | ||
} | ||
addNumbers([ | ||
frameRateByte[e.frameRate] + (0x1f & e.hour), | ||
e.min, | ||
e.sec, | ||
e.frame, | ||
e.subframe, | ||
]) | ||
break | ||
@@ -86,0 +98,0 @@ } |
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
190604
2555