Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thisNames committed May 22, 2024
1 parent 366027c commit 774413d
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 127 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
SoundMod
**/soundAssetsPath
**/*.ogg
**/*.ogg
**/dist
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ logPath = log
wemCMax = 20

```
##### 一些配置说明:
##### 一些配置说明:详细教程 look wiki
1. `soundAssetsPath` wem bnk 资源文件目录(游戏音效资源目录)

2. `buildPath` 保存的路径
Expand Down
File renamed without changes.
9 changes: 5 additions & 4 deletions src/class/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Ww2ogg = require("./class/Ww2ogg");
const Revorb = require("./class/Revorb");
const ReferencedStreamedFile = require("./class/ReferencedStreamedFile");
const IncludedMemoryFile = require("./class/IncludedMemoryFile");
const ProcessPools = require("./class/ProcessPools");
const ProcessSet = require("./class/ProcessSet");

// tools
const MessageCollect = require("./tools/MessageCollect");
Expand All @@ -31,10 +31,11 @@ const ww2ogg = new Ww2ogg(config.ww2ogg, config.www2ogg_packed_codebooks_aoTuV_6
const revorb = new Revorb(config.revorb);
const bnk2wm = new Bnkextr(config.bnk2wem);

// json 文件

// 公共资源
const pt = require("node:path");

// 注意:require 函数走的是相对路径
// json 文件
const SoundbanksInfoJson = require(pt.resolve(config.soundAssetsPath, "SoundbanksInfo.json"));

// 暴露数据
Expand All @@ -51,7 +52,7 @@ module.exports = {
Revorb,
ReferencedStreamedFile,
IncludedMemoryFile,
ProcessPools,
ProcessSet,
MessageCollect,
RunningLog,
config,
Expand Down
10 changes: 5 additions & 5 deletions test/src/ProcessSetTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const psList = [];
* 每次并发完成时调用
* 参数:完成的结果集
*
* nextBefore: Function
* next: Function
* 下一次任务开启之前调用。
* 也就是说在上一个任务开启后,是否继续开启下一个任务
* 参数:当前已经执行的任务数量(索引)
Expand Down Expand Up @@ -71,7 +71,7 @@ async function runSync(options)
* 每次并发完成时调用
* 参数:完成的结果集
*
* nextBefore: Function
* next: Function
* 下一次任务开启之前调用。
* 也就是说在上一个任务开启后,是否继续开启下一个任务
* 参数:当前已经执行的任务数量(索引)
Expand Down Expand Up @@ -131,12 +131,12 @@ async function run(options)
// 子进程的数量,也是最大并发的数量
const cMax = 5;
// 模拟任务的数量
const taskLength = 7;
const taskLength = 100;

// 先启动所有的子进程
function initProcess()
{
for (let i = 0; i < cMax; i++) { psList.push(fork("./1.js")) }
for (let i = 0; i < cMax; i++) { psList.push(fork("src/TaskTest.js")) }
}
initProcess();

Expand All @@ -161,7 +161,7 @@ runSync(options).then(v =>
console.log("sync count:", v);
});

// 100 task 5 process time is 20365ms ms
// 100 task(1000ms) 5 process time is 20365ms ms
// 100 task(1500ms ~ 500ms) 5 process time is(测试次数3:20403、20154、20328)ms
run(options).then(v =>
{
Expand Down
116 changes: 0 additions & 116 deletions test/src/Task.js

This file was deleted.

19 changes: 19 additions & 0 deletions test/src/TaskTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const rTime = (max, min) => Math.ceil(Math.random() * (max - min) + min + 1);
const fs = require("node:fs");
function task(data)
{
const t = rTime(1500, 500);
const startLine = `${process.pid} start task: ${data} in time ${t} ms`;
console.log(startLine);
const line = `${process.pid} run task: ${data}, out time ${t}ms`

fs.writeFileSync("hello.txt", t.toFixed(), { encoding: "utf-8", flag: "a" });

setTimeout(() =>
{
console.log(line);
console.log("-----------");
process.send("OK " + process.pid);
}, t);
}
process.on("message", task);

0 comments on commit 774413d

Please sign in to comment.