Open denjhang opened 2 years ago
I see lots of Arduino-code in that repo. But VGMPlay doesn't run on an Arduino.,
Is there a way to access the OPL3Duo from the PC side? And if so, please describe (or link) how it is done.
If it should be a serial connection via COM port, then I need information about the baud rate, stop bits, etc.
https://github.com/DhrBaksteen/ArduinoOPL2/blob/master/examples/OPL3Duo/SerialPassthrough/SerialPassthrough.ino https://github.com/DhrBaksteen/ArduinoOPL2/blob/master/examples/OPL2AudioBoard/SerialPassthrough/SerialPassthrough.ino
Currently I use SerialPassthrough.ino of OPL3DUO, compile these codes with arduino and upload them to arduino nano. After that I use dosbox-x and specify the port number (like com3) and I can use the actual opl3 hardware.
In addition to using dosbox-x to access opl3duo, you can also use opl3bankeditor https://github.com/Wohlstand/OPL3BankEditor
and an immature vgm player made by my friend. https://github.com/zhblue/OPL3USB/tree/main/vgmplay2usb
I may have a look whenever I port the "hardware OPL" code to vgmplay-libvgm.
The important code parts of the two repos are:
By the way, the vgmplay2usb made by my friend has been tested and found that the playback speed is very unstable, fast and slow. And it plays very slowly when it encounters VGM with many notes. This doesn't happen when I use dosbox-x+sbvgm.
vgmplay2usb's timing code just uses Sleep(wait/speed);
to perform timing.
In practise this guarantees you that timing will be inaccurate, because any sort of "wait" command waits at least the specified time. Sleep(4)
may return after 4 ms ... or after 300 ms if the OS is busy with other stuff.
VGMPlay uses a separate time counter that is advanced by the VGM wait commands. It does Sleep(1)
in a loop until the system time reaches the target time. When waiting takes too long for one delay, it will wait a shorter time for the next command. Thus the overall timing will be stable. (And it has been for hardware OPL passthrough when I used it.)
(Also, vgmplay2usb calling _kbhit()
between every VGM command will probably slow down VGM parsing. I'd check for key input only when actively waiting.)
https://github.com/DhrBaksteen/ArduinoOPL2 Arduino OPL2 allows to use serial port to control YM3812 or YMF262, I hope vgmplay can adapt to this function. I made a USB-OPL3 based on Arduino OPL2, and currently I can use Dosbox-X+sbvgm to play music from OPL1/2/3.