mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2025-10-09 20:45:23 +00:00
[adapters] 优化多线程特性文件结构,增加部分多线程音频系统代码,支持 Worker 子包特性(默认不开启),修复 Devtools 下强制不启用 Worker 问题
This commit is contained in:
9
adapters/platforms/wechat/res/workers/audio-worker.js
Normal file
9
adapters/platforms/wechat/res/workers/audio-worker.js
Normal file
@@ -0,0 +1,9 @@
|
||||
var audio_worker = {
|
||||
map: {},
|
||||
create(callback, sn) {
|
||||
this.map[sn] = worker.createInnerAudioContext();
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
module.exports = audio_worker;
|
@@ -4,3 +4,8 @@ if (globalThis.CC_WORKER_ASSET_PIPELINE) {
|
||||
const cacheManager = require("./cache-manager-worker.js");
|
||||
registerHandler("cacheManager", cacheManager);
|
||||
}
|
||||
|
||||
if (globalThis.CC_WORKER_AUDIO_SYSTEM) {
|
||||
const audio = require("./audio-worker.js");
|
||||
registerHandler("audio", audio);
|
||||
}
|
||||
|
@@ -144,7 +144,7 @@ function _initFromWorker(id, meta) {
|
||||
wrappers,
|
||||
CC_WORKER_FS_SYNC,
|
||||
CC_WORKER_ASSET_PIPELINE,
|
||||
CC_WORKER_ASSET_PIPELINE_INCLUDE_LOAD,
|
||||
CC_WORKER_AUDIO_SYSTEM,
|
||||
] = meta;
|
||||
|
||||
for (const wrapper of wrappers) {
|
||||
@@ -159,7 +159,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_ASSET_PIPELINE_INCLUDE_LOAD = CC_WORKER_ASSET_PIPELINE_INCLUDE_LOAD;
|
||||
globalThis.CC_WORKER_AUDIO_SYSTEM = CC_WORKER_AUDIO_SYSTEM;
|
||||
|
||||
_inited = true;
|
||||
if (_initCallback) _initCallback();
|
||||
|
@@ -9,8 +9,8 @@ globalThis.CC_WORKER_DEBUG = false;
|
||||
// 是否启用 Worker 使用同步版本的文件系统 API
|
||||
globalThis.CC_WORKER_FS_SYNC = null;
|
||||
|
||||
// 是否启用 Worker 驱动资源管线(下载、缓存)
|
||||
// 是否启用 Worker 驱动资源管线
|
||||
globalThis.CC_WORKER_ASSET_PIPELINE = null;
|
||||
|
||||
// 是否启用 Worker 驱动资源管线(加载)
|
||||
globalThis.CC_WORKER_ASSET_PIPELINE_INCLUDE_LOAD = null;
|
||||
// 是否启用 Worker 驱动音频系统
|
||||
globalThis.CC_WORKER_AUDIO_SYSTEM = null;
|
||||
|
Reference in New Issue
Block a user