Skip to content

Commit

Permalink
TAG187 2022/07/31
Browse files Browse the repository at this point in the history
  Driver
    MTコマンドのバグ修正。
  • Loading branch information
kumatan committed Jul 30, 2022
1 parent 7883c62 commit 4287e22
Show file tree
Hide file tree
Showing 3 changed files with 167 additions and 79 deletions.
4 changes: 4 additions & 0 deletions CHANGE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
�X�V����
TAG187 2022/07/31
Driver
MT�R�}���h�̃o�O�C���B

TAG186 2022/07/27 2nd
Compiler
�x���̌����ɖ߂������A1�x�̂ݏo�͂����悤�ɏC���B
Expand Down
240 changes: 162 additions & 78 deletions mucomDotNETDriver/music2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1207,81 +1207,65 @@ public void STV2(byte c)

c = work.soundWork.CRYDAT[work.pg.algo];

STV3(c, d, e);

//パラメータ表示向け
List<object> args = new List<object>();
if (work.isDotNET && (work.cd.FMVolMode == 2 || work.cd.FMVolMode == 3))
args.Add(work.pg.volume);
else
args.Add(work.pg.volume - 4);
args.Add(work.cd.FMVolMode);

DummyOUT(enmMMLType.Volume, args);
}

public void STV3(byte c,byte d,byte e)
{
if (CheckCh3SpecialMode())
{
if ((work.pg.useSlot & 1) != 0)
{
if ((c & (1 << 0)) != 0)//slot1
{
byte v = e;
if (work.isDotNET) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[0], 0), 127);
if (work.header.CarrierCorrection) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[0], 0), 127);
PSGOUT((byte)(d + 0 * 4), v);// キャリア ナラ PSGOUT ヘ
}
}

if ((work.pg.useSlot & 4) != 0)
{
if ((c & (1 << 1)) != 0)//slot3
{
byte v = e;
if (work.isDotNET) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[1], 0), 127);
if (work.header.CarrierCorrection) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[1], 0), 127);
PSGOUT((byte)(d + 1 * 4), v);// キャリア ナラ PSGOUT ヘ
}
}

if ((work.pg.useSlot & 2) != 0)
{
if ((c & (1 << 2)) != 0)//slot2
{
byte v = e;
if (work.isDotNET) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[2], 0), 127);
if (work.header.CarrierCorrection) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[2], 0), 127);
PSGOUT((byte)(d + 2 * 4), v);// キャリア ナラ PSGOUT ヘ
}
}

if ((work.pg.useSlot & 8) != 0)
{
if ((c & (1 << 3)) != 0)//slot4
{
byte v = e;
if (work.isDotNET) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[3], 0), 127);
if (work.header.CarrierCorrection) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[3], 0), 127);
PSGOUT((byte)(d + 3 * 4), v);// キャリア ナラ PSGOUT ヘ
}
}

}
else
{
for (int b = 0; b < 4; b++)
{
if ((c & (1 << b)) != 0)
{
byte v = e;
if (work.isDotNET)
{
if (e == 255)
{
v = (byte)Math.Min(Math.Max(work.pg.TLDirectTable[b] + work.pg.v_tl[b], 0), 127);
}
else
{
v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[b], 0), 127);
}
}
PSGOUT((byte)(d + b * 4), v);// キャリア ナラ PSGOUT ヘ
}
}
STV4(c, d, e, 4, work.header.CarrierCorrection);
}

//パラメータ表示向け
List<object> args = new List<object>();
if (work.isDotNET && (work.cd.FMVolMode == 2 || work.cd.FMVolMode == 3))
args.Add(work.pg.volume);
else
args.Add(work.pg.volume - 4);
args.Add(work.cd.FMVolMode);

DummyOUT(enmMMLType.Volume, args);
}

public void STV2opm(byte c)
Expand All @@ -1304,25 +1288,7 @@ public void STV2opm(byte c)

c = work.soundWork.CRYDAT[work.pg.algo];

for (int b = 0; b < 4; b++)
{
if ((c & (1 << b)) != 0)
{
byte v = e;
if (work.isDotNET)
{
if (e == 255)
{
v = (byte)Math.Min(Math.Max(work.pg.TLDirectTable[b] + work.pg.v_tl[b], 0), 127);
}
else
{
v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[b], 0), 127);
}
}
PSGOUT((byte)(d + b * 8), v);// キャリア ナラ PSGOUT ヘ
}
}
STV3opm(c, d, e);

//パラメータ表示向け
List<object> args = new List<object>();
Expand All @@ -1335,6 +1301,78 @@ public void STV2opm(byte c)
DummyOUT(enmMMLType.Volume, args);
}

public void STV3opm(byte c, byte d, byte e)
{
STV4(c, d, e, 8, work.header.CarrierCorrection);
}
public void STV4(byte c, byte d, byte e,byte m,bool caryCor)
{
if ((work.pg.useSlot & 1) != 0)
{
if ((c & (1 << 0)) != 0)
{
byte v = e;
if (e == 255)
{
v = (byte)Math.Min(Math.Max(work.pg.TLDirectTable[0] + work.pg.v_tl[0], 0), 127);
}
else
{
if (caryCor) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[0], 0), 127);
}
PSGOUT((byte)(d + 0 * m), v);// キャリア ナラ PSGOUT ヘ
}
}
if ((work.pg.useSlot & 4) != 0)
{
if ((c & (1 << 1)) != 0)
{
byte v = e;
if (e == 255)
{
v = (byte)Math.Min(Math.Max(work.pg.TLDirectTable[1] + work.pg.v_tl[1], 0), 127);
}
else
{
if (caryCor) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[1], 0), 127);
}
PSGOUT((byte)(d + 1 * m), v);// キャリア ナラ PSGOUT ヘ
}
}
if ((work.pg.useSlot & 2) != 0)
{
if ((c & (1 << 2)) != 0)
{
byte v = e;
if (e == 255)
{
v = (byte)Math.Min(Math.Max(work.pg.TLDirectTable[2] + work.pg.v_tl[2], 0), 127);
}
else
{
if (caryCor) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[2], 0), 127);
}
PSGOUT((byte)(d + 2 * m), v);// キャリア ナラ PSGOUT ヘ
}
}
if ((work.pg.useSlot & 8) != 0)
{
if ((c & (1 << 3)) != 0)
{
byte v = e;
if (e == 255)
{
v = (byte)Math.Min(Math.Max(work.pg.TLDirectTable[3] + work.pg.v_tl[3], 0), 127);
}
else
{
if (caryCor) v = (byte)Math.Min(Math.Max(e + work.pg.v_tl[3], 0), 127);
}
PSGOUT((byte)(d + 3 * m), v);// キャリア ナラ PSGOUT ヘ
}
}
}

public void PSGOUT(byte d, byte e)
{
byte port = 0;
Expand Down Expand Up @@ -2009,8 +2047,45 @@ public void LFORST2()
{
return;
}
work.pg.fnum = work.pg.TLlfo;

//volumeの再設定
byte c = (byte)(Math.Min(work.soundWork.TOTALV + work.pg.volume, 20));// INPUT VOLUME
byte e;
if (work.isDotNET)
{
if (work.cd.FMVolMode == 2)
e = (byte)(127 - Math.Min(Math.Max(work.pg.volume, 0), 127));
else if (work.cd.FMVolMode == 3)
e = 255;
else
{
//if (work.cd.currentFMVolTable == null)
// work.cd.currentFMVolTable = work.soundWork.FMVDAT;
e = work.cd.currentFMVolTable[c];// GET VOLUME DATA
}
}
else
e = work.soundWork.FMVDAT[c];// GET VOLUME DATA

work.pg.fnum = work.pg.TLlfo + e;
work.pg.bfnum2 = 0;
STVOL();

//volume以外のTL再設定
byte d;
byte m;
if (work.soundWork.currentChip != 4)
{
d = (byte)(0x40 + work.pg.channelNumber);// GET PORT No.
m = 4;
}
else {
d = (byte)(0x60 + work.pg.channelNumber);// GET PORT No.
m = 8;
}

STV4((byte)~work.soundWork.CRYDAT[work.pg.algo], d, 0, m, true);

}

// *** ADPCM PLAY ***
Expand Down Expand Up @@ -2474,7 +2549,7 @@ public void STENV()


//KUMA:tlの保存
if (work.isDotNET && work.header.CarrierCorrection)
//if (work.isDotNET && work.header.CarrierCorrection)
{
work.pg.v_tl[0] = work.fmVoiceAtMusData[hl + 4 + 0];
work.pg.v_tl[1] = work.fmVoiceAtMusData[hl + 4 + 1];
Expand Down Expand Up @@ -2562,7 +2637,7 @@ public void STENVopm()


//KUMA:tlの保存
if (work.header.CarrierCorrection)
//if (work.header.CarrierCorrection)
{
work.pg.v_tl[0] = work.fmVoiceAtMusData[hl + 4 + 0];
work.pg.v_tl[1] = work.fmVoiceAtMusData[hl + 4 + 1];
Expand Down Expand Up @@ -4174,6 +4249,11 @@ public void LFOP5(int hl)
{
if (work.pg.tlLfoflg)
{
if (work.soundWork.currentChip == 4)
{
LFOP6opm(hl);
return;
}
LFOP6(hl);
return;
}
Expand Down Expand Up @@ -4268,29 +4348,33 @@ public void LFOP6(int hl)
d += (byte)work.pg.channelNumber;
byte e = (byte)hl;

if ((c & 0x01) != 0)
{
PSGOUT(d, e);
d += 4;
}
if ((c & 0x04) != 0)
{
PSGOUT(d, e);
d += 4;
}
if ((c & 0x02) != 0)
{
PSGOUT(d, e);
d += 4;
}
if ((c & 0x08) == 0)
{
return;
}
PSGOUT(d, e);
if ((c & 0x01) != 0) PSGOUT(d, e);
d += 4;
if ((c & 0x04) != 0) PSGOUT(d, e);
d += 4;
if ((c & 0x02) != 0) PSGOUT(d, e);
d += 4;
if ((c & 0x08) == 0) return;
PSGOUT(d, e);
}

public void LFOP6opm(int hl)
{
byte c = work.pg.TLlfoSlot;//.soundWork.LFOP6_VAL;

byte d = 0x60;
d += (byte)work.pg.channelNumber;
byte e = (byte)hl;

if ((c & 0x01) != 0) PSGOUT(d, e);
d += 8;
if ((c & 0x04) != 0) PSGOUT(d, e);
d += 8;
if ((c & 0x02) != 0) PSGOUT(d, e);
d += 8;
if ((c & 0x08) == 0) return;
PSGOUT(d, e);
}


public void prcLFO()
Expand Down
2 changes: 1 addition & 1 deletion mucomDotNETPlayer/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"Player": {
"commandName": "Project",
"commandLineArgs": "\"D:\\bootcamp\\Source\\Repos\\mml2vgm\\mml2vgm\\mml2vgm\\sample\\mucomDotNET\\testSSGwave.mub\""
"commandLineArgs": "\"D:\\bootcamp\\FM音源\\data\\自作\\mamonoro\\LostWind\\testTemplate.mub\""
}
}
}

0 comments on commit 4287e22

Please sign in to comment.