Source Code (Use browser search to find items of interest.)
Class Index
kdelibs'SynthOut (./kdelibs/libkmid/synthout.h:44)
class SynthOut : public MidiOut
{
private:
class SynthOutPrivate;
SynthOutPrivate *di;
public:
/**
* Constructor. See @ref MidiOut::MidiOut() for more information.
*/
SynthOut(int d=0);
/**
* Destructor.
*/
~SynthOut();
/**
* See @ref MidiOut::openDev()
*/
void openDev (int sqfd);
/**
* See @ref MidiOut::closeDev()
*/
void closeDev(void);
/**
* See @ref MidiOut::initDev()
*/
void initDev (void);
/**
* See @ref MidiOut::noteOn()
*/
void noteOn ( uchar chn, uchar note, uchar vel );
/**
* See @ref MidiOut::noteOff()
*/
void noteOff ( uchar chn, uchar note, uchar vel );
/**
* See @ref MidiOut::keyPressure()
*/
void keyPressure ( uchar chn, uchar note, uchar vel );
/**
* See @ref MidiOut::chnPatchChange()
*/
void chnPatchChange ( uchar chn, uchar patch );
/**
* See @ref MidiOut::chnPressure()
*/
void chnPressure ( uchar chn, uchar vel );
/**
* See @ref MidiOut::chnPitchBender()
*/
void chnPitchBender ( uchar chn, uchar lsb, uchar msb );
/**
* See @ref MidiOut::chnController()
*/
void chnController ( uchar chn, uchar ctl , uchar v );
/**
* It's an empty function, as AWE devices don't support System Exclusive
* messages
*/
void sysex ( uchar *data,ulong size);
};
kdelibs'SynthOut::SynthOut() (./kdelibs/libkmid/synthout.cc:46)
SynthOut::SynthOut(int d)
{
seqfd = -1;
devicetype=KMID_SYNTH;
device= d;
#ifdef HANDLETIMEINDEVICES
count=0.0;
lastcount=0.0;
rate=100;
#endif
_ok=1;
}
kdelibs'SynthOut::~SynthOut() (./kdelibs/libkmid/synthout.cc:59)
SynthOut::~SynthOut()
{
delete map;
closeDev();
}
kdelibs'SynthOut::openDev() (./kdelibs/libkmid/synthout.cc:65)
void SynthOut::openDev (int sqfd)
{
_ok=1;
seqfd = sqfd;
if (seqfd==-1)
{
printfdebug("ERROR: Could not open /dev/sequencer\n");
return;
}
#ifdef HAVE_OSS_SUPPORT
#ifdef HANDLETIMEINDEVICES
ioctl(seqfd,SNDCTL_SEQ_NRSYNTHS,&ndevs);
ioctl(seqfd,SNDCTL_SEQ_NRMIDIS,&nmidiports);
rate=0;
int r=ioctl(seqfd,SNDCTL_SEQ_CTRLRATE,&rate);
if ((r==-1)||(rate<=0)) rate=HZ;
convertrate=1000/rate;
/*
int i=1;
ioctl(seqfd,SNDCTL_SEQ_THRESHOLD,i);
printfdebug("Threshold : %d\n",i);
*/
#ifdef SYNTHOUTDEBUG
printfdebug("Number of synth devices : %d\n",ndevs);
printfdebug("Number of midi ports : %d\n",nmidiports);
printfdebug("Rate : %d\n",rate);
#endif
count=0.0;
lastcount=0.0;
#endif
#ifdef HAVE_AWE32
struct synth_info info;
// Should really collect the possible devices and let the user choose ?
info.device = device;
if (ioctl (seqfd, SNDCTL_SYNTH_INFO, &info) == -1)
printfdebug(" ioctl SNDCTL_SYNTH_INFO FAILED \n");
if (info.synth_type == SYNTH_TYPE_SAMPLE
&& info.synth_subtype == SAMPLE_TYPE_AWE32)
{
// Enable layered patches ....
AWE_SET_CHANNEL_MODE(device,1);
#ifdef SYNTHOUTDEBUG
printfdebug(" Found AWE32 dev=%d \n",device);
#endif
}
#endif // HAVE_AWE32
#endif // HAVE_OSS_SUPPORT
}
kdelibs'SynthOut::closeDev() (./kdelibs/libkmid/synthout.cc:123)
void SynthOut::closeDev (void)
{
if (!ok()) return;
#ifdef HANDLETIMEINDEVICES
SEQ_STOP_TIMER();
SEQ_DUMPBUF();
#endif
//if (seqfd>=0) close(seqfd);
seqfd=-1;
}
kdelibs'SynthOut::initDev() (./kdelibs/libkmid/synthout.cc:134)
void SynthOut::initDev (void)
{
#ifdef HAVE_OSS_SUPPORT
int chn;
if (!ok()) return;
#ifdef HANDLETIMEINDEVICES
count=0.0;
lastcount=0.0;
#endif
uchar gm_reset[5]={0x7e, 0x7f, 0x09, 0x01, 0xf7};
sysex(gm_reset, sizeof(gm_reset));
for (chn=0;chn<16;chn++)
{
chnmute[chn]=0;
chnPatchChange(chn,0);
chnPressure(chn,127);
chnPitchBender(chn, 0x00, 0x40);
chnController(chn, CTL_MAIN_VOLUME,127);
chnController(chn, CTL_EXT_EFF_DEPTH, 0);
chnController(chn, CTL_CHORUS_DEPTH, 0);
chnController(chn, 0x4a, 127);
}
#endif
}
kdelibs'SynthOut::noteOn() (./kdelibs/libkmid/synthout.cc:159)
void SynthOut::noteOn (uchar chn, uchar note, uchar vel)
{
if (vel==0)
{
noteOff(chn,note,vel);
}
else
{
SEQ_START_NOTE(device, map->channel(chn),
map->key(chn,chnpatch[chn],note),
vel);
}
#ifdef SYNTHOUTDEBUG
printfdebug("Note ON >\t chn : %d\tnote : %d\tvel: %d\n",chn,note,vel);
#endif
}
kdelibs'SynthOut::noteOff() (./kdelibs/libkmid/synthout.cc:176)
void SynthOut::noteOff (uchar chn, uchar note, uchar)
{
SEQ_STOP_NOTE(device, map->channel(chn),
map->key(chn,chnpatch[chn],note), 0);
#ifdef SYNTHOUTDEBUG
printfdebug("Note OFF >\t chn : %d\tnote : %d\tvel: %d\n",chn,note,vel);
#endif
}
kdelibs'SynthOut::keyPressure() (./kdelibs/libkmid/synthout.cc:185)
void SynthOut::keyPressure (uchar chn, uchar note, uchar vel)
{
SEQ_KEY_PRESSURE(device, map->channel(chn), map->key(chn,chnpatch[chn],note),vel);
}
kdelibs'SynthOut::chnPatchChange() (./kdelibs/libkmid/synthout.cc:190)
void SynthOut::chnPatchChange (uchar chn, uchar patch)
{
SEQ_SET_PATCH(device,map->channel(chn),map->patch(chn,patch));
chnpatch[chn]=patch;
}
kdelibs'SynthOut::chnPressure() (./kdelibs/libkmid/synthout.cc:196)
void SynthOut::chnPressure (uchar chn, uchar vel)
{
SEQ_CHN_PRESSURE(device, map->channel(chn) , vel);
chnpressure[chn]=vel;
}
kdelibs'SynthOut::chnPitchBender() (./kdelibs/libkmid/synthout.cc:202)
void SynthOut::chnPitchBender(uchar chn,uchar lsb, uchar msb)
{
chnbender[chn]=((int)msb<<7) | (lsb & 0x7F);
SEQ_BENDER(device, map->channel(chn), chnbender[chn]);
}
kdelibs'SynthOut::chnController() (./kdelibs/libkmid/synthout.cc:208)
void SynthOut::chnController (uchar chn, uchar ctl, uchar v)
{
if ((ctl==11)||(ctl==7))
{
v=(v*volumepercentage)/100;
if (v>127) v=127;
}
SEQ_CONTROL(device, map->channel(chn), ctl, v);
chncontroller[chn][ctl]=v;
}
kdelibs'SynthOut::sysex() (./kdelibs/libkmid/synthout.cc:220)
void SynthOut::sysex(uchar *, ulong )
{
// AWE32 doesn't respond to sysex (AFAIK)
/*
#ifndef HAVE_AWE32
ulong i=0;
SEQ_MIDIOUT(device, MIDI_SYSTEM_PREFIX);
while (i<size)
{
SEQ_MIDIOUT(device, *data);
data++;
i++;
};
printfdebug("sysex\n");
#endif
*/
}