ScummVM API documentation
MADS::Phantom::Sound::PSound Class Referenceabstract

#include <psound.h>

Inheritance diagram for MADS::Phantom::Sound::PSound:
MADS::SoundDriver MADS::Phantom::Sound::PhantomPSound MADS::Phantom::Sound::PSound1 MADS::Phantom::Sound::PSound2 MADS::Phantom::Sound::PSound3 MADS::Phantom::Sound::PSound4 MADS::Phantom::Sound::PSound5 MADS::Phantom::Sound::PSound9 MADS::Phantom::Sound::PSoundDemo

Classes

struct  Channel
 

Public Types

enum  {
  kChannelCount = 9, kMusicChannelCount = 6, kPatchSize = 0x40, kScriptVarCount = 32,
  kOpcodeBudgetPerTick = 256
}
 

Public Member Functions

bool isReady () const
 
int stop () override
 
int poll () override
 
void noise () override
 
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 bool validateFile (const PSoundDriverData &driverData, const char *first8192Md5, Common::String *reason=nullptr)
 

Protected Types

enum  RegisterBank { kFirstBank = 1, kSecondBank = 2, kBothBanks = kFirstBank | kSecondBank }
 

Protected Member Functions

 PSound (Audio::Mixer *mixer, const PSoundDriverData &driverData)
 
bool isDataRangeValid (uint32 offset, uint32 length) const
 
const byte * getDataPointer (uint32 offset, uint32 length, const char *operation) const
 
byte * getDataPointer (uint32 offset, uint32 length, const char *operation)
 
byte readDataByte (uint32 offset) const
 
uint16 readDataUint16 (uint32 offset) const
 
void writeDataByte (uint32 offset, byte value)
 
void writeDataUint16 (uint32 offset, uint16 value)
 
byte getBankMask (uint channel) const
 
byte getOplChannel (uint channel) const
 
byte getOperatorOffset (uint channel, uint operatorIndex) const
 
const byte * getPatch (uint patchIndex) const
 
byte getPanningAttenuation (byte panning) const
 
uint16 getFrequencyNumber (byte semitone) const
 
void writeRegister (byte banks, byte reg, byte value)
 
byte getCachedRegister (byte banks, byte reg) const
 
void initializePas16 ()
 
void shutdownPas16 ()
 
void resetDriver ()
 
int command0 ()
 
int command1 ()
 
int command2 ()
 
int command3 ()
 
int command4 ()
 
int command5 ()
 
int command6 ()
 
int command7 ()
 
int command8 ()
 
void requestStop (uint firstChannel, uint endChannel)
 
void setCurrentSequence (uint firstChannel, uint endChannel, uint16 sequenceOffset)
 
void loadChannel (uint channel, uint16 sequenceOffset)
 
void playSound (uint16 sequenceOffset)
 
void playMusicAny (uint16 sequenceOffset)
 
bool isSoundActive (uint16 sequenceOffset) const
 
void onTimer ()
 
int serviceUpdate ()
 
void serviceNoise ()
 
void update ()
 
void updateChannel (uint channelIndex)
 
bool isOpcodeDataValid (uint16 position, uint32 length) const
 
byte readOpcodeByte (uint16 position, uint16 delta) const
 
uint16 readOpcodeWord (uint16 position, uint16 delta) const
 
bool isScriptVariableValid (byte index) const
 
bool transferOpcode (Channel &channel, uint16 position, bool take, bool isCall)
 
bool executeOpcode (uint channelIndex, byte opcode, bool &levelsDirty)
 
void finishChannel (uint channelIndex)
 
void checkPendingStops ()
 
void loadPatch (uint channelIndex, byte patchIndex)
 
void programOperator (byte banks, uint channelIndex, uint operatorIndex, const byte *operatorData)
 
void updatePanning (uint channelIndex)
 
void updateChannelLevels (uint channelIndex)
 
void updateChannelFrequency (uint channelIndex, bool keyOn)
 
void updatePitchBend (uint channelIndex)
 
void keyOff (uint channelIndex)
 
void setNoiseFrequency (uint channelIndex, int frequency)
 
void resultCheck ()
 
uint16 nextRandom ()
 
virtual bool callFunction (uint16 targetOffset, Channel &channel)=0
 
- Protected Member Functions inherited from MADS::SoundDriver
Common::MemoryReadStream getDataStream (int offset) const
 
 SoundDriver (Audio::Mixer *mixer)
 

Protected Attributes

OPL::OPL_opl
 
byte _registerCache [2][256]
 
NativeSoundTimer _hostTimer
 
Channel _channels [kChannelCount]
 
byte _scriptVars [kScriptVarCount]
 
int _masterVolume
 
uint16 _randomSeed
 
uint16 _frameCounter
 
int16 _pollResult
 
int8 _resultFlag
 
uint16 _nullSequenceOffset
 
uint16 _patchTableOffset
 
PSoundTableLayout _tableLayout
 
byte _patchCount
 
bool _updatesEnabled
 
bool _noiseServiceEnabled
 
uint16 _tickEnabled
 
uint16 _tickCounter
 
uint16 _tempoReload
 
uint16 _tempoTarget
 
int16 _tempoShift
 
uint16 _tempoBase
 
uint16 _tempoCurrent
 
uint16 _tempoScale
 
int _frameNumber2
 
- Protected Attributes inherited from MADS::SoundDriver
Audio::Mixer_mixer
 
Common::Array< byte > _soundData
 
Common::Mutex _driverMutex
 

Detailed Description

Interpreter for Return of the Phantom's PSOUND overlay family.

Member Function Documentation

◆ callFunction()

virtual bool MADS::Phantom::Sound::PSound::callFunction ( uint16  targetOffset,
Channel channel 
)
protectedpure virtual

Implement only callbacks proved reachable from this overlay's streams.

Implemented in MADS::Phantom::Sound::PhantomPSound.

◆ stop()

int MADS::Phantom::Sound::PSound::stop ( )
overridevirtual

Stop all currently playing sounds

Implements MADS::SoundDriver.

◆ poll()

int MADS::Phantom::Sound::PSound::poll ( )
overridevirtual

Main poll method to allow sounds to progress

Implements MADS::SoundDriver.

◆ noise()

void MADS::Phantom::Sound::PSound::noise ( )
overridevirtual

General noise/note output

Implements MADS::SoundDriver.

◆ setVolume()

void MADS::Phantom::Sound::PSound::setVolume ( int  volume)
overridevirtual

Set the volume

Implements MADS::SoundDriver.


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