ValleyBell / libvgm

A more modular rewrite of most components from VGMPlay. will include sub-libraries for audio output, sound emulation and VGM playback
irc://irc.digibase.ca/#vgmrips
142 stars 34 forks source link

Allow instancing of custom chip cores from the player classes #123

Open vampirefrog opened 5 months ago

vampirefrog commented 5 months ago

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?

ValleyBell commented 5 months ago

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.

vampirefrog commented 4 months ago

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

vampirefrog commented 4 months ago

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 commented 4 months ago

Here's my interpreter if it helps any.