ScummVM API documentation
MADS::RexNebular::ASound Class Referenceabstract

#include <asound.h>

Inheritance diagram for MADS::RexNebular::ASound:
MADS::SoundDriver MADS::RexNebular::RexASound MADS::RexNebular::ASound1 MADS::RexNebular::ASound2 MADS::RexNebular::ASound3 MADS::RexNebular::ASound4 MADS::RexNebular::ASound5 MADS::RexNebular::ASound6 MADS::RexNebular::ASound7 MADS::RexNebular::ASound8 MADS::RexNebular::ASound9

Public Member Functions

 ASound (Audio::Mixer *mixer, const Common::Path &filename, int dataOffset, int dataSize)
 
 ~ASound () override
 
int stop () override
 
int poll () override
 
void noise () override
 
int getFrameCounter ()
 
void setVolume (int volume) override
 
- Public Member Functions inherited from MADS::SoundDriver
 SoundDriver (Audio::Mixer *mixer, const Common::Path &filename, int dataOffset, int dataSize)
 
virtual int command (int commandId, int param)=0
 

Static Public Member Functions

static void validate ()
 

Public Attributes

AdlibChannel _channels [9]
 
AdlibChannel * _activeChannelPtr
 
AdlibChannelData _channelData [11]
 
Common::Array< AdlibSample > _samples
 
AdlibSample * _samplePtr
 
Common::Queue< RegisterValue > _queue
 
int _frameCounter
 
bool _isDisabled
 
int _noiseTicks1
 
int _noiseTicks2
 
int _activeChannelNumber
 
int _freqMask1
 
int _freqMask2
 
int _freqBase1
 
int _freqBase2
 
int _noiseChannel1
 
int _noiseChannel2
 
int _noiseFreqStep1
 
int _noiseFreqStep2
 
int _savedNoiseTicks1
 
int _savedNoiseTicks2
 
int _pollResult
 
int _resultFlag
 
byte _nullData [2]
 
int _ports [256]
 
bool _stateFlag
 
int _activeChannelReg
 
int _outputReg
 
bool _amDep
 
bool _vibDep
 
bool _splitPoint
 

Protected Member Functions

virtual void channelCommand (byte *&pSrc, bool &updateFlag)=0
 
virtual void tickCallback ()
 
byte * loadData (int offset)
 
int getDataOffset (byte *ptr) const
 
void loadSample (int sampleIndex)
 
void write (int reg, int val)
 
int write2 (int state, int reg, int val)
 
void flush ()
 
void channelOn (int reg, int volume)
 
void channelOff (int reg)
 
void resultCheck ()
 
void playSound (int offset)
 
void playSoundAny (int offset)
 
void playSoundData (byte *pData, int startingChannel=5)
 
bool isSoundActive (byte *pData)
 
void setFrequency (int channel, int freq)
 
int getRandomNumber ()
 
byte * getDataPtr (int nearPtr)
 
virtual int command0 ()
 
int command1 ()
 
int command2 ()
 
int command3 ()
 
int command4 ()
 
int command5 ()
 
int command6 ()
 
int command7 ()
 
int command8 ()
 
int nullCommand ()
 
- Protected Member Functions inherited from MADS::SoundDriver
Common::MemoryReadStream getDataStream (int offset) const
 

Protected Attributes

int _chanCommandCount
 
int _commandParam
 
- Protected Attributes inherited from MADS::SoundDriver
Audio::Mixer * _mixer
 
Common::Array< byte > _soundData
 
Common::Mutex _driverMutex
 

Detailed Description

Base class for the sound player resource files

Constructor & Destructor Documentation

◆ ASound()

MADS::RexNebular::ASound::ASound ( Audio::Mixer *  mixer,
const Common::Path &  filename,
int  dataOffset,
int  dataSize 
)

Constructor

Parameters
mixerMixer
filenameSpecifies the adlib sound player file to use
dataOffsetOffset in the file of the data segment
dataSizeSize of the data segment

◆ ~ASound()

MADS::RexNebular::ASound::~ASound ( )
override

Destructor

Member Function Documentation

◆ tickCallback()

virtual void MADS::RexNebular::ASound::tickCallback ( )
inlineprotectedvirtual

Hook called once per update() frame, immediately after the disabled check and before the frame counter/channel polling. Only ASound9's driver data makes use of a recurring deferred-callback timer (the word_1949E/word_194A0/_soundPtr trio in the original disassembly); every other driver leaves this as a no-op.

◆ loadData()

byte* MADS::RexNebular::ASound::loadData ( int  offset)
inlineprotected

Returns data for the specified offset

◆ loadSample()

void MADS::RexNebular::ASound::loadSample ( int  sampleIndex)
protected

Loads up the specified sample

◆ write()

void MADS::RexNebular::ASound::write ( int  reg,
int  val 
)
protected

Queue a byte for an Adlib register

◆ write2()

int MADS::RexNebular::ASound::write2 ( int  state,
int  reg,
int  val 
)
protected

Queue a byte for an Adlib register, and store it in the _ports array

◆ flush()

void MADS::RexNebular::ASound::flush ( )
protected

Flush any pending Adlib register values to the OPL driver

◆ channelOn()

void MADS::RexNebular::ASound::channelOn ( int  reg,
int  volume 
)
protected

Turn a channel on

◆ channelOff()

void MADS::RexNebular::ASound::channelOff ( int  reg)
protected

Turn a channel off

◆ resultCheck()

void MADS::RexNebular::ASound::resultCheck ( )
protected

Checks for whether a poll result needs to be set

◆ playSound()

void MADS::RexNebular::ASound::playSound ( int  offset)
protected

Play the specified sound, using any free channel from 5 to 8.

Parameters
offsetOffset of sound data within sound player data segment

◆ playSoundAny()

void MADS::RexNebular::ASound::playSoundAny ( int  offset)
inlineprotected

Play the specified sound using any channel from 0 to 8.

Parameters
offsetOffset of sound data within sound player data segment

◆ playSoundData()

void MADS::RexNebular::ASound::playSoundData ( byte *  pData,
int  startingChannel = 5 
)
protected

Play the specified raw sound data

Parameters
pDataPointer to data block containing sound data
startingChannelChannel to start scan from

◆ isSoundActive()

bool MADS::RexNebular::ASound::isSoundActive ( byte *  pData)
protected

Checks to see whether the given block of data is already loaded into a channel.

◆ setFrequency()

void MADS::RexNebular::ASound::setFrequency ( int  channel,
int  freq 
)
protected

Sets the frequency for a given channel.

◆ getRandomNumber()

int MADS::RexNebular::ASound::getRandomNumber ( )
protected

Returns a 16-bit random number

◆ getDataPtr()

byte* MADS::RexNebular::ASound::getDataPtr ( int  nearPtr)
protected

Converts a 16-bit near pointer (data-segment offset) to a C++ byte pointer by searching the data cache for the matching block.

◆ validate()

static void MADS::RexNebular::ASound::validate ( )
static

Validates the Adlib sound files

◆ stop()

int MADS::RexNebular::ASound::stop ( )
overridevirtual

Stop all currently playing sounds

Implements MADS::SoundDriver.

◆ poll()

int MADS::RexNebular::ASound::poll ( )
overridevirtual

Main poll method to allow sounds to progress

Implements MADS::SoundDriver.

◆ noise()

void MADS::RexNebular::ASound::noise ( )
overridevirtual

General noise/note output

Implements MADS::SoundDriver.

◆ getFrameCounter()

int MADS::RexNebular::ASound::getFrameCounter ( )
inline

Return the current frame counter

◆ setVolume()

void MADS::RexNebular::ASound::setVolume ( int  volume)
overridevirtual

Set the volume

Implements MADS::SoundDriver.


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