FMOplMidiDriver Class Reference

#include <FMOplMidiDriver.h>

Inheritance diagram for FMOplMidiDriver:

LowLevelMidiDriver MidiDriver XMidiSequenceHandler List of all members.

Public Member Functions

 FMOplMidiDriver ()

Static Public Member Functions

static const MidiDriverDesc * getDesc ()

Protected Member Functions

virtual int open ()
virtual void close ()
virtual void send (uint32 b)
virtual void lowLevelProduceSamples (sint16 *samples, uint32 num_samples)
virtual bool isSampleProducer ()
virtual bool isFMSynth ()
virtual void loadTimbreLibrary (IDataSource *, TimbreLibraryType type)

Private Types

 ADLIB_MELODIC = 0
 ADLIB_RYTHM = 1
enum  { ADLIB_MELODIC = 0, ADLIB_RYTHM = 1 }

Private Member Functions

void midi_write_adlib (unsigned int reg, unsigned char val)
void midi_fm_instrument (int voice, unsigned char *inst)
int midi_calc_volume (int chan, int vel)
void midi_update_volume (int chan)
void midi_fm_volume (int voice, int volume)
void midi_fm_playnote (int voice, int note, int volume, int pitchbend)
void midi_fm_endnote (int voice)
void loadXMIDITimbres (IDataSource *ds)
void loadU7VoiceTimbres (IDataSource *ds)

Static Private Member Functions

static MidiDrivercreateInstance ()

Private Attributes

unsigned char adlib_data [256]
int chp [9][4]
unsigned char myinsbank [128][12]
xmidibankxmidibanks [128]
FMOpl_Pentagram::FM_OPLopl
midi_channel ch [16]

Static Private Attributes

static const MidiDriverDesc desc
static const unsigned char midi_fm_instruments_table [128][11]
static const int my_midi_fm_vol_table [128]
static int lucas_fm_vol_table [128]
static const unsigned char adlib_opadd [9]
static const int fnums [12]
static const double bend_fine [256]
static const double bend_coarse [128]

Classes

struct  midi_channel
struct  xmidibank

Detailed Description

Definition at line 29 of file FMOplMidiDriver.h.


Member Enumeration Documentation

anonymous enum [private]

Enumerator:
ADLIB_MELODIC 
ADLIB_RYTHM 

Definition at line 78 of file FMOplMidiDriver.h.


Constructor & Destructor Documentation

FMOplMidiDriver::FMOplMidiDriver (  ) 

Definition at line 209 of file FMOplMidiDriver.cpp.

Referenced by createInstance().


Member Function Documentation

void FMOplMidiDriver::close (  )  [protected, virtual]

Close the Midi Device.

Implements LowLevelMidiDriver.

Definition at line 273 of file FMOplMidiDriver.cpp.

References opl, FMOpl_Pentagram::OPLDestroy(), and xmidibanks.

static MidiDriver* FMOplMidiDriver::createInstance (  )  [inline, static, private]

Definition at line 32 of file FMOplMidiDriver.h.

References FMOplMidiDriver().

static const MidiDriverDesc* FMOplMidiDriver::getDesc (  )  [inline, static]

Definition at line 37 of file FMOplMidiDriver.h.

References desc.

Referenced by InitMidiDriverVector().

virtual bool FMOplMidiDriver::isFMSynth (  )  [inline, protected, virtual]

Is this a FM Synth and should use the Adlib Tracks?

Reimplemented from MidiDriver.

Definition at line 49 of file FMOplMidiDriver.h.

virtual bool FMOplMidiDriver::isSampleProducer (  )  [inline, protected, virtual]

Is this a Software Synth/Sample producer.

Reimplemented from MidiDriver.

Definition at line 48 of file FMOplMidiDriver.h.

void FMOplMidiDriver::loadTimbreLibrary ( IDataSource ,
TimbreLibraryType  type 
) [protected, virtual]

Reimplemented from LowLevelMidiDriver.

Definition at line 804 of file FMOplMidiDriver.cpp.

References ch, loadU7VoiceTimbres(), loadXMIDITimbres(), MidiDriver::TIMBRE_LIBRARY_U7VOICE_AD, MidiDriver::TIMBRE_LIBRARY_XMIDI_AD, and xmidibanks.

void FMOplMidiDriver::loadU7VoiceTimbres ( IDataSource ds  )  [private]

Definition at line 908 of file FMOplMidiDriver.cpp.

References ch, FMOplMidiDriver::xmidibank::insbank, IDataSource::read(), IDataSource::read1(), IDataSource::read2(), and xmidibanks.

Referenced by loadTimbreLibrary().

void FMOplMidiDriver::loadXMIDITimbres ( IDataSource ds  )  [private]

Definition at line 822 of file FMOplMidiDriver.cpp.

References ch, IDataSource::getPos(), IDataSource::getSize(), FMOplMidiDriver::xmidibank::insbank, IDataSource::read(), IDataSource::read1(), IDataSource::read2(), IDataSource::read4(), IDataSource::seek(), IDataSource::skip(), and xmidibanks.

Referenced by loadTimbreLibrary(), and open().

void FMOplMidiDriver::lowLevelProduceSamples ( sint16 samples,
uint32  num_samples 
) [protected, virtual]

Allows LowLevelMidiDrivers to produce samples.

Reimplemented from LowLevelMidiDriver.

Definition at line 292 of file FMOplMidiDriver.cpp.

References opl, LowLevelMidiDriver::stereo, FMOpl_Pentagram::YM3812UpdateOne_Mono(), and FMOpl_Pentagram::YM3812UpdateOne_Stereo().

int FMOplMidiDriver::midi_calc_volume ( int  chan,
int  vel 
) [private]

Definition at line 302 of file FMOplMidiDriver.cpp.

References ch, FMOplMidiDriver::midi_channel::expression, my_midi_fm_vol_table, and FMOplMidiDriver::midi_channel::vol.

Referenced by midi_update_volume(), and send().

void FMOplMidiDriver::midi_fm_endnote ( int  voice  )  [private]

Definition at line 799 of file FMOplMidiDriver.cpp.

References adlib_data, and midi_write_adlib().

Referenced by send().

void FMOplMidiDriver::midi_fm_instrument ( int  voice,
unsigned char *  inst 
) [private]

Definition at line 586 of file FMOplMidiDriver.cpp.

References adlib_opadd, and midi_write_adlib().

Referenced by send().

void FMOplMidiDriver::midi_fm_playnote ( int  voice,
int  note,
int  volume,
int  pitchbend 
) [private]

Definition at line 763 of file FMOplMidiDriver.cpp.

References bend_coarse, bend_fine, fnums, PentZip::int(), midi_fm_volume(), and midi_write_adlib().

Referenced by send().

void FMOplMidiDriver::midi_fm_volume ( int  voice,
int  volume 
) [private]

Definition at line 639 of file FMOplMidiDriver.cpp.

References adlib_data, adlib_opadd, and midi_write_adlib().

Referenced by midi_fm_playnote(), midi_update_volume(), and send().

void FMOplMidiDriver::midi_update_volume ( int  chan  )  [private]

Definition at line 629 of file FMOplMidiDriver.cpp.

References chp, midi_calc_volume(), and midi_fm_volume().

Referenced by send().

void FMOplMidiDriver::midi_write_adlib ( unsigned int  reg,
unsigned char  val 
) [private]

Definition at line 555 of file FMOplMidiDriver.cpp.

References adlib_data, opl, and FMOpl_Pentagram::OPLWrite().

Referenced by midi_fm_endnote(), midi_fm_instrument(), midi_fm_playnote(), midi_fm_volume(), and send().

int FMOplMidiDriver::open (  )  [protected, virtual]

Open the Midi Device

Returns:
0 on sucess. Non zero on failure.

Implements LowLevelMidiDriver.

Definition at line 216 of file FMOplMidiDriver.cpp.

References ch, chp, FMOplMidiDriver::midi_channel::expression, GameData::get_instance(), MusicFlex::getAdlibTimbres(), GameData::getMusic(), PentZip::int(), loadXMIDITimbres(), lucas_fm_vol_table, midi_fm_instruments_table, my_midi_fm_vol_table, myinsbank, FMOplMidiDriver::midi_channel::nshift, FMOplMidiDriver::midi_channel::on, opl, FMOpl_Pentagram::OPLCreate(), FMOplMidiDriver::midi_channel::pan, perr, FMOplMidiDriver::midi_channel::pitchbend, LowLevelMidiDriver::sample_rate, FMOplMidiDriver::midi_channel::vol, FMOplMidiDriver::midi_channel::xmidi, FMOplMidiDriver::midi_channel::xmidi_bank, and xmidibanks.

void FMOplMidiDriver::send ( uint32  b  )  [protected, virtual]

Send a message to the Midi Device.

Implements LowLevelMidiDriver.

Definition at line 321 of file FMOplMidiDriver.cpp.

References adlib_opadd, ch, NS_TIMIDITY::channel, chp, FMOplMidiDriver::midi_channel::expression, FMOplMidiDriver::xmidibank::insbank, FMOplMidiDriver::midi_channel::inum, midi_calc_volume(), midi_fm_endnote(), midi_fm_instrument(), midi_fm_playnote(), midi_fm_volume(), midi_update_volume(), midi_write_adlib(), myinsbank, opl, FMOpl_Pentagram::OPLSetPan(), FMOplMidiDriver::midi_channel::pan, FMOplMidiDriver::midi_channel::pitchbend, FMOplMidiDriver::midi_channel::vol, FMOplMidiDriver::midi_channel::xmidi_bank, and xmidibanks.


Member Data Documentation

unsigned char FMOplMidiDriver::adlib_data[256] [private]

Definition at line 90 of file FMOplMidiDriver.h.

Referenced by midi_fm_endnote(), midi_fm_volume(), and midi_write_adlib().

const unsigned char FMOplMidiDriver::adlib_opadd [static, private]

Initial value:

 { 
        0x00, 0x01, 0x02, 0x08, 0x09, 0x0A, 0x10, 0x11, 0x12 
}

Definition at line 57 of file FMOplMidiDriver.h.

Referenced by midi_fm_instrument(), midi_fm_volume(), and send().

const double FMOplMidiDriver::bend_coarse [static, private]

Definition at line 60 of file FMOplMidiDriver.h.

Referenced by midi_fm_playnote().

const double FMOplMidiDriver::bend_fine [static, private]

Definition at line 59 of file FMOplMidiDriver.h.

Referenced by midi_fm_playnote().

midi_channel FMOplMidiDriver::ch[16] [private]

Definition at line 100 of file FMOplMidiDriver.h.

Referenced by loadTimbreLibrary(), loadU7VoiceTimbres(), loadXMIDITimbres(), midi_calc_volume(), open(), and send().

int FMOplMidiDriver::chp[9][4] [private]

Definition at line 93 of file FMOplMidiDriver.h.

Referenced by midi_update_volume(), open(), and send().

const MidiDriver::MidiDriverDesc FMOplMidiDriver::desc [static, private]

Initial value:

Definition at line 31 of file FMOplMidiDriver.h.

Referenced by getDesc().

const int FMOplMidiDriver::fnums [static, private]

Initial value:

        {       0x16b, 0x181, 0x198, 0x1b0, 
                0x1ca, 0x1e5, 0x202, 0x220, 
                0x241, 0x263, 0x287, 0x2ae }

Definition at line 58 of file FMOplMidiDriver.h.

Referenced by midi_fm_playnote().

int FMOplMidiDriver::lucas_fm_vol_table [static, private]

Definition at line 56 of file FMOplMidiDriver.h.

Referenced by open().

const unsigned char FMOplMidiDriver::midi_fm_instruments_table [static, private]

Definition at line 54 of file FMOplMidiDriver.h.

Referenced by open().

const int FMOplMidiDriver::my_midi_fm_vol_table [static, private]

Initial value:

 {
        0, 11, 16, 19, 22, 25, 27, 29, 32, 33, 35, 37, 39, 40, 42, 43,
        45, 46, 48, 49, 50, 51, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
        64, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77,
        78, 79, 80, 80, 81, 82, 83, 83, 84, 85, 86, 86, 87, 88, 89, 89,
        90, 91, 91, 92, 93, 93, 94, 95, 96, 96, 97, 97, 98, 99, 99, 100,
        101, 101, 102, 103, 103, 104, 104, 105, 106, 106, 107, 107, 108,
        109, 109, 110, 110, 111, 112, 112, 113, 113, 114, 114, 115, 115,
        116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122,
        123, 123, 124, 124, 125, 125, 126, 126, 127
}

Definition at line 55 of file FMOplMidiDriver.h.

Referenced by midi_calc_volume(), and open().

unsigned char FMOplMidiDriver::myinsbank[128][12] [private]

Definition at line 94 of file FMOplMidiDriver.h.

Referenced by open(), and send().

FMOpl_Pentagram::FM_OPL* FMOplMidiDriver::opl [private]

Definition at line 99 of file FMOplMidiDriver.h.

Referenced by close(), lowLevelProduceSamples(), midi_write_adlib(), open(), and send().

xmidibank* FMOplMidiDriver::xmidibanks[128] [private]

Definition at line 95 of file FMOplMidiDriver.h.

Referenced by close(), loadTimbreLibrary(), loadU7VoiceTimbres(), loadXMIDITimbres(), open(), and send().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:29:13 2007 for pentagram by  doxygen 1.4.7