diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/AY8910.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/AY8910.cs index 12783c3..e9a33c1 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/AY8910.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/AY8910.cs @@ -2,7 +2,7 @@ namespace MAME.Core { - public class AY8910 + public unsafe class AY8910 { public struct _ay_ym_param { @@ -383,7 +383,7 @@ namespace MAME.Core { for (j = 0; j < length; j++) { - stream.streamoutput[chan][offset + j] = 0; + stream.streamoutput_Ptrs[chan][offset + j] = 0; } } } @@ -453,18 +453,18 @@ namespace MAME.Core if (TONE_ENVELOPE(chan) != 0) { int i1 = ay8910info.env_table[chan][ay8910info.vol_enabled[chan] != 0 ? ay8910info.env_volume : 0]; - stream.streamoutput[chan][offset] = ay8910info.env_table[chan][ay8910info.vol_enabled[chan] != 0 ? ay8910info.env_volume : 0]; + stream.streamoutput_Ptrs[chan][offset] = ay8910info.env_table[chan][ay8910info.vol_enabled[chan] != 0 ? ay8910info.env_volume : 0]; } else { int i1 = ay8910info.vol_table[chan][ay8910info.vol_enabled[chan] != 0 ? TONE_VOLUME(chan) : 0]; - stream.streamoutput[chan][offset] = ay8910info.vol_table[chan][ay8910info.vol_enabled[chan] != 0 ? TONE_VOLUME(chan) : 0]; + stream.streamoutput_Ptrs[chan][offset] = ay8910info.vol_table[chan][ay8910info.vol_enabled[chan] != 0 ? TONE_VOLUME(chan) : 0]; } } } else { - stream.streamoutput[0][offset] = mix_3D(); + stream.streamoutput_Ptrs[0][offset] = mix_3D(); } offset++; } diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/DAC.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/DAC.cs index eeba0e1..86b1f39 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/DAC.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/DAC.cs @@ -12,14 +12,14 @@ namespace MAME.Core public short[] SignedVolTable; }; public static dac_info dac1; - public static void DAC_update(int offset, int length) + public unsafe static void DAC_update(int offset, int length) { ; short out1 = dac1.output; int i; for (i = 0; i < length; i++) { - Sound.dacstream.streamoutput[0][offset + i] = out1; + Sound.dacstream.streamoutput_Ptrs[0][offset + i] = out1; } } public static void dac_signed_data_w(int num, byte data) diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/FMOpl.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/FMOpl.cs index 226c71f..3643f1e 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/FMOpl.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/FMOpl.cs @@ -2,7 +2,7 @@ namespace MAME.Core { - public class FMOpl + public unsafe class FMOpl { public struct OPL_SLOT { @@ -1260,7 +1260,7 @@ namespace MAME.Core } lt = output0; lt = limit(lt, 32767, -32768); - Sound.ym3812stream.streamoutput[0][offset + i] = lt; + Sound.ym3812stream.streamoutput_Ptrs[0][offset + i] = lt; YM3812.advance(); } } @@ -1330,7 +1330,7 @@ namespace MAME.Core } lt = output0; lt = limit(lt, 32767, -32768); - Sound.ym3526stream.streamoutput[0][offset + i] = lt; + Sound.ym3526stream.streamoutput_Ptrs[0][offset + i] = lt; YM3526.advance(); } } diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/ICS2115.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/ICS2115.cs index 353a93b..14bef48 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/ICS2115.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/ICS2115.cs @@ -2,7 +2,7 @@ namespace MAME.Core { - public class ICS2115 + public unsafe class ICS2115 { public static byte V_ON = 1, V_DONE = 2; public static voice_struct[] voice2; @@ -75,8 +75,8 @@ namespace MAME.Core bool irq_invalid = false; for (i = 0; i < length; i++) { - Sound.ics2115stream.streamoutput[0][offset + i] = 0; - Sound.ics2115stream.streamoutput[1][offset + i] = 0; + Sound.ics2115stream.streamoutput_Ptrs[0][offset + i] = 0; + Sound.ics2115stream.streamoutput_Ptrs[1][offset + i] = 0; } for (osc = 0; osc < 32; osc++) { @@ -106,8 +106,8 @@ namespace MAME.Core else v = ((sbyte)v) << 6; v = (v * vol) >> (16 + 5); - Sound.ics2115stream.streamoutput[0][offset + i] += v; - Sound.ics2115stream.streamoutput[1][offset + i] += v; + Sound.ics2115stream.streamoutput_Ptrs[0][offset + i] += v; + Sound.ics2115stream.streamoutput_Ptrs[1][offset + i] += v; adr += delta; if (adr >= end) { diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/Iremga20.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/Iremga20.cs index e7ca585..4230528 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/Iremga20.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/Iremga20.cs @@ -2,7 +2,7 @@ namespace MAME.Core { - public class Iremga20 + public unsafe class Iremga20 { public struct IremGA20_channel_def { @@ -74,8 +74,8 @@ namespace MAME.Core play[3] = pos[3] < end[3] ? 1 : 0; } sampleout >>= 2; - Sound.iremga20stream.streamoutput[0][offset + i] = sampleout; - Sound.iremga20stream.streamoutput[1][offset + i] = sampleout; + Sound.iremga20stream.streamoutput_Ptrs[0][offset + i] = sampleout; + Sound.iremga20stream.streamoutput_Ptrs[1][offset + i] = sampleout; } for (i = 0; i < 4; i++) { diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/K007232.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/K007232.cs index 5c4611d..93a043a 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/K007232.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/K007232.cs @@ -2,7 +2,7 @@ namespace MAME.Core { - public class K007232 + public unsafe class K007232 { public struct kdacApcm { @@ -39,7 +39,7 @@ namespace MAME.Core { for (j = 0; j < length; j++) { - Sound.k007232stream.streamoutput[i][offset + j] = 0; + Sound.k007232stream.streamoutput_Ptrs[i][offset + j] = 0; } } for (i = 0; i < 2; i++) @@ -84,8 +84,8 @@ namespace MAME.Core } info.addr[i] += info.step[i]; out1 = (k007232rom[info.pcmbuf_offset[i] + addr] & 0x7f) - 0x40; - Sound.k007232stream.streamoutput[0][offset + j] += out1 * volA; - Sound.k007232stream.streamoutput[1][offset + j] += out1 * volB; + Sound.k007232stream.streamoutput_Ptrs[0][offset + j] += out1 * volA; + Sound.k007232stream.streamoutput_Ptrs[1][offset + j] += out1 * volB; } } } diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/K053260.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/K053260.cs index 4c5e182..c85f18e 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/K053260.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/K053260.cs @@ -2,7 +2,7 @@ namespace MAME.Core { - public class K053260 + public unsafe class K053260 { public struct k053260_channel_def { @@ -226,8 +226,8 @@ namespace MAME.Core { dataR = 32767; } - Sound.k053260stream.streamoutput[1][offset + j] = dataL; - Sound.k053260stream.streamoutput[0][offset + j] = dataR; + Sound.k053260stream.streamoutput_Ptrs[1][offset + j] = dataL; + Sound.k053260stream.streamoutput_Ptrs[0][offset + j] = dataR; } for (i = 0; i < 4; i++) { diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/K054539.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/K054539.cs index e536ce0..eaa0862 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/K054539.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/K054539.cs @@ -3,7 +3,7 @@ using System.IO; namespace MAME.Core { - public class K054539 + public unsafe class K054539 { public struct k054539_channel { @@ -80,7 +80,7 @@ namespace MAME.Core { for (j = 0; j < length; j++) { - Sound.k054539stream.streamoutput[i][offset + j] = 0; + Sound.k054539stream.streamoutput_Ptrs[i][offset + j] = 0; } } samples = k054539rom;//info.rom; @@ -189,8 +189,8 @@ namespace MAME.Core goto end_channel_0; } } - Sound.k054539stream.streamoutput[0][offset1] += (short)(cur_val * lvol); - Sound.k054539stream.streamoutput[1][offset1] += (short)(cur_val * rvol); + Sound.k054539stream.streamoutput_Ptrs[0][offset1] += (short)(cur_val * lvol); + Sound.k054539stream.streamoutput_Ptrs[1][offset1] += (short)(cur_val * rvol); offset1++; info.ram[rdelta] += (short)(cur_val * rbvol); rdelta++; @@ -226,8 +226,8 @@ namespace MAME.Core goto end_channel_4; } } - Sound.k054539stream.streamoutput[0][offset1] += (short)(cur_val * lvol); - Sound.k054539stream.streamoutput[1][offset1] += (short)(cur_val * rvol); + Sound.k054539stream.streamoutput_Ptrs[0][offset1] += (short)(cur_val * lvol); + Sound.k054539stream.streamoutput_Ptrs[1][offset1] += (short)(cur_val * rvol); offset1++; info.ram[rdelta] += (short)(cur_val * rbvol); rdelta++; @@ -285,8 +285,8 @@ namespace MAME.Core cur_val = 32767; } } - Sound.k054539stream.streamoutput[0][offset1] += (short)(cur_val * lvol); - Sound.k054539stream.streamoutput[1][offset1] += (short)(cur_val * rvol); + Sound.k054539stream.streamoutput_Ptrs[0][offset1] += (short)(cur_val * lvol); + Sound.k054539stream.streamoutput_Ptrs[1][offset1] += (short)(cur_val * rvol); offset1++; info.ram[rdelta] += (short)(cur_val * rbvol); rdelta++; @@ -321,8 +321,8 @@ namespace MAME.Core for (i = 0; i < length; i++) { short val = info.ram[(i + reverb_pos) & 0x3fff]; - Sound.k054539stream.streamoutput[0][offset + i] += val; - Sound.k054539stream.streamoutput[1][offset + i] += val; + Sound.k054539stream.streamoutput_Ptrs[0][offset + i] += val; + Sound.k054539stream.streamoutput_Ptrs[1][offset + i] += val; } } if (reverb_pos + length > 0x4000) diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/MSM5205.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/MSM5205.cs index c4de52a..5d94b31 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/MSM5205.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/MSM5205.cs @@ -3,7 +3,7 @@ using System.IO; namespace MAME.Core { - public class MSM5205 + public unsafe class MSM5205 { public struct MSM5205Voice { @@ -58,14 +58,14 @@ namespace MAME.Core short val = (short)(voice.signal * 16); for (i = 0; i < length; i++) { - voice.stream.streamoutput[0][offset + i] = val; + voice.stream.streamoutput_Ptrs[0][offset + i] = val; } } else { for (i = 0; i < length; i++) { - voice.stream.streamoutput[0][offset + i] = 0; + voice.stream.streamoutput_Ptrs[0][offset + i] = 0; } } } diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/Namco.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/Namco.cs index c21d729..f4c26dc 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/Namco.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/Namco.cs @@ -2,7 +2,7 @@ namespace MAME.Core { - public class Namco + public unsafe class Namco { public struct sound_channel { @@ -82,8 +82,8 @@ namespace MAME.Core int counter; for (i = 0; i < length; i++) { - Sound.namcostream.streamoutput[0][offset + i] = 0; - Sound.namcostream.streamoutput[1][offset + i] = 0; + Sound.namcostream.streamoutput_Ptrs[0][offset + i] = 0; + Sound.namcostream.streamoutput_Ptrs[1][offset + i] = 0; } for (voice = 0; voice < 8; voice++) { @@ -105,13 +105,13 @@ namespace MAME.Core int cnt; if (nam1.channel_list[voice].noise_state != 0) { - Sound.namcostream.streamoutput[0][offset + i] += l_noise_data; - Sound.namcostream.streamoutput[1][offset + i] += r_noise_data; + Sound.namcostream.streamoutput_Ptrs[0][offset + i] += l_noise_data; + Sound.namcostream.streamoutput_Ptrs[1][offset + i] += r_noise_data; } else { - Sound.namcostream.streamoutput[0][offset + i] += l_noise_data; - Sound.namcostream.streamoutput[1][offset + i] += r_noise_data; + Sound.namcostream.streamoutput_Ptrs[0][offset + i] += l_noise_data; + Sound.namcostream.streamoutput_Ptrs[1][offset + i] += r_noise_data; } if (hold != 0) { @@ -145,7 +145,7 @@ namespace MAME.Core counter = nam1.channel_list[voice].counter; for (i = 0; i < length; i++) { - Sound.namcostream.streamoutput[0][offset + i] += nam1.waveform[lv][nam1.channel_list[voice].waveform_select * 32 + (counter >> nam1.f_fracbits) & 0x1f]; + Sound.namcostream.streamoutput_Ptrs[0][offset + i] += nam1.waveform[lv][nam1.channel_list[voice].waveform_select * 32 + (counter >> nam1.f_fracbits) & 0x1f]; counter += nam1.channel_list[voice].frequency; } c = counter; @@ -155,7 +155,7 @@ namespace MAME.Core counter = nam1.channel_list[voice].counter; for (i = 0; i < length; i++) { - Sound.namcostream.streamoutput[1][offset + i] += nam1.waveform[rv][nam1.channel_list[voice].waveform_select * 32 + (counter >> nam1.f_fracbits) & 0x1f]; + Sound.namcostream.streamoutput_Ptrs[1][offset + i] += nam1.waveform[rv][nam1.channel_list[voice].waveform_select * 32 + (counter >> nam1.f_fracbits) & 0x1f]; counter += nam1.channel_list[voice].frequency; } c = counter; diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/OKI6295.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/OKI6295.cs index 2d3c02c..b3f31c3 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/OKI6295.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/OKI6295.cs @@ -117,12 +117,12 @@ namespace MAME.Core } //TODO 移动到这里,但是大小,还需要考虑 static short[] sample_data = new short[10000]; - public static void okim6295_update(int offset, int length) + public unsafe static void okim6295_update(int offset, int length) { int i; for (i = 0; i < length; i++) { - Sound.okistream.streamoutput[0][offset + i] = 0; + Sound.okistream.streamoutput_Ptrs[0][offset + i] = 0; } for (i = 0; i < 4; i++) { @@ -136,7 +136,7 @@ namespace MAME.Core generate_adpcm(i, sample_data, samples1); for (samp = 0; samp < length; samp++) { - Sound.okistream.streamoutput[0][offset + samp] += sample_data[samp]; + Sound.okistream.streamoutput_Ptrs[0][offset + samp] += sample_data[samp]; } remaining -= samples1; } diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/QSound.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/QSound.cs index b12df15..06870a8 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/QSound.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/QSound.cs @@ -30,7 +30,7 @@ namespace MAME.Core public int[] pan_table; /* Pan volume table */ public float frq_ratio; /* Frequency ratio */ }; - public class QSound + public unsafe class QSound { public static sbyte[] qsoundrom; public static qsound_info QChip; @@ -159,8 +159,8 @@ namespace MAME.Core int rvol, lvol, count; for (i = 0; i < length; i++) { - Sound.qsoundstream.streamoutput[0][offset + i] = 0; - Sound.qsoundstream.streamoutput[1][offset + i] = 0; + Sound.qsoundstream.streamoutput_Ptrs[0][offset + i] = 0; + Sound.qsoundstream.streamoutput_Ptrs[1][offset + i] = 0; } for (i = 0; i < 16; i++) { @@ -188,8 +188,8 @@ namespace MAME.Core } QChip.channel[i].lastdt = qsoundrom[(QChip.channel[i].bank + QChip.channel[i].address) % (QChip.sample_rom_length)]; } - Sound.qsoundstream.streamoutput[0][offset + j] += ((QChip.channel[i].lastdt * lvol) >> 6); - Sound.qsoundstream.streamoutput[1][offset + j] += ((QChip.channel[i].lastdt * rvol) >> 6); + Sound.qsoundstream.streamoutput_Ptrs[0][offset + j] += ((QChip.channel[i].lastdt * lvol) >> 6); + Sound.qsoundstream.streamoutput_Ptrs[1][offset + j] += ((QChip.channel[i].lastdt * rvol) >> 6); QChip.channel[i].offset += QChip.channel[i].pitch; } } diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/Sample.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/Sample.cs index deae5a8..3ada931 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/Sample.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/Sample.cs @@ -3,7 +3,7 @@ using System.IO; namespace MAME.Core { - public class Sample + public unsafe class Sample { public struct sample_channel { @@ -86,7 +86,7 @@ namespace MAME.Core int sample1 = info.channel[0].source[pos]; int sample2 = info.channel[0].source[(pos + 1) % sample_length]; int fracmult = (int)(frac >> (24 - 14)); - Sound.samplestream.streamoutput[0][offset + i] = ((0x4000 - fracmult) * sample1 + fracmult * sample2) >> 14; + Sound.samplestream.streamoutput_Ptrs[0][offset + i] = ((0x4000 - fracmult) * sample1 + fracmult * sample2) >> 14; frac += step; pos += frac >> 24; frac = frac & ((1 << 24) - 1); @@ -104,7 +104,7 @@ namespace MAME.Core { for (j = i + 1; j < length; j++) { - Sound.samplestream.streamoutput[0][offset + j] = 0; + Sound.samplestream.streamoutput_Ptrs[0][offset + j] = 0; } } break; @@ -118,7 +118,7 @@ namespace MAME.Core { for (i = 0; i < length; i++) { - Sound.samplestream.streamoutput[0][offset + i] = 0; + Sound.samplestream.streamoutput_Ptrs[0][offset + i] = 0; } } } diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/Sound.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/Sound.cs index f468309..ddb58b2 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/Sound.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/Sound.cs @@ -3,7 +3,7 @@ using System; namespace MAME.Core { - public partial class Sound + public unsafe partial class Sound { public static EmuTimer.emu_timer sound_update_timer; private static int[] leftmix, rightmix; @@ -724,7 +724,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int samp; - samp = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[2][sampindex]; + samp = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex]; if (samp < -32768) { samp = -32768; @@ -750,7 +750,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int sampL, sampR; - sampL = mixerstream.streaminput[0][sampindex]; + sampL = mixerstream.streaminput_Ptrs[0][sampindex]; if (sampL < -32768) { sampL = -32768; @@ -759,7 +759,7 @@ namespace MAME.Core { sampL = 32767; } - sampR = mixerstream.streaminput[1][sampindex]; + sampR = mixerstream.streaminput_Ptrs[1][sampindex]; if (sampR < -32768) { sampR = -32768; @@ -791,7 +791,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int samp; - samp = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[2][sampindex] + mixerstream.streaminput[3][sampindex] + mixerstream.streaminput[4][sampindex] + mixerstream.streaminput[5][sampindex]; + samp = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex] + mixerstream.streaminput_Ptrs[4][sampindex] + mixerstream.streaminput_Ptrs[5][sampindex]; if (samp < -32768) { samp = -32768; @@ -821,7 +821,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int samp; - samp = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[2][sampindex] + mixerstream.streaminput[3][sampindex] + mixerstream.streaminput[4][sampindex] + mixerstream.streaminput[5][sampindex] + mixerstream.streaminput[6][sampindex] + mixerstream.streaminput[7][sampindex] + mixerstream.streaminput[8][sampindex]; + samp = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex] + mixerstream.streaminput_Ptrs[4][sampindex] + mixerstream.streaminput_Ptrs[5][sampindex] + mixerstream.streaminput_Ptrs[6][sampindex] + mixerstream.streaminput_Ptrs[7][sampindex] + mixerstream.streaminput_Ptrs[8][sampindex]; if (samp < -32768) { samp = -32768; @@ -849,7 +849,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int sampL, sampR; - sampL = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex]; + sampL = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex]; if (sampL < -32768) { sampL = -32768; @@ -858,7 +858,7 @@ namespace MAME.Core { sampL = 32767; } - sampR = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[2][sampindex]; + sampR = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex]; if (sampR < -32768) { sampR = -32768; @@ -888,7 +888,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int samp; - samp = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[2][sampindex] + mixerstream.streaminput[3][sampindex] + mixerstream.streaminput[4][sampindex]; + samp = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex] + mixerstream.streaminput_Ptrs[4][sampindex]; if (samp < -32768) { samp = -32768; @@ -918,7 +918,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int sampL, sampR; - sampL = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[2][sampindex] + mixerstream.streaminput[4][sampindex]; + sampL = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex] + mixerstream.streaminput_Ptrs[4][sampindex]; if (sampL < -32768) { sampL = -32768; @@ -927,7 +927,7 @@ namespace MAME.Core { sampL = 32767; } - sampR = mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[3][sampindex] + mixerstream.streaminput[4][sampindex]; + sampR = mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex] + mixerstream.streaminput_Ptrs[4][sampindex]; if (sampR < -32768) { sampR = -32768; @@ -955,7 +955,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int samp; - samp = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex]; + samp = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex]; if (samp < -32768) { samp = -32768; @@ -981,7 +981,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int samp; - samp = mixerstream.streaminput[0][sampindex]; + samp = mixerstream.streaminput_Ptrs[0][sampindex]; if (samp < -32768) { samp = -32768; @@ -1009,7 +1009,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int samp; - samp = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[2][sampindex]; + samp = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex]; if (samp < -32768) { samp = -32768; @@ -1035,7 +1035,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int samp; - samp = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex]; + samp = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex]; if (samp < -32768) { samp = -32768; @@ -1061,7 +1061,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int samp; - samp = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex]; + samp = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex]; if (samp < -32768) { samp = -32768; @@ -1089,7 +1089,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int sampL, sampR; - sampL = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[2][sampindex]; + sampL = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex]; if (sampL < -32768) { sampL = -32768; @@ -1098,7 +1098,7 @@ namespace MAME.Core { sampL = 32767; } - sampR = mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[2][sampindex]; + sampR = mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex]; if (sampR < -32768) { sampR = -32768; @@ -1126,7 +1126,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int sampL, sampR; - sampL = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[2][sampindex]; + sampL = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex]; if (sampL < -32768) { sampL = -32768; @@ -1135,7 +1135,7 @@ namespace MAME.Core { sampL = 32767; } - sampR = mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[3][sampindex]; + sampR = mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex]; if (sampR < -32768) { sampR = -32768; @@ -1163,7 +1163,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int samp; - samp = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[2][sampindex] + mixerstream.streaminput[3][sampindex]; + samp = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex]; if (samp < -32768) { samp = -32768; @@ -1193,7 +1193,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int samp; - samp = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[2][sampindex] + mixerstream.streaminput[3][sampindex] + mixerstream.streaminput[4][sampindex]; + samp = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex] + mixerstream.streaminput_Ptrs[4][sampindex]; if (samp < -32768) { samp = -32768; @@ -1223,7 +1223,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int sampL, sampR; - sampL = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[2][sampindex] + mixerstream.streaminput[3][sampindex]; + sampL = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex]; if (sampL < -32768) { sampL = -32768; @@ -1232,7 +1232,7 @@ namespace MAME.Core { sampL = 32767; } - sampR = mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[2][sampindex] + mixerstream.streaminput[3][sampindex]; + sampR = mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex]; if (sampR < -32768) { sampR = -32768; @@ -1260,7 +1260,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int samp; - samp = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[2][sampindex]; + samp = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex]; if (samp < -32768) { samp = -32768; @@ -1286,7 +1286,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int sampL, sampR; - sampL = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex]; + sampL = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex]; if (sampL < -32768) { sampL = -32768; @@ -1295,7 +1295,7 @@ namespace MAME.Core { sampL = 32767; } - sampR = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex]; + sampR = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex]; if (sampR < -32768) { sampR = -32768; @@ -1323,7 +1323,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int sampL, sampR; - sampL = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[2][sampindex] + mixerstream.streaminput[3][sampindex]; + sampL = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex]; if (sampL < -32768) { sampL = -32768; @@ -1332,7 +1332,7 @@ namespace MAME.Core { sampL = 32767; } - sampR = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[2][sampindex] + mixerstream.streaminput[3][sampindex]; + sampR = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex]; if (sampR < -32768) { sampR = -32768; @@ -1364,7 +1364,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int sampL, sampR; - sampL = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[2][sampindex] + mixerstream.streaminput[3][sampindex] + mixerstream.streaminput[4][sampindex] + mixerstream.streaminput[5][sampindex]; + sampL = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex] + mixerstream.streaminput_Ptrs[4][sampindex] + mixerstream.streaminput_Ptrs[5][sampindex]; if (sampL < -32768) { sampL = -32768; @@ -1373,7 +1373,7 @@ namespace MAME.Core { sampL = 32767; } - sampR = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[2][sampindex] + mixerstream.streaminput[3][sampindex] + mixerstream.streaminput[4][sampindex] + mixerstream.streaminput[5][sampindex]; + sampR = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex] + mixerstream.streaminput_Ptrs[4][sampindex] + mixerstream.streaminput_Ptrs[5][sampindex]; if (sampR < -32768) { sampR = -32768; @@ -1401,7 +1401,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int sampL, sampR; - sampL = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[2][sampindex]; + sampL = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex]; if (sampL < -32768) { sampL = -32768; @@ -1410,7 +1410,7 @@ namespace MAME.Core { sampL = 32767; } - sampR = mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[3][sampindex]; + sampR = mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex]; if (sampR < -32768) { sampR = -32768; @@ -1436,7 +1436,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int sampL, sampR; - sampL = mixerstream.streaminput[0][sampindex]; + sampL = mixerstream.streaminput_Ptrs[0][sampindex]; if (sampL < -32768) { sampL = -32768; @@ -1445,7 +1445,7 @@ namespace MAME.Core { sampL = 32767; } - sampR = mixerstream.streaminput[1][sampindex]; + sampR = mixerstream.streaminput_Ptrs[1][sampindex]; if (sampR < -32768) { sampR = -32768; @@ -1473,7 +1473,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int sampL, sampR; - sampL = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[2][sampindex]; + sampL = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex]; if (sampL < -32768) { sampL = -32768; @@ -1482,7 +1482,7 @@ namespace MAME.Core { sampL = 32767; } - sampR = mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[3][sampindex]; + sampR = mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex]; if (sampR < -32768) { sampR = -32768; @@ -1510,7 +1510,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int sampL, sampR; - sampL = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[2][sampindex]; + sampL = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex]; if (sampL < -32768) { sampL = -32768; @@ -1519,7 +1519,7 @@ namespace MAME.Core { sampL = 32767; } - sampR = mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[3][sampindex]; + sampR = mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex]; if (sampR < -32768) { sampR = -32768; @@ -1547,7 +1547,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int sampL, sampR; - sampL = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[2][sampindex]; + sampL = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex]; if (sampL < -32768) { sampL = -32768; @@ -1556,7 +1556,7 @@ namespace MAME.Core { sampL = 32767; } - sampR = mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[3][sampindex]; + sampR = mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex]; if (sampR < -32768) { sampR = -32768; @@ -1582,7 +1582,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int sampL, sampR; - sampL = mixerstream.streaminput[0][sampindex]; + sampL = mixerstream.streaminput_Ptrs[0][sampindex]; if (sampL < -32768) { sampL = -32768; @@ -1591,7 +1591,7 @@ namespace MAME.Core { sampL = 32767; } - sampR = mixerstream.streaminput[1][sampindex]; + sampR = mixerstream.streaminput_Ptrs[1][sampindex]; if (sampR < -32768) { sampR = -32768; @@ -1623,7 +1623,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int samp; - samp = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[2][sampindex] + mixerstream.streaminput[3][sampindex] + mixerstream.streaminput[4][sampindex] + mixerstream.streaminput[5][sampindex] + mixerstream.streaminput[6][sampindex] + mixerstream.streaminput[7][sampindex]; + samp = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex] + mixerstream.streaminput_Ptrs[4][sampindex] + mixerstream.streaminput_Ptrs[5][sampindex] + mixerstream.streaminput_Ptrs[6][sampindex] + mixerstream.streaminput_Ptrs[7][sampindex]; if (samp < -32768) { samp = -32768; @@ -1653,7 +1653,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int sampL, sampR; - sampL = mixerstream.streaminput[0][sampindex] + mixerstream.streaminput[2][sampindex] + mixerstream.streaminput[3][sampindex]; + sampL = mixerstream.streaminput_Ptrs[0][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex]; if (sampL < -32768) { sampL = -32768; @@ -1662,7 +1662,7 @@ namespace MAME.Core { sampL = 32767; } - sampR = mixerstream.streaminput[1][sampindex] + mixerstream.streaminput[2][sampindex] + mixerstream.streaminput[3][sampindex]; + sampR = mixerstream.streaminput_Ptrs[1][sampindex] + mixerstream.streaminput_Ptrs[2][sampindex] + mixerstream.streaminput_Ptrs[3][sampindex]; if (sampR < -32768) { sampR = -32768; diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/Streams.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/Streams.cs index 42535fd..21eb07f 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/Streams.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/Streams.cs @@ -1,8 +1,9 @@ using System; +using System.Runtime.InteropServices; namespace MAME.Core { - public class sound_stream + public unsafe class sound_stream { public int sample_rate; public int new_sample_rate; @@ -13,7 +14,15 @@ namespace MAME.Core public int outputs; public int output_sampindex; public int output_base_sampindex; - public int[][] streaminput, streamoutput; + //改成指针读取 + private int[][] streaminput; + GCHandle[] streaminput_handles; + public int*[] streaminput_Ptrs; + //改成指针读取 + private int[][] streamoutput; + GCHandle[] streamoutput_handles; + public int*[] streamoutput_Ptrs; + private updatedelegate updatecallback; public delegate void updatedelegate(int offset, int length); public sound_stream(int _sample_rate, int _inputs, int _outputs, updatedelegate callback) @@ -26,17 +35,57 @@ namespace MAME.Core max_samples_per_update = (int)((Sound.update_attoseconds + attoseconds_per_sample - 1) / attoseconds_per_sample); output_base_sampindex = -max_samples_per_update; streaminput = new int[inputs][]; + // + streaminput_handles = new GCHandle[inputs]; + streaminput_Ptrs = new int*[inputs]; for (i = 0; i < inputs; i++) { streaminput[i] = new int[max_samples_per_update]; + // + streaminput_handles[i] = GCHandle.Alloc(streaminput[i], GCHandleType.Pinned); + streaminput_Ptrs[i] = (int*)streaminput_handles[i].AddrOfPinnedObject(); + } streamoutput = new int[outputs][]; + // + streamoutput_handles = new GCHandle[outputs]; + streamoutput_Ptrs = new int*[outputs]; for (i = 0; i < outputs; i++) { streamoutput[i] = new int[5 * max_samples_per_update]; + // + streamoutput_handles[i] = GCHandle.Alloc(streamoutput[i], GCHandleType.Pinned); + streamoutput_Ptrs[i] = (int*)streamoutput_handles[i].AddrOfPinnedObject(); } updatecallback = callback; } + + ~sound_stream() + { + // 释放句柄 + if (streaminput_handles != null) + { + for (int i = 0; i < streaminput_handles.Length; i++) + { + if (streaminput_handles[i].IsAllocated) + streaminput_handles[i].Free(); + } + streaminput_handles = null; + streaminput_Ptrs = null; + } + + + if (streamoutput_handles != null) + { + for (int i = 0; i < streamoutput_handles.Length; i++) + { + if (streamoutput_handles[i].IsAllocated) + streamoutput_handles[i].Free(); + } + streamoutput_handles = null; + streamoutput_Ptrs = null; + } + } public void stream_update() { int update_sampindex = time_to_sampindex(EmuTimer.get_current_time()); @@ -103,7 +152,7 @@ namespace MAME.Core } } }; - public partial class Sound + public unsafe partial class Sound { public static int last_update_second; public static sound_stream ym2151stream, okistream, mixerstream; @@ -119,7 +168,7 @@ namespace MAME.Core public static sound_stream samplestream; public static sound_stream k054539stream; public static long update_attoseconds = Attotime.ATTOSECONDS_PER_SECOND / 50; - private static void generate_resampled_dataY5(int gain) + private unsafe static void generate_resampled_dataY5(int gain) { int offset; int sample0, sample1; @@ -145,30 +194,30 @@ namespace MAME.Core int tpos = 0; int scale; scale = (int)((0x400000 - basefrac) >> 14); - sample0 = ym2151stream.streamoutput[0][offset + tpos] * scale; - sample1 = ym2151stream.streamoutput[1][offset + tpos] * scale; + sample0 = ym2151stream.streamoutput_Ptrs[0][offset + tpos] * scale; + sample1 = ym2151stream.streamoutput_Ptrs[1][offset + tpos] * scale; tpos++; remainder -= scale; while (remainder > 0x100) { - sample0 += ym2151stream.streamoutput[0][offset + tpos] * 0x100; - sample1 += ym2151stream.streamoutput[1][offset + tpos] * 0x100; + sample0 += ym2151stream.streamoutput_Ptrs[0][offset + tpos] * 0x100; + sample1 += ym2151stream.streamoutput_Ptrs[1][offset + tpos] * 0x100; tpos++; remainder -= 0x100; } - sample0 += ym2151stream.streamoutput[0][offset + tpos] * remainder; - sample1 += ym2151stream.streamoutput[1][offset + tpos] * remainder; + sample0 += ym2151stream.streamoutput_Ptrs[0][offset + tpos] * remainder; + sample1 += ym2151stream.streamoutput_Ptrs[1][offset + tpos] * remainder; sample0 /= smallstep; sample1 /= smallstep; - mixerstream.streaminput[0][sampindex] = (sample0 * gain) >> 8; - mixerstream.streaminput[1][sampindex] = (sample1 * gain) >> 8; + mixerstream.streaminput_Ptrs[0][sampindex] = (sample0 * gain) >> 8; + mixerstream.streaminput_Ptrs[1][sampindex] = (sample1 * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; } } } - private static void generate_resampled_dataO(int gain, int minput) + private unsafe static void generate_resampled_dataO(int gain, int minput) { int offset; int sample; @@ -190,8 +239,8 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int interp_frac = (int)(basefrac >> 10); - sample = (okistream.streamoutput[0][offset] * (0x1000 - interp_frac) + okistream.streamoutput[0][offset + 1] * interp_frac) >> 12; - mixerstream.streaminput[minput][sampindex] = (sample * gain) >> 8; + sample = (okistream.streamoutput_Ptrs[0][offset] * (0x1000 - interp_frac) + okistream.streamoutput_Ptrs[0][offset + 1] * interp_frac) >> 12; + mixerstream.streaminput_Ptrs[minput][sampindex] = (sample * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -219,8 +268,8 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int interp_frac = (int)(basefrac >> 10); - mixerstream.streaminput[0][sampindex] = (qsoundstream.streamoutput[0][offset] * (0x1000 - interp_frac) + qsoundstream.streamoutput[0][offset + 1] * interp_frac) >> 12; - mixerstream.streaminput[1][sampindex] = (qsoundstream.streamoutput[1][offset] * (0x1000 - interp_frac) + qsoundstream.streamoutput[1][offset + 1] * interp_frac) >> 12; + mixerstream.streaminput_Ptrs[0][sampindex] = (qsoundstream.streamoutput_Ptrs[0][offset] * (0x1000 - interp_frac) + qsoundstream.streamoutput_Ptrs[0][offset + 1] * interp_frac) >> 12; + mixerstream.streaminput_Ptrs[1][sampindex] = (qsoundstream.streamoutput_Ptrs[1][offset] * (0x1000 - interp_frac) + qsoundstream.streamoutput_Ptrs[1][offset + 1] * interp_frac) >> 12; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -253,18 +302,18 @@ namespace MAME.Core int tpos = 0; int scale; scale = (int)((0x400000 - basefrac) >> 14); - sample = AY8910.AA8910[0].stream.streamoutput[0][offset + tpos] * scale; + sample = AY8910.AA8910[0].stream.streamoutput_Ptrs[0][offset + tpos] * scale; tpos++; remainder -= scale; while (remainder > 0x100) { - sample += AY8910.AA8910[0].stream.streamoutput[0][offset + tpos] * 0x100; + sample += AY8910.AA8910[0].stream.streamoutput_Ptrs[0][offset + tpos] * 0x100; tpos++; remainder -= 0x100; } - sample += AY8910.AA8910[0].stream.streamoutput[0][offset + tpos] * remainder; + sample += AY8910.AA8910[0].stream.streamoutput_Ptrs[0][offset + tpos] * remainder; sample /= smallstep; - mixerstream.streaminput[0][sampindex] = (sample * 0x99) >> 8; + mixerstream.streaminput_Ptrs[0][sampindex] = (sample * 0x99) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -297,28 +346,28 @@ namespace MAME.Core int tpos = 0; int scale; scale = (int)((0x400000 - basefrac) >> 14); - sample0 = AY8910.AA8910[chip].stream.streamoutput[0][offset + tpos] * scale; - sample1 = AY8910.AA8910[chip].stream.streamoutput[1][offset + tpos] * scale; - sample2 = AY8910.AA8910[chip].stream.streamoutput[2][offset + tpos] * scale; + sample0 = AY8910.AA8910[chip].stream.streamoutput_Ptrs[0][offset + tpos] * scale; + sample1 = AY8910.AA8910[chip].stream.streamoutput_Ptrs[1][offset + tpos] * scale; + sample2 = AY8910.AA8910[chip].stream.streamoutput_Ptrs[2][offset + tpos] * scale; tpos++; remainder -= scale; while (remainder > 0x100) { - sample0 += AY8910.AA8910[chip].stream.streamoutput[0][offset + tpos] * 0x100; - sample1 += AY8910.AA8910[chip].stream.streamoutput[1][offset + tpos] * 0x100; - sample2 += AY8910.AA8910[chip].stream.streamoutput[2][offset + tpos] * 0x100; + sample0 += AY8910.AA8910[chip].stream.streamoutput_Ptrs[0][offset + tpos] * 0x100; + sample1 += AY8910.AA8910[chip].stream.streamoutput_Ptrs[1][offset + tpos] * 0x100; + sample2 += AY8910.AA8910[chip].stream.streamoutput_Ptrs[2][offset + tpos] * 0x100; tpos++; remainder -= 0x100; } - sample0 += AY8910.AA8910[chip].stream.streamoutput[0][offset + tpos] * remainder; - sample1 += AY8910.AA8910[chip].stream.streamoutput[1][offset + tpos] * remainder; - sample2 += AY8910.AA8910[chip].stream.streamoutput[2][offset + tpos] * remainder; + sample0 += AY8910.AA8910[chip].stream.streamoutput_Ptrs[0][offset + tpos] * remainder; + sample1 += AY8910.AA8910[chip].stream.streamoutput_Ptrs[1][offset + tpos] * remainder; + sample2 += AY8910.AA8910[chip].stream.streamoutput_Ptrs[2][offset + tpos] * remainder; sample0 /= smallstep; sample1 /= smallstep; sample2 /= smallstep; - mixerstream.streaminput[start][sampindex] = (sample0 * gain) >> 8; - mixerstream.streaminput[start + 1][sampindex] = (sample1 * gain) >> 8; - mixerstream.streaminput[start + 2][sampindex] = (sample2 * gain) >> 8; + mixerstream.streaminput_Ptrs[start][sampindex] = (sample0 * gain) >> 8; + mixerstream.streaminput_Ptrs[start + 1][sampindex] = (sample1 * gain) >> 8; + mixerstream.streaminput_Ptrs[start + 2][sampindex] = (sample2 * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -353,18 +402,18 @@ namespace MAME.Core int tpos = 0; int scale; scale = (int)((0x400000 - basefrac) >> 14); - sample = AY8910.AA8910[0].stream.streamoutput[0][offset + tpos] * scale; + sample = AY8910.AA8910[0].stream.streamoutput_Ptrs[0][offset + tpos] * scale; tpos++; remainder -= scale; while (remainder > 0x100) { - sample += AY8910.AA8910[0].stream.streamoutput[0][offset + tpos] * 0x100; + sample += AY8910.AA8910[0].stream.streamoutput_Ptrs[0][offset + tpos] * 0x100; tpos++; remainder -= 0x100; } - sample += AY8910.AA8910[0].stream.streamoutput[0][offset + tpos] * remainder; + sample += AY8910.AA8910[0].stream.streamoutput_Ptrs[0][offset + tpos] * remainder; sample /= smallstep; - mixerstream.streaminput[0][sampindex] = (sample * gain) >> 8; + mixerstream.streaminput_Ptrs[0][sampindex] = (sample * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -392,10 +441,10 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int interp_frac = (int)(basefrac >> 10); - int i2 = YM2203.FF2203[c].stream.streamoutput[0][offset]; - int i3 = YM2203.FF2203[c].stream.streamoutput[0][offset + 1]; - int i4 = (((YM2203.FF2203[c].stream.streamoutput[0][offset] * (0x1000 - interp_frac) + YM2203.FF2203[c].stream.streamoutput[0][offset + 1] * interp_frac) >> 12) * gain) >> 8; - mixerstream.streaminput[minput][sampindex] = (((YM2203.FF2203[c].stream.streamoutput[0][offset] * (0x1000 - interp_frac) + YM2203.FF2203[c].stream.streamoutput[0][offset + 1] * interp_frac) >> 12) * gain) >> 8; + int i2 = YM2203.FF2203[c].stream.streamoutput_Ptrs[0][offset]; + int i3 = YM2203.FF2203[c].stream.streamoutput_Ptrs[0][offset + 1]; + int i4 = (((YM2203.FF2203[c].stream.streamoutput_Ptrs[0][offset] * (0x1000 - interp_frac) + YM2203.FF2203[c].stream.streamoutput_Ptrs[0][offset + 1] * interp_frac) >> 12) * gain) >> 8; + mixerstream.streaminput_Ptrs[minput][sampindex] = (((YM2203.FF2203[c].stream.streamoutput_Ptrs[0][offset] * (0x1000 - interp_frac) + YM2203.FF2203[c].stream.streamoutput_Ptrs[0][offset + 1] * interp_frac) >> 12) * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -423,7 +472,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int interp_frac = (int)(basefrac >> 10); - mixerstream.streaminput[minput][sampindex] = (((ym3526stream.streamoutput[0][offset] * (0x1000 - interp_frac) + ym3526stream.streamoutput[0][offset + 1] * interp_frac) >> 12) * gain) >> 8; + mixerstream.streaminput_Ptrs[minput][sampindex] = (((ym3526stream.streamoutput_Ptrs[0][offset] * (0x1000 - interp_frac) + ym3526stream.streamoutput_Ptrs[0][offset + 1] * interp_frac) >> 12) * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -456,23 +505,23 @@ namespace MAME.Core int tpos = 0; int scale; scale = (int)((0x400000 - basefrac) >> 14); - sample0 = ym2610stream.streamoutput[0][offset + tpos] * scale; - sample1 = ym2610stream.streamoutput[1][offset + tpos] * scale; + sample0 = ym2610stream.streamoutput_Ptrs[0][offset + tpos] * scale; + sample1 = ym2610stream.streamoutput_Ptrs[1][offset + tpos] * scale; tpos++; remainder -= scale; while (remainder > 0x100) { - sample0 += ym2610stream.streamoutput[0][offset + tpos] * 0x100; - sample1 += ym2610stream.streamoutput[1][offset + tpos] * 0x100; + sample0 += ym2610stream.streamoutput_Ptrs[0][offset + tpos] * 0x100; + sample1 += ym2610stream.streamoutput_Ptrs[1][offset + tpos] * 0x100; tpos++; remainder -= 0x100; } - sample0 += ym2610stream.streamoutput[0][offset + tpos] * remainder; - sample1 += ym2610stream.streamoutput[1][offset + tpos] * remainder; + sample0 += ym2610stream.streamoutput_Ptrs[0][offset + tpos] * remainder; + sample1 += ym2610stream.streamoutput_Ptrs[1][offset + tpos] * remainder; sample0 /= smallstep; sample1 /= smallstep; - mixerstream.streaminput[1][sampindex] = sample0; - mixerstream.streaminput[2][sampindex] = sample1; + mixerstream.streaminput_Ptrs[1][sampindex] = sample0; + mixerstream.streaminput_Ptrs[2][sampindex] = sample1; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -507,23 +556,23 @@ namespace MAME.Core int tpos = 0; int scale; scale = (int)((0x400000 - basefrac) >> (14)); - sample0 = namcostream.streamoutput[0][offset + tpos] * scale; - sample1 = namcostream.streamoutput[1][offset + tpos] * scale; + sample0 = namcostream.streamoutput_Ptrs[0][offset + tpos] * scale; + sample1 = namcostream.streamoutput_Ptrs[1][offset + tpos] * scale; tpos++; remainder -= scale; while (remainder > 0x100) { - sample0 += namcostream.streamoutput[0][offset + tpos] * 0x100; - sample1 += namcostream.streamoutput[1][offset + tpos] * 0x100; + sample0 += namcostream.streamoutput_Ptrs[0][offset + tpos] * 0x100; + sample1 += namcostream.streamoutput_Ptrs[1][offset + tpos] * 0x100; tpos++; remainder -= 0x100; } - sample0 += namcostream.streamoutput[0][offset + tpos] * remainder; - sample1 += namcostream.streamoutput[1][offset + tpos] * remainder; + sample0 += namcostream.streamoutput_Ptrs[0][offset + tpos] * remainder; + sample1 += namcostream.streamoutput_Ptrs[1][offset + tpos] * remainder; sample0 /= smallstep; sample1 /= smallstep; - mixerstream.streaminput[2][sampindex] = (sample0 * gain) >> 8; - mixerstream.streaminput[3][sampindex] = (sample1 * gain) >> 8; + mixerstream.streaminput_Ptrs[2][sampindex] = (sample0 * gain) >> 8; + mixerstream.streaminput_Ptrs[3][sampindex] = (sample1 * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -556,18 +605,18 @@ namespace MAME.Core int tpos = 0; int scale; scale = (int)((0x400000 - basefrac) >> (14)); - sample = dacstream.streamoutput[0][offset + tpos] * scale; + sample = dacstream.streamoutput_Ptrs[0][offset + tpos] * scale; tpos++; remainder -= scale; while (remainder > 0x100) { - sample += dacstream.streamoutput[0][offset + tpos] * 0x100; + sample += dacstream.streamoutput_Ptrs[0][offset + tpos] * 0x100; tpos++; remainder -= 0x100; } - sample += dacstream.streamoutput[0][offset + tpos] * remainder; + sample += dacstream.streamoutput_Ptrs[0][offset + tpos] * remainder; sample /= smallstep; - mixerstream.streaminput[minput][sampindex] = (sample * gain) >> 8; + mixerstream.streaminput_Ptrs[minput][sampindex] = (sample * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -600,23 +649,23 @@ namespace MAME.Core int tpos = 0; int scale; scale = (int)((0x400000 - basefrac) >> 14); - sample0 = ym2413stream.streamoutput[0][offset + tpos] * scale; - sample1 = ym2413stream.streamoutput[1][offset + tpos] * scale; + sample0 = ym2413stream.streamoutput_Ptrs[0][offset + tpos] * scale; + sample1 = ym2413stream.streamoutput_Ptrs[1][offset + tpos] * scale; tpos++; remainder -= scale; while (remainder > 0x100) { - sample0 += ym2413stream.streamoutput[0][offset + tpos] * 0x100; - sample1 += ym2413stream.streamoutput[1][offset + tpos] * 0x100; + sample0 += ym2413stream.streamoutput_Ptrs[0][offset + tpos] * 0x100; + sample1 += ym2413stream.streamoutput_Ptrs[1][offset + tpos] * 0x100; tpos++; remainder -= 0x100; } - sample0 += ym2413stream.streamoutput[0][offset + tpos] * remainder; - sample1 += ym2413stream.streamoutput[1][offset + tpos] * remainder; + sample0 += ym2413stream.streamoutput_Ptrs[0][offset + tpos] * remainder; + sample1 += ym2413stream.streamoutput_Ptrs[1][offset + tpos] * remainder; sample0 /= smallstep; sample1 /= smallstep; - mixerstream.streaminput[minput][sampindex] = (sample0 * gain) >> 8; - mixerstream.streaminput[minput + 1][sampindex] = (sample1 * gain) >> 8; + mixerstream.streaminput_Ptrs[minput][sampindex] = (sample0 * gain) >> 8; + mixerstream.streaminput_Ptrs[minput + 1][sampindex] = (sample1 * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -649,18 +698,18 @@ namespace MAME.Core int tpos = 0; int scale; scale = (int)((0x400000 - basefrac) >> 14); - sample = ym3812stream.streamoutput[0][offset + tpos] * scale; + sample = ym3812stream.streamoutput_Ptrs[0][offset + tpos] * scale; tpos++; remainder -= scale; while (remainder > 0x100) { - sample += ym3812stream.streamoutput[0][offset + tpos] * 0x100; + sample += ym3812stream.streamoutput_Ptrs[0][offset + tpos] * 0x100; tpos++; remainder -= 0x100; } - sample += ym3812stream.streamoutput[0][offset + tpos] * remainder; + sample += ym3812stream.streamoutput_Ptrs[0][offset + tpos] * remainder; sample /= smallstep; - mixerstream.streaminput[minput][sampindex] = (sample * gain) >> 8; + mixerstream.streaminput_Ptrs[minput][sampindex] = (sample * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -671,7 +720,7 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int interp_frac = (int)(basefrac >> 10); - mixerstream.streaminput[minput][sampindex] = (((ym3812stream.streamoutput[0][offset] * (0x1000 - interp_frac) + ym3812stream.streamoutput[0][offset + 1] * interp_frac) >> 12) * gain) >> 8; + mixerstream.streaminput_Ptrs[minput][sampindex] = (((ym3812stream.streamoutput_Ptrs[0][offset] * (0x1000 - interp_frac) + ym3812stream.streamoutput_Ptrs[0][offset + 1] * interp_frac) >> 12) * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -699,8 +748,8 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int interp_frac = (int)(basefrac >> 10); - mixerstream.streaminput[0][sampindex] = (((ics2115stream.streamoutput[0][offset] * (0x1000 - interp_frac) + ics2115stream.streamoutput[0][offset + 1] * interp_frac) >> 12) * gain) >> 8; - mixerstream.streaminput[1][sampindex] = (((ics2115stream.streamoutput[1][offset] * (0x1000 - interp_frac) + ics2115stream.streamoutput[1][offset + 1] * interp_frac) >> 12) * gain) >> 8; + mixerstream.streaminput_Ptrs[0][sampindex] = (((ics2115stream.streamoutput_Ptrs[0][offset] * (0x1000 - interp_frac) + ics2115stream.streamoutput_Ptrs[0][offset + 1] * interp_frac) >> 12) * gain) >> 8; + mixerstream.streaminput_Ptrs[1][sampindex] = (((ics2115stream.streamoutput_Ptrs[1][offset] * (0x1000 - interp_frac) + ics2115stream.streamoutput_Ptrs[1][offset + 1] * interp_frac) >> 12) * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -733,23 +782,23 @@ namespace MAME.Core int tpos = 0; int scale; scale = (int)((0x400000 - basefrac) >> 14); - sample0 = iremga20stream.streamoutput[0][offset + tpos] * scale; - sample1 = iremga20stream.streamoutput[1][offset + tpos] * scale; + sample0 = iremga20stream.streamoutput_Ptrs[0][offset + tpos] * scale; + sample1 = iremga20stream.streamoutput_Ptrs[1][offset + tpos] * scale; tpos++; remainder -= scale; while (remainder > 0x100) { - sample0 += iremga20stream.streamoutput[0][offset + tpos] * 0x100; - sample1 += iremga20stream.streamoutput[1][offset + tpos] * 0x100; + sample0 += iremga20stream.streamoutput_Ptrs[0][offset + tpos] * 0x100; + sample1 += iremga20stream.streamoutput_Ptrs[1][offset + tpos] * 0x100; tpos++; remainder -= 0x100; } - sample0 += iremga20stream.streamoutput[0][offset + tpos] * remainder; - sample1 += iremga20stream.streamoutput[1][offset + tpos] * remainder; + sample0 += iremga20stream.streamoutput_Ptrs[0][offset + tpos] * remainder; + sample1 += iremga20stream.streamoutput_Ptrs[1][offset + tpos] * remainder; sample0 /= smallstep; sample1 /= smallstep; - mixerstream.streaminput[2][sampindex] = (sample0 * gain) >> 8; - mixerstream.streaminput[3][sampindex] = (sample1 * gain) >> 8; + mixerstream.streaminput_Ptrs[2][sampindex] = (sample0 * gain) >> 8; + mixerstream.streaminput_Ptrs[3][sampindex] = (sample1 * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -782,23 +831,23 @@ namespace MAME.Core int tpos = 0; int scale; scale = (int)((0x400000 - basefrac) >> 14); - sample0 = k053260stream.streamoutput[0][offset + tpos] * scale; - sample1 = k053260stream.streamoutput[1][offset + tpos] * scale; + sample0 = k053260stream.streamoutput_Ptrs[0][offset + tpos] * scale; + sample1 = k053260stream.streamoutput_Ptrs[1][offset + tpos] * scale; tpos++; remainder -= scale; while (remainder > 0x100) { - sample0 += k053260stream.streamoutput[0][offset + tpos] * 0x100; - sample1 += k053260stream.streamoutput[1][offset + tpos] * 0x100; + sample0 += k053260stream.streamoutput_Ptrs[0][offset + tpos] * 0x100; + sample1 += k053260stream.streamoutput_Ptrs[1][offset + tpos] * 0x100; tpos++; remainder -= 0x100; } - sample0 += k053260stream.streamoutput[0][offset + tpos] * remainder; - sample1 += k053260stream.streamoutput[1][offset + tpos] * remainder; + sample0 += k053260stream.streamoutput_Ptrs[0][offset + tpos] * remainder; + sample1 += k053260stream.streamoutput_Ptrs[1][offset + tpos] * remainder; sample0 /= smallstep; sample1 /= smallstep; - mixerstream.streaminput[minput1][sampindex] = (sample0 * gain) >> 8; - mixerstream.streaminput[minput2][sampindex] = (sample1 * gain) >> 8; + mixerstream.streaminput_Ptrs[minput1][sampindex] = (sample0 * gain) >> 8; + mixerstream.streaminput_Ptrs[minput2][sampindex] = (sample1 * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -826,8 +875,8 @@ namespace MAME.Core for (sampindex = 0; sampindex < 0x3c0; sampindex++) { int interp_frac = (int)(basefrac >> 10); - mixerstream.streaminput[2][sampindex] = (((k007232stream.streamoutput[0][offset] * (0x1000 - interp_frac) + k007232stream.streamoutput[0][offset + 1] * interp_frac) >> 12) * gain) >> 8; - mixerstream.streaminput[3][sampindex] = (((k007232stream.streamoutput[1][offset] * (0x1000 - interp_frac) + k007232stream.streamoutput[1][offset + 1] * interp_frac) >> 12) * gain) >> 8; + mixerstream.streaminput_Ptrs[2][sampindex] = (((k007232stream.streamoutput_Ptrs[0][offset] * (0x1000 - interp_frac) + k007232stream.streamoutput_Ptrs[0][offset + 1] * interp_frac) >> 12) * gain) >> 8; + mixerstream.streaminput_Ptrs[3][sampindex] = (((k007232stream.streamoutput_Ptrs[1][offset] * (0x1000 - interp_frac) + k007232stream.streamoutput_Ptrs[1][offset + 1] * interp_frac) >> 12) * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -860,18 +909,18 @@ namespace MAME.Core int tpos = 0; int scale; scale = (int)((0x400000 - basefrac) >> 14); - sample = upd7759stream.streamoutput[0][offset + tpos] * scale; + sample = upd7759stream.streamoutput_Ptrs[0][offset + tpos] * scale; tpos++; remainder -= scale; while (remainder > 0x100) { - sample += upd7759stream.streamoutput[0][offset + tpos] * 0x100; + sample += upd7759stream.streamoutput_Ptrs[0][offset + tpos] * 0x100; tpos++; remainder -= 0x100; } - sample += upd7759stream.streamoutput[0][offset + tpos] * remainder; + sample += upd7759stream.streamoutput_Ptrs[0][offset + tpos] * remainder; sample /= smallstep; - mixerstream.streaminput[4][sampindex] = (sample * gain) >> 8; + mixerstream.streaminput_Ptrs[4][sampindex] = (sample * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -898,7 +947,7 @@ namespace MAME.Core { for (sampindex = 0; sampindex < 0x3c0; sampindex++) { - mixerstream.streaminput[minput][sampindex] = (samplestream.streamoutput[0][offset + sampindex] * gain) >> 8; + mixerstream.streaminput_Ptrs[minput][sampindex] = (samplestream.streamoutput_Ptrs[0][offset + sampindex] * gain) >> 8; } } } @@ -922,8 +971,8 @@ namespace MAME.Core { for (sampindex = 0; sampindex < 0x3c0; sampindex++) { - mixerstream.streaminput[0][sampindex] = (k054539stream.streamoutput[0][offset + sampindex] * gain) >> 8; - mixerstream.streaminput[1][sampindex] = (k054539stream.streamoutput[1][offset + sampindex] * gain) >> 8; + mixerstream.streaminput_Ptrs[0][sampindex] = (k054539stream.streamoutput_Ptrs[0][offset + sampindex] * gain) >> 8; + mixerstream.streaminput_Ptrs[1][sampindex] = (k054539stream.streamoutput_Ptrs[1][offset + sampindex] * gain) >> 8; } } } @@ -953,18 +1002,18 @@ namespace MAME.Core int tpos = 0; int scale; scale = (int)((0x400000 - basefrac) >> 14); - sample = MSM5205.mm1[0].voice.stream.streamoutput[0][offset + tpos] * scale; + sample = MSM5205.mm1[0].voice.stream.streamoutput_Ptrs[0][offset + tpos] * scale; tpos++; remainder -= scale; while (remainder > 0x100) { - sample += MSM5205.mm1[0].voice.stream.streamoutput[0][offset + tpos] * 0x100; + sample += MSM5205.mm1[0].voice.stream.streamoutput_Ptrs[0][offset + tpos] * 0x100; tpos++; remainder -= 0x100; } - sample += MSM5205.mm1[0].voice.stream.streamoutput[0][offset + tpos] * remainder; + sample += MSM5205.mm1[0].voice.stream.streamoutput_Ptrs[0][offset + tpos] * remainder; sample /= smallstep; - mixerstream.streaminput[minput][sampindex] = (sample * gain) >> 8; + mixerstream.streaminput_Ptrs[minput][sampindex] = (sample * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; @@ -997,18 +1046,18 @@ namespace MAME.Core int tpos = 0; int scale; scale = (int)((0x400000 - basefrac) >> 14); - sample = MSM5205.mm1[1].voice.stream.streamoutput[0][offset + tpos] * scale; + sample = MSM5205.mm1[1].voice.stream.streamoutput_Ptrs[0][offset + tpos] * scale; tpos++; remainder -= scale; while (remainder > 0x100) { - sample += MSM5205.mm1[1].voice.stream.streamoutput[0][offset + tpos] * 0x100; + sample += MSM5205.mm1[1].voice.stream.streamoutput_Ptrs[0][offset + tpos] * 0x100; tpos++; remainder -= 0x100; } - sample += MSM5205.mm1[1].voice.stream.streamoutput[0][offset + tpos] * remainder; + sample += MSM5205.mm1[1].voice.stream.streamoutput_Ptrs[0][offset + tpos] * remainder; sample /= smallstep; - mixerstream.streaminput[minput][sampindex] = (sample * gain) >> 8; + mixerstream.streaminput_Ptrs[minput][sampindex] = (sample * gain) >> 8; basefrac += step; offset += (int)(basefrac >> 22); basefrac &= 0x3fffff; diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/Upd7759.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/Upd7759.cs index 9c58b0e..153ecb0 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/Upd7759.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/Upd7759.cs @@ -2,7 +2,7 @@ namespace MAME.Core { - public class Upd7759 + public unsafe class Upd7759 { public struct upd7759_chip { @@ -219,7 +219,7 @@ namespace MAME.Core { for (i = 0; i < length; i++) { - Sound.upd7759stream.streamoutput[0][offset + i] = sample << 7; + Sound.upd7759stream.streamoutput_Ptrs[0][offset + i] = sample << 7; pos += step; while (updrom != null && pos >= 0x100000) { @@ -247,7 +247,7 @@ namespace MAME.Core { for (j = i; j < length; j++) { - Sound.upd7759stream.streamoutput[0][offset + j] = 0; + Sound.upd7759stream.streamoutput_Ptrs[0][offset + j] = 0; } } chip.clocks_left = clocks_left; diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/YM2151.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/YM2151.cs index 1b40bb5..97186ac 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/YM2151.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/YM2151.cs @@ -1785,16 +1785,18 @@ namespace MAME.Core fixed (uint* PSGfreqPtr = &PSG.freq[0]) fixed (YM2151Operator* PSGoperPtr = &PSG.oper[0]) fixed (int* chanoutPtr = &chanout[0]) - fixed (int* streamoutput0Ptr = &Sound.ym2151stream.streamoutput[0][0]) - fixed (int* streamoutput1Ptr = &Sound.ym2151stream.streamoutput[0][1]) + //fixed (int* streamoutput0Ptr = &Sound.ym2151stream.streamoutput_Ptrs[0][0]) + //fixed (int* streamoutput1Ptr = &Sound.ym2151stream.streamoutput_Ptrs[0][1]) fixed (int* imemPtr = &imem[0]) { YM2151Operator* PSGoper = PSGoperPtr; uint* PSGpan = PSGpanPtr; uint* PSGfreq = PSGfreqPtr; int* chanout = chanoutPtr; - int* streamoutput0 = streamoutput0Ptr; - int* streamoutput1 = streamoutput1Ptr; + //int* streamoutput0 = streamoutput0Ptr; + //int* streamoutput1 = streamoutput1Ptr; + int* streamoutput0 = &Sound.ym2151stream.streamoutput_Ptrs[0][0]; + int* streamoutput1 = &Sound.ym2151stream.streamoutput_Ptrs[0][1]; int* imem = imemPtr; int i; @@ -1911,8 +1913,8 @@ namespace MAME.Core // { // outr = -32768; // } - // Sound.ym2151stream.streamoutput[0][offset + i] = outl; - // Sound.ym2151stream.streamoutput[1][offset + i] = outr; + // Sound.ym2151stream.streamoutput_Ptrs[0][offset + i] = outl; + // Sound.ym2151stream.streamoutput_Ptrs[1][offset + i] = outr; // advance(); // } //} diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/YM2203.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/YM2203.cs index 288c587..7b1478b 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/YM2203.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/YM2203.cs @@ -2,7 +2,7 @@ namespace MAME.Core { - public class YM2203 + public unsafe class YM2203 { public byte[] REGS; public FM.FM_OPN OPN; @@ -273,7 +273,7 @@ namespace MAME.Core lt = FM.out_fm[0] + FM.out_fm[1] + FM.out_fm[2]; lt >>= 0; lt = FM.Limit(lt, 32767, -32768); - stream.streamoutput[0][offset + i] = lt; + stream.streamoutput_Ptrs[0][offset + i] = lt; } } } diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/YM2413.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/YM2413.cs index 1203b31..ac69dfb 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/YM2413.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/YM2413.cs @@ -1158,7 +1158,7 @@ namespace MAME.Core { OPLLSetUpdateHandler(UpdateHandler, param); }*/ - public static void ym2413_update_one(int offset, int length) + public unsafe static void ym2413_update_one(int offset, int length) { byte rhythm = (byte)(OPLL.rhythm & 0x20); int i; @@ -1188,8 +1188,8 @@ namespace MAME.Core ro = output[1]; mo = limit(mo, 32767, -32768); ro = limit(ro, 32767, -32768); - Sound.ym2413stream.streamoutput[0][offset + i] = mo; - Sound.ym2413stream.streamoutput[1][offset + i] = ro; + Sound.ym2413stream.streamoutput_Ptrs[0][offset + i] = mo; + Sound.ym2413stream.streamoutput_Ptrs[1][offset + i] = ro; advance(); } } diff --git a/MAME.Unity/Assets/Plugins/UMAME/sound/YM2610.cs b/MAME.Unity/Assets/Plugins/UMAME/sound/YM2610.cs index a9d5f11..607f7e5 100644 --- a/MAME.Unity/Assets/Plugins/UMAME/sound/YM2610.cs +++ b/MAME.Unity/Assets/Plugins/UMAME/sound/YM2610.cs @@ -2,7 +2,7 @@ namespace MAME.Core { - public class YM2610 + public unsafe class YM2610 { public byte[] REGS; public FM.FM_OPN OPN; @@ -522,8 +522,8 @@ namespace MAME.Core rt += (int)((FM.out_fm[5] >> 1) & OPN.pan[11]); lt = FM.Limit(lt, 32767, -32768); rt = FM.Limit(rt, 32767, -32768); - Sound.ym2610stream.streamoutput[0][offset + i] = lt; - Sound.ym2610stream.streamoutput[1][offset + i] = rt; + Sound.ym2610stream.streamoutput_Ptrs[0][offset + i] = lt; + Sound.ym2610stream.streamoutput_Ptrs[1][offset + i] = rt; } } public void ym2610b_update_one(int offset, int length) @@ -607,8 +607,8 @@ namespace MAME.Core rt += (int)((FM.out_fm[5] >> 1) & OPN.pan[11]); lt = FM.Limit(lt, 32767, -32768); rt = FM.Limit(rt, 32767, -32768); - Sound.ym2610stream.streamoutput[0][offset + i] = lt; - Sound.ym2610stream.streamoutput[1][offset + i] = rt; + Sound.ym2610stream.streamoutput_Ptrs[0][offset + i] = lt; + Sound.ym2610stream.streamoutput_Ptrs[1][offset + i] = rt; } } public void ym2610_postload()