@waveform-playlist/playout 11.3.0 → 12.0.0
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/index.d.mts +2 -5
- package/dist/index.d.ts +2 -5
- package/dist/index.js +33 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
getTransport as getTransport2,
|
|
8
8
|
getContext as getContext4
|
|
9
9
|
} from "tone";
|
|
10
|
+
import { gainToDb as gainToDb4 } from "@waveform-playlist/core";
|
|
10
11
|
|
|
11
12
|
// src/ToneTrack.ts
|
|
12
13
|
import {
|
|
@@ -17,6 +18,7 @@ import {
|
|
|
17
18
|
getTransport,
|
|
18
19
|
getContext
|
|
19
20
|
} from "tone";
|
|
21
|
+
import { gainToDb } from "@waveform-playlist/core";
|
|
20
22
|
|
|
21
23
|
// src/fades.ts
|
|
22
24
|
import {
|
|
@@ -52,8 +54,11 @@ var ToneTrack = class {
|
|
|
52
54
|
// clips at/after this offset.
|
|
53
55
|
this._scheduleGuardOffset = 0;
|
|
54
56
|
this.track = options.track;
|
|
55
|
-
this.volumeNode = new Volume(
|
|
56
|
-
this.panNode = new Panner({
|
|
57
|
+
this.volumeNode = new Volume(gainToDb(options.track.gain));
|
|
58
|
+
this.panNode = new Panner({
|
|
59
|
+
pan: options.track.stereoPan,
|
|
60
|
+
channelCount: options.channelCount ?? 1
|
|
61
|
+
});
|
|
57
62
|
this.muteGain = new Gain(options.track.muted ? 0 : 1);
|
|
58
63
|
this.volumeNode.chain(this.panNode, this.muteGain);
|
|
59
64
|
const destination = options.destination || getDestination();
|
|
@@ -385,12 +390,9 @@ var ToneTrack = class {
|
|
|
385
390
|
audioParam.setValueAtTime(clipInfo.gain, 0);
|
|
386
391
|
});
|
|
387
392
|
}
|
|
388
|
-
gainToDb(gain) {
|
|
389
|
-
return 20 * Math.log10(gain);
|
|
390
|
-
}
|
|
391
393
|
setVolume(gain) {
|
|
392
394
|
this.track.gain = gain;
|
|
393
|
-
this.volumeNode.volume.value =
|
|
395
|
+
this.volumeNode.volume.value = gainToDb(gain);
|
|
394
396
|
}
|
|
395
397
|
setPan(pan) {
|
|
396
398
|
this.track.stereoPan = pan;
|
|
@@ -483,6 +485,7 @@ import {
|
|
|
483
485
|
getDestination as getDestination2,
|
|
484
486
|
getContext as getContext2
|
|
485
487
|
} from "tone";
|
|
488
|
+
import { gainToDb as gainToDb2 } from "@waveform-playlist/core";
|
|
486
489
|
function getDrumCategory(midiNote) {
|
|
487
490
|
if (midiNote === 35 || midiNote === 36) return "kick";
|
|
488
491
|
if (midiNote >= 37 && midiNote <= 40) return "snare";
|
|
@@ -493,7 +496,7 @@ function getDrumCategory(midiNote) {
|
|
|
493
496
|
var MidiToneTrack = class {
|
|
494
497
|
constructor(options) {
|
|
495
498
|
this.track = options.track;
|
|
496
|
-
this.volumeNode = new Volume2(
|
|
499
|
+
this.volumeNode = new Volume2(gainToDb2(options.track.gain));
|
|
497
500
|
this.panNode = new Panner2(options.track.stereoPan);
|
|
498
501
|
this.muteGain = new Gain2(options.track.muted ? 0 : 1);
|
|
499
502
|
this.volumeNode.chain(this.panNode, this.muteGain);
|
|
@@ -626,9 +629,6 @@ var MidiToneTrack = class {
|
|
|
626
629
|
this.synth.triggerAttackRelease(noteName, duration, time, velocity);
|
|
627
630
|
}
|
|
628
631
|
}
|
|
629
|
-
gainToDb(gain) {
|
|
630
|
-
return 20 * Math.log10(gain);
|
|
631
|
-
}
|
|
632
632
|
/**
|
|
633
633
|
* No-op for MIDI — schedule guard is for AudioBufferSourceNode ghost tick prevention.
|
|
634
634
|
* Tone.Part handles its own scheduling relative to Transport.
|
|
@@ -696,7 +696,7 @@ var MidiToneTrack = class {
|
|
|
696
696
|
}
|
|
697
697
|
setVolume(gain) {
|
|
698
698
|
this.track.gain = gain;
|
|
699
|
-
this.volumeNode.volume.value =
|
|
699
|
+
this.volumeNode.volume.value = gainToDb2(gain);
|
|
700
700
|
}
|
|
701
701
|
setPan(pan) {
|
|
702
702
|
this.track.stereoPan = pan;
|
|
@@ -785,6 +785,7 @@ var MidiToneTrack = class {
|
|
|
785
785
|
|
|
786
786
|
// src/SoundFontToneTrack.ts
|
|
787
787
|
import { Volume as Volume3, Gain as Gain3, Panner as Panner3, Part as Part2, getDestination as getDestination3, getContext as getContext3 } from "tone";
|
|
788
|
+
import { gainToDb as gainToDb3 } from "@waveform-playlist/core";
|
|
788
789
|
var _SoundFontToneTrack = class _SoundFontToneTrack {
|
|
789
790
|
constructor(options) {
|
|
790
791
|
this.activeSources = /* @__PURE__ */ new Set();
|
|
@@ -792,7 +793,7 @@ var _SoundFontToneTrack = class _SoundFontToneTrack {
|
|
|
792
793
|
this.soundFontCache = options.soundFontCache;
|
|
793
794
|
this.programNumber = options.programNumber ?? 0;
|
|
794
795
|
this.bankNumber = options.isPercussion ? 128 : 0;
|
|
795
|
-
this.volumeNode = new Volume3(
|
|
796
|
+
this.volumeNode = new Volume3(gainToDb3(options.track.gain));
|
|
796
797
|
this.panNode = new Panner3(options.track.stereoPan);
|
|
797
798
|
this.muteGain = new Gain3(options.track.muted ? 0 : 1);
|
|
798
799
|
this.volumeNode.chain(this.panNode, this.muteGain);
|
|
@@ -892,9 +893,6 @@ var _SoundFontToneTrack = class _SoundFontToneTrack {
|
|
|
892
893
|
source.start(time);
|
|
893
894
|
source.stop(time + effectiveDuration + releaseVolEnv);
|
|
894
895
|
}
|
|
895
|
-
gainToDb(gain) {
|
|
896
|
-
return 20 * Math.log10(gain);
|
|
897
|
-
}
|
|
898
896
|
/**
|
|
899
897
|
* No-op — Tone.Part handles scheduling internally, no ghost tick guard needed.
|
|
900
898
|
*/
|
|
@@ -954,7 +952,7 @@ var _SoundFontToneTrack = class _SoundFontToneTrack {
|
|
|
954
952
|
}
|
|
955
953
|
setVolume(gain) {
|
|
956
954
|
this.track.gain = gain;
|
|
957
|
-
this.volumeNode.volume.value =
|
|
955
|
+
this.volumeNode.volume.value = gainToDb3(gain);
|
|
958
956
|
}
|
|
959
957
|
setPan(pan) {
|
|
960
958
|
this.track.stereoPan = pan;
|
|
@@ -1048,7 +1046,7 @@ var TonePlayout = class {
|
|
|
1048
1046
|
this._loopEnabled = false;
|
|
1049
1047
|
this._loopStart = 0;
|
|
1050
1048
|
this._loopEnd = 0;
|
|
1051
|
-
this.masterVolume = new Volume4(
|
|
1049
|
+
this.masterVolume = new Volume4(gainToDb4(options.masterGain ?? 1));
|
|
1052
1050
|
if (options.effects) {
|
|
1053
1051
|
const cleanup = options.effects(this.masterVolume, getDestination4(), false);
|
|
1054
1052
|
if (cleanup) {
|
|
@@ -1064,9 +1062,6 @@ var TonePlayout = class {
|
|
|
1064
1062
|
});
|
|
1065
1063
|
}
|
|
1066
1064
|
}
|
|
1067
|
-
gainToDb(gain) {
|
|
1068
|
-
return 20 * Math.log10(gain);
|
|
1069
|
-
}
|
|
1070
1065
|
clearCompletionEvent() {
|
|
1071
1066
|
if (this._completionEventId !== null) {
|
|
1072
1067
|
try {
|
|
@@ -1261,7 +1256,7 @@ var TonePlayout = class {
|
|
|
1261
1256
|
this.clearCompletionEvent();
|
|
1262
1257
|
}
|
|
1263
1258
|
setMasterGain(gain) {
|
|
1264
|
-
this.masterVolume.volume.value =
|
|
1259
|
+
this.masterVolume.volume.value = gainToDb4(gain);
|
|
1265
1260
|
}
|
|
1266
1261
|
setSolo(trackId, soloed) {
|
|
1267
1262
|
const track = this.tracks.get(trackId);
|
|
@@ -1619,7 +1614,8 @@ import {
|
|
|
1619
1614
|
clipStartTime,
|
|
1620
1615
|
clipEndTime,
|
|
1621
1616
|
clipOffsetTime,
|
|
1622
|
-
clipDurationTime
|
|
1617
|
+
clipDurationTime,
|
|
1618
|
+
trackChannelCount
|
|
1623
1619
|
} from "@waveform-playlist/core";
|
|
1624
1620
|
import { now as now2 } from "tone";
|
|
1625
1621
|
function createToneAdapter(options) {
|
|
@@ -1659,7 +1655,8 @@ function createToneAdapter(options) {
|
|
|
1659
1655
|
p.addTrack({
|
|
1660
1656
|
clips: clipInfos,
|
|
1661
1657
|
track: trackObj,
|
|
1662
|
-
effects: track.effects
|
|
1658
|
+
effects: track.effects,
|
|
1659
|
+
channelCount: trackChannelCount(track)
|
|
1663
1660
|
});
|
|
1664
1661
|
}
|
|
1665
1662
|
if (midiClips.length > 0) {
|
|
@@ -1900,8 +1897,6 @@ export {
|
|
|
1900
1897
|
SoundFontToneTrack,
|
|
1901
1898
|
TonePlayout,
|
|
1902
1899
|
ToneTrack,
|
|
1903
|
-
applyFadeIn,
|
|
1904
|
-
applyFadeOut,
|
|
1905
1900
|
calculatePlaybackRate,
|
|
1906
1901
|
closeGlobalAudioContext,
|
|
1907
1902
|
configureGlobalContext,
|