FIX: sửa MASTERING PANEL có tác dụng với mainout
This commit is contained in:
+556
-275
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -25,6 +25,14 @@
|
|||||||
let _scheduledNotes = [];
|
let _scheduledNotes = [];
|
||||||
|
|
||||||
const getCtx = function () {
|
const getCtx = function () {
|
||||||
|
if (_audioCtx) {
|
||||||
|
if (!_gainNode) {
|
||||||
|
_gainNode = _audioCtx.createGain();
|
||||||
|
_gainNode.gain.value = 0.3;
|
||||||
|
_gainNode.connect(window.masterBus ? window.masterBus.input : _audioCtx.destination);
|
||||||
|
}
|
||||||
|
return _audioCtx;
|
||||||
|
}
|
||||||
if (typeof getAudioContext === 'function') {
|
if (typeof getAudioContext === 'function') {
|
||||||
var ctx = getAudioContext();
|
var ctx = getAudioContext();
|
||||||
if (!_gainNode) {
|
if (!_gainNode) {
|
||||||
@@ -67,6 +75,12 @@
|
|||||||
try {
|
try {
|
||||||
_audioCtx = audioContext;
|
_audioCtx = audioContext;
|
||||||
if (_audioCtx.state === 'suspended') await _audioCtx.resume();
|
if (_audioCtx.state === 'suspended') await _audioCtx.resume();
|
||||||
|
// Create gain node for master bus routing before any node connections
|
||||||
|
if (!_gainNode) {
|
||||||
|
_gainNode = _audioCtx.createGain();
|
||||||
|
_gainNode.gain.value = 0.3;
|
||||||
|
_gainNode.connect(window.masterBus ? window.masterBus.input : _audioCtx.destination);
|
||||||
|
}
|
||||||
|
|
||||||
console.log("[SonicSF] AudioCtx state:", _audioCtx.state, "sampleRate:", _audioCtx.sampleRate);
|
console.log("[SonicSF] AudioCtx state:", _audioCtx.state, "sampleRate:", _audioCtx.sampleRate);
|
||||||
|
|
||||||
@@ -224,7 +238,7 @@
|
|||||||
|
|
||||||
selectInstrument: async function (channel, bank, program, sfId) {
|
selectInstrument: async function (channel, bank, program, sfId) {
|
||||||
if (!_initialized || !_fluidModule) {
|
if (!_initialized || !_fluidModule) {
|
||||||
var ctx = new (window.AudioContext || window.webkitAudioContext)();
|
var ctx = (typeof getAudioContext === 'function') ? getAudioContext() : new (window.AudioContext || window.webkitAudioContext)();
|
||||||
await this.init(ctx);
|
await this.init(ctx);
|
||||||
}
|
}
|
||||||
if (sfId) {
|
if (sfId) {
|
||||||
@@ -350,7 +364,7 @@
|
|||||||
if (_initialized && _fluidModule) return;
|
if (_initialized && _fluidModule) return;
|
||||||
if (_initPromise) return;
|
if (_initPromise) return;
|
||||||
try {
|
try {
|
||||||
var ctx = new (window.AudioContext || window.webkitAudioContext)();
|
var ctx = (typeof getAudioContext === 'function') ? getAudioContext() : new (window.AudioContext || window.webkitAudioContext)();
|
||||||
if (ctx.state === 'suspended') await ctx.resume();
|
if (ctx.state === 'suspended') await ctx.resume();
|
||||||
await this.init(ctx);
|
await this.init(ctx);
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|||||||
Reference in New Issue
Block a user