Skip to content

Commit c332162

Browse files
committed
Added YM2610B MSX pi supporting
1 parent 646ac6e commit c332162

19 files changed

+2580
-919
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,4 +1023,7 @@ License: MIT license https://github.com/naudio/NAudio?tab=MIT-1-ov-file#readme
10231023

10241024
*VST.NET - obiwanjacobi
10251025
https://github.com/obiwanjacobi/vst.net/tree/vstnet1
1026-
License: LGPL-2.1 license
1026+
License: LGPL-2.1 license
1027+
1028+
*Neo-Geo ADPCM-A sample encoder - AJ Kelly
1029+
https://github.com/freem/adpcma/blob/master/LICENSE

src/VSIF/VGMPlayer/SongBase.cs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,50 +1154,6 @@ protected void deferredWriteOPNB_P1(VsifClient comPortOPNB, int adrs, int dt)
11541154
}
11551155
}
11561156

1157-
1158-
/// <summary>
1159-
///
1160-
/// </summary>
1161-
/// <param name="transferData"></param>
1162-
/// <param name="saddr"></param>
1163-
/// <param name="fp"></param>
1164-
protected void sendAdpcmDataYM2610_SIOS(VsifClient comPortOPNB, byte[] transferData, int saddr, int type, FormProgress fp)
1165-
{
1166-
//Transfer
1167-
int len = transferData.Length;
1168-
int index = 0;
1169-
int percentage = 0;
1170-
int lastPercentage = -1;
1171-
for (int i = 0; i < len; i++)
1172-
{
1173-
deferredWriteOPNA_P1(comPortOPNB, 0x08, transferData[i]);
1174-
1175-
//HACK: WAIT
1176-
switch (comPortOPNB?.SoundModuleType)
1177-
{
1178-
case VsifSoundModuleType.Spfm:
1179-
case VsifSoundModuleType.SpfmLight:
1180-
case VsifSoundModuleType.Gimic:
1181-
comPortOPNB?.FlushDeferredWriteDataAndWait();
1182-
break;
1183-
}
1184-
1185-
percentage = (100 * index) / len;
1186-
if (percentage != lastPercentage)
1187-
{
1188-
FormMain.TopForm.SetStatusText("YM2608: Transferring ADPCM(" + percentage + "%)");
1189-
//fp.Percentage = percentage;
1190-
comPortOPNB?.FlushDeferredWriteDataAndWait();
1191-
}
1192-
lastPercentage = percentage;
1193-
index++;
1194-
if (RequestedStat == SoundState.Stopped)
1195-
break;
1196-
else updateStatusForDataTransfer();
1197-
}
1198-
FormMain.TopForm.SetStatusText("YM2610: Transferred ADPCM");
1199-
}
1200-
12011157
/// <summary>
12021158
///
12031159
/// </summary>

src/VSIF/VGMPlayer/VGMSong.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,10 +2135,6 @@ private bool connectToOPNB(uint opnb_clock, bool opnb)
21352135

21362136
//LFO
21372137
deferredWriteOPNB_P0(comPortOPNB, 0x22, 0x00);
2138-
//channel 3 mode
2139-
deferredWriteOPNB_P0(comPortOPNB, 0x27, 0x00);
2140-
//Force OPN mode
2141-
deferredWriteOPNB_P0(comPortOPNB, 0x29, 0x00);
21422138

21432139
for (int i = 0x30; i <= 0x3F; i++)
21442140
deferredWriteOPNB_P0(comPortOPNB, i, 0);
@@ -4250,7 +4246,7 @@ protected override void StreamSong()
42504246
byte[] romData = vgmReader.ReadBytes((int)size);
42514247
if (comPortOPNB != null)
42524248
{
4253-
if(!looped)
4249+
if (!looped)
42544250
transferAdpcmDataForNeotron(size, saddr, romData, 1, "A");
42554251
}
42564252
else if (opnbPcm != null)
@@ -5279,7 +5275,11 @@ protected override void StreamSong()
52795275
NotifyFinished();
52805276
}
52815277

5282-
private Dictionary<uint, bool> adpcmMemoryErased = new Dictionary<uint, bool>();
5278+
private Dictionary<uint, bool>[] adpcmMemoryErased =
5279+
new Dictionary<uint, bool>[]{
5280+
new Dictionary<uint, bool>(), // ADPCM-A
5281+
new Dictionary<uint, bool>() // ADPCM-B
5282+
};
52835283

52845284
/// <summary>
52855285
/// Transfers ADPCM data to the YM2610 for a specific memory type.
@@ -5324,9 +5324,9 @@ private uint transferAdpcmDataForNeotron(uint size, uint saddr, byte[] romData,
53245324

53255325
// ここでchunkを使って処理を行う
53265326
bool erase = false;
5327-
if (!adpcmMemoryErased.ContainsKey((saddr >> 16)))
5327+
if (!adpcmMemoryErased[memoryType - 1].ContainsKey((saddr >> 16)))
53285328
{
5329-
adpcmMemoryErased[(saddr >> 16)] = true;
5329+
adpcmMemoryErased[memoryType - 1][(saddr >> 16)] = true;
53305330
erase = true;
53315331
#if DEBUG
53325332
Console.WriteLine("YM2610: Erase ADPCM-" + memoryTypeName + "(" +

src/devices/sound/fm.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2433,7 +2433,6 @@ struct ADPCM_CH
24332433
int8_t vol_mul; /* volume in "0.75dB" steps */
24342434
uint8_t vol_shift; /* volume in "-6dB" steps */
24352435
int32_t *pan; /* &out_adpcm[OPN_xxxx] */
2436-
uint8_t program_no; /* prog no mamidimemo */
24372436

24382437
};
24392438

@@ -2496,7 +2495,7 @@ struct ym2610_state
24962495
data = ch->now_data & 0x0f;
24972496
else
24982497
{
2499-
ch->now_data = read_byte(device, (ch->program_no << 24) | ch->now_addr>>1);
2498+
ch->now_data = read_byte(device, (0 << 24) | ch->now_addr>>1);
25002499
data = (ch->now_data >> 4) & 0x0f;
25012500
}
25022501

@@ -2580,14 +2579,6 @@ struct ym2610_state
25802579
adpcm[c].adpcm_out = ((adpcm[c].adpcm_acc * adpcm[c].vol_mul) >> adpcm[c].vol_shift) & ~3; /* multiply, shift and mask out low 2 bits */
25812580
}
25822581
break;
2583-
case 0x02:
2584-
case 0x03:
2585-
case 0x04:
2586-
case 0x05:
2587-
case 0x06:
2588-
case 0x07:
2589-
adpcm[r - 2].program_no = v;
2590-
break;
25912582
default:
25922583
c = r&0x07;
25932584
if( c >= 0x06 ) return;

src/mamidimemo/Gui/FormOpnbPcmTableEditor.Designer.cs

Lines changed: 179 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)