ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

An OPL that represents an emulated OPL. More...

#include <fmopl.h>

Inheritance diagram for OPL::EmulatedOPL:
Collaboration diagram for OPL::EmulatedOPL:

List of all members.

Public Member Functions

 EmulatedOPL ()
virtual ~EmulatedOPL ()
void setCallbackFrequency (int timerFrequency)
int readBuffer (int16 *buffer, const int numSamples)
 Fill the given buffer with up to numSamples samples.
int getRate () const
 Sample rate of the stream.
bool endOfData () const
 End of data reached? If this returns true, it means that at this time there is no data available in the stream.

Protected Member Functions

void startCallbacks (int timerFrequency)
void stopCallbacks ()
virtual void generateSamples (int16 *buffer, int numSamples)=0
 Read up to 'length' samples.

Private Types

enum  { FIXP_SHIFT = 16 }

Private Attributes

int _baseFreq
int _nextTick
int _samplesPerTick
Audio::SoundHandle_handle

Detailed Description

An OPL that represents an emulated OPL.

This will send callbacks based on the number of samples decoded in readBuffer().

Definition at line 240 of file fmopl.h.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
FIXP_SHIFT 

Definition at line 273 of file fmopl.h.


Constructor & Destructor Documentation

OPL::EmulatedOPL::EmulatedOPL (  ) 

Definition at line 263 of file fmopl.cpp.

OPL::EmulatedOPL::~EmulatedOPL (  )  [virtual]

Definition at line 270 of file fmopl.cpp.


Member Function Documentation

bool OPL::EmulatedOPL::endOfData (  )  const [inline, virtual]

End of data reached? If this returns true, it means that at this time there is no data available in the stream.

However there may be more data in the future. This is used by e.g. a rate converter to decide whether to keep on converting data or stop.

Implements Audio::AudioStream.

Definition at line 251 of file fmopl.h.

virtual void OPL::EmulatedOPL::generateSamples ( int16 buffer,
int  numSamples 
) [protected, pure virtual]

Read up to 'length' samples.

Data will be in native endianess, 16 bit per sample, signed. For stereo OPL, buffer will be filled with interleaved left and right channel samples, starting with a left sample. Furthermore, the samples in the left and right are summed up. So if you request 4 samples from a stereo OPL, you will get a total of two left channel and two right channel samples.

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

int OPL::EmulatedOPL::getRate (  )  const [virtual]

Sample rate of the stream.

Implements Audio::AudioStream.

Definition at line 307 of file fmopl.cpp.

int OPL::EmulatedOPL::readBuffer ( int16 buffer,
const int  numSamples 
) [virtual]

Fill the given buffer with up to numSamples samples.

Returns the actual number of samples read, or -1 if a critical error occurred (note: you *must* check if this value is less than what you requested, this can happen when the stream is fully used up).

Data has to be in native endianess, 16 bit per sample, signed. For stereo stream, buffer will be filled with interleaved left and right channel samples, starting with a left sample. Furthermore, the samples in the left and right are summed up. So if you request 4 samples from a stereo stream, you will get a total of two left channel and two right channel samples.

Implements Audio::AudioStream.

Definition at line 280 of file fmopl.cpp.

void OPL::EmulatedOPL::setCallbackFrequency ( int  timerFrequency  ) 

Definition at line 320 of file fmopl.cpp.

void OPL::EmulatedOPL::startCallbacks ( int  timerFrequency  )  [protected]

Definition at line 311 of file fmopl.cpp.

void OPL::EmulatedOPL::stopCallbacks (  )  [protected]

Definition at line 316 of file fmopl.cpp.


Member Data Documentation

Definition at line 271 of file fmopl.h.

Definition at line 280 of file fmopl.h.

Definition at line 277 of file fmopl.h.

Definition at line 278 of file fmopl.h.


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


Generated on Sat Mar 16 2019 05:06:50 for ResidualVM by doxygen 1.7.1
curved edge   curved edge