public void screenChangeParams() { byte[] vrc7Register = Audio.GetVRC7Register(chipID); if (vrc7Register == null) { return; } //キーオン(ワンショット)があったかを取得する ChipKeyInfo ki = Audio.getVRC7KeyInfo(chipID); for (int ch = 0; ch < 6; ch++) { MDChipParams.Channel nyc = newParam.channels[ch]; //音色番号 nyc.inst[0] = (vrc7Register[0x30 + ch] & 0xf0) >> 4; //サスティンの取得 nyc.inst[1] = (vrc7Register[0x20 + ch] & 0x20) >> 5; //現在のキーオン状態 nyc.inst[2] = (vrc7Register[0x20 + ch] & 0x10) >> 4; //ボリューム nyc.inst[3] = (vrc7Register[0x30 + ch] & 0x0f); //再生周波数 int freq = vrc7Register[0x10 + ch] + ((vrc7Register[0x20 + ch] & 0x1) << 8); //オクターブ int oct = ((vrc7Register[0x20 + ch] & 0xe) >> 1); //周波数とオクターブ情報から近似する音程を取得する nyc.note = common.searchSegaPCMNote(freq / 172.0) + (oct - 4) * 12; //ワンショット(前回の処理から比較してキーオンが1度以上発生している状態)の場合 if (ki.On[ch]) { //ボリュームメーターを振る nyc.volumeL = (19 - nyc.inst[3]); } else { //ワンショットが無く、現在もキーオンしていない場合は音程を無しにする。 //ワンショットが無くても、キーオン状態ならば音程をリセットしない。 //(持続している場合やベンドやスラーをしていることが考えられる為。) //また、この処理はワンショットが発生しているときは実施しない。 //ワンショットが有り、現在はキーオンしていない場合に対応するため。 //上記ケースは、ボリュームメータを振り、音程表示は一瞬だけ表示する動きになる if (nyc.inst[2] == 0) { nyc.note = -1; } //ボリュームメータの減衰処理(音色設定を無視し常に一定) nyc.volumeL--; if (nyc.volumeL < 0) { nyc.volumeL = 0; } } } newParam.channels[0].inst[4] = (vrc7Register[0x02] & 0x3f); //TL newParam.channels[0].inst[5] = (vrc7Register[0x03] & 0x07); //FB newParam.channels[0].inst[6] = (vrc7Register[0x04] & 0xf0) >> 4; //AR newParam.channels[0].inst[7] = (vrc7Register[0x04] & 0x0f); //DR newParam.channels[0].inst[8] = (vrc7Register[0x06] & 0xf0) >> 4; //SL newParam.channels[0].inst[9] = (vrc7Register[0x06] & 0x0f); //RR newParam.channels[0].inst[10] = (vrc7Register[0x02] & 0x80) >> 7; //KL newParam.channels[0].inst[11] = (vrc7Register[0x00] & 0x0f); //MT newParam.channels[0].inst[12] = (vrc7Register[0x00] & 0x80) >> 7; //AM newParam.channels[0].inst[13] = (vrc7Register[0x00] & 0x40) >> 6; //VB newParam.channels[0].inst[14] = (vrc7Register[0x00] & 0x20) >> 5; //EG newParam.channels[0].inst[15] = (vrc7Register[0x00] & 0x10) >> 4; //KR newParam.channels[0].inst[16] = (vrc7Register[0x03] & 0x08) >> 3; //DM newParam.channels[0].inst[17] = (vrc7Register[0x05] & 0xf0) >> 4; //AR newParam.channels[0].inst[18] = (vrc7Register[0x05] & 0x0f); //DR newParam.channels[0].inst[19] = (vrc7Register[0x07] & 0xf0) >> 4; //SL newParam.channels[0].inst[20] = (vrc7Register[0x07] & 0x0f); //RR newParam.channels[0].inst[21] = (vrc7Register[0x03] & 0x80) >> 7; //KL newParam.channels[0].inst[22] = (vrc7Register[0x01] & 0x0f); //MT newParam.channels[0].inst[23] = (vrc7Register[0x01] & 0x80) >> 7; //AM newParam.channels[0].inst[24] = (vrc7Register[0x01] & 0x40) >> 6; //VB newParam.channels[0].inst[25] = (vrc7Register[0x01] & 0x20) >> 5; //EG newParam.channels[0].inst[26] = (vrc7Register[0x01] & 0x10) >> 4; //KR newParam.channels[0].inst[27] = (vrc7Register[0x03] & 0x10) >> 4; //DC }
public void screenChangeParams() { int[] ym3812Register = Audio.GetYM3812Register(chipID); MDChipParams.Channel nyc; int slot = 0; ChipKeyInfo ki = Audio.getYM3812KeyInfo(chipID); //FM for (int c = 0; c < 9; c++) { nyc = newParam.channels[c]; for (int i = 0; i < 2; i++) { if (i == 0) { slot = slot1Tbl[c]; } else { slot = slot2Tbl[c]; } slot = (slot % 6) + 8 * (slot / 6); //AR nyc.inst[0 + i * 17] = ym3812Register[0x60 + slot] >> 4; //DR nyc.inst[1 + i * 17] = ym3812Register[0x60 + slot] & 0xf; //SL nyc.inst[2 + i * 17] = ym3812Register[0x80 + slot] >> 4; //RR nyc.inst[3 + i * 17] = ym3812Register[0x80 + slot] & 0xf; //KL nyc.inst[4 + i * 17] = ym3812Register[0x40 + slot] >> 6; //TL nyc.inst[5 + i * 17] = ym3812Register[0x40 + slot] & 0x3f; //MT nyc.inst[6 + i * 17] = ym3812Register[0x20 + slot] & 0xf; //AM nyc.inst[7 + i * 17] = ym3812Register[0x20 + slot] >> 7; //VB nyc.inst[8 + i * 17] = (ym3812Register[0x20 + slot] >> 6) & 1; //EG nyc.inst[9 + i * 17] = (ym3812Register[0x20 + slot] >> 5) & 1; //KR nyc.inst[10 + i * 17] = (ym3812Register[0x20 + slot] >> 4) & 1; //WS nyc.inst[13 + i * 17] = (ym3812Register[0xe0 + slot] & 3); } //BL nyc.inst[11] = (ym3812Register[0xb0 + c] >> 2) & 7; //FNUM nyc.inst[12] = ym3812Register[0xa0 + c] + ((ym3812Register[0xb0 + c] & 3) << 8); //FB nyc.inst[15] = (ym3812Register[0xc0 + c] >> 1) & 7; //CN nyc.inst[14] = (ym3812Register[0xc0 + c] & 1); nyc.note = Common.searchSegaPCMNote(nyc.inst[12] / 344.0) + (nyc.inst[11] - 4) * 12; //詳細はfrmVRC7の該当箇所を参照 if (ki.On[c]) { int tl1 = nyc.inst[5 + 0 * 17]; int tl2 = nyc.inst[5 + 1 * 17]; int tl = tl2; if (nyc.inst[14] != 0) { tl = Math.Min(tl1, tl2); } nyc.volume = (19 * (64 - tl) / 64); } else { if ((ym3812Register[0xb0 + c] & 0x20) == 0) { nyc.note = -1; } nyc.volume--; if (nyc.volume < 0) { nyc.volume = 0; } } } newParam.channels[9].dda = ((ym3812Register[0xbd] >> 7) & 0x01) != 0; //DA newParam.channels[10].dda = ((ym3812Register[0xbd] >> 6) & 0x01) != 0; //DV #region リズム情報の取得 //slot14 TL 0x51 HH //slot15 TL 0x52 TOM //slot16 TL 0x53 BD //slot17 TL 0x54 SD //slot18 TL 0x55 CYM for (int i = 0; i < 5; i++) { if (ki.On[i + 9]) { newParam.channels[i + 9].volume = 19 - ((ym3812Register[rhythmAdr[i]] & 0x3f) >> 2); } else { newParam.channels[i + 9].volume--; if (newParam.channels[i + 9].volume < 0) { newParam.channels[i + 9].volume = 0; } } } #endregion }
public void screenChangeParams() { int[] Y8950Register = Audio.GetY8950Register(chipID); MDChipParams.Channel nyc; int slot = 0; ChipKeyInfo ki = Audio.getY8950KeyInfo(chipID); MDSound.MDSound.Chip chipInfo = Audio.GetMDSChipInfo(MDSound.MDSound.enmInstrumentType.Y8950); uint masterClock = chipInfo == null ? 3579545 : chipInfo.Clock; //3579545 -> Default master clock //FM for (int c = 0; c < 9; c++) { nyc = newParam.channels[c]; for (int i = 0; i < 2; i++) { if (i == 0) { slot = slot1Tbl[c]; } else { slot = slot2Tbl[c]; } slot = (slot % 6) + 8 * (slot / 6); //AR nyc.inst[0 + i * 17] = Y8950Register[0x60 + slot] >> 4; //DR nyc.inst[1 + i * 17] = Y8950Register[0x60 + slot] & 0xf; //SL nyc.inst[2 + i * 17] = Y8950Register[0x80 + slot] >> 4; //RR nyc.inst[3 + i * 17] = Y8950Register[0x80 + slot] & 0xf; //KL nyc.inst[4 + i * 17] = Y8950Register[0x40 + slot] >> 6; //TL nyc.inst[5 + i * 17] = Y8950Register[0x40 + slot] & 0x3f; //MT nyc.inst[6 + i * 17] = Y8950Register[0x20 + slot] & 0xf; //AM nyc.inst[7 + i * 17] = Y8950Register[0x20 + slot] >> 7; //VB nyc.inst[8 + i * 17] = (Y8950Register[0x20 + slot] >> 6) & 1; //EG nyc.inst[9 + i * 17] = (Y8950Register[0x20 + slot] >> 5) & 1; //KR nyc.inst[10 + i * 17] = (Y8950Register[0x20 + slot] >> 4) & 1; } //BL nyc.inst[11] = (Y8950Register[0xb0 + c] >> 2) & 7; //FNUM nyc.inst[12] = Y8950Register[0xa0 + c] + ((Y8950Register[0xb0 + c] & 3) << 8); //FB nyc.inst[15] = (Y8950Register[0xc0 + c] >> 1) & 7; //CN nyc.inst[14] = (Y8950Register[0xc0 + c] & 1); // FNUM / (2^19) * (mClock/72) * (2 ^ (block - 1)) double fmus = (double)nyc.inst[12] / (1 << 19) * (masterClock / 72.0) * (1 << nyc.inst[11]); nyc.note = Common.searchSegaPCMNote(fmus / 523.3);//523.3 -> c4 if (ki.On[c]) { int tl1 = nyc.inst[5 + 0 * 17]; int tl2 = nyc.inst[5 + 1 * 17]; int tl = tl2; if (nyc.inst[14] != 0) { tl = Math.Min(tl1, tl2); } nyc.volume = (19 * (64 - tl) / 64); } else { if ((Y8950Register[0xb0 + c] & 0x20) == 0) { nyc.note = -1; } nyc.volume--; if (nyc.volume < 0) { nyc.volume = 0; } } } newParam.channels[9].dda = ((Y8950Register[0xbd] >> 7) & 0x01) != 0; //DA newParam.channels[10].dda = ((Y8950Register[0xbd] >> 6) & 0x01) != 0; //DV #region リズム情報の取得 //slot14 TL 0x51 HH //slot15 TL 0x52 TOM //slot16 TL 0x53 BD //slot17 TL 0x54 SD //slot18 TL 0x55 CYM for (int i = 0; i < 5; i++) { if (ki.On[i + 9]) { newParam.channels[i + 9].volume = 19 - ((Y8950Register[rhythmAdr[i]] & 0x3f) >> 2); } else { newParam.channels[i + 9].volume--; if (newParam.channels[i + 9].volume < 0) { newParam.channels[i + 9].volume = 0; } } } #endregion #region ADPCM //Delta newParam.channels[14].inst[12] = Y8950Register[0x10] + (Y8950Register[0x11] << 8); if (ki.On[14] || ki.Off[14]) { //fSample = deltaN * 50KHz / (2^16) double fSample = newParam.channels[14].inst[12] * 50000.0 / (double)(1 << 16); int pnt = ki.Off[14] ? -1 : Common.searchSegaPCMNote(fSample / 8000.0); if (newParam.channels[14].note != pnt || ki.Off[14]) { newParam.channels[14].note = pnt; int tl = Y8950Register[0x12]; newParam.channels[14].volume = pnt == -1 ? 0 : Common.Range(tl >> 3, 0, 19); } else { newParam.channels[14].volume--; if (newParam.channels[14].volume < 0) { newParam.channels[14].volume = 0; } } } else { newParam.channels[14].note = -1; newParam.channels[14].volume--; if (newParam.channels[14].volume < 0) { newParam.channels[14].volume = 0; } } #endregion }
public void screenChangeParams() { int[] ym2413Register = Audio.GetYM2413Register(chipID); MDChipParams.Channel nyc; ChipKeyInfo ki = Audio.getYM2413KeyInfo(chipID); for (int ch = 0; ch < 9; ch++) { nyc = newParam.channels[ch]; nyc.inst[0] = (ym2413Register[0x30 + ch] & 0xf0) >> 4; nyc.inst[1] = (ym2413Register[0x20 + ch] & 0x20) >> 5; nyc.inst[2] = (ym2413Register[0x20 + ch] & 0x10) >> 4; nyc.inst[3] = (ym2413Register[0x30 + ch] & 0x0f); int freq = ym2413Register[0x10 + ch] + ((ym2413Register[0x20 + ch] & 0x1) << 8); int oct = ((ym2413Register[0x20 + ch] & 0xe) >> 1); nyc.note = common.searchSegaPCMNote(freq / 172.0) + (oct - 4) * 12; if (ki.On[ch]) { nyc.volumeL = (19 - nyc.inst[3]); } else { if (nyc.inst[2] == 0) { nyc.note = -1; } nyc.volumeL--; if (nyc.volumeL < 0) { nyc.volumeL = 0; } } } //int r = Audio.getYM2413RyhthmKeyON(chipID); //BD if (ki.On[9]) { newParam.channels[9].volume = (19 - (ym2413Register[0x36] & 0x0f)); } else { newParam.channels[9].volume--; if (newParam.channels[9].volume < 0) { newParam.channels[9].volume = 0; } } //SD if (ki.On[10]) { newParam.channels[10].volume = (19 - (ym2413Register[0x37] & 0x0f)); } else { newParam.channels[10].volume--; if (newParam.channels[10].volume < 0) { newParam.channels[10].volume = 0; } } //TOM if (ki.On[11]) { newParam.channels[11].volume = 19 - ((ym2413Register[0x38] & 0xf0) >> 4); } else { newParam.channels[11].volume--; if (newParam.channels[11].volume < 0) { newParam.channels[11].volume = 0; } } //CYM if (ki.On[12]) { newParam.channels[12].volume = 19 - (ym2413Register[0x38] & 0x0f); } else { newParam.channels[12].volume--; if (newParam.channels[12].volume < 0) { newParam.channels[12].volume = 0; } } //HH if (ki.On[13]) { newParam.channels[13].volume = 19 - ((ym2413Register[0x37] & 0xf0) >> 4); } else { newParam.channels[13].volume--; if (newParam.channels[13].volume < 0) { newParam.channels[13].volume = 0; } } newParam.channels[0].inst[4] = (ym2413Register[0x02] & 0x3f); //TL newParam.channels[0].inst[5] = (ym2413Register[0x03] & 0x07); //FB newParam.channels[0].inst[6] = (ym2413Register[0x04] & 0xf0) >> 4; //AR newParam.channels[0].inst[7] = (ym2413Register[0x04] & 0x0f); //DR newParam.channels[0].inst[8] = (ym2413Register[0x06] & 0xf0) >> 4; //SL newParam.channels[0].inst[9] = (ym2413Register[0x06] & 0x0f); //RR newParam.channels[0].inst[10] = (ym2413Register[0x02] & 0x80) >> 7; //KL newParam.channels[0].inst[11] = (ym2413Register[0x00] & 0x0f); //MT newParam.channels[0].inst[12] = (ym2413Register[0x00] & 0x80) >> 7; //AM newParam.channels[0].inst[13] = (ym2413Register[0x00] & 0x40) >> 6; //VB newParam.channels[0].inst[14] = (ym2413Register[0x00] & 0x20) >> 5; //EG newParam.channels[0].inst[15] = (ym2413Register[0x00] & 0x10) >> 4; //KR newParam.channels[0].inst[16] = (ym2413Register[0x03] & 0x08) >> 3; //DM newParam.channels[0].inst[17] = (ym2413Register[0x05] & 0xf0) >> 4; //AR newParam.channels[0].inst[18] = (ym2413Register[0x05] & 0x0f); //DR newParam.channels[0].inst[19] = (ym2413Register[0x07] & 0xf0) >> 4; //SL newParam.channels[0].inst[20] = (ym2413Register[0x07] & 0x0f); //RR newParam.channels[0].inst[21] = (ym2413Register[0x03] & 0x80) >> 7; //KL newParam.channels[0].inst[22] = (ym2413Register[0x01] & 0x0f); //MT newParam.channels[0].inst[23] = (ym2413Register[0x01] & 0x80) >> 7; //AM newParam.channels[0].inst[24] = (ym2413Register[0x01] & 0x40) >> 6; //VB newParam.channels[0].inst[25] = (ym2413Register[0x01] & 0x20) >> 5; //EG newParam.channels[0].inst[26] = (ym2413Register[0x01] & 0x10) >> 4; //KR newParam.channels[0].inst[27] = (ym2413Register[0x03] & 0x10) >> 4; //DC }