libvgm icon indicating copy to clipboard operation
libvgm copied to clipboard

Allow instancing of custom chip cores from the player classes

Open vampirefrog opened this issue 1 year ago • 4 comments

from a cursory glance, it seems possible to subclass the VGMPlayer class and overwrite InitDevices() to not call SndEmu_Start() and instead fill in the device definition callbacks manually.

Is this the case? And if so, is it possible to make another method, either on the VGMPlayer class or on the player base class, that is used to wrap the SndEmu_Start call, maybe call it StartChipCore or something similar, so then all the player classes can just be inherited and I could just overwrite that new method with a method that makes my own DEV_INFO for a fake chip core. Let's assume that all this custom chip core does is dump all the commands sent to the chip with a simple printf().

Do you think this is a good idea, or should I just overwrite InitDevices() and it's not really a library issue?

vampirefrog avatar Jun 16 '24 08:06 vampirefrog

My idea for this was to modify the "SndEmu_Start" call to take a pointer to a custom "sound chip lookup" function. The VGMPlayer would then need another function to set that custom callback.

Meanwhile you can probably just overwrite InitDevices() locally.

ValleyBell avatar Jun 16 '24 12:06 ValleyBell

Well okay but both solutions would be hacks because yours would depend on libemu.

vampirefrog avatar Jun 17 '24 06:06 vampirefrog

I was thinking of a VGM parser that just gives callbacks, and maybe some kind of superclass that auto detects VGM/S98/GYM etc. but also gives you callbacks or virtual functions, and preferrably is in C and is used by the vgm player that emulates and by VGM tools that don't emulate.

vampirefrog avatar Jun 17 '24 06:06 vampirefrog

Here's my interpreter if it helps any.

vampirefrog avatar Jun 18 '24 00:06 vampirefrog