Skip to content

Commit 51b2418

Browse files
author
kumatan
committed
TAG708 2023/11/08
Core:OPN系:OPM:TGON/TGOFコマンド追加
1 parent 5e60860 commit 51b2418

File tree

14 files changed

+134
-30
lines changed

14 files changed

+134
-30
lines changed

mml2vgm/CHANGE.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
�X�V����
2+
TAG708 2023/11/08
3+
Core:OPN�n:OPM:TGON/TGOF�R�}���h�lj�
4+
25
TAG707 2023/09/24
36
Core:OPNA2:ADPCM1/2/3�̉��ʏ����C��
47

mml2vgm/Core/MMLAnalyze.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,11 @@ private void CmdTotalVolumeOrArpeggioOrVoperator(partWork pw, partPage page, MML
878878
CmdVoperator(pw, page, mml);
879879
return;
880880
}
881+
else if (pw.getChar(page) == 'G') //vG
882+
{
883+
CmdVguard(pw, page, mml);
884+
return;
885+
}
881886

882887

883888
CmdTotalVolume(pw, page, mml);
@@ -1434,6 +1439,38 @@ private void CmdVoperator(partWork pw, partPage page, MML mml)
14341439

14351440
}
14361441

1442+
private void CmdVguard(partWork pw, partPage page, MML mml)
1443+
{
1444+
pw.incPos(page);
1445+
if (pw.getChar(page) != 'O')//vgO
1446+
{
1447+
msgBox.setErrMsg(msg.get("E05090"), mml.line.Lp);
1448+
return;
1449+
}
1450+
pw.incPos(page);
1451+
int n = 0;
1452+
if (pw.getChar(page) == 'N')//vgoN
1453+
{
1454+
n = 1;
1455+
pw.incPos(page);
1456+
}
1457+
else if (pw.getChar(page) == 'F')//vgoF
1458+
{
1459+
n = 0;
1460+
pw.incPos(page);
1461+
}
1462+
else
1463+
{
1464+
msgBox.setErrMsg(msg.get("E05090"), mml.line.Lp);
1465+
return;
1466+
}
1467+
1468+
mml.type = enmMMLType.VGuard;
1469+
mml.args = new List<object>();
1470+
mml.args.Add(n);
1471+
1472+
}
1473+
14371474
private void CmdLoop(partWork pw, partPage page, MML mml)
14381475
{
14391476
pw.incPos(page);

mml2vgm/Core/chips/YM2151.cs

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,16 @@ public void OutSetVolume(partPage page, MML mml, int vol, int n)
148148
}
149149
}
150150

151-
if ((page.slots & 1) != 0 && ope[0] != -1) OutSetTl(mml, page, 0, ope[0]);
152-
if ((page.slots & 2) != 0 && ope[1] != -1) OutSetTl(mml, page, 1, ope[1]);
153-
if ((page.slots & 4) != 0 && ope[2] != -1) OutSetTl(mml, page, 2, ope[2]);
154-
if ((page.slots & 8) != 0 && ope[3] != -1) OutSetTl(mml, page, 3, ope[3]);
151+
if (!page.vguard)
152+
{
153+
if ((page.slots & 1) != 0 && ope[0] != -1) OutSetTl(mml, page, 0, ope[0]);
154+
if ((page.slots & 2) != 0 && ope[1] != -1) OutSetTl(mml, page, 1, ope[1]);
155+
if ((page.slots & 4) != 0 && ope[2] != -1) OutSetTl(mml, page, 2, ope[2]);
156+
if ((page.slots & 8) != 0 && ope[3] != -1) OutSetTl(mml, page, 3, ope[3]);
157+
}
155158
}
156159

157-
public void OutFmSetTL(partPage page, MML mml, int tl1, int tl2, int tl3, int tl4,int slot, int n)
160+
public void OutFmSetTL(partPage page, MML mml, int tl1, int tl2, int tl3, int tl4, int slot, int n)
158161
{
159162
if (!parent.instOPM.ContainsKey(n))
160163
{
@@ -208,10 +211,13 @@ public void OutFmSetTL(partPage page, MML mml, int tl1, int tl2, int tl3, int tl
208211
vmml.type = enmMMLType.unknown;//.TotalLevel;
209212
if (mml != null)
210213
vmml.line = mml.line;
211-
if ((page.slots & 1) != 0 && ope[0] != -1) OutSetTl(vmml, vpg, 0, ope[0]);
212-
if ((page.slots & 2) != 0 && ope[1] != -1) OutSetTl(vmml, vpg, 1, ope[1]);
213-
if ((page.slots & 4) != 0 && ope[2] != -1) OutSetTl(vmml, vpg, 2, ope[2]);
214-
if ((page.slots & 8) != 0 && ope[3] != -1) OutSetTl(vmml, vpg, 3, ope[3]);
214+
if (!page.vguard)
215+
{
216+
if ((page.slots & 1) != 0 && ope[0] != -1) OutSetTl(vmml, vpg, 0, ope[0]);
217+
if ((page.slots & 2) != 0 && ope[1] != -1) OutSetTl(vmml, vpg, 1, ope[1]);
218+
if ((page.slots & 4) != 0 && ope[2] != -1) OutSetTl(vmml, vpg, 2, ope[2]);
219+
if ((page.slots & 8) != 0 && ope[3] != -1) OutSetTl(vmml, vpg, 3, ope[3]);
220+
}
215221
}
216222

217223
public void OutSetTl(MML mml, partPage page, int ope, int tl)
@@ -418,10 +424,13 @@ public void OutSetInstrument(partPage page, MML mml, int n, int vol, int modeBef
418424
}
419425
}
420426

421-
if ((page.slots & 1) != 0 && op[0] != -1) OutSetTl(mml, page, 0, op[0]);
422-
if ((page.slots & 2) != 0 && op[1] != -1) OutSetTl(mml, page, 1, op[1]);
423-
if ((page.slots & 4) != 0 && op[2] != -1) OutSetTl(mml, page, 2, op[2]);
424-
if ((page.slots & 8) != 0 && op[3] != -1) OutSetTl(mml, page, 3, op[3]);
427+
if (!page.vguard)
428+
{
429+
if ((page.slots & 1) != 0 && op[0] != -1) OutSetTl(mml, page, 0, op[0]);
430+
if ((page.slots & 2) != 0 && op[1] != -1) OutSetTl(mml, page, 1, op[1]);
431+
if ((page.slots & 4) != 0 && op[2] != -1) OutSetTl(mml, page, 2, op[2]);
432+
if ((page.slots & 8) != 0 && op[3] != -1) OutSetTl(mml, page, 3, op[3]);
433+
}
425434

426435
((YM2151)page.chip).OutSetVolume(page, mml, vol, n);
427436

@@ -844,6 +853,17 @@ public override void CmdNoise(partPage page, MML mml)
844853
}
845854
}
846855

856+
public override void CmdVGuard(partPage page, MML mml)
857+
{
858+
int val = (int)mml.args[0];
859+
page.vguard = val == 1;
860+
if (!page.vguard)
861+
{
862+
page.beforeVolume = -1;
863+
SetVolume(page, mml);
864+
}
865+
}
866+
847867
public override void CmdMPMS(partPage page, MML mml)
848868
{
849869
int n = (int)mml.args[1];

mml2vgm/Core/chips/clsChip.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,6 +1650,11 @@ public virtual void CmdVOperator(partPage page, MML mml)
16501650
, mml.line.Lp);
16511651
}
16521652

1653+
public virtual void CmdVGuard(partPage page, MML mml)
1654+
{
1655+
msgBox.setWrnMsg(msg.get("E10050")
1656+
, mml.line.Lp);
1657+
}
16531658

16541659
public virtual void CmdRenpuStart(partPage page, MML mml)
16551660
{

mml2vgm/Core/chips/clsOPN.cs

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -957,10 +957,13 @@ public void OutFmSetVolume(partPage page, MML mml, int vol)//, int n)
957957
vmml.type = enmMMLType.Volume;
958958
if (mml != null)
959959
vmml.line = mml.line;
960-
if ((page.slots & 1) != 0 && ope[0] != -1) ((ClsOPN)page.chip).OutFmSetTl(vmml, vpg, 0, ope[0]);
961-
if ((page.slots & 2) != 0 && ope[1] != -1) ((ClsOPN)page.chip).OutFmSetTl(vmml, vpg, 1, ope[1]);
962-
if ((page.slots & 4) != 0 && ope[2] != -1) ((ClsOPN)page.chip).OutFmSetTl(vmml, vpg, 2, ope[2]);
963-
if ((page.slots & 8) != 0 && ope[3] != -1) ((ClsOPN)page.chip).OutFmSetTl(vmml, vpg, 3, ope[3]);
960+
if (!page.vguard)
961+
{
962+
if ((page.slots & 1) != 0 && ope[0] != -1) ((ClsOPN)page.chip).OutFmSetTl(vmml, vpg, 0, ope[0]);
963+
if ((page.slots & 2) != 0 && ope[1] != -1) ((ClsOPN)page.chip).OutFmSetTl(vmml, vpg, 1, ope[1]);
964+
if ((page.slots & 4) != 0 && ope[2] != -1) ((ClsOPN)page.chip).OutFmSetTl(vmml, vpg, 2, ope[2]);
965+
if ((page.slots & 8) != 0 && ope[3] != -1) ((ClsOPN)page.chip).OutFmSetTl(vmml, vpg, 3, ope[3]);
966+
}
964967
}
965968

966969
public int GetTLOFS(partPage page,MML mml, int slot)
@@ -1002,15 +1005,15 @@ public int GetTLOFS(partPage page,MML mml, int slot)
10021005
return tlOfs;
10031006
}
10041007

1005-
public void OutFmSetTL(partPage page, MML mml, int tl1, int tl2, int tl3, int tl4,int slot)//, int n)
1008+
public void OutFmSetTL(partPage page, MML mml, int tl1, int tl2, int tl3, int tl4, int slot)//, int n)
10061009
{
10071010
//if (!parent.instFM.ContainsKey(n))
10081011
//{
10091012
// msgBox.setWrnMsg(string.Format(msg.get("E11000"), n), mml.line.Lp);
10101013
// return;
10111014
//}
10121015

1013-
int alg =page.voice[0] & 0x7;
1016+
int alg = page.voice[0] & 0x7;
10141017
int[] ope = new int[4] {
10151018
page.voice[partPage.voiceWidth + 0 * partPage.voiceWidth + 5]
10161019
, page.voice[partPage.voiceWidth + 1 * partPage.voiceWidth + 5]
@@ -1070,10 +1073,13 @@ public void OutFmSetTL(partPage page, MML mml, int tl1, int tl2, int tl3, int tl
10701073
vmml.type = enmMMLType.unknown;//.TotalLevel;
10711074
if (mml != null)
10721075
vmml.line = mml.line;
1073-
if ((page.slots & 1) != 0 && ope[0] != -1) ((ClsOPN)page.chip).OutFmSetTl(vmml, vpg, 0, ope[0]);
1074-
if ((page.slots & 2) != 0 && ope[1] != -1) ((ClsOPN)page.chip).OutFmSetTl(vmml, vpg, 1, ope[1]);
1075-
if ((page.slots & 4) != 0 && ope[2] != -1) ((ClsOPN)page.chip).OutFmSetTl(vmml, vpg, 2, ope[2]);
1076-
if ((page.slots & 8) != 0 && ope[3] != -1) ((ClsOPN)page.chip).OutFmSetTl(vmml, vpg, 3, ope[3]);
1076+
if (!page.vguard)
1077+
{
1078+
if ((page.slots & 1) != 0 && ope[0] != -1) ((ClsOPN)page.chip).OutFmSetTl(vmml, vpg, 0, ope[0]);
1079+
if ((page.slots & 2) != 0 && ope[1] != -1) ((ClsOPN)page.chip).OutFmSetTl(vmml, vpg, 1, ope[1]);
1080+
if ((page.slots & 4) != 0 && ope[2] != -1) ((ClsOPN)page.chip).OutFmSetTl(vmml, vpg, 2, ope[2]);
1081+
if ((page.slots & 8) != 0 && ope[3] != -1) ((ClsOPN)page.chip).OutFmSetTl(vmml, vpg, 3, ope[3]);
1082+
}
10771083
}
10781084

10791085
public void OutFmCh3SpecialModeSetFnum(MML mml, partPage page, byte ope, int octave, int num)
@@ -1271,12 +1277,13 @@ public void OutFmSetInstrument(partPage page, MML mml, int n, int vol, char type
12711277
op[i] = Common.CheckRange(op[i], 0, 127);
12721278
}
12731279

1274-
1275-
if ((isDef || (UMop & 1) != 0) && op[0] != -1) ((ClsOPN)page.chip).OutFmSetTl(mml, vpg, 0, op[0]);
1276-
if ((isDef || (UMop & 2) != 0) && op[1] != -1) ((ClsOPN)page.chip).OutFmSetTl(mml, vpg, 1, op[1]);
1277-
if ((isDef || (UMop & 4) != 0) && op[2] != -1) ((ClsOPN)page.chip).OutFmSetTl(mml, vpg, 2, op[2]);
1278-
if ((isDef || (UMop & 8) != 0) && op[3] != -1) ((ClsOPN)page.chip).OutFmSetTl(mml, vpg, 3, op[3]);
1279-
1280+
if (!page.vguard)
1281+
{
1282+
if ((isDef || (UMop & 1) != 0) && op[0] != -1) ((ClsOPN)page.chip).OutFmSetTl(mml, vpg, 0, op[0]);
1283+
if ((isDef || (UMop & 2) != 0) && op[1] != -1) ((ClsOPN)page.chip).OutFmSetTl(mml, vpg, 1, op[1]);
1284+
if ((isDef || (UMop & 4) != 0) && op[2] != -1) ((ClsOPN)page.chip).OutFmSetTl(mml, vpg, 2, op[2]);
1285+
if ((isDef || (UMop & 8) != 0) && op[3] != -1) ((ClsOPN)page.chip).OutFmSetTl(mml, vpg, 3, op[3]);
1286+
}
12801287

12811288
//音量を再セットする
12821289

@@ -2967,6 +2974,20 @@ public override void CmdVOperator(partPage page, MML mml)
29672974
page.voperator = val;
29682975
}
29692976

2977+
public override void CmdVGuard(partPage page, MML mml)
2978+
{
2979+
int val = (int)mml.args[0];
2980+
page.vguard = val == 1;
2981+
if (!page.vguard)
2982+
{
2983+
page.beforeTL[0] = -1;
2984+
page.beforeTL[1] = -1;
2985+
page.beforeTL[2] = -1;
2986+
page.beforeTL[3] = -1;
2987+
SetVolume(page, mml);
2988+
}
2989+
}
2990+
29702991
public override void CmdVolume(partPage page, MML mml)
29712992
{
29722993
base.CmdVolume(page, mml);
@@ -3421,7 +3442,7 @@ private void outTL(partPage page,MML mml)
34213442
if (page.beforeTL[0] != tl)
34223443
{
34233444
page.beforeTL[0] = tl;
3424-
OutFmSetTl(mml, page, 0, tl);
3445+
if (!page.vguard) OutFmSetTl(mml, page, 0, tl);
34253446
}
34263447
}
34273448
}

mml2vgm/Core/clsVgm.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6242,6 +6242,11 @@ private void Commander(partWork pw, partPage page, MML mml)
62426242
page.chip.CmdVOperator(page, mml);
62436243
page.mmlPos++;
62446244
break;
6245+
case enmMMLType.VGuard:
6246+
log.Write("VGuard");
6247+
page.chip.CmdVGuard(page, mml);
6248+
page.mmlPos++;
6249+
break;
62456250
case enmMMLType.Lfo:
62466251
log.Write("Lfo");
62476252
page.chip.CmdLfo(page, mml);

mml2vgm/Core/lang/message.ja-JP.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ E05086='VOP'コマンドの解析に失敗しました。
252252
E05087='TLOFS'コマンドの解析に失敗しました。
253253
E05088=使用できないスロット番号が指定されています。slotは使用するslotの番号(1~4)を列挙します。
254254
E05089=指定できる数値の範囲を超えています
255+
E05090='VGON/VGOF'コマンドの解析に失敗しました。
255256

256257

257258
;partWork.cs 06000
@@ -331,6 +332,7 @@ E10046=このパートではFMコマンドは使用できません。
331332
E10047=__コマンドを使用する前にPOxコマンドを使用して初期化をしてください。
332333
E10048=このパートではTTON/TTOFコマンドは使用できません。
333334
E10049=指定のChipではVOPコマンドは使用できません。
335+
E10050=指定のChipではVGON/VGOFコマンドは使用できません。
334336

335337

336338
;clsOPN.cs 11000

mml2vgm/Core/lang/message.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ E05086=Unknown command ('VOP?') defined.
249249
E05087=Unknown command ('TLOFS?') defined.
250250
E05088=A slot number is specified that cannot be used. slot enumerates the number of slots (1-4) to be used.
251251
E05089=The value exceeds the range of values that can be specified.
252+
E05090=Unknown command ('VGO?') defined.
252253

253254

254255
;partWork.cs 06000
@@ -325,6 +326,7 @@ E10046=This channel can't use FM command.
325326
E10047=Use the POx command to initialize the system before using the __ command.
326327
E10048=This channel can't use TTON/TTOF command.
327328
E10049=This chip can't use VOP command.
329+
E10050=This chip can't use VGON/VGOF command.
328330

329331

330332
;clsOPN.cs 11000

mml2vgm/Core/partPage.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@ public class partPage
702702
public bool RR15sw { get; set; } = false;
703703
public int RR15 { get; set; } = 0;
704704
public int voperator { get; set; } = 0;
705+
public bool vguard { get; set; } = false;
705706
public Dictionary<byte, byte> TLOFS = new Dictionary<byte, byte>();
706707

707708
public bool PASwitch = false;

mml2vgm/mml2vgmIDE/MMLParameter/Instrument.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ public Instrument(int n, SoundManager.Chip chip, Setting setting,MIDIKbd midiKbd
111111
//70 -
112112
null, null, null, null, null,
113113
null, SetHardLFO, null, null, null,
114+
//80 -
115+
null, null, null, null, null,
116+
null, null, null, null, null,
114117
};
115118
}
116119

0 Bytes
Binary file not shown.

mml2vgm/mml2vgmIDEx64/MMLParameter/Instrument.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ public Instrument(int n, SoundManager.Chip chip, Setting setting,MIDIKbd midiKbd
111111
//70 -
112112
null, null, null, null, null,
113113
null, SetHardLFO, null, null, null,
114+
//80 -
115+
null, null, null, null, null,
116+
null, null, null, null, null,
114117
};
115118
}
116119

0 Bytes
Binary file not shown.

mml2vgm_MMLCommandMemo.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,8 @@ Vn ----------o----o----o--------------------------------- ADPCM-A/
775775
Vn --------------------------------------------------o--- マスターボリュームの音量絶対指定( 0:2/5(min) 1:1/2 2:2/3 3:1/1(max) )
776776
Vn1,n2 ----------------------------o------------------------- マスターボリュームの音量絶対指定(n1: 左 0 - 15 n2: 右 0 - 15 )
777777
VOPn -oo----oo---oo---oo----oo----------------------------- ボリュームコマンドの対象となるスロットの割り当て(使用するスロットを列挙する)
778+
VGON -oo----oo---oo---oo----oo-o--------------------------- ボリューム(TL)の値をChipに送信しません。yTLなどで完全に手動操作したい時などに使用します。
779+
VGOF -oo----oo---oo---oo----oo-o--------------------------- ボリューム(TL)の値をChipに送信します。(default)
778780
> -ooo-ooooo-oooo-oooo-oooooooooooo-o-o-oo-o-ooooooooooo オクターブ相対指定(上げ)
779781
< -ooo-ooooo-oooo-oooo-oooooooooooo-o-o-oo-o-ooooooooooo オクターブ相対指定(下げ)
780782
) -oo--ooooooooooooooooooooooooooooooooooooooooooooooooo 音量相対指定(上げ)

0 commit comments

Comments
 (0)