Closed freq-mod closed 3 years ago
I'll try to help with a panning once I finish my workday after some hours, however, I'll give you some hints on how to backport the soft-panning code:
1) add the pan law table at the top: https://github.com/Wohlstand/OPN2BankEditor/blob/5552cfe6fccd8b3b83eae5a3bb598fab567c77dc/src/opl/chips/gens/Ym2612_Emu.cpp#L259-L282
/*
* Pan law table
*/
static const unsigned short panlawtable[] =
{
65535, 65529, 65514, 65489, 65454, 65409, 65354, 65289,
65214, 65129, 65034, 64929, 64814, 64689, 64554, 64410,
64255, 64091, 63917, 63733, 63540, 63336, 63123, 62901,
62668, 62426, 62175, 61914, 61644, 61364, 61075, 60776,
60468, 60151, 59825, 59489, 59145, 58791, 58428, 58057,
57676, 57287, 56889, 56482, 56067, 55643, 55211, 54770,
54320, 53863, 53397, 52923, 52441, 51951, 51453, 50947,
50433, 49912, 49383, 48846, 48302, 47750, 47191,
46340, /* Center left */
46340, /* Center right */
45472, 44885, 44291, 43690, 43083, 42469, 41848, 41221,
40588, 39948, 39303, 38651, 37994, 37330, 36661, 35986,
35306, 34621, 33930, 33234, 32533, 31827, 31116, 30400,
29680, 28955, 28225, 27492, 26754, 26012, 25266, 24516,
23762, 23005, 22244, 21480, 20713, 19942, 19169, 18392,
17613, 16831, 16046, 15259, 14469, 13678, 12884, 12088,
11291, 10492, 9691, 8888, 8085, 7280, 6473, 5666,
4858, 4050, 3240, 2431, 1620, 810, 0
};
2) into the channel_t, add two new fields: https://github.com/Wohlstand/OPN2BankEditor/blob/5552cfe6fccd8b3b83eae5a3bb598fab567c77dc/src/opl/chips/gens/Ym2612_Emu.cpp#L99-L100
int PANVolumeL; // Left PCM output channel volume
int PANVolumeR; // Right PCM output channel volume
3) Add the public call: https://github.com/Wohlstand/OPN2BankEditor/blob/5552cfe6fccd8b3b83eae5a3bb598fab567c77dc/src/opl/chips/gens/Ym2612_Emu.cpp#L912-L916
void Ym2612_Impl::write_pan( int channel, int data )
{
YM2612.CHANNEL[channel].PANVolumeL = panlawtable[data & 0x7F];
YM2612.CHANNEL[channel].PANVolumeR = panlawtable[0x7F - (data & 0x7F)];
}
4) At the reset call, add the set the default values: https://github.com/Wohlstand/OPN2BankEditor/blob/5552cfe6fccd8b3b83eae5a3bb598fab567c77dc/src/opl/chips/gens/Ym2612_Emu.cpp#L948-L949
ch.PANVolumeL = 46340;
ch.PANVolumeR = 46340;
5) Into the update channel call, add the formula: https://github.com/Wohlstand/OPN2BankEditor/blob/5552cfe6fccd8b3b83eae5a3bb598fab567c77dc/src/opl/chips/gens/Ym2612_Emu.cpp#L1213-L1214
int t0 = buf [0] + ((CH_OUTd * ch.PANVolumeL / 65535) & ch.LEFT);
int t1 = buf [1] + ((CH_OUTd * ch.PANVolumeR / 65535) & ch.RIGHT);
it should do the actual panning. :fox_face: :+1:
About the panning, steps 1,2 and 4 went fine, yet 3 and 5... no idea how to do it right into new Gens.
Gonna resume the work on this, I mean, to complete the work you had started on adding of the soft-panning to here.
Okay, I am here, and I am ready to continue this. So, I need to finish the soft-panning code to make it work.
Okay, in the new code you need to inject macros, I did that, now I gonna put this new chipset into libOPNMIDI and verify it's work with the panning...
And, the benchmark ran with the update
Now it's time to try the new MAME core with a BSD license (@jpcima, don't worry, I didn't forgot that :wink:)
.... and Nuked OPN-Mod :joy:
.... and Nuked OPN-Mod joy
yeah, also, @nukeykt thinks about making the real OPNA emulator which will represent the original OPNA internal logic.
, @nukeykt thinks about making the real OPNA emulator which will represent the original OPNA internal logic.
wow, for real? finally, proper OPNA emulation, after 22+ years of development...
Recently he made the accurate OPM emulator https://github.com/nukeykt/Nuked-OPM and we discussed its work, he showed me various things against it.
To do: