@dawcore/transport 0.0.16-next.8 → 0.0.16-next.9
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/README.md +13 -5
- package/dist/index.d.mts +16 -7
- package/dist/index.d.ts +16 -7
- package/dist/index.js +28 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1291,12 +1291,12 @@ var MasterNode = class {
|
|
|
1291
1291
|
import { createPanStage } from "@waveform-playlist/core";
|
|
1292
1292
|
var PREFIX = "[waveform-playlist] ";
|
|
1293
1293
|
var TrackNode = class {
|
|
1294
|
-
constructor(id, audioContext,
|
|
1294
|
+
constructor(id, audioContext, panLaw = "mono") {
|
|
1295
1295
|
this._effects = null;
|
|
1296
1296
|
this.id = id;
|
|
1297
1297
|
this._inputNode = audioContext.createGain();
|
|
1298
1298
|
this._volumeNode = audioContext.createGain();
|
|
1299
|
-
this._panStage = createPanStage(audioContext, 0,
|
|
1299
|
+
this._panStage = createPanStage(audioContext, 0, panLaw);
|
|
1300
1300
|
this._muteNode = audioContext.createGain();
|
|
1301
1301
|
this._inputNode.connect(this._volumeNode);
|
|
1302
1302
|
this._volumeNode.connect(this._panStage.input);
|
|
@@ -1316,10 +1316,10 @@ var TrackNode = class {
|
|
|
1316
1316
|
setPan(value) {
|
|
1317
1317
|
this._panStage.setPan(value);
|
|
1318
1318
|
}
|
|
1319
|
-
/**
|
|
1320
|
-
* (
|
|
1321
|
-
|
|
1322
|
-
this._panStage.
|
|
1319
|
+
/** Switch the pan law: 'mono' (−3 dB per side at centre) or 'stereo'
|
|
1320
|
+
* (unity at centre). The gains ramp; the law it already has does nothing. */
|
|
1321
|
+
setPanLaw(panLaw) {
|
|
1322
|
+
this._panStage.setPanLaw(panLaw);
|
|
1323
1323
|
}
|
|
1324
1324
|
setMute(muted) {
|
|
1325
1325
|
this._muteNode.gain.value = muted ? 0 : 1;
|
|
@@ -1693,7 +1693,7 @@ var MetronomePlayer = class {
|
|
|
1693
1693
|
};
|
|
1694
1694
|
|
|
1695
1695
|
// src/transport.ts
|
|
1696
|
-
import {
|
|
1696
|
+
import { trackPanLaw } from "@waveform-playlist/core";
|
|
1697
1697
|
|
|
1698
1698
|
// src/audio/count-in-player.ts
|
|
1699
1699
|
var CountInPlayer = class {
|
|
@@ -2135,7 +2135,7 @@ var _Transport = class _Transport {
|
|
|
2135
2135
|
this._mutedTrackIds.clear();
|
|
2136
2136
|
this._tracks = tracks;
|
|
2137
2137
|
for (const track of tracks) {
|
|
2138
|
-
const trackNode = new TrackNode(track.id, this._audioContext,
|
|
2138
|
+
const trackNode = new TrackNode(track.id, this._audioContext, trackPanLaw(track));
|
|
2139
2139
|
trackNode.setVolume(track.volume);
|
|
2140
2140
|
trackNode.setPan(track.pan);
|
|
2141
2141
|
trackNode.connectOutput(this._masterNode.input);
|
|
@@ -2151,7 +2151,7 @@ var _Transport = class _Transport {
|
|
|
2151
2151
|
this._clipPlayer.setTracks(tracks, this._trackNodes);
|
|
2152
2152
|
}
|
|
2153
2153
|
addTrack(track) {
|
|
2154
|
-
const trackNode = new TrackNode(track.id, this._audioContext,
|
|
2154
|
+
const trackNode = new TrackNode(track.id, this._audioContext, trackPanLaw(track));
|
|
2155
2155
|
trackNode.setVolume(track.volume);
|
|
2156
2156
|
trackNode.setPan(track.pan);
|
|
2157
2157
|
trackNode.connectOutput(this._masterNode.input);
|
|
@@ -2184,7 +2184,7 @@ var _Transport = class _Transport {
|
|
|
2184
2184
|
if (node) {
|
|
2185
2185
|
node.setVolume(track.volume);
|
|
2186
2186
|
node.setPan(track.pan);
|
|
2187
|
-
node.
|
|
2187
|
+
node.setPanLaw(trackPanLaw(track));
|
|
2188
2188
|
}
|
|
2189
2189
|
if (track.muted) {
|
|
2190
2190
|
this._mutedTrackIds.add(trackId);
|
|
@@ -2216,6 +2216,22 @@ var _Transport = class _Transport {
|
|
|
2216
2216
|
}
|
|
2217
2217
|
node.setPan(pan);
|
|
2218
2218
|
}
|
|
2219
|
+
/**
|
|
2220
|
+
* Set a track's pan law (#684): `'mono'`, `'stereo'`, or `'auto'` for
|
|
2221
|
+
* "from the clips of the track the transport holds". The clips are not
|
|
2222
|
+
* touched: playing sources go on playing, and the pan stage ramps to the
|
|
2223
|
+
* new law. A later `updateTrack` or `setTracks` takes the law from the
|
|
2224
|
+
* track it is given (its `panLaw`, else its clips).
|
|
2225
|
+
*/
|
|
2226
|
+
setTrackPanLaw(trackId, panLaw) {
|
|
2227
|
+
const node = this._trackNodes.get(trackId);
|
|
2228
|
+
const track = this._tracks.find((t) => t.id === trackId);
|
|
2229
|
+
if (!node || !track) {
|
|
2230
|
+
console.warn('[waveform-playlist] setTrackPanLaw: unknown trackId "' + trackId + '"');
|
|
2231
|
+
return;
|
|
2232
|
+
}
|
|
2233
|
+
node.setPanLaw(trackPanLaw({ ...track, panLaw }));
|
|
2234
|
+
}
|
|
2219
2235
|
setTrackMute(trackId, muted) {
|
|
2220
2236
|
if (muted) {
|
|
2221
2237
|
this._mutedTrackIds.add(trackId);
|
|
@@ -2817,6 +2833,9 @@ var NativePlayoutAdapter = class {
|
|
|
2817
2833
|
setTrackPan(trackId, pan) {
|
|
2818
2834
|
this._transport.setTrackPan(trackId, pan);
|
|
2819
2835
|
}
|
|
2836
|
+
setTrackPanLaw(trackId, panLaw) {
|
|
2837
|
+
this._transport.setTrackPanLaw(trackId, panLaw);
|
|
2838
|
+
}
|
|
2820
2839
|
setLoop(enabled, start, end) {
|
|
2821
2840
|
const finite = Number.isFinite(start) && Number.isFinite(end);
|
|
2822
2841
|
const degenerate = enabled && finite && this._transport.timeToTick(start) >= this._transport.timeToTick(end);
|