mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2024-12-25 11:18:30 +00:00
[adapters] 修复宏的一些问题,并增加 CC_WORKER_AUDIO_SYSTEM_SYNC_INTERVAL 宏
This commit is contained in:
parent
d28997bcbb
commit
3ffea9ae23
@ -145,6 +145,7 @@ function _initFromWorker(id, meta) {
|
||||
CC_WORKER_FS_SYNC,
|
||||
CC_WORKER_ASSET_PIPELINE,
|
||||
CC_WORKER_AUDIO_SYSTEM,
|
||||
CC_WORKER_AUDIO_SYSTEM_SYNC_INTERVAL,
|
||||
] = meta;
|
||||
|
||||
for (const wrapper of wrappers) {
|
||||
@ -160,6 +161,7 @@ function _initFromWorker(id, meta) {
|
||||
globalThis.CC_WORKER_FS_SYNC = CC_WORKER_FS_SYNC;
|
||||
globalThis.CC_WORKER_ASSET_PIPELINE = CC_WORKER_ASSET_PIPELINE;
|
||||
globalThis.CC_WORKER_AUDIO_SYSTEM = CC_WORKER_AUDIO_SYSTEM;
|
||||
globalThis.CC_WORKER_AUDIO_SYSTEM_SYNC_INTERVAL = CC_WORKER_AUDIO_SYSTEM_SYNC_INTERVAL;
|
||||
|
||||
_inited = true;
|
||||
if (_initCallback) _initCallback();
|
||||
|
@ -14,3 +14,6 @@ globalThis.CC_WORKER_ASSET_PIPELINE = null;
|
||||
|
||||
// 是否启用 Worker 驱动音频系统
|
||||
globalThis.CC_WORKER_AUDIO_SYSTEM = null;
|
||||
|
||||
// Worker 音频系统同步音频属性的间隔时间(单位:毫秒)
|
||||
globalThis.CC_WORKER_AUDIO_SYSTEM_SYNC_INTERVAL = null;
|
||||
|
@ -13,6 +13,7 @@ module.exports = {
|
||||
CC_WORKER_DEBUG,
|
||||
CC_WORKER_ASSET_PIPELINE,
|
||||
CC_WORKER_AUDIO_SYSTEM,
|
||||
CC_WORKER_AUDIO_SYSTEM_SYNC_INTERVAL,
|
||||
CC_WORKER_SCHEDULER,
|
||||
CC_WORKER_FS_SYNC,
|
||||
CC_WORKER_SUB_PACKAGE,
|
||||
|
@ -110,6 +110,7 @@ const ipcMain = {
|
||||
CC_WORKER_FS_SYNC,
|
||||
CC_WORKER_ASSET_PIPELINE,
|
||||
CC_WORKER_AUDIO_SYSTEM,
|
||||
CC_WORKER_AUDIO_SYSTEM_SYNC_INTERVAL,
|
||||
]);
|
||||
},
|
||||
|
||||
|
@ -19,11 +19,18 @@ if (!("CC_WORKER_ASSET_PIPELINE" in globalThis)) {
|
||||
// 是否启用 Worker 驱动音频系统
|
||||
if (!("CC_WORKER_AUDIO_SYSTEM" in globalThis)) {
|
||||
globalThis.CC_WORKER_AUDIO_SYSTEM = false;
|
||||
// NOTE 截止 2024.10.22,微信未修复 iOS、Windows、Mac 上仅文件系统 API 可以正常使用的问题
|
||||
globalThis.CC_WORKER_AUDIO_SYSTEM = (isAndroid || isDevtools) && globalThis.CC_WORKER_AUDIO_SYSTEM;
|
||||
}
|
||||
|
||||
// Worker 音频系统同步音频属性的间隔时间(单位:毫秒)
|
||||
if (!("CC_WORKER_AUDIO_SYSTEM_SYNC_INTERVAL" in globalThis)) {
|
||||
globalThis.CC_WORKER_AUDIO_SYSTEM_SYNC_INTERVAL = 500;
|
||||
}
|
||||
|
||||
// 是否启用 Worker
|
||||
if (!("CC_USE_WORKER" in globalThis)) {
|
||||
globalThis.CC_USE_WORKER = (CC_WORKER_ASSET_PIPELINE) && hasWorker && !isSubContext;
|
||||
globalThis.CC_USE_WORKER = (CC_WORKER_ASSET_PIPELINE || CC_WORKER_AUDIO_SYSTEM) && hasWorker && !isSubContext;
|
||||
}
|
||||
|
||||
// 是否启用 Worker 调试模式
|
||||
|
Loading…
Reference in New Issue
Block a user