Skip to content

Commit

Permalink
TAG729 2024/03/06 2nd
Browse files Browse the repository at this point in the history
  Core:XGM2:効果音モードが上手く動作していなかったので調整。SGDKのほうは今のところ未対応。
  • Loading branch information
kumatan committed Mar 6, 2024
1 parent cfef1de commit 0deaccc
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 23 deletions.
3 changes: 3 additions & 0 deletions mml2vgm/CHANGE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
�X�V����
TAG729 2024/03/06 2nd
Core:XGM2:���ʉ����[�h����肭���삵�Ă��Ȃ������̂Œ����BSGDK�̂ق��͍��̂Ƃ��떢�Ή��B

TAG728 2024/03/06
Core:XGM2:J�R�}���h�����C���B����(?)�̓����ɂȂ�܂����BTAG727�̓���̓G�N�X�|�[�g������MDPlayer�ɂ�鉉�t���w�肵���Ƃ��ɔ������܂��B

Expand Down
56 changes: 40 additions & 16 deletions mml2vgm/Core/chips/YM2612X2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -749,43 +749,67 @@ public override void OutFmSetFnum(partPage page, MML mml, int octave, int num)
if (pw.slotFixedFnum[3] == -1) f = freq + page.slotDetune[3];
else f = pw.slotFixedFnum[3] + page.slotDetune[3];

SOutData(page, mml, page.port[2]
, (byte)(0x30 + 0 + 3 + 8)//0:port 3:slot4 8:ch3specialMode
, (byte)((f & 0xff00) >> 8)
, (byte)(f & 0xff));
//SOutData(page, mml, page.port[2]
// , (byte)(0x30 + 0 + 3 + 8)//0:port 3:slot4 8:ch3specialMode
// , (byte)((f & 0xff00) >> 8)
// , (byte)(f & 0xff));
SOutData(page, mml, page.port[0]
, (byte)0xa6 //slot4
, (byte)((f & 0xff00) >> 8));
SOutData(page, mml, page.port[0]
, (byte)0xa2
, (byte)f);
}
if ((page.slots & 4) != 0)
{
int f;
if (pw.slotFixedFnum[2] == -1) f = freq + page.slotDetune[2];
else f = pw.slotFixedFnum[2] + page.slotDetune[2];

SOutData(page, mml, page.port[2]
, (byte)(0x30 + 0 + 2 + 8)//0:port 2:slot3 8:ch3specialMode
, (byte)((f & 0xff00) >> 8)
, (byte)(f & 0xff));
//SOutData(page, mml, page.port[2]
// , (byte)(0x30 + 0 + 2 + 8)//0:port 2:slot3 8:ch3specialMode
// , (byte)((f & 0xff00) >> 8)
// , (byte)(f & 0xff));
SOutData(page, mml, page.port[0]
, (byte)0xac //slot3
, (byte)((f & 0xff00) >> 8));
SOutData(page, mml, page.port[0]
, (byte)0xa8
, (byte)f);
}
if ((page.slots & 1) != 0)
{
int f;
if (pw.slotFixedFnum[0] == -1) f = freq + page.slotDetune[0];
else f = pw.slotFixedFnum[0] + page.slotDetune[0];

SOutData(page, mml, page.port[2]
, (byte)(0x30 + 0 + 1 + 8)//0:port 1:slot2 8:ch3specialMode
, (byte)((f & 0xff00) >> 8)
, (byte)(f & 0xff));
//SOutData(page, mml, page.port[2]
// , (byte)(0x30 + 0 + 1 + 8)//0:port 1:slot2 8:ch3specialMode
// , (byte)((f & 0xff00) >> 8)
// , (byte)(f & 0xff));
SOutData(page, mml, page.port[0]
, (byte)0xad //slot1
, (byte)((f & 0xff00) >> 8));
SOutData(page, mml, page.port[0]
, (byte)0xa9
, (byte)f);
}
if ((page.slots & 2) != 0)
{
int f;
if (pw.slotFixedFnum[1] == -1) f = freq + page.slotDetune[1];
else f = pw.slotFixedFnum[1] + page.slotDetune[1];

SOutData(page, mml, page.port[2]
, (byte)(0x30 + 0 + 0 + 8)//0:port 0:slot1 8:ch3specialMode
, (byte)((f & 0xff00) >> 8)
, (byte)(f & 0xff));
//SOutData(page, mml, page.port[2]
// , (byte)(0x30 + 0 + 0 + 8)//0:port 0:slot1 8:ch3specialMode
// , (byte)((f & 0xff00) >> 8)
// , (byte)(f & 0xff));
SOutData(page, mml, page.port[0]
, (byte)0xae //slot2
, (byte)((f & 0xff00) >> 8));
SOutData(page, mml, page.port[0]
, (byte)0xaa
, (byte)f);
}
}
else
Expand Down
14 changes: 7 additions & 7 deletions mml2vgm/mml2vgmIDEx64/Driver/xgm2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class xgm2 : baseDriver
private uint[] psgVol = new uint[4];

private int pendingFrame;
private static byte[] ch3FnumAdr = [0xa6, 0xac, 0xad, 0xae];
private static byte[] ch3FnumAdr = [0xad, 0xae, 0xac, 0xa6];//op1:0xad op2:0xae op3:0xac op4:0xa6
private byte ch3KeyOn = 0;
private bool vi = true;

Expand Down Expand Up @@ -517,9 +517,9 @@ private void fmFreqDeltaSet(outDatum val)
return;
}

fmFreq[port][2][cs + 1] = (uint)(fmFreq[port][2][cs + 1] + (addOrsub == 0 ? 1 : -1) * freq);
WriteYM2612(true, new outDatum(ch3FnumAdr[cs + 1]), new outDatum((byte)(fmFreq[port][2][cs + 1] >> 8)));
WriteYM2612(true, new outDatum((byte)(ch3FnumAdr[cs + 1] - 4)), new outDatum((byte)fmFreq[port][2][cs + 1]));
fmFreq[port][2][cs] = (uint)(fmFreq[port][2][cs] + (addOrsub == 0 ? 1 : -1) * freq);
WriteYM2612(true, new outDatum(ch3FnumAdr[cs]), new outDatum((byte)(fmFreq[port][2][cs] >> 8)));
WriteYM2612(true, new outDatum((byte)(ch3FnumAdr[cs] - 4)), new outDatum((byte)fmFreq[port][2][cs]));
}

private void fmFreqSetAndKeyOffOn(outDatum val)
Expand Down Expand Up @@ -556,16 +556,16 @@ private void fmFreqSetAndKeyOffOn(outDatum val)
}


fmFreq[port][2][cs + 1] = freq;
fmFreq[port][2][cs] = freq;

//byte m = (byte)(0x20 << cs);
//if (keyOff != 0)
//{
// ch3KeyOn = (byte)(ch3KeyOn & (~m));
// WriteYM2612P0(0x28, (byte)(ch3KeyOn | 2));
//}
WriteYM2612(true, new outDatum(ch3FnumAdr[cs + 1]),new outDatum( (byte)(fmFreq[port][2][cs + 1] >> 8)));
WriteYM2612(true, new outDatum((byte)(ch3FnumAdr[cs + 1] - 4)), new outDatum((byte)fmFreq[port][2][cs + 1]));
WriteYM2612(true, new outDatum(ch3FnumAdr[cs]),new outDatum( (byte)(fmFreq[port][2][cs] >> 8)));
WriteYM2612(true, new outDatum((byte)(ch3FnumAdr[cs] - 4)), new outDatum((byte)fmFreq[port][2][cs]));
//if (keyOn != 0)
//{
// ch3KeyOn = (byte)(ch3KeyOn | m);
Expand Down

0 comments on commit 0deaccc

Please sign in to comment.