Source Code (Use browser search to find items of interest.)
Class Index
kdelibs'MidiStatus (./kdelibs/libkmid/midistat.h:40)
class MidiStatus
{
private:
class MidiStatusPrivate;
MidiStatusPrivate *d;
ulong tempo;
unsigned char chn_patch [16];
int chn_bender [16];
unsigned char chn_pressure[16];
unsigned char chn_controller[16][256];
int chn_lastisvolumeev[16];
public:
/**
* Constructor.
*/
MidiStatus();
/**
* Destructor.
*/
~MidiStatus();
// void noteOn ( uchar chn, uchar note, uchar vel );
// void noteOff ( uchar chn, uchar note, uchar vel );
/**
* Stores a new value for the key aftertouch.
* @see MidiOut::keyPressure()
*/
void keyPressure ( uchar chn, uchar note, uchar vel );
/**
* Stores a new patch in channel @p chn.
* @see #chnPatch()
* @see MidiOut::chnPatchChange()
*/
void chnPatchChange ( uchar chn, uchar patch );
/**
* Returns the patch currently used in channel @p chn.
*/
uchar chnPatch ( uchar chn ) { return chn_patch[chn]; };
/**
* Stores a new channel pressure value in channel @p chn.
* @see MidiOut::chnPressure()
*/
void chnPressure ( uchar chn, uchar vel );
/**
* Returns the pressure value currently used in channel @p chn.
*/
uchar chnPressure ( uchar chn ) { return chn_pressure[chn]; };
/**
* Stores a new pitch bender value in channel chn
*/
void chnPitchBender ( uchar chn, uchar lsb, uchar msb );
/**
* Returns the pitch bender value used in channel @p chn
*/
int chnPitchBender ( uchar chn) { return chn_bender[chn]; };
/**
* Stores a new value for controller @p ctl in channel @p chn.
*/
void chnController ( uchar chn, uchar ctl , uchar v );
/**
* Returns the value used for controller @ctl in channel @chn
*/
uchar chnController ( uchar chn, uchar ctl )
{ return chn_controller[chn][ctl]; };
/**
* Stores a sysex message that will be send in the next call to sendData
*/
void sysex ( uchar *data, ulong size);
/**
* Sets the tempo.
*
* @see DeviceManager::tmrSetTempo()
*/
void tmrSetTempo ( int v );
/**
* Sends the current MIDI state to the @ref DeviceManager object used as
* parameter (you should have already set the default device to the one you
* want to use). The @p gm parameter specifies if the patches used follow
* the GM standard (1), or follow the MT32 standard (0), in which case, they
* will be converted to GM before being sent.
*/
void sendData ( class DeviceManager *midi, int gm=1 );
};
kdelibs'MidiStatus::MidiStatus() (./kdelibs/libkmid/midistat.cc:36)
MidiStatus::MidiStatus()
{
int i;
tempo=1000000;
for (int chn=0;chn<16;chn++)
{
chn_patch[chn]=0;
chn_bender[chn]=0x4000;
chn_pressure[chn]=127;
for (i=0;i<256;i++)
chn_controller[chn][i]=0;
chn_controller[chn][CTL_MAIN_VOLUME]=127;
chn_controller[chn][11]=127;
chn_controller[chn][0x4a]=127;
chn_lastisvolumeev[chn]=1;
}
}
kdelibs'MidiStatus::~MidiStatus() (./kdelibs/libkmid/midistat.cc:54)
MidiStatus::~MidiStatus()
{
}
// void noteOn ( uchar chn, uchar note, uchar vel );
// void noteOff ( uchar chn, uchar note, uchar vel );
kdelibs'MidiStatus::chnPatchChange() (./kdelibs/libkmid/midistat.cc:61)
void MidiStatus::chnPatchChange ( uchar chn, uchar patch )
{
chn_patch[chn]=patch;
}
kdelibs'MidiStatus::chnPressure() (./kdelibs/libkmid/midistat.cc:66)
void MidiStatus::chnPressure ( uchar chn, uchar vel )
{
chn_pressure[chn]=vel;
}
kdelibs'MidiStatus::chnPitchBender() (./kdelibs/libkmid/midistat.cc:71)
void MidiStatus::chnPitchBender ( uchar chn, uchar lsb, uchar msb )
{
chn_bender[chn]=((int)msb<<8|lsb);
}
kdelibs'MidiStatus::chnController() (./kdelibs/libkmid/midistat.cc:76)
void MidiStatus::chnController ( uchar chn, uchar ctl , uchar v )
{
if (ctl==7) chn_lastisvolumeev[chn]=1;
else if (ctl==11) chn_lastisvolumeev[chn]=0;
chn_controller[chn][ctl]=v;
}
kdelibs'MidiStatus::tmrSetTempo() (./kdelibs/libkmid/midistat.cc:84)
void MidiStatus::tmrSetTempo(int v)
{
tempo=v;
}
kdelibs'MidiStatus::sendData() (./kdelibs/libkmid/midistat.cc:89)
void MidiStatus::sendData(DeviceManager *midi,int gm)
{
for (int chn=0;chn<16;chn++)
{
#ifdef MIDISTATDEBUG
printf("Restoring channel %d\n",chn);
#endif
midi->chnPatchChange(chn,
(gm==1)?(chn_patch[chn]):(MT32toGM[chn_patch[chn]]));
midi->chnPitchBender(chn,chn_bender[chn]&0xFF,chn_bender[chn]>>8);
midi->chnPressure(chn,chn_pressure[chn]);
if (chn_lastisvolumeev[chn])
{
midi->chnController(chn,11,chn_controller[chn][11]);
midi->chnController(chn,CTL_MAIN_VOLUME,chn_controller[chn][CTL_MAIN_VOLUME]);
} else {
midi->chnController(chn,CTL_MAIN_VOLUME,chn_controller[chn][CTL_MAIN_VOLUME]);
midi->chnController(chn,11,chn_controller[chn][11]);
}
/*
for (int i=0;i<256;i++)
midi->chnController(chn,i,chn_controller[chn][i]);
*/
}
midi->tmrSetTempo(tempo);
midi->sync();
}