libkmid Library API Documentation

AlsaOut Class Reference

Sends MIDI events to a MIDI devices using ALSA. More...

#include <alsaout.h>

Inheritance diagram for AlsaOut:

MidiOut List of all members.

Public Member Functions

 AlsaOut (int d, int client=64, int port=0, const char *cname="", const char *pname="")
 Constructor.

virtual ~AlsaOut ()
 Destructor.

virtual void openDev (int sqfd)
 Opens the device.

virtual void closeDev ()
 Closes the device.

virtual void initDev ()
 Initializes the device sending generic standard midi events and controllers, such as changing the patches of each channel to an Acoustic Piano (000), setting the volume to a normal value, etc.

int deviceType () const
virtual const char * deviceName (void) const
 Returns the name and type of this MIDI device.

int rate (void)
virtual void noteOn (uchar chn, uchar note, uchar vel)
 See DeviceManager::noteOn().

virtual void noteOff (uchar chn, uchar note, uchar vel)
 See DeviceManager::noteOff().

virtual void keyPressure (uchar chn, uchar note, uchar vel)
 See DeviceManager::keyPressure().

virtual void chnPatchChange (uchar chn, uchar patch)
 See DeviceManager::chnPatchChange().

virtual void chnPressure (uchar chn, uchar vel)
 See DeviceManager::chnPressure().

virtual void chnPitchBender (uchar chn, uchar lsb, uchar msb)
 See DeviceManager::chnPitchBender().

virtual void chnController (uchar chn, uchar ctl, uchar v)
 See DeviceManager::chnController().

virtual void sysex (uchar *data, ulong size)
 See DeviceManager::sysex().

virtual void channelSilence (uchar chn)
 Mutes all notes being played on a given channel.

virtual void channelMute (uchar chn, int a)
 Mute or "unmute" a given channel .

virtual void setVolumePercentage (int volper)
 Change all channel volume events multiplying it by this percentage correction Instead of forcing a channel to a fixed volume, this method allows to music to fade out even when it was being played softly.

int ok (void)
 Returns true if everything's ok and false if there has been any problem.

virtual void wait (double ticks)
virtual void tmrSetTempo (int v)
virtual void tmrStart (int tpcn)
virtual void tmrStart ()
virtual void tmrStop ()
virtual void tmrContinue ()
void sync (int i=0)
 Sends the buffer to the device and returns when it's played, so you can synchronize XXX: sync should be virtual after next bic release.


Public Attributes

AlsaOutPrivate * di

Protected Member Functions

virtual void seqbuf_dump (void)
virtual void seqbuf_clean (void)
void eventInit (snd_seq_event_t *ev)
void eventSend (snd_seq_event_t *ep)
void timerEventSend (int type)

Protected Attributes

int ndevs
int nmidiports
double count
double lastcount
double lasttime
double begintime
int m_rate
double convertrate
long int time

Friends

class DeviceManager

Detailed Description

Sends MIDI events to a MIDI devices using ALSA.

Version:
0.9.5 17/01/2000
Author:
Antonio Larrosa Jimenez <larrosa@kde.org>

Definition at line 37 of file alsaout.h.


Constructor & Destructor Documentation

AlsaOut::AlsaOut int  d,
int  client = 64,
int  port = 0,
const char *  cname = "",
const char *  pname = ""
 

Constructor.

After constructing a MidiOut device, you must open it (using openDev() ). Additionally you may want to initialize it (with initDev() ),

Definition at line 111 of file alsaout.cc.

AlsaOut::~AlsaOut  )  [virtual]
 

Destructor.

It doesn't matter if you close the device (closeDev() ) before you destruct the object because in other case, it will be closed here.

Definition at line 126 of file alsaout.cc.

References closeDev().


Member Function Documentation

void AlsaOut::openDev int  sqfd  )  [virtual]
 

Opens the device.

This is generally called from DeviceManager , so you shouldn't call this yourself (except if you created the MidiOut object yourself.

Parameters:
sqfd a file descriptor of /dev/sequencer
See also:
closeDev

initDev

Reimplemented from MidiOut.

Definition at line 132 of file alsaout.cc.

void AlsaOut::closeDev  )  [virtual]
 

Closes the device.

It basically tells the device (the file descriptor) is going to be closed.

See also:
openDev

Reimplemented from MidiOut.

Definition at line 181 of file alsaout.cc.

References ok().

Referenced by ~AlsaOut().

void AlsaOut::initDev  )  [virtual]
 

Initializes the device sending generic standard midi events and controllers, such as changing the patches of each channel to an Acoustic Piano (000), setting the volume to a normal value, etc.

Reimplemented from MidiOut.

Definition at line 204 of file alsaout.cc.

References chnController(), chnPatchChange(), chnPitchBender(), chnPressure(), ok(), and sysex().

int AlsaOut::deviceType  )  const [inline]
 

Returns:
the device type of the object. This is to identify the inherited class that a given object is polymorphed to. The returned value is one of these :
  • KMID_EXTERNAL_MIDI if it's a MidiOut object
  • KMID_SYNTH if it's a SynthOut object (as an AWE device)
  • KMID_FM if it's a FMOut object
  • KMID_GUS if it's a GUSOut object
which are defined in midispec.h

See also:
deviceName

Reimplemented from MidiOut.

Definition at line 129 of file alsaout.h.

const char * AlsaOut::deviceName void   )  const [virtual]
 

Returns the name and type of this MIDI device.

See also:
deviceType

Reimplemented from MidiOut.

Definition at line 561 of file alsaout.cc.

void AlsaOut::noteOn uchar  chn,
uchar  note,
uchar  vel
[virtual]
 

See DeviceManager::noteOn().

Reimplemented from MidiOut.

Definition at line 291 of file alsaout.cc.

References MidiMapper::channel(), MidiMapper::key(), and noteOff().

void AlsaOut::noteOff uchar  chn,
uchar  note,
uchar  vel
[virtual]
 

See DeviceManager::noteOff().

Reimplemented from MidiOut.

Definition at line 313 of file alsaout.cc.

References MidiMapper::channel(), and MidiMapper::key().

Referenced by channelSilence(), and noteOn().

void AlsaOut::keyPressure uchar  chn,
uchar  note,
uchar  vel
[virtual]
 

See DeviceManager::keyPressure().

Reimplemented from MidiOut.

Definition at line 328 of file alsaout.cc.

References MidiMapper::channel(), and MidiMapper::key().

void AlsaOut::chnPatchChange uchar  chn,
uchar  patch
[virtual]
 

See DeviceManager::chnPatchChange().

Reimplemented from MidiOut.

Definition at line 340 of file alsaout.cc.

References MidiMapper::channel(), and MidiMapper::patch().

Referenced by initDev().

void AlsaOut::chnPressure uchar  chn,
uchar  vel
[virtual]
 

See DeviceManager::chnPressure().

Reimplemented from MidiOut.

Definition at line 357 of file alsaout.cc.

References MidiMapper::channel().

Referenced by initDev().

void AlsaOut::chnPitchBender uchar  chn,
uchar  lsb,
uchar  msb
[virtual]
 

See DeviceManager::chnPitchBender().

Reimplemented from MidiOut.

Definition at line 371 of file alsaout.cc.

References MidiMapper::channel(), and MidiMapper::pitchBender().

Referenced by initDev().

void AlsaOut::chnController uchar  chn,
uchar  ctl,
uchar  v
[virtual]
 

See DeviceManager::chnController().

Reimplemented from MidiOut.

Definition at line 387 of file alsaout.cc.

References MidiMapper::channel(), and MidiMapper::controller().

Referenced by initDev().

void AlsaOut::sysex uchar data,
ulong  size
[virtual]
 

See DeviceManager::sysex().

Reimplemented from MidiOut.

Definition at line 408 of file alsaout.cc.

Referenced by initDev().

void AlsaOut::channelSilence uchar  chn  )  [virtual]
 

Mutes all notes being played on a given channel.

Reimplemented from MidiOut.

Definition at line 424 of file alsaout.cc.

References noteOff().

Referenced by channelMute().

void AlsaOut::channelMute uchar  chn,
int  a
[virtual]
 

Mute or "unmute" a given channel .

Parameters:
chn channel to work on
b if true, the device will ignore subsequent notes played on the chn channel, and mute all notes being played on it. If b is false, the channel is back to work.

Reimplemented from MidiOut.

Definition at line 438 of file alsaout.cc.

References channelSilence().

virtual void AlsaOut::setVolumePercentage int  volper  )  [inline, virtual]
 

Change all channel volume events multiplying it by this percentage correction Instead of forcing a channel to a fixed volume, this method allows to music to fade out even when it was being played softly.

Parameters:
volper is an integer value, where 0 is quiet, 100 is used to send an unmodified value, 200 play music twice louder than it should, etc.

Reimplemented from MidiOut.

Definition at line 203 of file alsaout.h.

int AlsaOut::ok void   )  [inline]
 

Returns true if everything's ok and false if there has been any problem.

Reimplemented from MidiOut.

Definition at line 209 of file alsaout.h.

Referenced by closeDev(), and initDev().

void AlsaOut::sync int  i = 0  ) 
 

Sends the buffer to the device and returns when it's played, so you can synchronize XXX: sync should be virtual after next bic release.

Reimplemented from MidiOut.

Definition at line 497 of file alsaout.cc.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:15:59 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001