ScummVM API documentation
OPL::OPL Class Referenceabstract

#include <fmopl.h>

Inheritance diagram for OPL::OPL:
Audio::Chip OPL::DOSBox::OPL OPL::MAME::OPL OPL::NUKED::OPL OPL::RetroWaveOPL3::OPL

Public Types

enum  { kDefaultCallbackFrequency = 250 }
 
- Public Types inherited from Audio::Chip
typedef Common::Functor0< void > TimerCallback
 

Public Member Functions

virtual bool init ()=0
 
virtual void reset ()=0
 
virtual void write (int a, int v)=0
 
virtual void writeReg (int r, int v)=0
 
void start (TimerCallback *callback)
 
- Public Member Functions inherited from Audio::Chip
void start (TimerCallback *callback, int timerFrequency)
 
void stop ()
 
virtual void setCallbackFrequency (int timerFrequency)=0
 

Protected Member Functions

void initDualOpl2OnOpl3 (Config::OplType oplType)
 
bool emulateDualOpl2OnOpl3 (int r, int v, Config::OplType oplType)
 
- Protected Member Functions inherited from Audio::Chip
virtual void startCallbacks (int timerFrequency)=0
 
virtual void stopCallbacks ()=0
 

Protected Attributes

bool _rhythmMode
 
int _connectionFeedbackValues [3]
 
- Protected Attributes inherited from Audio::Chip
Common::ScopedPtr< TimerCallback_callback
 

Detailed Description

A representation of a Yamaha OPL chip.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kDefaultCallbackFrequency 

The default callback frequency that start() uses

Member Function Documentation

◆ init()

virtual bool OPL::OPL::init ( )
pure virtual

Initializes the OPL emulator.

Returns
true on success, false on failure

Implemented in OPL::MAME::OPL, OPL::NUKED::OPL, OPL::DOSBox::OPL, and OPL::RetroWaveOPL3::OPL.

◆ reset()

virtual void OPL::OPL::reset ( )
pure virtual

Reinitializes the OPL emulator

Implemented in OPL::MAME::OPL, OPL::NUKED::OPL, OPL::DOSBox::OPL, and OPL::RetroWaveOPL3::OPL.

◆ write()

virtual void OPL::OPL::write ( int  a,
int  v 
)
pure virtual

Writes a byte to the given I/O port.

Parameters
aport address
vvalue, which will be written

Implemented in OPL::MAME::OPL, OPL::NUKED::OPL, OPL::DOSBox::OPL, and OPL::RetroWaveOPL3::OPL.

◆ writeReg()

virtual void OPL::OPL::writeReg ( int  r,
int  v 
)
pure virtual

Function to directly write to a specific OPL register. This writes to both chips for a Dual OPL2. We allow writing to secondary OPL registers by using register values >= 0x100.

Parameters
rhardware register number to write to
vvalue, which will be written

Implemented in OPL::MAME::OPL, OPL::NUKED::OPL, OPL::DOSBox::OPL, and OPL::RetroWaveOPL3::OPL.

◆ initDualOpl2OnOpl3()

void OPL::OPL::initDualOpl2OnOpl3 ( Config::OplType  oplType)
protected

Initializes an OPL3 chip for emulating dual OPL2.

Parameters
oplTypeThe type of OPL configuration that the engine expects. If this is not DualOpl2, this function will do nothing.

◆ emulateDualOpl2OnOpl3()

bool OPL::OPL::emulateDualOpl2OnOpl3 ( int  r,
int  v,
Config::OplType  oplType 
)
protected

Processes the specified register write so it will be correctly handled for emulating dual OPL2 on an OPL3 chip.

Parameters
rThe register that is written to.
vThe value written to the register.
oplTypeThe type of OPL configuration that the engine expects. If this is not DualOpl2, this function will do nothing.
Returns
True if the register write can be processed normally; false if it should be discarded. In this case, a new call to writeReg is usually performed by this function to replace the discarded register write.

The documentation for this class was generated from the following file: