nukeykt / Nuked-OPN2

Cycle-accurate Yamaha YM3438(YM2612) emulator
GNU Lesser General Public License v2.1
219 stars 15 forks source link

FM Towns question #29

Closed wothke closed 1 year ago

wothke commented 1 year ago

I am trying to improve an old Euphony format player (FM Towns) by replacing its original home grown OPN2 emulation with Nuked-OPN2. My updated player runs in the browser (via EMSCRIPTEN compilation to WebAssembly) so the runtime environment obviously loses some of the hardware's native processing power..

I am using the nuked-OPN2 version from vgmPlay and I have reached the point where the songs play - and while playing they actually sound quite nice.. However the playback stutters massively which to me is an indication that the processing is too expensive for this scenario. Is there a way to tradeoff emulation quality for processing speed? (I meanwhile disabled some functionalities that probably are not used in my use case: OPN2_doTimerA, OPN2_doTimerB. OPN2_EnvelopeSSGEG - and that seems to barely be enough to prevent the playback from stuttering on my machine..)

I am currently using 7670454 as the clock rate. Is that the correct master clock that an FM Towns machine would be using to drive the chip? (The CPU seems to run at 16MHz but how does that relate to what clock rate the OPN2 is using?)