Skip to content

Commit

Permalink
TAG028 2020/10/19 2nd
Browse files Browse the repository at this point in the history
  Vsyncタグ修正(XGMの書式をmml2vgmに合わせた。)
  • Loading branch information
kumatan committed Oct 19, 2020
1 parent 899e1be commit 30a3c0b
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
�X�V����
TAG028 2020/10/19 2nd
Vsync�^�O�C��(XGM�̏�����mml2vgm�ɍ��킹���B)

TAG027 2020/10/19
Vsync�^�O�lj�(XGM�ł��g�p�”\�ɁB)

Expand Down
6 changes: 3 additions & 3 deletions Core/ClsVgm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2263,7 +2263,7 @@ public byte[] Xgm_getByteData(Dictionary<string, List<MML>> mmlData, enmLoopExSt
}
else
{
waitSample = waitCounter * (44100 / info.vgmVsync);
waitSample = waitCounter * (info.xgmSamplesPerSecond / info.vgmVsync);
}
lClock -= waitCounter;
dSample -= waitSample;
Expand Down Expand Up @@ -2601,7 +2601,7 @@ private void Xgm_procWait(long cnt)
}
else
{
sample = cnt * (44100 / info.vgmVsync);
sample = cnt * (info.xgmSamplesPerSecond / info.vgmVsync);
}

if (pw.chip.use && !pw.dataEnd)
Expand Down Expand Up @@ -2640,7 +2640,7 @@ private void Xgm_procWait(long cnt)
}
else
{
info.samplesPerClock = 44100 / info.vgmVsync;
info.samplesPerClock = info.xgmSamplesPerSecond / info.vgmVsync;
}
// wait発行
lClock += cnt;
Expand Down
48 changes: 42 additions & 6 deletions Core/Information.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ public int AddInformation(string buf, int lineNumber, string fn, Dictionary<enmC
msgBox.setWrnMsg(string.Format(msg.get("E03000"), s), fn, lineNumber);
}
}

SetTimers();

return 0;
}

Expand All @@ -166,15 +169,15 @@ private void SetFormat(string val)
case "VGM":
default:
format = enmFormat.VGM;
tempo = DEFAULT_TEMPO;
clockCount = DEFAULT_CLOCK_COUNT;
samplesPerClock = DEFAULT_SAMPLES_PER_CLOCK;
//tempo = DEFAULT_TEMPO;
//clockCount = DEFAULT_CLOCK_COUNT;
//samplesPerClock = DEFAULT_SAMPLES_PER_CLOCK;
break;
case "XGM":
format = enmFormat.XGM;
tempo = DEFAULT_TEMPO;
clockCount = XGM_DEFAULT_CLOCK_COUNT;
samplesPerClock = XGM_DEFAULT_SAMPLES_PER_CLOCK;
//tempo = DEFAULT_TEMPO;
//clockCount = XGM_DEFAULT_CLOCK_COUNT;
//samplesPerClock = XGM_DEFAULT_SAMPLES_PER_CLOCK;
break;
}
}
Expand Down Expand Up @@ -202,6 +205,39 @@ private void SetVsyncRate(string val)
}
}

public void SetTimers()
{
if (vgmVsync == -1)
{
tempo = DEFAULT_TEMPO;
clockCount = DEFAULT_CLOCK_COUNT;
switch (format)
{
case enmFormat.VGM:
default:
samplesPerClock = Information.VGM_SAMPLE_PER_SECOND * 60.0 * 4.0 / (tempo * clockCount);
break;
case enmFormat.XGM:
samplesPerClock = xgmSamplesPerSecond * 60.0 * 4.0 / (tempo * clockCount);
break;
}
}
else
{
switch (format)
{
case enmFormat.VGM:
default:
samplesPerClock = 44100 / vgmVsync;
break;
case enmFormat.XGM:
vgmVsync = (int)xgmSamplesPerSecond;
samplesPerClock = 1;
break;
}
}
}

private void SetOctaveRev(string val)
{
switch (val.ToUpper())
Expand Down
7 changes: 7 additions & 0 deletions mucomMD2vgm_MMLCommandMemo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ mucomMD2vgm MML
���K�h���C�u�œ��삷��XGM�`���������d�g�݂ɂȂ��Ă��܂��B

#Vsync hz
vgm����
���̎w����s���ƁA1Clock = 1Frame �Œ胂�[�h�ɂȂ�܂��B
����ăe���|�̎w��������ɂȂ�܂��B
hz(�l)�Ɏw�肵�����l���A�P�b�Ԃ�����̃t���[�����ƂȂ�܂��B
Expand All @@ -467,6 +468,12 @@ mucomMD2vgm MML

44100Hz / 60Hz = 1Clock = 1Frame

#Vsync 1
xgm����
���̎w����s���ƁA1Clock = 1Frame �Œ胂�[�h�ɂȂ�܂��B
����ăe���|�̎w��������ɂȂ�܂��B
�l��1���w�肵�Ă��������BXGMBaseFrame�Őݒ肵�����l���A�P�b�Ԃ�����̃t���[�����ƂȂ�܂��B



�E�G���[�ƌx���ɂ‚���
Expand Down

0 comments on commit 30a3c0b

Please sign in to comment.