# class MidiOut | Sends MIDI events to external MIDI devices. More...
Definition | `#include <midiout.h>`
Inherited by | AlsaOut, FMOut, GUSOut, SynthOut
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- MidiOut (int d=0)
- virtual ~MidiOut ()
- virtual void openDev (int sqfd)
- virtual void closeDev ()
- virtual void initDev ()
- int deviceType () const
- const char * deviceName (void) const
- void setMidiMapper ( MidiMapper *map )
- virtual void noteOn ( uchar chn, uchar note, uchar vel )
- virtual void noteOff ( uchar chn, uchar note, uchar vel )
- virtual void keyPressure ( uchar chn, uchar note, uchar vel )
- virtual void chnPatchChange ( uchar chn, uchar patch )
- virtual void chnPressure ( uchar chn, uchar vel )
- virtual void chnPitchBender ( uchar chn, uchar lsb, uchar msb )
- virtual void chnController ( uchar chn, uchar ctl , uchar v )
- virtual void sysex ( uchar *data,ulong size)
- virtual void channelSilence ( uchar chn )
- virtual void channelMute ( uchar chn, int a )
- virtual void setVolumePercentage ( int volper )
- int ok (void)
- const char * midiMapFilename ()

#### Protected Methods

- void seqbuf_dump (void)
- void seqbuf_clean (void)

#### Protected Members

- int seqfd
- int device
- int devicetype
- int volumepercentage
- MidiMapper *map
- uchar chnpatch [16]
- int chnbender [16]
- uchar chnpressure [16]
- uchar chncontroller [16][256]
- int chnmute [16]
- int _ok

## Detailed Description

External MIDI port output class . This class is used to send midi events to external midi devices.

MidiOut is inherited by other MIDI devices classes (like SynthOut or FMOut) to support a common API.

In general, you don't want to use MidiOut directly, but within a DeviceManager object, which is the preferred way to generate music.

If you want to add support for other devices (I don't think there are any) you just have to create a class that inherits from MidiOut and create one object of your new class in DeviceManager::initManager().

int seqfd | ### seqfd

[protected]

int device | ### device

[protected]

int devicetype | ### devicetype

[protected]

int volumepercentage | ### volumepercentage

[protected]

MidiMapper * map | ### map

[protected]

uchar chnpatch [16] | ### chnpatch [16]

[protected]

int chnbender [16] | ### chnbender [16]

[protected]

uchar chnpressure [16] | ### chnpressure [16]

[protected]

uchar chncontroller [16][256] | ### chncontroller [16][256]

[protected]

int chnmute [16] | ### chnmute [16]

[protected]

int _ok | ### _ok

[protected]

void seqbuf_dump (void) | ### seqbuf_dump

[protected]

This is the /dev/sequencer file handler. Remember _not_to_close_ it on MidiOut, but just on DeviceManager

void seqbuf_clean (void) | ### seqbuf_clean

[protected]

MidiOut (int d=0) | ### MidiOut

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

~MidiOut () | ### ~MidiOut

[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.

void openDev (int sqfd) | ### openDev

[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

void closeDev () | ### closeDev

[virtual]

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

See also: openDev

void initDev () | ### 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.

int deviceType () | ### deviceType

[const]

- 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

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 :

See also: deviceName

const char * deviceName (void) | ### deviceName

[const]

Returns the name and type of this MIDI device.

See also: deviceType

void setMidiMapper ( MidiMapper *map ) | ### setMidiMapper

Sets a MidiMapper object to be used to modify the midi events before sending them.

Parameters:

map | the MidiMapper to use.

See also: MidiMapper, midiMapFilename

void noteOn ( uchar chn, uchar note, uchar vel ) | ### noteOn

[virtual]

See DeviceManager::noteOn()

void noteOff ( uchar chn, uchar note, uchar vel ) | ### noteOff

[virtual]

See DeviceManager::noteOff()

void keyPressure ( uchar chn, uchar note, uchar vel ) | ### keyPressure

[virtual]

See DeviceManager::keyPressure()

void chnPatchChange ( uchar chn, uchar patch ) | ### chnPatchChange

[virtual]

See DeviceManager::chnPatchChange()

void chnPressure ( uchar chn, uchar vel ) | ### chnPressure

[virtual]

See DeviceManager::chnPressure()

void chnPitchBender ( uchar chn, uchar lsb, uchar msb ) | ### chnPitchBender

[virtual]

See DeviceManager::chnPitchBender()

void chnController ( uchar chn, uchar ctl , uchar v ) | ### chnController

[virtual]

See DeviceManager::chnController()

void sysex ( uchar *data,ulong size) | ### sysex

[virtual]

See DeviceManager::sysex()

void channelSilence ( uchar chn ) | ### channelSilence

[virtual]

Mutes all notes being played on a given channel.

void channelMute ( uchar chn, int a ) | ### channelMute

[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.

void setVolumePercentage ( int volper ) | ### setVolumePercentage

[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.

int ok (void) | ### ok

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

const char * midiMapFilename () | ### midiMapFilename

Returns the path to the file where the current used MidiMapper object reads the configuration from, or an empty string if there's no MidiMapper.

- Version: 0.9.5 17/01/2000
- Author: Antonio Larrosa Jimenez <larrosa@kde.org>
- Generated: root@i386.ports.openbsd.org on Wed Apr 25 13:59:16 2001, using kdoc 2.0a53.