ScummVM API documentation
Darkseed::MidiDriver_Worx_AdLib Class Reference

#include <adlib_worx.h>

Inheritance diagram for Darkseed::MidiDriver_Worx_AdLib:
MidiDriver_ADLIB_Multisource MidiDriver_Multisource MidiDriver MidiDriver_BASE

Public Member Functions

 MidiDriver_Worx_AdLib (OPL::Config::OplType oplType, int timerFrequency=OPL::OPL::kDefaultCallbackFrequency)
 
- Public Member Functions inherited from MidiDriver_ADLIB_Multisource
 MidiDriver_ADLIB_Multisource (OPL::Config::OplType oplType, int timerFrequency=OPL::OPL::kDefaultCallbackFrequency)
 
int open () override
 
bool isOpen () const override
 
void close () override
 
uint32 property (int prop, uint32 param) override
 
uint32 getBaseTempo () override
 
MidiChannelallocateChannel () override
 
MidiChannelgetPercussionChannel () override
 
void send (int8 source, uint32 b) override
 
void sysEx (const byte *msg, uint16 length) override
 
void metaEvent (int8 source, byte type, byte *data, uint16 length) override
 
void stopAllNotes (bool stopSustainedNotes=false) override
 
void stopAllNotes (uint8 source, uint8 channel) override
 
void deinitSource (uint8 source) override
 
- Public Member Functions inherited from MidiDriver_Multisource
void send (uint32 b) override
 
uint32 property (int prop, uint32 param) override
 
void setSourceType (SourceType type)
 
void setSourceType (uint8 source, SourceType type)
 
void setSourceVolume (uint16 volume)
 
void setSourceVolume (uint8 source, uint16 volume)
 
void resetSourceVolume ()
 
void resetSourceVolume (uint8 source)
 
void setSourceNeutralVolume (uint16 volume)
 
void setSourceNeutralVolume (uint8 source, uint16 volume)
 
void startFade (uint16 duration, uint16 targetVolume)
 
void startFade (uint8 source, uint16 duration, uint16 targetVolume)
 
void abortFade (FadeAbortType abortType=FADE_ABORT_TYPE_END_VOLUME)
 
void abortFade (uint8 source, FadeAbortType abortType=FADE_ABORT_TYPE_END_VOLUME)
 
bool isFading ()
 
bool isFading (uint8 source)
 
void setControllerDefault (ControllerDefaultType type)
 
void setControllerDefault (ControllerDefaultType type, int16 value)
 
void setControllerDefaults (ControllerDefaultType type, int16 *values)
 
void clearControllerDefault (ControllerDefaultType type)
 
void setInstrumentRemapping (const byte *instrumentRemapping)
 
void syncSoundSettings ()
 
void setTimerCallback (void *timer_param, Common::TimerManager::TimerProc timer_proc) override
 
- Public Member Functions inherited from MidiDriver
void midiDriverCommonSend (uint32 b)
 
void midiDriverCommonSysEx (const byte *msg, uint16 length)
 
virtual void setPitchBendRange (byte channel, uint range)
 
void sendMT32Reset ()
 
void sendGMReset ()
 
virtual void setEngineSoundFont (Common::SeekableReadStream *soundFontData)
 
virtual bool acceptsSoundFontData ()
 
- Public Member Functions inherited from MidiDriver_BASE
void send (byte status, byte firstOp, byte secondOp)
 
void send (int8 source, byte status, byte firstOp, byte secondOp)
 
virtual uint16 sysExNoDelay (const byte *msg, uint16 length)
 
virtual void metaEvent (byte type, byte *data, uint16 length)
 
virtual bool isReady (int8 source=-1)
 

Protected Member Functions

uint8 allocateOplChannel (uint8 channel, uint8 source, uint8 instrumentId) override
 
uint16 calculateFrequency (uint8 channel, uint8 source, uint8 note) override
 
uint8 calculateUnscaledVolume (uint8 channel, uint8 source, uint8 velocity, OplInstrumentDefinition &instrumentDef, uint8 operatorNum) override
 
- Protected Member Functions inherited from MidiDriver_ADLIB_Multisource
void applySourceVolume (uint8 source) override
 
virtual void initOpl ()
 
virtual void noteOff (uint8 channel, uint8 note, uint8 velocity, uint8 source)
 
virtual void noteOn (uint8 channel, uint8 note, uint8 velocity, uint8 source)
 
virtual void polyAftertouch (uint8 channel, uint8 note, uint8 pressure, uint8 source)
 
virtual void controlChange (uint8 channel, uint8 controller, uint8 value, uint8 source)
 
virtual void programChange (uint8 channel, uint8 program, uint8 source)
 
virtual void channelAftertouch (uint8 channel, uint8 pressure, uint8 source)
 
virtual void pitchBend (uint8 channel, uint8 pitchBendLsb, uint8 pitchBendMsb, uint8 source)
 
virtual void modulation (uint8 channel, uint8 modulation, uint8 source)
 
virtual void dataEntry (uint8 channel, uint8 dataMsb, uint8 dataLsb, uint8 source)
 
virtual void volume (uint8 channel, uint8 volume, uint8 source)
 
virtual void panning (uint8 channel, uint8 panning, uint8 source)
 
virtual void expression (uint8 channel, uint8 expression, uint8 source)
 
virtual void sustain (uint8 channel, uint8 sustain, uint8 source)
 
virtual void registeredParameterNumber (uint8 channel, uint8 rpnMsb, uint8 rpnLsb, uint8 source)
 
virtual void allSoundOff (uint8 channel, uint8 source)
 
virtual void resetAllControllers (uint8 channel, uint8 source)
 
virtual void allNotesOff (uint8 channel, uint8 source)
 
virtual void applyControllerDefaults (uint8 source)
 
virtual void recalculateFrequencies (uint8 channel, uint8 source)
 
virtual void recalculateVolumes (uint8 channel, uint8 source)
 
virtual InstrumentInfo determineInstrument (uint8 channel, uint8 source, uint8 note)
 
void determineMelodicChannels ()
 
virtual int32 calculatePitchBend (uint8 channel, uint8 source, uint16 oplFrequency)
 
virtual uint8 calculateVolume (uint8 channel, uint8 source, uint8 velocity, OplInstrumentDefinition &instrumentDef, uint8 operatorNum)
 
virtual bool isVolumeApplicableToOperator (OplInstrumentDefinition &instrumentDef, uint8 operatorNum)
 
virtual uint8 calculatePanning (uint8 channel, uint8 source)
 
virtual void setRhythmMode (bool rhythmMode)
 
uint16 determineOperatorRegisterOffset (uint8 oplChannel, uint8 operatorNum, OplInstrumentRhythmType rhythmType=RHYTHM_TYPE_UNDEFINED, bool fourOperator=false)
 
uint16 determineChannelRegisterOffset (uint8 oplChannel, bool fourOperator=false)
 
void writeInstrument (uint8 oplChannel, InstrumentInfo instrument)
 
void writeKeyOff (uint8 oplChannel, OplInstrumentRhythmType rhythmType=RHYTHM_TYPE_UNDEFINED, bool forceWrite=false)
 
void writeRhythm (bool forceWrite=false)
 
virtual void writeVolume (uint8 oplChannel, uint8 operatorNum, OplInstrumentRhythmType rhythmType=RHYTHM_TYPE_UNDEFINED)
 
virtual void writePanning (uint8 oplChannel, OplInstrumentRhythmType rhythmType=RHYTHM_TYPE_UNDEFINED)
 
virtual void writeFrequency (uint8 oplChannel, OplInstrumentRhythmType rhythmType=RHYTHM_TYPE_UNDEFINED)
 
void writeRegister (uint16 reg, uint8 value, bool forceWrite=false)
 
- Protected Member Functions inherited from MidiDriver_Multisource
void updateFading ()
 
virtual void onTimer ()
 
- Protected Member Functions inherited from MidiDriver_BASE
void midiDumpInit ()
 
int midiDumpVarLength (const uint32 &delta)
 
void midiDumpDelta ()
 
void midiDumpDo (uint32 b)
 
void midiDumpSysEx (const byte *msg, uint16 length)
 
void midiDumpFinish ()
 

Additional Inherited Members

- Public Types inherited from MidiDriver_ADLIB_Multisource
enum  AccuracyMode { ACCURACY_MODE_SB16_WIN95, ACCURACY_MODE_GM }
 
enum  ChannelAllocationMode { ALLOCATION_MODE_DYNAMIC, ALLOCATION_MODE_STATIC }
 
enum  InstrumentWriteMode { INSTRUMENT_WRITE_MODE_NOTE_ON, INSTRUMENT_WRITE_MODE_PROGRAM_CHANGE, INSTRUMENT_WRITE_MODE_FIRST_NOTE_ON }
 
enum  NoteSelectMode { NOTE_SELECT_MODE_0, NOTE_SELECT_MODE_1 }
 
enum  ModulationDepth { MODULATION_DEPTH_LOW, MODULATION_DEPTH_HIGH }
 
enum  VibratoDepth { VIBRATO_DEPTH_LOW, VIBRATO_DEPTH_HIGH }
 
- Public Types inherited from MidiDriver_Multisource
enum  SourceType { SOURCE_TYPE_UNDEFINED, SOURCE_TYPE_MUSIC, SOURCE_TYPE_SFX }
 
enum  FadeAbortType { FADE_ABORT_TYPE_END_VOLUME, FADE_ABORT_TYPE_CURRENT_VOLUME, FADE_ABORT_TYPE_START_VOLUME }
 
enum  ControllerDefaultType {
  CONTROLLER_DEFAULT_PROGRAM, CONTROLLER_DEFAULT_INSTRUMENT_BANK, CONTROLLER_DEFAULT_DRUMKIT, CONTROLLER_DEFAULT_CHANNEL_PRESSURE,
  CONTROLLER_DEFAULT_PITCH_BEND, CONTROLLER_DEFAULT_MODULATION, CONTROLLER_DEFAULT_VOLUME, CONTROLLER_DEFAULT_PANNING,
  CONTROLLER_DEFAULT_EXPRESSION, CONTROLLER_DEFAULT_SUSTAIN, CONTROLLER_DEFAULT_RPN, CONTROLLER_DEFAULT_PITCH_BEND_SENSITIVITY
}
 
- Public Types inherited from MidiDriver
enum  DeviceStringType { kDriverName, kDriverId, kDeviceName, kDeviceId }
 
enum  { MERR_CANNOT_CONNECT = 1, MERR_DEVICE_NOT_AVAILABLE = 3, MERR_ALREADY_OPEN = 4 }
 
enum  {
  PROP_OLD_ADLIB = 2, PROP_CHANNEL_MASK = 3, PROP_SCUMM_OPL3 = 4, PROP_USER_VOLUME_SCALING = 5,
  PROP_MIDI_DATA_REVERSE_PANNING = 6, PROP_OPL_ACCURACY_MODE = 7, PROP_OPL_CHANNEL_ALLOCATION_MODE = 8, PROP_MILES_VERSION = 9,
  PROP_OPL_RHYTHM_MODE_IGNORE_NOTE_OFF = 10
}
 
typedef uint32 DeviceHandle
 
- Static Public Member Functions inherited from MidiDriver_ADLIB_Multisource
static bool detectOplType (OPL::Config::OplType oplType)
 
- Static Public Member Functions inherited from MidiDriver
static Common::String musicType2GUIO (uint32 musicType)
 
static MidiDrivercreateMidi (DeviceHandle handle)
 
static DeviceHandle detectDevice (int flags)
 
static DeviceHandle getDeviceHandle (const Common::String &identifier)
 
static bool checkDevice (DeviceHandle handle, int flags, bool quiet)
 
static MusicType getMusicType (DeviceHandle handle)
 
static Common::String getDeviceString (DeviceHandle handle, DeviceStringType type)
 
static const char * getErrorName (int error_code)
 
- Static Public Attributes inherited from MidiDriver_ADLIB_Multisource
static const uint8 OPL2_NUM_CHANNELS = 9
 
static const uint8 OPL3_NUM_CHANNELS = 18
 
static const uint8 MELODIC_CHANNELS_OPL2 [9]
 
static const uint8 MELODIC_CHANNELS_OPL2_RHYTHM [6]
 
static const uint8 MELODIC_CHANNELS_OPL3 [18]
 
static const uint8 MELODIC_CHANNELS_OPL3_RHYTHM [15]
 
static const uint8 OPL_NUM_RHYTHM_INSTRUMENTS = 5
 
static const uint8 OPL_RHYTHM_INSTRUMENT_CHANNELS [OPL_NUM_RHYTHM_INSTRUMENTS]
 
static const uint8 OPL_REGISTER_TEST = 0x01
 
static const uint8 OPL_REGISTER_TIMER1 = 0x02
 
static const uint8 OPL_REGISTER_TIMER2 = 0x03
 
static const uint8 OPL_REGISTER_TIMERCONTROL = 0x04
 
static const uint8 OPL_REGISTER_NOTESELECT_CSM = 0x08
 
static const uint8 OPL_REGISTER_RHYTHM = 0xBD
 
static const uint8 OPL_REGISTER_BASE_FREQMULT_MISC = 0x20
 
static const uint8 OPL_REGISTER_BASE_LEVEL = 0x40
 
static const uint8 OPL_REGISTER_BASE_DECAY_ATTACK = 0x60
 
static const uint8 OPL_REGISTER_BASE_RELEASE_SUSTAIN = 0x80
 
static const uint8 OPL_REGISTER_BASE_WAVEFORMSELECT = 0xE0
 
static const uint8 OPL_REGISTER_BASE_FNUMLOW = 0xA0
 
static const uint8 OPL_REGISTER_BASE_FNUMHIGH_BLOCK_KEYON = 0xB0
 
static const uint8 OPL_REGISTER_BASE_CONNECTION_FEEDBACK_PANNING = 0xC0
 
static const uint16 OPL3_REGISTER_CONNECTIONSELECT = 0x104
 
static const uint16 OPL3_REGISTER_NEW = 0x105
 
static const uint16 OPL_REGISTER_SET_2_OFFSET = 0x100
 
static const uint8 OPL_REGISTER_RHYTHM_OFFSETS []
 
static const uint8 OPL_MASK_LEVEL = 0x3F
 
static const uint8 OPL_MASK_FNUMHIGH_BLOCK = 0x1F
 
static const uint8 OPL_MASK_KEYON = 0x20
 
static const uint8 OPL_MASK_PANNING = 0x30
 
static const uint8 OPL_PANNING_CENTER = 0x30
 
static const uint8 OPL_PANNING_LEFT = 0x10
 
static const uint8 OPL_PANNING_RIGHT = 0x20
 
static OplInstrumentDefinition OPL_INSTRUMENT_BANK []
 
static OplInstrumentDefinition OPL_RHYTHM_BANK []
 
- Static Public Attributes inherited from MidiDriver_Multisource
static const uint8 MAXIMUM_SOURCES = 10
 
static const uint16 DEFAULT_SOURCE_NEUTRAL_VOLUME = 255
 
- Static Public Attributes inherited from MidiDriver
static const byte _mt32ToGm [128]
 
static const byte _gmToMt32 [128]
 
- Static Public Attributes inherited from MidiDriver_BASE
static const uint8 MIDI_CHANNEL_COUNT = 16
 
static const uint8 MIDI_RHYTHM_CHANNEL = 9
 
static const byte MIDI_COMMAND_NOTE_OFF = 0x80
 
static const byte MIDI_COMMAND_NOTE_ON = 0x90
 
static const byte MIDI_COMMAND_POLYPHONIC_AFTERTOUCH = 0xA0
 
static const byte MIDI_COMMAND_CONTROL_CHANGE = 0xB0
 
static const byte MIDI_COMMAND_PROGRAM_CHANGE = 0xC0
 
static const byte MIDI_COMMAND_CHANNEL_AFTERTOUCH = 0xD0
 
static const byte MIDI_COMMAND_PITCH_BEND = 0xE0
 
static const byte MIDI_COMMAND_SYSTEM = 0xF0
 
static const byte MIDI_CONTROLLER_BANK_SELECT_MSB = 0x00
 
static const byte MIDI_CONTROLLER_MODULATION = 0x01
 
static const byte MIDI_CONTROLLER_DATA_ENTRY_MSB = 0x06
 
static const byte MIDI_CONTROLLER_VOLUME = 0x07
 
static const byte MIDI_CONTROLLER_BALANCE = 0x08
 
static const byte MIDI_CONTROLLER_PANNING = 0x0A
 
static const byte MIDI_CONTROLLER_EXPRESSION = 0x0B
 
static const byte MIDI_CONTROLLER_BANK_SELECT_LSB = 0x20
 
static const byte MIDI_CONTROLLER_DATA_ENTRY_LSB = 0x26
 
static const byte MIDI_CONTROLLER_SUSTAIN = 0x40
 
static const byte MIDI_CONTROLLER_PORTAMENTO = 0x41
 
static const byte MIDI_CONTROLLER_SOSTENUTO = 0x42
 
static const byte MIDI_CONTROLLER_SOFT = 0x43
 
static const byte MIDI_CONTROLLER_REVERB = 0x5B
 
static const byte MIDI_CONTROLLER_CHORUS = 0x5D
 
static const byte MIDI_CONTROLLER_RPN_LSB = 0x64
 
static const byte MIDI_CONTROLLER_RPN_MSB = 0x65
 
static const byte MIDI_CONTROLLER_ALL_SOUND_OFF = 0x78
 
static const byte MIDI_CONTROLLER_RESET_ALL_CONTROLLERS = 0x79
 
static const byte MIDI_CONTROLLER_ALL_NOTES_OFF = 0x7B
 
static const byte MIDI_CONTROLLER_OMNI_ON = 0x7C
 
static const byte MIDI_CONTROLLER_OMNI_OFF = 0x7D
 
static const byte MIDI_CONTROLLER_MONO_ON = 0x7E
 
static const byte MIDI_CONTROLLER_POLY_ON = 0x7F
 
static const uint16 MIDI_RPN_PITCH_BEND_SENSITIVITY = 0x0000
 
static const uint16 MIDI_RPN_MASTER_TUNING_FINE = 0x0001
 
static const uint16 MIDI_RPN_MASTER_TUNING_COARSE = 0x0002
 
static const uint16 MIDI_RPN_NULL = 0x7F7F
 
static const uint8 MIDI_META_END_OF_TRACK = 0x2F
 
static const uint8 MIDI_META_SEQUENCER = 0x7F
 
static const uint16 MIDI_PITCH_BEND_DEFAULT = 0x2000
 
static const uint8 MIDI_PANNING_DEFAULT = 0x40
 
static const uint8 MIDI_EXPRESSION_DEFAULT = 0x7F
 
static const uint16 MIDI_MASTER_TUNING_FINE_DEFAULT = 0x2000
 
static const uint8 MIDI_MASTER_TUNING_COARSE_DEFAULT = 0x40
 
static const uint8 MT32_PITCH_BEND_SENSITIVITY_DEFAULT = 0x0C
 
static const uint8 GM_PITCH_BEND_SENSITIVITY_DEFAULT = 0x02
 
static const uint8 GS_RHYTHM_FIRST_NOTE = 0x1B
 
static const uint8 GS_RHYTHM_LAST_NOTE = 0x58
 
- Protected Attributes inherited from MidiDriver_ADLIB_Multisource
OPL::Config::OplType _oplType
 
OPL::OPL_opl
 
bool _isOpen
 
int _timerFrequency
 
AccuracyMode _accuracyMode
 
ChannelAllocationMode _allocationMode
 
InstrumentWriteMode _instrumentWriteMode
 
bool _rhythmModeIgnoreNoteOffs
 
bool _channel10Melodic
 
uint8 _defaultChannelVolume
 
NoteSelectMode _noteSelect
 
ModulationDepth _modulationDepth
 
VibratoDepth _vibratoDepth
 
bool _rhythmMode
 
OplInstrumentDefinition_instrumentBank
 
OplInstrumentDefinition_rhythmBank
 
uint8 _rhythmBankFirstNote
 
uint8 _rhythmBankLastNote
 
MidiChannelControlData _controlData [MAXIMUM_SOURCES][MIDI_CHANNEL_COUNT]
 
ActiveNote _activeNotes [OPL3_NUM_CHANNELS]
 
ActiveNote _activeRhythmNotes [5]
 
uint8 _channelAllocations [MAXIMUM_SOURCES][MIDI_CHANNEL_COUNT]
 
const uint8 * _melodicChannels
 
uint8 _numMelodicChannels
 
uint32 _noteCounter
 
float _oplFrequencyConversionFactor
 
uint8 _shadowRegisters [0x200]
 
Common::Mutex _allocationMutex
 
Common::Mutex _activeNotesMutex
 
- Protected Attributes inherited from MidiDriver_Multisource
MidiSource _sources [MAXIMUM_SOURCES]
 
ControllerDefaults _controllerDefaults
 
const byte * _instrumentRemapping
 
bool _userVolumeScaling
 
uint16 _userMusicVolume
 
uint16 _userSfxVolume
 
bool _userMute
 
Common::Mutex _fadingMutex
 
uint16 _fadeDelay
 
uint32 _timerRate
 
void * _timer_param
 
Common::TimerManager::TimerProc _timer_proc
 
- Protected Attributes inherited from MidiDriver_BASE
bool _midiDumpEnable
 
uint32 _prevMillis
 
Common::Array< byte > _midiDumpCache
 
- Static Protected Attributes inherited from MidiDriver_ADLIB_Multisource
static const uint8 OPL_LEVEL_DEFAULT = 0x3F
 
static const uint8 OPL_MIDI_PANNING_LEFT_LIMIT = 0x2F
 
static const uint8 OPL_MIDI_PANNING_RIGHT_LIMIT = 0x51
 
static const uint16 OPL_NOTE_FREQUENCIES []
 
static const uint8 OPL_VOLUME_LOOKUP []
 
- Static Protected Attributes inherited from MidiDriver_Multisource
static const uint16 FADING_DELAY = 25 * 1000
 

Detailed Description

Implementation of the AdLib code from the Worx Toolkit library, based on version 2.1, as used by Dark Seed (CD version). Implements the OPL channel allocation algorithm and note frequency and volume calculation.

TODO Implementation is incomplete, because Dark Seed does not use some functionality of the library:

  • OPL rhythm mode
  • Transpose controllers 0x68 and 0x69 (seems to be buggy)

Member Function Documentation

◆ allocateOplChannel()

uint8 Darkseed::MidiDriver_Worx_AdLib::allocateOplChannel ( uint8  channel,
uint8  source,
uint8  instrumentId 
)
overrideprotectedvirtual

Allocates an OPL channel to play a note on the specified MIDI channel and source with the specified instrument ID. Allocation behavior depends on the active channel allocation mode:

  • Dynamic: allocates an unused channel, a channel playing a note using the same instrument or the channel playing the oldest note. This will always allocate a channel to play the note. This is the same behavior as the Win95 SB16 driver.
  • Static: allocates an unused OPL channel and assigns it to the MIDI channel playing the note. All subsequent notes on this MIDI channel will be played using this OPL channel. If there are no free channels, it will fail to allocate a channel. The MIDI data must play one note at a time on each channel and not use more MIDI channels than there are OPL channels for this algorithm to work properly.
Parameters
channelThe MIDI channel on which the note is played.
sourceThe source playing the note.
instrumentIdThe ID of the instrument playing the note. Not used by the static channel allocation mode.
Returns
The number of the allocated OPL channel; 0xFF if allocation failed (not possible using the dynamic channel allocation mode).

Reimplemented from MidiDriver_ADLIB_Multisource.

◆ calculateFrequency()

uint16 Darkseed::MidiDriver_Worx_AdLib::calculateFrequency ( uint8  channel,
uint8  source,
uint8  note 
)
overrideprotectedvirtual

Calculates the OPL frequency (F-num) and octave (block) to play the specified note on the specified MIDI channel and source, taking into account the MIDI controllers pitch bend and (on accuracy mode GM) pitch bend sensitivity and master tuning. The result is returned in the format of the Ax (low byte) and Bx (high byte) OPL registers. Note that the MIDI note range exceeds the frequency range of an OPL chip, so the highest MIDI notes will be shifted down one or two octaves. The SB16 Win95 accuracy mode calculates the same frequencies as the Windows 95 SB16 driver. The GM accuracy mode is more accurate, but the calculations are more CPU intensive. This mode also supports pitch bend sensitivity (which is fixed at 2 semitones in SB16 Win95 mode) and master tuning.

Parameters
channelThe MIDI channel on which the note is played.
sourceThe source playing the note.
noteThe MIDI note which is played.
Returns
The F-num and block to play the note on the OPL chip.

Reimplemented from MidiDriver_ADLIB_Multisource.

◆ calculateUnscaledVolume()

uint8 Darkseed::MidiDriver_Worx_AdLib::calculateUnscaledVolume ( uint8  channel,
uint8  source,
uint8  velocity,
OplInstrumentDefinition instrumentDef,
uint8  operatorNum 
)
overrideprotectedvirtual

Calculates the unscaled volume for the specified operator of a note on the specified MIDI channel and source, using the specified MIDI velocity and instrument definition. The SB16 Win95 accuracy mode calculates the same values as the Windows 95 SB16 driver. The GM accuracy mode is more accurate to the volume curve in the General MIDI specification and supports the expression controller, but the calculation is more CPU intensive. The volume is returned as an OPL 2x register volume (level) value, i.e. 0 = maximum volume, 3F = minimum volume.

Parameters
channelThe MIDI channel on which the note is played.
sourceThe source playing the note.
velocityThe MIDI velocity of the note for which volume should be calculated.
instrumentDefThe instrument definition used to play the note.
operatorNumThe number of the operator for which volume should be calculated; 0-1 for 2 operator instruments, 0-3 for 4 operator instruments.
Returns
The calculated unscaled operator volume (level).

Reimplemented from MidiDriver_ADLIB_Multisource.


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