@onjmin/dtm 0.1.79 → 0.1.80
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 +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +8 -2
- package/dist/index.mjs +8 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1862,6 +1862,10 @@ type DtmStudio = {
|
|
|
1862
1862
|
* getDaw() で現在の DawInstance を取得できる(mountPresetSelect の getDaw に渡せる)。
|
|
1863
1863
|
*/
|
|
1864
1864
|
mountModeSwitch: (target: HTMLElement, options: ModeSwitchOptions) => ModeSwitchInstance;
|
|
1865
|
+
/** マスタ音量を 0-100 で変更する。 */
|
|
1866
|
+
setMasterVolume: (volume: number) => void;
|
|
1867
|
+
/** マスタ音量を 0-100 で変更する(`setMasterVolume` のエイリアス)。 */
|
|
1868
|
+
setVolume: (volume: number) => void;
|
|
1865
1869
|
/** AudioContext を閉じ、生成物を破棄する。 */
|
|
1866
1870
|
dispose: () => void;
|
|
1867
1871
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1862,6 +1862,10 @@ type DtmStudio = {
|
|
|
1862
1862
|
* getDaw() で現在の DawInstance を取得できる(mountPresetSelect の getDaw に渡せる)。
|
|
1863
1863
|
*/
|
|
1864
1864
|
mountModeSwitch: (target: HTMLElement, options: ModeSwitchOptions) => ModeSwitchInstance;
|
|
1865
|
+
/** マスタ音量を 0-100 で変更する。 */
|
|
1866
|
+
setMasterVolume: (volume: number) => void;
|
|
1867
|
+
/** マスタ音量を 0-100 で変更する(`setMasterVolume` のエイリアス)。 */
|
|
1868
|
+
setVolume: (volume: number) => void;
|
|
1865
1869
|
/** AudioContext を閉じ、生成物を破棄する。 */
|
|
1866
1870
|
dispose: () => void;
|
|
1867
1871
|
};
|
package/dist/index.js
CHANGED
|
@@ -7798,7 +7798,7 @@ var mountChordPlayer = (target, chords, options = {}) => {
|
|
|
7798
7798
|
if (beatAbsSec >= now - 0.01) {
|
|
7799
7799
|
const isDownbeat = beat % 4 === 0;
|
|
7800
7800
|
const pitch = isDownbeat ? DRUM_KEYS.kick : DRUM_KEYS.hihatClosed;
|
|
7801
|
-
const velocity = isDownbeat ? 0.7 : 0.45;
|
|
7801
|
+
const velocity = (isDownbeat ? 0.7 : 0.45) * (masterVolume / 100);
|
|
7802
7802
|
const wafDrum = _drumCache.get(pitch);
|
|
7803
7803
|
if (wafDrum) {
|
|
7804
7804
|
wafDrum.play({
|
|
@@ -14027,7 +14027,7 @@ var createDtmStudio = async (options = {}) => {
|
|
|
14027
14027
|
masterGain.connect(audioCtx.destination);
|
|
14028
14028
|
const drumGain = audioCtx.createGain();
|
|
14029
14029
|
drumGain.gain.value = options.drumVolume ?? 1;
|
|
14030
|
-
drumGain.connect(
|
|
14030
|
+
drumGain.connect(masterGain);
|
|
14031
14031
|
const resumeAudio = () => {
|
|
14032
14032
|
if (audioCtx.state === "closed") return Promise.resolve();
|
|
14033
14033
|
return audioCtx.resume();
|
|
@@ -14793,6 +14793,10 @@ var createDtmStudio = async (options = {}) => {
|
|
|
14793
14793
|
mountedEditors.length = 0;
|
|
14794
14794
|
void audioCtx.close();
|
|
14795
14795
|
};
|
|
14796
|
+
const setMasterVolume = (volume) => {
|
|
14797
|
+
const g = Math.max(0, Math.min(100, volume)) / 100;
|
|
14798
|
+
masterGain.gain.setValueAtTime(g, audioCtx.currentTime);
|
|
14799
|
+
};
|
|
14796
14800
|
return {
|
|
14797
14801
|
audioContext: audioCtx,
|
|
14798
14802
|
singingVoices,
|
|
@@ -14809,6 +14813,8 @@ var createDtmStudio = async (options = {}) => {
|
|
|
14809
14813
|
defaultPreset,
|
|
14810
14814
|
mountPresetSelect,
|
|
14811
14815
|
mountModeSwitch,
|
|
14816
|
+
setMasterVolume,
|
|
14817
|
+
setVolume: setMasterVolume,
|
|
14812
14818
|
dispose
|
|
14813
14819
|
};
|
|
14814
14820
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -7675,7 +7675,7 @@ var mountChordPlayer = (target, chords, options = {}) => {
|
|
|
7675
7675
|
if (beatAbsSec >= now - 0.01) {
|
|
7676
7676
|
const isDownbeat = beat % 4 === 0;
|
|
7677
7677
|
const pitch = isDownbeat ? DRUM_KEYS.kick : DRUM_KEYS.hihatClosed;
|
|
7678
|
-
const velocity = isDownbeat ? 0.7 : 0.45;
|
|
7678
|
+
const velocity = (isDownbeat ? 0.7 : 0.45) * (masterVolume / 100);
|
|
7679
7679
|
const wafDrum = _drumCache.get(pitch);
|
|
7680
7680
|
if (wafDrum) {
|
|
7681
7681
|
wafDrum.play({
|
|
@@ -13903,7 +13903,7 @@ var createDtmStudio = async (options = {}) => {
|
|
|
13903
13903
|
masterGain.connect(audioCtx.destination);
|
|
13904
13904
|
const drumGain = audioCtx.createGain();
|
|
13905
13905
|
drumGain.gain.value = options.drumVolume ?? 1;
|
|
13906
|
-
drumGain.connect(
|
|
13906
|
+
drumGain.connect(masterGain);
|
|
13907
13907
|
const resumeAudio = () => {
|
|
13908
13908
|
if (audioCtx.state === "closed") return Promise.resolve();
|
|
13909
13909
|
return audioCtx.resume();
|
|
@@ -14669,6 +14669,10 @@ var createDtmStudio = async (options = {}) => {
|
|
|
14669
14669
|
mountedEditors.length = 0;
|
|
14670
14670
|
void audioCtx.close();
|
|
14671
14671
|
};
|
|
14672
|
+
const setMasterVolume = (volume) => {
|
|
14673
|
+
const g = Math.max(0, Math.min(100, volume)) / 100;
|
|
14674
|
+
masterGain.gain.setValueAtTime(g, audioCtx.currentTime);
|
|
14675
|
+
};
|
|
14672
14676
|
return {
|
|
14673
14677
|
audioContext: audioCtx,
|
|
14674
14678
|
singingVoices,
|
|
@@ -14685,6 +14689,8 @@ var createDtmStudio = async (options = {}) => {
|
|
|
14685
14689
|
defaultPreset,
|
|
14686
14690
|
mountPresetSelect,
|
|
14687
14691
|
mountModeSwitch,
|
|
14692
|
+
setMasterVolume,
|
|
14693
|
+
setVolume: setMasterVolume,
|
|
14688
14694
|
dispose
|
|
14689
14695
|
};
|
|
14690
14696
|
};
|
package/package.json
CHANGED