Wohlstand / libOPNMIDI

A Software MIDI Synthesizer library with OPN2 (YM2612) emulator
GNU Lesser General Public License v3.0
96 stars 6 forks source link

OPM core support #88

Open jpcima opened 5 years ago

jpcima commented 5 years ago

Support the basis of YM2151. Can play back on 8 FM channels. LFO possibly needs more work to enable.

Detune2 could be had in WOPN without a format update, becase it's stored in unused bit space of decay2_70.

87

jpcima commented 5 years ago

Found here the likely source of the issue for tuning problems. It's in the resampler. It's needed for OPM to have 64 not 144 as the scaling factor.

https://github.com/Wohlstand/libOPNMIDI/blob/826101e52bcb15c73bcbba17935bf03f2a511e82/src/chips/opn_chip_base.tcc#L218

In these emus (of which I just tried MAME 2151) you can't usually set clock and sampling rate in independence. Neither can we in OPN as you see, as it sets a fixed factor 144.

So I thought it's wise for chip APIs to set only the clock, and provide the appropriate native sample clock for the chip family according to the fixed divisor value. (having nativeClockDiv and nativeClockRate, as opposed to current nativeRate and nativeClockRate)

In the future, if we'd want to match a MSX extension board, OPM would need clock 3.58 MHz; and a clock at 4 MHz which matches X68k. Native sampling rates will vary in linear relation.

Wohlstand commented 5 years ago

Please pull to your side my "opm" branch to fix conflicts.

freq-mod commented 3 years ago

Is it still being considered?

Mike77154 commented 1 year ago

yeah, ading YM2151 support to this will enchace the library