-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No support for real OPL? #3
Comments
I had to remove support for CRealopl from the latest Winamp plugin as the Windows API no longer supports I/O port reads/writes (even with the appropriate drivers), and I figure computers running the latest versions of Windows are fast losing the ability for a real OPL to be connected to them anyway. If you think support for this would be useful (and you have a computer running adplay-unix that has a real OPL you can test with) then by all means send a pull request through and I'll be happy to merge it. I'm not sure how much use it would get but maybe there are still people out there using AdPlug with hardware OPL devices? |
I do have an OPL equipped laptop and would love to get adplay running on it using the CRealopl class. I also think there's a growing interest in FM synthesis, in general, so I don't think I'll be the only guy using this if implemented, haha. Now, why is the Winamp plugin relevant for the purposes of this client? Is any part of the code shared between the two projects? |
In that case, go right ahead. The Winamp plugin is the main user of the AdPlug library and the way most AdPlug users make use of the library. I only mention it because now it has lost real OPL support, and it does suggest there are fewer machines as time goes on that are capable of communicating with a real FM synth. Because of this there are currently no users of CRealopl and I was contemplating removing it entirely, as opposed to just disabling it under Windows as is the case now. However if you add support for it to adplay-unix, then I guess that's one reason to keep CRealopl a little longer! |
Keep it forever! Eventually the world will realize we need to start putting OPL chips back into laptops, haha. On a sidenote, I've been trying to use the CRealopl class on Deadbeef's adplug plugin but I had to do a couple of changes in realopl.cpp for it to initialize correctly in Linux -- though I haven't managed to get sound out of it yet. I'm assuming I'd need to send a PR with those changes to adplug in order to get CRealopl working in this repo, right? Or is there something I'm missing? |
Happy to keep it there as long as someone is actually using it! Yes I'm no expert on port I/O under Linux but it looks like that will have to become part of the core Probably best if you make those changes locally and once you get it working, send one pull request for |
Would anybody here need a Linux user to help test real OPL support? Another project known as "vgmplay" can use real OPL chips if you tell it where to find the chip. I have a soundcard using a legit CMI8738 (so not a real Yamaha OPL3 but it sounds closer than Creative's CQM) behind a bridge chip. As a result of the bridge chip the OPL3 has to be accessed at 0xD050 rather than the typical 0x388. (My card uses the range D000-DFFF) Short audio example here: To make adplay-unix work without root in this case (like vgmplay is) you must pass the proper capability onto it: |
@KynikossDragonn Kudos to you my friend. I knew I wasn't the only Linux user wanting to make use of an OPL chip! |
@tomas Thanks. I was surprised this even worked myself. There seems to also be support for hardware OPL in Chocolate Doom, you most likely also have to do the same "setcap" invocation to make that work without root as well. |
TIL about the setcap command, by the way. Do you know what the command does internally? |
I don't know fully how the capability system works. I'm going to presume that information is stored somewhere sane... Not sure if it stores that directly in the ELF header or some information database system wide. Would be worth reading CAPABILITIES(7) in man. |
Normally a program doesn't have access to directly write to I/O ports unless run as root. When a program tries, the CPU jumps into the kernel and it's up to the kernel to decide whether to allow it or to terminate the program with an exception. While supporting playback on real OPL chips is great, I'm not such a huge fan of doing it by directly writing to I/O ports for this reason. In my opinion it would be better served by having a kernel module talk to the OPL chip, and then make something like The Linux kernel already has drivers for the OPL3 chip (looks like you can use it as an ALSA MIDI device and there seem to be functions for loading custom instruments) so it may already have a method of sending the chip raw OPL data. It would be worth investigating this further, because if there's already a way to use existing kernel modules for OPL chip access then that would be a much cleaner, more secure method to use and wouldn't need root access or |
Yeah, not only is there a OPL3 driver for ALSA MIDI playback, the driver appears to be aware of bridge chip remappings despite the driver "snd_cmipci" being loaded with a default "0x388" fm_port variable... I'm not sure how they figure that part out so automatically like that, I don't really understand enough C\C++ to figure alot of these out by glance. I can understand why direct IO is a big "no no" but I don't know of anybody willing to write a kernel driver to handle this stuff, and I'm not much of a decent programmer to wrap my head around that issue myself unfortunately. The rawio method just seems much simpler to do by comparison. |
The kernel module would be nice but I agree, it's a complex solution to create one from scratch. Are you able to have a look at the existing OPL kernel modules and ascertain whether any of them already provide direct access to the OPL registers? Maybe the module already exists and has done so for a while, which would be perfect. |
Looking at the adplay-unix source reveals that nowhere is the CRealopl class used, which means (as far as I know) that adplay-unix doesn't actually support using a real OPL chip.
Is this on purpose? Would you be interested in a pull request to include this?
The text was updated successfully, but these errors were encountered: