From 9edd8eff0166c32fc2b5e07eaf0a37783a847ef3 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sat, 17 Feb 2018 12:50:19 +0100 Subject: AUDIO: add support for OPL2LPT The OPL2LPT is an OPL2 chip plugged on a parallel port. It is write-only but otherwise acts as a classic AdLib. This commit adds support for this device. User is expected to have the right permissions on the parallel port. By default, the first suitable parallel port is used. It is possible to override that with the hidden configuration setting "opl2lpt_parport". It depends on the presence of the libieee1284 library which abstracts a bit parallel port handling. An alternative would be to access directly /dev/parportX on Linux. This would amount of code but it would be Linux-only. Tested with Indy 3 and SOMI. --- audio/fmopl.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'audio/fmopl.cpp') diff --git a/audio/fmopl.cpp b/audio/fmopl.cpp index 3756d98123..3a003c80d9 100644 --- a/audio/fmopl.cpp +++ b/audio/fmopl.cpp @@ -43,6 +43,12 @@ namespace ALSA { } // End of namespace ALSA #endif // USE_ALSA +#ifdef ENABLE_OPL2LPT +namespace OPL2LPT { + OPL *create(); +} // End of namespace OPL2LPT +#endif // ENABLE_OPL2LPT + // Config implementation enum OplEmulator { @@ -50,7 +56,8 @@ enum OplEmulator { kMame = 1, kDOSBox = 2, kALSA = 3, - kNuked = 4 + kNuked = 4, + kOPL2LPT = 5 }; OPL::OPL() { @@ -70,6 +77,9 @@ const Config::EmulatorDescription Config::_drivers[] = { #endif #ifdef USE_ALSA { "alsa", _s("ALSA Direct FM"), kALSA, kFlagOpl2 | kFlagDualOpl2 | kFlagOpl3 }, +#endif +#ifdef ENABLE_OPL2LPT + { "opl2lpt", _s("OPL2LPT"), kOPL2LPT, kFlagOpl2 }, #endif { 0, 0, 0, 0 } }; @@ -193,6 +203,15 @@ OPL *Config::create(DriverId driver, OplType type) { return ALSA::create(type); #endif +#ifdef ENABLE_OPL2LPT + case kOPL2LPT: + if (type == kOpl2) + return OPL2LPT::create(); + else + warning("OPL2LPT only supports OPL2"); + return 0; +#endif + default: warning("Unsupported OPL emulator %d", driver); // TODO: Maybe we should add some dummy emulator too, which just outputs -- cgit v1.2.3