ScummVM API documentation
OPL::OPL Class Referenceabstract

#include <fmopl.h>

Inheritance diagram for OPL::OPL:
OPL::EmulatedOPL OPL::RealOPL OPL::DOSBox::OPL OPL::MAME::OPL OPL::NUKED::OPL OPL::RetroWaveOPL3::OPL

Public Types

enum  { kDefaultCallbackFrequency = 250 }
 

Public Member Functions

virtual bool init ()=0
 
virtual void reset ()=0
 
virtual void write (int a, int v)=0
 
virtual byte read (int a)=0
 
virtual void writeReg (int r, int v)=0
 
void start (TimerCallback *callback, int timerFrequency=kDefaultCallbackFrequency)
 
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)
 
virtual void startCallbacks (int timerFrequency)=0
 
virtual void stopCallbacks ()=0
 

Protected Attributes

Common::ScopedPtr< TimerCallback_callback
 
bool _rhythmMode
 
int _connectionFeedbackValues [3]
 

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.

◆ read()

virtual byte OPL::OPL::read ( int  a)
pure virtual

Reads a byte from the given I/O port.

Parameters
aport address
Returns
value read

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.

◆ start()

void OPL::OPL::start ( TimerCallback callback,
int  timerFrequency = kDefaultCallbackFrequency 
)

Start the OPL with callbacks.

◆ stop()

void OPL::OPL::stop ( )

Stop the OPL

◆ setCallbackFrequency()

virtual void OPL::OPL::setCallbackFrequency ( int  timerFrequency)
pure virtual

Change the callback frequency. This must only be called from a timer proc.

Implemented in OPL::EmulatedOPL, and OPL::RealOPL.

◆ 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.

◆ startCallbacks()

virtual void OPL::OPL::startCallbacks ( int  timerFrequency)
protectedpure virtual

Start the callbacks.

Implemented in OPL::EmulatedOPL, and OPL::RealOPL.

◆ stopCallbacks()

virtual void OPL::OPL::stopCallbacks ( )
protectedpure virtual

Stop the callbacks.

Implemented in OPL::EmulatedOPL, and OPL::RealOPL.

Member Data Documentation

◆ _callback

Common::ScopedPtr<TimerCallback> OPL::OPL::_callback
protected

The functor for callbacks.


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