@opendaw/studio-core 0.0.72 → 0.0.74
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/dist/dawproject/DawProjectService.d.ts +2 -4
- package/dist/dawproject/DawProjectService.d.ts.map +1 -1
- package/dist/dawproject/DawProjectService.js +3 -7
- package/dist/processors.js +1 -1
- package/dist/processors.js.map +2 -2
- package/dist/project/ProjectApi.d.ts +5 -0
- package/dist/project/ProjectApi.d.ts.map +1 -1
- package/dist/project/ProjectApi.js +20 -1
- package/package.json +5 -5
|
@@ -35,6 +35,10 @@ export type NoteRegionParams = {
|
|
|
35
35
|
name?: string;
|
|
36
36
|
hue?: number;
|
|
37
37
|
};
|
|
38
|
+
export type QuantiseNotesOptions = {
|
|
39
|
+
positionQuantisation?: ppqn;
|
|
40
|
+
durationQuantisation?: ppqn;
|
|
41
|
+
};
|
|
38
42
|
export declare class ProjectApi {
|
|
39
43
|
#private;
|
|
40
44
|
constructor(project: Project);
|
|
@@ -55,6 +59,7 @@ export declare class ProjectApi {
|
|
|
55
59
|
createNotStretchedClip(props: AudioContentFactory.NotStretchedProps & AudioContentFactory.Clip): AudioClipBox;
|
|
56
60
|
createNotStretchedRegion(props: AudioContentFactory.NotStretchedProps & AudioContentFactory.Region): AudioRegionBox;
|
|
57
61
|
createNoteClip(trackBox: TrackBox, clipIndex: int, { name, hue }?: ClipRegionOptions): NoteClipBox;
|
|
62
|
+
quantiseNotes(collection: NoteEventCollectionBox, { positionQuantisation, durationQuantisation }: QuantiseNotesOptions): void;
|
|
58
63
|
createValueClip(trackBox: TrackBox, clipIndex: int, { name, hue }?: ClipRegionOptions): ValueClipBox;
|
|
59
64
|
createNoteRegion({ trackBox, position, duration, loopOffset, loopDuration, eventOffset, eventCollection, mute, name, hue }: NoteRegionParams): NoteRegionBox;
|
|
60
65
|
createTrackRegion(trackBox: TrackBox, position: ppqn, duration: ppqn, { name, hue }?: ClipRegionOptions): Option<NoteRegionBox> | Option<ValueRegionBox>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectApi.d.ts","sourceRoot":"","sources":["../../src/project/ProjectApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,OAAO,EAGP,KAAK,EACL,GAAG,
|
|
1
|
+
{"version":3,"file":"ProjectApi.d.ts","sourceRoot":"","sources":["../../src/project/ProjectApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,OAAO,EAGP,KAAK,EACL,GAAG,EAIH,QAAQ,EACR,MAAM,EAIN,YAAY,EAEf,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAC,IAAI,EAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAW,KAAK,EAAc,YAAY,EAAC,MAAM,kBAAkB,CAAA;AAC1E,OAAO,EAAgB,QAAQ,EAAC,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EACH,YAAY,EACZ,cAAc,EACd,YAAY,EAGZ,WAAW,EACX,YAAY,EACZ,sBAAsB,EACtB,aAAa,EACb,QAAQ,EACR,YAAY,EAEZ,cAAc,EACjB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACH,mBAAmB,EAInB,iBAAiB,EACjB,gCAAgC,EAChC,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EAGpB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAA;AACtC,OAAO,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAA;AAE3C,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC1B,KAAK,EAAE;QAAE,MAAM,EAAE,YAAY,CAAC,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,mBAAmB,CAAC,MAAM,GAAG,cAAc;IAInH,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,EAAC,IAAI,EAAE,GAAG,EAAC,GAAE,iBAAsB,GAAG,WAAW;IAgBpG,aAAa,CAAC,UAAU,EAAE,sBAAsB,EAClC,EAAC,oBAAoB,EAAE,oBAAoB,EAAC,EAAE,oBAAoB,GAAG,IAAI;IAoBvF,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,EAAC,IAAI,EAAE,GAAG,EAAC,GAAE,iBAAsB,GAAG,YAAY;IAgBtG,gBAAgB,CAAC,EACI,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EACtD,WAAW,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAChD,EAAE,gBAAgB,GAAG,aAAa;IAoBpD,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAC,IAAI,EAAE,GAAG,EAAC,GAAE,iBAAsB;IAkCzG,eAAe,CAAC,EAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAC,EAAE,eAAe,GAAG,YAAY;IAe1G,eAAe,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;CA+BpD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { asInstanceOf, assert, Attempts, clamp, isInstanceOf, Option, panic, Strings, UUID } from "@opendaw/lib-std";
|
|
1
|
+
import { asInstanceOf, assert, Attempts, clamp, isAbsent, isDefined, isInstanceOf, Option, panic, quantizeRound, Strings, UUID } from "@opendaw/lib-std";
|
|
2
2
|
import { PPQN } from "@opendaw/lib-dsp";
|
|
3
3
|
import { IndexedBox } from "@opendaw/lib-box";
|
|
4
4
|
import { AudioUnitType } from "@opendaw/studio-enums";
|
|
@@ -109,6 +109,25 @@ export class ProjectApi {
|
|
|
109
109
|
box.events.refer(events.owners);
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
+
quantiseNotes(collection, { positionQuantisation, durationQuantisation }) {
|
|
113
|
+
if (isAbsent(positionQuantisation) && isAbsent(durationQuantisation)) {
|
|
114
|
+
console.warn("Nothing to quantise: both quantisation parameters are absent");
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
collection.events.pointerHub.incoming().forEach(({ box }) => {
|
|
118
|
+
const event = asInstanceOf(box, NoteEventBox);
|
|
119
|
+
let position = event.position.getValue();
|
|
120
|
+
let duration = event.duration.getValue();
|
|
121
|
+
if (isDefined(positionQuantisation)) {
|
|
122
|
+
position = quantizeRound(position, positionQuantisation);
|
|
123
|
+
}
|
|
124
|
+
if (isDefined(durationQuantisation)) {
|
|
125
|
+
duration = Math.max(quantizeRound(duration, durationQuantisation), durationQuantisation);
|
|
126
|
+
}
|
|
127
|
+
event.position.setValue(Math.max(position, 0));
|
|
128
|
+
event.duration.setValue(duration);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
112
131
|
createValueClip(trackBox, clipIndex, { name, hue } = {}) {
|
|
113
132
|
const { boxGraph } = this.#project;
|
|
114
133
|
const type = trackBox.type.getValue();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendaw/studio-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.74",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@opendaw/lib-fusion": "^0.0.57",
|
|
39
39
|
"@opendaw/lib-runtime": "^0.0.55",
|
|
40
40
|
"@opendaw/lib-std": "^0.0.55",
|
|
41
|
-
"@opendaw/studio-adapters": "^0.0.
|
|
41
|
+
"@opendaw/studio-adapters": "^0.0.62",
|
|
42
42
|
"@opendaw/studio-boxes": "^0.0.57",
|
|
43
43
|
"@opendaw/studio-enums": "^0.0.47",
|
|
44
44
|
"dropbox": "^10.34.0",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"@ffmpeg/ffmpeg": "^0.12.15",
|
|
55
55
|
"@ffmpeg/util": "^0.12.2",
|
|
56
56
|
"@opendaw/eslint-config": "^0.0.22",
|
|
57
|
-
"@opendaw/studio-core-processors": "^0.0.
|
|
58
|
-
"@opendaw/studio-core-workers": "^0.0.
|
|
57
|
+
"@opendaw/studio-core-processors": "^0.0.64",
|
|
58
|
+
"@opendaw/studio-core-workers": "^0.0.57",
|
|
59
59
|
"@opendaw/studio-forge-boxes": "^0.0.57",
|
|
60
60
|
"@opendaw/typescript-config": "^0.0.22"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "6b4c77bff99703f59b320a846b5336369a3e6604"
|
|
63
63
|
}
|