public void asyncResampler() { int rp; while (true) { Monitor.Enter(this); for (rp = 0; rp < this.threadParseList.Length && !this.isStop; rp++) { if (this.threadParseList[rp] == 0) { //标记为正在合成 this.threadParseList[rp] = 1; break; } } Monitor.Exit(this); if (rp == threadParseList.Length) { returnedThreads++; if (returnedThreads == this.mainForm.config.threadNum) { //表示合成已经完成 this.synthetiseIsFinished = true; } if (this.wavtoolIsWaitting) { this._wavtoolWaitHandle.Set(); } break; } resamParam param = this.bat.resamParams[rp]; if (!File.Exists(param.temp)) { string[] args = getResamplerParam(param); this.ResamplerEvent(args); } //标记为已完成 this.threadParseList[rp] = 2; if (this.wavtoolIsWaitting == true) { this._wavtoolWaitHandle.Set(); } Monitor.Enter(this); this.synthedGens++; this.mainForm.SetProgress1NowNum(this.synthedGens); Monitor.Exit(this); //合成部分 } }
public string[] getResamplerParam(resamParam param) { string[] args = new string[16]; args[0] = "resampler"; args[1] = param.genfile; args[2] = param.temp; args[3] = param.pitchPercent; args[4] = param.velocity.ToString(); args[5] = param.flags; args[6] = param.offset.ToString(); args[7] = param.lengthReq.ToString(); args[8] = param.fix.ToString(); args[9] = param.blank.ToString(); args[10] = param.volume.ToString(); args[11] = param.modulation.ToString(); args[12] = param.tempo; args[13] = param.pit; args[14] = param.vend.ToString(); args[15] = param.pre.ToString(); return(args); }