Skip to content

Commit

Permalink
TAG181 2022/06/09
Browse files Browse the repository at this point in the history
  Compiler
    パート別リプレイス機能を追加
  • Loading branch information
kumatan committed Jun 9, 2022
1 parent d047aa2 commit 3a7262b
Show file tree
Hide file tree
Showing 9 changed files with 192 additions and 3 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����
TAG181 2022/06/09
Compiler
�p�[�g�ʃ��v���C�X�@�\��lj�

TAG180 2022/06/01
Compiler&Driver
OPNA2RhythmMute�^�O��lj�
Expand Down
Binary file modified Common_NET5/musicDriverInterface.dll
Binary file not shown.
26 changes: 26 additions & 0 deletions MML.txt
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,32 @@ mub
0xFF 0xFA n1 n2 n3 n4 n5 n6


-�p�[�g�ʃ��v���C�X
�R�}���h
[|
|
|]
����
[|
|
|]
�l�͈̔�
-
�f�t�H���g�l
�Ȃ�
�g�p�”\�ȃp�[�g
All
���e
[|��|]�Ŋ������͈͂��p�[�g�ʎw�肵���͈͂ʼn��t���܂��B
�������͈͓���|�Ŏ��̃p�[�g�����t������e�ɂȂ�܂��B
�l�X�g�s�”\�ł��B
[|�����‚���ƁA�p�[�g�̋L�q�����Q�Ƃ��A����(�R���p�C�����悤�Ƃ��Ă��錻�݂̃p�[�g)�����Ԗڂ̈ʒu�ɂ����邩���ׂ܂��B
���̂��Ǝ����̈ʒu�ɂ������悾����L���Ƃ��Ă��Ƃ�|]�܂œǂݎ̂Ă܂��B
|���w�肷�邽�тɎ��̃p�[�g�̋��ɐ؂�ւ��܂��B
mub�t�@�C���ł̃t�H�[�}�b�g
-




--�����R�}���h--
Expand Down
Binary file modified lib/musicDriverInterface.dll
Binary file not shown.
158 changes: 158 additions & 0 deletions mucomDotNETCompiler/muc88.cs
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,11 @@ private EnmFCOMPNextRtn SETSYO()
{
mucInfo.srcCPtr++;

if (work.partReplaceSw)
{
return SetPartReplaceEnd();
}

return EnmFCOMPNextRtn.fcomp1;
}

Expand Down Expand Up @@ -1896,6 +1901,13 @@ private EnmFCOMPNextRtn SETLPS()

mucInfo.srcCPtr++;

char c = mucInfo.srcCPtr < mucInfo.lin.Item2.Length ?
mucInfo.lin.Item2[mucInfo.srcCPtr] : (char)0;
if (c == '|')// 0x2c
{
return SetPartReplaceStart();
}

msub.MWRIT2(new MmlDatum(0xf5));// COM OF LOOPSTART
work.POINTC += 10;

Expand Down Expand Up @@ -4199,6 +4211,8 @@ public void COMPST()
// continue;
//}

int checkPos = mucInfo.srcCPtr;

bool isFirst = true;

//先ずパート文字を探す
Expand Down Expand Up @@ -4371,6 +4385,10 @@ public void COMPST()
//if (p != work.pageNow) continue;

Log.WriteLine(LogLevel.TRACE, string.Format(msg.get("I0402"), work.ChipIndex * work.MAXCH + work.CHIP_CH, work.pageNow));

//パートの定義位置を調べる(単一パートの場合は常に 0 )
work.partPos = CheckPartPos(checkPos);
work.partReplaceSw = false;

EnmFMCOMPrtn ret = FMCOMP();// TO FM COMPILE
if (mucInfo.ErrSign) break;
Expand All @@ -4386,6 +4404,72 @@ public void COMPST()
} while (true);
}

private int CheckPartPos(int mpos)
{
char c;
int partNum = 0;
int pageNum;
List<Tuple<int, int>> partList = new List<Tuple<int, int>>();
bool partMode = true;
bool pageFirst = true;

do
{
c = mpos < mucInfo.lin.Item2.Length
? mucInfo.lin.Item2[mpos]
: (char)0;

if (partMode)
{
//パート文字解析

partNum = work.GetTrackNo(c);
if (partNum < 0) break;
partMode = false;
mpos++;
}
else
{
//ページ番号解析

if (c < '0' || c > '9')
{
if ((c == 0 || c == ' ' || c == '\t') && pageFirst)
{
partList.Add(new Tuple<int, int>(partNum, 0));
break;
}
else
{
int part = work.GetTrackNo(c);
if (part < 0) break;

if (pageFirst)
partList.Add(new Tuple<int, int>(partNum, 0));
partMode = true;
pageFirst = true;
}
continue;
}

pageNum = c - '0';
partList.Add(new Tuple<int, int>(partNum, pageNum));
pageFirst = false;
mpos++;
}

} while (true);

int cnt = 0;
foreach(Tuple<int, int> part in partList)
{
if (part.Item1 == work.ChipIndex * work.MAXCH + work.CHIP_CH && part.Item2 == work.pageNow)
return cnt;
cnt++;
}
return -1;
}

public bool CheckExtendFormat()
{
if (mucInfo.SSGExtend) return true;
Expand Down Expand Up @@ -5342,6 +5426,80 @@ public EnmFCOMPNextRtn COMPRC()
return act();
}



private EnmFCOMPNextRtn SetPartReplaceStart()
{
mucInfo.srcCPtr++;
work.partReplaceSw = true;

int p = work.partPos;
while (p > 0)
{
char c = mucInfo.srcCPtr < mucInfo.lin.Item2.Length ?
mucInfo.lin.Item2[mucInfo.srcCPtr++] : (char)0;

if (c == 0)
{
mucInfo.srcCPtr++;
work.partReplaceSw = false;
return EnmFCOMPNextRtn.fcomp1;
}
if (c == '|')// 0x2c
{
c = mucInfo.srcCPtr < mucInfo.lin.Item2.Length ?
mucInfo.lin.Item2[mucInfo.srcCPtr] : (char)0;
if (c == ']')
{
mucInfo.srcCPtr++;
work.partReplaceSw = false;
return EnmFCOMPNextRtn.fcomp1;
}
p--;
}
}

return EnmFCOMPNextRtn.fcomp1;
}

private EnmFCOMPNextRtn SetPartReplaceEnd()
{
// もし|の場合は最後の|]または行端までスキップ
//ただし行端の場合はパートリプレイス処理続行
while (true)
{
char c = mucInfo.srcCPtr < mucInfo.lin.Item2.Length ?
mucInfo.lin.Item2[mucInfo.srcCPtr++] : (char)0;

if (c == 0)
{
mucInfo.srcCPtr++;
work.partReplaceSw = false;
break;
}
if (c == ']')
{
mucInfo.srcCPtr++;
work.partReplaceSw = false;
break;
}
if (c == '|')// 0x2c
{
c = mucInfo.srcCPtr < mucInfo.lin.Item2.Length ?
mucInfo.lin.Item2[mucInfo.srcCPtr] : (char)0;
if (c == ']')
{
mucInfo.srcCPtr++;
work.partReplaceSw = false;
break;
}
}

}

return EnmFCOMPNextRtn.fcomp1;
}

}

public enum EnmFCOMPNextRtn
Expand Down
2 changes: 2 additions & 0 deletions mucomDotNETCompiler/work.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public class work
public bool CompEndCmdFlag { get; internal set; } = false;
public HashSet<int> useSSGVoice { get; set; } = new HashSet<int>();
public HashSet<int> usedFMVoiceNumber { get; set; } = new HashSet<int>();
public int partPos { get; set; } = -1;
public bool partReplaceSw { get; set; } = false;

public int MU_NUM = 0;// 0xC200 b コンパイルチュウ ノ MUSICナンバー
public int OTODAT = 1;// 0xc201 w FMオンショク ガ カクノウサレル アドレストップ ガ ハイッテイル
Expand Down
2 changes: 1 addition & 1 deletion mucomDotNETConsole/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"Console": {
"commandName": "Project",
"commandLineArgs": "-LOGLEVEL=TRACE \"D:\\bootcamp\\FM音源\\data\\自作\\muc\\testRhythmMute.muc\""
"commandLineArgs": "-LOGLEVEL=TRACE \"D:\\bootcamp\\FM音源\\data\\自作\\muc\\testPartReplace.muc\""
}
}
}
1 change: 0 additions & 1 deletion mucomDotNETDriver/MUBHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ public void SetDriverOptionFromTags(List<Tuple<string, string>> tags)
if (!string.IsNullOrEmpty(tag.Item2))
{
string val = tag.Item2.ToLower().Trim();

RhythmMute[0] = 0;
if (val.IndexOf('b') > -1) RhythmMute[0] |= 1;
if (val.IndexOf('s') > -1) RhythmMute[0] |= 2;
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\\FM音源\\data\\自作\\muc\\testRhythmMute.mub\""
"commandLineArgs": "\"D:\\bootcamp\\FM音源\\data\\自作\\muc\\testPartReplace.mub\""
}
}
}

0 comments on commit 3a7262b

Please sign in to comment.