Skip to content

Commit c152483

Browse files
author
kumatan
committed
TAG206 2025/03/01
Compiler PCM読み込み時に逆再生のデータを作成するスイッチを指定できる機能追加
1 parent 71dbffd commit c152483

5 files changed

Lines changed: 43 additions & 16 deletions

File tree

CHANGE.txt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
�X�V����
2+
TAG206 2025/03/01
3+
Compiler
4+
PCM�ǂݍ��ݎ��ɋt�Đ��̃f�[�^���쐬����X�C�b�`���w��ł���@�\�lj�
25
TAG205 2025/02/23
36
Compiler
47
���[�v�񐔂����w��̏ꍇ�Ɏ��̕������X�L�b�v���Ă��܂��o�O���C��
@@ -20,27 +23,27 @@ TAG203 2024/05/04
2023
������
2124
"#pcmopna_s"
2225
�@ �ʖ�
23-
"pcm_2nd"
26+
"#pcm_2nd"
2427

2528
������
26-
"pcmopnb_b_p"
29+
"#pcmopnb_b_p"
2730
�@ �ʖ�
28-
"pcm_3rd"
31+
"#pcm_3rd"
2932

3033
������
31-
"pcmopnb_b_s"
34+
"#pcmopnb_b_s"
3235
�@ �ʖ�
33-
"pcm_4th"
36+
"#pcm_4th"
3437

3538
������
36-
"pcmopnb_a_p"
39+
"#pcmopnb_a_p"
3740
�@ �ʖ�
38-
"pcm_5th"
41+
"#pcm_5th"
3942

4043
������
41-
"pcmopnb_a_s"
44+
"#pcmopnb_a_s"
4245
�@ �ʖ�
43-
"pcm_6th"
46+
"#pcm_6th"
4447

4548
TAG202 2024/03/20
4649
Compiler

MML.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ mucomDotNET
183183
#@pcm_3rd_a
184184
#@pcm_4th_a
185185
����
186-
#@pcm number , name , filename , volume
186+
#@pcm number , name , filename , volume , reverse
187187
(���̃^�O�����l)
188188
�l�͈̔�
189189
number ���F�ԍ� (1�`)(���F�ԍ����w�肷��(OPNB ADPCM-A�̏ꍇ�͉����𐔒l��(��q)��������))
@@ -192,6 +192,7 @@ mucomDotNET
192192
name ���F�� (���F�����w�肷��)
193193
filename �t�@�C���� (.wav�t�@�C�����w�肷��)
194194
volume ���� (TBD:100)(�Ƃ肠����100���w�肷��)
195+
reverse �t�Đ� R���w�肷�邱�Ƃŋt�Đ��̃f�[�^���쐬����
195196
���e
196197
OPNA/B�Ŏg�p����PCM��wav�t�@�C���Ŏw�肵�܂��B
197198
���ꂼ�ꏇ�ԂɁA

bin.zip

3.28 MB
Binary file not shown.

mucomDotNETCompiler/PCMTool/PCMFileInfo.cs

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class PCMFileInfo
1515
public byte[] raw { get; private set; } = null;
1616
public byte[] encData { get; private set; } = null;
1717
private bool is16bit;
18+
public bool rev { get; set; } = false;
1819

1920
public PCMFileInfo(List<string> itemList, Func<string, Stream> appendFileReaderCallback = null)
2021
{
@@ -48,6 +49,7 @@ public PCMFileInfo(List<string> itemList, Func<string, Stream> appendFileReaderC
4849
if (itemList.Count > 1) name = itemList[1];
4950
if (itemList.Count > 2) fileName = itemList[2];
5051
if (itemList.Count > 3 && int.TryParse(itemList[3], out n)) volume = n;
52+
if (itemList.Count > 4) rev=(itemList[4].ToUpper()=="R");
5153

5254
byte[] buf;
5355
using (Stream pd = appendFileReaderCallback?.Invoke(fileName))
@@ -61,7 +63,7 @@ public PCMFileInfo(List<string> itemList, Func<string, Stream> appendFileReaderC
6163
{
6264
bool isRaw;
6365
int samplerate;
64-
raw = GetPCMDataFromFile("", fileName, volume, out isRaw, out is16bit, out samplerate);
66+
raw = GetPCMDataFromFile("", fileName, volume, rev, out isRaw, out is16bit, out samplerate);
6567
if (raw != null) length = (ushort)raw.Length;
6668
else
6769
throw new mucomDotNET.Common.MucException(string.Format("Fail get pcm data from file[{0}].", fileName));
@@ -75,7 +77,7 @@ public PCMFileInfo(List<string> itemList, Func<string, Stream> appendFileReaderC
7577
{
7678
bool isRaw;
7779
int samplerate;
78-
raw = GetPCMDataFromFile(buf, volume, out isRaw, out is16bit, out samplerate);
80+
raw = GetPCMDataFromFile(buf, volume,rev, out isRaw, out is16bit, out samplerate);
7981
if (raw != null) length = (ushort)raw.Length;
8082
else
8183
throw new mucomDotNET.Common.MucException(string.Format("Fail get pcm data from file[{0}].", fileName));
@@ -126,7 +128,7 @@ public void Encode(enmFormatType formatType)
126128
length = encData.Length;
127129
}
128130

129-
public static byte[] GetPCMDataFromFile(string path, string fileName, int vol, out bool isRaw, out bool is16bit, out int samplerate)
131+
public static byte[] GetPCMDataFromFile(string path, string fileName, int vol,bool rev, out bool isRaw, out bool is16bit, out int samplerate)
130132
{
131133
string fnPcm = Path.Combine(path, fileName).Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar);
132134

@@ -149,10 +151,10 @@ public static byte[] GetPCMDataFromFile(string path, string fileName, int vol, o
149151
return buf;
150152
}
151153

152-
return GetPCMDataFromFile(buf, vol, out isRaw, out is16bit, out samplerate);
154+
return GetPCMDataFromFile(buf, vol,rev, out isRaw, out is16bit, out samplerate);
153155
}
154156

155-
public static byte[] GetPCMDataFromFile(byte[] buf, int vol, out bool isRaw, out bool is16bit, out int samplerate)
157+
public static byte[] GetPCMDataFromFile(byte[] buf, int vol,bool rev, out bool isRaw, out bool is16bit, out int samplerate)
156158
{
157159
isRaw = false;
158160
is16bit = false;
@@ -276,6 +278,18 @@ public static byte[] GetPCMDataFromFile(byte[] buf, int vol, out bool isRaw, out
276278
des[i] = (byte)(b & 0xff);
277279
des[i + 1] = (byte)((b & 0xff00) >> 8);
278280
}
281+
if (rev)
282+
{
283+
for (int i = 0; i < des.Length / 2; i += 2)
284+
{
285+
byte l = des[i];
286+
byte m = des[i + 1];
287+
des[i] = des[des.Length - 1 - i - 1];
288+
des[i + 1] = des[des.Length - 1 - i - 0];
289+
des[des.Length - 1 - i - 1] = l;
290+
des[des.Length - 1 - i - 0] = m;
291+
}
292+
}
279293
}
280294
else
281295
{
@@ -294,6 +308,15 @@ public static byte[] GetPCMDataFromFile(byte[] buf, int vol, out bool isRaw, out
294308

295309
des[i] = (byte)d;
296310
}
311+
if (rev)
312+
{
313+
for (int i = 0; i < des.Length / 2; i ++)
314+
{
315+
byte l = des[i];
316+
des[i] = des[des.Length - 1 - i];
317+
des[des.Length - 1 - i] = l;
318+
}
319+
}
297320
}
298321

299322
return des;

mucomDotNETConsole/Properties/launchSettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"profiles": {
33
"Console": {
44
"commandName": "Project",
5-
"commandLineArgs": "-LOGLEVEL=TRACE \"D:\\bootcamp\\FM音源\\data\\自作\\Natsuki\\test_20250223.muc\""
5+
"commandLineArgs": "-LOGLEVEL=TRACE \"D:\\bootcamp\\FM音源\\data\\自作\\花~Sakuyo~\\flower-sakuyo-.muc\""
66
}
77
}
88
}

0 commit comments

Comments
 (0)